@floless/app 0.142.0 → 0.143.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/app.js CHANGED
@@ -1657,7 +1657,7 @@ function userSafeToastMessage(msg, type) {
1657
1657
  return text || 'We couldn’t finish that. Your work is still here. Try again.';
1658
1658
  }
1659
1659
 
1660
- function showToast(msg, type) {
1660
+ function showToast(msg, type, options) {
1661
1661
  const c = document.getElementById('toast-container');
1662
1662
  const t = document.createElement('div');
1663
1663
  t.className = `toast ${type || 'info'}`;
@@ -1680,9 +1680,10 @@ function showToast(msg, type) {
1680
1680
  t.style.transform = 'translateY(8px)';
1681
1681
  setTimeout(() => t.remove(), 300);
1682
1682
  };
1683
- // Errors stay until dismissed (they carry an action to read); warnings linger
1684
- // longer; info/ok auto-dismiss. warn/err get an × so they can be closed early.
1685
- const ms = { ok: 2500, info: 2500, warn: 5000, err: 0, progress: 0 }[type] ?? 2500;
1683
+ // Errors stay until dismissed; most warnings linger longer than confirmations.
1684
+ // A warning carrying the only next step may opt into persistence while keeping
1685
+ // warn styling. warn/err get an × so they can always be closed early.
1686
+ const ms = options?.persistent ? 0 : ({ ok: 2500, info: 2500, warn: 5000, err: 0, progress: 0 }[type] ?? 2500);
1686
1687
  if (type === 'warn' || type === 'err') {
1687
1688
  const x = document.createElement('button');
1688
1689
  x.className = 'toast-close';
package/dist/web/aware.js CHANGED
@@ -9205,7 +9205,8 @@
9205
9205
  // person on the row's Copy. Only a tweak is refused this way, and a tweak never opens the
9206
9206
  // request-queued modal.
9207
9207
  if (code === 'needs-screenshots' && typeof err.body.error === 'string') {
9208
- showToast(err.body.error, 'warn');
9208
+ dismissScreenshotRefusal(req.id);
9209
+ screenshotRefusalDismissals.set(req.id, showToast(err.body.error, 'warn', { persistent: true }));
9209
9210
  focusRequestContinuation(req.id);
9210
9211
  return null;
9211
9212
  }
@@ -9656,6 +9657,19 @@
9656
9657
  }
9657
9658
 
9658
9659
  let pendingRequests = [];
9660
+ const screenshotRefusalDismissals = new Map();
9661
+ function dismissScreenshotRefusal(requestId) {
9662
+ const dismiss = screenshotRefusalDismissals.get(requestId);
9663
+ if (!dismiss) return;
9664
+ screenshotRefusalDismissals.delete(requestId);
9665
+ dismiss();
9666
+ }
9667
+ function dismissRefusalsWithoutRows(list) {
9668
+ const visibleIds = new Set(Array.from(list.querySelectorAll('.req-item'), (row) => row.dataset.id));
9669
+ for (const requestId of screenshotRefusalDismissals.keys()) {
9670
+ if (!visibleIds.has(requestId)) dismissScreenshotRefusal(requestId);
9671
+ }
9672
+ }
9659
9673
  // The Workspaces project the Requests window scopes to, pushed by workspaces.js's applyMode()
9660
9674
  // (null in Workflows mode, or on the Workspaces landing). Non-null ⇒ Workspaces with a project
9661
9675
  // open, which is why activeRequestScope() can pick between the two modes from this alone.
@@ -10611,6 +10625,7 @@
10611
10625
  ? `No request matches “${escapeHtml(normalizedRequestQuery)}”.${!requestScopeAll && inScope.length < pendingRequests.length ? ' Try All to search everything.' : ''}`
10612
10626
  : `Nothing queued for ${escapeHtml(scope ? scope.label : 'this')} — ${pendingRequests.length} item${pendingRequests.length === 1 ? '' : 's'} waiting elsewhere. <button type="button" class="req-showall">Show all</button>`;
10613
10627
  paintRequestList($list, `<div class="empty-state">${msg}</div>`, normalizedRequestQuery);
10628
+ dismissRefusalsWithoutRows($list);
10614
10629
  const $showAll = $list.querySelector('.req-showall');
10615
10630
  if ($showAll) $showAll.onclick = () => setRequestScopeAll(true);
10616
10631
  return;
@@ -10737,6 +10752,7 @@
10737
10752
  </div>`;
10738
10753
  }).join('');
10739
10754
  paintRequestList($list, queuedHtml, normalizedRequestQuery);
10755
+ dismissRefusalsWithoutRows($list);
10740
10756
  const paintOwner = $list.__requestPaintOwner;
10741
10757
  $list.querySelectorAll('[data-request-chat]').forEach((button) => {
10742
10758
  button.onclick = async () => {
@@ -10822,6 +10838,7 @@
10822
10838
  });
10823
10839
  $list.querySelectorAll('.req-copy').forEach((b) => {
10824
10840
  b.onclick = async () => {
10841
+ dismissScreenshotRefusal(b.dataset.id);
10825
10842
  const r = pendingRequests.find((x) => x.id === b.dataset.id);
10826
10843
  if (!r) return;
10827
10844
  const modal = document.getElementById('requests-modal');
package/dist/web/chat.css CHANGED
@@ -765,6 +765,8 @@
765
765
  .ai-chat-event strong { color: var(--text); font-weight: 500; }
766
766
  .ai-chat-event.error { border-color: color-mix(in srgb, var(--err) 42%, var(--border)); color: var(--err); }
767
767
  .ai-chat-event.knowledge { border-color: color-mix(in srgb, var(--accent) 36%, var(--border)); }
768
+ /* The chat model's object links (#1653): a quiet receipt under its answer. */
769
+ .ai-chat-event.links { border-color: color-mix(in srgb, var(--accent) 24%, var(--border)); }
768
770
  .ai-chat-live-status {
769
771
  align-self: flex-start;
770
772
  display: inline-flex;
package/dist/web/chat.js CHANGED
@@ -44,6 +44,8 @@
44
44
  // The last sentence report() put under the box, held there until the person acts on it (#1683):
45
45
  // { message, scope, chatId, draft, attachments, blocked }. See heldReport().
46
46
  reportHold: null,
47
+ // Only this exact report announcement may be removed when its composer reason ends (#1704).
48
+ reportLiveMessage: null,
47
49
  // A Tekla model library carried over from a Graft receipt but not yet bound to its chat. It is
48
50
  // browser-only until Send: opening, editing or removing it never calls the binding route.
49
51
  // pendingTeklaLibrary waits for the provider chooser to create the chat it belongs to.
@@ -127,9 +129,9 @@
127
129
  return body;
128
130
  }
129
131
 
130
- function announce(message) {
132
+ function announce(message, stillCurrent = () => true) {
131
133
  ui.status.textContent = '';
132
- requestAnimationFrame(() => { ui.status.textContent = message; });
134
+ requestAnimationFrame(() => { if (stillCurrent()) ui.status.textContent = message; });
133
135
  }
134
136
 
135
137
  function setBusy(busy) {
@@ -345,7 +347,8 @@
345
347
  || error?.name === 'TypeError' || error?.name === 'SyntaxError';
346
348
  if (unexpected) console.error(`[ai-chat] ${message}`, error?.cause ?? '', error);
347
349
  else if (status !== null) console.warn(`[ai-chat] ${message}`, error);
348
- announce(message);
350
+ state.reportLiveMessage = message;
351
+ announce(message, () => state.reportLiveMessage === message);
349
352
  ui.hint.textContent = message;
350
353
  ui.hint.classList.add('error');
351
354
  holdReport(message);
@@ -461,6 +464,16 @@
461
464
  // Painted as it was reported, so the poll does not restyle it.
462
465
  if (filterNote && message === filterNote) ui.hint.classList.add('error');
463
466
  }
467
+ // The refusal no longer describes the composer. Only remove that exact announcement:
468
+ // a response may have since claimed the same live region (#1704).
469
+ if (state.reportLiveMessage && ui.hint.textContent !== state.reportLiveMessage) {
470
+ retireReportAnnouncement();
471
+ }
472
+ }
473
+
474
+ function retireReportAnnouncement() {
475
+ if (ui.status.textContent === state.reportLiveMessage) ui.status.textContent = '';
476
+ state.reportLiveMessage = null;
464
477
  }
465
478
 
466
479
  function scopeKey(scope) {
@@ -1818,6 +1831,15 @@
1818
1831
  compaction: 'Conversation summary updated', 'knowledge-citation': 'Knowledge cited', state: 'Status', request: 'Request',
1819
1832
  };
1820
1833
  const payload = event.payload || {};
1834
+ if (event.type === 'chat-subjects') {
1835
+ // The chat model linked Steel objects to this question (#1653). Its note is untrusted text: textContent only.
1836
+ item.classList.add('links');
1837
+ const count = Array.isArray(payload.items) ? payload.items.length : 0;
1838
+ label.textContent = payload.role === 'answer' ? 'Named in answer' : 'Linked objects';
1839
+ const note = typeof payload.aiNote === 'string' ? payload.aiNote : '';
1840
+ item.append(label, document.createTextNode(` · ${count} object${count === 1 ? '' : 's'}${note ? ` · AI note: ${note}` : ''}`));
1841
+ return item;
1842
+ }
1821
1843
  label.textContent = event.type === 'error' && payload.outcome === 'not-sent' ? 'Not sent' : labels[event.type] || event.type;
1822
1844
  let detail = event.type === 'error' ? errorMessage(payloadText(event)) : payloadText(event);
1823
1845
  if (!detail && event.type === 'tool') {
@@ -2107,13 +2129,18 @@
2107
2129
  ui.feed.append(emptyFeedNotice());
2108
2130
  } else {
2109
2131
  let assistant = null;
2132
+ // The chat model's object links (#1653) are written while it answers. They wait until the turn's answer
2133
+ // has been shown and follow it, so an answer is never split by one or pushed below its own receipts.
2134
+ let links = [];
2110
2135
  const flushAssistant = () => {
2111
2136
  if (!assistant) return;
2112
2137
  const rendered = renderedLiveAssistantText(assistant.event, assistant.text);
2113
2138
  ui.feed.append(renderMessage(assistant.event, 'assistant', rendered.text, rendered.streaming));
2114
2139
  assistant = null;
2115
2140
  };
2141
+ const flushLinks = () => { if (links.length) { ui.feed.append(...links.map((link) => link.node)); links = []; } };
2116
2142
  for (const event of state.events) {
2143
+ if (links.length && event.turnId !== links[0].turnId) { flushAssistant(); flushLinks(); }
2117
2144
  if (event.type === 'assistant-message' && event.payload?.delta) {
2118
2145
  // Codex keeps a stable item id while Claude's SDK may assign one per stream packet.
2119
2146
  // Consecutive deltas in the same turn are one visible answer; a tool or other event
@@ -2130,11 +2157,13 @@
2130
2157
  // Provider tools commonly split one answer into before/after chunks. They are not prose,
2131
2158
  // so keep collecting same-turn deltas across them instead of rendering abandoned fragments.
2132
2159
  if (['tool', 'usage', 'knowledge-citation', 'attachment', 'compaction', 'state'].includes(event.type)) continue;
2160
+ if (event.type === 'chat-subjects') { links.push({ turnId: event.turnId, node: renderEvent(event) }); continue; }
2133
2161
  flushAssistant();
2134
2162
  const node = renderEvent(event);
2135
2163
  if (node) ui.feed.append(node);
2136
2164
  }
2137
2165
  flushAssistant();
2166
+ flushLinks();
2138
2167
  // A provider can send text before it finishes tools, usage, or its terminal turn signal.
2139
2168
  // Keep this fixed activity row visible for the full durable turn so an intermittent stream
2140
2169
  // never looks like a failed response. Recovery deliberately has no live indicator.
@@ -2936,6 +2965,8 @@
2936
2965
  }
2937
2966
  if (state.events.some((item) => item.eventId === event.eventId)) return;
2938
2967
  state.events.push(event);
2968
+ // The chat model linked objects during this answer: an open Steel card reads its links again (#1653).
2969
+ if (event.type === 'chat-subjects') subjectLinksSaved(event.payload);
2939
2970
  state.events.sort((a, b) => a.sequence - b.sequence);
2940
2971
  state.chat.lastEventSequence = Math.max(state.chat.lastEventSequence || 0, event.sequence || 0);
2941
2972
  const listChat = state.chats.find((item) => item.chatId === chatId);
@@ -3246,10 +3277,13 @@
3246
3277
  closeSource(); closePicker();
3247
3278
  clearProviderChoice();
3248
3279
  const scopeChanged = scopeKey(scope) !== scopeKey(state.scope);
3280
+ // The new project's history may take time to load. Its old project's refusal is already false.
3281
+ if (scopeChanged) retireReportAnnouncement();
3249
3282
  state.scope = scope;
3250
3283
  state.scopeInitialized = true;
3251
3284
  if (scopeChanged) { try { window.flolessLeftPane?.chatLinksChanged?.(); } catch { /* the card refreshes on its next read */ } }
3252
3285
  state.chat = null; state.chats = []; state.archivedChats = []; state.unreadableChats = []; state.events = []; state.capability = null; state.desktop = null; state.attachments = []; state.integrations = null;
3286
+ if (scopeChanged) clearReport();
3253
3287
  // A published filter answer still lands in its own project's conversation; reopening it resumes.
3254
3288
  for (const entry of state.filterPending.values()) clearTimeout(entry.timer);
3255
3289
  state.filterPending.clear(); state.filterNotices.clear(); state.filterCardMessages.clear();
@@ -2228,9 +2228,9 @@
2228
2228
  def('steel.registration-detail', { label: 'Registration details', actsOn: 'Shows the exact reason this sheet’s registration was refused, naming the contract fields to change', group: 'On the steel canvas', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The plain-English warning is for you; this is the sentence your terminal AI needs.' });
2229
2229
  def('steel.registration-copy', { label: 'Copy reason', actsOn: 'Copies the exact registration refusal to the clipboard', group: 'On the steel canvas', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This sheet cannot be corrected in the editor — paste the reason to your terminal AI and ask it to fix the registration.' });
2230
2230
  def('steel.review-select', { label: 'Select this connection', actsOn: 'Selects {instance} from the review list', group: 'In the review list', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A watched connection selects the members it watches; an unwatched one opens the 3D view and selects the connection itself.' });
2231
- def('steel.chat-question-show', { label: 'Show in chat', actsOn: 'Opens AI Chat at the question “{instance}”', anyInstance: 'a question asked about this object', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Questions asked in AI Chat with objects selected stay linked to those objects.' });
2231
+ def('steel.chat-question-show', { label: 'Show in chat', actsOn: 'Opens AI Chat at the question “{instance}”', anyInstance: 'a question asked about this object', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A question stays linked to the objects selected when it was asked, and to the objects the AI’s answer named.' });
2232
2232
  def('steel.chat-questions-more', { label: 'Show more questions', actsOn: 'Shows the older questions asked in AI Chat about the selection', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
2233
- def('steel.chat-questions-orphans', { label: 'Questions about objects no longer in the model', actsOn: 'Shows AI Chat questions about objects this model no longer has, with the name each had when asked', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A question is never moved to another object, even one with the same name.' });
2233
+ def('steel.chat-questions-orphans', { label: 'Questions about objects not in the model', actsOn: 'Shows AI Chat questions about objects this model does not have now, with the name each was linked under', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'A question is never moved to another object, even one with the same name.' });
2234
2234
  def('steel.chat-questions-retry', { label: 'Retry loading questions', actsOn: 'Reads the questions asked in AI Chat about this project again', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
2235
2235
  def('steel.connection-part-back', { label: 'Back to connection', actsOn: 'Selects the whole connection that owns this part', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
2236
2236
  def('steel.connection-part-edit', { label: 'Edit on parent member', actsOn: 'Selects the member that owns this connection part', group: 'In the Properties panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
@@ -17,6 +17,26 @@ export function rankFilterControls(controls, instruction, focusedControl) {
17
17
  return [...controls].sort((a, b) => score(b) - score(a));
18
18
  }
19
19
 
20
+ /**
21
+ * How much of the view the answering AI is told about.
22
+ *
23
+ * These were 10 facts and a 500-character text budget — a few dozen short strings out of a sheet
24
+ * with thousands of elements — and the answer then carried a line telling the model not to claim a
25
+ * complete audit, which was true and unhelpful in equal measure. The numbers were never measured
26
+ * against a model's capacity; they were a cautious guess made when this path had no other evidence
27
+ * and could not afford to be wrong.
28
+ *
29
+ * It has other evidence now: the sheet itself is attached as a picture, so these facts are the
30
+ * CONTROLS and the drawing carries the rest. That makes a wider fact list cheap and a narrow one
31
+ * pointlessly lossy, so the budgets are raised to where a real sheet fits.
32
+ */
33
+ const MAX_FACTS = 200;
34
+ const MAX_FACT_CHARS = 1_000;
35
+ // Under the server's MAX_FACT_CHARS (20,000), not equal to it: a fact of exactly the limit passes
36
+ // by one character, and the next word added to the prefix would tip every message into a refusal
37
+ // nobody can see. Margin on purpose.
38
+ const MAX_SAMPLE_CHARS = 18_000;
39
+
20
40
  export function readOnlyFilterContext(snapshot, instruction, scope) {
21
41
  const facts = [
22
42
  scope,
@@ -27,24 +47,33 @@ export function readOnlyFilterContext(snapshot, instruction, scope) {
27
47
  for (const row of controls) {
28
48
  const entry = row.dimension+':'+JSON.stringify(row.label)+' '+(row.checked?'on':'off')+' ('+row.count+')'
29
49
  +(row.notRead ? ' not read by FloLess and cannot be changed here' : '');
30
- if (part && part.length + entry.length + 2 > 500) {
50
+ if (part && part.length + entry.length + 2 > MAX_FACT_CHARS) {
31
51
  facts.push(part); part = '';
32
52
  }
33
- if (facts.length >= 10) break;
53
+ if (facts.length >= MAX_FACTS) break;
34
54
  part += (part ? '; ' : '') + entry;
35
55
  represented++;
36
56
  }
37
- if (part && facts.length < 10) facts.push(part);
57
+ if (part && facts.length < MAX_FACTS) facts.push(part);
38
58
  const samples = snapshot.sheetTextSamples || [];
39
- let sampleCount = 0, sampleFact = 'Text examples, not a complete read: ';
59
+ let sampleCount = 0, sampleFact = 'Text on this sheet: ';
40
60
  for (const row of samples) {
41
61
  const entry = JSON.stringify(row.text)+' on '+JSON.stringify(row.layer)+' '+(row.selected?'selected':'excluded');
42
- if (sampleFact.length + entry.length + 2 > 500) break;
62
+ if (sampleFact.length + entry.length + 2 > MAX_SAMPLE_CHARS) break;
43
63
  sampleFact += (sampleCount ? '; ' : '') + entry;
44
64
  sampleCount++;
45
65
  }
46
66
  if (sampleCount) facts.push(sampleFact);
47
- facts.push('Partial drawing view: '+represented+' of '+(snapshot.controlTotal ?? controls.length)+' controls and '+sampleCount+' of '+(snapshot.textTotal ?? samples.length)+' text items are listed. More drawing content may exist. Do not claim a complete audit.');
67
+ const allControls = represented >= (snapshot.controlTotal ?? controls.length);
68
+ const allText = sampleCount >= (snapshot.textTotal ?? samples.length);
69
+ // Still honest about what is listed, but no longer an instruction to hedge: when the sheet itself
70
+ // is attached, the drawing is the evidence and these facts are the controls beside it. Telling the
71
+ // model to distrust a complete list is how a question with a real answer got a cautious non-answer.
72
+ facts.push('Controls listed: '+represented+' of '+(snapshot.controlTotal ?? controls.length)
73
+ +'. Text items listed: '+sampleCount+' of '+(snapshot.textTotal ?? samples.length)+'.'
74
+ + (allControls && allText
75
+ ? ' That is everything this view holds.'
76
+ : ' Some of this view is not listed here; if the answer depends on what is missing, say so and say what to open.'));
48
77
  return { subject:instruction, commandId:'filter.ask-ai-question', surface:'steel-filter', tone:'idle', facts };
49
78
  }
50
79
 
@@ -17,15 +17,51 @@ export function filterAiTouchesUnreadLayer(proposal, filter) {
17
17
  && blocked.has(facetKey('layer', item.value)));
18
18
  }
19
19
 
20
+ /**
21
+ * How long an answer may be.
22
+ *
23
+ * This was 500 characters, and it REJECTED rather than truncated — an answer one character over was
24
+ * thrown away whole and the person saw a failure. 500 is about four sentences, which is fine for
25
+ * “turn that layer off” and useless for the questions this surface is actually asked. Measured
26
+ * 2026-09-28: asked to list the elevation callouts on one sheet, the model returned a correct and
27
+ * well-organised answer of roughly 1,200 characters, which the old cap would have discarded.
28
+ *
29
+ * The outer 8,000-character bound on the whole JSON document is the real backstop and is unchanged;
30
+ * this one now sits under it with room for a real answer rather than in front of it.
31
+ */
32
+ export const MAX_FILTER_EXPLANATION = 6_000;
33
+
20
34
  /** Reject malformed or contradictory suggestions before any surface presents them. */
21
35
  export function parseFilterAiProposalShape(answer) {
22
- if (typeof answer !== 'string' || answer.length > 8_000) throw new Error('AI returned a suggestion that is too large. Ask about fewer layers.');
36
+ if (typeof answer !== 'string' || answer.length > 32_000) throw new Error('AI returned a suggestion that is too large. Ask about fewer layers.');
23
37
  let value;
24
- try { value = JSON.parse(answer); }
25
- catch { throw new Error('AI did not return a usable selection. Ask it to try again.'); }
38
+ // A model that wraps the envelope in a ```json fence produced the envelope; the fence is packaging,
39
+ // not a different answer, so unwrap it before deciding anything.
40
+ const unfenced = /^```(?:json)?\s*\n([\s\S]*?)\n?```$/i.exec(answer.trim())?.[1] ?? answer;
41
+ try { value = JSON.parse(unfenced); }
42
+ catch {
43
+ // PROSE IS AN ANSWER. The envelope exists so a SELECTION CHANGE can be audited rather than
44
+ // parsed out of a sentence — it was never meant to be the price of admission for an answer that
45
+ // proposes no change. A correct, complete reply that happened to arrive as plain text was being
46
+ // thrown away and shown as "AI's answer could not be shown", which is the worst of both: the
47
+ // work was done, the person paid for it, and they got nothing. Seen in a real browser with an
48
+ // answer that named nine elevations correctly.
49
+ //
50
+ // Accepted as an explanation with NO changes, which is exactly what it is: nothing here can
51
+ // propose a tick, so nothing can be applied by accident.
52
+ // But a FAILED ENVELOPE is not prose. Text opening with `{` or `[` was trying to be the envelope
53
+ // and did not finish — truncated, or malformed. Its debris may be a half-written list of CHANGES,
54
+ // and showing that as an answer would present machine wreckage as a reply and hide the fact that
55
+ // a change was proposed and lost. Only text that never attempted the envelope is prose.
56
+ const text = unfenced.trim();
57
+ if (!text || text.startsWith('{') || text.startsWith('[')) {
58
+ throw new Error('AI did not return a usable selection. Ask it to try again.');
59
+ }
60
+ return { explanation: text.slice(0, MAX_FILTER_EXPLANATION), changes: [], mode: null };
61
+ }
26
62
  if (!value || Array.isArray(value) || typeof value !== 'object'
27
63
  || Object.keys(value).sort().join(',') !== 'changes,explanation,mode'
28
- || typeof value.explanation !== 'string' || !value.explanation.trim() || value.explanation.length > 500
64
+ || typeof value.explanation !== 'string' || !value.explanation.trim() || value.explanation.length > MAX_FILTER_EXPLANATION
29
65
  || !Array.isArray(value.changes) || value.changes.length > 30
30
66
  || (value.mode !== null && (typeof value.mode !== 'string'
31
67
  || !value.mode || value.mode !== canonicalMode(value.mode.split('+'))))) {
@@ -426,7 +426,6 @@
426
426
  binding must never eat a literal "?" the user meant to type. */
427
427
 
428
428
  var lastHovered = null;
429
- var lastHoveredAt = 0;
430
429
  var lastHoveredOrder = 0;
431
430
  var lastFocused = null;
432
431
  var lastFocusedOrder = 0;
@@ -445,10 +444,13 @@
445
444
 
446
445
  function recordHoverIntent(e) {
447
446
  lastHovered = e && e.target;
448
- lastHoveredAt = Date.now();
449
447
  lastHoveredOrder = ++intentOrder;
450
448
  }
451
449
 
450
+ function clearHoverIntent() {
451
+ lastHovered = null;
452
+ }
453
+
452
454
  function recordFocusIntent(e) {
453
455
  lastFocused = e && e.target;
454
456
  lastFocusedOrder = ++intentOrder;
@@ -462,6 +464,7 @@
462
464
  if (!doc || typeof doc.addEventListener !== 'function' || remembersIntentDocument(doc)) return;
463
465
  rememberIntentDocument(doc);
464
466
  doc.addEventListener('mouseover', recordHoverIntent, true);
467
+ doc.addEventListener('mouseleave', clearHoverIntent, true);
465
468
  doc.addEventListener('focusin', recordFocusIntent, true);
466
469
  }
467
470
 
@@ -488,9 +491,9 @@
488
491
  • Hover-first would explain whatever the mouse was last parked over,
489
492
  which is meaningless for someone tabbing through with the keyboard.
490
493
 
491
- The rule: a RECENT pointer movement means the user is pointing at what they
492
- mean; otherwise they are navigating by keyboard and focus wins. */
493
- var HOVER_INTENT_MS = 3000;
494
+ The last intent wins. A pointer that remains over a control does not become
495
+ irrelevant after an arbitrary timeout; leaving the document or moving focus
496
+ by keyboard retires that pointer intent. */
494
497
 
495
498
  /* A model editor's panel tabs are its own controls, moved into the main window's #left-model-panel frame
496
499
  (web/model-panel-bridge.js): a third document, searched after the editor's own. */
@@ -530,18 +533,18 @@
530
533
  var hasActive = active && active !== document.body;
531
534
  /* A control can disappear while the pointer remains parked at its old coordinates. The revision
532
535
  result does exactly that: Apply is hidden, then focus moves to Close. Treating the hidden Apply
533
- as fresh pointer intent makes `?` narrate an action that is no longer on screen. The same goes for
536
+ as pointer intent makes `?` narrate an action that is no longer on screen. The same goes for
534
537
  one a full-window overlay has since covered (#1445): it keeps its layout but is inert. */
535
538
  var hoveredIsRendered = lastHovered && lastHovered.isConnected && isOnScreen(lastHovered);
536
- var pointerIsFresh = hoveredIsRendered && (Date.now() - lastHoveredAt) < HOVER_INTENT_MS;
539
+ var pointerIntent = hoveredIsRendered;
537
540
  var focusedOrder = lastFocused === active ? lastFocusedOrder : 0;
538
541
 
539
- var el = hasActive ? active : (pointerIsFresh ? lastHovered : null);
542
+ var el = hasActive ? active : (pointerIntent ? lastHovered : null);
540
543
  /* Most recent intentional target wins. This keeps pointer-over-another-control
541
- useful, but a later Tab/Shift+Tab transition must beat the still-fresh hover
544
+ useful, but a later Tab/Shift+Tab transition must beat the earlier hover
542
545
  left by a prior click. Programmatic focus in the browser emits focusin too,
543
546
  so replacements that restore focus participate in the same ordering. */
544
- if (pointerIsFresh && lastHovered !== active && focusFor(lastHovered)
547
+ if (pointerIntent && lastHovered !== active && focusFor(lastHovered)
545
548
  && (!hasActive || !focusedOrder || lastHoveredOrder > focusedOrder)) {
546
549
  el = lastHovered;
547
550
  }
@@ -1451,7 +1454,6 @@
1451
1454
  // control elsewhere remains the user's valid pointer intent after a keyboard close.
1452
1455
  if (lastHovered && lastHovered.closest && lastHovered.closest('#command-sheet')) {
1453
1456
  lastHovered = null;
1454
- lastHoveredAt = 0;
1455
1457
  }
1456
1458
  setBackgroundInert(false);
1457
1459
  if (coveredDialogAriaBefore) {
@@ -891,7 +891,8 @@
891
891
  .chat-q{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;align-items:center;padding:6px 0;border-bottom:1px solid var(--line)}
892
892
  .chat-q:last-child{border-bottom:0}
893
893
  .chat-q-note{grid-column:1;font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
894
- .chat-q-meta,.chat-q-about{grid-column:1;font-size:10.5px;color:var(--mut);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
894
+ .chat-q-meta,.chat-q-about,.chat-q-ai{grid-column:1;font-size:10.5px;color:var(--mut);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
895
+ .chat-q-ai{font-style:italic}
895
896
  .chat-q-show{grid-column:2;grid-row:1/span 3;align-self:center}
896
897
  .chat-q-more>summary,.chat-q-orphans>summary{cursor:pointer;font-size:11px;color:var(--mut);padding:4px 0;list-style-position:inside}
897
898
  .chat-q-more>summary:hover,.chat-q-orphans>summary:hover{color:var(--text)}
@@ -14116,7 +14117,7 @@ function canonicalTargetItems(ids){
14116
14117
  function subjectLabelText(text){return [...String(text||'').replace(/[\u0000-\u001f\u007f]+/g,' ').replace(/\s+/g,' ').trim()].slice(0,120).join('').trimEnd();}
14117
14118
  function subjectLabel(item){
14118
14119
  if(item.kind==='member'){const m=(C.members||[]).find(x=>x&&x.id===item.id);return m?((m.mark||m.id)+(m.profile?' · '+m.profile:'')):item.id;}
14119
- if(item.kind==='joint'){const r=connRowById(item.id);return r?connLabel(r):('Connection '+item.id);}
14120
+ if(item.kind==='joint')return 'Connection '+item.id; // a placed joint (C.joints), never a connection-library row
14120
14121
  const d=(C.detail_placements||[]).find(x=>x&&x.id===item.id);return 'Detail '+((d&&d.detailName)||item.id);
14121
14122
  }
14122
14123
  // 64-bit FNV-1a over the WHOLE canonical list, so a pill left out for one selection returns for another even
@@ -14168,16 +14169,27 @@ function refreshChatLinks(force){
14168
14169
  }
14169
14170
  function chatSubjectResolves(link){
14170
14171
  if(link.kind==='member')return (C.members||[]).some(m=>m&&m.id===link.id);
14171
- if(link.kind==='joint')return (C.connections||[]).some(r=>r&&r.id===link.id)||Object.values(partsById||{}).some(part=>part&&part.conn===link.id);
14172
+ if(link.kind==='joint')return (C.joints||[]).some(j=>j&&j.id===link.id); // the model, never the 3D part cache, which can outlive a removed joint
14172
14173
  if(link.kind==='detail')return (C.detail_placements||[]).some(d=>d&&d.id===link.id);
14173
14174
  return false;
14174
14175
  }
14175
14176
  function chatQuestionDate(iso){const d=new Date(iso);return Number.isNaN(d.getTime())?'':d.toLocaleDateString(undefined,{day:'numeric',month:'short',year:'numeric'});}
14176
- // One row per question: the links of one message collapse into it, naming the objects it was about.
14177
+ // One row per question: the links of one message collapse into it, naming the objects it was about. A link is
14178
+ // the person's selection, the chat model's note on it, or its answer naming the object (#1653). What a row says
14179
+ // never depends on which link arrived first: every link of a question carries the same question line and time,
14180
+ // the newest note wins, and "named in the answer" is a fact of the set.
14177
14181
  function chatQuestionRows(links){
14178
14182
  const byMessage=new Map();
14179
- for(const link of links){const row=byMessage.get(link.messageEventId)||{link,labels:[]};row.labels.push(link.label||link.id);byMessage.set(link.messageEventId,row);}
14180
- return [...byMessage.values()].sort((a,b)=>String(b.link.createdAt).localeCompare(String(a.link.createdAt)));
14183
+ for(const link of links){
14184
+ let row=byMessage.get(link.messageEventId);
14185
+ if(!row){row={link,labels:[],seen:new Set(),selected:false,named:false,aiNote:'',aiSeq:-1};byMessage.set(link.messageEventId,row);}
14186
+ const key=link.kind+'\0'+link.id;
14187
+ if(!row.seen.has(key)){row.seen.add(key);row.labels.push(link.label||link.id);}
14188
+ if(link.origin==='ai-answer')row.named=true;else if(link.origin==='ai-note'){if(link.linkSequence>row.aiSeq){row.aiSeq=link.linkSequence;row.aiNote=link.aiNote||'';}}
14189
+ else{if(!row.selected)row.link=link;row.selected=true;} // "When asked" reads the label from when the person asked
14190
+ }
14191
+ const askedAt=row=>String(row.link.askedAt||row.link.createdAt);
14192
+ return [...byMessage.values()].sort((a,b)=>askedAt(b).localeCompare(askedAt(a))||(b.link.sequence-a.link.sequence));
14181
14193
  }
14182
14194
  // The id is all a link knows of its object, and a reader may give a removed member's id to a new one. So a row
14183
14195
  // whose object is named differently now says what it was called when asked, rather than quietly vouching for it.
@@ -14189,15 +14201,20 @@ function chatQuestionWas(row){
14189
14201
  function chatQuestionRow(row,{about,unresolved}){
14190
14202
  const link=row.link,li=document.createElement('div');li.className='chat-q';
14191
14203
  const note=document.createElement('div');note.className='chat-q-note';note.textContent=link.note;note.dataset.tip=link.note;
14204
+ li.append(note);
14205
+ // The chat model's own sentence, said to be its own: untrusted text, one line, textContent only.
14206
+ if(row.aiNote){const ai=document.createElement('div');ai.className='chat-q-ai';ai.textContent='AI note: '+row.aiNote;ai.dataset.tip=row.aiNote;li.append(ai);}
14192
14207
  const meta=document.createElement('div');meta.className='chat-q-meta';
14193
- meta.textContent=[link.chatTitle,chatQuestionDate(link.createdAt)].filter(Boolean).join(' · ')+(link.archived?' · archived':'');
14194
- li.append(note,meta);
14208
+ meta.textContent=[link.chatTitle,chatQuestionDate(link.askedAt||link.createdAt)].filter(Boolean).join(' · ')+(link.archived?' · archived':'');
14209
+ li.append(meta);
14210
+ if(row.named){const named=document.createElement('div');named.className='chat-q-about';named.textContent=row.selected?'Also named in the answer':'Named in the answer';li.append(named);}
14195
14211
  if(about){const who=document.createElement('div');who.className='chat-q-about';
14196
14212
  const names=row.labels.slice(0,3);who.textContent=(unresolved?'Was: ':'About ')+names.join(', ')+(row.labels.length>3?' and '+(row.labels.length-3)+' more':'');li.append(who);}
14197
14213
  else{const was=chatQuestionWas(row);if(was){const who=document.createElement('div');who.className='chat-q-about';who.textContent='When asked: '+was;li.append(who);}}
14198
14214
  const show=document.createElement('button');show.type='button';show.className='ghost chat-q-show';show.textContent='Show in chat';
14199
14215
  show.dataset.commandId='steel.chat-question-show#'+link.messageEventId;show.dataset.commandInstanceLabel=link.note;
14200
14216
  show.setAttribute('aria-label','Show in chat: '+link.note);
14217
+ show.style.gridRow='1/span '+li.children.length; // spans every line this row has, and no empty ones
14201
14218
  show.onclick=()=>{if(!modelPanelBridge||!modelPanelBridge.openChat(link.chatId,link.messageEventId,PROJECT))toast('AI Chat is not open for this project. Open the project in Workspaces, then choose Show in chat again.');};
14202
14219
  li.append(show);return li;
14203
14220
  }
@@ -14240,7 +14257,8 @@ function paintChatQuestions(p){
14240
14257
  const det=document.createElement('details');det.className='chat-q-orphans';det.open=chatQuestionsOpen;
14241
14258
  det.addEventListener('toggle',()=>{chatQuestionsOpen=det.open;});
14242
14259
  const sum=document.createElement('summary');sum.dataset.commandId='steel.chat-questions-orphans';
14243
- sum.textContent='Questions about objects no longer in the model ('+atLeast+orphans.length+')';det.append(sum);
14260
+ // Removed, or never there: an answer can name an id the model lacks.
14261
+ sum.textContent='Questions about objects not in the model ('+atLeast+orphans.length+')';det.append(sum);
14244
14262
  chatQuestionList(det,orphans,{about:true,unresolved:true});
14245
14263
  box.append(head,det);p.append(box);
14246
14264
  }
@@ -1044,15 +1044,29 @@ function filterAiChangeContext(instruction){
1044
1044
  let names = '', shown = 0;
1045
1045
  for(const key of unread){
1046
1046
  const next = (names ? names+', ' : '')+JSON.stringify(key);
1047
- if(next.length > 420) break;
1047
+ if(next.length > 4000) break;
1048
1048
  names = next; shown++;
1049
1049
  }
1050
1050
  if(shown) facts.push('Not read by FloLess, so they cannot be changed here: '+names
1051
1051
  +(shown < unread.length ? ' (and '+(unread.length-shown)+' more)' : ''));
1052
1052
  }
1053
+ // THE SHEET'S WORDS, not seven of them.
1054
+ //
1055
+ // This was `slice(0,7)` then `.slice(0,500)`: seven text items, cut at 500 characters, out of a
1056
+ // sheet with dozens. It is the list the AI answers a question about text FROM, and at that size
1057
+ // it mostly answered "I cannot tell from the samples". The sheet itself now travels with the
1058
+ // question as a picture, so this list no longer has to carry the whole burden — but there is also
1059
+ // no reason to ration it, and a wider one is what makes a text question answerable at all.
1053
1060
  const texts = filterAiSnapshot().sheetTextSamples || [];
1054
- if(texts.length) facts.push(('Text samples, incomplete: '+texts.slice(0,7).map(row=>JSON.stringify([row.layer,row.text,row.selected])).join(',')).slice(0,500));
1055
- if(facts.length > 12) throw new Error('This filter has too many values for one AI message. Ask about one specific layer instead.');
1061
+ if(texts.length) facts.push(('Text on this sheet: '+texts.map(row=>JSON.stringify([row.layer,row.text,row.selected])).join(',')).slice(0,18000));
1062
+ // NO REFUSAL ON COUNT. This used to throw above twelve facts and the person got
1063
+ // "This filter has too many values for one AI message. Ask about one specific layer instead." —
1064
+ // a busy sheet could not be asked about at all, which is the opposite of what a busy sheet needs.
1065
+ // The budget is generous and the honest line below says what was listed; nothing is refused for
1066
+ // being large.
1067
+ // Room left for what the server appends (the sheet note, the tiles sentence, one per attached
1068
+ // file). Clamping to exactly the server's 200 meant those pushed it over and the message died.
1069
+ if(facts.length > 150) facts.length = 150;
1056
1070
  return { context:{ subject:instruction, commandId:'filter.ask-ai-change', surface:'steel-filter', tone:'idle', facts }, allowed };
1057
1071
  }
1058
1072
  function filterAiSelectionCopy(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.142.0",
3
+ "version": "0.143.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {