@rig-c/review 4.11.0 → 4.12.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.
@@ -29,6 +29,11 @@ export function jobRigScreenAnswers(ask: Pick<PendingAskV3, 'subject'>, checkpoi
29
29
  return subject.kind === 'review-verdict' ? (subject.stage === 'rig-review' || subject.stage === 'direction-review') :
30
30
  subject.kind === 'checkpoint' && checkpoints.has(subject.checkpointId);
31
31
  }
32
+ /** #1048: the sealed identities the server attached to the record's question images (none elsewhere). */
33
+ function questionPictures(questions:readonly {readonly images:readonly {readonly name:string;readonly path?:string;readonly sha256?:string}[]}[]|undefined):{questionPictures?:{name:string;path:string;sha256:string}[]} {
34
+ const rows=(questions??[]).flatMap(question=>question.images.flatMap(image=>image.path&&image.sha256?[{name:image.name,path:image.path,sha256:image.sha256}]:[]));
35
+ return rows.length?{questionPictures:rows}:{};
36
+ }
32
37
  /** One ask-availability check for both the route and its retained modal forms. */
33
38
  export function jobRigScreenAsk(display:DisplayPublicationV3,ask:PendingAskV3,checkpoints:ReadonlySet<string>):boolean {
34
39
  const source=display.publication.source;
@@ -309,7 +314,7 @@ export function createJobRigScreen(options: {
309
314
  return {...(backdrop?.subject?{subject:backdrop.subject}:{}),access:{...(backdrop?.access??access),capability:null,
310
315
  headers:init=>{const headers=options.access.headers(init);headers.delete('X-Review-Capability');return headers;}},
311
316
  ownerActAccess:{capability:options.access.capability},
312
- record:{...(jobId?{jobId}:{}),draftId,publicationId:prepared.display.publication.publicationId,previousPublicationId,label:prepared.display.publication.label,sourceHash:prepared.display.publication.source.sourceHash,hasPicture:!!record.picture,...record.inspection.planPicture?{planPicture:record.inspection.planPicture}:{},missingPicture:question?.missingPicture,questionPicture:question?.scenePicture || (question?.missingPicture && question.images.length ? true : undefined)},...prepared.refusal?{unavailable:prepared.refusal}:{},pendingSubjects,
317
+ record:{...(jobId?{jobId}:{}),draftId,publicationId:prepared.display.publication.publicationId,previousPublicationId,label:prepared.display.publication.label,sourceHash:prepared.display.publication.source.sourceHash,hasPicture:!!record.picture,...record.inspection.planPicture?{planPicture:record.inspection.planPicture}:{},...questionPictures(record.inspection.interview?.questions),missingPicture:question?.missingPicture,questionPicture:question?.scenePicture || (question?.missingPicture && question.images.length ? true : undefined)},...prepared.refusal?{unavailable:prepared.refusal}:{},pendingSubjects,
313
318
  read:(path,method)=>method==='GET'&&backdrop?backdrop.read(path,method):Promise.reject(new Error('JOB_REVIEW_READ_ONLY')),
314
319
  submit:async()=>{throw new Error('JOB_REVIEW_READ_ONLY');},
315
320
  submitParts:async()=>{throw new Error('JOB_REVIEW_READ_ONLY');},
@@ -741,6 +741,9 @@ type JobInterview = {
741
741
  images: {
742
742
  name: string;
743
743
  url: string;
744
+ /** #1048: the sealed `files` entry, present on a record publication only. */
745
+ path?: string;
746
+ sha256?: string;
744
747
  }[];
745
748
  })[];
746
749
  interview?: JobInterviewDiagnostics | null;
@@ -845,8 +848,9 @@ export interface JobPreparedInspection {
845
848
  images: readonly HTMLImageElement[];
846
849
  }[];
847
850
  references: JobReferenceView[];
848
- /** #983: the record plan's declared picture, hash-checked and decoded; the record screen draws it first. */
849
- planPicture?: {name: string; src: string};
851
+ /** #983: the record plan's declared picture, hash-checked and decoded; the record screen draws it first.
852
+ * #1048: `path` and `sha256` are the sealed `files` entry, never a browser digest; pins name the picture by them. */
853
+ planPicture?: {name: string; src: string; path: string; sha256: string};
850
854
  assets: ModelAssets | null;
851
855
  player: RigPlayer | null;
852
856
  rigRoot: HTMLElement;
@@ -1214,11 +1218,12 @@ export async function prepareJobInspection(display: DisplayPublicationV3, signal
1214
1218
  preload.push(image(routes.api('stage-parts/page/' + page.index))
1215
1219
  .then(element => { partPages.set(page.index, element); }));
1216
1220
  }
1217
- let planPicture: {name: string; src: string} | undefined;
1221
+ let planPicture: {name: string; src: string; path: string; sha256: string} | undefined;
1218
1222
  const declaredPlanPicture = record && publishedSource.subject === 'plan' ? publishedSource.planPicture : undefined;
1219
1223
  if (preloadVisuals && declaredPlanPicture) {
1220
1224
  preload.push(image(routes.api('plan-picture'), declaredPlanPicture.sha256).then(element => {
1221
- planPicture = {name: declaredPlanPicture.path.split('/').at(-1)!, src: element.src};
1225
+ planPicture = {name: declaredPlanPicture.path.split('/').at(-1)!, src: element.src,
1226
+ path: declaredPlanPicture.path, sha256: declaredPlanPicture.sha256};
1222
1227
  }));
1223
1228
  }
1224
1229
  const preloaded = await Promise.allSettled(preload);
@@ -1547,7 +1552,7 @@ export interface JobFormDependencies {
1547
1552
  }
1548
1553
  questionSet=jobQuestionSet(ask,prepared,t);
1549
1554
  interviewForm=createInterviewForm({question,id:'interview-answer-'+ask.askId,node,form,fieldset:fields,source,mainView:true,
1550
- images:question.images.map(image=>({name:image.name,src:jobPublicationRoutes(prepared.display,location.origin).instance(image.url)})),answered:ask.status==='answered',
1555
+ images:question.images.map(image=>({name:image.name,src:jobPublicationRoutes(prepared.display,location.origin).instance(image.url),...(image.path&&image.sha256?{path:image.path,sha256:image.sha256}:{})})),answered:ask.status==='answered',
1551
1556
  ...questionSet?.list});
1552
1557
  if (prepared.metadata.recordSource && (question.missingPicture || !question.images.length) && !prepared.metadata.manifest?.model) {
1553
1558
  fields.prepend(node('p', question.missingPicture === 'rig'
@@ -1558,7 +1563,9 @@ export interface JobFormDependencies {
1558
1563
  }
1559
1564
  const {localize,dispose,read:readInterview}=interviewForm;
1560
1565
  const offLanguage=onLanguageChange(localize);
1561
- disposeInterview=()=>{offLanguage();dispose();};read=readInterview;
1566
+ disposeInterview=()=>{offLanguage();dispose();};
1567
+ // #1048: a record interview carries its comments in the optional `words`; none keeps the old value bytes.
1568
+ read=()=>{const value=readInterview(),words=prepared.metadata.recordSource?commentWords():'';return words?{...value,words}:value;};
1562
1569
  submitKey = 'interview.save';
1563
1570
  }
1564
1571
  else if (subject.kind === 'checkpoint') {
@@ -49,7 +49,8 @@ export function placeLabels(inputs:readonly LabelInput[],options:LabelPlacementO
49
49
  const active=inputs.filter(x=>onCanvas(x.at));
50
50
  const inferSide=(input:LabelInput):'left'|'right'=>{
51
51
  if(input.side)return input.side;
52
- const right=input.at.x+gap,left=input.at.x-gap-input.width,band=active.filter(o=>o!==input&&Math.abs(o.at.y-input.at.y)<=step);
52
+ // The band is the row the home box sits in (it rises above the point), so a neighbour just above the point counts at any zoom.
53
+ const right=input.at.x+gap,left=input.at.x-gap-input.width,row=input.at.y-(options.rise??2)-h/2,band=active.filter(o=>o!==input&&Math.abs(o.at.y-row)<=step);
53
54
  return band.filter(o=>o.at.x>=right&&o.at.x<=right+input.width).length>band.filter(o=>o.at.x>=left&&o.at.x<=left+input.width).length?'left':'right';
54
55
  };
55
56
  const placed:LabelBox[]=[...(options.obstacles??[])],labels:LabelBox[]=[],out:PlacedLabel[]=new Array(inputs.length);
package/web/main.ts CHANGED
@@ -14,7 +14,7 @@ import {rigWorkspaceMarkup,rigFeedbackMarkup,sharedViewToolsMarkup,sharedComment
14
14
  import {bindDirectionPanel} from './direction-panel.ts';
15
15
  import {bindWorkspaceVisibility} from './workspace-visibility.ts';
16
16
  import type {DirectionInspection} from '../src/direction-inspection.ts';
17
- import {parseStageComment,feedbackItemComments,projectComments,timeOnlyBasis,unprojectMark,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback} from '../src/stage-comment.ts';
17
+ import {parseStageComment,parsePictureCommentLabel,feedbackItemComments,projectComments,timeOnlyBasis,unprojectMark,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback,type StageComment} from '../src/stage-comment.ts';
18
18
  import {bindStageComments,type CommentRow,type CommentPose} from './stage-comments.ts';
19
19
  import {discoverTurnDials,TurnState} from '../src/turn-pad.ts';
20
20
  import {bindTurnPad,type TurnPad} from './turn-pad.ts';
@@ -106,7 +106,7 @@ const el = <T extends HTMLElement = HTMLElement>(id: string): T => {
106
106
  const input = (id: string) => el<HTMLInputElement>(id);
107
107
  const select = (id: string) => el<HTMLSelectElement>(id);
108
108
  const button = (id: string) => el<HTMLButtonElement>(id);
109
- const titledIds = new Set(['message', 'player-state', 'layout-state', 'renderer-state', 'layer-state', 'idle-state', 'control-state', 'draft-state', 'rig-label', 'reference-label', 'coordinates']);
109
+ const titledIds = new Set(['message', 'review-message', 'player-state', 'layout-state', 'renderer-state', 'layer-state', 'idle-state', 'control-state', 'draft-state', 'rig-label', 'reference-label', 'coordinates']);
110
110
  // #347: write only a changed source, so a played frame does not rewrite (and re-translate) unchanged text.
111
111
  const text = (id: string, value: string) => { const node = el(id); setSourceText(node, value); if (titledIds.has(id)) setSourceAttribute(node, 'title', value); };
112
112
  const option = (value: string, label: string) => { const item = document.createElement('option'); item.value = value; item.textContent = label; return item; };
@@ -117,6 +117,10 @@ let host:JobRigMeshHost|null=rigHost(),access=host?.access??pageInstanceAccess()
117
117
  let partsOnly=host?.subject==='parts'||screenRoot.dataset.reviewScreen==='parts';
118
118
  let firstPublicationPrompt=!!host?.waiting;
119
119
  const app=el('app');app.innerHTML=rigWorkspaceMarkup+rigFeedbackMarkup;
120
+ /** #1041: the right panel is communication with the AI: the pending question, Comments and (later) record forms.
121
+ * The bottom panel keeps the controllers tied to the view. */
122
+ const communicationPanel=panelMake('aside',{id:'workspace-communication',className:'workspace-communication',hidden:true});
123
+ setSourceAttribute(communicationPanel,'aria-label','Communication');
120
124
  const rigStatusBar=mountStatusBar({
121
125
  message:'Loading local review package…',
122
126
  readouts:[
@@ -139,7 +143,7 @@ const rigStatusBar=mountStatusBar({
139
143
  app.querySelector<HTMLElement>('[data-workspace-status]')!.replaceWith(rigStatusBar.footer);
140
144
  for(const id of ['layout-state','idle-state','control-state','draft-state'])el(id).setAttribute('role','status');
141
145
  el('layout-state').setAttribute('aria-label','Effective layout');el('renderer-state').setAttribute('aria-label','Last draw backend');el('draft-state').setAttribute('aria-live','polite');el('view-coordinates').setAttribute('aria-label','Current numeric inspection region');
142
- const shell=mountWorkspaceShell({compatibility:'rigStep1',pendingActRow:!!host,embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header,...shell.actRow?[shell.actRow]:[]);
146
+ const shell=mountWorkspaceShell({compatibility:'rigStep1',embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header,...shell.actRow?[shell.actRow]:[]);
143
147
  el('app').querySelector<HTMLElement>('[data-workspace-comment]')!.innerHTML=sharedCommentMarkup;
144
148
  el('app').querySelector<HTMLElement>('[data-workspace-layers]')!.append(createRigLayerControls());
145
149
  el('app').querySelector<HTMLElement>('[data-workspace-view-tools]')!.innerHTML=sharedViewToolsMarkup;
@@ -149,7 +153,7 @@ const primaryToolbar=app.querySelector<HTMLElement>('.viewbar')!;primaryToolbar.
149
153
  const secondaryToolbar=document.createElement('div');secondaryToolbar.className='workspace-secondary-toolbar';secondaryToolbar.append(app.querySelector<HTMLElement>('[data-workspace-layers]')!,app.querySelector<HTMLElement>('[data-workspace-view-tools]')!);primaryToolbar.after(secondaryToolbar);
150
154
  for(const event of ['click','change'])secondaryToolbar.addEventListener(event,()=>{if(rigDifference){leaveRigDifference();renderLayout();}},true);
151
155
  const rigInspector=mountRigInspector(document,shell.actRow??undefined);
152
- if(host)rigInspector.act.hidden=true;
156
+ rigInspector.act.hidden=true;
153
157
  const rigAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-ask',hidden:true});rigAsk.type='button';
154
158
  const recordAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-record-ask',hidden:true,type:'button'});
155
159
  const askHeadline=panelMake('span',{id:'workspace-ask-headline',className:'workspace-act-ask',hidden:true});
@@ -296,7 +300,7 @@ function message(value: string, error = false, footerOnly = false, diagnostic?:
296
300
  delete reviewMessage.dataset.partsPinRefusal;
297
301
  }
298
302
  text('review-message', value); reviewMessage.classList.toggle('error', error);
299
- if(host&&error&&rigInspector.act.hidden&&!rigInspector.answersRendered){
303
+ if(error&&rigInspector.act.hidden&&!rigInspector.answersRendered){
300
304
  for(const node of rigInspector.act.querySelectorAll<HTMLElement>('#save,#review-status,label[for="review-status"]'))node.hidden=true;
301
305
  rigInspector.act.hidden=false;
302
306
  rigInspector.syncActRow?.();
@@ -339,8 +343,8 @@ let liveIssueCount=()=>(session?.feedback.length??0)+(host?.verdictComments?.row
339
343
  function renderDraftState(): void {
340
344
  const live=host?.reviewState?.(liveIssueCount(),saving);
341
345
  renderAnswerControls();
342
- if (draftStatus === null && !live && !answerSaved) return;
343
- rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: draftConflict ? 'Saved draft could not be restored. Your draft has not been deleted. Download or discard it before submitting.' : answerSaved ? 'Answer saved' : draftStatus&&/^(The source changed, so |Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus! });
346
+ if (draftStatus === null && !live && !answerSaved && !dirty && !saving && !draftConflict && !actReadOnly && !session?.updatedAt) return;
347
+ rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: draftConflict ? 'Saved draft could not be restored. Your draft has not been deleted. Download or discard it before submitting.' : saving ? 'Saving…' : answerSaved ? 'Answer saved' : draftStatus&&/^(The source changed, so |Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus??(dirty ? 'Unsubmitted changes' : session?.updatedAt ? 'Submitted' : 'Not submitted') });
344
348
  if(answerSaved&&!saving&&!draftConflict&&!dirty&&!actReadOnly&&(host?.record||!host)&&
345
349
  (host?.pendingSubjects?.()??pendingAnswers).every(subject=>subject.kind==='interview-picks')&&!el('message').classList.contains('error'))message(sourceTextContent(el('dirty')),false,true);
346
350
  }
@@ -1328,15 +1332,19 @@ function bind(): void {
1328
1332
  /** The one shell and block binding, for either subject. */
1329
1333
  function bindWorkspace(hasModel=false,empty=false):void {
1330
1334
  if(!workspace){
1331
- workspace=bindWorkspaceUI({root:screenRoot,regions:{layout:screenRoot.querySelector<HTMLElement>('.layout')!,left:screenRoot.querySelector<HTMLElement>('.left-panel')!,main:el('stage-layout').parentElement!,stage:el('stage-layout'),bottom:screenRoot.querySelector<HTMLElement>('.inspector')!,columns:{left:'rightWidth',right:null}},language:shell.language!,bottomPanel:rigInspector,changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
1335
+ const layout=screenRoot.querySelector<HTMLElement>('.layout')!;layout.append(communicationPanel);
1336
+ workspace=bindWorkspaceUI({root:screenRoot,regions:{layout,left:screenRoot.querySelector<HTMLElement>('.left-panel')!,main:el('stage-layout').parentElement!,stage:el('stage-layout'),bottom:screenRoot.querySelector<HTMLElement>('.inspector')!,right:communicationPanel,columns:{left:'rightWidth',right:'communicationWidth'},rightPending:communicationPending,bottomBound:()=>inspectorBlocks!==null},language:shell.language!,bottomPanel:rigInspector,changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
1332
1337
  viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
1333
1338
  appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
1334
1339
  }
1335
1340
  if(empty)return;
1336
1341
  bindReviewDialog();
1337
- // The waiting layout may have moved this body into the inspector drawer.
1338
- rigInspector.body.append(questionPanel);
1339
- 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();}});
1342
+ // The question on top, Comments below; Comment rows sit above the provenance block and the review form.
1343
+ const comments=rigInspector.comments.panel;comments.hidden=false;
1344
+ comments.querySelector('.review-dialog-header')?.after(el('comments-list-host'));
1345
+ communicationPanel.append(questionPanel,recordPanel,comments);
1346
+ inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],available:host?.record&&(!host.record.hasPicture||!hasModel&&!partsOnly)?['feedback']:undefined,bottom:{strip:rigInspector.strip},changed:()=>{syncQuestionImage();workspace?.refresh();persistence?.save();}});
1347
+ workspace?.refresh();
1340
1348
  }
1341
1349
  async function start(): Promise<void> {
1342
1350
  try {
@@ -1390,6 +1398,7 @@ async function start(): Promise<void> {
1390
1398
  (el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
1391
1399
  const sourceFiles = el('source-files'); for (const file of data.manifest.authoring) { const a = document.createElement('a'); a.href = assetUrl(file.path); a.textContent = file.label; a.className = 'source-link'; a.target = '_blank'; a.rel = 'noopener'; sourceFiles.append(a); } if (!data.manifest.authoring.length) sourceFiles.textContent = 'No source files supplied';sourceFiles.parentElement!.hidden=!data.manifest.authoring.length;
1392
1400
  populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);if(host)chestEditor?.sync();else if(part&&!stageCorrectionRebinding)void openStageCorrection({part:part.slot,instrument:'selection'});requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({hideGateBanner:!!host?.direction,readOnlyReason:sealedRecordRigReadOnly,host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){if(activeScene())seek(time);else{player.seek(time);drawRig(()=>player!.draw());}}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
1401
+ if(!host&&!data.capabilities.preRig)renderPendingSubjects([{kind:'review-verdict',stage:'rig-review'}]);
1393
1402
  const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
1394
1403
  rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
1395
1404
  // A job rig subject lands in Animate before the model finishes loading (#709).
@@ -1406,7 +1415,7 @@ async function start(): Promise<void> {
1406
1415
  else if (host?.ownerActAccess) message('Not submitted',false,true);
1407
1416
  else message(data.manifest.model ? 'Record review status and structured feedback while preserving sources. Motion is read only.' : 'No rig supplied. Review the available references and checkpoints.');
1408
1417
  frameHandle=requestAnimationFrame(tick);
1409
- const restored=await setupPersistence();setupComments();renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'review-verdict',stage:'rig-review'}]);if(host?.direction)showRecordComments(true);else if(host?.record&&!data.manifest.model)showRecordComments();await loadRebuildStatus();void loadRequirements();renderChest();restoreEnvironment();physicsPanel?.restore();bonesPanel?.restore();cutsPanel?.restore();clothPanel?.restore();idlePanel?.restore();rigFieldsPanel?.restore();meshPanel?.restore();void refreshDensityStrip();renderIdle();if(idlePreviewOnOpen(restored,!!host)&&canRepeatIdle()&&automaticIdlePreview(assets?.animations.map(item=>item.name)??[],animation,first,!!requestedId))void playPreview();
1418
+ const restored=await setupPersistence();setupComments();renderPendingSubjects(host?.pendingSubjects?.()??(data.capabilities.preRig?[]:[{kind:'review-verdict',stage:'rig-review'}]));if(host?.direction)showRecordComments(true);else if(host?.record&&!data.manifest.model)showRecordComments();await loadRebuildStatus();void loadRequirements();renderChest();restoreEnvironment();physicsPanel?.restore();bonesPanel?.restore();cutsPanel?.restore();clothPanel?.restore();idlePanel?.restore();rigFieldsPanel?.restore();meshPanel?.restore();void refreshDensityStrip();renderIdle();if(idlePreviewOnOpen(restored,!!host)&&canRepeatIdle()&&automaticIdlePreview(assets?.animations.map(item=>item.name)??[],animation,first,!!requestedId))void playPreview();
1410
1419
  // Only an instance that serves agent control is asked for its config: a plain open has no control endpoint (#164).
1411
1420
  if(!readOnly&&writes.control!==false)controlDispose=connectControl({sourceHash:data.sourceHash,mode:'single',route:access.route,headers:()=>access.headers(),observe:controlState,apply:applyControl,onStatus:value=>text('control-state',value)});
1412
1421
  bindWorkspaceVisibility({key:access.key,sourceHash:data.sourceHash,pause});
@@ -1521,6 +1530,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
1521
1530
  };
1522
1531
  viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
1523
1532
  const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
1533
+ if(!host)renderPendingSubjects([{kind:'parts-verdict'}]);
1524
1534
  viewport.requestFit();await partsSubject.ready();text('dirty','Not submitted');message(actReadOnly??(host?.ownerActAccess?'Not submitted':'Parts ready. Source files remain unchanged.'),!!actReadOnly,!!host?.ownerActAccess&&!actReadOnly);referenceInput=subject.painting?{state:'loaded'}:{state:'absent'};renderLayout();
1525
1535
  setupPartsPersistence=async()=>{
1526
1536
  if(host?.record)return;
@@ -1548,7 +1558,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
1548
1558
  function showRecordComments(preserveInspector=false):void {
1549
1559
  for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
1550
1560
  if(preserveInspector)return;
1551
- for(const child of rigInspector.comments.panel.children)(child as HTMLElement).hidden=child!==el('proposal-panel')&&!child.classList.contains('review-dialog-header');
1561
+ for(const child of rigInspector.comments.panel.children)(child as HTMLElement).hidden=child!==el('proposal-panel')&&child!==el('comments-list-host')&&!child.classList.contains('review-dialog-header');
1552
1562
  rigInspector.comments.panel.style.display='block';
1553
1563
  rigInspector.collapse.disabled=false;setSourceAttribute(rigInspector.collapse,'title','');
1554
1564
  }
@@ -1581,7 +1591,7 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
1581
1591
  if(interview){
1582
1592
  button('stage-comment').hidden=true;
1583
1593
  button('save').disabled=true;setSourceAttribute(button('save'),'aria-description',unavailable);
1584
- viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,'job.pending',true)));
1594
+ viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,true)));
1585
1595
  text('provenance-rig',unavailable);text('provenance-motion',unavailable);text('source-files','project.json');
1586
1596
  }else{restoreRecordComments();setupComments();showRecordComments();rigInspector.comments.button.disabled=false;button('stage-comment').disabled=false;}
1587
1597
  const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
@@ -1590,15 +1600,17 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
1590
1600
  document.body.dataset.ready='true';
1591
1601
  if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,progress:setJobProgress,stage:()=>null,redraw:()=>{},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
1592
1602
  }
1593
- let recordDialog:HTMLDialogElement|null=null;
1594
- let releaseRecordDrawer:(()=>void)|null=null;
1595
- viewDisposers.push(()=>{releaseRecordDrawer?.();releaseRecordDrawer=null;recordDialog?.remove();recordDialog=null;});
1596
- let recordDrawerTrigger:HTMLButtonElement|null=null;
1603
+ /** #1041 B: checkpoint, signoff and plan-approval forms are a right-panel section, below the question and above Comments. */
1604
+ const recordPanel=panelMake('section',{id:'job-record-asks',className:'workspace-interview-panel',hidden:true});
1605
+ recordPanel.tabIndex=-1;const recordTitle=panelMake('h2',{});recordPanel.append(panelMake('div',{className:'review-dialog-header'},recordTitle));
1606
+ const recordForms=()=>[...recordPanel.querySelectorAll<HTMLFormElement>('form[data-job-ask]')];
1607
+ viewDisposers.push(()=>{for(const form of recordForms())form.remove();recordPanel.hidden=true;});
1597
1608
  let unregisterQuestion:(()=>void)|null=null;
1598
- let activeInterviewImages:readonly {name:string;src:string}[]|null=null;
1599
- let activeInterviewImage:{name:string;src:string}|null=null;
1609
+ let activeInterviewImages:readonly {name:string;src:string;path?:string;sha256?:string}[]|null=null;
1610
+ let activeInterviewImage:{name:string;src:string;path?:string;sha256?:string}|null=null;
1600
1611
  let releaseInterview:(()=>void)|null=null;
1601
1612
  const questionPanel=panelMake('section',{id:'workspace-interview-answer',className:'workspace-interview-panel',hidden:true});
1613
+ {const title=panelMake('h2',{});setSourceText(title,'Question');questionPanel.append(panelMake('div',{className:'review-dialog-header'},title));}
1602
1614
  let questionForms:readonly HTMLElement[]=[];
1603
1615
  /** #1004: several question forms share the Question tab; the list shows one at a time. */
1604
1616
  let selectedQuestionAsk:string|undefined;
@@ -1635,10 +1647,16 @@ function restoreRecordComments(form?:HTMLFormElement):void {
1635
1647
  ids.add(row.id);
1636
1648
  if(host?.verdictComments&&('schema' in row||'target' in row))throw new Error('JOB_ACT_INVALID');
1637
1649
  if('schema' in row){const issue=parsePartsIssue(row,false,true,false),items=new Map((partsSubject?.items()??[]).map(item=>[item.name,{...item,imageHash:item.imageHash!}]));assertPartsIssueBinding(issue,items,partsSubject!.sourceHash());}
1638
- else if('target' in row){const mark=parseStageComment((row.context as {comment?:unknown})?.comment);if((!host?.direction&&!host!.record!.hasPicture)||mark.sourceHash!==data.sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');}
1650
+ else if('target' in row){const mark=parseStageComment((row.context as {comment?:unknown})?.comment),pictures=!host?.direction&&!host!.record!.hasPicture?recordPictures():undefined;
1651
+ if(pictures){
1652
+ // #1048: a plan- or question-picture pin restores only through its A1 label, parsed back against a sealed entry.
1653
+ if(mark.viewport!=='reference'||mark.sourceHash!==sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');
1654
+ const label=projectComments(feedbackItemComments([row as Feedback]),pictures).split('\n')[0]!.slice(1,-1),parsed=parsePictureCommentLabel(label);
1655
+ if(!pictures.some(picture=>parsed.referenceId===picture.path&&parsed.referenceHash===picture.sha256))throw new Error('COMMENT_PICTURE_LABEL_INVALID: the pin does not name a sealed picture of this record');
1656
+ }else if((!host?.direction&&!host!.record!.hasPicture)||mark.sourceHash!==data.sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');}
1639
1657
  else if(Object.keys(row).some(key=>key!=='id'&&key!=='summary'))throw new Error('JOB_ACT_INVALID');
1640
1658
  }
1641
- if(!host?.verdictComments)projectComments(rows.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}));
1659
+ if(!host?.verdictComments)projectComments(rows.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}),recordPictures());
1642
1660
  return rows;
1643
1661
  };
1644
1662
  if(!target.storageBound&&typeof window!=='undefined'&&typeof window.addEventListener==='function'){
@@ -1705,11 +1723,25 @@ function restoreRecordComments(form?:HTMLFormElement):void {
1705
1723
  if(typeof renderDraftState==='function')renderDraftState();
1706
1724
  }
1707
1725
  }
1708
- }catch{/* A mismatched or invalid local draft has no authority. */}
1726
+ }catch(error){
1727
+ /* A mismatched or invalid local draft has no authority. A plan-picture pin that cannot be parsed back says so by name (#1048). */
1728
+ const reason=error instanceof Error?error.message:'';
1729
+ if(reason.startsWith('COMMENT_PICTURE_LABEL_INVALID')&&typeof message==='function')message(reason,true);
1730
+ }
1731
+ }
1732
+ /** #1048: the record's sealed plan picture and question images, the only `files` entries a record-host pin can name. */
1733
+ function recordPictures():{path:string;sha256:string}[]|undefined {
1734
+ const picture=host?.record?.planPicture,rows=[...picture?[{path:picture.path,sha256:picture.sha256}]:[],...host?.record?.questionPictures??[]];
1735
+ return rows.length?rows:undefined;
1709
1736
  }
1710
1737
  /** Comments remain native rows locally; the old act field carries their scalar projection only. */
1711
1738
  function recordCommentWords():string {
1712
- return projectComments(recordComments.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}));
1739
+ return projectComments(recordComments.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}),recordPictures());
1740
+ }
1741
+ /** The sealed plan picture or question image while it is the reference view's shown image; null otherwise (#1048). */
1742
+ function shownPlanPicture():{name:string;path:string;sha256:string}|null {
1743
+ const image=host?.record&&!host.record.hasPicture?activeInterviewImage:null,path=image?.path,sha256=image?.sha256;
1744
+ return image&&path&&sha256&&recordPictures()?.some(picture=>picture.path===path&&picture.sha256===sha256)?{name:image.name,path,sha256}:null;
1713
1745
  }
1714
1746
  function persistRecordComments():void {
1715
1747
  const binding=host?.direction??host?.verdictComments??host?.record;
@@ -1731,7 +1763,7 @@ function persistRecordComments():void {
1731
1763
  comments.splice(0,comments.length,...kept,...addedFromOther,...localNew);
1732
1764
  }
1733
1765
  knownIds.clear();for(const row of comments)knownIds.add(row.id);
1734
- const dialogPublication=typeof recordDialog!=='undefined'?recordDialog?.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication:undefined;
1766
+ const dialogPublication=recordPanel.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication;
1735
1767
  const activePub=binding.publicationId??dialogPublication;
1736
1768
  const prefix=host?.verdictComments?'rig-review-verdict-comments/1:':'rig-review-record-comments/1:';
1737
1769
  if(typeof localStorage.removeItem==='function'){
@@ -1748,12 +1780,12 @@ function recordCommentsChanged():void {
1748
1780
  persistRecordComments();
1749
1781
  setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);
1750
1782
  renderDraftState();
1751
- for(const form of recordDialog?.querySelectorAll('form[data-job-ask]')??[])form.dispatchEvent(new Event('input',{bubbles:true}));
1783
+ for(const form of recordForms())form.dispatchEvent(new Event('input',{bubbles:true}));
1752
1784
  }
1753
1785
  /** Keep the shared reference viewport bound while the interview form is mounted. */
1754
1786
  function syncQuestionImage():void {
1755
1787
  if(disposed){releaseInterview?.();releaseInterview=null;return;}
1756
- const form=(questionForms.find(item=>!item.hidden)??questionForms[0]) as (HTMLElement&{interviewImages?:readonly {name:string;src:string}[]})|undefined;
1788
+ const form=(questionForms.find(item=>!item.hidden)??questionForms[0]) as (HTMLElement&{interviewImages?:readonly {name:string;src:string;path?:string;sha256?:string}[]})|undefined;
1757
1789
  const images=form?.interviewImages??(host?.record?.planPicture?[host.record.planPicture]:undefined);
1758
1790
  if(activeInterviewImages&&images?.length===activeInterviewImages.length&&images.every((image,index)=>{
1759
1791
  const previous=activeInterviewImages![index]!;
@@ -1785,51 +1817,51 @@ function syncQuestionImage():void {
1785
1817
  if(sourceTextContent(el('message'))==='This request has no picture.')message(sourceTextContent(el('dirty')),false,true);
1786
1818
  void showReference('',activeInterviewImage);
1787
1819
  }
1788
- /** Survey forms use the shared bottom tab. Pending text-only record forms use the drawer. */
1789
- function renderRecordForms(forms:readonly HTMLElement[],label='job.pending',standalone=false):void {
1790
- if(standalone){pendingAnswers=[{kind:'interview-picks'}];}
1820
+ /** Survey forms take the Question section and record forms the record section, both in the right panel (#1041). */
1821
+ function renderRecordForms(forms:readonly HTMLElement[],standalone=false):void {
1822
+ if(standalone){renderPendingSubjects([{kind:'interview-picks'}]);}
1791
1823
  for(const form of forms){
1792
1824
  if(questionFormBindings.has(form))continue;questionFormBindings.add(form);
1793
1825
  form.addEventListener('submit',event=>{if(draftConflict||pendingAnswers.some(subject=>subject.kind.endsWith('verdict'))){event.preventDefault();event.stopImmediatePropagation();}},true);
1794
- form.addEventListener('job-answer-saved',()=>{answerSaved=true;if(recordDialog?.contains(form))recordDialog.close();renderDraftState();},{once:true});
1826
+ form.addEventListener('job-answer-saved',()=>{answerSaved=true;renderDraftState();},{once:true});
1795
1827
  }
1796
1828
  const questionTabForms=forms.filter(form=>form.dataset.interviewMain!==undefined);
1797
1829
  for(const form of questionForms)if(!questionTabForms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
1798
1830
  questionForms=questionTabForms;
1799
1831
  if(questionForms.length){
1800
1832
  for(const form of questionForms)if(form.parentElement!==questionPanel)questionPanel.append(form);
1801
- const reveal=()=>{inspectorBlocks?.select(selectedInspector()??'rig','question');workspace?.revealInspector();};
1833
+ const reveal=()=>{questionPanel.hidden=false;workspace?.revealCommunication();};
1802
1834
  rigAsk.onclick=()=>{if(!draftConflict)reveal();};
1803
1835
  if(!unregisterQuestion){
1804
- unregisterQuestion=inspectorBlocks!.register({id:'question',panel:questionPanel,label:'Question',position:'first'});
1805
- inspectorBlocks!.restore({rig:'question',playback:'question'});reveal();
1836
+ unregisterQuestion=()=>{questionPanel.hidden=true;workspace?.refresh();};reveal();
1806
1837
  }
1807
1838
  if(questionForms.every(form=>form.dataset.interviewAnswered==='true')){answerSaved=true;firstPublicationPrompt=false;}
1808
1839
  }else{
1809
1840
  unregisterQuestion?.();unregisterQuestion=null;rigAsk.onclick=null;
1810
1841
  }
1811
1842
  showQuestionForm();
1843
+ // #1048: a record question form carries the comments too, in its interview-picks act's optional `words`.
1844
+ if(!standalone&&host?.record)for(const form of questionTabForms)(form as JobForm['form']).commentWords=recordCommentWords;
1812
1845
  forms=forms.filter(form=>!questionTabForms.includes(form));
1813
1846
  if(!forms.length){
1814
- releaseRecordDrawer?.();releaseRecordDrawer=null;recordDrawerTrigger=null;
1815
- recordDialog?.remove();recordDialog=null;
1847
+ for(const form of recordForms()){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
1848
+ if(!recordPanel.hidden){recordPanel.hidden=true;workspace?.refresh();}
1816
1849
  renderDraftState();return;
1817
1850
  }
1818
- if(!recordDialog){
1819
- recordDialog=panelMake('dialog',{id:'job-record-asks',className:'workspace-drawer'});recordDialog.setAttribute('aria-label',tr(label));
1820
- recordDialog.append(panelMake('button',{className:'workspace-drawer-close',type:'button'},tr('Close')));app.append(recordDialog);
1821
- }
1822
1851
  const trigger=questionForms.length?recordAsk:rigAsk;
1823
- if(recordDrawerTrigger!==trigger){
1824
- releaseRecordDrawer?.();recordDrawerTrigger=trigger;
1825
- releaseRecordDrawer=bindWorkspaceDrawer({trigger,drawer:recordDialog,label:tr(label),close:recordDialog.querySelector('button')!});
1826
- }
1827
- for(const form of recordDialog.querySelectorAll<HTMLFormElement>('form[data-job-ask]'))if(!forms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
1852
+ // The ask line's Review…/Approve… brings the section into view; it opens with the panel like a pending question.
1853
+ const revealRecord=()=>{recordPanel.hidden=false;workspace?.revealCommunication();recordPanel.scrollIntoView?.({block:'nearest'});};
1854
+ trigger.onclick=()=>{if(draftConflict)return;revealRecord();recordPanel.focus({preventScroll:true});};
1855
+ for(const form of recordForms())if(!forms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
1828
1856
  if(!standalone&&forms[0])restoreRecordComments(forms[0] as HTMLFormElement);
1829
1857
  for(const form of forms){
1830
1858
  if(!standalone)(form as JobForm['form']).commentWords=()=>host?.record||host?.direction?recordCommentWords():partsOnly?projectComments(partsIssueComments(partsSubject?.issues()??[])):projectComments(feedbackItemComments(session.feedback));
1831
- if(!recordDialog.contains(form)){form.style.overflow='auto';form.style.minHeight='0';recordDialog.append(form);}
1859
+ if(!recordPanel.contains(form))recordPanel.append(form);
1832
1860
  }
1861
+ // One line, like Question and Comments: a checkpoint form carries the outcome select, a signoff (stage or plan approval) does not.
1862
+ const checkpoints=forms.filter(form=>form.querySelector('select[name=outcome]')).length;
1863
+ setSourceText(recordTitle,checkpoints===forms.length?'Checkpoint':checkpoints?'Checkpoint · Sign-off':'Sign-off');
1864
+ if(recordPanel.hidden)revealRecord();
1833
1865
  if(host?.record){
1834
1866
  for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
1835
1867
  setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);comments?.refresh();partsSubject?.refreshComments();
@@ -1876,6 +1908,8 @@ function renderAskHeadline(sentence=askSentence):void {
1876
1908
  askHeadline.removeAttribute('translate');
1877
1909
  askHeadline.style?.removeProperty('white-space');
1878
1910
  setSourceText(askHeadline,sentence);
1911
+ // In a refusal the headline ellipsizes to one line (#1041); its title keeps the whole sentence.
1912
+ setSourceAttribute(askHeadline,'title',sentence);
1879
1913
  return;
1880
1914
  }
1881
1915
  const at=Date.parse(progress.at),age=()=>Math.max(0,Math.floor((Date.now()-at)/1000));
@@ -1887,18 +1921,15 @@ function renderAskHeadline(sentence=askSentence):void {
1887
1921
  // Catalog fragments are already localized. Keep the agent's text as a literal across locale changes.
1888
1922
  askHeadline.setAttribute('translate','no');
1889
1923
  askHeadline.style?.setProperty('white-space','pre-wrap');
1890
- if(quiet){
1891
- const [before,after]=t('job.progress.quiet',['{0}',phaseAndStep]).split('{0}');
1892
- askHeadline.replaceChildren(before!,ageText,after!);
1893
- }else{
1894
- const prefix=progress.text?phaseAndStep+' · '+progress.text:phaseAndStep;
1895
- askHeadline.replaceChildren(prefix+' · ',ageText);
1896
- }
1924
+ const [before,after]=quiet?t('job.progress.quiet',['{0}',phaseAndStep]).split('{0}'):[(progress.text?phaseAndStep+' · '+progress.text:phaseAndStep)+' · ',''];
1925
+ askHeadline.replaceChildren(...[before!,ageText,after!].filter(part=>part!==''));
1926
+ // In a refusal the headline ellipsizes to one line (#1041); its title keeps the whole sentence.
1927
+ const titleNow=()=>setSourceAttribute(askHeadline,'title',before!+ageText.data+after!);titleNow();
1897
1928
  const tickAge=()=>{
1898
1929
  const seconds=age();
1899
1930
  if((seconds>=60)!==quiet){renderAskHeadline();return;}
1900
1931
  const value=ageValue(seconds);
1901
- if(ageText.data!==value)ageText.data=value;
1932
+ if(ageText.data!==value){ageText.data=value;titleNow();}
1902
1933
  };
1903
1934
  if(!suspended&&!disposed)progressTimer=setInterval(tickAge,1000);
1904
1935
  }
@@ -1910,7 +1941,7 @@ function renderAnswerControls():void {
1910
1941
  const dialog=subjects.some(subject=>!subject.kind.endsWith('verdict'))&&!verdict;
1911
1942
  const readable=questionForms.some(form=>form.dataset.interviewAnswered==='true');
1912
1943
  const questionEnabled=questionForms.some(form=>form.querySelector('fieldset:not(:disabled)'));
1913
- const recordEnabled=!!recordDialog?.querySelector('fieldset:not(:disabled)');
1944
+ const recordEnabled=!!recordPanel.querySelector('form[data-job-ask] fieldset:not(:disabled)');
1914
1945
  const blocked=saving||draftConflict||!!actReadOnly||!!host?.unavailable;
1915
1946
  const save=button('save');
1916
1947
  const pendingPartComment=parts&&typeof partsSubject!=='undefined'&&!!partsSubject?.hasPendingComment?.();
@@ -1918,7 +1949,7 @@ function renderAnswerControls():void {
1918
1949
  const hasPinnedPart=parts&&(liveIssueCount()>0||pendingPartComment);
1919
1950
  const needsPinnedPart=parts&&!!host?.verdictComments?.rows.length&&!hasPinnedPart;
1920
1951
  const pinRefusal='Request changes needs at least one comment pinned to a part.';
1921
- if((host||subjects.some(subject=>subject.kind==='interview-picks'))&&subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
1952
+ if(subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
1922
1953
  select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
1923
1954
  save.classList.toggle('primary',verdict&&!hasPinnedPart);
1924
1955
  requestChanges.classList.toggle('primary',hasPinnedPart);
@@ -1948,7 +1979,7 @@ function renderAnswerControls():void {
1948
1979
  }
1949
1980
  requestChanges.onclick=async()=>{if(requestChanges.disabled)return;if(parts){if(typeof partsSubject!=='undefined'&&partsSubject?.hasPendingComment?.()&&!await partsSubject.commitDraft())return;if(liveIssueCount()===0)return;void save.onclick?.call(save,new PointerEvent('click'));}else{if(typeof comments!=='undefined'&&comments?.hasPendingComment?.()&&!await comments.commitDraft())return;session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
1950
1981
  }
1951
- for(const root of [recordDialog,...questionForms])for(const control of root?.querySelectorAll<HTMLButtonElement>('button[type="submit"]')??[])control.disabled=blocked||verdict;
1982
+ for(const root of [recordPanel,...questionForms])for(const control of root.querySelectorAll<HTMLButtonElement>('button[type="submit"]'))control.disabled=blocked||verdict;
1952
1983
  // The waiting row is already visible: finish labels, state and handlers before revealing any answer.
1953
1984
  save.hidden=!verdict||firstPublicationPrompt;requestChanges.hidden=save.hidden;rigAsk.hidden=!dialog||firstPublicationPrompt||!questionPending&&recordTrigger!==rigAsk;
1954
1985
  recordAsk.hidden=!dialog||firstPublicationPrompt||recordTrigger!==recordAsk||!recordKind;
@@ -1957,16 +1988,17 @@ function renderAnswerControls():void {
1957
1988
  if(needsPinnedPart&&!save.hidden&&!save.disabled){
1958
1989
  if(!notice.classList.contains('error')){
1959
1990
  setSourceText(notice,pinRefusal);
1991
+ setSourceAttribute(notice,'title',pinRefusal);
1960
1992
  notice.classList.add('error');
1961
1993
  notice.dataset.partsPinRefusal='true';
1962
1994
  }
1963
1995
  }else if(notice.dataset.partsPinRefusal){
1964
1996
  delete notice.dataset.partsPinRefusal;
1965
- setSourceText(notice,'');
1997
+ setSourceText(notice,'');setSourceAttribute(notice,'title','');
1966
1998
  notice.classList.remove('error');
1967
1999
  }
1968
2000
  }
1969
- if(host){rigInspector.answersRendered=true;syncJobActRow(subjects);}
2001
+ rigInspector.answersRendered=true;syncJobActRow(subjects);
1970
2002
  }
1971
2003
  let verdictSubmit:((event:MouseEvent)=>unknown)|null=null;
1972
2004
  /** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
@@ -2047,7 +2079,9 @@ function bindInspector(partsSubject=false):void {
2047
2079
  for(const mode of document.querySelectorAll<HTMLButtonElement>('[data-mode]'))if(mode.dataset.mode==='rig'||mode.dataset.mode==='playback')mode.onclick=()=>showInspector(mode.dataset.mode!);
2048
2080
  }
2049
2081
  /** Pause at the held time and reveal the existing act without changing Setup/Animate mode. */
2050
- function openReview():void {pause();if(!partsOnly)syncCorrectionStage();inspectorBlocks?.select(selectedInspector()??'rig','feedback');workspace?.revealInspector();}
2082
+ function openReview():void {pause();if(!partsOnly)syncCorrectionStage();workspace?.revealCommunication();}
2083
+ /** Something to communicate: a pending question or record form, or at least one comment. */
2084
+ function communicationPending():boolean {return !!communicationPanel.querySelector('form[data-job-ask]')||!!communicationPanel.querySelector('.stage-comment-item');}
2051
2085
  function unitScaleMessage(target:CameraTarget):void {message(partsOnly?'1:1':target==='rig'?'1:1 · one CSS pixel per model coordinate unit.':'1:1 · one CSS pixel per reference grid unit.');}
2052
2086
  function bindReviewDialog():void {select('correction-stage').onchange=syncCorrectionStage;button('native-one').title=tr('One CSS pixel per current pane coordinate unit; synchronized panes retain relative zoom.');}
2053
2087
 
@@ -2145,7 +2179,7 @@ async function decodedControlTime(media:HTMLVideoElement,target:number,signal:Ab
2145
2179
  });
2146
2180
  }
2147
2181
  function numericView():ControlView {return viewport.numericView();}
2148
- function inspectionBinding():InspectionBinding{return {mode:'single',sourceHash:data.sourceHash,rigs:[data.reviewedSource.rig?.sha256??null]};}
2182
+ function inspectionBinding():InspectionBinding{return {mode:'single',sourceHash:data?.sourceHash??host!.record!.sourceHash,rigs:[data?.reviewedSource.rig?.sha256??null]};}
2149
2183
  // Persist the displayed inspection clock; the runtime clock accumulates across idle loops for physics.
2150
2184
  function inspectionBookmark():InspectionBookmark {if(rigDifference)return structuredClone(rigDifference.bookmark);return {schema:'rig-review-inspection/1',binding:inspectionBinding(),animation:animation||null,time,theme:appearance?.get()??'system',layers:{images:layers.images,meshes:layers.mesh,bones:layers.bones},view:numericView(),selection:{...(turnPad?{turn:turnPad.snapshot()}:{}),part:parts?.value()??null,view,checkpoint:checkpoint?.id??null,reference:select('reference-select').value||null,person:selectedPerson||null,inspector:document.querySelector<HTMLElement>('[data-mode][aria-pressed="true"]')?.dataset.mode??selectedInspector()??'rig',partSet:select('part-set').disabled?null:select('part-set').value,axis:axisInspection?{id:select('axis-select').value,value:Number(input('axis-value').value)}:null}};}
2151
2185
  async function restoreInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false,keepCamera=true):Promise<void> {
@@ -3449,21 +3483,36 @@ function commentCaptureRefusal():string|null {
3449
3483
  (()=>{const handles=document.getElementById('idle-handles');return handles&&!handles.hidden&&handles.childElementCount>0;})()?'Idle tracks stage handles':null;
3450
3484
  return preview?`COMMENT_UNAPPLIED_PREVIEW: ${preview} is active; leave or disable that preview before commenting (nothing is cleared or applied automatically)`:null;
3451
3485
  }
3486
+ /** #1048: the shown plan picture or sealed question image takes reference-view pins. The camera is the shared reference viewport's image space,
3487
+ * so `world` is the picture's natural pixels; the identity is the sealed `files` entry. */
3488
+ function planPicturePose(view:StageComment['viewport']):CommentPose|null {
3489
+ const picture=shownPlanPicture(),pane=el('reference-viewport'),camera=numericView().cameras.reference,media=el('reference-content').querySelector('img');
3490
+ if(!picture||view!=='reference'||!camera||!media||pane.clientWidth<=0||pane.clientHeight<=0)return null;
3491
+ return {mode:'setup',capture:{pane,images:true,backend:'canvas2d'},camera,frame:null,timeBasis:timeOnlyBasis,time:0,animation:null,turn:null,
3492
+ sourceHash:host!.record!.sourceHash,modelHash:null,referenceHash:picture.sha256,referenceId:picture.path,rig:picture.name,media};
3493
+ }
3494
+ function planPictureBookmark():InspectionBookmark {
3495
+ const bookmark=inspectionBookmark();
3496
+ return {...bookmark,time:0,selection:{...bookmark.selection,view:'reference',reference:shownPlanPicture()!.path,inspector:'rig'}};
3497
+ }
3452
3498
  function setupComments():void {
3453
3499
  if(host?.direction||host?.record){restoreRecordComments();liveIssueCount=()=>recordComments.length;if(host?.direction)dirty=dirty||recordComments.length>0;}
3454
3500
  if(host?.verdictComments){restoreRecordComments();if(host.verdictComments.rows.length)markDirty();}
3455
3501
  comments=bindStageComments<CommentRow,CommentPose>({general:host?.record||host?.direction||host?.verdictComments?{
3456
3502
  create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('target' in row),
3457
3503
  ...(host.verdictComments?{rows:host.verdictComments.rows,available:host.verdictComments.available,refusal:()=>readOnly}:{}),
3458
- }:undefined,listHost:el('comments-list-host'),openList:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?{}:{rig:el('rig-viewport'),reference:el('reference-viewport')},
3504
+ }:undefined,listHost:el('comments-list-host'),openList:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot)||!!shownPlanPicture(),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?(recordPictures()?{reference:el('reference-viewport')}:{}):{rig:el('rig-viewport'),reference:el('reference-viewport')},
3459
3505
  pose:view=>{
3506
+ if(host?.record&&!host.record.hasPicture)return planPicturePose(view);
3460
3507
  if(hasTransientQuestionImage(screenRoot))return null;
3461
3508
  if(view!=='rig'&&view!=='reference')return null;const workspaceMode=document.querySelector<HTMLElement>('[data-mode][aria-pressed="true"]')?.dataset.mode;if(workspaceMode!=='rig'&&workspaceMode!=='playback')return null;const camera=numericView().cameras[view],pane=el(view+'-viewport');if(!camera||pane.clientWidth<=0||pane.clientHeight<=0)return null;
3462
3509
  const renderer=player?.renderer;const current=time,index=frameAtTime(activeFrameClock(),current),referenceId=view==='reference'?select('reference-select').value||null:null,referenceHash=referenceId?data.referenceHashes?.[referenceId]??(data.explicitReference?.id===referenceId?data.explicitReference.sha256:null):null;
3463
3510
  return {mode:workspaceMode==='playback'?'animate':'setup',capture:{pane,root:view==='rig'?el('rig-root'):undefined,images:view==='reference'||layers.images,canvas:view==='rig'&&renderer instanceof CanvasRenderer?renderer.canvas:undefined,backend:renderer instanceof CanvasRenderer?renderer.backendActive:renderer?.meshBackendActive??'canvas2d'},camera,frame:index===null?null:{index,basis:'producer'},...(index===null?{timeBasis:timeOnlyBasis}:{}),time:current,animation:animation||null,turn:turnPad?.snapshot()??null,sourceHash:data.sourceHash,modelHash:view==='reference'?null:stageModelHash,referenceHash,referenceId,rig:data.manifest.id,...(view==='reference'?{media:video??el('reference-content').querySelector('img')??undefined}:{posed:parts?.frame('single'),assets:assets??undefined})} as CommentPose;
3464
3511
  },
3465
- pause:async()=>{const running=playing||!!video&&!video.paused;pause();if(running&&video&&video.readyState>=1){seekingControl=true;try{await inspectControlTime(time,new AbortController().signal);}finally{seekingControl=false;}}if(turnPad)turnPad.restore({...turnPad.snapshot(),held:true},false);},bookmark:inspectionBookmark,restore:(b,timed)=>restoreInspection(parseBookmark(b,inspectionBinding()),new AbortController().signal,!!timed),feedback:()=>host?.record||host?.direction?recordComments:session.feedback,
3512
+ pause:async()=>{const running=playing||!!video&&!video.paused;pause();if(running&&video&&video.readyState>=1){seekingControl=true;try{await inspectControlTime(time,new AbortController().signal);}finally{seekingControl=false;}}if(turnPad)turnPad.restore({...turnPad.snapshot(),held:true},false);},bookmark:()=>shownPlanPicture()?planPictureBookmark():inspectionBookmark(),restore:(b,timed)=>host?.record&&!host.record.hasPicture?Promise.resolve():restoreInspection(parseBookmark(b,inspectionBinding()),new AbortController().signal,!!timed),feedback:()=>host?.record||host?.direction?recordComments:session.feedback,
3466
3513
  locked:host?.record?()=>false:host?.direction?id=>submittedDirectionComments.has(id):isSubmittedFeedback,add:f=>{if(host?.record||host?.direction)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(/^The source changed, so /.test(draftStatus??''))draftStatus=null;if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}if(host?.verdictComments)persistRecordComments();markDirty();renderProposals();return persistence?.save();},draftChanged:()=>{if(typeof renderAnswerControls==='function')renderAnswerControls();},error:value=>message(value,true),
3514
+ picture:mark=>{const record=host?.record&&!host.record.hasPicture?host.record:undefined,pictures=record?[...record.planPicture?[record.planPicture]:[],...record.questionPictures??[]]:[];
3515
+ return mark.viewport==='reference'&&pictures.find(picture=>mark.referenceId===picture.path&&mark.referenceHash===picture.sha256)?.name||null;},
3467
3516
  refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
3468
3517
  });
3469
3518
  if(host?.verdictComments)renderProposals();
package/web/rig-host.ts CHANGED
@@ -49,7 +49,7 @@ export interface RigHost {
49
49
  readonly navigation?:RigHostNavigation;
50
50
  /** Derived from the displayed subject's finalized verdict; never a mode or another subject's act. */
51
51
  reviewState?(issues:number,sending:boolean):string;
52
- readonly record?:{readonly jobId?:string;readonly draftId?:string;readonly publicationId?:string;readonly previousPublicationId?:string|null;readonly label:string;readonly sourceHash:string;readonly hasPicture:boolean;readonly planPicture?:{readonly name:string;readonly src:string};readonly missingPicture?:'rig'|'scene';readonly questionPicture?:true};
52
+ readonly record?:{readonly jobId?:string;readonly draftId?:string;readonly publicationId?:string;readonly previousPublicationId?:string|null;readonly label:string;readonly sourceHash:string;readonly hasPicture:boolean;readonly planPicture?:{readonly name:string;readonly src:string;readonly path:string;readonly sha256:string};/** #1048: the sealed `files` entries of the record's question images. */readonly questionPictures?:readonly {readonly name:string;readonly path:string;readonly sha256:string}[];readonly missingPicture?:'rig'|'scene';readonly questionPicture?:true};
53
53
  submitParts?(issues:readonly PartsIssue[], general?:readonly string[]):Promise<string>;
54
54
  readonly access: InstanceAccess;
55
55
  /** UI act authority is separate from a retained backdrop's immutable source access. */
@@ -32,6 +32,8 @@ interface Host<Row extends CommentRow=Feedback,Pose extends CommentUiPose=Commen
32
32
  feedback:()=>Row[];locked:(id:string)=>boolean;
33
33
  add:(feedback:Row,side?:'a'|'b')=>void;changed:()=>void|Promise<void>;draftChanged?:()=>void;error:(message:string)=>void;
34
34
  general?:{create:(summary:string)=>Row;matches:(row:Row)=>boolean;rows?:Row[];available?:()=>boolean;refusal?:()=>string|null};
35
+ /** #1062: the shown still picture a mark names, if any. A still picture has no clock, so its row shows the picture and the place, not a time. */
36
+ picture?:(mark:StageComment)=>string|null;
35
37
  refusal?:()=>string|null;blocked:()=>boolean;busy?:()=>boolean;busyError?:(message:string)=>void;shortcutBlocked?:()=>boolean;shortcutActive?:()=>boolean;codec?:CommentCodec<Row,Pose>;
36
38
  }
37
39
  const markOf=(f:Feedback):StageComment|null=>{try{const c=f.context as Record<string,unknown>|undefined;return c?.comment?parseStageComment(c.comment):null;}catch{return null;}};
@@ -136,8 +138,10 @@ export function bindStageComments<Row extends CommentRow=Feedback,Pose extends C
136
138
  const openComment=async(f:Row)=>{const mark=readMark(f);if(!mark){if(host.general?.matches(f))openComposer(null,{x:0,y:0,width:0,height:0},f);return;}if(list.hidden)setOpen(true);if(list.hidden)return;if(await jump(f)){const reason=updateRefusal();setCapture(!reason&&!host.blocked());const pose=host.pose(mark.viewport),screen=host.codec?.geometry&&pose?region(projectMark(mark.world,pose.camera),projectMark({x:mark.world.x+mark.world.width,y:mark.world.y+mark.world.height},pose.camera)):mark.screen;openComposer(mark.viewport,screen,f,pose?.mode??mark.mode);}};
137
139
  const renderList=()=>{placeList();list.setAttribute('aria-label',t('Comments'));list.replaceChildren();const title=document.createElement('strong');title.textContent=t('Comments');list.append(title);const rawReason=host.refusal?.()??null,reason=rawReason?t(rawReason):null;if(reason){const note=document.createElement('small');note.className='stage-comment-refusal-note';note.title=reason;note.textContent=reason;Object.assign(note.style,{display:'block',marginTop:'4px',maxWidth:'100%',whiteSpace:inline?'normal':'nowrap',overflow:'hidden',textOverflow:'ellipsis'});list.append(note);}if(host.general&&host.general.available?.()!==false){const add=document.createElement('button');add.type='button';add.textContent=t('Add general comment');add.dataset.commentGeneral='';add.onclick=()=>openComposer(null,{x:0,y:0,width:0,height:0});list.append(add);}const all=host.feedback().filter(f=>readMark(f)||host.general?.matches(f));if(host.general?.rows)all.push(...host.general.rows);toggle.textContent=t(host.busy?.()?'Comment · C ({0}) · Rendering':'Comment · C ({0})').replace('{0}',String(all.length));if(!all.length){const empty=document.createElement('p');empty.textContent=t(inline?'No comments yet.':reason?'Read only · Escape closes':'Mark a point or region, then type. Enter saves · Escape cancels.');list.append(empty);}for(const [i,f]of all.entries()){
138
140
  const mark=readMark(f),row=document.createElement('div');row.className='stage-comment-item';row.dataset.commentId=f.id;
139
- const [timing,frameReason]=mark&&!host.codec&&!mark.frame?feedbackTimingLabel(f as unknown as Feedback).split(' · '):[];
140
- const go=document.createElement('button');go.type='button';go.className='stage-comment-summary';if(frameReason)go.title=t(frameReason);go.textContent=!mark?`${i+1} · ${t('General comment')} · ${f.summary}`:host.codec?`${i+1} · ${host.codec.label(f,mark)}`:`${i+1} · ${t(commentLabels[mark.mode]??mark.mode)} · ${t(commentLabels[mark.viewport]??mark.viewport)} · ${mark.frame?t(`F${mark.frame.index} (${mark.frame.basis})`):t(timing!)} · ${f.summary}${frameReason?` · ${t('Frame unavailable')}`:''}`;go.onclick=()=>openComment(f);row.append(go);
141
+ const picture=mark&&!host.codec?host.picture?.(mark as StageComment)??null:null;
142
+ const [timing,frameReason]=mark&&!host.codec&&!picture&&!mark.frame?feedbackTimingLabel(f as unknown as Feedback).split(' · '):[];
143
+ const place=picture?t(mark!.world.width>0||mark!.world.height>0?'Region':'Point'):'';
144
+ const go=document.createElement('button');go.type='button';go.className='stage-comment-summary';if(frameReason)go.title=t(frameReason);go.textContent=!mark?`${i+1} · ${t('General comment')} · ${f.summary}`:host.codec?`${i+1} · ${host.codec.label(f,mark)}`:picture?`${i+1} · ${picture} · ${place} · ${f.summary}`:`${i+1} · ${t(commentLabels[mark.mode]??mark.mode)} · ${t(commentLabels[mark.viewport]??mark.viewport)} · ${mark.frame?t(`F${mark.frame.index} (${mark.frame.basis})`):t(timing!)} · ${f.summary}${frameReason?` · ${t('Frame unavailable')}`:''}`;go.onclick=()=>openComment(f);row.append(go);
141
145
  if(host.locked(f.id)){const submitted=document.createElement('span');submitted.textContent=t('Submitted');row.append(submitted);}
142
146
  list.append(row);
143
147
  }};