rig-review 4.7.0 → 4.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.
@@ -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
- // Gate off: a held mesh draft is not read or sent; the verdict goes as on main and the draft stays in the page.
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:()=>EMIT_UNPINNED_CREATE_FIELDS&&!!screen?.hasMeshEdits?.(),
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)};
@@ -1682,7 +1682,10 @@ export async function mountJobScreen(host:HTMLElement):Promise<()=>void> {
1682
1682
  window:{state:()=>window.state(),submit:input=>window.submit(input)},readPublication:(id,signal)=>transport.readPublication(id,signal),
1683
1683
  routes:display=>jobPublicationRoutes(display,location.origin),load:async()=>(await import('./main.ts')).mountRigScreen()});
1684
1684
  let bootstrapNotice:HTMLElement|null=null,bootstrapStream=false,bootstrapPrior:{text:string;title:string}|null=null;
1685
- const report=(error:unknown,fallback?:string)=>{const stream=fallback==='JOB_STREAM_FAILED';if(rigScreen.mounted()){rigScreen.report(error,fallback);return;}if(!bootstrapNotice){bootstrapNotice=node('p');bootstrapNotice.setAttribute('role','status');bootstrapNotice.setAttribute('translate','no');host.prepend(bootstrapNotice);}const text=jobWindowRefusal(error,fallback),code=error instanceof Error?error.message:error,title=typeof code==='string'&&/^[A-Z][A-Z0-9_]*$/.test(code)&&Object.hasOwn(enCatalog,code)&&Object.hasOwn(koCatalog,code)?code:fallback??'JOB_WINDOW_FAILED';if(stream)bootstrapStream=true;else{bootstrapStream=false;bootstrapPrior={text,title};}bootstrapNotice.textContent=text;bootstrapNotice.title=title;};
1685
+ const report=(failure:unknown,fallback?:string)=>{
1686
+ const reason=failure instanceof Error?failure.message:failure;
1687
+ const error=!access.capability&&reason==='JOB_CAPABILITY_REQUIRED'?'JOB_CAPABILITY_LINK_LOST':failure;
1688
+ const stream=fallback==='JOB_STREAM_FAILED';if(rigScreen.mounted()){rigScreen.report(error,fallback);return;}if(!bootstrapNotice){bootstrapNotice=node('p');bootstrapNotice.setAttribute('role','status');bootstrapNotice.setAttribute('translate','no');host.prepend(bootstrapNotice);}const text=jobWindowRefusal(error,fallback),code=error instanceof Error?error.message:error,title=typeof code==='string'&&/^[A-Z][A-Z0-9_]*$/.test(code)&&Object.hasOwn(enCatalog,code)&&Object.hasOwn(koCatalog,code)?code:fallback??'JOB_WINDOW_FAILED';if(stream)bootstrapStream=true;else{bootstrapStream=false;bootstrapPrior={text,title};}bootstrapNotice.textContent=text;bootstrapNotice.title=title;};
1686
1689
  const clear=()=>{rigScreen.clearReport?.();if(!bootstrapStream)return;bootstrapStream=false;if(bootstrapPrior&&bootstrapNotice){bootstrapNotice.textContent=bootstrapPrior.text;bootstrapNotice.title=bootstrapPrior.title;return;}if(bootstrapNotice){bootstrapNotice.textContent='';bootstrapNotice.title='';bootstrapNotice.remove?.();bootstrapNotice=null;}};
1687
1690
  const window=createJobWindow<JobRigScreenPrepared|null>({jobId:access.jobId,pageId,transport,adapter:{
1688
1691
  async prepare(display,signal){return rigScreen.prepare(display,signal);},
package/web/main.ts CHANGED
@@ -340,12 +340,13 @@ function renderDraftState(): void {
340
340
  function renderProvenance(): void {
341
341
  const provenance = session.reviewedSource;
342
342
  text('provenance-version', provenance.packageRevision);
343
- text('provenance-rig', provenance.rig ? provenance.rig.sha256.slice(0, 12) + '…' : 'Not supplied');
343
+ el('provenance-rig').textContent = provenance.rig ? provenance.rig.sha256.slice(0, 12) + '…' : t('Not supplied');
344
344
  el('provenance-motion').hidden = !provenance.motion;
345
345
  el('provenance-motion-missing').hidden = !!provenance.motion;
346
346
  text('provenance-motion', provenance.motion ? provenance.motion.sha256.slice(0, 12) + '…' : '');
347
347
  text('provenance-full', JSON.stringify({ sourceHash: session.sourceHash, referenceBinding:session.referenceBinding, reviewedSource: provenance }, null, 2));
348
348
  }
349
+ viewDisposers.push(onLanguageChange(()=>{if(session)renderProvenance();}));
349
350
 
350
351
  function checkpointEntry(): ReviewSession['checkpoints'][string] | undefined {
351
352
  if (!checkpoint) return;
@@ -1309,7 +1310,8 @@ function bindWorkspace(hasModel=false,empty=false):void {
1309
1310
  }
1310
1311
  if(empty)return;
1311
1312
  bindReviewDialog();
1312
- screenRoot.querySelector<HTMLElement>('.inspector-body')!.append(questionPanel);
1313
+ // The waiting layout may have moved this body into the inspector drawer.
1314
+ rigInspector.body.append(questionPanel);
1313
1315
  inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],available:host?.record&&(!host.record.hasPicture||!hasModel&&!partsOnly)?['feedback']:undefined,bottom:{strip:rigInspector.strip,comment:rigInspector.comments.button,panel:rigInspector.comments.panel},changed:()=>{syncQuestionImage();workspace?.refresh();persistence?.save();}});
1314
1316
  }
1315
1317
  async function start(): Promise<void> {
@@ -1434,7 +1436,8 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
1434
1436
  for(const control of document.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('#checkpoint-detail input,#proposal-panel input,#proposal-panel select,#proposal-panel button,#strip-panel input,#strip-panel select,#strip-panel button'))if(!control.closest('#comments-list-host')){control.disabled=true;setSourceAttribute(control,'title',unavailable);if(control instanceof HTMLInputElement&&control.name==='outcome')control.checked=false;}
1435
1437
  el('checkpoint-detail').hidden=true;
1436
1438
  text('detail-note',unavailable);text('checkpoint-note','');el('strip-panel').hidden=true;
1437
- text('provenance-version','Parts package, before rigging');text('provenance-rig','Not supplied');text('provenance-motion','Not supplied');
1439
+ const renderPartsProvenance=()=>{text('provenance-version','Parts package, before rigging');el('provenance-rig').textContent=t('Not supplied');el('provenance-motion').hidden=true;el('provenance-motion-missing').hidden=false;text('provenance-motion','');};
1440
+ renderPartsProvenance();viewDisposers.push(onLanguageChange(renderPartsProvenance));
1438
1441
  text('provenance-full',JSON.stringify({subject:'parts',sourceHash:subject.sourceHash,painting:subject.painting,images:subject.items.map(({name,imageHash})=>({name,imageHash}))},null,2));
1439
1442
  text('source-files',`source ${subject.sourceHash}`);const provenanceHint=document.querySelector<HTMLElement>('.provenance>.hint');if(provenanceHint)setSourceText(provenanceHint,'Source files remain unchanged.');
1440
1443
  for(const tab of document.querySelectorAll<HTMLButtonElement>('[data-block-target]'))if(!['selected-part','feedback'].includes(tab.dataset.blockTarget??'')){tab.disabled=true;setSourceAttribute(tab,'title',unavailable);}
@@ -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'):!job?null:EMIT_UNPINNED_CREATE_FIELDS?
212
- t('In a job, press Request changes to send this edit; the producer rebuilds it.'):held?.edits.length?t('job.submit.JOB_ACT_KIND_DISABLED'):null;
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()&&EMIT_UNPINNED_CREATE_FIELDS?{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}};
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),
@@ -1,3 +0,0 @@
1
- // Fields Create cannot parse until it pins the Review version that reads them
2
- // (act@7 comment context, #714; act@8 mesh edits, #952; Parts view.visibleLayers, #652). Off until the create tower confirms that pin.
3
- export const EMIT_UNPINNED_CREATE_FIELDS = false;