@floless/app 0.160.0 → 0.161.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
@@ -4011,7 +4011,7 @@
4011
4011
  if (m.relabelled === 'live-failed' && typeof m.home === 'string' && typeof m.pageId === 'string') {
4012
4012
  // A failed live session's versions changed label: an open copy of that Page must not keep the old one.
4013
4013
  window.flolessPages?.reloadIfOpen?.(m.home, m.pageId);
4014
- window.flolessPages?.refresh?.();
4014
+ window.flolessPages?.refresh?.(true); // quiet: the open list keeps its rows until the new ones arrive (#2724)
4015
4015
  return;
4016
4016
  }
4017
4017
  if (typeof m.home !== 'string' || typeof m.pageId !== 'string' || !Number.isInteger(m.version) || m.version < 1) {
@@ -4022,7 +4022,7 @@
4022
4022
  workflowPageByRun.set(captureKeyOf(m.runId, m.fireKey) || m.runId, page);
4023
4023
  if (workflowPageByRun.size > WORKFLOW_PAGE_RUNS_KEPT) workflowPageByRun.delete(workflowPageByRun.keys().next().value);
4024
4024
  noteWorkflowPageLatest(m.app, page);
4025
- window.flolessPages?.refresh?.();
4025
+ window.flolessPages?.refresh?.(true); // quiet, as every re-read for a change (#2724)
4026
4026
  if (currentId === m.app) paintReportPageLinks();
4027
4027
  }
4028
4028
 
@@ -5372,7 +5372,9 @@
5372
5372
  // in the viewer overlay + a toast. No console.error — the server returns the
5373
5373
  // failure in-band, so a failed run isn't a console-worthy fault.
5374
5374
  $reportSub.textContent = 'Execution ended without a report.';
5375
- showRunFailure(e.body || {}, runFailureMessage(msg), app);
5375
+ // #2796: Try again only once the server has answered that this run ended. With no answer the run may still be
5376
+ // going on the host, and a second one could do its work twice.
5377
+ showRunFailure(e.body || {}, runFailureMessage(msg), app, opts.debug || liveOutcome === 'no-answer' ? null : () => runReport(nodeId));
5376
5378
  }
5377
5379
  }
5378
5380
  } finally {
@@ -5402,9 +5404,9 @@
5402
5404
 
5403
5405
  // A run that failed for any reason other than Stop or an expired sign-in (#1912, #1851): the
5404
5406
  // plain sentence the server or runFailureMessage produced, the fix when there is one (Compile, for
5405
- // an approval AWARE refused), and Report this problem every time. Reuses the reconnect card's
5407
+ // an approval AWARE refused, or Try again through `runAgain`), and Report this problem every time. Reuses the reconnect card's
5406
5408
  // amber-topped layout; built with textContent only, so nothing the server says becomes markup.
5407
- function showRunFailure(body, message, app) {
5409
+ function showRunFailure(body, message, app, runAgain = null) {
5408
5410
  const code = body && typeof body.code === 'string' ? body.code : '';
5409
5411
  const compileFix = (code === 'agent-version-changed' || code === 'needs-compile') && !$compileBtn.hidden;
5410
5412
  const reinstall = code === 'agent-files-changed';
@@ -5445,6 +5447,22 @@
5445
5447
  compile.onclick = () => { hideModal($reportModal); $compileBtn.click(); };
5446
5448
  actions.append(compile);
5447
5449
  }
5450
+ // #2796: a run that stopped can be run again from here, with the same inputs and every check Run makes, so a card
5451
+ // whose sentence says "try again" offers it. Not where the server says running again cannot help (`retryable:
5452
+ // false`: the account cannot read the model, or FloLess lost its connection to AWARE and a restart comes first), not
5453
+ // where Compile or a reinstall is the fix, and not for a run that never started.
5454
+ if (runAgain && !notRun && !compileFix && !reinstall && body.retryable !== false) {
5455
+ const retry = mkEl('button', 'primary cred-reconnect run-fail-retry', 'Try again');
5456
+ retry.type = 'button';
5457
+ retry.dataset.commandId = 'shell.run-failure-retry';
5458
+ // One run per click, however fast the clicks. A run that starts replaces this card; one that does not (an inputs
5459
+ // prompt or a confirmation the person cancelled) leaves it, so Try again works again.
5460
+ retry.onclick = async () => {
5461
+ retry.disabled = true;
5462
+ try { await runAgain(); } finally { if (retry.isConnected) retry.disabled = false; }
5463
+ };
5464
+ actions.append(retry);
5465
+ }
5448
5466
  const report = mkEl('button', 'cred-open-integrations run-fail-report', 'Report this problem');
5449
5467
  report.type = 'button';
5450
5468
  report.dataset.commandId = 'shell.run-failure-report';
@@ -5879,6 +5897,7 @@
5879
5897
  else if (f.commandId === 'shell.requests-runtime') commandCarrier = ' data-command-id="shell.requests-runtime"';
5880
5898
  else if (f.commandId === 'shell.new-workflow-location') commandCarrier = ' data-command-id="shell.new-workflow-location"';
5881
5899
  else if (f.commandId === 'workflow.select-model-revision') commandCarrier = ' data-command-id="workflow.select-model-revision"';
5900
+ else if (f.commandId === 'shell.render-caption-choice') commandCarrier = ' data-command-id="shell.render-caption-choice"';
5882
5901
  let optionIndex = 0;
5883
5902
  const optionRow = (o) => `<div id="${id}-option-${optionIndex++}" class="wf-option${isOn(o) && !o.unavailable ? ' selected' : ''}${o.volatile ? ' volatile' : ''}${o.unavailable ? ' is-unavailable' : ''}" role="option" data-id="${escapeAttr(String(o.value))}" data-trigger-label="${escapeAttr(o.triggerLabel || '')}"${o.unavailable ? ` aria-disabled="true" data-blocked-reason="${escapeAttr(String(o.unavailable))}" data-tip="${escapeAttr(String(o.unavailable))}"` : ''}${commandCarrier}${commandCarrier ? ` data-command-instance="${escapeAttr(String(o.value))}" data-command-instance-label="${escapeAttr(String(o.label))}"` : ''} data-search="${escapeAttr(String(o.search || o.label).toLowerCase())}" tabindex="-1" aria-label="${escapeAttr(o.ariaLabel || o.label)}" aria-selected="${isOn(o) ? 'true' : 'false'}"><span class="wf-option-name">${escapeHtml(o.label)}</span>${o.meta ? `<span class="wf-option-meta">${escapeHtml(o.meta)}</span>` : ''}</div>`;
5884
5903
  const grouped = opts.some((o) => o.group);
@@ -6863,6 +6882,9 @@
6863
6882
  $compileBtn.disabled = false;
6864
6883
  const ask = globalThis.flolessStepRename ? globalThis.flolessStepRename.askOf(e) : null;
6865
6884
  if (ask) { await renameStepThenCompile(id, ask); return; }
6885
+ // #2740: in the Compile slot, so a second refusal replaces the first and a later clean compile clears it.
6886
+ const refused = compileRefusalText(e);
6887
+ if (refused) { standingToast('compile', authoredToastCopy(refused), 'warn'); return; }
6866
6888
  reportErr(e);
6867
6889
  }
6868
6890
  }
@@ -8021,11 +8043,14 @@
8021
8043
  let content;
8022
8044
  try { content = await file.text(); } catch { showToast('Could not read that file', 'err'); return; }
8023
8045
  try {
8024
- const { id } = await api('/api/import', { method: 'POST', body: JSON.stringify({ filename: file.name, content }) });
8025
- await loadApps();
8026
- $promptSel.value = id;
8027
- $promptSel.dispatchEvent(new Event('change', { bubbles: true })); // → loadApp(id), arms Compile
8028
- showToast(`Imported "${id}" — Compile to run`, 'ok');
8046
+ // #2742: the file is kept as a Standalone draft (not installed under its app: id, which no list showed), so it
8047
+ // opens as a draft with Compile, and Compile publishes it into the picker like any workflow built in AI Chat.
8048
+ const { workflow } = await api('/api/import', { method: 'POST', body: JSON.stringify({ filename: file.name, content }) });
8049
+ try { await loadApps({ preserveSelection: true }); } catch { /* the draft is still on the Workflows page after the next refresh */ }
8050
+ const opened = openDraftWorkflow(workflow.workflowId);
8051
+ showToast(opened
8052
+ ? `Imported "${workflow.displayName}" as a draft — Compile to add it to your picker`
8053
+ : `Imported "${workflow.displayName}" as a draft — find it under Standalone on the Workflows page, then Compile it to add it to your picker`, 'ok');
8029
8054
  } catch (e) {
8030
8055
  const body = e && e.body;
8031
8056
  const reason = body && typeof body.reason === 'string' ? body.reason.trim() : '';
@@ -8037,12 +8062,14 @@
8037
8062
  openImportFailedModal(reason, Array.isArray(body.agentsUnavailable) ? body.agentsUnavailable : [], file);
8038
8063
  return;
8039
8064
  }
8040
- showToast(body && body.code === 'exists'
8041
- ? 'A workflow with that name already exists. Choose a different name, then try again.'
8042
- // #2470: the server's sentence names the General project id and a name to use instead.
8043
- : body && body.code === 'reserved-id' && typeof body.error === 'string' && body.error
8044
- ? `${body.error} Change the app: line in the file, then import it again.`
8045
- : 'We couldn’t import that workflow because FloLess could not read it. Check the file, then try again.', 'err');
8065
+ // A file FloLess could not read is a 400. The Workspace refusing to keep it (no Workspace folder, a folder it
8066
+ // cannot write) is labelled by the server, whose sentence names why. Anything else is unconfirmed: it may have been kept.
8067
+ showToast(body && body.stage === 'workspace' && typeof body.error === 'string' && body.error
8068
+ ? `We couldn’t save that workflow to your Workspace: ${body.error.replace(/[.\s]+$/, '')}. Try again.`
8069
+ // Only a 400 is a verdict on the file; a lost response (no status) may follow a kept draft.
8070
+ : e && e.status === 400
8071
+ ? 'We couldn’t import that workflow because FloLess could not read it. Check the file, then try again.'
8072
+ : 'FloLess couldn’t confirm the import just now. Check Standalone on the Workflows page before you try again.', 'err');
8046
8073
  }
8047
8074
  } finally {
8048
8075
  _importing = false; // every path, including an unreadable file and the dialog's early return
@@ -11059,6 +11086,11 @@
11059
11086
  return text;
11060
11087
  }
11061
11088
 
11089
+ /** #2740: the sentence the server wrote from AWARE's reason when it refused to compile a workflow, or ''. */
11090
+ function compileRefusalText(e) {
11091
+ return e?.body?.ok === false && e.body.code === 'workflow-compile-refused' && typeof e.body.userMessage === 'string' ? e.body.userMessage.trim() : '';
11092
+ }
11093
+
11062
11094
  function reportErr(e) {
11063
11095
  if (awarePageUnloading && e instanceof TypeError && e.message === 'Failed to fetch') return;
11064
11096
  console.error(e);
@@ -11073,6 +11105,13 @@
11073
11105
  showToast(owned, 'warn');
11074
11106
  return;
11075
11107
  }
11108
+ // #2740: AWARE refused to compile the workflow and said why (a pin mismatch names both versions). Retrying cannot fix
11109
+ // that, so the person reads AWARE's reason and the choices, and it stays until they close it.
11110
+ const refused = compileRefusalText(e);
11111
+ if (refused) {
11112
+ showToast(authoredToastCopy(refused), 'warn', { persistent: true });
11113
+ return;
11114
+ }
11076
11115
  showToast('We couldn’t finish that. Your work is still here. Try again. If it keeps happening, reopen FloLess.', 'err');
11077
11116
  }
11078
11117
 
@@ -17980,17 +18019,76 @@
17980
18019
  done.focus();
17981
18020
  }
17982
18021
 
18022
+ // #2786: how a browser sign-in ended, in the words the sign-in screen and the report dialog both use.
18023
+ const SIGN_IN_ENDED = {
18024
+ refused: "FloLess didn't receive this sign-in from floless.io, so you're still signed out. Click Try again to start a new sign-in.",
18025
+ expired: "This sign-in expired before it was finished, so you're still signed out. Click Try again to start a new sign-in.",
18026
+ unconfirmed: "FloLess couldn't confirm that the sign-in started. If no sign-in page opened, click Try again.",
18027
+ stopped: "FloLess is no longer waiting for this sign-in, so you're still signed out. Click Try again to start a new sign-in.",
18028
+ };
18029
+ const SIGN_IN_STARTING = 'FloLess is starting the sign-in with floless.io. Wait a moment.';
18030
+
18031
+ // #2786: what a sign-in watcher does with one /api/license/status read (null when it could not be read).
18032
+ // `view.waiting`: the watcher's screen says it is waiting for a sign-in it started. `view.shown`: the sign-in
18033
+ // (by session id) whose ending is already on screen, so each ending shows once and a retry's ending always does.
18034
+ // `view.doneOnly`: only a finished sign-in counts, not a licence that was already valid. Pure, so
18035
+ // desktop-login.test.ts runs it.
18036
+ function signInWatchStep(st, view) {
18037
+ if (!st) return { act: 'again' };
18038
+ if (!view.doneOnly && (st.state === 'valid' || st.state === 'offline-grace')) return { act: 'signed-in' };
18039
+ const latest = st.signIn || null;
18040
+ if (latest && latest.state === 'waiting') return { act: 'again' };
18041
+ if (latest && latest.state === 'done') return { act: view.waiting ? 'signed-in' : 'idle' };
18042
+ if (latest && latest.sessionId !== view.shown) return { act: 'ended', ended: latest.state, shown: latest.sessionId };
18043
+ if (!latest && view.waiting) return { act: 'ended', ended: 'stopped', shown: null };
18044
+ return { act: 'idle' };
18045
+ }
18046
+
17983
18047
  function riRenderSignIn() {
17984
18048
  const sub = document.createElement('div');
17985
18049
  sub.className = 'modal-sub';
18050
+ sub.setAttribute('role', 'status');
17986
18051
  sub.textContent = 'Sign in to send a report — your session has expired.';
17987
18052
  const actions = document.createElement('div');
17988
18053
  actions.className = 'modal-actions';
17989
18054
  const close = riButton('ri-signin-close', 'Close', false, () => riClose());
18055
+ // #2786: the dialog stays open while the sign-in runs. It gives the report back once signed in, and says how
18056
+ // a sign-in that did not finish ended; the button then tries again.
18057
+ const showing = () => sub.isConnected && $riModal.classList.contains('show');
18058
+ const view = { waiting: false, shown: null, doneOnly: true }; // the report service, not the licence, asked for this
18059
+ const ended = (message) => { view.waiting = false; sub.textContent = message; signin.hidden = false; signin.textContent = 'Try again'; signin.focus(); };
18060
+ const watch = async () => {
18061
+ if (!showing() || !view.waiting) return;
18062
+ let st; try { st = await api('/api/license/status'); } catch { st = null; }
18063
+ if (!showing() || !view.waiting) return;
18064
+ const step = signInWatchStep(st, view);
18065
+ if (step.act === 'signed-in') {
18066
+ view.waiting = false;
18067
+ $riState.hidden = true; $riForm.hidden = false;
18068
+ $riSend.textContent = 'Send report'; // the send that was turned away left its "Sending…" label
18069
+ riSyncSend(); $riSend.focus();
18070
+ return;
18071
+ }
18072
+ if (step.act === 'ended') { view.shown = step.shown; ended(SIGN_IN_ENDED[step.ended]); return; }
18073
+ if (step.act === 'again') setTimeout(watch, 2000);
18074
+ };
17990
18075
  const signin = riButton('ri-signin-btn', 'Sign in', true, async () => {
17991
- try { await api('/api/license/start', { method: 'POST' }); } catch { /* surfaced via license polling */ }
17992
- riClose();
18076
+ view.waiting = false;
18077
+ signin.disabled = true;
18078
+ signin.setAttribute('data-blocked-reason', SIGN_IN_STARTING);
18079
+ sub.textContent = SIGN_IN_STARTING;
18080
+ let failed = null;
18081
+ try { await api('/api/license/start', { method: 'POST' }); }
18082
+ catch (e) { failed = e?.body?.code === 'sign-in-could-not-start' ? e.body.error : SIGN_IN_ENDED.unconfirmed; }
18083
+ signin.disabled = false;
18084
+ signin.removeAttribute('data-blocked-reason');
18085
+ if (failed) { ended(failed); return; }
18086
+ sub.textContent = 'Finish signing in in your browser. This dialog shows your report again once you are signed in.';
18087
+ signin.hidden = true;
18088
+ view.waiting = true;
18089
+ watch();
17993
18090
  });
18091
+ signin.setAttribute('data-command-id', 'shell.issue-sign-in');
17994
18092
  actions.append(close, signin);
17995
18093
  riShowState(sub, actions);
17996
18094
  }
@@ -18599,7 +18697,8 @@
18599
18697
  #license-gate .primary{appearance:none;border:none;cursor:pointer;font-size:14px;font-weight:600;
18600
18698
  padding:11px 22px;border-radius:8px;background:var(--accent,#3b82f6);color:#fff;}
18601
18699
  #license-gate .primary:hover{filter:brightness(1.08);}
18602
- #license-gate .lg-status{min-height:18px;margin:14px 0 0;font-size:12.5px;color:var(--text-dim,#94a3b8);}
18700
+ #license-gate .primary:disabled{opacity:.6;cursor:default;filter:none;}
18701
+ #license-gate .lg-status{min-height:18px;margin:14px 0 0;font-size:12.5px;color:var(--text-muted,#9aa5b6);}
18603
18702
  #license-gate .lg-sub{display:inline-block;margin-top:6px;font-size:12.5px;color:var(--accent,#3b82f6);text-decoration:none;}
18604
18703
  #license-gate .lg-sub:hover{text-decoration:underline;}
18605
18704
  #license-gate .lg-version{margin:18px 0 0;font-size:11px;font-family:var(--mono,monospace);color:var(--text-muted,#9aa5b6);}`;
@@ -18621,8 +18720,8 @@
18621
18720
  </svg></div>
18622
18721
  <h1>${escapeHtml(copy.headline)}</h1>
18623
18722
  <p>${escapeHtml(copy.body)}</p>
18624
- <button id="lg-signin" class="primary">Sign in at floless.io</button>
18625
- <p class="lg-status" id="lg-status"></p>
18723
+ <button id="lg-signin" class="primary" data-command-id="shell.license-sign-in" aria-describedby="lg-status">Sign in at floless.io</button>
18724
+ <p class="lg-status" id="lg-status" role="status"></p>
18626
18725
  ${copy.secondary ? `<a class="lg-sub" href="${copy.secondary.href}" target="_blank" rel="noopener">${escapeHtml(copy.secondary.label)}</a>` : ''}
18627
18726
  <p class="lg-version" id="lg-version"></p>
18628
18727
  </div>`;
@@ -18633,20 +18732,41 @@
18633
18732
  readHealth()
18634
18733
  .then((h) => { if (h && h.appVersion) document.getElementById('lg-version').textContent = 'FloLess ' + h.appVersion; })
18635
18734
  .catch(() => { /* version is a nicety; never block the gate on it */ });
18636
- document.getElementById('lg-signin').onclick = async () => {
18637
- const s = document.getElementById('lg-status');
18735
+ const signIn = document.getElementById('lg-signin');
18736
+ const s = document.getElementById('lg-status');
18737
+ // A sign-in that cannot go on says why, and the same button starts a fresh one.
18738
+ // #2786: one watcher, while a sign-in is under way. It reloads once FloLess is signed in, and says how the latest
18739
+ // sign-in ended wherever it was started (here, the report dialog, AI Chat or `floless login`), once per sign-in.
18740
+ const view = { waiting: false, shown: null, doneOnly: false };
18741
+ const stop = (message) => { view.waiting = false; s.textContent = message; signIn.textContent = 'Try again'; };
18742
+ let generation = 0;
18743
+ const watch = async (g = ++generation) => {
18744
+ let st; try { st = await api('/api/license/status'); } catch { st = null; }
18745
+ if (g !== generation) return; // a click or a newer watch took over
18746
+ const step = signInWatchStep(st, view);
18747
+ if (step.act === 'signed-in') { location.reload(); return; }
18748
+ if (step.act === 'ended') { view.shown = step.shown; stop(SIGN_IN_ENDED[step.ended]); return; }
18749
+ if (step.act === 'again') setTimeout(() => watch(g), 2000);
18750
+ };
18751
+ signIn.onclick = async () => {
18752
+ generation += 1; // an older watch stops here, so it cannot write over this sign-in while it registers
18753
+ view.waiting = false;
18638
18754
  s.textContent = 'Opening sign-in in your browser…';
18639
- try { await api('/api/license/start', { method: 'POST' }); } catch { /* ignore */ }
18755
+ signIn.textContent = 'Sign in at floless.io';
18756
+ // Starting registers the sign-in with floless.io first, so it can take a moment: one start at a time.
18757
+ signIn.disabled = true;
18758
+ signIn.setAttribute('data-blocked-reason', SIGN_IN_STARTING);
18759
+ let failed = null;
18760
+ try { await api('/api/license/start', { method: 'POST' }); }
18761
+ catch (e) { failed = e?.body?.code === 'sign-in-could-not-start' ? e.body.error : SIGN_IN_ENDED.unconfirmed; }
18762
+ signIn.disabled = false;
18763
+ signIn.removeAttribute('data-blocked-reason');
18764
+ if (failed) { stop(failed); signIn.focus(); watch(); return; } // still follow a sign-in already under way
18765
+ view.waiting = true;
18640
18766
  s.textContent = 'Waiting for sign-in to complete…';
18641
- const deadline = Date.now() + 185000;
18642
- const tick = async () => {
18643
- let st; try { st = await api('/api/license/status'); } catch { st = {}; }
18644
- if (st.state === 'valid' || st.state === 'offline-grace') { location.reload(); return; }
18645
- if (Date.now() > deadline) { s.textContent = 'Timed out — click to try again.'; return; }
18646
- setTimeout(tick, 2000);
18647
- };
18648
- tick();
18767
+ watch();
18649
18768
  };
18769
+ watch(); // a sign-in started before this screen showed (or one that already ended) is said here too
18650
18770
  }
18651
18771
 
18652
18772
  // ── Custom Panels bridge (web/panels.js) ─────────────────────────────────────
@@ -419,6 +419,9 @@
419
419
  if (question.layout === 'grid') list.classList.add('ai-chat-ask-grid');
420
420
  card.append(head, text);
421
421
  for (const context of question.context || []) card.append(el('p', 'ai-chat-filter-note ai-chat-ask-context', context));
422
+ // #2777: a picture of what the question is about (the height card's place on the drawings), above the answers.
423
+ // It is told which answer is selected, and the card repaints on every choice, so the picture follows the choice.
424
+ if (typeof question.figure === 'function') { const figure = question.figure(row.choices[0]); if (figure) card.append(figure); }
422
425
  card.append(list);
423
426
  if (selected()?.statement) { const statement = el('p', 'ai-chat-setup-statement ai-chat-ask-statement', selected().statement); statement.setAttribute('role', 'status'); card.append(statement); }
424
427
  if (selected()?.requiresNote) {
package/dist/web/chat.css CHANGED
@@ -887,8 +887,9 @@
887
887
  .ai-chat-height-card[data-state="closed"] { border-left-color: var(--border-strong); }
888
888
  [data-theme="light"] .ai-chat-height-card[data-state="answered"] { --text-muted: #475569; }
889
889
  .ai-chat-height-count { margin: 6px 0 0; color: var(--text-dim); font: 600 9px/1.3 var(--mono); letter-spacing: .04em; }
890
+ /* overflow-anchor: the list's place is kept as its scroll offset (#2770); anchoring would move it while AI Chat opens narrow. */
890
891
  .ai-chat-height-rows { display: flex; flex-direction: column; gap: 6px; max-height: min(320px, 50vh); margin: 6px 0 0; padding: 0 2px 0 0; overflow-y: auto; list-style: none;
891
- scrollbar-width: thin; scrollbar-color: var(--text-dim) var(--surface-2); }
892
+ overflow-anchor: none; scrollbar-width: thin; scrollbar-color: var(--text-dim) var(--surface-2); }
892
893
  .ai-chat-height-rows::-webkit-scrollbar { width: 8px; }
893
894
  .ai-chat-height-rows::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--text-dim); }
894
895
  .ai-chat-height-rows::-webkit-scrollbar-track { background: var(--surface-2); }
@@ -1043,7 +1044,49 @@
1043
1044
  /* The page is laid on paper in a frame shaped like the crop; the picture inside is positioned so only the crop shows. */
1044
1045
  .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; }
1045
1046
  .ai-chat-evidence-frame:empty { min-height: 160px; }
1047
+ /* #2777: the drawing can be zoomed and moved, so it says so to the pointer and keeps a visible focus ring. */
1048
+ .ai-chat-evidence-viewer .ai-chat-evidence-frame { cursor: grab; touch-action: none; user-select: none; }
1049
+ .ai-chat-evidence-viewer .ai-chat-evidence-frame.dragging { cursor: grabbing; }
1050
+ .ai-chat-evidence-viewer .ai-chat-evidence-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
1051
+ .ai-chat-evidence-viewer .ai-chat-evidence-frame img { pointer-events: none; }
1052
+ .ai-chat-evidence-zoom { display: flex; gap: 0; }
1053
+ .ai-chat-evidence-viewer .ai-chat-evidence-zoom button { min-width: 30px; padding: 6px 9px; border-radius: 0; font-weight: 600; }
1054
+ .ai-chat-evidence-viewer .ai-chat-evidence-zoom button:first-child { border-radius: 5px 0 0 5px; }
1055
+ .ai-chat-evidence-viewer .ai-chat-evidence-zoom button:last-child { border-radius: 0 5px 5px 0; border-left-width: 0; }
1056
+ .ai-chat-evidence-viewer .ai-chat-evidence-zoom button:disabled { color: var(--text-dim); cursor: default; }
1046
1057
  .ai-chat-evidence-viewer .ai-chat-evidence-frame img { position: absolute; max-width: none; height: auto; margin: 0; border: 0; border-radius: 0; }
1058
+ /* #2777: where on the drawings a height question means. The picture is the button: the same paper-on-frame as the viewer,
1059
+ held short (110px) so the answers stay in sight, with a plain caption saying what opens and who drew the outline. */
1060
+ .ai-chat-drawing-step button.ai-chat-height-place { appearance: none; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; margin: 6px 0 2px; padding: 6px;
1061
+ border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text); font: 10.5px/1.4 var(--ui); text-align: left; cursor: pointer; }
1062
+ .ai-chat-drawing-step button.ai-chat-height-place:hover { background: var(--surface-2); border-color: var(--border-strong); }
1063
+ .ai-chat-drawing-step button.ai-chat-height-place:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
1064
+ .ai-chat-height-place-frame { position: relative; display: block; overflow: hidden; max-height: 110px; border: 1px solid var(--border-strong); border-radius: 4px; background: #fff; }
1065
+ .ai-chat-height-place-frame[data-state="loading"] { background: var(--surface-2); }
1066
+ .ai-chat-height-place-frame[data-state="error"] { display: flex; align-items: center; justify-content: center; min-height: 48px; background: var(--surface-2); }
1067
+ .ai-chat-height-place-frame img { position: absolute; max-width: none; height: auto; margin: 0; border: 0; border-radius: 0; }
1068
+ .ai-chat-height-place-missing { padding: 6px 8px; color: var(--text-dim); font: 10px/1.4 var(--ui); text-align: center; }
1069
+ .ai-chat-height-place-caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; color: var(--text-muted); }
1070
+ .ai-chat-height-place-caption strong { color: var(--text); font-weight: 600; }
1071
+ .ai-chat-height-unplaced, .ai-chat-height-unproposed { color: var(--text-dim); }
1072
+ /* A row's sheet in the card's list: a small outlined mono tag at the row's end, no picture. */
1073
+ .ai-chat-height-card button.ai-chat-height-sheet, .ai-chat-drawing-step button.ai-chat-height-sheet, .ai-chat-place-strip button.ai-chat-height-sheet { appearance: none; flex: none; margin-left: auto; padding: 0 5px; min-height: 18px; border: 1px solid var(--border); border-radius: 3px;
1074
+ background: transparent; color: var(--accent); font: 600 9.5px/1.6 var(--mono); cursor: pointer; }
1075
+ .ai-chat-height-card button.ai-chat-height-sheet:hover, .ai-chat-drawing-step button.ai-chat-height-sheet:hover, .ai-chat-place-strip button.ai-chat-height-sheet:hover { background: var(--surface-2); border-color: var(--border-strong); }
1076
+ .ai-chat-height-card button.ai-chat-height-sheet:focus-visible, .ai-chat-drawing-step button.ai-chat-height-sheet:focus-visible, .ai-chat-place-strip button.ai-chat-height-sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
1077
+ /* #2777: a level's other places, beside its picture: chips that wrap, never a scrolling row. */
1078
+ .ai-chat-setup-places { display: flex; flex-direction: column; gap: 4px; }
1079
+ .ai-chat-evidence-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px 0; }
1080
+ .ai-chat-evidence-bar .ai-chat-evidence-views { padding: 0; }
1081
+ /* A sheet with no marked area offers only "Whole sheet": one button, rounded on both sides. */
1082
+ .ai-chat-evidence-viewer .ai-chat-evidence-views button:only-child { border-radius: 5px; border-left-width: 1px; }
1083
+ .ai-chat-evidence-viewer button.ai-chat-evidence-filter { border-radius: 5px; color: var(--text); }
1084
+ .ai-chat-evidence-viewer button.ai-chat-evidence-filter[aria-busy="true"] { cursor: progress; color: var(--text-muted); }
1085
+ /* #2777 slice D: why the Drawing Filter could not show the place, beside the button that was pressed. */
1086
+ .ai-chat-evidence-filter-note { margin: 0; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--border)); border-radius: 4px; background: var(--surface-2); color: var(--text); font: 11px/1.4 var(--ui); }
1087
+ .ai-chat-evidence-filter-note[hidden] { display: none; }
1088
+ .ai-chat-setup-place-chips { display: flex; flex-wrap: wrap; gap: 4px; }
1089
+ .ai-chat-setup-place-chips button.ai-chat-height-sheet { margin-left: 0; }
1047
1090
  .ai-chat-readiness-review { margin: 0; color: var(--text-muted); font: 10.5px/1.4 var(--ui); }
1048
1091
  .ai-chat-readiness-actions { display: flex; flex-wrap: wrap; gap: 5px; }
1049
1092
  .ai-chat-readiness-actions button.ai-chat-source-action { appearance: none; min-height: 22px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 5px;
@@ -1094,6 +1137,14 @@
1094
1137
  .ai-chat-sources { display: flex; flex-direction: column; gap: 5px; padding: 6px 8px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border)); border-radius: 5px; background: color-mix(in srgb, var(--surface-2) 72%, transparent); }
1095
1138
  .ai-chat-sources-head { align-self: flex-start; color: var(--text-dim); font: 9px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
1096
1139
  .ai-chat-sources-list { display: flex; flex-wrap: wrap; gap: 5px; }
1140
+ /* #2777: a place the AI showed on the drawings: its label, then its sheet as the same mono tag the height card uses. */
1141
+ .ai-chat-place-strip button.ai-chat-place-chip { display: inline-flex; align-items: baseline; gap: 6px; width: auto; height: auto; min-height: 20px; max-width: 100%; padding: 2px 7px;
1142
+ border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font: 10.5px/1.3 var(--ui); cursor: pointer; text-align: left; }
1143
+ .ai-chat-place-strip button.ai-chat-place-chip:hover { background: var(--surface-2); border-color: var(--accent); }
1144
+ .ai-chat-place-strip button.ai-chat-place-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
1145
+ .ai-chat-place-strip .ai-chat-place-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1146
+ .ai-chat-place-strip .ai-chat-place-chip .ai-chat-readiness-place-sheet { flex: none; color: var(--accent); font: 600 9.5px/1.3 var(--mono); }
1147
+ .ai-chat-place-strip .ai-chat-height-unplaced { margin: 0; font: 10px/1.4 var(--ui); }
1097
1148
  .ai-chat-source { max-width: 100%; }
1098
1149
  .ai-chat-source.answer-jump { outline: 2px solid var(--accent); outline-offset: 2px; background: var(--accent-soft); }
1099
1150
  .ai-chat-source .ai-chat-source-n { flex: none; min-width: 14px; padding: 0 3px; border: 1px solid var(--border-strong); border-radius: 3px; background: var(--surface-3); color: var(--text); text-align: center; }
@@ -1116,8 +1167,10 @@
1116
1167
  .ai-chat-source-picker { position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border-strong);
1117
1168
  border-radius: 6px; background: var(--surface-2); color: var(--text); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
1118
1169
  .ai-chat-source-picker-head { margin: 0; color: var(--text); font: 600 11px/1.35 var(--ui); }
1119
- .ai-chat-source-picker-projects { display: flex; flex-wrap: wrap; gap: 4px; }
1120
- .ai-chat-source-picker-projects[hidden] { display: none; }
1170
+ .ai-chat-source-picker-projects, .ai-chat-source-picker-kinds { display: flex; flex-wrap: wrap; gap: 4px; }
1171
+ .ai-chat-source-picker-projects[hidden], .ai-chat-source-picker-kinds[hidden] { display: none; }
1172
+ /* #2692: what to choose from — one even row of three; the project row under it is its refinement. */
1173
+ .ai-chat-source-picker-kinds .ai-chat-source-picker-project { flex: 1 1 auto; }
1121
1174
  .ai-chat-source-picker-project { appearance: none; min-height: 22px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 5px;
1122
1175
  background: var(--surface); color: var(--text-muted); font: 10px/1.3 var(--ui); cursor: pointer; }
1123
1176
  .ai-chat-source-picker-project[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }