rig-review 2.7.1 → 2.9.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.
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  import type { JobPublicationReader } from './job-source.ts';
15
+ import type { PartsIssue } from './parts-comment.ts';
15
16
 
16
17
  export const JOB_API_SCHEMA = 'rig-review/job-api@2' as const;
17
18
  export const JOB_API_V3_SCHEMA = 'rig-review/job-api@3' as const;
@@ -20,6 +21,65 @@ export const JOB_ACT_SCHEMA = 'rig-review/act@2' as const;
20
21
  export const JOB_RIG_REVIEW_ACT_SCHEMA = 'rig-review/act@3' as const;
21
22
  /** Record-source acts only under opt-in API@3. Package/image acts retain @2/@3. */
22
23
  export const JOB_RECORD_ACT_SCHEMA = 'rig-review/act@4' as const;
24
+ /** New parts verdicts only. Historical @2 parts-verdict acts remain readable. */
25
+ export const JOB_PARTS_VERDICT_ACT_SCHEMA = 'rig-review/act@5' as const;
26
+ export const JOB_PANEL_COMPOSITION_SCHEMA = 'rig-review/panels@1' as const;
27
+
28
+ export type PanelSlot = 'left' | 'stage' | 'toolbar' | 'side';
29
+ export const PANEL_COMPONENTS = [
30
+ 'parts.canvas', 'parts.list', 'parts.issues', 'parts.layers', 'act.submit',
31
+ 'interview.picks', 'plan.body', 'rig.playback', 'scene.composite', 'images.set',
32
+ ] as const;
33
+ export type PanelComponent = typeof PANEL_COMPONENTS[number];
34
+ export interface JobPanelComposition {
35
+ readonly schema: typeof JOB_PANEL_COMPOSITION_SCHEMA;
36
+ readonly left?: readonly PanelComponent[];
37
+ readonly stage?: readonly PanelComponent[];
38
+ readonly toolbar?: readonly PanelComponent[];
39
+ readonly side?: readonly PanelComponent[];
40
+ }
41
+ export function isPanelComponent(value: string): value is PanelComponent {
42
+ return (PANEL_COMPONENTS as readonly string[]).includes(value);
43
+ }
44
+
45
+ export function parsePanelComposition(input: unknown): JobPanelComposition {
46
+ if (input === null || typeof input !== 'object' || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype) {
47
+ throw new Error('JOB_PANELS_INVALID: panels must be a plain object');
48
+ }
49
+ const p = input as Record<string, unknown>;
50
+ if (p.schema !== JOB_PANEL_COMPOSITION_SCHEMA) {
51
+ throw new Error(`JOB_PANELS_INVALID: panels.schema must be ${JOB_PANEL_COMPOSITION_SCHEMA}`);
52
+ }
53
+ for (const key of Object.keys(p)) {
54
+ if (!['schema', 'left', 'stage', 'toolbar', 'side'].includes(key)) {
55
+ throw new Error(`JOB_PANELS_INVALID: unknown panel slot ${key}`);
56
+ }
57
+ }
58
+ const slot = (value: unknown, field: string): PanelComponent[] => {
59
+ if (!Array.isArray(value) || value.length > 32) {
60
+ throw new Error(`JOB_PANELS_INVALID: ${field} must be an array of at most 32 components`);
61
+ }
62
+ return value.map((item, index) => {
63
+ if (typeof item !== 'string' || !item.trim() || item.length > 128 || /[\r\n\0]/.test(item)) {
64
+ throw new Error(`JOB_PANELS_INVALID: ${field}[${index}] must be a nonblank component id`);
65
+ }
66
+ // Unknown component IDs are preserved in their declared slot so the host renders JOB_PANEL_UNKNOWN: <id>.
67
+ return item as PanelComponent;
68
+ });
69
+ };
70
+ const stage = slot(p.stage, 'panels.stage');
71
+ const side = slot(p.side, 'panels.side');
72
+ if (stage.length !== 1 || side.length < 1 || side[side.length - 1] !== 'act.submit') {
73
+ throw new Error('JOB_PANELS_INVALID: stage must have exactly one component and side must end with act.submit');
74
+ }
75
+ return {
76
+ schema: JOB_PANEL_COMPOSITION_SCHEMA,
77
+ ...(p.left === undefined ? {} : { left: slot(p.left, 'panels.left') }),
78
+ stage,
79
+ ...(p.toolbar === undefined ? {} : { toolbar: slot(p.toolbar, 'panels.toolbar') }),
80
+ side,
81
+ };
82
+ }
23
83
  export const JOB_RECORD_READER_ID = 'rig-create/publication-reader/2' as const;
24
84
  export const JOB_RECORD_SOURCE_SCHEMA = 'rig-review-job-record-source/1' as const;
25
85
  export const JOB_RECORD_INSTANCE_SCHEMA = 'rig-review-job-record-instance/1' as const;
@@ -39,8 +99,16 @@ export const JOB_ENABLED_ACT_KINDS = [
39
99
  'signoff',
40
100
  ] as const;
41
101
 
102
+ export const JOB_RECORD_ACT_KINDS = [
103
+ 'interview-picks',
104
+ 'checkpoint',
105
+ 'signoff',
106
+ 'reopen',
107
+ ] as const;
108
+
42
109
  export const JOB_RESERVED_ACT_KINDS = ['described-correction', 'mesh-edit'] as const;
43
110
  export type JobEnabledActKind = typeof JOB_ENABLED_ACT_KINDS[number];
111
+ export type RecordActKind = typeof JOB_RECORD_ACT_KINDS[number];
44
112
  export type JobReservedActKind = typeof JOB_RESERVED_ACT_KINDS[number];
45
113
  export type JobActKind = JobEnabledActKind | JobReservedActKind;
46
114
 
@@ -220,6 +288,22 @@ export type JobVerdict = 'pending' | 'approved' | 'changes-requested';
220
288
  export type JobPartOutcome = 'pending' | 'clean' | 'flagged';
221
289
  export type JobReviewStage = 'rig-review' | 'direction-review' | 'image-review';
222
290
 
291
+ export type PartsVerdictValue = {
292
+ readonly verdict: 'approved' | 'changes-requested';
293
+ readonly issues: readonly PartsIssue[];
294
+ readonly words: string;
295
+ };
296
+
297
+ export interface JobLegacyPartsVerdictValue {
298
+ readonly verdict: JobVerdict;
299
+ readonly parts: readonly {
300
+ readonly partId: string;
301
+ readonly part: { readonly outcome: JobPartOutcome; readonly note: string };
302
+ readonly mesh: { readonly outcome: JobPartOutcome; readonly note: string };
303
+ }[];
304
+ readonly words: string;
305
+ }
306
+
223
307
  export interface JobActValues {
224
308
  readonly 'interview-picks': {
225
309
  readonly questionId: string;
@@ -243,15 +327,7 @@ export interface JobActValues {
243
327
  */
244
328
  readonly words: string;
245
329
  };
246
- readonly 'parts-verdict': {
247
- readonly verdict: JobVerdict;
248
- readonly parts: readonly {
249
- readonly partId: string;
250
- readonly part: { readonly outcome: JobPartOutcome; readonly note: string };
251
- readonly mesh: { readonly outcome: JobPartOutcome; readonly note: string };
252
- }[];
253
- readonly words: string;
254
- };
330
+ readonly 'parts-verdict': PartsVerdictValue;
255
331
  readonly 'review-verdict': JobModelReviewValue | JobImageReviewValue;
256
332
  readonly signoff: {
257
333
  /** An explicitly declared Create stage. Validation belongs to its writer. */
@@ -313,7 +389,8 @@ export type JobLegacyAct = {
313
389
  } & (Kind extends 'review-verdict' ? (
314
390
  | {readonly source: Exclude<JobActSources['review-verdict'], JobImageSourceBinding>; readonly value: JobModelReviewValue}
315
391
  | {readonly source: JobImageSourceBinding; readonly value: JobImageReviewValue}
316
- ) : {readonly source: JobActSources[Kind]; readonly value: JobActValues[Kind]});
392
+ ) : Kind extends 'parts-verdict' ? {readonly source: JobActSources['parts-verdict']; readonly value: JobLegacyPartsVerdictValue}
393
+ : {readonly source: JobActSources[Kind]; readonly value: JobActValues[Kind]});
317
394
  }[JobEnabledActKind];
318
395
 
319
396
  export type JobRigStill = {
@@ -335,8 +412,13 @@ export type JobRigReviewAct = Omit<Extract<JobLegacyAct, {kind: 'review-verdict'
335
412
  readonly still: JobRigStill;
336
413
  };
337
414
 
338
- /** Historical @2 rig acts remain readable without being backfilled or relabelled. */
339
- export type JobAct = JobLegacyAct | JobRigReviewAct;
415
+ export type JobPartsVerdictAct = Omit<Extract<JobLegacyAct, {kind: 'parts-verdict'}>, 'schema' | 'value'> & {
416
+ readonly schema: typeof JOB_PARTS_VERDICT_ACT_SCHEMA;
417
+ readonly value: PartsVerdictValue;
418
+ };
419
+
420
+ /** Historical @2 acts remain readable without being backfilled or relabelled. */
421
+ export type JobAct = JobLegacyAct | JobRigReviewAct | JobPartsVerdictAct;
340
422
 
341
423
  /** Authenticated browser provenance. The daemon validates identity and hashes PNG bytes. */
342
424
  export interface JobRigCapture {
@@ -384,6 +466,47 @@ export interface JobPendingAsk {
384
466
  readonly status: 'pending' | 'answered' | 'superseded';
385
467
  }
386
468
 
469
+ export type JobInterviewJson =
470
+ | null
471
+ | boolean
472
+ | number
473
+ | string
474
+ | readonly JobInterviewJson[]
475
+ | { readonly [key: string]: JobInterviewJson };
476
+
477
+ export interface JobInterviewRecord {
478
+ readonly questionId: string;
479
+ readonly record: string;
480
+ readonly setId: string | null;
481
+ readonly ref: JobFileIdentity;
482
+ readonly observedSet: JobFileIdentity | null;
483
+ readonly timeKind: 'inspection' | 'answer' | 'decision';
484
+ readonly at: string | null;
485
+ readonly original: { readonly [key: string]: JobInterviewJson } | null;
486
+ }
487
+
488
+ export type JobInterviewDiagnostic = {
489
+ readonly record: string;
490
+ readonly at: string | null;
491
+ } & (
492
+ | {
493
+ readonly code: 'INTERVIEW_OPTIONS_STALE';
494
+ readonly severity: 'error';
495
+ }
496
+ | {
497
+ readonly code: 'INTERVIEW_OPTIONS_SCENE_LEGACY';
498
+ readonly severity: 'warning';
499
+ }
500
+ );
501
+
502
+ export interface JobInterviewDiagnostics {
503
+ readonly schema: 'rig-review/job-interview@1';
504
+ readonly project: JobFileIdentity;
505
+ readonly evaluatedAt: string;
506
+ readonly records: readonly JobInterviewRecord[];
507
+ readonly diagnostics: readonly JobInterviewDiagnostic[];
508
+ }
509
+
387
510
  export interface JobPublication {
388
511
  readonly publicationId: JobPublicationId;
389
512
  readonly instanceKey: JobSha256;
@@ -395,6 +518,7 @@ export interface JobPublication {
395
518
  readonly status: 'unavailable';
396
519
  readonly code: string;
397
520
  };
521
+ readonly interview?: JobInterviewDiagnostics | null;
398
522
  }
399
523
 
400
524
  export interface JobStatus {
@@ -607,9 +731,9 @@ export interface JobHostPorts {
607
731
  readonly jobId: JobId;
608
732
  readonly after: JobCursor | null;
609
733
  readonly signal: AbortSignal;
610
- }): AsyncIterable<JobEvent>;
611
- readPublication(jobId: JobId, publicationId: JobPublicationId): Promise<JobResult<JobDisplayPublication>>;
612
- commitUIAct(jobId: JobId, request: Request): Promise<JobResult<JobAct>>;
734
+ }): AsyncIterable<EventV3>;
735
+ readPublication(jobId: JobId, publicationId: JobPublicationId): Promise<JobResult<DisplayPublicationV3>>;
736
+ commitUIAct(jobId: JobId, request: Request): Promise<JobResult<ActV3>>;
613
737
  ackDisplayed(jobId: JobId, request: Request): Promise<JobResult<JobDisplayReceipt>>;
614
738
  jobLiveness(jobId: JobId): Promise<JobResult<{
615
739
  readonly active: boolean;
@@ -690,8 +814,9 @@ export type PublishRequestV3 = Omit<JobPublishRequest, 'schema' | 'result' | 'fr
690
814
  }
691
815
  );
692
816
 
693
- export type AskRequestV3 = Omit<JobAskRequest, 'schema'> & {
817
+ export type AskRequestV3 = Omit<JobAskRequest, 'schema' | 'subject'> & {
694
818
  readonly schema: typeof JOB_API_V3_SCHEMA;
819
+ readonly subject: JobSubject | RecordSubject;
695
820
  };
696
821
 
697
822
  export type NextRequestV3 = Omit<JobNextRequest, 'schema'> & {
@@ -730,7 +855,12 @@ export interface RecordSignoffSubject {
730
855
  readonly stage: RecordSignoffStage;
731
856
  }
732
857
 
733
- export type RecordPlanSubject = RecordCheckpointSubject | RecordSignoffSubject;
858
+ export interface RecordReopenSubject {
859
+ readonly kind: 'reopen';
860
+ readonly stage: JobId;
861
+ }
862
+
863
+ export type RecordPlanSubject = RecordCheckpointSubject | RecordSignoffSubject | RecordReopenSubject;
734
864
  export type RecordSubject = RecordPicksSubject | RecordPlanSubject;
735
865
 
736
866
  export interface RecordPartsIdentity {
@@ -781,6 +911,15 @@ export interface RecordHostHooks {
781
911
  }
782
912
 
783
913
  export interface RecordSourceBase {
914
+ readonly package?: never;
915
+ readonly selector?: never;
916
+ readonly model?: never;
917
+ readonly direction?: never;
918
+ readonly appliedResult?: never;
919
+ readonly parts?: never;
920
+ readonly imageSet?: never;
921
+ readonly imageSetDigest?: never;
922
+ readonly duplicateHashes?: never;
784
923
  readonly sourceHash: JobSha256;
785
924
  readonly projectHash: JobSha256;
786
925
  readonly record: ProjectRecord;
@@ -812,6 +951,34 @@ export type RecordSignoffValue = Omit<JobActValues['signoff'], 'stage'> & {
812
951
  readonly stage: RecordSignoffStage;
813
952
  };
814
953
 
954
+ export interface RecordReopenValue {
955
+ readonly stage: JobId;
956
+ readonly words: string;
957
+ }
958
+
959
+ export interface RecordUIActValues {
960
+ readonly 'interview-picks': JobUIActValues['interview-picks'];
961
+ readonly checkpoint: JobUIActValues['checkpoint'];
962
+ readonly signoff: JobUIActValues['signoff'];
963
+ readonly reopen: RecordReopenValue;
964
+ }
965
+
966
+ export type RecordUISubmission = {
967
+ [Kind in keyof RecordUIActValues]: {
968
+ readonly publicationId: JobPublicationId;
969
+ readonly askId: JobAskId;
970
+ readonly pageId: string;
971
+ readonly displayedNonce: string;
972
+ readonly expectedGeneration: number;
973
+ readonly submissionId: string;
974
+ readonly kind: Kind;
975
+ readonly value: RecordUIActValues[Kind];
976
+ readonly capture?: never;
977
+ };
978
+ }[keyof RecordUIActValues];
979
+
980
+ export type UISubmissionV3 = JobUISubmission | RecordUISubmission;
981
+
815
982
  export type RecordAct = Pick<JobLegacyAct,
816
983
  'actId' | 'jobId' | 'askId' | 'publicationId' | 'authority' | 'at'> & {
817
984
  readonly schema: typeof JOB_RECORD_ACT_SCHEMA;
@@ -831,6 +998,11 @@ export type RecordAct = Pick<JobLegacyAct,
831
998
  readonly source: PlanSource;
832
999
  readonly value: RecordSignoffValue;
833
1000
  }
1001
+ | {
1002
+ readonly kind: 'reopen';
1003
+ readonly source: PlanSource;
1004
+ readonly value: RecordReopenValue;
1005
+ }
834
1006
  );
835
1007
 
836
1008
  export type SourceV3 = JobSourceBinding | RecordSource;
@@ -847,7 +1019,8 @@ export const JOB_CAPABILITIES_V3: JobCapabilitiesV3 = Object.freeze({
847
1019
  recordActSchema: JOB_RECORD_ACT_SCHEMA,
848
1020
  });
849
1021
 
850
- export interface PendingAskV3 extends Omit<JobPendingAsk, 'source'> {
1022
+ export interface PendingAskV3 extends Omit<JobPendingAsk, 'subject' | 'source'> {
1023
+ readonly subject: JobSubject | RecordSubject;
851
1024
  readonly source: SourceV3;
852
1025
  }
853
1026
 
@@ -855,6 +1028,10 @@ export interface PublicationV3 extends Omit<JobPublication, 'source'> {
855
1028
  readonly source: SourceV3;
856
1029
  }
857
1030
 
1031
+ export interface DisplayPublicationV3 extends Omit<JobDisplayPublication, 'publication'> {
1032
+ readonly publication: PublicationV3;
1033
+ }
1034
+
858
1035
  export interface StatusV3 extends Omit<JobStatus, 'publication' | 'pending'> {
859
1036
  readonly publication: PublicationV3 | null;
860
1037
  readonly pending: readonly PendingAskV3[];
@@ -872,7 +1049,7 @@ export type EventV3 = {
872
1049
  );
873
1050
 
874
1051
  export interface NextValueV3 {
875
- readonly capabilities?: JobCapabilitiesV3;
1052
+ readonly capabilities?: JobCapabilities | JobCapabilitiesV3;
876
1053
  readonly events: readonly EventV3[];
877
1054
  readonly cursor: JobCursor | null;
878
1055
  readonly status: 'events' | 'timeout' | 'closed';
@@ -912,8 +1089,10 @@ export type JobRecordPicksSubject = RecordPicksSubject;
912
1089
  export type JobRecordCheckpointSubject = RecordCheckpointSubject;
913
1090
  export type JobRecordSignoffStage = RecordSignoffStage;
914
1091
  export type JobRecordSignoffSubject = RecordSignoffSubject;
1092
+ export type JobRecordReopenSubject = RecordReopenSubject;
915
1093
  export type JobRecordPlanSubject = RecordPlanSubject;
916
1094
  export type JobRecordSubject = RecordSubject;
1095
+ export type JobRecordActKind = RecordActKind;
917
1096
  export type JobRecordPartsIdentity = RecordPartsIdentity;
918
1097
  export type JobRecordContextBase = RecordContextBase;
919
1098
  export type JobOptionContext = OptionContext;
@@ -927,11 +1106,16 @@ export type JobOptionSource = OptionSource;
927
1106
  export type JobPlanSource = PlanSource;
928
1107
  export type JobRecordSource = RecordSource;
929
1108
  export type JobRecordSignoffValue = RecordSignoffValue;
1109
+ export type JobRecordReopenValue = RecordReopenValue;
1110
+ export type JobRecordUIActValues = RecordUIActValues;
1111
+ export type JobRecordUISubmission = RecordUISubmission;
1112
+ export type JobUISubmissionV3 = UISubmissionV3;
930
1113
  export type JobRecordAct = RecordAct;
931
1114
  export type JobSourceV3 = SourceV3;
932
1115
  export type JobActV3 = ActV3;
933
1116
  export type JobPendingAskV3 = PendingAskV3;
934
1117
  export type JobPublicationV3 = PublicationV3;
1118
+ export type JobDisplayPublicationV3 = DisplayPublicationV3;
935
1119
  export type JobStatusV3 = StatusV3;
936
1120
  export type JobEventV3 = EventV3;
937
1121
  export type JobNextValueV3 = NextValueV3;