@rig-c/review 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/REVIEW_PACKAGE.md +243 -28
- package/docs/STABILITY.md +88 -12
- package/package.json +1 -1
- package/src/canonical-json.ts +14 -0
- package/src/feedback-export.ts +2 -2
- package/src/interview-project.ts +27 -19
- package/src/interview-scene.ts +18 -11
- package/src/job-act.ts +99 -12
- package/src/job-api.ts +185 -38
- package/src/job-checkpoint-evidence.ts +19 -6
- package/src/job-cli.ts +12 -6
- package/src/job-contract.ts +91 -15
- package/src/job-front.ts +100 -78
- package/src/job-host.ts +9 -2
- package/src/job-previous-draft.ts +37 -0
- package/src/job-session.ts +76 -41
- package/src/job-source.ts +196 -35
- package/src/manifest.ts +43 -14
- package/src/mesh-edit.ts +7 -1
- package/src/parts-comment-crops.ts +15 -3
- package/src/parts-comparison.ts +21 -8
- package/src/parts-view.ts +23 -8
- package/web/catalog-en.ts +10 -0
- package/web/catalog-ko.ts +10 -0
- package/web/job-rig-screen.ts +63 -21
- package/web/job-session.ts +54 -26
- package/web/main.ts +158 -50
- package/web/mesh-editor.ts +123 -13
- package/web/part-selection.ts +1 -1
- package/web/parts-viewport-provider.ts +46 -11
- package/web/rig-host.ts +5 -3
- package/web/stage-comments.ts +77 -14
- package/web/styles.css +2 -0
- package/web/workspace-layout.ts +10 -0
- package/web/workspace-ui.ts +2 -2
- package/src/create-pin-gate.ts +0 -3
package/src/feedback-export.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {parseCommentsSession} from './session.ts';
|
|
|
13
13
|
import {projectComments} from './stage-comment.ts';
|
|
14
14
|
import type {ReviewCommentsSession, JobCommentFeedbackAnchor, JobCommentPartsAnchor} from './job-contract.ts';
|
|
15
15
|
import type {PartsIssue} from './parts-comment.ts';
|
|
16
|
-
import type {JobComment, JobActValues, ActV3, JobCommentsAct} from './job-contract.ts';
|
|
16
|
+
import type {JobComment, JobActValues, ActV3, JobCommentsAct, JobContextCommentsAct, JobMeshEditsAct} from './job-contract.ts';
|
|
17
17
|
import type {CompareFeedback} from './compare-session.ts';
|
|
18
18
|
import {parseRecordAct} from './job-api.ts';
|
|
19
19
|
|
|
@@ -51,7 +51,7 @@ export function legacyRecordActComments(raw: unknown): {text: string}[] {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** Display projection of already-decoded @2–@5 acts, without upgrading their envelopes. */
|
|
54
|
-
export function legacyActComments(act: Exclude<ActV3, JobCommentsAct>): {text: string}[] {
|
|
54
|
+
export function legacyActComments(act: Exclude<ActV3, JobCommentsAct | JobContextCommentsAct | JobMeshEditsAct>): {text: string}[] {
|
|
55
55
|
if (act.kind === 'interview-picks') return [];
|
|
56
56
|
const value = act.value;
|
|
57
57
|
const fields = [value.words];
|
package/src/interview-project.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface InterviewDiagnostic {
|
|
|
28
28
|
code: 'INTERVIEW_OPTIONS_STALE' | 'INTERVIEW_OPTIONS_SCENE_LEGACY';
|
|
29
29
|
question: string; record: string; ref: SetRef; at?: string;
|
|
30
30
|
}
|
|
31
|
-
export interface InterviewQuestion {ref: SetRef; set: InterviewSet; editable: boolean; images: Image[]; hasParts: boolean; partsUnavailable?: boolean; answer?: RecordData}
|
|
31
|
+
export interface InterviewQuestion {ref: SetRef; set: InterviewSet; editable: boolean; images: Image[]; hasParts: boolean; partsUnavailable?: boolean; scenePicture?: true; missingPicture?: 'rig' | 'scene'; answer?: RecordData}
|
|
32
32
|
export const digest = (data: Buffer | string) => createHash('sha256').update(data).digest('hex');
|
|
33
33
|
export const object = (v: unknown): RecordData => v !== null && typeof v === 'object' && !Array.isArray(v) ? v as RecordData : {};
|
|
34
34
|
const records = (v: unknown) => Array.isArray(v) ? v.map(object) : [];
|
|
@@ -174,30 +174,38 @@ function contextAt(project: RecordData, stage: string, at: number): unknown {
|
|
|
174
174
|
config: object(rig.provenance).config, parts: draft.parts};
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/** Resolve the same question-level plates for project and retained record readers. */
|
|
178
|
+
export function inspectSceneQuestion(project: RecordData, ctx: RecordData, set: InterviewSet,
|
|
179
|
+
at: number, read: (ref: SetRef) => RecordData): {images: Image[]; hasParts: false; legacy: boolean} {
|
|
180
|
+
const drafted = date(set.drafted_at);
|
|
181
|
+
if (set.stage !== 'post-interview' || !Number.isFinite(at) || drafted > at ||
|
|
182
|
+
reopened(project, set.stage, drafted, at)) return stale(set.id);
|
|
183
|
+
let legacy = false;
|
|
184
|
+
let scene: RecordData = {};
|
|
185
|
+
for (const instant of [drafted, at]) {
|
|
186
|
+
const selected = sceneAt(project, instant, read);
|
|
187
|
+
if (!selected || !equal(selected.context, ctx)) return stale(set.id);
|
|
188
|
+
if (!selected.current) {
|
|
189
|
+
if (drafted >= Date.parse('2026-11-08T00:00:00Z')) return stale(set.id);
|
|
190
|
+
legacy = true;
|
|
191
|
+
}
|
|
192
|
+
scene = selected.document;
|
|
193
|
+
}
|
|
194
|
+
const images = records(scene.plates).map(plate => ({
|
|
195
|
+
ref: {path: plate.path as string, sha256: plate.sha256 as string}, name: plate.role as string, type: 'image/png',
|
|
196
|
+
}));
|
|
197
|
+
return {images, hasParts: false, legacy};
|
|
198
|
+
}
|
|
199
|
+
|
|
177
200
|
function inspectContext(root: string, project: RecordData, raw: RecordData, set: InterviewSet, at: number, fresh: boolean): {
|
|
178
201
|
images: Image[]; hasParts: boolean; partsUnavailable?: boolean; legacy?: boolean;
|
|
179
202
|
} {
|
|
180
|
-
const drafted = date(set.drafted_at);
|
|
181
203
|
const ctx = object(raw.context);
|
|
182
|
-
if (!Number.isFinite(at) || drafted > at || reopened(project, set.stage, drafted, at)) return stale(set.id);
|
|
183
204
|
if (ctx.kind === 'scene') {
|
|
184
|
-
|
|
185
|
-
let legacy = false;
|
|
186
|
-
let scene: RecordData = {};
|
|
187
|
-
for (const instant of [drafted, at]) {
|
|
188
|
-
const selected = sceneAt(project, instant, ref => jsonObject(boundBytes(root, ref)));
|
|
189
|
-
if (!selected || !equal(selected.context, ctx)) return stale(set.id);
|
|
190
|
-
if (!selected.current) {
|
|
191
|
-
if (drafted >= Date.parse('2026-11-08T00:00:00Z')) return stale(set.id);
|
|
192
|
-
legacy = true;
|
|
193
|
-
}
|
|
194
|
-
scene = selected.document;
|
|
195
|
-
}
|
|
196
|
-
const images = records(scene.plates).map(plate => ({
|
|
197
|
-
ref: {path: plate.path as string, sha256: plate.sha256 as string}, name: plate.role as string, type: 'image/png',
|
|
198
|
-
}));
|
|
199
|
-
return {images, hasParts: false, legacy};
|
|
205
|
+
return inspectSceneQuestion(project, ctx, set, at, ref => jsonObject(boundBytes(root, ref)));
|
|
200
206
|
}
|
|
207
|
+
const drafted = date(set.drafted_at);
|
|
208
|
+
if (!Number.isFinite(at) || drafted > at || reopened(project, set.stage, drafted, at)) return stale(set.id);
|
|
201
209
|
const expected = contextAt(project, set.stage, drafted);
|
|
202
210
|
const historicalInputs = !fresh && set.stage === 'interview';
|
|
203
211
|
const matches = historicalInputs ? ctx.kind === 'inputs' && records(ctx.files).length > 0 &&
|
package/src/interview-scene.ts
CHANGED
|
@@ -66,28 +66,33 @@ function sorted(value: unknown): unknown {
|
|
|
66
66
|
if (data !== value) return value;
|
|
67
67
|
return Object.fromEntries(Object.keys(data).sort().map(key => [key, sorted(data[key])]));
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
/** Resolve the operative human acceptance and its package record from the project alone. */
|
|
70
|
+
export function acceptedRigReview(project: Data, versionNumber: unknown, at: number) {
|
|
70
71
|
const live = records(project.versions).map((version, index) => ({version, index})).filter(({version}) =>
|
|
71
72
|
version.kind === 'rig' && date(version.at) <= at && !coveringChange(project, 'rig-review', date(version.at) - 1, at));
|
|
72
73
|
const latest = live.sort((a, b) => Number(b.version.n) - Number(a.version.n))[0];
|
|
73
|
-
if (!latest || latest.version.n !==
|
|
74
|
+
if (!latest || latest.version.n !== versionNumber) return undefined;
|
|
74
75
|
const {version, index} = latest;
|
|
75
76
|
const verdicts = records(version.verdicts);
|
|
76
77
|
const operative = verdicts.map((verdict, index) => ({verdict, index})).filter(({verdict}) =>
|
|
77
78
|
verdict.review === 'rig-review' && human(verdict.by) && verdict.verdict !== 'provisional' && date(verdict.at) <= at).at(-1);
|
|
78
|
-
if (!operative || operative.verdict.verdict !== 'accepted') return
|
|
79
|
+
if (!operative || operative.verdict.verdict !== 'accepted') return undefined;
|
|
79
80
|
const signature = records(project.signoffs).filter(signoff => signoff.stage === 'rig-review' && signoff.checkpoint === null &&
|
|
80
81
|
human(signoff.by) && date(signoff.at) <= at && object(signoff.target).version === version.n &&
|
|
81
82
|
!coveringChange(project, 'rig-review', date(signoff.at) - 1, at)).reverse().sort((a, b) => date(b.at) - date(a.at))[0];
|
|
82
|
-
if (!signature) return
|
|
83
|
+
if (!signature) return undefined;
|
|
83
84
|
const target = object(signature.target), pkg = object(version.review_package);
|
|
84
85
|
const packageHash = createHash('sha256').update(JSON.stringify(sorted({config: pkg.config, files: pkg.files}))).digest('hex');
|
|
85
86
|
if (target.verdict !== `versions[${index}].verdicts[${operative.index}]` ||
|
|
86
|
-
!equal(target.review_package, {path: `versions[${index}].review_package`, sha256: packageHash})) return
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
!equal(target.review_package, {path: `versions[${index}].review_package`, sha256: packageHash})) return undefined;
|
|
88
|
+
return {
|
|
89
|
+
pkg,
|
|
90
|
+
acceptance: {
|
|
91
|
+
signoff: {stage: signature.stage, checkpoint: signature.checkpoint, at: signature.at},
|
|
92
|
+
verdict: target.verdict,
|
|
93
|
+
review_package: target.review_package,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
export function sceneAt(project: Data, at: number, read: (ref: SetRef) => Data) {
|
|
@@ -96,7 +101,7 @@ export function sceneAt(project: Data, at: number, read: (ref: SetRef) => Data)
|
|
|
96
101
|
const entries = records(project.scenes);
|
|
97
102
|
for (const [index, entry] of entries.entries()) {
|
|
98
103
|
if (!closed(entry, ['n', 'path', 'sha256', 'at', 'by']) || entry.n !== index + 1 ||
|
|
99
|
-
entry.path !== `evidence/scene/s${index + 1}.json` || !hash(entry.sha256) || !human(entry.by) ||
|
|
104
|
+
entry.path !== `evidence/scene/s${index + 1}.json` || !hash(entry.sha256) || !(entry.by === 'agent' || human(entry.by)) ||
|
|
100
105
|
typeof entry.at !== 'string' || !entry.at.endsWith('Z') || !Number.isFinite(date(entry.at))) return stale();
|
|
101
106
|
}
|
|
102
107
|
const candidate = entries.filter(entry => date(entry.at) <= at).at(-1);
|
|
@@ -105,5 +110,7 @@ export function sceneAt(project: Data, at: number, read: (ref: SetRef) => Data)
|
|
|
105
110
|
let scene: Data;
|
|
106
111
|
try {scene = read(reference);} catch {return stale();}
|
|
107
112
|
if (!sceneDocumentShape(scene, candidate.n)) return stale();
|
|
108
|
-
|
|
113
|
+
const rig = object(scene.rig);
|
|
114
|
+
const accepted = acceptedRigReview(project, rig.version, at);
|
|
115
|
+
return {context: {kind: 'scene', scene: reference}, current: equal(rig.acceptance, accepted?.acceptance), document: scene};
|
|
109
116
|
}
|
package/src/job-act.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import {
|
|
3
3
|
JOB_ACT_SCHEMA, JOB_API_SCHEMA, JOB_COMMENTS_ACT_SCHEMA, JOB_API_V3_SCHEMA, JOB_RECORD_ACT_KINDS, JOB_RECORD_ACT_SCHEMA, jobStillByteLimit, JOB_ENABLED_ACT_KINDS, JOB_PLAN_BOUND_SIGNOFF_STAGES, JOB_RESERVED_ACT_KINDS,
|
|
4
|
-
type ActV3, type JobAct, type JobCommentsAct, type JobApiSchema, type JobPendingAsk, type JobPublicationMode, type JobReviewerBinding,
|
|
4
|
+
type ActV3, type JobAct, type JobComment, type JobCommentsAct, type JobApiSchema, type JobPendingAsk, type JobPublicationMode, type JobReviewerBinding,
|
|
5
5
|
type JobSourceBinding, type JobSubject, type JobUISubmission, type JobRigCapture, type JobRigStill,
|
|
6
|
-
type PendingAskV3, type RecordAct, type RecordSource, type RecordSubject, type SourceV3, type UISubmissionV3,
|
|
6
|
+
type JobMeshEdit, type PendingAskV3, type RecordAct, type RecordSource, type RecordSubject, type SourceV3, type UISubmissionV3,
|
|
7
|
+
type JobCommentContext, type JobContextComment,
|
|
7
8
|
} from './job-contract.ts';
|
|
8
9
|
import { parsePartsIssue, type PartsIssue } from './parts-comment.ts';
|
|
9
10
|
import {
|
|
10
11
|
isRecordSource, jobHash, jobId, jobInteger, jobObject,
|
|
11
|
-
parseCommentsAct, parseRecordAct, parseRecordSource, requestDigest, validateRecordAskSubject,
|
|
12
|
+
commentsActForEmission, meshEditsActForEmission, parseCommentsAct, parseMeshEdits, parseRecordAct, parseRecordSource, requestDigest, validateRecordAskSubject,
|
|
12
13
|
} from './job-api.ts';
|
|
13
14
|
import { checkpointNoteComments, feedbackItemComments, noteComments, partsIssueComments } from './feedback-export.ts';
|
|
15
|
+
import { hasStageComment, parseStageComment } from './stage-comment.ts';
|
|
14
16
|
import type { Feedback } from './session.ts';
|
|
15
17
|
import { validatePicks } from './interview-picks.ts';
|
|
16
18
|
import {
|
|
@@ -22,6 +24,8 @@ import {
|
|
|
22
24
|
import { JobError } from './job-store.ts';
|
|
23
25
|
import { checkedPath, readRegular } from './interview-project.ts';
|
|
24
26
|
import {validatePngBytes} from './comment-crops.ts';
|
|
27
|
+
import {applyMeshOps, attachmentHashText, MESH_EDIT_CODES} from './mesh-edit.ts';
|
|
28
|
+
import {readStoredSetupMesh} from './setup-mesh.ts';
|
|
25
29
|
|
|
26
30
|
function words(value: unknown): string {
|
|
27
31
|
if (typeof value !== 'string' || value.length > 10_000) throw new JobError('JOB_ACT_INVALID');
|
|
@@ -34,6 +38,70 @@ function commentsAct(act: JobCommentsAct): JobCommentsAct {
|
|
|
34
38
|
return act;
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
function rigVerdictFeedbackComments(feedback: readonly Feedback[], subject: NonNullable<JobCommentContext['subject']>): JobContextComment[] {
|
|
42
|
+
return feedbackItemComments(feedback).map(comment => {
|
|
43
|
+
const rawMark = (comment.anchor.context as {comment?: unknown} | undefined)?.comment;
|
|
44
|
+
if (!hasStageComment(rawMark)) return comment;
|
|
45
|
+
const mark = parseStageComment(rawMark);
|
|
46
|
+
const selection = (mark.bookmark as {
|
|
47
|
+
selection: {inspector: JobCommentContext['tab']; part?: JobCommentContext['part'] | null};
|
|
48
|
+
}).selection;
|
|
49
|
+
return {...comment, context: {subject, mode: mark.mode, tab: selection.inspector,
|
|
50
|
+
...(selection.part ? {part: selection.part} : {}), region: mark.world, camera: mark.camera,
|
|
51
|
+
...(mark.frame ? {frame: mark.frame} : {})}};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function hasMeshSubmission(kind: unknown, value: unknown): boolean {
|
|
56
|
+
if (value === null || typeof value !== 'object' || !Object.hasOwn(value, 'meshEdits')) return false;
|
|
57
|
+
const {stage, verdict} = value as {stage?: unknown; verdict?: unknown};
|
|
58
|
+
if (kind !== 'review-verdict' || stage !== 'rig-review' || verdict !== 'changes-requested') {
|
|
59
|
+
throw new JobError('JOB_ACT_INVALID');
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function validateRetainedMeshEdits(retained: JobRetainedSource, edits: readonly JobMeshEdit[]): void {
|
|
65
|
+
const binding = retained.source.model;
|
|
66
|
+
if (!binding) throw new JobError('JOB_ACT_SOURCE_STALE');
|
|
67
|
+
let model: {stage?: {width?: number; height?: number}};
|
|
68
|
+
try {
|
|
69
|
+
const bytes = readRegular(checkedPath(retained.snapshotRoot, binding.path), 64 * 1024 * 1024);
|
|
70
|
+
if (jobHash(bytes) !== binding.sha256) throw new Error('model hash differs');
|
|
71
|
+
model = JSON.parse(bytes.toString('utf8'));
|
|
72
|
+
} catch {
|
|
73
|
+
throw new JobError('JOB_ACT_SOURCE_STALE');
|
|
74
|
+
}
|
|
75
|
+
for (const {edit} of edits) {
|
|
76
|
+
const read = readStoredSetupMesh(model, edit.slot, edit, MESH_EDIT_CODES);
|
|
77
|
+
if (!read.ok || jobHash(attachmentHashText(read.mesh.entry)) !== edit.source.hash) throw new JobError('JOB_ACT_SOURCE_STALE');
|
|
78
|
+
const {mesh} = read;
|
|
79
|
+
const {frame, positions, vertexCount, triangleCount, hullLength, hash} = edit.source;
|
|
80
|
+
const uvs = mesh.entry.uvs;
|
|
81
|
+
if (mesh.linked || !Array.isArray(uvs) || uvs.length !== vertexCount * 2 ||
|
|
82
|
+
mesh.vertices.length !== vertexCount || positions.length !== vertexCount ||
|
|
83
|
+
mesh.triangles.length !== triangleCount * 3 || mesh.hull !== hullLength ||
|
|
84
|
+
model.stage?.width !== frame.width || model.stage?.height !== frame.height) {
|
|
85
|
+
throw new JobError('JOB_ACT_INVALID');
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
applyMeshOps({slot: edit.slot, attachment: edit.attachment, skin: edit.skin,
|
|
89
|
+
vertices: positions, triangles: mesh.triangles, hull: hullLength, hash}, edit.ops);
|
|
90
|
+
} catch {
|
|
91
|
+
throw new JobError('JOB_ACT_INVALID');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function generalComments(value: unknown): JobComment[] {
|
|
97
|
+
if (value === undefined) return [];
|
|
98
|
+
if (!Array.isArray(value)) throw new JobError('JOB_ACT_INVALID');
|
|
99
|
+
return Array.from(value, (text: unknown) => {
|
|
100
|
+
if (typeof text !== 'string') throw new JobError('JOB_ACT_INVALID');
|
|
101
|
+
return {text};
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
37
105
|
function choice<Value extends string>(value: unknown, allowed: readonly Value[]): Value {
|
|
38
106
|
if (!allowed.includes(value as Value)) throw new JobError('JOB_ACT_INVALID');
|
|
39
107
|
return value as Value;
|
|
@@ -468,6 +536,11 @@ export function finalizeJobAct(options: {
|
|
|
468
536
|
readonly actId?: string;
|
|
469
537
|
readonly at?: string;
|
|
470
538
|
}): ActV3 {
|
|
539
|
+
const meshSubmission = hasMeshSubmission(options.submission.kind, options.submission.value);
|
|
540
|
+
if (meshSubmission && (isRetainedRecordSource(options.retained) ||
|
|
541
|
+
options.ask.subject.kind !== 'review-verdict' || options.ask.subject.stage !== 'rig-review')) {
|
|
542
|
+
throw new JobError('JOB_ACT_INVALID');
|
|
543
|
+
}
|
|
471
544
|
if (isRetainedRecordSource(options.retained)) {
|
|
472
545
|
return prepareJobRecordAct({
|
|
473
546
|
jobId: options.jobId,
|
|
@@ -537,7 +610,7 @@ export function finalizeJobAct(options: {
|
|
|
537
610
|
} });
|
|
538
611
|
}
|
|
539
612
|
case 'parts-verdict': {
|
|
540
|
-
const value = jobObject(submission.value, ['verdict', 'issues', 'words']);
|
|
613
|
+
const value = jobObject(submission.value, ['verdict', 'issues', 'words', 'general']);
|
|
541
614
|
const verdict = choice(value.verdict, ['approved', 'changes-requested'] as const);
|
|
542
615
|
if (
|
|
543
616
|
!Array.isArray(value.issues) ||
|
|
@@ -577,25 +650,39 @@ export function finalizeJobAct(options: {
|
|
|
577
650
|
selector: source.selector as Extract<NonNullable<JobSourceBinding['selector']>, { kind: 'draft' }>,
|
|
578
651
|
parts: source.parts!,
|
|
579
652
|
},
|
|
580
|
-
value: {
|
|
653
|
+
value: {
|
|
654
|
+
verdict,
|
|
655
|
+
comments: [...partsIssueComments(issues), ...noteComments(words(value.words)), ...generalComments(value.general)],
|
|
656
|
+
},
|
|
581
657
|
});
|
|
582
658
|
}
|
|
583
659
|
case 'review-verdict': {
|
|
584
660
|
const value = jobObject(submission.value, ['stage', 'verdict', 'words',
|
|
585
|
-
...(ask.subject.kind === 'review-verdict' && ask.subject.stage === 'rig-review' ? ['feedback'] : [])]);
|
|
661
|
+
...(ask.subject.kind === 'review-verdict' && ask.subject.stage === 'rig-review' ? ['feedback', 'general', 'meshEdits'] : [])]);
|
|
586
662
|
if (ask.subject.kind !== 'review-verdict' || ask.subject.stage === 'image-review' || value.stage !== ask.subject.stage) throw new JobError('JOB_ACT_INVALID');
|
|
587
663
|
if (ask.subject.stage === 'rig-review') {
|
|
664
|
+
const verdict = choice(value.verdict, ['pending', 'approved', 'changes-requested'] as const);
|
|
665
|
+
let meshEdits: readonly JobMeshEdit[] | undefined;
|
|
666
|
+
if (meshSubmission) {
|
|
667
|
+
meshEdits = parseMeshEdits(value.meshEdits);
|
|
668
|
+
validateRetainedMeshEdits(retained, meshEdits);
|
|
669
|
+
}
|
|
588
670
|
if (!options.still) throw new JobError('JOB_STILL_CAPTURE_FAILED');
|
|
589
671
|
const note = words(value.words);
|
|
590
672
|
if (value.feedback !== undefined && !Array.isArray(value.feedback)) throw new JobError('JOB_ACT_INVALID');
|
|
591
|
-
|
|
673
|
+
const selector = source.selector as Extract<NonNullable<JobSourceBinding['selector']>, {kind: 'rig'}>;
|
|
674
|
+
let verdictComments: readonly JobContextComment[];
|
|
592
675
|
try {
|
|
593
|
-
verdictComments = value.feedback === undefined ? noteComments(note) :
|
|
676
|
+
verdictComments = value.feedback === undefined ? noteComments(note) : rigVerdictFeedbackComments(value.feedback as Feedback[],
|
|
677
|
+
{ask: ask.subject, sourceHash: source.sourceHash, selector});
|
|
594
678
|
} catch { throw new JobError('JOB_ACT_INVALID'); }
|
|
595
|
-
|
|
596
|
-
source: {...source, model: source.model!, selector
|
|
597
|
-
value: {stage: 'rig-review'
|
|
598
|
-
still: options.still}
|
|
679
|
+
const act = {...comments, kind: 'review-verdict' as const,
|
|
680
|
+
source: {...source, model: source.model!, selector},
|
|
681
|
+
value: {stage: 'rig-review' as const, verdict, comments: [...verdictComments, ...generalComments(value.general)]},
|
|
682
|
+
still: options.still};
|
|
683
|
+
if (meshEdits) return meshEditsActForEmission({...act, value: {...act.value, meshEdits}});
|
|
684
|
+
if (verdictComments.some(comment => Object.hasOwn(comment, 'context'))) return commentsActForEmission(act);
|
|
685
|
+
return commentsAct(act);
|
|
599
686
|
}
|
|
600
687
|
return commentsAct({ ...comments, kind: 'review-verdict', source: { ...source, model: source.model!,
|
|
601
688
|
selector: source.selector as Extract<NonNullable<JobSourceBinding['selector']>, { kind: 'rig' | 'post' }> }, value: {
|