rig-review 4.7.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 +23 -27
- package/docs/STABILITY.md +35 -17
- package/package.json +1 -1
- package/src/feedback-export.ts +2 -2
- package/src/job-act.ts +24 -13
- package/src/job-api.ts +6 -10
- package/src/job-cli.ts +12 -6
- package/src/job-contract.ts +8 -3
- package/src/job-session.ts +4 -3
- package/web/job-rig-screen.ts +2 -4
- package/web/mesh-editor.ts +2 -3
- package/web/parts-viewport-provider.ts +1 -3
- package/src/create-pin-gate.ts +0 -3
package/docs/REVIEW_PACKAGE.md
CHANGED
|
@@ -1233,9 +1233,7 @@ except for the limit refusal.
|
|
|
1233
1233
|
The publisher emits this field only when installed Review exports
|
|
1234
1234
|
`JOB_PREVIOUS_DRAFT_SCHEMA` with value `rig-review-previous-draft/1` from
|
|
1235
1235
|
`@rig-c/review/job-host`. This is the publisher-to-Review capability rule.
|
|
1236
|
-
Both
|
|
1237
|
-
their emission gate. The existing pin gate in `src/create-pin-gate.ts`
|
|
1238
|
-
governs Review-to-publisher emission separately. An older Review ignores
|
|
1236
|
+
Both act keys require an admitted `previousDraft`. An older Review ignores
|
|
1239
1237
|
the extra context key and treats the composite `files` rows as ordinary
|
|
1240
1238
|
seals. On the pre-feature main
|
|
1241
1239
|
`d82aff4`, the in-process `readPublished` seam is in
|
|
@@ -1298,7 +1296,7 @@ A post-interview option set with a `rig` context can also show the accepted rig
|
|
|
1298
1296
|
|
|
1299
1297
|
<a id="ask-batch"></a>
|
|
1300
1298
|
|
|
1301
|
-
`ask-batch` asks several subjects of the head record publication in one request ([Review #963](https://github.com/rig-c/review/issues/963)). Each subject is parsed exactly like the single `ask` subject, and a repeated subject refuses the batch. A package head refuses `JOB_REQUEST_INVALID`, a non-head publication refuses `JOB_ACT_SOURCE_STALE`, and zero or more than 64 subjects refuse `JOB_REQUEST_INVALID`. The existing 256 KiB body limit still applies. Review binds every subject, runs `verifyJobRecordSourceFresh` once for the batch (one `inventory` and one `retained` reader call) and validates each subject against that one fresh source. One immediate transaction then re-checks the head, the work root and the retained snapshot once and creates every ask. Each ask writes its own `pending` event and moves the generation by 1, so a batch of N moves it by N. The batch is all or none: any refusal creates no ask, no event and no generation change. A subject's refusal keeps its existing code and prefixes the message with `subjects[<i>]: `. A freshness refusal carries no index. One idempotency key replays the whole batch without reading the publisher again. Single `ask` and finalize are unchanged. A Create detects support through `capabilities.askBatch` in `next`, never by sending `ask-batch` and reading the refusal: an older Review answers the unknown verb with `JOB_REQUEST_INVALID`.
|
|
1299
|
+
`ask-batch` asks several subjects of the head record publication in one request ([Review #963](https://github.com/rig-c/review/issues/963)). Each subject is parsed exactly like the single `ask` subject, and a repeated subject refuses the batch. A package head refuses `JOB_REQUEST_INVALID`, a non-head publication refuses `JOB_ACT_SOURCE_STALE`, and zero or more than 64 subjects refuse `JOB_REQUEST_INVALID`. The existing 256 KiB body limit still applies. Review binds every subject, runs `verifyJobRecordSourceFresh` once for the batch (one `inventory` and one `retained` reader call) and validates each subject against that one fresh source. One immediate transaction then re-checks the head, the work root and the retained snapshot once and creates every ask. Each ask writes its own `pending` event and moves the generation by 1, so a batch of N moves it by N. The batch is all or none: any refusal creates no ask, no event and no generation change. A subject's refusal keeps its existing code and prefixes the message with `subjects[<i>]: `. A freshness refusal carries no index. One idempotency key replays the whole batch without reading the publisher again. Single `ask` and finalize are unchanged. A Create detects support through `capabilities.askBatch` in `next`, never by sending `ask-batch` and reading the refusal: an older Review answers the unknown verb with `JOB_REQUEST_INVALID`. In `JobCapabilitiesV3`, `recordPublication`, `recordActSchema` and `askBatch` describe the host rather than the current head: `ask-batch` applies only to a record-retained head publication and a package head refuses `JOB_REQUEST_INVALID`, so a consumer checks the publication's mode as well as the flag.
|
|
1302
1300
|
|
|
1303
1301
|
The read-only official reader returns the six-key `RecordPublishedContext` with producer-sealed `parts`. `prepareJobRecordSource` runs `phase: 'inventory'` on the immutable source root (re-verifying `project.json` identity before and after each reader phase and before mapping generic reader failures so mid-read record movement reports `JOB_RECORD_MOVED` / `JOB_SOURCE_MISMATCH` rather than `JOB_RECORD_INCOMPLETE`) and retains the sorted, duplicate-free `inventory.files` closure into an owned snapshot (`project.json` within 8 MiB, at most 4,096 regular non-symlink files, 64 MiB per file and 256 MiB total bytes). It then calls `phase: 'retained'` on the snapshot root with `parts: inventory.parts` forwarded unchanged and requires `assertEqualRecordContexts(inventory, retainedContext)`. Before ask or finalize, `verifyJobRecordSourceFresh` re-runs `phase: 'inventory'`, rejects any `inventory.parts` drift against the originally sealed `retained.context.parts` (`JOB_SOURCE_MISMATCH` on ask and `JOB_ACT_SOURCE_STALE` on finalize) before invoking `phase: 'retained'`, and forwards the sealed `retained.context.parts` unchanged when equal; synchronous `store.update` commit re-verifies source and retained snapshot integrity before persisting. Missing reader or contract tokens (`CREATE_PUBLICATION_CONTRACT_UNAVAILABLE`, `CREATE_PLAN_PUBLICATION_CONTRACT_UNAVAILABLE`) refuse with `JOB_SOURCE_UNRETAINABLE`, while named producer tokens (`JOB_RECORD_CLOSURE_INCOMPLETE`, `JOB_RECORD_PARTS_MISMATCH`, `JOB_RECORD_PARTS_LOCK_MISSING`) map to `JOB_RECORD_INCOMPLETE` on publish or ask and `JOB_ACT_SOURCE_STALE` on finalize.
|
|
1304
1302
|
|
|
@@ -1506,9 +1504,10 @@ strings and readers. There is no interview-picks arm or question/ask anchor in
|
|
|
1506
1504
|
this extension. Technical configuration and search controls are outside it.
|
|
1507
1505
|
|
|
1508
1506
|
The decoders and consumer projections are read-only. Since [Review #713](https://github.com/rig-c/review/issues/713)
|
|
1509
|
-
(HQ contract ruling), the UI finalizers
|
|
1510
|
-
rig and direction review-verdict and signoff
|
|
1511
|
-
keeps its existing `words` and `issues` fields.
|
|
1507
|
+
(HQ contract ruling), the UI finalizers use act@6 as the base format for
|
|
1508
|
+
fresh checkpoint, parts-verdict, rig and direction review-verdict and signoff
|
|
1509
|
+
acts. The UI submission keeps its existing `words` and `issues` fields.
|
|
1510
|
+
[Review #746](https://github.com/rig-c/review/issues/746)
|
|
1512
1511
|
adds optional `feedback: Feedback[]` beside required `words` only for the
|
|
1513
1512
|
`rig-review` verdict submission. When present, including an empty list,
|
|
1514
1513
|
`feedback` supplies the pinned comments and suppresses the `words` fallback.
|
|
@@ -1518,8 +1517,7 @@ malformed or blank rows. The act bar sends a detached feedback list when there
|
|
|
1518
1517
|
are pinned comments and keeps `words` as their projection. It omits `feedback`
|
|
1519
1518
|
when there are no pinned comments. With `feedback` absent, nonblank `words`
|
|
1520
1519
|
still supplies one general comment. Direction and image verdict submissions
|
|
1521
|
-
keep their existing closed shapes.
|
|
1522
|
-
act@6 format.
|
|
1520
|
+
keep their existing closed shapes.
|
|
1523
1521
|
|
|
1524
1522
|
Only the `rig-review` verdict and `parts-verdict` accept optional
|
|
1525
1523
|
`general: readonly string[]` in their UI submission values. Each string becomes
|
|
@@ -1528,12 +1526,13 @@ produced by the existing fields. For parts verdicts, nonblank `words` still
|
|
|
1528
1526
|
produces a comment after the pinned `issues` and before `general`. Parts Request
|
|
1529
1527
|
changes still requires a pinned issue, and approval still requires zero issues. The existing decoder
|
|
1530
1528
|
validates the combined comment count, text, evidence and signed projection.
|
|
1531
|
-
Omitting `general` preserves the existing written bytes.
|
|
1532
|
-
keeps the
|
|
1529
|
+
Omitting `general` preserves the existing written bytes. Adding `general` by
|
|
1530
|
+
itself keeps the existing schema selection. Historical words-only acts retain
|
|
1531
|
+
their readers. [Review #831](https://github.com/rig-c/review/issues/831).
|
|
1533
1532
|
|
|
1534
1533
|
Pointed marks, inline crops, bookmarks and valid time-only null frames remain
|
|
1535
|
-
inside the existing `anchor.context`.
|
|
1536
|
-
`comment.context
|
|
1534
|
+
inside the existing `anchor.context`. [Comment context (act@7)](#comment-context-act7)
|
|
1535
|
+
defines the separate top-level `comment.context` field.
|
|
1537
1536
|
|
|
1538
1537
|
For the words-only mapping, the daemon maps a nonblank note
|
|
1539
1538
|
to one comment: anchored to the checkpoint for a checkpoint, general otherwise.
|
|
@@ -1609,9 +1608,8 @@ Anchors use existing source-bound fields without a new kind discriminator:
|
|
|
1609
1608
|
`view.visibleLayers: {name, imageHash}[]` retains the complete visible set in
|
|
1610
1609
|
source item order, bound to `sourceHash` and each loaded source image. Entries
|
|
1611
1610
|
must be unique and source-bound before restoration replaces the hidden set.
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
`EMIT_UNPINNED_CREATE_FIELDS` gate is enabled after Create confirms its parser pin.
|
|
1611
|
+
Starting in 4.8.0, fresh assembled capture writes this field. Readers accept
|
|
1612
|
+
both forms. Absence retains the historical restore branch and recorded bytes.
|
|
1615
1613
|
- Named image: `name`, optionally the complete existing-field composition
|
|
1616
1614
|
`imageRegion, crop, nativeCrop`. Names resolve in the sealed image set. Regions
|
|
1617
1615
|
use nonnegative native-pixel integer origins, positive extents and at most
|
|
@@ -1690,10 +1688,11 @@ existing pin or restore path already carries:
|
|
|
1690
1688
|
Each key reuses the decoder of the shape it copies. A `reopen` act has no ask
|
|
1691
1689
|
subject, so its comments cannot carry `context.subject`.
|
|
1692
1690
|
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1691
|
+
Starting in 4.8.0, the rig verdict writer takes top-level `context` from pinned
|
|
1692
|
+
stage-comment evidence and the bound ask and source. It uses @7 when at least
|
|
1693
|
+
one comment carries that context and @6 when none does. A rig verdict carrying
|
|
1694
|
+
mesh edits uses @8 as described below.
|
|
1695
|
+
See [Create compatibility](STABILITY.md#mesh-edit-act-compatibility).
|
|
1697
1696
|
|
|
1698
1697
|
### Mesh edits on Request changes (act@8)
|
|
1699
1698
|
|
|
@@ -1765,18 +1764,15 @@ escaping and serialize numbers as ECMAScript `Number.prototype.toString`
|
|
|
1765
1764
|
shortest round-trip text. The value contains no integer-like keys, negative
|
|
1766
1765
|
zero or non-finite numbers. For this value domain the rule is RFC 8785 (JCS).
|
|
1767
1766
|
|
|
1768
|
-
**Review refusals
|
|
1767
|
+
**Review refusals.** Before writing the act, Review refuses with
|
|
1769
1768
|
`JOB_ACT_INVALID` for invalid shape, digest mismatch, invalid ordering or
|
|
1770
1769
|
duplicate identity, ineligible kind, stage or verdict, counts that differ from
|
|
1771
1770
|
the stored entry, or an op that cannot replay over the stored topology. An
|
|
1772
1771
|
attachment hash that differs from the retained displayed model refuses
|
|
1773
1772
|
`JOB_ACT_SOURCE_STALE`. Existing browser `MESH_EDIT_*` refusals still apply.
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
Create must pin a Review release that reads @8 and build its relay before
|
|
1778
|
-
emission opens. The release that opens the gate will be recorded here when it
|
|
1779
|
-
is known. Older decoders refuse act@8 with `JOB_ACT_INVALID`.
|
|
1773
|
+
Starting in 4.8.0, eligible submissions carrying edits emit act@8. Review
|
|
1774
|
+
decoders older than 4.7.0 refuse act@8 with `JOB_ACT_INVALID`. See
|
|
1775
|
+
[Create compatibility](STABILITY.md#mesh-edit-act-compatibility).
|
|
1780
1776
|
Review refuses `JOB_BODY_LIMIT` if the canonical UTF-8 JSON of
|
|
1781
1777
|
`value.meshEdits` exceeds 256 KiB. Rig stills and inline comment images
|
|
1782
1778
|
retain their existing request allowances. Finalized-act delivery retains its
|
package/docs/STABILITY.md
CHANGED
|
@@ -420,18 +420,18 @@ preserve capability, origin, size, cancellation and replay checks.
|
|
|
420
420
|
narrow on `schema`. @8 uses the @7 envelope and comment rules, with optional
|
|
421
421
|
`value.meshEdits` restricted to a `review-verdict` at `stage: "rig-review"` with
|
|
422
422
|
`verdict: "changes-requested"`. An edited request may carry an empty comments
|
|
423
|
-
array.
|
|
423
|
+
array. Rig verdicts without edits use @7 when a comment carries top-level
|
|
424
|
+
`context` and @6 otherwise.
|
|
424
425
|
Existing @2–@7 decoder entry points, accepted shapes and historical bytes
|
|
425
426
|
retain their contracts. The API version, reviewer and consumer grant, and
|
|
426
427
|
reserved standalone `mesh-edit` kind keep their current contracts. The legacy
|
|
427
428
|
`rig-review-mesh-edit/1` export and `--delta` input keep their existing formats.
|
|
428
429
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
position checks are part of the [act@8 wire contract](REVIEW_PACKAGE.md#mesh-edits-on-request-changes-act8).
|
|
430
|
+
Starting in 4.8.0, Review emits @8 for eligible submissions carrying edits.
|
|
431
|
+
Create versions below 1.13.0 must not run with Review 4.8.0. Create's exact Review
|
|
432
|
+
dependency pin normally prevents this pairing. Review decoders older than 4.7.0
|
|
433
|
+
refuse @8 with `JOB_ACT_INVALID`. The consumer's required hash, frame and position
|
|
434
|
+
checks are part of the [act@8 wire contract](REVIEW_PACKAGE.md#mesh-edits-on-request-changes-act8).
|
|
435
435
|
The host facade adds `parseMeshEditsAct`, `JOB_MESH_EDITS_ACT_SCHEMA` and
|
|
436
436
|
the three mesh edit types listed below.
|
|
437
437
|
|
|
@@ -448,14 +448,14 @@ See [Comments decoder contract](REVIEW_PACKAGE.md#comments-decoder-contract).
|
|
|
448
448
|
(`rig-review/act@7`), for thirty runtime exports total, plus the type-only
|
|
449
449
|
`JobCommentContext`, `JobContextComment` and `JobContextCommentsAct`. The change
|
|
450
450
|
is additive: `parseCommentsAct`, `JobComment` and `JobCommentsAct` keep their @6
|
|
451
|
-
shapes, and @2–@6 decode unchanged.
|
|
452
|
-
|
|
451
|
+
shapes, and @2–@6 decode unchanged. Starting in 4.8.0, the comments writer
|
|
452
|
+
uses @7 when a comment carries top-level `context`. See [Comment context (act@7)](REVIEW_PACKAGE.md#comment-context-act7).
|
|
453
453
|
|
|
454
454
|
[Review #713](https://github.com/rig-c/review/issues/713) turns on the act@6
|
|
455
455
|
writers. `JobAct` widens to `JobLegacyAct | JobRigReviewAct | JobPartsVerdictAct |
|
|
456
456
|
JobCommentsAct`, so `JobActV3`, `JobEvent`, `JobEventV3`, `JobNextValue`,
|
|
457
457
|
`JobNextValueV3` and `JobHostPorts.commitUIAct` admit fresh act@6 values. No
|
|
458
|
-
export is added or removed, and `JobComment` is unchanged.
|
|
458
|
+
export is added or removed, and `JobComment` is unchanged. With that change, fresh UI checkpoint,
|
|
459
459
|
parts-verdict, rig and direction review-verdict and signoff acts are
|
|
460
460
|
`rig-review/act@6`. Image-review verdicts and interview picks stay at act@2, and
|
|
461
461
|
record acts stay at act@4. Consumers narrow on `schema`. A consumer's
|
|
@@ -471,10 +471,11 @@ existing `feedbackItemComments` mapper and act@6 decoder. It preserves entry
|
|
|
471
471
|
order, text, IDs, frames, target, category and `anchor.context` (including point,
|
|
472
472
|
crop, bookmark and valid time-only null-frame evidence). `words` supplies the
|
|
473
473
|
legacy general comment only when `feedback` is absent.
|
|
474
|
-
Direction and image submissions retain their previous closed shapes.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
Direction and image submissions retain their previous closed shapes. Review
|
|
475
|
+
originally wrote this mapping as act@6. Starting in 4.8.0, pinned rig stage
|
|
476
|
+
comments can also carry the top-level context described above. Historical
|
|
477
|
+
words-only acts still parse.
|
|
478
|
+
See [Comments decoder contract](REVIEW_PACKAGE.md#comments-decoder-contract).
|
|
478
479
|
|
|
479
480
|
The `rig-review` verdict and `parts-verdict` accept optional
|
|
480
481
|
`general: readonly string[]` on their UI submission values. The writer appends
|
|
@@ -486,7 +487,12 @@ Request changes verdict still requires a pinned issue, and approval still
|
|
|
486
487
|
requires zero issues.
|
|
487
488
|
The existing act@6 decoder checks the combined comment count, text and signed
|
|
488
489
|
projection. Omitting `general` preserves the existing mapping and serialized
|
|
489
|
-
act bytes.
|
|
490
|
+
act bytes. Adding `general` by itself keeps the existing schema selection.
|
|
491
|
+
[Review #831](https://github.com/rig-c/review/issues/831).
|
|
492
|
+
|
|
493
|
+
Starting in 4.8.0, fresh assembled Parts issues carry `view.visibleLayers`
|
|
494
|
+
with the complete source-bound visible set. Readers still accept historical
|
|
495
|
+
anchors without that field. See [Comments decoder contract](REVIEW_PACKAGE.md#comments-decoder-contract).
|
|
490
496
|
|
|
491
497
|
[Review #914](https://github.com/rig-c/review/issues/914) adds
|
|
492
498
|
`JOB_PREVIOUS_DRAFT_SCHEMA` (`rig-review-previous-draft/1`) and the
|
|
@@ -502,6 +508,14 @@ with the keys absent keep their existing contract. The Review-to-publisher
|
|
|
502
508
|
pin gate applies in its existing direction. See
|
|
503
509
|
[Previous accepted draft Difference](REVIEW_PACKAGE.md#previous-accepted-draft-difference).
|
|
504
510
|
|
|
511
|
+
[Review #914](https://github.com/rig-c/review/issues/914) adds the previous-draft
|
|
512
|
+
constant `JOB_PREVIOUS_DRAFT_SCHEMA` (`rig-review-previous-draft/1`), for twenty-nine runtime exports total after the 4.0.0 removal of `startJobHub` and `assertJobImageSetCapability`, plus the type-only `JobPreviousDraft`.
|
|
513
|
+
|
|
514
|
+
[Review #952](https://github.com/rig-c/review/issues/952) adds the act@8 decoder
|
|
515
|
+
`parseMeshEditsAct` and its constant `JOB_MESH_EDITS_ACT_SCHEMA`
|
|
516
|
+
(`rig-review/act@8`), for thirty-one runtime exports total, plus the type-only
|
|
517
|
+
`JobMeshEditValue`, `JobMeshEdit` and `JobMeshEditsAct`.
|
|
518
|
+
|
|
505
519
|
The exact runtime exports are listed below. Constants preserve their literal
|
|
506
520
|
values from the frozen semantic contract.
|
|
507
521
|
|
|
@@ -709,14 +723,18 @@ Rows are capped at 4096, roles at 128 UTF-16 code units and literal paths at 409
|
|
|
709
723
|
## Installed acceptance
|
|
710
724
|
|
|
711
725
|
`bun run smoke` packs the package and installs that tarball into an empty project.
|
|
712
|
-
A consumer checks the thirty runtime exports and every listed type, including
|
|
726
|
+
A consumer checks the thirty-one runtime exports and every listed type, including
|
|
713
727
|
`JobHostListenerIncarnation`, `JobHostReuseBinding`, `JobHostReuseExpectation`,
|
|
714
728
|
`JobHostAttachField`, `JobHostAttachFailure`, `JobInterviewJson`,
|
|
715
729
|
`JobInterviewRecord`, `JobInterviewDiagnostic`, `JobInterviewDiagnostics` and
|
|
716
730
|
the comments decoder types and the record-mode `JobRecordAct` / `JobActV3` / `JobPlanSource` /
|
|
717
731
|
`JobFetchActRequestV3` / `JobRecordHostHooks` / `JobCapabilitiesV3` / `JobAskBatchRequestV3` /
|
|
718
732
|
`JobAskBatchValueV3` surface, through `@rig-c/review/job-host`. The consumer also
|
|
719
|
-
proves that `JobCapabilitiesV3` carries `askBatch: true`.
|
|
733
|
+
proves that `JobCapabilitiesV3` carries `askBatch: true`. In `JobCapabilitiesV3`,
|
|
734
|
+
`recordPublication`, `recordActSchema` and `askBatch` describe the host rather
|
|
735
|
+
than the current head: `ask-batch` applies only to a record-retained head
|
|
736
|
+
publication and a package head refuses `JOB_REQUEST_INVALID`, so a consumer
|
|
737
|
+
checks the publication's mode as well as the flag.
|
|
720
738
|
TypeScript checks the installed consumer and the runtime checks the full owner
|
|
721
739
|
resources, retained publication, semantic ports, declared hooks, enumerator
|
|
722
740
|
version/row carriage, ordinary reuse, strict `reuseOnly: {expected}` attachment
|
package/package.json
CHANGED
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, JobMeshEditsAct} 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 | JobMeshEditsAct>): {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/job-act.ts
CHANGED
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
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
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
|
-
meshEditsActForEmission, parseCommentsAct, parseMeshEdits, 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,7 +24,6 @@ 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';
|
|
25
|
-
import {EMIT_UNPINNED_CREATE_FIELDS} from './create-pin-gate.ts';
|
|
26
27
|
import {applyMeshOps, attachmentHashText, MESH_EDIT_CODES} from './mesh-edit.ts';
|
|
27
28
|
import {readStoredSetupMesh} from './setup-mesh.ts';
|
|
28
29
|
|
|
@@ -37,6 +38,20 @@ function commentsAct(act: JobCommentsAct): JobCommentsAct {
|
|
|
37
38
|
return act;
|
|
38
39
|
}
|
|
39
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
|
+
|
|
40
55
|
function hasMeshSubmission(kind: unknown, value: unknown): boolean {
|
|
41
56
|
if (value === null || typeof value !== 'object' || !Object.hasOwn(value, 'meshEdits')) return false;
|
|
42
57
|
const {stage, verdict} = value as {stage?: unknown; verdict?: unknown};
|
|
@@ -210,9 +225,6 @@ export function parseUISubmission(
|
|
|
210
225
|
if (!allowed) {
|
|
211
226
|
throw new JobError('JOB_ACT_INVALID');
|
|
212
227
|
}
|
|
213
|
-
if (hasMeshSubmission(item.kind, item.value) && !EMIT_UNPINNED_CREATE_FIELDS) {
|
|
214
|
-
throw new JobError('JOB_ACT_KIND_DISABLED');
|
|
215
|
-
}
|
|
216
228
|
if (item.capture !== undefined && (item.kind !== 'review-verdict' ||
|
|
217
229
|
(item.value as {stage?: unknown} | null)?.stage !== 'rig-review')) throw new JobError('JOB_REQUEST_INVALID');
|
|
218
230
|
return item as unknown as UISubmissionV3;
|
|
@@ -513,7 +525,6 @@ export function finalizeJobAct(options: {
|
|
|
513
525
|
readonly still?: JobRigStill;
|
|
514
526
|
readonly actId?: string;
|
|
515
527
|
readonly at?: string;
|
|
516
|
-
readonly emitUnpinned?: boolean;
|
|
517
528
|
}): ActV3;
|
|
518
529
|
export function finalizeJobAct(options: {
|
|
519
530
|
readonly jobId: string;
|
|
@@ -524,15 +535,12 @@ export function finalizeJobAct(options: {
|
|
|
524
535
|
readonly still?: JobRigStill;
|
|
525
536
|
readonly actId?: string;
|
|
526
537
|
readonly at?: string;
|
|
527
|
-
readonly emitUnpinned?: boolean;
|
|
528
538
|
}): ActV3 {
|
|
529
539
|
const meshSubmission = hasMeshSubmission(options.submission.kind, options.submission.value);
|
|
530
540
|
if (meshSubmission && (isRetainedRecordSource(options.retained) ||
|
|
531
541
|
options.ask.subject.kind !== 'review-verdict' || options.ask.subject.stage !== 'rig-review')) {
|
|
532
542
|
throw new JobError('JOB_ACT_INVALID');
|
|
533
543
|
}
|
|
534
|
-
const emitUnpinned = options.emitUnpinned ?? EMIT_UNPINNED_CREATE_FIELDS;
|
|
535
|
-
if (meshSubmission && !emitUnpinned) throw new JobError('JOB_ACT_KIND_DISABLED');
|
|
536
544
|
if (isRetainedRecordSource(options.retained)) {
|
|
537
545
|
return prepareJobRecordAct({
|
|
538
546
|
jobId: options.jobId,
|
|
@@ -662,15 +670,18 @@ export function finalizeJobAct(options: {
|
|
|
662
670
|
if (!options.still) throw new JobError('JOB_STILL_CAPTURE_FAILED');
|
|
663
671
|
const note = words(value.words);
|
|
664
672
|
if (value.feedback !== undefined && !Array.isArray(value.feedback)) throw new JobError('JOB_ACT_INVALID');
|
|
665
|
-
|
|
673
|
+
const selector = source.selector as Extract<NonNullable<JobSourceBinding['selector']>, {kind: 'rig'}>;
|
|
674
|
+
let verdictComments: readonly JobContextComment[];
|
|
666
675
|
try {
|
|
667
|
-
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});
|
|
668
678
|
} catch { throw new JobError('JOB_ACT_INVALID'); }
|
|
669
679
|
const act = {...comments, kind: 'review-verdict' as const,
|
|
670
|
-
source: {...source, model: source.model!, selector
|
|
680
|
+
source: {...source, model: source.model!, selector},
|
|
671
681
|
value: {stage: 'rig-review' as const, verdict, comments: [...verdictComments, ...generalComments(value.general)]},
|
|
672
682
|
still: options.still};
|
|
673
|
-
if (meshEdits) return meshEditsActForEmission({...act, value: {...act.value, meshEdits}}
|
|
683
|
+
if (meshEdits) return meshEditsActForEmission({...act, value: {...act.value, meshEdits}});
|
|
684
|
+
if (verdictComments.some(comment => Object.hasOwn(comment, 'context'))) return commentsActForEmission(act);
|
|
674
685
|
return commentsAct(act);
|
|
675
686
|
}
|
|
676
687
|
return commentsAct({ ...comments, kind: 'review-verdict', source: { ...source, model: source.model!,
|
package/src/job-api.ts
CHANGED
|
@@ -29,7 +29,6 @@ import { parseStageComment, hasStageComment, projectComments, commentModes } fro
|
|
|
29
29
|
import { validatePngCrop, validatePngCropMetadata } from './comment-crops.ts';
|
|
30
30
|
import {parseJobPartsIdentity} from './job-source.ts';
|
|
31
31
|
import {parseControlPart, parseControlView} from './control.ts';
|
|
32
|
-
import {EMIT_UNPINNED_CREATE_FIELDS} from './create-pin-gate.ts';
|
|
33
32
|
import {canonicalJson} from './canonical-json.ts';
|
|
34
33
|
import {MESH_EDIT_MAX_OPS, type Vec} from './mesh-edit.ts';
|
|
35
34
|
|
|
@@ -1528,25 +1527,22 @@ export function parseMeshEdits(raw: unknown): readonly JobMeshEdit[] {
|
|
|
1528
1527
|
}, 'JOB_ACT_INVALID');
|
|
1529
1528
|
}
|
|
1530
1529
|
|
|
1531
|
-
/**
|
|
1532
|
-
export function commentsActForEmission(act: JobCommentsAct | JobContextCommentsAct
|
|
1533
|
-
emitUnpinned: boolean = EMIT_UNPINNED_CREATE_FIELDS): JobCommentsAct | JobContextCommentsAct {
|
|
1530
|
+
/** Write @7 when a comment carries context, otherwise keep the @6 envelope. */
|
|
1531
|
+
export function commentsActForEmission(act: JobCommentsAct | JobContextCommentsAct): JobCommentsAct | JobContextCommentsAct {
|
|
1534
1532
|
const value = act.value as {comments: readonly JobContextComment[]};
|
|
1535
|
-
const
|
|
1536
|
-
const
|
|
1537
|
-
const next = {...structuredClone(act), schema, value: {...structuredClone(act.value), comments: structuredClone(comments)}};
|
|
1533
|
+
const schema = value.comments.some(comment => Object.hasOwn(comment, 'context')) ? JOB_COMMENT_CONTEXT_ACT_SCHEMA : JOB_COMMENTS_ACT_SCHEMA;
|
|
1534
|
+
const next = {...act, schema};
|
|
1538
1535
|
return schema === JOB_COMMENTS_ACT_SCHEMA ? parseCommentsAct(next) : parseContextCommentsAct(next);
|
|
1539
1536
|
}
|
|
1540
1537
|
|
|
1541
|
-
/**
|
|
1538
|
+
/** Write @8 for a rig verdict carrying mesh evidence. */
|
|
1542
1539
|
export function meshEditsActForEmission(act: JobCommentsAct | (Extract<JobCommentsAct, {kind: 'review-verdict'}> & {
|
|
1543
1540
|
readonly value: {readonly meshEdits: readonly JobMeshEdit[]};
|
|
1544
|
-
})
|
|
1541
|
+
})): JobCommentsAct | Extract<JobAct, {schema: typeof JOB_MESH_EDITS_ACT_SCHEMA}> {
|
|
1545
1542
|
if (!Object.hasOwn(act.value, 'meshEdits')) {
|
|
1546
1543
|
parseCommentsAct(act);
|
|
1547
1544
|
return act;
|
|
1548
1545
|
}
|
|
1549
|
-
if (!emitMeshEdits) throw new JobError('JOB_ACT_KIND_DISABLED');
|
|
1550
1546
|
return parseMeshEditsAct({...act, schema: JOB_MESH_EDITS_ACT_SCHEMA}) as Extract<JobAct, {schema: typeof JOB_MESH_EDITS_ACT_SCHEMA}>;
|
|
1551
1547
|
}
|
|
1552
1548
|
|
package/src/job-cli.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import {closeSync, constants, fstatSync, fsyncSync, lstatSync, openSync, readFileSync, renameSync, unlinkSync, writeSync} from 'node:fs';
|
|
3
3
|
import {join} from 'node:path';
|
|
4
|
-
import { JOB_API_SCHEMA, JOB_ACT_SCHEMA, JOB_PARTS_VERDICT_ACT_SCHEMA, JOB_RIG_REVIEW_ACT_SCHEMA, JOB_COMMENTS_ACT_SCHEMA, JOB_MESH_EDITS_ACT_SCHEMA, JOB_ENABLED_ACT_KINDS, jobRawActMediaType, jobStillByteLimit, jobActDeliveryLimit, jobResponseBodyLimit,
|
|
5
|
-
type JobAct, type
|
|
6
|
-
import { assertJobApiSchema, jobFailure, jobHash, jobId, jobInteger, jobObject, jobWaitLimitMs, parseJobRequest, parseCommentsAct, parseMeshEditsAct } from './job-api.ts';
|
|
4
|
+
import { JOB_API_SCHEMA, JOB_ACT_SCHEMA, JOB_PARTS_VERDICT_ACT_SCHEMA, JOB_RIG_REVIEW_ACT_SCHEMA, JOB_COMMENTS_ACT_SCHEMA, JOB_COMMENT_CONTEXT_ACT_SCHEMA, JOB_MESH_EDITS_ACT_SCHEMA, JOB_ENABLED_ACT_KINDS, jobRawActMediaType, jobStillByteLimit, jobActDeliveryLimit, jobResponseBodyLimit,
|
|
5
|
+
type JobAct, type JobMeshEditsAct, type JobAgentRequest, type JobNextRequest, type JobNextValue } from './job-contract.ts';
|
|
6
|
+
import { assertJobApiSchema, jobFailure, jobHash, jobId, jobInteger, jobObject, jobWaitLimitMs, parseJobRequest, parseCommentsAct, parseContextCommentsAct, parseMeshEditsAct } from './job-api.ts';
|
|
7
7
|
import { JobError } from './job-store.ts';
|
|
8
8
|
import {validatePngBytes} from './comment-crops.ts';
|
|
9
9
|
import {destinationDirectory} from './destination-directory.ts';
|
|
@@ -145,15 +145,21 @@ async function consumerBytes(stream: ReadableStream<Uint8Array> | null, maximum:
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
type ConsumerAct = JobAct |
|
|
148
|
+
type ConsumerAct = JobAct | JobMeshEditsAct;
|
|
149
|
+
|
|
150
|
+
const consumerCommentsDecoders = {
|
|
151
|
+
[JOB_COMMENTS_ACT_SCHEMA]: parseCommentsAct,
|
|
152
|
+
[JOB_COMMENT_CONTEXT_ACT_SCHEMA]: parseContextCommentsAct,
|
|
153
|
+
[JOB_MESH_EDITS_ACT_SCHEMA]: parseMeshEditsAct,
|
|
154
|
+
} as const;
|
|
149
155
|
|
|
150
156
|
function parseConsumerAct(bytes: Buffer, job: string, actId: string): ConsumerAct {
|
|
151
157
|
let value: unknown;
|
|
152
158
|
try { value = JSON.parse(new TextDecoder('utf-8', {fatal: true}).decode(bytes)); }
|
|
153
159
|
catch { throw new JobError('JOB_REQUEST_INVALID'); }
|
|
154
160
|
const act = jobObject(value, ['schema', 'actId', 'jobId', 'askId', 'publicationId', 'kind', 'authority', 'at', 'source', 'value', 'still']);
|
|
155
|
-
if (act.schema ===
|
|
156
|
-
const comments = act.schema
|
|
161
|
+
if (typeof act.schema === 'string' && Object.hasOwn(consumerCommentsDecoders, act.schema)) {
|
|
162
|
+
const comments = consumerCommentsDecoders[act.schema as keyof typeof consumerCommentsDecoders](act);
|
|
157
163
|
if (comments.jobId !== job || comments.actId !== actId) throw new JobError('JOB_ACT_INVALID');
|
|
158
164
|
return comments;
|
|
159
165
|
}
|
package/src/job-contract.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const JOB_RECORD_ACT_SCHEMA = 'rig-review/act@4' as const;
|
|
|
31
31
|
export const JOB_PARTS_VERDICT_ACT_SCHEMA = 'rig-review/act@5' as const;
|
|
32
32
|
/** Fresh checkpoint, parts-verdict, rig/post review-verdict and signoff writers. Image-review and interview-picks stay @2; record acts stay @4. */
|
|
33
33
|
export const JOB_COMMENTS_ACT_SCHEMA = 'rig-review/act@6' as const;
|
|
34
|
-
/** @6 plus an optional per-comment `context
|
|
34
|
+
/** @6 plus an optional per-comment `context` (#714). */
|
|
35
35
|
export const JOB_COMMENT_CONTEXT_ACT_SCHEMA = 'rig-review/act@7' as const;
|
|
36
36
|
/** @7 plus a mesh payload on a compiled rig's Request changes (#952). */
|
|
37
37
|
export const JOB_MESH_EDITS_ACT_SCHEMA = 'rig-review/act@8' as const;
|
|
@@ -625,8 +625,8 @@ export type JobPartsVerdictAct = Omit<Extract<JobLegacyAct, {kind: 'parts-verdic
|
|
|
625
625
|
};
|
|
626
626
|
|
|
627
627
|
/** Historical @2 acts remain readable without being backfilled or relabelled.
|
|
628
|
-
* Fresh
|
|
629
|
-
export type JobAct = JobLegacyAct | JobRigReviewAct | JobPartsVerdictAct | JobCommentsAct | JobRigMeshEditsAct;
|
|
628
|
+
* Fresh comments use @6, live rig comments carrying context use @7, and rig verdicts carrying mesh edits use @8. */
|
|
629
|
+
export type JobAct = JobLegacyAct | JobRigReviewAct | JobPartsVerdictAct | JobCommentsAct | JobContextCommentsAct | JobRigMeshEditsAct;
|
|
630
630
|
|
|
631
631
|
/** Authenticated browser provenance. The daemon validates identity and hashes PNG bytes. */
|
|
632
632
|
export interface JobRigCapture {
|
|
@@ -1223,6 +1223,11 @@ export type RecordAct = Pick<JobLegacyAct,
|
|
|
1223
1223
|
export type SourceV3 = JobSourceBinding | RecordSource;
|
|
1224
1224
|
export type ActV3 = JobAct | RecordAct;
|
|
1225
1225
|
|
|
1226
|
+
/**
|
|
1227
|
+
* `recordPublication`, `recordActSchema` and `askBatch` describe the host, not the current head.
|
|
1228
|
+
* `ask-batch` applies only to a record-retained head publication; a package head refuses `JOB_REQUEST_INVALID`,
|
|
1229
|
+
* so a consumer checks the publication's mode as well as the flag (#972).
|
|
1230
|
+
*/
|
|
1226
1231
|
export interface JobCapabilitiesV3 extends JobCapabilities {
|
|
1227
1232
|
readonly recordPublication: true;
|
|
1228
1233
|
readonly recordActSchema: typeof JOB_RECORD_ACT_SCHEMA;
|
package/src/job-session.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
2
2
|
import { dirname, isAbsolute, join, relative, sep } from 'node:path';
|
|
3
3
|
import {
|
|
4
|
-
JOB_API_SCHEMA, JOB_API_V3_SCHEMA, JOB_ACT_SCHEMA, JOB_COMMENTS_ACT_SCHEMA, JOB_MESH_EDITS_ACT_SCHEMA, JOB_PARTS_VERDICT_ACT_SCHEMA, JOB_RIG_REVIEW_ACT_SCHEMA, JOB_RECORD_READER_ID, jobStillByteLimit, jobActDeliveryLimit, JOB_CAPABILITIES, JOB_CAPABILITIES_V3, JOB_ENABLED_ACT_KINDS,
|
|
4
|
+
JOB_API_SCHEMA, JOB_API_V3_SCHEMA, JOB_ACT_SCHEMA, JOB_COMMENTS_ACT_SCHEMA, JOB_COMMENT_CONTEXT_ACT_SCHEMA, JOB_MESH_EDITS_ACT_SCHEMA, JOB_PARTS_VERDICT_ACT_SCHEMA, JOB_RIG_REVIEW_ACT_SCHEMA, JOB_RECORD_READER_ID, jobStillByteLimit, jobActDeliveryLimit, JOB_CAPABILITIES, JOB_CAPABILITIES_V3, JOB_ENABLED_ACT_KINDS,
|
|
5
5
|
type ActV3, type AgentRequestV3, type EventV3, type JobPartsEnumerator, type JobAct, type JobAgentRequest, type JobDisplayAcknowledgment,
|
|
6
6
|
type JobDisplayPublication, type JobDisplayPublicationV3, type JobDisplayReceipt, type JobEvent, type JobFetchActRequest, type JobFetchActRequestV3,
|
|
7
7
|
type JobNextValue, type JobPendingAsk, type JobPublication, type JobPublicationMode, type JobReviewerBinding,
|
|
8
8
|
type JobSubject, type NextValueV3, type PendingAskV3, type PublicationV3, type RecordPublicationReader, type RecordSubject, type StatusV3,
|
|
9
9
|
} from './job-contract.ts';
|
|
10
10
|
import { bindJobAsk, bindJobRecordAsk, finalizeJobAct, parseUISubmission, prepareJobRecordAct, prepareJobStill } from './job-act.ts';
|
|
11
|
-
import { atSubject, isRecordSource, parseRecordSource, parseCommentsAct, parseMeshEditsAct, jobApiSchemaForMode, jobHash, jobPartsEnumeratorVersion, jobWaitLimitMs, requestDigest, sameCapability } from './job-api.ts';
|
|
11
|
+
import { atSubject, isRecordSource, parseRecordSource, parseCommentsAct, parseContextCommentsAct, parseMeshEditsAct, jobApiSchemaForMode, jobHash, jobPartsEnumeratorVersion, jobWaitLimitMs, requestDigest, sameCapability } from './job-api.ts';
|
|
12
12
|
import {
|
|
13
13
|
assertStoredCheckpointEvidence, assertJobRoot, assertJobSourceCurrent, assertRetainedSnapshotIntact, captureJobRoot, isRetainedRecordSource, loadRetainedJobReview, prepareJobSource, jobSnapshotHash, removeOwnedJobSnapshot, verifyJobRecordSourceFresh,
|
|
14
14
|
type JobPublicationReader, type JobRetainedSource, type JobRetainedSourceV3, type JobRootIdentity,
|
|
@@ -637,7 +637,8 @@ export class JobSession {
|
|
|
637
637
|
const storedAct = current.data.acts[actId];
|
|
638
638
|
if (!storedAct) throw new JobError('JOB_ACT_UNKNOWN');
|
|
639
639
|
// Validation must not replace the stored representation or reorder its keys.
|
|
640
|
-
if (
|
|
640
|
+
if (storedAct.schema === JOB_COMMENTS_ACT_SCHEMA) parseCommentsAct(storedAct);
|
|
641
|
+
if (storedAct.schema === JOB_COMMENT_CONTEXT_ACT_SCHEMA) parseContextCommentsAct(storedAct);
|
|
641
642
|
if (storedAct.schema === JOB_MESH_EDITS_ACT_SCHEMA) parseMeshEditsAct(storedAct);
|
|
642
643
|
const still = 'still' in storedAct ? storedAct.still : undefined;
|
|
643
644
|
const actBytes = Buffer.from(JSON.stringify(storedAct));
|
package/web/job-rig-screen.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type {PartsSubjectData} from './parts-viewport-provider.ts';
|
|
|
6
6
|
* Rig verdicts use the act bar; supported approval and interview asks use the shared ask dialog. */
|
|
7
7
|
import {JOB_MESH_EDITS_ACT_SCHEMA,type ActV3,type DisplayPublicationV3,type JobMeshEdit,type JobResult,type JobUISubmission,type PendingAskV3,type SourceV3,type UISubmissionV3} from '../src/job-contract.ts';
|
|
8
8
|
import {canonicalJson} from '../src/canonical-json.ts';
|
|
9
|
-
import {EMIT_UNPINNED_CREATE_FIELDS} from '../src/create-pin-gate.ts';
|
|
10
9
|
import {draftKey} from '../src/mesh-edit.ts';
|
|
11
10
|
import type {Feedback, ReviewSession} from '../src/session.ts';
|
|
12
11
|
import type {ReviewManifest, ReviewedSource} from '../src/manifest.ts';
|
|
@@ -224,8 +223,7 @@ export function createJobRigScreen(options: {
|
|
|
224
223
|
if(directionWords!==undefined)for(const decision of decisions)if(decision.kind==='review-verdict'&&decision.value.stage==='direction-review')decision.value.words=directionWords;
|
|
225
224
|
if (!decisions.length) throw new Error('JOB_ACT_NOTHING_TO_SUBMIT');
|
|
226
225
|
const rigChanges=decisions.find(decision=>decision.kind==='review-verdict'&&decision.value.stage==='rig-review'&&decision.value.verdict==='changes-requested');
|
|
227
|
-
|
|
228
|
-
const meshDraft=EMIT_UNPINNED_CREATE_FIELDS&&rigChanges?.kind==='review-verdict'?await screen?.meshEdits?.():null;
|
|
226
|
+
const meshDraft=rigChanges?.kind==='review-verdict'?await screen?.meshEdits?.():null;
|
|
229
227
|
if(rigChanges?.kind==='review-verdict'){
|
|
230
228
|
if(meshDraft?.edits.length){
|
|
231
229
|
const edits=meshDraft.edits.map(edit=>({key:draftKey(edit),edit}));
|
|
@@ -327,7 +325,7 @@ export function createJobRigScreen(options: {
|
|
|
327
325
|
return Promise.reject(new Error('JOB_REVIEW_READ_ONLY'));
|
|
328
326
|
},
|
|
329
327
|
submit,
|
|
330
|
-
canSubmitMeshEdits:()
|
|
328
|
+
canSubmitMeshEdits:()=>!!screen?.hasMeshEdits?.(),
|
|
331
329
|
attach: value => {screen = value;lastMessage=['',false];streamReport=null;screen.pendingSubjects?.(pendingSubjects());refreshRecordForms();},
|
|
332
330
|
displayed: () => ready.resolve(),
|
|
333
331
|
failed: error => ready.reject(error)};
|
package/web/mesh-editor.ts
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* inspected build, and the local draft keeps the applied delta (edits over the revision are not written to it).
|
|
12
12
|
*/
|
|
13
13
|
import type {CropWorldMapping} from '../src/chest-regions.ts';
|
|
14
|
-
import {EMIT_UNPINNED_CREATE_FIELDS} from '../src/create-pin-gate.ts';
|
|
15
14
|
import type {JobMeshEditValue} from '../src/job-contract.ts';
|
|
16
15
|
import {readStoredSetupMesh,setupModel} from '../src/setup-mesh.ts';
|
|
17
16
|
import {
|
|
@@ -208,8 +207,8 @@ export function bindMeshEditor(host:MeshEditorHost):MeshEditor {
|
|
|
208
207
|
if(!session){status.textContent=host.applied()&&appliedOutcome?appliedOutcome:'';status.classList.toggle('error',noteError);return;}
|
|
209
208
|
const s=session.source,count=session.ops().length;
|
|
210
209
|
const summary=`${note?note+' · ':''}${count} op${count===1?'':'s'} · setup pose · ${MESH_EDIT_PREVIEW_NOTE} · ${mode?hint[mode]:'no sub-mode — Escape again leaves mesh edit'} · Space-drag pans`;
|
|
211
|
-
const reason=host.job==='read-only'?t('JOB_REVIEW_READ_ONLY')
|
|
212
|
-
t('In a job, press Request changes to send this edit; the producer rebuilds it.'):
|
|
210
|
+
const reason=host.job==='read-only'?t('JOB_REVIEW_READ_ONLY'):job?
|
|
211
|
+
t('In a job, press Request changes to send this edit; the producer rebuilds it.'):null;
|
|
213
212
|
const readout=host.job?[reason,held?.stale?t('job.mesh.staleDraft'):null,tr(summary)].filter(Boolean).join(' · '):summary;
|
|
214
213
|
status.textContent=readout;
|
|
215
214
|
status.title=t('{0} / {1} / {2} · {3} vertices · {4} triangles · hull {5} · {6}',
|
|
@@ -59,7 +59,6 @@ import {paintAssembly,paintMesh,paintOverlay,paintPaintingCrop,pickAssembly,type
|
|
|
59
59
|
import {bindStageComments,type CommentCodec,type CommentUiPose,type CommentRow} from './stage-comments.ts';
|
|
60
60
|
import {parsePartsIssue,assertPartsIssueBinding,snapImageRegion,type PartsIssue} from '../src/parts-comment.ts';
|
|
61
61
|
import {projectMark,unprojectMark,region} from '../src/stage-comment.ts';
|
|
62
|
-
import {EMIT_UNPINNED_CREATE_FIELDS} from '../src/create-pin-gate.ts';
|
|
63
62
|
/** U5 uses the same native raster paint path as a parts subject, with the whole rig as one operand. */
|
|
64
63
|
export function paintRigDifference(canvas:HTMLCanvasElement,still:HTMLCanvasElement,painting:HTMLImageElement) {
|
|
65
64
|
assertOriginalPaintingSize(painting.naturalWidth,painting.naturalHeight,[still.width,still.height],1);
|
|
@@ -110,7 +109,6 @@ export function bindPartsSubject(host:{
|
|
|
110
109
|
const partsBinding=(names:readonly string[])=>names.map(name=>{const entry=data.items.find(item=>item.name===name);if(!entry?.imageHash)throw new Error('PARTS_COMMENT_PART_MISMATCH');return {name,imageHash:entry.imageHash};});
|
|
111
110
|
const sourceItems=()=>new Map(data.items.map(item=>[item.name,{...item,imageHash:item.imageHash!}]));
|
|
112
111
|
async function prepare(issue:PartsIssue):Promise<PartsIssue>{
|
|
113
|
-
if(!EMIT_UNPINNED_CREATE_FIELDS&&Object.hasOwn(issue.view,'visibleLayers')){const {visibleLayers:_ignored,...view}=issue.view;issue={...issue,view};}
|
|
114
112
|
const bound=parsePartsIssue(issue,false,false,false);assertPartsIssueBinding(bound,sourceItems(),data.sourceHash);
|
|
115
113
|
const response=await host.request(`${host.base}/comment`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(bound)});
|
|
116
114
|
if(disposed)throw new Error('PARTS_COMMENT_STALE_SOURCE');return parsePartsIssue((await response.json()).comment,true,false,false);
|
|
@@ -208,7 +206,7 @@ export function bindPartsSubject(host:{
|
|
|
208
206
|
const pose=():PartsPose|null=>{
|
|
209
207
|
let camera=host.viewport.numericView().cameras.rig;const entry=item();if(!camera||!entry||busy||failed||disposed)return null;
|
|
210
208
|
if(data.painting&&!assembled())camera={...camera,center:{x:camera.center.x-entry.x,y:camera.center.y-entry.y},visible:{...camera.visible,x:camera.visible.x-entry.x,y:camera.visible.y-entry.y}};
|
|
211
|
-
return {mode:'parts',item:entry,sourceHash:data.sourceHash,camera,view:{mode:assembled()?'assembled':'item',camera:{zoom:camera.zoom,center:camera.center,viewport:camera.viewport},cameraSync:host.viewport.state.cameraSync,referenceCamera:null,background:'checker',alpha:false,footprints:false,mesh:host.mesh(),comparison:{...comparison},...(assembled()
|
|
209
|
+
return {mode:'parts',item:entry,sourceHash:data.sourceHash,camera,view:{mode:assembled()?'assembled':'item',camera:{zoom:camera.zoom,center:camera.center,viewport:camera.viewport},cameraSync:host.viewport.state.cameraSync,referenceCamera:null,background:'checker',alpha:false,footprints:false,mesh:host.mesh(),comparison:{...comparison},...(assembled()?{visibleLayers:partsBinding(data.items.filter(item=>!hidden.has(item.name)).map(item=>item.name))}:{})},capture:{pane:host.el('rig-viewport'),root:host.el('rig-root'),images:true,canvas:host.canvas,backend:'canvas2d',nearest:true}};
|
|
212
210
|
};
|
|
213
211
|
comments=bindStageComments<CommentRow,PartsPose>({general:host.recordComments||host.generalComments?{
|
|
214
212
|
create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('schema' in row),
|
package/src/create-pin-gate.ts
DELETED