@rig-c/review 1.10.2 → 1.11.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.
@@ -0,0 +1,180 @@
1
+ import type { HistoricalInterview, InterviewQuestion } from '../src/interview-project.ts';
2
+ import type { Picks } from '../src/interview-picks.ts';
3
+ import { onLanguageChange, t } from './i18n.ts';
4
+ import type { InstanceAccess } from './instance-access.ts';
5
+
6
+ type Question = Omit<InterviewQuestion,'images'> & {images:{name:string;url:string}[]; saved:Picks|null};
7
+ export const interviewErrors: Readonly<Record<string,string>> = {
8
+ INTERVIEW_CHOICE_INVALID:'interview.invalid',
9
+ INTERVIEW_CHOICE_CONSTRAINT:'interview.constraint',
10
+ INTERVIEW_CHOICE_REQUIRED:'interview.required',
11
+ INTERVIEW_OPTIONS_INVALID:'interview.invalidOptions',
12
+ INTERVIEW_OPTIONS_FILE:'interview.file',
13
+ INTERVIEW_OPTIONS_STALE:'interview.stale',
14
+ INTERVIEW_PICKS_OUTPUT:'interview.output',
15
+ };
16
+ function element<K extends keyof HTMLElementTagNameMap>(tag: K, content?: string): HTMLElementTagNameMap[K] {
17
+ const el = document.createElement(tag);
18
+ if (content !== undefined) el.textContent = content;
19
+ return el;
20
+ }
21
+ function errorKey(error: unknown) {
22
+ return error instanceof Error ? interviewErrors[error.message] ?? 'interview.failed' : 'interview.failed';
23
+ }
24
+ async function request(access: InstanceAccess, path: string, body?: Picks) {
25
+ const response = await fetch(access.route(path), body ? {
26
+ method:'POST', headers:access.headers({'Content-Type':'application/json'}), body:JSON.stringify(body),
27
+ } : undefined);
28
+ const result = await response.json();
29
+ if (!response.ok) throw new Error(result.error);
30
+ return result;
31
+ }
32
+
33
+ export async function mountInterview(host: HTMLElement, access: InstanceAccess) {
34
+ let data: {questions:Question[];historical:HistoricalInterview[]};
35
+ try {data = await request(access, '/api/interview');}
36
+ catch (error) {
37
+ const render = () => {host.textContent = t(errorKey(error));};
38
+ onLanguageChange(render); render(); return;
39
+ }
40
+ const {questions, historical:legacy} = data;
41
+ const drafts = questions.map(question => {
42
+ const saved = question.editable ? question.saved : null;
43
+ return {
44
+ picks:new Map(saved?.picks.map(pick => [pick.ask, pick])),
45
+ note:saved?.note,
46
+ image:0,
47
+ status:saved ? 'interview.saved' : '',
48
+ };
49
+ });
50
+ let selected = 0;
51
+ let busy = false;
52
+ const render = () => {
53
+ const archive = element('details');
54
+ archive.append(element('summary', t('interview.legacy')));
55
+ for (const answer of legacy) {
56
+ const item = element('section');
57
+ item.append(element('h3', answer.question), element('p', [answer.by,answer.at].filter(Boolean).join(' · ')),
58
+ element('pre', answer.verbatim));
59
+ archive.append(item);
60
+ }
61
+ if (!questions.length) {
62
+ host.replaceChildren(element('p', t('interview.empty')));
63
+ if (legacy.length) {archive.open = true; host.append(archive);}
64
+ return;
65
+ }
66
+ const question = questions[selected]!;
67
+ const state = drafts[selected]!;
68
+ const picker = element('select');
69
+ picker.setAttribute('aria-label', t('interview.question'));
70
+ questions.forEach((item, index) => {
71
+ const entry = element('option', item.set.question + ' · ' + item.set.id + (item.editable ? '' : ' · ' + t('interview.history')));
72
+ entry.value = String(index); picker.append(entry);
73
+ });
74
+ picker.value = String(selected);
75
+ picker.disabled = busy;
76
+ picker.onchange = () => {selected = Number(picker.value); render();};
77
+
78
+ const grid = element('div'); grid.className = 'interview-grid';
79
+ const art = element('aside');
80
+ art.append(element('h2', t(question.hasParts ? 'interview.parts' : 'interview.source')));
81
+ if (!question.hasParts) art.append(element('p', t('interview.noParts')));
82
+ if (question.partsUnavailable) art.append(element('p', t('interview.partsUnavailable')));
83
+ const image = question.images[state.image];
84
+ if (image) {
85
+ const tabs = element('div');
86
+ question.images.forEach((asset, index) => {
87
+ const button = element('button', asset.name);
88
+ button.type = 'button';
89
+ button.setAttribute('aria-pressed', String(index === state.image));
90
+ button.onclick = () => {state.image = index; render();};
91
+ tabs.append(button);
92
+ });
93
+ const preview = element('img'); preview.alt = image.name; preview.src = access.route(image.url);
94
+ const unavailable = element('p', t('interview.imageUnavailable'));
95
+ unavailable.setAttribute('role','status');
96
+ unavailable.hidden = true;
97
+ preview.onerror = () => {preview.hidden = true; unavailable.hidden = false;};
98
+ art.append(tabs, preview, unavailable);
99
+ }
100
+
101
+ const form = element('form');
102
+ const fields = element('fieldset'); fields.disabled = !question.editable || !access.capability || busy;
103
+ const provenance = element('p', t('interview.provenance', [question.set.drafted_by, question.set.drafted_at]));
104
+ const binding = element('code', question.ref.path + ' · ' + question.ref.sha256);
105
+ form.append(provenance, binding);
106
+ const historical = question.answer?.choice as {picks?:Picks['picks'];note?:string} | undefined;
107
+ const status = element('p'); status.setAttribute('role','status');
108
+ const markUnsaved = () => {
109
+ state.status = 'interview.unsaved';
110
+ status.textContent = t(state.status);
111
+ };
112
+ for (const ask of question.set.asks) {
113
+ const group = element('fieldset');
114
+ group.append(element('legend', ask.prompt));
115
+ const pick = state.picks.get(ask.id) ?? historical?.picks?.find(pick => pick.ask === ask.id);
116
+ const other = element('textarea');
117
+ other.setAttribute('aria-label', t('interview.other'));
118
+ other.value = pick?.other_text ?? '';
119
+ other.hidden = pick?.other_text === undefined && !ask.options.some(option => option.id === pick?.option_id && option.kind === 'other');
120
+ other.oninput = () => {
121
+ const previous = state.picks.get(ask.id);
122
+ if (previous) {state.picks.set(ask.id, {...previous, other_text:other.value}); markUnsaved();}
123
+ };
124
+ for (const option of ask.options) {
125
+ const label = element('label'); label.className = 'interview-option';
126
+ const radio = element('input'); radio.type = 'radio'; radio.name = ask.id; radio.value = option.id;
127
+ radio.required = true; radio.checked = option.id === pick?.option_id;
128
+ radio.onchange = () => {
129
+ const next = {ask:ask.id, option_id:option.id};
130
+ state.picks.set(ask.id, option.kind === 'other' ? {...next, other_text:other.value} : next);
131
+ markUnsaved();
132
+ other.hidden = option.kind !== 'other';
133
+ other.required = option.kind === 'other';
134
+ pending.hidden = option.kind === 'value';
135
+ pending.textContent = t(option.kind === 'other' ? 'interview.otherPending' : 'interview.autoPending');
136
+ };
137
+ label.append(radio, element('strong', option.label), element('span', option.effect));
138
+ if (option.recommended) label.append(element('b', t('interview.recommended')), element('span', option.reason));
139
+ group.append(label);
140
+ }
141
+ const kind = ask.options.find(option => option.id === pick?.option_id)?.kind;
142
+ const autoResolved = !question.editable && Array.isArray((question.answer?.agent_decision as {fragments?:unknown}|undefined)?.fragments) &&
143
+ ((question.answer!.agent_decision as {fragments:{ask:string}[]}).fragments).some(fragment => fragment.ask === ask.id);
144
+ const pending = element('p', t(kind === 'other' ? 'interview.otherPending' : 'interview.autoPending'));
145
+ pending.hidden = !(kind === 'auto' && !autoResolved || kind === 'other' && !(pick && 'other_fragment' in pick));
146
+ other.required = kind === 'other';
147
+ group.append(other, pending);
148
+ fields.append(group);
149
+ }
150
+ const noteLabel = element('label', t('interview.note'));
151
+ const note = element('textarea');
152
+ note.value = state.note ?? historical?.note ?? '';
153
+ note.oninput = () => {state.note = note.value; markUnsaved();};
154
+ noteLabel.append(note);
155
+ fields.append(noteLabel);
156
+ if (question.editable) {
157
+ const submit = element('button', t('interview.save')); submit.type = 'submit'; fields.append(submit);
158
+ }
159
+ status.textContent = state.status ? t(state.status) : t(!question.editable ? 'interview.history' : access.capability ? 'interview.choose' : 'interview.readOnly');
160
+ form.append(fields, status);
161
+ form.onsubmit = async event => {
162
+ event.preventDefault();
163
+ if (!question.editable || !access.capability || busy) return;
164
+ const ordered = question.set.asks.map(ask => state.picks.get(ask.id));
165
+ if (ordered.some(pick => !pick)) return;
166
+ busy = true; fields.disabled = true; picker.disabled = true;
167
+ try {
168
+ await request(access, '/api/interview/picks', {
169
+ schema:'rig-review/interview-picks@1', set:question.ref, picks:ordered as Picks['picks'],
170
+ ...(state.note !== undefined ? {note:state.note} : {}), by:'user', at:new Date().toISOString(),
171
+ });
172
+ state.status = 'interview.saved';
173
+ } catch (error) {state.status = errorKey(error);}
174
+ finally {busy = false; render();}
175
+ };
176
+ grid.append(art, form); host.replaceChildren(picker, grid);
177
+ if (legacy.length) host.append(archive);
178
+ };
179
+ onLanguageChange(render); render();
180
+ }
@@ -0,0 +1,26 @@
1
+ :root { color-scheme: dark; font-family: system-ui, sans-serif; background: #14171c; color: #edf0f4; }
2
+ body { max-width: 88rem; margin: auto; padding: 1.25rem; }
3
+ header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1rem; }
4
+ header h1 { margin: 0; }
5
+ header select { margin-inline-start: auto; }
6
+ button, select, textarea { font: inherit; color: inherit; background: #202630; border: 1px solid #637386; border-radius: .3rem; padding: .45rem; }
7
+ button[aria-pressed="true"], button[aria-current="step"] { border-color: #a4cbfa; }
8
+ .interview-grid { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(20rem, 2fr); gap: 1rem; align-items: start; margin-top: 1rem; }
9
+ aside, form { background: #1a1f27; border: 1px solid #414e60; border-radius: .45rem; padding: 1rem; min-width: 0; }
10
+ aside { position: sticky; top: 1rem; }
11
+ aside img:not([hidden]) { display: block; max-width: 100%; max-height: 65vh; margin: 1rem auto; background: #272e3b; }
12
+ fieldset { border: 0; padding: .5rem 0; margin: 0; min-width: 0; }
13
+ fieldset fieldset { border-top: 1px solid #414e60; margin: .75rem 0; }
14
+ legend, .interview-option span, .interview-option strong { white-space: pre-wrap; overflow-wrap: anywhere; }
15
+ .interview-option { display: grid; grid-template-columns: min-content 1fr; gap: .3rem .6rem; padding: .6rem; margin: .35rem 0; background: #242b36; border-radius: .3rem; }
16
+ .interview-option span, .interview-option b { grid-column: 2; }
17
+ .interview-option b { color: #a4cbfa; }
18
+ textarea:not([hidden]) { display: block; box-sizing: border-box; width: 100%; min-height: 4rem; margin-bottom: .75rem; }
19
+ code { overflow-wrap: anywhere; }
20
+ @media (max-width: 42rem) {
21
+ .interview-grid { grid-template-columns: minmax(0, 1fr); }
22
+ aside { position: static; }
23
+ }
24
+
25
+ details { margin-block: 1rem; }
26
+ pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@@ -0,0 +1,17 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <link rel="stylesheet" href="interview.css">
7
+ </head>
8
+ <body>
9
+ <header>
10
+ <h1></h1>
11
+ <nav data-stage-nav></nav>
12
+ <select><option value="en">English</option><option value="ko">한국어</option></select>
13
+ </header>
14
+ <main></main>
15
+ <script type="module" src="interview.js"></script>
16
+ </body>
17
+ </html>
@@ -0,0 +1,27 @@
1
+ import { getLanguage, setLinkLanguage, setLanguagePreference, t } from './i18n.ts';
2
+ import { pageInstanceAccess } from './instance-access.ts';
3
+ import { mountInterview } from './interview-panel.ts';
4
+ import { connectLiveWindow } from './live-connection.ts';
5
+ import { bindStageNav } from './stage-nav.ts';
6
+
7
+ const access = pageInstanceAccess();
8
+ const lang = new URL(location.href).searchParams.get('lang');
9
+ setLanguagePreference(lang === 'en' || lang === 'ko' ? lang : 'system');
10
+ const title = document.querySelector('h1')!;
11
+ const languages = document.querySelector('select')!;
12
+ function localize() {
13
+ document.title = title.textContent = t('interview.title');
14
+ languages.setAttribute('aria-label', t('interview.language'));
15
+ }
16
+ languages.value = getLanguage();
17
+ languages.onchange = () => {
18
+ setLinkLanguage(null);
19
+ setLanguagePreference(languages.value === 'ko' ? 'ko' : 'en');
20
+ localize();
21
+ };
22
+ localize();
23
+ bindStageNav({interviewOnly:true, model:false});
24
+ connectLiveWindow(access);
25
+ const host = document.querySelector('main')!;
26
+ host.textContent = t('interview.loading');
27
+ await mountInterview(host, access);
package/web/main.ts CHANGED
@@ -722,6 +722,27 @@ function renderProposals(): void {
722
722
  for (const feedback of session.feedback) {
723
723
  const item = document.createElement('div'); item.className = 'proposal-item'; const title = document.createElement('strong'); title.className = 'feedback-heading'; title.textContent = `${feedback.category} · ${feedback.target.kind}:${feedback.target.name} · ${feedbackTimingLabel(feedback)}`; const description = document.createElement('span'); description.className = 'feedback-summary'; description.textContent = feedback.summary;
724
724
  item.append(title, description);
725
+ const context = feedback.context as Record<string, Json> | undefined;
726
+ const correction = context?.correction as {path?: string;selector?:{kind?:string}} | undefined;
727
+ if (correction) {
728
+ const label = document.createElement('p');
729
+ const schema=(context?.applied as {schema?:string}|undefined)?.schema;
730
+ const unsupported=correction.selector?.kind==='post'||schema!=='rig-review-applied/2';
731
+ setSourceText(label, correction.path === 'described' ? 'Unresolved correction request' :
732
+ unsupported ? 'Unsupported correction operation' : 'Made correction evidence');
733
+ item.append(label);
734
+ }
735
+ if ((context?.comment as {schema?: string} | undefined)?.schema === 'rig-review-comment/1' &&
736
+ !submittedBaseline?.feedback.some(row => row.id === feedback.id)) {
737
+ const describe = document.createElement('button');
738
+ describe.type = 'button';
739
+ setSourceText(describe, 'Use as described correction');
740
+ describe.onclick = () => {
741
+ try { feedback.context = { ...context, correction: correctionSelection('described') }; markDirty(); renderProposals(); }
742
+ catch (error) { message(errorText(error), true); }
743
+ };
744
+ item.append(describe);
745
+ }
725
746
  for (const warning of session.feedbackWarnings.filter(value => value.id === feedback.id)) { const note = document.createElement('p'); note.className = 'hint'; note.textContent = `Validation warning · ${warning.error}`; item.append(note); }
726
747
  const details = document.createElement('details'), summary = document.createElement('summary'), source = document.createElement('pre'); summary.textContent = 'Saved feedback and inspection context'; source.className = 'feedback-json'; source.textContent = JSON.stringify(feedback, null, 2); details.append(summary, source);
727
748
  const remove = document.createElement('button'); remove.type = 'button'; remove.textContent = 'Delete'; remove.onclick = () => { session.feedback = session.feedback.filter(item => item.id !== feedback.id); session.feedbackWarnings = session.feedbackWarnings.filter(warning => warning.id !== feedback.id); markDirty(); renderProposals(); };
@@ -730,6 +751,24 @@ function renderProposals(): void {
730
751
  updateSavedState();
731
752
  }
732
753
 
754
+ function syncCorrectionStage(): void {
755
+ el('correction-post-fields').hidden = select('correction-stage').value !== 'direction-review';
756
+ }
757
+
758
+ function correctionSelection(path: 'described' | 'made'): Json {
759
+ const stage = select('correction-stage').value, identity = input('correction-selector').value;
760
+ if (stage === 'parts-review' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(identity)) {
761
+ return { path, selector: { stage, kind: 'draft', id: identity } };
762
+ }
763
+ const version = Number(identity);
764
+ if (/^[1-9][0-9]*$/.test(identity) && Number.isSafeInteger(version)) {
765
+ if (stage === 'rig-review') return { path, selector: { stage, kind: 'rig', version } };
766
+ const modelFile = input('correction-model').value;
767
+ if (stage === 'direction-review' && modelFile) return { path, selector: { stage, kind: 'post', version, modelFile } };
768
+ }
769
+ throw new Error(tr('Choose the explicit Create source identity.'));
770
+ }
771
+
733
772
  function propose(tool: string): void {
734
773
  if (tool === 'angle' && !input('axis-value').disabled) { showInspector('playback');chooseAxis(); return; }
735
774
  const choices: Record<string, { target: Feedback['target']['kind']; hint: string }> = {
@@ -800,7 +839,7 @@ function bind(): void {
800
839
  button('chest-export').onclick = () => { void exportChest(); };
801
840
  for (const event of ['input', 'change']) el('chest-regions').addEventListener(event, renderChest);
802
841
  // A discarded local draft restores the form after its button's own handler; re-read the tool then.
803
- for (const id of ['draft-recovery', 'review-draft-recovery']) el(id).addEventListener('click', () => { renderChest(); restoreEnvironment(); physicsPanel?.restore(); bonesPanel?.restore(); cutsPanel?.restore(); clothPanel?.restore(); idlePanel?.restore(); rigFieldsPanel?.restore(); });
842
+ for (const id of ['draft-recovery', 'review-draft-recovery']) el(id).addEventListener('click', () => { renderChest(); restoreEnvironment(); physicsPanel?.restore(); bonesPanel?.restore(); cutsPanel?.restore(); clothPanel?.restore(); idlePanel?.restore(); rigFieldsPanel?.restore(); syncCorrectionStage(); });
804
843
  for (const id of ['strip-scope', 'strip-reference', 'strip-format']) select(id).onchange = () => stripStatus('Selection changed. Check the ranges, animation and reference video before downloading.');
805
844
  for (const item of document.querySelectorAll<HTMLButtonElement>('[data-view]')) item.onclick = () => {setView(item.dataset.view as typeof view);const menu=document.getElementById('view-menu') as HTMLDetailsElement|null;if(menu)menu.open=false;};
806
845
  for (const item of document.querySelectorAll<HTMLButtonElement>('[data-proposal]')) item.onclick = () => propose(item.dataset.proposal ?? '');
@@ -831,18 +870,34 @@ function bind(): void {
831
870
  el<HTMLTextAreaElement>('checkpoint-note').oninput = () => { const entry = checkpointEntry(); if (entry) { entry.note = el<HTMLTextAreaElement>('checkpoint-note').value; markDirty(); } };
832
871
  for (const radio of document.querySelectorAll<HTMLInputElement>('input[name="outcome"]')) radio.onchange = () => { const entry = checkpointEntry(); if (entry) { entry.outcome = radio.value as typeof entry.outcome; markDirty(); renderCheckpoints(); } };
833
872
  select('feedback-target-kind').onchange = () => renderFeedbackTargets();
834
- button('add-proposal').onclick = () => {
873
+ button('add-proposal').onclick = async () => {
835
874
  const start = input('feedback-start').value.trim(), end = input('feedback-end').value.trim(), frameStart = Number(start), frameEnd = Number(end);
836
- const name = input('feedback-target-name').value.trim(), summary = input('feedback-summary').value.trim();
875
+ const name = input('feedback-target-name').value.trim();
876
+ const path = select('correction-path').value, capturedApply = appliedOnStage;
877
+ let summary = input('feedback-summary').value.trim(), correction: ReturnType<typeof correctionSelection> | undefined;
878
+ if (path === 'described' || path === 'made') {
879
+ try {
880
+ correction = correctionSelection(path);
881
+ summary = input('feedback-summary').value;
882
+ const file = input('correction-words').files?.[0];
883
+ if (file) {
884
+ if (file.size > 4000) throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
885
+ summary = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(await file.arrayBuffer());
886
+ }
887
+ if (!summary.trim() || summary.length > 1000) throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
888
+ if (path === 'made' && (!capturedApply || capturedApply !== appliedOnStage)) throw new Error(tr('CORRECTION_APPLY_PENDING: Apply and check the correction first.'));
889
+ } catch (error) { message(errorText(error), true); return; }
890
+ }
837
891
  if (!start || !end || !Number.isSafeInteger(frameStart) || !Number.isSafeInteger(frameEnd) || frameStart < 0 || frameEnd < frameStart) { message('Enter nonnegative integer start and end frames, with the end at or after the start.', true); return; }
838
892
  if (!['bone', 'slot', 'rig'].includes(select('feedback-target-kind').value) || !['defect', 'quality'].includes(select('feedback-category').value)) { message('Select a target type and defect or quality category.', true); return; }
839
- if (!name || !summary || /[\r\n]/.test(summary) || summary.length > 1000) { message('Enter the actual target name and a one-line summary of up to 1,000 characters.', true); return; }
893
+ if (!name || !summary || (!correction && /[\r\n]/.test(summary)) || summary.length > 1000) { message('Enter the actual target name and a one-line summary of up to 1,000 characters.', true); return; }
840
894
  const target: Feedback['target'] = { kind: select('feedback-target-kind').value as Feedback['target']['kind'], name };
841
895
  const selectedAnimation = feedbackAnimation();
842
896
  try { validateFeedbackSelection(data.feedbackCatalog, { frameStart, frameEnd, target, animation: selectedAnimation }); } catch (error) { message(errorText(error), true); return; }
843
897
  const box = assets?.stage ?? player?.bounds();
844
898
  const center = viewport.state.cameraCenter ?? (box ? { x: box.x + box.width / 2, y: box.y + box.height / 2 } : null);
845
899
  session.feedback.push({ id: crypto.randomUUID(), frameStart, frameEnd, target, category: select('feedback-category').value as Feedback['category'], summary, context: {...(turnPad?{turn:JSON.parse(JSON.stringify(turnPad.snapshot())) as Json}:{}),part:parts?.feedback()??null,
900
+ ...(correction ? { correction } : {}),
846
901
  interval: { frameStart, frameEnd, inclusive: true },
847
902
  checkpoint: checkpoint?.id ?? null, animation: selectedAnimation, time, frame: frameAtTime(activeFrameClock(), time),
848
903
  reference: select('reference-select').value || null, person: selectedPerson || null,
@@ -861,7 +916,7 @@ function bind(): void {
861
916
  requirements: (requirementsPanel?.context() ?? null) as unknown as Json,
862
917
  reportEvent: selectedReportEvent ? { id: selectedReportEvent.id, field: selectedReportEvent.field, source: { ...selectedReportEvent.source }, frames: selectedReportEvent.frames ? [...selectedReportEvent.frames] : null, exactTime: eventSeekTime(selectedReportEvent, selectedReportTime), targets: selectedReportEvent.targets.map(target => ({ ...target })) } : null,
863
918
  } });
864
- input('feedback-summary').value = ''; markDirty(); renderProposals(); message('Added structured feedback. Submit the review to save it.');
919
+ input('feedback-summary').value = ''; input('correction-words').value = ''; markDirty(); renderProposals(); message('Added structured feedback. Submit the review to save it.');
865
920
  };
866
921
  button('save').onclick = async () => {
867
922
  if(readOnly){message(readOnly,true);return;}
@@ -972,10 +1027,11 @@ async function start(): Promise<void> {
972
1027
  function showInspector(name:string,reveal=true):void {if(name==='feedback'){if(reveal)openReview();return;}if(reveal)workspace?.revealInspector();const selector=document.querySelector<HTMLButtonElement>(`[data-inspector="${name}"]`);if(selector&&selector.getAttribute('aria-pressed')!=='true'&&selector.getAttribute('aria-selected')!=='true')selector.click();}
973
1028
  function bindInspector():void {bindInspectorTabs(()=>{workspace?.afterTab();fitCamera();},()=>workspace?.beforeTab());}
974
1029
  /** Opening the review pauses playback, as selecting Feedback did. Its inputs stay in the document whether or not it is open, so the draft keeps them. */
975
- function openReview():void {document.querySelector<HTMLButtonElement>('[data-review-stage="3"]')?.click();const dialog=el<HTMLDialogElement>('review-dialog');for(const drawer of document.querySelectorAll<HTMLDialogElement>('dialog.workspace-drawer[open]'))drawer.close();pause();if(!dialog.open)dialog.showModal();}
1030
+ function openReview():void {document.querySelector<HTMLButtonElement>('[data-review-stage="3"]')?.click();const dialog=el<HTMLDialogElement>('review-dialog');for(const drawer of document.querySelectorAll<HTMLDialogElement>('dialog.workspace-drawer[open]'))drawer.close();pause();syncCorrectionStage();if(!dialog.open)dialog.showModal();}
976
1031
  function bindReviewDialog():void {
977
1032
  const dialog=el<HTMLDialogElement>('review-dialog');
978
1033
  button('write-review').onclick=openReview;button('review-dialog-close').onclick=()=>dialog.close();
1034
+ select('correction-stage').onchange=syncCorrectionStage;
979
1035
  // Escape closes the native modal; every close returns focus to the button that opens it.
980
1036
  dialog.addEventListener('close',()=>{button('write-review').setAttribute('aria-expanded','false');button('write-review').focus();});
981
1037
  dialog.addEventListener('toggle',()=>{if(dialog.open)button('write-review').setAttribute('aria-expanded','true');});
package/web/parts.html CHANGED
@@ -27,7 +27,7 @@
27
27
  </main>
28
28
  <aside class="pv-side">
29
29
  <section><h2>PRODUCER FLAGS</h2><ul id="pv-flags" data-pv-flags></ul><p id="pv-flag-sources" class="pv-subtle"></p></section>
30
- <section class="pv-verdict"><h2>VERDICT</h2>
30
+ <section class="pv-verdict"><h2>VERDICT</h2><p id="parts-correction-hint" class="subtle" hidden>Saved part notes and pointed comments can be handed off as described corrections.</p>
31
31
  <div class="pv-outcomes" role="radiogroup" aria-label="Part outcome">
32
32
  <label><input type="radio" name="pv-outcome" value="pending" data-pv-outcome> Pending</label>
33
33
  <label><input type="radio" name="pv-outcome" value="clean" data-pv-outcome> Clean</label>
package/web/parts.ts CHANGED
@@ -414,6 +414,7 @@ async function boot(): Promise<void> {
414
414
  const data = await res.json() as ViewData & { error?: string };
415
415
  if (!res.ok) { const status=$('pv-load');status.textContent=t(data.error??'Load failed.');status.dataset.result='refused';return; }
416
416
  state.data = data;if(!data.differenceAvailable)document.querySelector('[data-pv-comparison="difference"]')?.remove();if(stageEmbedded)for(const item of data.items)if(item.mesh)state.meshShown.add(item.name);$('reference-empty').textContent=data.painting?'':t('PARTS_REFERENCE_UNAVAILABLE: supply --painting to compare the original painting');$('reference-empty').hidden=!!data.painting;if(data.painting)viewport.state.cameraSync=true;comments.push(...data.verdict?.comments??[]);setupPartsComments();viewport.bindNavigation(undefined,()=>!commentUi?.active());viewport.observeResize();
417
+ document.getElementById('parts-correction-hint')!.hidden = data.mode !== 'parts' || stageEmbedded;
417
418
  for (const item of data.items) state.verdict.set(item.name, { outcome: 'pending', note: '', ...(item.mesh ? { mesh: { outcome: 'pending' as Outcome, note: '' } } : {}) });
418
419
  if (data.verdict) { for (const [name, v] of Object.entries(data.verdict.parts)) if (state.verdict.has(name)) state.verdict.set(name, { outcome: v.outcome, note: v.note ?? '', ...(v.mesh ? { mesh: v.mesh } : {}) }); $<HTMLSelectElement>('pv-overall').value = data.verdict.status; }
419
420
  document.title = data.title;
@@ -501,7 +502,7 @@ function renderCorrections():void {
501
502
  for(const [instrument,title,operation]of [['chest','Chest regions',t('rig-parts remesh --mesh')],['mesh','Mesh parameters',t('rig-parts remesh --mesh')],['delta','Edit Mesh',t('rig-parts remesh --delta')]]){
502
503
  const button=document.createElement('button');button.type='button';button.textContent=t(title!);button.title=`${mapping.part} · ${operation}`;button.onclick=()=>parent.postMessage({type:'review-stage-correction',part:mapping.part,sourceHash:data.sourceHash,buildId:data.draft!.buildId,instrument},location.origin);host.append(button);
503
504
  }
504
- const unavailable=document.createElement('p');unavailable.textContent=t('Correction-record export unavailable: waiting for the shared correction contract.');host.append(unavailable);
505
+ const guidance=document.createElement('p');guidance.textContent=t('Use Write review, choose Parts review and name the Create draft. Export the saved item with the feedback CLI. Mesh deltas retain evidence as unsupported operations.');host.append(guidance);
505
506
  }
506
507
 
507
508
  function stagePartsSnapshot():StagePartsState|null {
package/web/stage-nav.ts CHANGED
@@ -17,13 +17,19 @@ export function stagePartsSelectionIndex(data:{inspectionSourceHash?:string;item
17
17
  return i;
18
18
  }
19
19
  export function stageReason(stage:ReviewStage,model:boolean):string|null {
20
- if(stage===2)return 'INTERVIEW_UNAVAILABLE: no interview consumer contract is installed.';
20
+ if(stage===2)return 'INTERVIEW_UNAVAILABLE: Open a designated create project with rig-review interview.';
21
21
  if(stage===4)return 'DIRECTION_UNAVAILABLE: no direction inspection contract is installed.';
22
22
  if(stage===3&&!model)return 'MODEL_UNAVAILABLE: no compiled model is supplied in this inspection.';
23
23
  return null;
24
24
  }
25
- export function bindStageNav(options:{partsOnly?:boolean;model:boolean;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
25
+ export function bindStageNav(options:{interviewOnly?:boolean;partsOnly?:boolean;model:boolean;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
26
26
  const host=document.querySelector<HTMLElement>('[data-stage-nav]');if(!host)return ()=>{};
27
+ if(options.interviewOnly){
28
+ const button=document.createElement('button');button.type='button';button.dataset.reviewStage='2';button.setAttribute('aria-current','step');host.append(button);
29
+ const render=()=>{button.textContent=t(reviewStages[1]);host.setAttribute('aria-label',t('Inspection stages'));};
30
+ document.documentElement.dataset.inspectionStage='2';render();
31
+ const language=onLanguageChange(render);return ()=>{language();button.remove();};
32
+ }
27
33
  const embedded=new URL(location.href).searchParams.get('stageEmbed')==='1';
28
34
  if(embedded){host.hidden=true;return ()=>{};}
29
35
  const access=pageInstanceAccess(),panel=document.createElement('section');panel.className='review-stage-panel';panel.hidden=true;panel.setAttribute('aria-live','polite');document.body.append(panel);