@floless/app 0.161.0 → 0.162.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web/aware.js CHANGED
@@ -2877,21 +2877,36 @@
2877
2877
 
2878
2878
  async function restoreWorkflow(id) {
2879
2879
  closeCombo(false);
2880
+ let review;
2881
+ let sourceOnly = false;
2882
+ try {
2883
+ const updates = await api('/api/workflows/updates');
2884
+ const repair = (updates.sourceRepairReviews || []).find((t) => t.id === id);
2885
+ sourceOnly = Boolean(repair);
2886
+ review = repair ? { expectedSourceHash: repair.sourceHash, expectedFromVersion: repair.fromVersion,
2887
+ expectedToVersion: repair.toVersion, expectedTemplateHash: repair.templateHash } : {};
2888
+ } catch (e) { reportErr(e); return; }
2880
2889
  const ok = await formModal({
2881
2890
  title: 'Restore the official version?',
2882
- sub: 'Re-installs the official workflow and discards any changes made to its logic. Your saved inputs are kept.',
2891
+ sub: 'Re-installs the official workflow and discards any changes made to its logic. Your saved inputs are kept.'
2892
+ + (sourceOnly ? ' This restores the source only. Review it afterwards, then press Compile yourself before running it.' : ''),
2883
2893
  fields: [],
2884
2894
  okLabel: 'Restore',
2885
2895
  });
2886
2896
  if (!ok) return;
2887
2897
  showToast('Restoring…', 'ok');
2888
2898
  try {
2889
- await api(`/api/app/${encodeURIComponent(id)}/restore`, { method: 'POST', body: JSON.stringify({}) });
2899
+ const restored = await api(`/api/app/${encodeURIComponent(id)}/restore`, { method: 'POST', body: JSON.stringify(review) });
2890
2900
  await loadApps();
2891
2901
  if (currentId === id) await loadApp(id);
2892
2902
  await refreshWorkflowUpdates(); // back on the channel — re-offer any pending update
2893
- showToast('Restored to the official version.', 'ok');
2903
+ showToast(restored.needsCompile ? 'The official workflow source was restored. Review it, then press Compile yourself before running it.'
2904
+ : 'Restored to the official version.', 'ok');
2894
2905
  } catch (e) {
2906
+ if (e.body && (e.body.code === 'update-changed' || e.body.code === 'workflow-changed')) {
2907
+ showToast('The workflow or its official version changed after you reviewed it. Your work was kept. Open Restore again to review the current versions.', 'warn');
2908
+ return;
2909
+ }
2895
2910
  console.error(e);
2896
2911
  showToast('We couldn’t restore that workflow because FloLess could not save it. Try again.', 'warn');
2897
2912
  }
@@ -5656,6 +5671,7 @@
5656
5671
  resolve(result);
5657
5672
  };
5658
5673
  const onKey = (e) => {
5674
+ if ($confirmModal.inert || document.getElementById('server-offline-overlay')) return;
5659
5675
  if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); done('cancel'); }
5660
5676
  else if (e.key === 'Tab') {
5661
5677
  // This confirmation can sit above Requests. Own Tab here so the lower dialog's document-level
@@ -8594,6 +8610,7 @@
8594
8610
  const $wfUpdate = document.getElementById('wf-update');
8595
8611
  const $wfUpdateModal = document.getElementById('wf-update-modal');
8596
8612
  let _wfUpdateApplying = false;
8613
+ let _wfReviewedUpdate = null;
8597
8614
  function wfUpdateFor(id) { return _wfUpdates.find((u) => u.id === id) || null; }
8598
8615
  function renderWfUpdatePill() {
8599
8616
  const el = document.getElementById('wf-update');
@@ -8601,6 +8618,8 @@
8601
8618
  const u = currentId ? wfUpdateFor(currentId) : null;
8602
8619
  if (u) {
8603
8620
  el.textContent = '↑ Update to v' + u.available;
8621
+ el.setAttribute('data-command-id', 'shell.workflow-update#' + u.id);
8622
+ el.setAttribute('data-command-instance-label', apps.get(u.id)?.displayName || u.id);
8604
8623
  el.dataset.tip = 'A newer version of this workflow is available — see what changed';
8605
8624
  el.hidden = false;
8606
8625
  } else {
@@ -8618,10 +8637,20 @@
8618
8637
  }
8619
8638
  function openWfUpdateModal(u) {
8620
8639
  if (!$wfUpdateModal) return;
8640
+ // Confirm exactly the offer displayed here, even if background polling replaces the live list.
8641
+ _wfReviewedUpdate = Object.freeze({ ...u });
8621
8642
  const a = apps.get(u.id);
8622
8643
  const name = (a && a.displayName) || u.id;
8623
- document.getElementById('wf-update-title').textContent = `Update “${name}” to v${u.available}`;
8624
- document.getElementById('wf-update-sub').textContent = `You’re on v${u.installed}. What’s new:`;
8644
+ document.getElementById('wf-update-title').textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? `Repair “${name}” compatibility`
8645
+ : u.sourceUpdate?.mode === 'steel-review' ? `Review the update for “${name}”` : `Update “${name}” to v${u.available}`;
8646
+ document.getElementById('wf-update-sub').textContent = `${name} ${u.installed} → ${u.available}${u.sourceUpdate?.mode === 'steel-compatibility' ? ' available · compatibility repair only' : '. What’s new:'}`;
8647
+ const note = $wfUpdateModal.querySelector('.wf-update-note');
8648
+ if (note) note.textContent = u.sourceUpdate ? `${u.sourceUpdate.explanation} A backup is saved before any source change. Afterwards return to Review and approve your model.` : u.sourceOnly
8649
+ ? 'This updates the unchanged older workflow file and saves a backup. It does not approve it. Review the updated workflow, then press Compile yourself before running it.'
8650
+ : "Your work is safe — this updates the workflow's steps and keeps your data. A backup of the current version is saved first.";
8651
+ const apply = document.getElementById('wf-update-ok');
8652
+ if (apply) apply.textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? 'Back up & repair compatibility'
8653
+ : u.sourceUpdate?.mode === 'steel-review' ? 'Review in AI Chat' : '↑ Back up & update';
8625
8654
  const changelog = Array.isArray(u.changelog) ? u.changelog : [];
8626
8655
  document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
8627
8656
  const changes = Array.isArray(e.changes) && e.changes.length
@@ -8631,32 +8660,66 @@
8631
8660
  }).join('') || '<div class="wf-ver-sum">No changelog provided.</div>';
8632
8661
  showModal($wfUpdateModal);
8633
8662
  }
8663
+ function dismissWfUpdateModal() {
8664
+ _wfReviewedUpdate = null;
8665
+ hideModal($wfUpdateModal);
8666
+ }
8634
8667
  async function applyWfUpdate(u) {
8635
8668
  if (_wfUpdateApplying) return;
8669
+ if (u.sourceUpdate?.mode === 'steel-review') {
8670
+ if (typeof window.flolessChat?.openDraft !== 'function' || typeof window.flolessBridge?.openApp !== 'function') {
8671
+ showToast('AI Chat is still starting. Keep this review open and try again in a moment.', 'warn'); return;
8672
+ }
8673
+ _wfUpdateApplying = true;
8674
+ const button = document.getElementById('wf-update-ok');
8675
+ if (button) { button.disabled = true; button.setAttribute('data-blocked-reason', 'Opening this workflow’s chat review.'); }
8676
+ try {
8677
+ // Installed workflows use Workspace chat. Opening the exact workflow first leaves a project
8678
+ // conversation safely; openDraft then preserves/appends the destination draft or offers a provider.
8679
+ await window.flolessBridge.openApp(u.id);
8680
+ await window.flolessChat.openDraft(`Review the installed workflow ${u.id} (${u.installed}) against its bundled maintained template ${u.templateId} (${u.available}). Preserve all my customizations, baked content, models and approval history. Explain the changes before editing; do not compile or approve anything for me.`);
8681
+ dismissWfUpdateModal();
8682
+ showToast('The update review is ready in AI Chat. Send it when you are ready; nothing was changed.', 'ok');
8683
+ } catch (error) { showToast('The review could not open in this workflow’s AI Chat. Your drafts were kept. Try again.', 'warn'); }
8684
+ finally { _wfUpdateApplying = false; if (button) { button.disabled = false; button.removeAttribute('data-blocked-reason'); } }
8685
+ return;
8686
+ }
8636
8687
  _wfUpdateApplying = true;
8637
8688
  const $ok = document.getElementById('wf-update-ok');
8638
8689
  const prev = $ok ? $ok.textContent : '';
8639
- if ($ok) { $ok.disabled = true; $ok.textContent = 'Updating…'; }
8690
+ if ($ok) { $ok.disabled = true; $ok.setAttribute('data-blocked-reason', 'Updating this workflow now.'); $ok.textContent = 'Updating…'; }
8640
8691
  try {
8641
- const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' } });
8692
+ const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' },
8693
+ body: JSON.stringify({ expectedFromVersion: u.installed, expectedToVersion: u.available,
8694
+ ...(u.sourceOnly ? { expectedSourceHash: u.sourceHash, expectedTemplateHash: u.templateHash } : {}),
8695
+ ...(u.sourceUpdate ? { sourceUpdateMode: u.sourceUpdate.mode, expectedSourceHash: u.sourceUpdate.sourceHash, expectedTemplateHash: u.sourceUpdate.templateHash } : {}) }) });
8642
8696
  const d = await r.json().catch(() => ({}));
8643
- if (!r.ok || !d.ok) throw new Error(d.error || 'update failed');
8644
- hideModal($wfUpdateModal);
8645
- showToast(`Updated to v${d.toVersion} — your data is preserved, a backup was saved.`, 'ok');
8697
+ if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || 'update failed'), { code: d.code });
8698
+ dismissWfUpdateModal();
8699
+ showToast(d.compatibilityRepaired ? `3D Viewer compatibility repaired. Workflow v${d.toVersion} and your work were preserved; a backup was saved. Return to Review and approve your model.`
8700
+ : d.needsCompile ? `Updated to v${d.toVersion}. A backup was saved. Review the workflow, then press Compile yourself before running it.`
8701
+ : `Updated to v${d.toVersion} — your data is preserved, a backup was saved.`, 'ok');
8646
8702
  await refreshWorkflowUpdates();
8703
+ globalThis.dispatchEvent?.(new CustomEvent('floless:workflow-updates-changed'));
8647
8704
  if (currentId === u.id) await loadApp(currentId); // reload to show the new structure
8648
8705
  } catch (e) {
8649
- showToast('We couldn’t update this workflow because FloLess could not save the change. Try again.', 'warn');
8706
+ if (e.code === 'update-changed') {
8707
+ dismissWfUpdateModal();
8708
+ await refreshWorkflowUpdates();
8709
+ }
8710
+ showToast(e.code === 'update-changed'
8711
+ ? 'The workflow or its update changed after you opened this review. Your work was kept. Open the update again to review the current version.'
8712
+ : 'We couldn’t update this workflow because FloLess could not save the change. Try again.', 'warn');
8650
8713
  } finally {
8651
8714
  _wfUpdateApplying = false;
8652
- if ($ok) { $ok.disabled = false; $ok.textContent = prev; }
8715
+ if ($ok) { $ok.disabled = false; $ok.removeAttribute('data-blocked-reason'); $ok.textContent = prev; }
8653
8716
  }
8654
8717
  }
8655
8718
  if ($wfUpdate) {
8656
8719
  $wfUpdate.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) openWfUpdateModal(u); };
8657
- const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = () => hideModal($wfUpdateModal);
8658
- const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) applyWfUpdate(u); };
8659
- if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, () => hideModal($wfUpdateModal));
8720
+ const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = dismissWfUpdateModal;
8721
+ const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { if (_wfReviewedUpdate) return applyWfUpdate(_wfReviewedUpdate); };
8722
+ if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, dismissWfUpdateModal);
8660
8723
  }
8661
8724
 
8662
8725
  // The poll deliberately does NOT start here. Module init runs before the boot sequence, so the
@@ -9792,6 +9855,8 @@
9792
9855
  // bug.) The tab then heals itself: the next health tick flips back online and, if
9793
9856
  // we never managed to load, pulls the workspace.
9794
9857
  let serverOnline = null;
9858
+ // SSE is newer evidence than a health probe already in flight. Fence all effects of that probe.
9859
+ let serverObservationEpoch = 0;
9795
9860
 
9796
9861
  // The overlay leads with AUTO-RECOVERY. The login watchdog (FlolessApp --supervise)
9797
9862
  // respawns a dead server within seconds, so a crash heals itself with NO user action
@@ -9812,10 +9877,24 @@
9812
9877
  // preventDefault. No "approve the dialog" promise: on managed browsers no dialog
9813
9878
  // ever appears, so the escalation line's "reopen FloLess" stays the honest path.
9814
9879
  const s = document.getElementById('so-status');
9815
- if (s) s.textContent = 'Starting FloLess…';
9880
+ if (s) s.textContent = 'Your browser was asked to open FloLess. If it does not open, use the Start menu or desktop shortcut.';
9816
9881
  }
9817
9882
 
9818
9883
  let offlineOverlayEl = null;
9884
+ function trapOfflineOverlayKeys(event) {
9885
+ if (document.getElementById('leave-guard-modal')?.classList.contains('show')) return;
9886
+ if (!offlineOverlayEl?.contains(event.target)) return;
9887
+ if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); return; }
9888
+ if (event.key !== 'Tab') return;
9889
+ // Capture before lower dialogs' document-level traps; they are covered, not dismissed.
9890
+ event.preventDefault();
9891
+ event.stopPropagation();
9892
+ const actions = [...offlineOverlayEl.querySelectorAll('.secondary:not([hidden])')];
9893
+ if (!actions.length) return;
9894
+ const at = actions.indexOf(document.activeElement);
9895
+ const next = at < 0 ? (event.shiftKey ? actions.length - 1 : 0) : (at + (event.shiftKey ? actions.length - 1 : 1)) % actions.length;
9896
+ actions[next].focus();
9897
+ }
9819
9898
  function showOfflineOverlay() {
9820
9899
  if (offlineOverlayEl) return;
9821
9900
  lastFocusBeforeOverlay = document.activeElement; // restored on heal (WCAG 2.4.3)
@@ -9827,33 +9906,54 @@
9827
9906
  `<div class="so-card" role="status" tabindex="-1">
9828
9907
  <div class="so-spinner" aria-hidden="true"></div>
9829
9908
  <h1>Reconnecting to FloLess…</h1>
9830
- <p>The local server stopped — this tab reconnects automatically in a few seconds.</p>
9909
+ <p>FloLess isn’t responding. This tab will keep trying to reconnect.</p>
9831
9910
  <p class="so-status" id="so-status"></p>
9832
- <a id="so-start" href="floless://start" class="secondary" hidden>Start FloLess now</a>
9911
+ <div class="so-actions">
9912
+ <button type="button" id="so-refresh" data-command-id="app.reconnect-refresh" class="secondary" hidden>Refresh page</button>
9913
+ <a id="so-start" data-command-id="app.reconnect-start" href="floless://start" class="secondary" hidden>Start FloLess now</a>
9914
+ </div>
9833
9915
  </div>`;
9834
9916
  document.body.appendChild(wrap);
9835
9917
  offlineOverlayEl = wrap;
9836
9918
  document.getElementById('so-start').addEventListener('click', onStartClickFeedback);
9919
+ document.getElementById('so-refresh').addEventListener('click', async () => {
9920
+ // The shared question probes every editor and workflow, even while HTTP is unavailable.
9921
+ // Do not use the self-update reload path: that path intentionally bypasses the leave guard.
9922
+ if (!window.flolessLeaveGuard) { location.reload(); return; } // native beforeunload fallback
9923
+ const returnFocus = lastFocusBeforeOverlay;
9924
+ if (await window.flolessLeaveGuard.confirm({ action: 'refresh', returnFocus })) location.reload();
9925
+ else if (offlineOverlayEl) {
9926
+ // A renewed outage may have replaced the button that opened this question.
9927
+ // Cancel returns to the current recovery card; a later recovery returns to the view.
9928
+ lastFocusBeforeOverlay = returnFocus;
9929
+ (offlineOverlayEl.querySelector('#so-refresh:not([hidden])') || offlineOverlayEl.querySelector('.so-card')).focus();
9930
+ }
9931
+ });
9932
+ window.addEventListener('keydown', trapOfflineOverlayKeys, true);
9837
9933
  // No action is required, so move focus to the CARD (tabindex=-1), NOT the link —
9838
9934
  // keeps keyboard focus inside the overlay without implying the link is the action.
9839
- wrap.querySelector('.so-card').focus();
9935
+ if (!document.getElementById('leave-guard-modal')?.classList.contains('show')) wrap.querySelector('.so-card').focus();
9840
9936
  // Reveal the manual fallback only if recovery is clearly stuck (watchdog down).
9841
9937
  if (escalateTimer) clearTimeout(escalateTimer);
9842
9938
  escalateTimer = setTimeout(() => {
9843
9939
  if (serverOnline === true) return; // healed
9844
9940
  const s = document.getElementById('so-status');
9845
9941
  const a = document.getElementById('so-start');
9846
- if (s) s.textContent = 'Taking longer than usual — try the button below, or reopen FloLess to bring it back.';
9942
+ if (s) s.textContent = 'This is taking longer than usual. You can refresh this page, or start FloLess if it is closed.';
9943
+ const refresh = document.getElementById('so-refresh');
9944
+ if (refresh) refresh.hidden = false;
9847
9945
  if (a) a.hidden = false;
9848
9946
  }, ESCALATE_MS);
9849
9947
  }
9850
9948
  function hideOfflineOverlay() {
9851
9949
  if (escalateTimer) { clearTimeout(escalateTimer); escalateTimer = null; }
9852
9950
  if (!offlineOverlayEl) return;
9951
+ const restoreFocus = offlineOverlayEl.contains(document.activeElement);
9952
+ window.removeEventListener('keydown', trapOfflineOverlayKeys, true);
9853
9953
  offlineOverlayEl.remove();
9854
9954
  offlineOverlayEl = null;
9855
9955
  // Return focus to wherever it was before the overlay grabbed it.
9856
- if (lastFocusBeforeOverlay && document.contains(lastFocusBeforeOverlay)) {
9956
+ if (restoreFocus && lastFocusBeforeOverlay && document.contains(lastFocusBeforeOverlay)) {
9857
9957
  try { lastFocusBeforeOverlay.focus(); } catch { /* element gone */ }
9858
9958
  }
9859
9959
  lastFocusBeforeOverlay = null;
@@ -10399,6 +10499,23 @@
10399
10499
  background:transparent;border:1px solid var(--border,#1e293b);color:var(--text-dim,#94a3b8);
10400
10500
  padding:7px 16px;border-radius:7px;text-decoration:none;display:inline-block;}
10401
10501
  #server-offline-overlay .secondary:hover{border-color:var(--accent,#3b82f6);color:var(--text,#f8fafc);}
10502
+ #server-offline-overlay .secondary:focus-visible{outline:2px solid var(--accent,#3b82f6);outline-offset:3px;}
10503
+ #server-offline-overlay .so-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;}
10504
+ #server-offline-overlay .so-card{box-sizing:border-box;width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;
10505
+ scrollbar-width:thin;scrollbar-color:var(--text-dim,#94a3b8) transparent;}
10506
+ #server-offline-overlay .so-card::-webkit-scrollbar{width:8px;}
10507
+ #server-offline-overlay .so-card::-webkit-scrollbar-thumb{background:var(--text-dim,#94a3b8);border-radius:8px;}
10508
+ #server-offline-overlay .so-card::-webkit-scrollbar-track{background:transparent;}
10509
+ /* The question may outlive reconnection, above a preserved generic confirmation. */
10510
+ #leave-guard-modal{z-index:100002;}
10511
+ body:has(#server-offline-overlay) #command-sheet{z-index:100004;}
10512
+ body:has(#server-offline-overlay) .app.has-instructor #instructor{position:fixed;inset:auto 0 0;z-index:100003;}
10513
+ body:has(#server-offline-overlay) .app.has-instructor #instructor:not(.collapsed){height:auto;max-height:140px;overflow:auto;white-space:normal;}
10514
+ body:has(#server-offline-overlay) .app.has-instructor #instructor .ix-parts{white-space:normal;overflow-wrap:anywhere;}
10515
+ body:has(#server-offline-overlay) .app.has-instructor #instructor{scrollbar-width:thin;scrollbar-color:var(--text-dim,#94a3b8) transparent;}
10516
+ body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar{width:8px;}
10517
+ body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar-thumb{background:var(--text-dim,#94a3b8);border-radius:8px;}
10518
+ body:has(#server-offline-overlay) .app.has-instructor #instructor::-webkit-scrollbar-track{background:transparent;}
10402
10519
  /* display:inline-block (for padding) would beat the UA [hidden] rule — keep the
10403
10520
  link hidden until escalation with an ID+attribute rule that wins on specificity. */
10404
10521
  #server-offline-overlay .secondary[hidden]{display:none;}
@@ -10516,9 +10633,11 @@
10516
10633
  try { await healthTick(); } finally { healthInFlight = false; }
10517
10634
  };
10518
10635
  const healthTick = async () => {
10636
+ const observationEpoch = serverObservationEpoch;
10519
10637
  let ok = false;
10520
10638
  try {
10521
10639
  const h = await readHealth();
10640
+ if (observationEpoch !== serverObservationEpoch) return;
10522
10641
  ok = true;
10523
10642
  if (ok) {
10524
10643
  // Stamp the build + AWARE runtime versions into the footer once (so a
@@ -10591,7 +10710,7 @@
10591
10710
  }
10592
10711
  }
10593
10712
  } catch { ok = false; }
10594
- setServerStatus(ok);
10713
+ if (observationEpoch === serverObservationEpoch) setServerStatus(ok);
10595
10714
  };
10596
10715
  tick();
10597
10716
  setInterval(tick, 5000);
@@ -10668,6 +10787,7 @@
10668
10787
  // One unfinished reconnect may resume after an existing dialog refresh or root selection.
10669
10788
  window.addEventListener('floless:workspace-root-state', drainPendingCatchup);
10670
10789
  es.onopen = () => {
10790
+ serverObservationEpoch++;
10671
10791
  const reconnect = everOpened || rootDisconnected;
10672
10792
  everOpened = true;
10673
10793
  rootDisconnected = false;
@@ -11034,6 +11154,9 @@
11034
11154
  }
11035
11155
  };
11036
11156
  es.onerror = () => {
11157
+ serverObservationEpoch++;
11158
+ // A later health poll must not borrow a pre-disconnect shared startup probe.
11159
+ globalThis.flolessStartupAdmission?.invalidate();
11037
11160
  connectionGeneration++;
11038
11161
  pendingCatchup = null;
11039
11162
  rootDisconnected = true;
@@ -19461,6 +19584,12 @@
19461
19584
 
19462
19585
  window.flolessBridge = {
19463
19586
  api,
19587
+ async reviewWorkflowUpdate(appId) {
19588
+ await refreshWorkflowUpdates();
19589
+ const offer = wfUpdateFor(appId);
19590
+ if (!offer) throw new Error('No bundled workflow update is currently available. Ask AI Chat to review the workflow requirements.');
19591
+ openWfUpdateModal(offer);
19592
+ },
19464
19593
  /** #2046: the ≡ menu's New workflow, opened from a Guide suggestion with its name filled in. */
19465
19594
  newWorkflow: (prefill) => requestNewWorkflow(prefill),
19466
19595
  // #2185: a Guide card's Build it — straight to its own conversation, no dialog.
@@ -274,8 +274,8 @@
274
274
  const line = el('div', 'ai-chat-ask-other-line');
275
275
  const input = control('input', key('other-input'), question.header || 'your answer', 'ai-chat-ask-other-input');
276
276
  input.type = 'text'; input.autocomplete = 'off'; input.maxLength = 1000; input.spellcheck = true;
277
- input.placeholder = 'Type your answer';
278
- input.setAttribute('aria-label', `Your own answer to: ${question.question}`);
277
+ input.placeholder = question.otherPlaceholder || 'Type your answer';
278
+ input.setAttribute('aria-label', question.otherInputLabel || `Your own answer to: ${question.question}`);
279
279
  input.value = row.other;
280
280
  if (busy) input.readOnly = true;
281
281
  block(input, busy);
@@ -297,7 +297,11 @@
297
297
  draft.cursor = 0;
298
298
  opts.repaint();
299
299
  });
300
- line.append(input);
300
+ if (question.otherInputLabel) {
301
+ const label = el('label', 'ai-chat-ask-other-field');
302
+ label.append(el('span', 'ai-chat-ask-desc', question.otherInputLabel), input);
303
+ line.append(label);
304
+ } else line.append(input);
301
305
  if (files && !opts.source) {
302
306
  const clip = control('button', key('attach'), question.header || 'your answer', 'ai-chat-answer-clip ai-chat-ask-clip');
303
307
  clip.setAttribute('aria-label', 'Attach a screenshot or PDF to your answer');
package/dist/web/chat.css CHANGED
@@ -957,6 +957,13 @@
957
957
  .ai-chat-answer-picture button.ai-chat-answer-open:hover { background: transparent; color: var(--accent); }
958
958
  .ai-chat-answer-missing { color: var(--text-dim); font: 9px/1.25 var(--ui); }
959
959
  .ai-chat-answered-source { padding-left: calc(1em + 6px); }
960
+ .ai-chat-answered-source .ai-chat-answer-lead { white-space: pre-wrap; }
961
+ .ai-chat-inherited-clarification { white-space: pre-wrap; overflow-wrap: anywhere; }
962
+ .ai-chat-answer-clarification .ai-chat-answer-note { min-height: 80px; height: auto; resize: vertical; max-height: 40vh; font: 11px/1.5 var(--ui); white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: var(--text-dim) var(--surface-2); }
963
+ .ai-chat-answer-clarification .ai-chat-answer-note::-webkit-scrollbar { width: 8px; height: 8px; }
964
+ .ai-chat-answer-clarification .ai-chat-answer-note::-webkit-scrollbar-track { background: var(--surface-2); }
965
+ .ai-chat-answer-clarification .ai-chat-answer-note::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 4px; }
966
+ .ai-chat-ask-other-field { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
960
967
  .ai-chat-answer-source button.ai-chat-answer-picture-only { align-self: flex-start; }
961
968
 
962
969
  /* #1906 — the read setup card: three stacked sections in ONE scroller, header and footer outside it. */
@@ -1044,6 +1051,7 @@
1044
1051
  /* The page is laid on paper in a frame shaped like the crop; the picture inside is positioned so only the crop shows. */
1045
1052
  .ai-chat-evidence-frame { position: relative; overflow: hidden; width: 100%; margin: 8px auto 0; border: 1px solid var(--border-strong); border-radius: 4px; background: #fff; }
1046
1053
  .ai-chat-evidence-frame:empty { min-height: 160px; }
1054
+ .ai-chat-evidence-viewer .ai-chat-evidence-frame[aria-busy="true"] { background: var(--surface-2); cursor: progress; }
1047
1055
  /* #2777: the drawing can be zoomed and moved, so it says so to the pointer and keeps a visible focus ring. */
1048
1056
  .ai-chat-evidence-viewer .ai-chat-evidence-frame { cursor: grab; touch-action: none; user-select: none; }
1049
1057
  .ai-chat-evidence-viewer .ai-chat-evidence-frame.dragging { cursor: grabbing; }
@@ -1270,6 +1278,17 @@
1270
1278
  .ai-chat-fold.is-open .ai-chat-fold-chevron { transform: rotate(90deg); }
1271
1279
  .ai-chat-fold-body { display: flex; flex-direction: column; gap: 5px; align-self: stretch; margin: 2px 0 2px 3px; padding-left: 10px; border-left: 1px solid var(--border); }
1272
1280
  .ai-chat-fold-body[hidden] { display: none; }
1281
+ /* Auto approval is a passive receipt. Its technical record is available without filling the feed. */
1282
+ .ai-chat-auto-review-receipt { align-self: stretch; }
1283
+ .ai-chat-auto-review-receipt .ai-chat-fold-toggle { width: 100%; white-space: nowrap; overflow-wrap: normal; overflow: hidden; }
1284
+ .ai-chat-auto-review-receipt .ai-chat-fold-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1285
+ .ai-chat-auto-review-record { box-sizing: border-box; width: 100%; max-height: 240px; min-width: 0; margin: 0; padding: 8px;
1286
+ background: var(--surface-2); color: var(--text-muted); border-radius: 4px; font: 11px/1.5 var(--mono);
1287
+ white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--text-dim) transparent; }
1288
+ .ai-chat-auto-review-record::-webkit-scrollbar { width: 8px; height: 8px; }
1289
+ .ai-chat-auto-review-record::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 8px; }
1290
+ .ai-chat-auto-review-record::-webkit-scrollbar-track { background: transparent; }
1291
+ .ai-chat-auto-review-record:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
1273
1292
  [data-theme="light"] .ai-chat-fold-toggle, [data-theme="light"] .ai-chat-fold-chevron { color: #475569; }
1274
1293
  [data-theme="light"] .ai-chat-fold-toggle:hover { color: var(--text); }
1275
1294
  @media (prefers-reduced-motion: reduce) { .ai-chat-fold-chevron { transition: none; } }
@@ -1280,12 +1299,14 @@
1280
1299
  box-sizing: border-box;
1281
1300
  height: 22px;
1282
1301
  min-height: 22px;
1283
- gap: 0;
1302
+ gap: 6px;
1284
1303
  max-width: 92%;
1285
1304
  margin: -2px 0 0;
1286
1305
  padding: 0;
1287
1306
  }
1288
- .ai-chat-live-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1307
+ .ai-chat-live-status { min-width: 0; color: var(--text-muted); font: 12px/1.4 var(--ui); }
1308
+ .ai-chat-live-status > canvas { flex: none; }
1309
+ .ai-chat-live-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1289
1310
  .ai-chat-live-dots { display: inline-flex; gap: 3px; }
1290
1311
  .ai-chat-live-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: ai-chat-dot 1.1s ease-in-out infinite; }
1291
1312
  .ai-chat-live-dots i:nth-child(2) { animation-delay: .16s; }