@floless/app 0.162.0 → 0.163.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.
Files changed (36) hide show
  1. package/dist/floless-server.cjs +11754 -8096
  2. package/dist/schemas/steel.model.v2.schema.json +16 -2
  3. package/dist/skills/floless-app-actions/SKILL.md +54 -3
  4. package/dist/skills/floless-app-onboarding/SKILL.md +2 -2
  5. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
  6. package/dist/skills/floless-app-report-issue/SKILL.md +12 -1
  7. package/dist/skills/floless-app-rfi/SKILL.md +36 -9
  8. package/dist/skills/floless-app-steel-model/SKILL.md +5 -3
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +39 -34
  10. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +10 -6
  11. package/dist/web/agents.js +24 -4
  12. package/dist/web/app.css +45 -7
  13. package/dist/web/app.js +22 -3
  14. package/dist/web/aware.js +157 -43
  15. package/dist/web/chat.css +26 -1
  16. package/dist/web/chat.js +32 -8
  17. package/dist/web/commands-shell.js +190 -4
  18. package/dist/web/commands-steel.js +14 -0
  19. package/dist/web/failure-copy.js +168 -0
  20. package/dist/web/index.html +35 -1
  21. package/dist/web/instructor.js +3 -1
  22. package/dist/web/landing-sort.js +277 -0
  23. package/dist/web/model-editor-steel-adapter.js +3 -0
  24. package/dist/web/model-panel-bridge.js +13 -2
  25. package/dist/web/model-view-query.js +23 -15
  26. package/dist/web/project-access.js +3 -3
  27. package/dist/web/project-rfis.js +250 -7
  28. package/dist/web/project-workflows.js +1 -1
  29. package/dist/web/steel-3d-view.js +8 -1
  30. package/dist/web/steel-editor.html +441 -12
  31. package/dist/web/steel-filter-core.js +2 -0
  32. package/dist/web/steel-filter.html +38 -5
  33. package/dist/web/steel-model-v2-commands.js +3 -1
  34. package/dist/web/steel-profile-colours.js +124 -24
  35. package/dist/web/workspaces.js +243 -38
  36. package/package.json +1 -1
@@ -45,6 +45,23 @@
45
45
  : r?.status === 'ready' ? '' : (r?.message || READINESS_TEXT[r?.status] || 'Gmail sending isn’t available just now.'));
46
46
  const unresolved = (d) => d && (d.status === 'prepared' || d.status === 'outcome-unknown');
47
47
  const HELD = 'Mark sent, Answer and Close are held back until this is settled, so the RFI’s history stays true.';
48
+ /** The ways out of a send FloLess couldn't confirm (#2470 R6.6e): only those the server offers, never preselected. */
49
+ const SETTLE_WAYS = [
50
+ { key: 'try-again', allowed: 'canTryAgain', label: 'Send it again with Gmail', help: 'They may get it twice.', primary: 'Send it again…' },
51
+ { key: 'sent-another-way', allowed: 'canRecordSentAnotherWay', label: 'I sent it another way', help: 'Record it. FloLess sends nothing.', primary: 'Record as sent' },
52
+ { key: 'leave-unconfirmed', allowed: 'canLeaveUnconfirmed', label: 'Leave it unconfirmed', help: 'Free the RFI without saying it was sent.', primary: 'Leave unconfirmed' },
53
+ ];
54
+ const LEAVE_TEXT = 'FloLess won’t finish or send this, and can’t say whether Gmail already did. The RFI is free again, and its history will show this send as not confirmed.';
55
+ const SETTLED_WORDS = { 'try-again': 'sent again with Gmail', 'sent-another-way': 'sent another way', 'left-unconfirmed': 'left unconfirmed' };
56
+ // What became of the new send of a Try again: said only as far as FloLess knows it (a refused one reached nobody).
57
+ const resendWords = (status) => !status || status === 'recorded' || status === 'confirmed-sent' ? ''
58
+ : status === 'failed' ? ' · Gmail didn’t receive the new send' : ' · the new send isn’t confirmed either';
59
+ // Refusals that mean the list on screen is out of date: the form closes and the list is read again.
60
+ const SETTLE_OUT_OF_DATE = new Set(['rfi-delivery-terminal', 'rfi-delivery-stale', 'rfi-revision-stale', 'rfi-delivery-evidence-present', 'rfi-delivery-not-found']);
61
+ const HOW_MAX = 120;
62
+ /** A send that holds this RFI, live or from before it changed, by its attempt id. */
63
+ const heldAttempt = (rfi, attemptId) => (rfi?.holdingDeliveries || []).find((h) => h.attemptId === attemptId)
64
+ || (rfi?.delivery?.attemptId === attemptId && unresolved(rfi.delivery) ? rfi.delivery : null);
48
65
 
49
66
  function ago(iso, now = Date.now()) {
50
67
  const t = Date.parse(iso);
@@ -171,6 +188,51 @@
171
188
  aria-label="${esc(`Send ${rfi.id} with Gmail`)}"${held}>${form.uncertain ? 'Try again' : form.busy ? 'Sending…' : 'Send email'}</button>
172
189
  </div></div>`;
173
190
  }
191
+ case 'settle': {
192
+ const held = heldAttempt(rfi, form.attemptId);
193
+ if (!held) return '';
194
+ const ways = SETTLE_WAYS.filter((w) => held[w.allowed]);
195
+ const way = draft.way || '';
196
+ const off = form.busy || form.uncertain ? ' disabled' : '';
197
+ const frozen = form.busy || form.uncertain ? ' readonly' : '';
198
+ const intro = held.stale
199
+ ? `<p class="pm-note">This earlier send to ${esc(held.to || '')} (${esc(ago(held.preparedAt))}) is from before this RFI last changed, so the only way to settle it is to leave it unconfirmed.</p>`
200
+ : '';
201
+ const radios = ways.length > 1 ? `<div class="pr-radios" role="radiogroup" aria-label="What do you want to do?">${ways.map((w, i) => {
202
+ const on = way === w.key;
203
+ return `<button type="button" class="pr-radio" role="radio" aria-checked="${on}" tabindex="${on || (!way && i === 0) ? 0 : -1}" data-pr-way="${w.key}"
204
+ data-command-id="shell.project-rfi-settle-way#${esc(w.key)}" data-command-instance-label="${esc(w.label)}"${off}><span class="pr-radio-dot" aria-hidden="true"></span>
205
+ <span><span class="pr-radio-label">${esc(w.label)}</span><span class="pg-row-meta">${esc(w.help)}</span></span></button>`;
206
+ }).join('')}</div>` : '';
207
+ let detail = '';
208
+ if (way === 'sent-another-way') {
209
+ const via = draft.via || '';
210
+ const how = String(draft.how || '');
211
+ detail = `<div class="pr-radios" role="radiogroup" aria-label="How did you send it?">${[['email', 'Email'], ['other', 'Other']].map(([key, text], i) => {
212
+ const on = via === key;
213
+ return `<button type="button" class="pr-radio" role="radio" aria-checked="${on}" tabindex="${on || (!via && i === 0) ? 0 : -1}" data-pr-via="${key}"
214
+ data-command-id="shell.project-rfi-settle-via#${esc(key)}" data-command-instance-label="${text}"${off}><span class="pr-radio-dot" aria-hidden="true"></span>
215
+ <span class="pr-radio-label">${text}</span></button>`;
216
+ }).join('')}</div>
217
+ <label class="pr-field">Who did you send it to?<input type="email" class="pr-input" data-pr-input="to" value="${esc(draft.to ?? held.to ?? '')}" autocomplete="email"
218
+ data-command-id="shell.project-rfi-settle-to#${esc(rfi.id)}" data-command-instance-label="${id}"${frozen}></label>
219
+ ${via === 'other' ? `<label class="pr-field">How did you send it?<input class="pr-input" data-pr-input="how" maxlength="${HOW_MAX}" value="${esc(how)}"
220
+ placeholder="Handed over at the site meeting" data-command-id="shell.project-rfi-settle-how#${esc(rfi.id)}" data-command-instance-label="${id}"${frozen}>
221
+ <span class="pg-row-meta" data-pr-how-count>${how.length} of ${HOW_MAX}</span></label>` : ''}
222
+ <p class="pg-row-meta">FloLess records this and marks the RFI sent. It sends nothing.</p>`;
223
+ } else if (way === 'leave-unconfirmed') detail = `<p class="pg-row-meta">${LEAVE_TEXT}</p>`;
224
+ else if (way === 'try-again') detail = '<p class="pg-row-meta">Gmail sends this RFI as a new email. FloLess asks you to confirm first.</p>';
225
+ const chosen = SETTLE_WAYS.find((w) => w.key === way);
226
+ const lost = form.uncertain ? '<p class="pm-note pr-alert" role="alert">FloLess didn’t get an answer, so it can’t tell whether that was recorded. Try again does the same thing again, never twice.</p>' : '';
227
+ const err = form.error ? `<p class="pm-note pr-alert" role="alert">${esc(form.error)}</p>` : '';
228
+ return `<div class="pr-form" role="group" aria-label="${esc(`Settle the unconfirmed send of ${rfi.id}`)}"${form.busy ? ' aria-busy="true"' : ''}>${intro}${radios}${detail}${err}${lost}
229
+ <div class="pm-strip-acts pr-form-acts">
230
+ ${form.uncertain
231
+ ? `<button type="button" class="ghost" data-pr-gmail-check="1" data-command-id="shell.project-rfi-gmail-check-list#${esc(rfi.id)}" data-command-instance-label="${id}">Check the list</button>`
232
+ : `<button type="button" class="ghost" data-pr-form-cancel="1" data-command-id="shell.project-rfi-form-cancel#${esc(rfi.id)}" data-command-instance-label="${id}"${busy}>Cancel</button>`}
233
+ <button type="button" class="primary" data-pr-form-submit="1" data-command-id="shell.project-rfi-settle-submit#${esc(rfi.id)}" data-command-instance-label="${id}"${busy}>${form.uncertain ? 'Try again' : form.busy ? 'Saving…' : esc(chosen?.primary || 'Choose one')}</button>
234
+ </div></div>`;
235
+ }
174
236
  case 'reopen':
175
237
  fields = `<label class="pr-field">Why is this open again?<textarea class="pr-input pr-text" data-pr-input="why" rows="2" maxlength="1000"
176
238
  data-command-id="shell.project-rfi-reopen-why#${esc(rfi.id)}" data-command-instance-label="${id}"${busy}${ro}>${esc(draft.why || '')}</textarea></label>`;
@@ -186,11 +248,18 @@
186
248
  </div></div>`;
187
249
  }
188
250
 
251
+ /** The ghost button that opens the ways out of a held send, when the server offers one (#2470 R6.6e). */
252
+ function settleButton(rfi, d, text) {
253
+ if (!SETTLE_WAYS.some((w) => d[w.allowed])) return '';
254
+ return `<button type="button" class="ghost" data-pr-settle="${esc(rfi.id)}" data-pr-attempt="${esc(d.attemptId)}" data-command-id="shell.project-rfis-gmail-settle#${esc(rfi.id)}"
255
+ data-command-instance-label="${esc(rfi.id)}" aria-label="${esc(`${text.replace('…', '')}: ${rfi.id}`)}" data-tip="Other ways to settle this send: send it again, record that you sent it, or leave it unconfirmed">${text}</button>`;
256
+ }
257
+
189
258
  function rowHtml(rfi, now) {
190
259
  const id = esc(rfi.id);
191
260
  const label = `data-command-instance-label="${id}"`;
192
261
  const meta = [];
193
- if (rfi.sent) meta.push(`<span data-tip="${esc(exact(rfi.sent.at))}">${rfi.sent.via === 'gmail' ? 'Sent with Gmail to' : 'Marked sent to'} ${esc(rfi.sent.to)} · ${esc(ago(rfi.sent.at, now))}</span>`);
262
+ if (rfi.sent) meta.push(`<span data-tip="${esc(exact(rfi.sent.at))}">${rfi.sent.via === 'gmail' ? 'Sent with Gmail to' : rfi.sent.via === 'other' ? `Sent another way (${esc(rfi.sent.how || '')}) to` : 'Marked sent to'} ${esc(rfi.sent.to)} · ${esc(ago(rfi.sent.at, now))}</span>`);
194
263
  else meta.push(`<span data-tip="${esc(exact(rfi.raisedAt))}">Filed ${esc(ago(rfi.raisedAt, now))}${rfi.raisedBy === 'ai' ? ' by AI Chat' : ''}</span>`);
195
264
  if (rfi.reopens) meta.push(`Reopened ${rfi.reopens === 1 ? 'once' : `${rfi.reopens} times`}`);
196
265
  const answer = rfi.answer ? `<blockquote class="pr-answer"><span class="pr-answer-label">Answer</span> ${esc(rfi.answer.text)}</blockquote>` : '';
@@ -211,20 +280,36 @@
211
280
  : d.status === 'confirmed-sent' ? `You confirmed it in Sent on ${esc(exact(d.settledAt || ''))}.`
212
281
  : d.status === 'failed' ? (rfi.status === 'open' ? 'Gmail didn’t receive this RFI, so nothing was sent. Send it again, or copy the email text and send it yourself.' : '')
213
282
  : d.status === 'prepared' ? `FloLess began sending this with Gmail but didn’t finish recording it, so it can’t tell whether it went. Don’t send it again. Choose Finish sending. ${HELD}`
214
- : `FloLess can’t tell whether Gmail accepted this RFI. Don’t send it again. Open the connected account’s Sent folder and search for <span class="pr-marker">${esc(d.reconciliationMarker || '')}</span>. If you find it, choose I found it in Sent. ${HELD}`;
283
+ : `FloLess can’t tell whether Gmail accepted this RFI. Don’t send it again. Open the connected account’s Sent folder and search for <span class="pr-marker">${esc(d.reconciliationMarker || '')}</span>. If you find it, choose I found it in Sent. If you don’t, choose I didn’t find it. ${HELD}`;
215
284
  const alert = state.alertFor === rfi.id ? ' role="alert"' : '';
216
285
  if (note) deliveryNote = `<p class="pm-note${pending ? ' pr-delivery-held' : ''}" tabindex="-1" data-pr-delivery-note="${id}"${alert}>${note}</p>`;
217
286
  }
287
+ // #2470 R6.6e: a send from before this RFI last changed still holds it, and offers only Leave it unconfirmed.
288
+ const earlier = (rfi.holdingDeliveries || []).filter((h) => h.stale).map((h) => `<p class="pm-note pr-delivery-held">An earlier Gmail send to ${esc(h.to || '')} (${esc(ago(h.preparedAt, now))}) is still held. Settle it to free this RFI.</p>
289
+ <div class="pm-strip-acts"><button type="button" class="ghost" data-pr-settle="${id}" data-pr-attempt="${esc(h.attemptId)}" data-command-id="shell.project-rfis-gmail-leave-earlier#${esc(h.attemptId)}"
290
+ data-command-instance-label="${id}" aria-label="${esc(`Leave the earlier send of ${rfi.id} unconfirmed`)}" data-tip="Settles that earlier send without recording a send">Leave it unconfirmed…</button></div>`).join('');
291
+ const history = rfi.deliveryHistory;
292
+ let historyHtml = '';
293
+ if (history) {
294
+ const reach = history.mayHaveReached;
295
+ const open = state.historyOpen?.has(rfi.id);
296
+ const lines = history.settled.map((h) => `<li>Gmail send to ${esc(h.to)} · ${esc(ago(h.preparedAt, now))} · not confirmed, ${esc(SETTLED_WORDS[h.choice] || h.choice)}${h.stale ? ' (an earlier send)' : ''}${resendWords(h.resend)}</li>`).join('');
297
+ historyHtml = `<p class="pm-note pr-delivery-held">${esc(reach.to)} ${reach.moreThanOnce ? 'may have received it more than once.' : 'may already have this RFI.'}</p>
298
+ <div class="pm-strip-acts"><button type="button" class="ghost" data-pr-history="${id}" aria-expanded="${open ? 'true' : 'false'}" data-command-id="shell.project-rfi-settled-history#${esc(rfi.id)}" data-command-instance-label="${id}">Not confirmed (${history.settled.length})</button></div>
299
+ ${open ? `<ul class="pg-row-meta pr-settled" aria-label="${esc(`Sends of ${rfi.id} FloLess couldn’t confirm`)}">${lines}</ul>` : ''}`;
300
+ }
301
+ deliveryNote += earlier + historyHtml;
218
302
  const sendButton = rfi.status === 'open' && !pending && rfi.verbs.includes('mark-sent')
219
303
  ? `<button type="button" class="${state.readiness?.status === 'ready' ? 'primary' : 'ghost'}" data-pr-gmail="${id}" data-command-id="shell.project-rfis-gmail-send#${esc(rfi.id)}" ${label}
220
304
  aria-label="${esc(`Send ${rfi.id} with Gmail`)}" data-tip="${esc(elsewhere ? 'A send is in progress' : 'Sends this RFI from your connected Google account')}"${elsewhere}>Send with Gmail…</button>` : '';
221
305
  const recoverButtons = !pending ? '' : d.status === 'prepared'
222
306
  ? `<button type="button" class="primary" data-pr-gmail-continue="${id}" data-pr-attempt="${esc(d.attemptId)}" data-command-id="shell.project-rfis-gmail-continue#${esc(rfi.id)}" ${label}
223
- aria-label="${esc(`Finish sending ${rfi.id} with Gmail`)}" data-tip="Finishes this one send. It never starts a second one."${recovering ? ' aria-busy="true" aria-disabled="true" data-blocked-reason="Finishing this send now."' : ''}>${recovering ? 'Finishing…' : 'Finish sending'}</button>`
307
+ aria-label="${esc(`Finish sending ${rfi.id} with Gmail`)}" data-tip="Finishes this one send. It never starts a second one."${recovering ? ' aria-busy="true" aria-disabled="true" data-blocked-reason="Finishing this send now."' : ''}>${recovering ? 'Finishing…' : 'Finish sending'}</button>${settleButton(rfi, d, 'Something else…')}`
224
308
  : `<button type="button" class="primary" data-pr-gmail-confirm="${id}" data-pr-attempt="${esc(d.attemptId)}" data-command-id="shell.project-rfis-gmail-confirm#${esc(rfi.id)}" ${label}
225
309
  aria-label="${esc(`I found ${rfi.id} in Sent`)}" data-tip="Use only after you found this exact send in the connected account’s Sent folder"${recovering ? ' aria-busy="true" aria-disabled="true" data-blocked-reason="Recording this now."' : ''}>${recovering ? 'Recording…' : 'I found it in Sent'}</button>
226
310
  <button type="button" class="ghost" data-pr-gmail-marker="${id}" data-command-id="shell.project-rfis-gmail-marker#${esc(rfi.id)}" ${label}
227
- aria-label="${esc(`Copy the search text for ${rfi.id}`)}" data-tip="Copies the reference line to search for in Sent">Copy search text</button>`;
311
+ aria-label="${esc(`Copy the search text for ${rfi.id}`)}" data-tip="Copies the reference line to search for in Sent">Copy search text</button>
312
+ ${settleButton(rfi, d, 'I didn’t find it…')}`;
228
313
  const verbButtons = form ? '' : [
229
314
  sendButton, recoverButtons,
230
315
  rfi.status !== 'closed' ? `<button type="button" class="ghost" data-pr-copy="${id}" data-command-id="shell.project-rfi-copy#${esc(rfi.id)}" ${label} aria-label="Copy the email text of ${id}"
@@ -393,10 +478,21 @@
393
478
  : verb === 'gmail' ? '.pr-form [data-pr-input="to"], .pr-form [data-pr-gmail-integrations], .pr-form [data-pr-gmail-recheck]' : '.pr-form [data-pr-input]';
394
479
  paint();
395
480
  }
481
+ function openSettle(rfiId, attemptId) {
482
+ const rfi = state.view.data?.rfis.find((r) => r.id === rfiId);
483
+ const held = heldAttempt(rfi, attemptId);
484
+ if (!held) { toast('That send is already settled. The list has been read again.', 'info'); state.quietLoad = true; void load(); return; }
485
+ const ways = SETTLE_WAYS.filter((w) => held[w.allowed]);
486
+ // Only one way (an earlier send): it is the choice. Otherwise nothing is chosen for the person.
487
+ state.form = { rfiId, verb: 'settle', attemptId, key: newKey(), draft: { way: ways.length === 1 ? ways[0].key : '' }, error: null, busy: false, uncertain: false, stale: false };
488
+ state.focusAfter = '.pr-form [data-pr-way][tabindex="0"], .pr-form [data-pr-form-submit]';
489
+ paint();
490
+ }
396
491
  function closeForm() {
397
492
  const f = state.form;
398
493
  state.form = null;
399
- state.focusAfter = !f ? null : f.verb === 'gmail' ? `[data-pr-gmail="${CSS.escape(f.rfiId)}"]` : `[data-pr-verb="${f.verb}"][data-pr-rfi="${CSS.escape(f.rfiId)}"]`;
494
+ state.focusAfter = !f ? null : f.verb === 'settle' ? `[data-pr-settle="${CSS.escape(f.rfiId)}"][data-pr-attempt="${CSS.escape(f.attemptId)}"]`
495
+ : f.verb === 'gmail' ? `[data-pr-gmail="${CSS.escape(f.rfiId)}"]` : `[data-pr-verb="${f.verb}"][data-pr-rfi="${CSS.escape(f.rfiId)}"]`;
400
496
  paint();
401
497
  }
402
498
  function readDraft() {
@@ -410,6 +506,7 @@
410
506
  const f = mine.form;
411
507
  if (!f || f.busy) return;
412
508
  if (f.verb === 'gmail') { void submitGmail(mine, f); return; }
509
+ if (f.verb === 'settle') { void submitSettle(mine, f); return; }
413
510
  if (f.uncertain) { void sendForm(mine, f, f.sent); return; }
414
511
  readDraft();
415
512
  const rfi = mine.view.data.rfis.find((r) => r.id === f.rfiId);
@@ -532,6 +629,89 @@
532
629
  if (status === 'failed') announce(`Gmail didn’t receive ${rfiId}, so nothing was sent.`);
533
630
  }
534
631
 
632
+ // ── The ways out of an unconfirmed send (#2470 R6.6e) ───────────────────────────────────────────────────────
633
+
634
+ /**
635
+ * A Try again answered: the earlier send is settled whatever happened next. When the new send never started (the
636
+ * project is being archived, or it changed), the server's reason is said — the row's own note would only say the
637
+ * send wasn't finished recording, which is not what happened.
638
+ */
639
+ async function settleAgainAnswered(mine, rfiId, res, to) {
640
+ const unfinished = res?.settledAttempt && res?.attempt?.status === 'prepared' && res?.error;
641
+ await settleGmail(mine, rfiId, res, to);
642
+ if (state !== mine || !unfinished) return;
643
+ // "Didn't start" only when the server says so; otherwise Gmail may have taken it and only the record is missing.
644
+ const msg = res.code === 'rfi-gmail-prepared'
645
+ ? `${rfiId}: the earlier send is settled, but the new Gmail send didn’t start. ${res.error}`
646
+ : `${rfiId}: the earlier send is settled. ${res.error}`;
647
+ toast(msg, 'warn'); announce(msg);
648
+ }
649
+
650
+ function submitSettle(mine, f) {
651
+ if (f.uncertain) { void sendSettle(mine, f, f.sent); return; }
652
+ readDraft();
653
+ const d = f.draft;
654
+ const to = String(d.to || '').trim();
655
+ const how = String(d.how || '').trim();
656
+ // Asked, not refused: the button stays live and says what is missing.
657
+ const missing = !d.way ? 'Choose what you want to do first.'
658
+ : d.way === 'sent-another-way' && !d.via ? 'Say how you sent it: by email, or another way.'
659
+ : d.way === 'sent-another-way' && !isAddress(to) ? 'Give the one email address it went to, like name@company.com.'
660
+ : d.way === 'sent-another-way' && d.via === 'other' && !how ? 'Say in a few words how you sent it.' : null;
661
+ if (missing) {
662
+ f.error = missing;
663
+ mine.focusAfter = !d.way ? '.pr-form [data-pr-way][tabindex="0"]' : !d.via ? '.pr-form [data-pr-via][tabindex="0"]' : !isAddress(to) ? '.pr-form [data-pr-input="to"]' : '.pr-form [data-pr-input="how"]';
664
+ paint(); announce(missing); return;
665
+ }
666
+ if (d.way === 'try-again') { openAgain(f); return; }
667
+ const body = { ...identity(), operationKey: f.key };
668
+ if (d.way === 'sent-another-way') { body.to = to; body.via = d.via; if (d.via === 'other') body.how = how; }
669
+ f.sent = { way: d.way, body }; // what Try again resends, unchanged, under the same key
670
+ void sendSettle(mine, f, f.sent);
671
+ }
672
+
673
+ async function sendSettle(mine, f, sent) {
674
+ f.busy = true; f.error = null; mine.focusAfter = '.pr-form [data-pr-form-submit]'; paint();
675
+ const rfiId = f.rfiId;
676
+ try {
677
+ const res = await api(`/api/projects/${encodeURIComponent(target().projectId)}/correspondence-rfis/${encodeURIComponent(rfiId)}/delivery-attempts/${encodeURIComponent(f.attemptId)}/${sent.way}`,
678
+ { method: 'POST', body: JSON.stringify(sent.body) });
679
+ if (state !== mine) return;
680
+ if (sent.way === 'try-again') { await settleAgainAnswered(mine, rfiId, res, sent.body.to); return; }
681
+ mine.form = null; mine.quietLoad = true;
682
+ mine.focusAfter = `[data-pr-title="${CSS.escape(rfiId)}"]`;
683
+ await load();
684
+ if (state !== mine) return;
685
+ const msg = sent.way === 'leave-unconfirmed' ? `${rfiId} left unconfirmed. It’s free again.` : `${rfiId} recorded as sent another way, to ${sent.body.to}.`;
686
+ toast(msg, 'ok'); announce(msg);
687
+ } catch (error) {
688
+ if (state !== mine) return;
689
+ f.busy = false;
690
+ if (sent.way === 'try-again' && error?.body?.attempt) { await settleAgainAnswered(mine, rfiId, error.body, sent.body.to); return; }
691
+ // Someone settled it elsewhere, or it changed: say what the server said and show the list as it now is.
692
+ if (refused(error) && SETTLE_OUT_OF_DATE.has(error.body?.code)) {
693
+ const msg = said(error, `${rfiId} changed since you opened it.`);
694
+ mine.form = null; mine.quietLoad = true;
695
+ mine.focusAfter = `[data-pr-title="${CSS.escape(rfiId)}"]`;
696
+ await load();
697
+ if (state !== mine) return;
698
+ toast(msg, 'warn'); announce(msg);
699
+ return;
700
+ }
701
+ // Gmail not ready answers 503 with nothing written: an answer, so it is said, never taken for a lost one.
702
+ const notReady = error?.body?.code === 'rfi-gmail-not-ready';
703
+ if (notReady && error.body.readiness) mine.readiness = error.body.readiness;
704
+ if (refused(error) || notReady) {
705
+ f.error = said(error, 'FloLess couldn’t do that just now. Try again.');
706
+ f.uncertain = false; f.sent = null; f.key = newKey(); // a refusal: the next try is a new intent
707
+ } else {
708
+ f.uncertain = true; // no answer: same key and body on Try again, so it is done once
709
+ }
710
+ mine.focusAfter = '.pr-form [data-pr-form-submit]';
711
+ paint(); announce(f.uncertain ? 'FloLess didn’t get an answer, so it can’t tell whether that was recorded.' : f.error);
712
+ }
713
+ }
714
+
535
715
  async function recoverGmail(rfiId, attemptId, action) {
536
716
  const mine = state;
537
717
  if (mine.recovering) return;
@@ -652,10 +832,53 @@
652
832
  }
653
833
  const citeKey = (c) => (c.kind === 'knowledge-page' ? `k:${c.slug}` : `d:${c.linkedProjectUuid}:${c.pageId}:${c.sourceHash}`);
654
834
 
835
+ /** Try Gmail again asks first, in a dialog with a tick the person must give (owner ruling, #2470 R6.6e). */
836
+ function openAgain(f) {
837
+ if (!$sheet || !target()) return;
838
+ const rfi = state.view.data?.rfis.find((r) => r.id === f.rfiId);
839
+ const held = heldAttempt(rfi, f.attemptId);
840
+ sheet = { returnFocus: state.pane.querySelector('.pr-form [data-pr-form-submit]') || document.activeElement, mode: 'again', form: f, rfiId: f.rfiId,
841
+ was: held?.to || '', to: f.draft.againTo ?? held?.to ?? '', ticked: false, error: null };
842
+ paintSheet();
843
+ $sheet.classList.add('show');
844
+ requestAnimationFrame(() => $body?.querySelector('[data-pr-again-tick]')?.focus());
845
+ }
846
+ function paintAgain() {
847
+ $title.textContent = 'Send it again?';
848
+ $sub.textContent = `FloLess can’t tell whether Gmail already sent ${sheet.rfiId} to ${sheet.was}. If it did, they will get it twice.`;
849
+ $body.innerHTML = `${sheet.error ? `<div class="pm-note pr-alert" role="alert">${esc(sheet.error)}</div>` : ''}
850
+ <label class="pr-field">Gmail sends a new email to<input type="email" class="pr-input" data-pr-field="to" value="${esc(sheet.to)}" autocomplete="email" data-command-id="shell.project-rfis-gmail-again-to"></label>
851
+ <label class="modal-check"><input type="checkbox" data-pr-again-tick="1" data-command-id="shell.project-rfis-gmail-again-tick"${sheet.ticked ? ' checked' : ''}${sheet.error && !sheet.ticked ? ' aria-invalid="true"' : ''}><span>I understand they may get it twice</span></label>`;
852
+ $foot.innerHTML = `<button type="button" class="ghost" data-pr-sheet-cancel="1" data-command-id="shell.project-rfis-gmail-again-cancel">Cancel</button>
853
+ <button type="button" class="primary" data-pr-again-send="1" data-command-id="shell.project-rfis-gmail-again-send">Send again with Gmail</button>`;
854
+ }
855
+ function sendAgain() {
856
+ sheet.to = String($body.querySelector('[data-pr-field="to"]')?.value || '').trim();
857
+ sheet.ticked = !!$body.querySelector('[data-pr-again-tick]')?.checked;
858
+ // Asked, not refused: the button stays live and says what is missing.
859
+ sheet.error = !isAddress(sheet.to) ? 'Give one email address, like name@company.com.'
860
+ : !sheet.ticked ? 'Tick the box to confirm you understand they may get it twice.' : null;
861
+ if (sheet.error) {
862
+ paintSheet();
863
+ $body.querySelector(isAddress(sheet.to) ? '[data-pr-again-tick]' : '[data-pr-field="to"]')?.focus();
864
+ return;
865
+ }
866
+ const f = sheet.form;
867
+ const to = sheet.to;
868
+ const mine = state;
869
+ const rfi = mine?.view.data?.rfis.find((r) => r.id === f.rfiId);
870
+ closeSheet({ restoreFocus: false });
871
+ if (!mine || mine.form !== f || !rfi) return;
872
+ f.draft.againTo = to;
873
+ f.sent = { way: 'try-again', body: { ...identity(), operationKey: f.key, to: f.draft.againTo, recordRevision: rfi.recordRevision } };
874
+ void sendSettle(mine, f, f.sent);
875
+ }
876
+
655
877
  function paintSheet() {
656
878
  const t = target();
657
879
  if (!sheet || !t) return;
658
880
  if (sheet.mode === 'pick') { paintPicker(); return; }
881
+ if (sheet.mode === 'again') { paintAgain(); return; }
659
882
  $title.textContent = 'New RFI';
660
883
  $sub.textContent = `A question from “${t.name}”. FloLess keeps it; after filing you can send it with Gmail or copy its email text.`;
661
884
  const ro = sheet.uncertain || sheet.busy ? ' readonly' : '';
@@ -815,6 +1038,7 @@
815
1038
  if (t === $sheet) { closeSheet(); return; }
816
1039
  const file = t.closest('[data-pr-sheet-file]');
817
1040
  if (file) { void fileRfi(file.getAttribute('data-pr-sheet-file') === 'sent'); return; }
1041
+ if (t.closest('[data-pr-again-send]')) { sendAgain(); return; }
818
1042
  if (t.closest('[data-pr-sheet-retry]')) { void fileRfi(!!sheet.payload?.markSentTo); return; }
819
1043
  if (t.closest('[data-pr-sheet-edit]')) { sheet.uncertain = false; sheet.key = newKey(); paintSheet(); $body.querySelector('[data-pr-field="title"]')?.focus(); return; }
820
1044
  if (t.closest('[data-pr-sheet-check]')) { closeSheet(); if (state) void load(); return; }
@@ -856,6 +1080,21 @@
856
1080
  if (t.closest('[data-pr-gmail-integrations]')) { readDraft(); if (typeof window.openIntegrations === 'function') window.openIntegrations('google-workspace'); return; }
857
1081
  if (t.closest('[data-pr-gmail-recheck]')) { void checkReadiness(); return; }
858
1082
  if (t.closest('[data-pr-gmail-check]')) { state.form = null; state.quietLoad = true; void load(); return; }
1083
+ const settle = t.closest('[data-pr-settle]');
1084
+ if (settle) { openSettle(settle.getAttribute('data-pr-settle'), settle.getAttribute('data-pr-attempt')); return; }
1085
+ const history = t.closest('[data-pr-history]');
1086
+ if (history) {
1087
+ const rfiId = history.getAttribute('data-pr-history');
1088
+ state.historyOpen ??= new Set();
1089
+ if (state.historyOpen.has(rfiId)) state.historyOpen.delete(rfiId); else state.historyOpen.add(rfiId);
1090
+ readDraft(); state.focusAfter = `[data-pr-history="${CSS.escape(rfiId)}"]`; paint(); return;
1091
+ }
1092
+ const way = t.closest('[data-pr-way]');
1093
+ if (way) { if (state.form?.busy || state.form?.uncertain || way.disabled) return; readDraft(); state.form.draft.way = way.getAttribute('data-pr-way'); state.form.error = null;
1094
+ state.focusAfter = `[data-pr-way="${state.form.draft.way}"]`; paint(); return; }
1095
+ const via = t.closest('[data-pr-via]');
1096
+ if (via) { if (state.form?.busy || state.form?.uncertain || via.disabled) return; readDraft(); state.form.draft.via = via.getAttribute('data-pr-via'); state.form.error = null;
1097
+ state.focusAfter = `[data-pr-via="${state.form.draft.via}"]`; paint(); return; }
859
1098
  const cont = t.closest('[data-pr-gmail-continue]');
860
1099
  if (cont) { if (cont.getAttribute('aria-disabled') !== 'true') void recoverGmail(cont.getAttribute('data-pr-gmail-continue'), cont.getAttribute('data-pr-attempt'), 'continue'); return; }
861
1100
  const confirm = t.closest('[data-pr-gmail-confirm]');
@@ -895,6 +1134,10 @@
895
1134
  sheet.timer = setTimeout(() => void loadCitable(), 200);
896
1135
  }
897
1136
  if (sheet && event.target.closest?.('[data-pr-field]')) event.target.removeAttribute('aria-invalid');
1137
+ if (event.target.matches?.('.pr-form [data-pr-input="how"]')) {
1138
+ const count = event.target.closest('.pr-field')?.querySelector('[data-pr-how-count]');
1139
+ if (count) count.textContent = `${event.target.value.length} of ${HOW_MAX}`;
1140
+ }
898
1141
  });
899
1142
 
900
1143
  document.addEventListener('keydown', (event) => {
@@ -920,9 +1163,9 @@
920
1163
  if (event.key === 'Escape' && state.form && event.target.closest('.pr-form')) { event.preventDefault(); if (!state.form.busy) closeForm(); return; }
921
1164
  if (event.key === 'Enter' && state.form?.verb === 'gmail' && event.target.matches?.('[data-pr-input="to"]')) { event.preventDefault(); void submitForm(); return; }
922
1165
  // The disposition choice is a radio group: arrows move and choose.
923
- const radio = event.target.closest?.('[data-pr-disposition]');
1166
+ const radio = event.target.closest?.('[data-pr-disposition], [data-pr-way], [data-pr-via]');
924
1167
  if (radio && ['ArrowDown', 'ArrowRight', 'ArrowUp', 'ArrowLeft'].includes(event.key)) {
925
- const radios = [...state.pane.querySelectorAll('[data-pr-disposition]')];
1168
+ const radios = [...radio.closest('[role="radiogroup"]').querySelectorAll('[role="radio"]')];
926
1169
  const i = radios.indexOf(radio);
927
1170
  const next = radios[(i + (event.key === 'ArrowDown' || event.key === 'ArrowRight' ? 1 : radios.length - 1)) % radios.length];
928
1171
  event.preventDefault();
@@ -153,7 +153,7 @@
153
153
  const newBtn = (cls) => `<button type="button" class="ghost ${cls}" data-pw-new="1" data-command-id="shell.project-workflow-new"${view.busyNew ? ' disabled aria-busy="true"' : ''}
154
154
  data-tip="Name a new workflow for this project. AI builds it with you; nothing is made until you confirm.">New workflow…</button>`;
155
155
  const head = `<div class="step-head"><span tabindex="-1" data-pw-heading="1">Workflows</span>${view.status === 'ready' && view.rows.some((w) => w.status !== 'archived') ? newBtn('pw-new') : ''}</div>
156
- <p class="pg-sub">Repeatable checks and reports that belong to this project. Agents, schedules and other workflows that
156
+ <p class="pg-sub">Repeatable workflows that belong to this project, such as checks, reports and exports. Agents, schedules and other workflows that
157
157
  use this project are under <button type="button" class="pw-access" data-pw-access="1" aria-haspopup="dialog" data-command-id="shell.project-workflows-access"
158
158
  data-tip="Shows every Agent, schedule and workflow that reaches into this project">Project access</button>.</p>`;
159
159
  if (view.status === 'loading') return `${head}<p class="pg-loading-line">Loading this project’s workflows…</p>`;
@@ -4244,6 +4244,13 @@ function visibleMemberIds() {
4244
4244
  for (const [id, m] of meshById) if (m.visible && !m.userData.derived) out.push(id);
4245
4245
  return out;
4246
4246
  }
4247
+ // Every member drawn in 3D, hidden or not (a member with no geometry is never built). AI Chat's view command (#2876)
4248
+ // selects only what has something to show, and reports the rest as matched-but-not-drawn.
4249
+ function drawnMemberIds() {
4250
+ const out = [];
4251
+ for (const [id, m] of meshById) if (!m.userData.derived) out.push(id);
4252
+ return out;
4253
+ }
4247
4254
  function visibleObjectIds() {
4248
4255
  const out = [];
4249
4256
  for (const [id, m] of meshById) if (m.visible) out.push(id);
@@ -9392,7 +9399,7 @@ window.Steel3DView = {
9392
9399
  if (!wpGroup) return { group: false, extent: wpExtent };
9393
9400
  return { group: true, extent: wpExtent, children: wpGroup.children.map((c) => ({ type: c.type, color: c.material && '#' + c.material.color.getHexString(), opacity: c.material && c.material.opacity, w: c.geometry && c.geometry.parameters ? c.geometry.parameters.width : null, h: c.geometry && c.geometry.parameters ? c.geometry.parameters.height : null })) };
9394
9401
  },
9395
- toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], selectionHiddenIds: () => [...selectionHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds, visibleObjectIds, visibleGridIds,
9402
+ toggleGroup, setGroupsHidden, setIdsHidden, connHiddenIds: () => [...connHidden], selectionHiddenIds: () => [...selectionHidden], soloToggle, setSoloGroups, showAllGroups, groupState, getGroups, visibleMemberIds, drawnMemberIds, visibleObjectIds, visibleGridIds,
9396
9403
  setClipMode, clipMode: clipModeOn, toggleClip, removeClip, clearClips, getClips, renameClip, selectClip, setSelectedClips, selectedClips, deleteSelectedClips, clipState, setClipState, mountClipList,
9397
9404
  // Instructor seam: what this module has armed, and the one slot that paints what the shell produced.
9398
9405
  instructorCommand, renderGuidance,