@floless/app 0.158.0 → 0.160.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 (43) hide show
  1. package/dist/floless-server.cjs +140655 -117708
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
  3. package/dist/schemas/steel.model.v2.schema.json +1 -0
  4. package/dist/skills/floless-app-actions/SKILL.md +23 -5
  5. package/dist/skills/floless-app-bridge/SKILL.md +5 -3
  6. package/dist/skills/floless-app-onboarding/SKILL.md +69 -5
  7. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
  8. package/dist/skills/floless-app-queue/SKILL.md +3 -1
  9. package/dist/skills/floless-app-rfi/SKILL.md +29 -1
  10. package/dist/skills/floless-app-steel-model/SKILL.md +11 -5
  11. package/dist/skills/floless-app-steel-takeoff/SKILL.md +28 -8
  12. package/dist/skills/floless-app-workflows/SKILL.md +6 -3
  13. package/dist/web/agents.js +12 -5
  14. package/dist/web/app.css +266 -159
  15. package/dist/web/app.js +23 -51
  16. package/dist/web/aware.js +533 -546
  17. package/dist/web/chat-question-card.js +24 -1
  18. package/dist/web/chat.css +170 -48
  19. package/dist/web/chat.js +1406 -208
  20. package/dist/web/commands-shell.js +1104 -177
  21. package/dist/web/commands-steel.js +2 -0
  22. package/dist/web/drawing-check-editor.html +10 -0
  23. package/dist/web/drawing-check-editor.js +44 -0
  24. package/dist/web/guide.js +12 -2
  25. package/dist/web/index.html +62 -48
  26. package/dist/web/instructor.js +33 -12
  27. package/dist/web/pages.js +186 -31
  28. package/dist/web/panels.js +19 -1
  29. package/dist/web/project-access.js +67 -8
  30. package/dist/web/project-modules.js +474 -0
  31. package/dist/web/project-rfis.js +715 -0
  32. package/dist/web/project-workflows.js +506 -0
  33. package/dist/web/run-history.js +198 -0
  34. package/dist/web/run-page-view.js +12 -2
  35. package/dist/web/steel-3d-core.js +75 -1
  36. package/dist/web/steel-3d-view.js +8 -38
  37. package/dist/web/steel-editor.html +263 -59
  38. package/dist/web/steel-model-v2-projection.js +7 -0
  39. package/dist/web/workspace-root-recovery.js +119 -0
  40. package/dist/web/workspaces.js +493 -161
  41. package/launch-starting-page.mjs +5 -2
  42. package/launch.mjs +136 -78
  43. package/package.json +6 -1
package/dist/web/pages.js CHANGED
@@ -103,13 +103,29 @@
103
103
  ${canDelete ? `<button type="button" class="ghost pg-row-delete" data-command-id="shell.page-delete-unreadable#${esc(p.id)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Delete</button>` : ''}
104
104
  </div>`;
105
105
  }
106
- const meta = [...(view.lead || [sourceText(p.source)]), versionsText(p.versionCount), p.sequence ? 'Has an order' : '', `Updated ${ago(p.updatedAt)}`].filter(Boolean).join(' · ');
106
+ if (typeof p.locked === 'string' && p.locked) {
107
+ // #2644: made by a Drawing Checker or Steel Model workflow this account's plan does not include. It stays listed
108
+ // by name and says why it does not open, in the module's own words; nothing of it is read.
109
+ // Housekeeping stays: Delete, and Cancel publishing while a link is still going out (the viewer that holds them
110
+ // does not open). The landing's owner and Archived context lead the sentence, as on any other row.
111
+ const lead = (view.lead || []).filter(Boolean).join(' · ');
112
+ const cancel = p.shareState === 'pending-publish'
113
+ ? `<button type="button" class="ghost pg-row-locked-act" data-locked-act="cancel" data-command-id="shell.page-share-cancel-locked#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Cancel publishing</button>` : '';
114
+ return `<div class="pg-row pg-row-locked" role="listitem" aria-disabled="true" data-blocked-reason="${esc(p.locked)}">
115
+ <div class="pg-row-text"><span class="pg-row-line"><span class="pg-row-title">${esc(p.title)}</span><span class="wf-fork-badge wf-lock-badge" data-tip="${esc(p.locked)}">${globalThis.FLOLESS_LOCK_ICON_SVG || ''}Locked</span></span>
116
+ <span class="pg-row-meta">${esc(lead ? `${lead} · ${p.locked}` : p.locked)}</span></div>
117
+ ${cancel}<button type="button" class="ghost pg-row-locked-act" data-locked-act="delete" data-command-id="shell.page-delete-locked#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">Delete</button>
118
+ </div>`;
119
+ }
120
+ const meta = [...(view.lead || [sourceText(p.source)]), versionsText(p.versionCount), p.sequence ? 'Has an order' : ''].filter(Boolean).join(' · ');
121
+ // #2702: "Updated N min ago" is its own element so a quiet clock tick (retimeLists) can keep it true without a re-read.
122
+ const updated = `Updated <span class="pg-ago" data-at="${esc(p.updatedAt)}">${esc(ago(p.updatedAt))}</span>`;
107
123
  // Only an order FloLess did not read is flagged on the row; a read one is the plain "Has an order".
108
124
  const seqChip = p.sequence && (p.sequence !== 'read' || p.sequencePartial) ? `<span class="pg-seq-chip is-warn">${esc(seqLabel({ order: p.sequence, partial: p.sequencePartial }))}</span>` : '';
109
125
  return `<div class="pg-row" role="listitem">
110
126
  <button type="button" class="pg-row-open" data-command-id="shell.page-open#${esc(p.id)}" data-command-instance-label="${esc(p.title)}" data-home="${esc(home)}" data-page="${esc(p.id)}">
111
127
  <span class="pg-row-line"><span class="pg-row-title">${esc(p.title)}</span>${p.aiMade ? '<span class="pg-ai-badge">AI-made</span>' : ''}${seqChip}${p.shareState && p.shareState !== 'revoked' ? `<span class="sl-chip" data-state="${esc(p.shareState)}">${esc(LIST_CHIP[p.shareState] || 'Shared')}</span>` : ''}</span>
112
- <span class="pg-row-meta" data-tip="${esc(when(p.updatedAt))}">${esc(meta)}</span>
128
+ <span class="pg-row-meta" data-tip="${esc(when(p.updatedAt))}">${esc(meta)}${meta ? ' · ' : ''}${updated}</span>
113
129
  </button>
114
130
  </div>`;
115
131
  }
@@ -135,7 +151,9 @@
135
151
  for (const e of lists) if (e.container === container) lists.delete(e);
136
152
  lists.add(entry);
137
153
  const token = (container.dataset.pagesToken = String(Math.random()));
138
- if (!opts.hideWhenEmpty) container.innerHTML = `${opts.headHtml || ''}<p class="pg-loading-line">Loading Pages…</p>`;
154
+ // A re-read for a change (opts.quiet) keeps the rows on screen until the new ones arrive, so the list never flashes.
155
+ const keepRows = opts.quiet && container.querySelector('.pg-list, .pg-empty');
156
+ if (!opts.hideWhenEmpty && !keepRows) container.innerHTML = `${opts.headHtml || ''}<p class="pg-loading-line">Loading Pages…</p>`;
139
157
  let body;
140
158
  try {
141
159
  body = await api(`/api/pages?home=${encodeURIComponent(home)}`);
@@ -163,7 +181,7 @@
163
181
  }
164
182
  // Landing rows remain usable during loading: preserve the person's latest row, not the
165
183
  // one focused when the request began. Other surfaces replace rows with Loading immediately.
166
- if (opts.hideWhenEmpty) focusedPageCommand = container.contains(document.activeElement) ? document.activeElement?.getAttribute('data-command-id') : null;
184
+ if (opts.hideWhenEmpty || opts.quiet) focusedPageCommand = container.contains(document.activeElement) ? document.activeElement?.getAttribute('data-command-id') : null;
167
185
  const own = pages.length ? `<div class="pg-list" role="list" aria-label="${esc(opts.label || 'Pages')}">${pages.map((p) => rowHtml(body.home || home, p)).join('')}</div>` : '';
168
186
  const workflows = fromWorkflows.length || workflowsNote ? `<div class="pg-group-label">From workflows</div>
169
187
  ${workflowsNote ? `<p class="pg-empty">${esc(workflowsNote)}</p>` : ''}
@@ -279,19 +297,41 @@
279
297
  window.dispatchEvent(new CustomEvent('floless:page-deleted', { detail: { home, id } }));
280
298
  }
281
299
 
282
- function refreshLists() {
300
+ function refreshLists(quiet = false) {
283
301
  for (const e of [...lists]) {
284
302
  if (!e.container.isConnected) { lists.delete(e); continue; }
285
303
  if (e.kind === 'workflows') renderWorkflowsList(e.container, e.opts);
286
- else renderList(e.container, e.home, e.opts);
304
+ else renderList(e.container, e.home, quiet ? { ...e.opts, quiet: true } : e.opts);
305
+ }
306
+ }
307
+
308
+ // #2702: a Page changed anywhere (chat, workflow run, viewer share/publish/revoke, delete) — the server says so on the
309
+ // event stream it already has open, and every open list re-reads. Bursts (a run adding versions) become one re-read.
310
+ let pagesChangedTimer = null;
311
+ window.addEventListener('floless:pages-changed', () => {
312
+ if (pagesChangedTimer) return;
313
+ pagesChangedTimer = setTimeout(() => { pagesChangedTimer = null; refreshLists(true); }, 250);
314
+ });
315
+
316
+ /** Keep "Updated N min ago" true on an open list with no request: re-word it from the time already on the row. */
317
+ function retimeLists() {
318
+ for (const el of document.querySelectorAll('.pg-ago[data-at]')) {
319
+ const text = ago(el.getAttribute('data-at'));
320
+ if (text && el.textContent !== text) el.textContent = text;
287
321
  }
288
322
  }
323
+ const retimeTick = () => { if (!document.hidden) retimeLists(); const t = setTimeout(retimeTick, 30_000); t?.unref?.(); };
324
+ retimeTick();
325
+ document.addEventListener('visibilitychange', () => { if (!document.hidden) retimeLists(); });
289
326
 
290
327
  document.addEventListener('click', (event) => {
291
328
  const open = event.target.closest?.('.pg-row-open');
292
329
  if (open) { openViewer(open.dataset.home, open.dataset.page, null, open); return; }
293
330
  const del = event.target.closest?.('.pg-row-delete');
294
331
  if (del) { deleteUnreadable(del.dataset.home, del.dataset.page, del); return; }
332
+ // #2644: a locked Page's housekeeping, from its row (its viewer does not open).
333
+ const lockedAct = event.target.closest?.('.pg-row-locked-act');
334
+ if (lockedAct) { void lockedPageAction(lockedAct.dataset.lockedAct, lockedAct.dataset.home, lockedAct.dataset.page, lockedAct); return; }
295
335
  const act = event.target.closest?.('.pg-wf-act');
296
336
  const owner = act && [...lists].find((e) => e.kind === 'workflows' && e.container.contains(act));
297
337
  if (!owner) return;
@@ -316,6 +356,37 @@
316
356
  refreshLists();
317
357
  }
318
358
 
359
+ /** #2644: Delete, or Cancel publishing, a locked Page from its row. Each asks first, as the viewer's buttons do. */
360
+ async function lockedPageAction(act, home, id, button) {
361
+ const page = `/api/pages/${encodeURIComponent(home)}/${encodeURIComponent(id)}`;
362
+ const ok = await bridge.formModal?.(act === 'cancel'
363
+ ? { title: 'Cancel publishing this Page?', sub: 'Its link is not out yet. Cancelling stops it from being published; the Page itself stays.',
364
+ fields: [], okLabel: 'Cancel publishing', danger: false, returnFocusTo: button }
365
+ : { title: 'Delete this Page?', sub: 'Deleting removes its folder and every version in it. This can’t be undone.',
366
+ fields: [], okLabel: 'Delete', danger: true, returnFocusTo: button });
367
+ if (!ok) return;
368
+ try {
369
+ if (act === 'cancel') {
370
+ // Said as the viewer's own Cancel publishing says it: a cancel that found the link already out, or could not reach
371
+ // floless.io, is never reported as cancelled.
372
+ const { outcome } = await api(`${page}/share/cancel`, { method: 'POST' });
373
+ if (outcome === 'cancelled') toast('Publishing cancelled. The link is as it was.', 'ok');
374
+ else if (outcome === 'published') toast('It had already been published, so the link shows it.', 'ok');
375
+ else if (outcome && outcome !== 'nothing-to-do') toast(outcomeSentence(outcome), 'warn');
376
+ } else {
377
+ const body = await api(page, { method: 'DELETE' });
378
+ announceDeleted(home, id);
379
+ // As the viewer's Delete says it: a shared link floless.io could not be told about yet is still online.
380
+ if (body?.revokePending === true) {
381
+ toast('Page deleted. Its link will be revoked as soon as FloLess can reach floless.io; you can see it in My shared links.', 'warn');
382
+ } else toast('Page deleted.', 'ok');
383
+ }
384
+ } catch (err) {
385
+ toast(`FloLess couldn’t ${act === 'cancel' ? 'cancel publishing' : 'delete it'}. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
386
+ }
387
+ refreshLists();
388
+ }
389
+
319
390
  // ── Viewer ───────────────────────────────────────────────────────────────────────────────────────
320
391
 
321
392
  const $modal = document.getElementById('page-viewer');
@@ -522,7 +593,7 @@
522
593
  $loading.hidden = true;
523
594
  });
524
595
 
525
- async function openViewer(home, id, n, returnFocus) {
596
+ async function openViewer(home, id, n, returnFocus, opts = {}) {
526
597
  const seq = ++view.openSeq;
527
598
  let body;
528
599
  try {
@@ -533,6 +604,14 @@
533
604
  if (['page-damaged', 'page-not-found'].includes(err?.body?.code) && typeof window.flolessWorkspaces?.openPagesHome === 'function') {
534
605
  if (await window.flolessWorkspaces.openPagesHome(home, id, closeViewer)) return true;
535
606
  }
607
+ // #2644: a Page a locked Drawing Checker or Steel Model workflow made does not open. Say why, and go to its row in the
608
+ // Pages list, where its Delete (and Cancel publishing) still are: AI Chat's delete hands the person this screen.
609
+ const locked = err?.status === 403 && typeof err.body?.userMessage === 'string' ? err.body.userMessage.trim() : '';
610
+ if (locked) {
611
+ toast(locked, 'warn');
612
+ if (typeof window.flolessWorkspaces?.openPagesHome === 'function' && await window.flolessWorkspaces.openPagesHome(home, id, closeViewer)) return true;
613
+ return false;
614
+ }
536
615
  toast(`FloLess couldn’t open this Page. ${err?.body?.error || 'Try again in a moment.'}`, 'warn');
537
616
  return false;
538
617
  }
@@ -558,7 +637,11 @@
558
637
  if (found === 'known') view.n = n;
559
638
  else note = found === 'gone' ? goneNote(n) : failedNote(n, found);
560
639
  }
561
- view.returnFocus = returnFocus instanceof HTMLElement ? returnFocus : document.activeElement;
640
+ // #2706: a caller that has to close something first (the run viewer) does it here, once the Page is known to open, so a
641
+ // Page that cannot be opened leaves that screen as it was. Focus then returns to whatever the caller put back.
642
+ if (typeof opts.beforeShow === 'function') await opts.beforeShow();
643
+ if (seq !== view.openSeq) return false;
644
+ view.returnFocus = !opts.beforeShow && returnFocus instanceof HTMLElement ? returnFocus : document.activeElement;
562
645
  view.linkAsk = null;
563
646
  view.blocked.clear();
564
647
  view.kept.clear();
@@ -575,7 +658,13 @@
575
658
  $modal.classList.add('show');
576
659
  loadFrame();
577
660
  $close.focus();
578
- void loadShare();
661
+ if (opts.share) {
662
+ // #2706: the run viewer's Share lands here with the share menu open for the version that run made, so it is the
663
+ // same menu, link and confirmation as this viewer's own Share. The menu opens once the link's state is known.
664
+ await loadShare();
665
+ // Not over something the person opened meanwhile (the version list, the site list).
666
+ if (seq === view.openSeq && isOpen() && $versionPop.hidden && $sitesPop.hidden) showSharePop();
667
+ } else void loadShare();
579
668
  return true;
580
669
  }
581
670
 
@@ -1001,7 +1090,7 @@
1001
1090
  parts.push(`<div class="pv-share-row">${`<button type="button" class="ghost" data-command-id="shell.page-share-open-link" data-share-act="open">${esc('Open link')}</button>`}</div>`);
1002
1091
  }
1003
1092
  const shown = view.n;
1004
- // floless.io can't draw the order label yet, so a version whose order FloLess did not read carries it in the title.
1093
+ // Row 6b: floless.io draws the order label beside the link's title; this says so for the version being published.
1005
1094
  const shownVersion = view.known.find((x) => x.n === shown);
1006
1095
  const shownSeq = shownVersion?.sequence;
1007
1096
  // #2262 slice 3c: a whole complete report says what leaves the computer before it is shared.
@@ -1010,9 +1099,11 @@
1010
1099
  ? '<p class="pv-pop-note pv-share-whole-report">This version holds the whole model property report — every property in it will be on the link.</p>'
1011
1100
  : '<p class="pv-pop-note pv-share-whole-report">This version is only a summary of the report, so only the summary will be on the link.</p>');
1012
1101
  }
1013
- if (shownSeq && (shownSeq.order !== 'read' || shownSeq.partial)) {
1014
- const suffix = shownSeq.order === 'read' ? 'order partly read' : shownSeq.order === 'assumed' ? 'order assumed' : shownSeq.order === 'unverified' ? 'order not checked' : 'order unreadable';
1015
- parts.push(`<p class="pv-pop-note pv-share-seq">The shared link’s title will end with “ · ${esc(suffix)}”, because floless.io can’t show the order label yet.</p>`);
1102
+ // #2262 6b: floless.io shows every order as a chip (owner ruling 2026-10-23), so the note says so for every labelled
1103
+ // version; only an order not fully read keeps the warning colour.
1104
+ if (shownSeq) {
1105
+ const fullyRead = shownSeq.order === 'read' && !shownSeq.partial;
1106
+ parts.push(`<p class="pv-pop-note pv-share-seq${fullyRead ? ' is-read' : ''}">Publishing this version shows its order label (${esc(seqLabel(shownSeq))}) on the link.</p>`);
1016
1107
  }
1017
1108
  if (!s || s.state === 'revoked') {
1018
1109
  parts.push(`<div class="pv-share-row">${`<button type="button" class="pv-share-primary" data-command-id="shell.page-share-create" data-share-act="create">${esc(s ? `Share ${verLabel(shown)} again` : `Share ${verLabel(shown)}`)}</button>`}</div>`);
@@ -1051,7 +1142,11 @@
1051
1142
  } else if (st.error) {
1052
1143
  kind = 'blocked';
1053
1144
  text = esc(st.error.message);
1054
- if (st.error.code === 'quota') actions = `<button type="button" class="ghost" data-command-id="shell.shared-links-open" data-share-act="mine">${esc('My shared links')}</button>`;
1145
+ if (st.error.code === 'quota') {
1146
+ actions = `<button type="button" class="ghost" data-command-id="shell.shared-links-open" data-share-act="mine">${esc('My shared links')}</button>`;
1147
+ // More space is a plan away, except on Enterprise (already the largest); an unknown plan is offered it too.
1148
+ if (st.error.quota?.plan !== 'enterprise') actions += `<button type="button" class="ghost" data-command-id="shell.page-share-plans" data-share-act="plans">${esc('See plans')}</button>`;
1149
+ }
1055
1150
  else if (st.error.code === 'no_subscription') actions = `<button type="button" class="ghost" data-command-id="shell.page-share-plans" data-share-act="plans">${esc('See plans')}</button>`;
1056
1151
  else if (st.error.code === 'share-too-large' && st.error.path) actions = `<button type="button" class="ghost" data-command-id="shell.page-share-reveal" data-share-act="reveal">${esc('Reveal in folder')}</button>`;
1057
1152
  else if (['offline', 'rate_limited', 'in_progress', 'signed_out'].includes(st.error.code)) actions = `<button type="button" class="ghost" data-command-id="shell.page-share-retry" data-share-act="retry">${esc('Try again')}</button>`;
@@ -1120,7 +1215,18 @@
1120
1215
  }
1121
1216
 
1122
1217
  /** The words for a failure the server answered with, in the person's terms. */
1123
- function outcomeSentence(code) {
1218
+ // #2262 5e: the space for shared files depends on the plan (Trial 50 MB, Solo 200 MB, Enterprise 1 GB), so every
1219
+ // figure comes from floless.io's answer; nothing here knows a limit. An older floless.io names no plan.
1220
+ const PLAN_NAME = { trial: 'Trial', solo: 'Solo', enterprise: 'Enterprise' };
1221
+ const spaceSize = (b) => (b >= 1024 ** 3 ? `${+(b / 1024 ** 3).toFixed(1)} GB` : b > 0 && b < 1024 ** 2 / 2 ? 'under 1 MB' : `${Math.round(b / 1024 ** 2)} MB`);
1222
+ const spaceUsed = (q) => `${spaceSize(q.usedBytes)} of ${spaceSize(q.quotaBytes)}`;
1223
+ function quotaSentence(quota) {
1224
+ const numbers = quota ? ` (${spaceUsed(quota)}${PLAN_NAME[quota.plan] ? ` on your ${PLAN_NAME[quota.plan]} plan` : ''})` : '';
1225
+ const more = quota?.plan === 'enterprise' ? '' : ', or see plans for more space';
1226
+ return `floless.io’s space for your shared links’ files is full${numbers}, so this link wasn’t published. Revoke links you no longer need in My shared links${more}, then share again.`;
1227
+ }
1228
+
1229
+ function outcomeSentence(code, quota = null) {
1124
1230
  return ({
1125
1231
  signed_out: 'You’re signed out of FloLess, so the link wasn’t published. Sign in, then try again; FloLess keeps the request until then.',
1126
1232
  no_subscription: 'Sharing a link needs a FloLess plan, so this Page wasn’t shared. Your Page is unchanged.',
@@ -1134,7 +1240,7 @@
1134
1240
  revoked: 'This link was revoked from somewhere else, so it can’t show new versions. Share the Page again to make a new link.',
1135
1241
  not_found: 'floless.io no longer has this link. Share the Page again to make a new link.',
1136
1242
  damaged: 'One of this version’s files is damaged on this computer, so nothing was published. Share another version, or save this one again with its files.',
1137
- quota: 'floless.io’s space for your shared links’ files is full (1 GB), so this link wasn’t published. Revoke links you no longer need in My shared links, then share again.',
1243
+ quota: quotaSentence(quota),
1138
1244
  })[code] || '';
1139
1245
  }
1140
1246
 
@@ -1164,6 +1270,7 @@
1164
1270
  view.shareSeq += 1;
1165
1271
  adoptShare(body.page);
1166
1272
  view.share = { ...(view.share || {}), share: body.share, error: null };
1273
+ view.shareQuota = body.quota || null;
1167
1274
  return body.outcome;
1168
1275
  } catch (err) {
1169
1276
  if (!current()) { if (view.page?.id === id && isOpen()) void loadShare(); return null; }
@@ -1172,11 +1279,13 @@
1172
1279
  if (answer?.outcome && answer.page) {
1173
1280
  // An answer, not a failure: the share published nothing and says why (needs a plan, too large, …), with the Page's record.
1174
1281
  adoptShare(answer.page);
1282
+ view.shareQuota = answer.quota || null;
1175
1283
  view.share = { ...(view.share || {}), share: answer.share,
1176
1284
  error: answer.outcome === 'share-too-large' ? { code: 'share-too-large', message: answer.reason, path: answer.path || null } : null };
1177
1285
  return answer.outcome;
1178
1286
  }
1179
1287
  const code = err?.body?.code || 'offline';
1288
+ view.shareQuota = err?.body?.quota || null;
1180
1289
  const path = code === 'share-too-large' && (payload?.version ?? latestN()) === latestN() ? view.share?.eligibility?.path || null : null;
1181
1290
  view.share = { ...(view.share || {}), error: { code, message: err?.body?.error || outcomeSentence('offline'), path } };
1182
1291
  return null;
@@ -1261,9 +1370,10 @@
1261
1370
  } else if (outcome === 'revoke-pending') {
1262
1371
  toast('This link is being revoked, so the new version wasn’t published.', 'warn');
1263
1372
  } else if (outcome && outcome !== 'published') {
1264
- const sentence = outcomeSentence(outcome);
1373
+ const quota = outcome === 'quota' ? view.shareQuota || null : null;
1374
+ const sentence = outcomeSentence(outcome, quota);
1265
1375
  if (['no_subscription', 'too_large', 'quota', 'damaged', 'cancelled', 'reused', 'unsupported', 'revoked', 'not_found'].includes(outcome)) {
1266
- view.share = { ...(view.share || {}), error: { code: outcome, message: sentence, path: null } };
1376
+ view.share = { ...(view.share || {}), error: { code: outcome, message: sentence, path: null, quota } };
1267
1377
  paintBanner();
1268
1378
  } else if (sentence) toast(sentence, 'warn');
1269
1379
  }
@@ -1274,13 +1384,17 @@
1274
1384
  $share.setAttribute('aria-expanded', 'false');
1275
1385
  }
1276
1386
 
1277
- $share.addEventListener('click', () => {
1278
- if (!$sharePop.hidden) { closePopovers(); return; }
1387
+ function showSharePop() {
1279
1388
  closePopovers();
1280
1389
  paintSharePop();
1281
1390
  $sharePop.hidden = false;
1282
1391
  $share.setAttribute('aria-expanded', 'true');
1283
1392
  ($sharePop.querySelector('.pv-share-primary') || $sharePop.querySelector('button'))?.focus();
1393
+ }
1394
+
1395
+ $share.addEventListener('click', () => {
1396
+ if (!$sharePop.hidden) { closePopovers(); return; }
1397
+ showSharePop();
1284
1398
  });
1285
1399
 
1286
1400
  async function onShareAct(act, button) {
@@ -1347,12 +1461,46 @@
1347
1461
  const $slNote = document.getElementById('sl-note');
1348
1462
  const $slMore = document.getElementById('sl-more');
1349
1463
  const $slClose = document.getElementById('sl-close');
1350
- const sl = { next: null, rows: [], local: [], returnFocus: null, loading: false };
1464
+ const $slUsage = document.getElementById('sl-usage');
1465
+ const $slUsageValue = document.getElementById('sl-usage-value');
1466
+ const $slMeter = document.getElementById('sl-meter');
1467
+ const $slMeterFill = document.getElementById('sl-meter-fill');
1468
+ const $slUsageStatus = document.getElementById('sl-usage-status');
1469
+ const $slPlans = document.getElementById('sl-plans');
1470
+ // `gen` numbers each list request: a refresh (after a revoke) supersedes any older answer still in flight, so a
1471
+ // late "Show more" can never repaint the space as it was before the revoke.
1472
+ const sl = { next: null, rows: [], local: [], returnFocus: null, loading: false, gen: 0 };
1473
+
1474
+ /** The space block: what is used of the plan's limit, a meter, and the way to more space (#2262 5e). */
1475
+ function slPaintUsage(usage) {
1476
+ if (!$slUsage) return;
1477
+ $slUsage.hidden = !usage;
1478
+ if (!usage) return;
1479
+ const plan = PLAN_NAME[usage.plan] || '';
1480
+ const ratio = usage.quotaBytes > 0 ? usage.usedBytes / usage.quotaBytes : 1;
1481
+ const level = ratio >= 1 ? 'full' : ratio >= 0.9 ? 'almost' : 'ok';
1482
+ const value = `${spaceUsed(usage)}${plan ? ` · ${plan} plan` : ''}`;
1483
+ const enterprise = usage.plan === 'enterprise';
1484
+ $slUsageValue.textContent = value;
1485
+ $slUsage.dataset.level = level;
1486
+ $slMeter.setAttribute('aria-valuemax', String(Math.max(usage.quotaBytes, 1)));
1487
+ $slMeter.setAttribute('aria-valuenow', String(Math.min(usage.usedBytes, Math.max(usage.quotaBytes, 1))));
1488
+ $slMeter.setAttribute('aria-valuetext', `${spaceUsed(usage)} used${plan ? `, ${plan} plan` : ''}`);
1489
+ // A little usage still shows: at least 2% of the bar once anything is stored.
1490
+ $slMeterFill.style.width = `${usage.usedBytes > 0 ? Math.max(2, Math.min(100, ratio * 100)) : 0}%`;
1491
+ $slUsageStatus.textContent = level === 'full'
1492
+ ? (enterprise ? 'Full. Revoke links you no longer need to publish again.' : 'Full. New links can’t be published until you free space or move to a larger plan.')
1493
+ : level === 'almost' ? (enterprise ? 'Almost full. Revoke links you no longer need.' : 'Almost full. Revoke links you no longer need, or see plans for more space.') : '';
1494
+ $slUsageStatus.hidden = level === 'ok';
1495
+ $slPlans.hidden = enterprise || level === 'ok';
1496
+ }
1351
1497
 
1352
1498
  const CHIP = { live: 'Live', 'pending-publish': 'Publishing', 'pending-revoke': 'Revoke waiting', revoked: 'Revoked' };
1353
1499
 
1354
1500
  function slRowHtml(row) {
1355
1501
  const chip = row.state ? `<span class="sl-chip" data-state="${esc(row.state)}">${esc(CHIP[row.state] || '')}</span>` : '';
1502
+ // The chip describes the link's own version as floless.io holds it, never the local Page's latest (row 6b).
1503
+ const seq = row.sequence ? `<span class="pg-seq-chip${row.sequence.order !== 'read' || row.sequence.partial ? ' is-warn' : ''}" tabindex="0" data-tip="${esc(row.sequence.sentence)}">${esc(seqLabel(row.sequence))}</span>` : '';
1356
1504
  const ai = row.aiMade ? '<span class="pg-ai-badge" tabindex="0" data-tip="Made by AI. FloLess doesn’t check its figures or statements.">AI-made</span>' : '';
1357
1505
  const titleCell = row.page && !row.deleted
1358
1506
  ? `<button type="button" class="sl-title-open" data-command-id="shell.shared-link-page#${esc(row.title)}" data-sl-act="page" data-home="${esc(row.page.home)}" data-page="${esc(row.page.pageId)}">${esc(row.title || 'Untitled Page')}</button>`
@@ -1363,7 +1511,7 @@
1363
1511
  <button type="button" class="ghost" data-command-id="shell.shared-link-open#${esc(row.title)}" data-sl-act="open" data-url="${esc(row.url)}">Open</button>
1364
1512
  <button type="button" class="ghost sl-revoke" data-command-id="shell.shared-link-revoke#${esc(row.title)}" data-sl-act="revoke" data-token="${esc(row.token)}" data-title="${esc(row.title)}">Revoke</button>` : '';
1365
1513
  return `<div class="pg-row sl-row" role="listitem">
1366
- <div class="pg-row-text sl-row-text"><span class="pg-row-line">${titleCell}${ai}${chip}</span>
1514
+ <div class="pg-row-text sl-row-text"><span class="pg-row-line">${titleCell}${ai}${seq}${chip}</span>
1367
1515
  <span class="pg-row-meta" ${row.when ? `data-tip="${esc(when(row.when))}"` : ''}>${esc(row.meta)}</span></div>
1368
1516
  <div class="sl-actions">${actions}</div></div>`;
1369
1517
  }
@@ -1377,7 +1525,7 @@
1377
1525
  byToken.delete(r.token);
1378
1526
  const state = r.revoked ? 'revoked' : (mine?.share?.state === 'pending-revoke' ? 'pending-revoke' : 'live');
1379
1527
  const kind = r.kind === 'page' ? `Page link · link version ${r.remoteVersion}` : 'Report link';
1380
- return { token: r.token, url: r.url, title: mine?.title || r.title, aiMade: r.aiMade, state, page: mine ? { home: mine.home, pageId: mine.pageId } : null,
1528
+ return { token: r.token, url: r.url, title: r.title || mine?.title, aiMade: r.aiMade, sequence: r.sequence || null, state, page: mine ? { home: mine.home, pageId: mine.pageId } : null,
1381
1529
  deleted: !!mine?.deleted, when: r.updatedAt || r.createdAt, meta: `${kind} · updated ${ago(r.updatedAt || r.createdAt)}` };
1382
1530
  });
1383
1531
  return rows;
@@ -1394,12 +1542,14 @@
1394
1542
  }
1395
1543
 
1396
1544
  async function slLoad(more) {
1397
- if (sl.loading) return;
1545
+ if (more && sl.loading) return;
1546
+ const gen = ++sl.gen;
1398
1547
  sl.loading = true;
1399
1548
  $slMore.setAttribute('aria-busy', 'true');
1400
1549
  try {
1401
1550
  const q = more && sl.next ? `?before=${encodeURIComponent(sl.next)}` : '';
1402
1551
  const body = await api(`/api/pages/shared-links${q}`);
1552
+ if (gen !== sl.gen) return;
1403
1553
  if (!more) { sl.rows = []; sl.local = body.local || []; }
1404
1554
  const remote = body.remote?.ok ? body.remote.links : [];
1405
1555
  sl.next = body.remote?.ok ? body.remote.next : null;
@@ -1407,10 +1557,10 @@
1407
1557
  const tokens = new Set(sl.rows.map((r) => r.token));
1408
1558
  const localOnly = !body.remote?.ok || !sl.next ? slLocalOnly(sl.local, tokens) : [];
1409
1559
  // Slice 5: how much of the person's space for shared files is used (revoking a link frees what only it used).
1410
- const usage = body.remote?.ok ? body.remote.usage : null;
1411
- const size = (b) => (b >= 1024 ** 3 ? `${(b / 1024 ** 3).toFixed(1)} GB` : `${Math.round(b / 1024 ** 2)} MB`);
1412
- $slNote.hidden = !!body.remote?.ok && !usage;
1413
- $slNote.textContent = body.remote?.ok ? (usage ? `${usage.usedBytes >= usage.quotaBytes * 0.9 ? 'Almost full. ' : ''}Files kept on floless.io for your shared links: ${size(usage.usedBytes)} of ${size(usage.quotaBytes)}. Space a revoked link used alone is freed within a day.` : '') : (body.remote?.error === 'signed_out'
1560
+ // Signed out or offline: the note says so and no space is shown, rather than an old figure.
1561
+ slPaintUsage(body.remote?.ok ? body.remote.usage || null : null);
1562
+ $slNote.hidden = !!body.remote?.ok;
1563
+ $slNote.textContent = body.remote?.ok ? '' : (body.remote?.error === 'signed_out'
1414
1564
  ? 'You’re signed out, so FloLess can’t check floless.io. This shows the links this computer knows about. Sign in to see all of them.'
1415
1565
  : 'FloLess couldn’t reach floless.io, so this shows the links this computer knows about.');
1416
1566
  const all = [...sl.rows, ...localOnly];
@@ -1418,11 +1568,15 @@
1418
1568
  : '<p class="pg-empty sl-empty">No shared links yet. Share a Page from its viewer with the Share button.</p>';
1419
1569
  $slMore.hidden = !sl.next;
1420
1570
  } catch (err) {
1571
+ if (gen !== sl.gen) return;
1572
+ slPaintUsage(null);
1421
1573
  $slNote.hidden = false;
1422
1574
  $slNote.textContent = `FloLess couldn’t list your shared links. ${err?.body?.error || 'Try again in a moment.'}`;
1423
1575
  } finally {
1424
- sl.loading = false;
1425
- $slMore.removeAttribute('aria-busy');
1576
+ if (gen === sl.gen) {
1577
+ sl.loading = false;
1578
+ $slMore.removeAttribute('aria-busy');
1579
+ }
1426
1580
  }
1427
1581
  }
1428
1582
 
@@ -1445,6 +1599,7 @@
1445
1599
  if ($sl) {
1446
1600
  $slClose.addEventListener('click', closeSharedLinks);
1447
1601
  $slMore.addEventListener('click', () => { void slLoad(true); });
1602
+ $slPlans?.addEventListener('click', () => { window.open(PLANS_URL, '_blank', 'noopener'); });
1448
1603
  if (typeof window.onBackdropDismiss === 'function') window.onBackdropDismiss($sl, closeSharedLinks);
1449
1604
  $sl.addEventListener('keydown', (event) => {
1450
1605
  if (event.key === 'Escape') { event.stopPropagation(); closeSharedLinks(); return; }
@@ -1544,7 +1699,7 @@
1544
1699
  renderWorkflowsList,
1545
1700
  repaintWorkflowsList,
1546
1701
  openSharedLinks: (returnFocus) => openSharedLinks(returnFocus),
1547
- open: (home, id, n) => openViewer(home, id, n ?? null, document.activeElement),
1702
+ open: (home, id, n, opts) => openViewer(home, id, n ?? null, document.activeElement, opts || {}),
1548
1703
  refresh: refreshLists,
1549
1704
  /** The server changed this Page's record (a failed live session's labels): an open copy re-reads it. */
1550
1705
  reloadIfOpen: (home, id) => {
@@ -242,9 +242,19 @@
242
242
  // distinct from "no run yet" — don't tell the user to run something that DID run.
243
243
  const traceUnreadable = (payload) =>
244
244
  !!(payload && typeof payload === 'object' && payload.traceUnreadable === true);
245
+ // #2644: a Drawing Checker or Steel Model workflow this account's plan does not include: its run is not shown, and
246
+ // the panel says why in the module's own words (never "run it", which would not help).
247
+ function moduleRefusedHtml(payload) {
248
+ if (!payload || typeof payload !== 'object' || payload.moduleRefused !== true) return null;
249
+ const sentence = typeof payload.userMessage === 'string' && payload.userMessage.trim() ? payload.userMessage.trim()
250
+ : 'this workflow is part of a module this account’s plan does not include.';
251
+ return placeholderHtml(`Locked: ${sentence}`);
252
+ }
245
253
 
246
254
  function tableHtml(b) {
247
255
  const payload = payloadFor(b.source);
256
+ const locked = moduleRefusedHtml(payload);
257
+ if (locked) return locked;
248
258
  if (traceUnreadable(payload)) {
249
259
  return placeholderHtml(`The last run of “${String(b.source ?? '')}” finished, but its trace couldn’t be read — re-run to refresh this table.`);
250
260
  }
@@ -297,6 +307,8 @@
297
307
  function reportHtml(b) {
298
308
  const payload = payloadFor(b.source);
299
309
  const title = typeof b.title === 'string' && b.title ? b.title : String(b.source ?? 'Report');
310
+ const locked = moduleRefusedHtml(payload);
311
+ if (locked) return locked;
300
312
  if (traceUnreadable(payload)) {
301
313
  return placeholderHtml(`The last run of “${String(b.source ?? '')}” finished, but its trace couldn’t be read — re-run to refresh this report.`);
302
314
  }
@@ -321,6 +333,7 @@
321
333
  let disabled = ' disabled';
322
334
  let tip;
323
335
  if (!gate || gate.state === 'loading') tip = 'Checking workflow state…';
336
+ else if (gate.locked) tip = `Locked: ${gate.locked}`;
324
337
  else if (gate.missing) tip = `Blocked: workflow “${appId}” is not installed.`;
325
338
  else if (!gate.runnable) {
326
339
  // The same stale-lock language the header Run button teaches.
@@ -451,7 +464,12 @@
451
464
  appGate.set(id, { state: 'loading' });
452
465
  api(`/api/app/${encodeURIComponent(id)}`)
453
466
  .then(({ app }) => appGate.set(id, { state: 'ready', runnable: !!app.runnable, runState: app.runState, missing: false }))
454
- .catch(() => appGate.set(id, { state: 'ready', runnable: false, runState: 'uncompiled', missing: true }))
467
+ // #2644: a module workflow this account's plan does not include answers 403 with its own sentence; it is
468
+ // locked, not missing, so the panel says that instead of "not installed".
469
+ .catch((e) => {
470
+ const locked = e?.status === 403 && typeof e.body?.userMessage === 'string' ? e.body.userMessage.trim() : '';
471
+ appGate.set(id, { state: 'ready', runnable: false, runState: 'uncompiled', missing: !locked, locked });
472
+ })
455
473
  .then(() => renderActiveSurfaces());
456
474
  }
457
475
  }
@@ -217,6 +217,23 @@
217
217
  </li>`;
218
218
  }
219
219
 
220
+ /**
221
+ * The workflows that only belong to this project, as a note after the lists (not a list of its own): the project's
222
+ * Workflows step lists them, with their state and last run.
223
+ */
224
+ function ownedSummaryHtml(owned) {
225
+ if (!owned.length) return '';
226
+ const archived = owned.filter((w) => w.archived).length;
227
+ const active = owned.length - archived;
228
+ const what = active
229
+ ? `${plural(active, 'workflow belongs', 'workflows belong')} to this project${archived ? ` (and ${archived} archived)` : ''}. `
230
+ + `${active === 1 ? 'It is' : 'They are'} listed with ${active === 1 ? 'its' : 'their'} last run on the project’s Workflows step.`
231
+ : `${plural(archived, 'archived workflow belongs', 'archived workflows belong')} to this project. `
232
+ + `${archived === 1 ? 'It is' : 'They are'} under Archived on the project’s Workflows step.`;
233
+ return `<div class="pa-owned"><p class="pa-owned-line">${esc(what)}</p>
234
+ <button type="button" class="pa-btn" data-pa-go="workflows" data-command-id="shell.project-access-go-workflows">Show on the Workflows step</button></div>`;
235
+ }
236
+
220
237
  function group(id, title, rows, renderRow, selectable) {
221
238
  if (!rows.length) return '';
222
239
  const keys = selectable ? rows.map(selectable).filter(Boolean) : [];
@@ -257,6 +274,16 @@
257
274
  return lines.length ? `<div class="pa-note" role="status">${lines.map((line) => `<p>${esc(line)}</p>`).join('')}</div>` : '';
258
275
  }
259
276
 
277
+ // #2470 R6.7: the General projects that list this one on their Modules step. Information only: a link reaches nothing
278
+ // and gives nothing, so there is no switch — Open goes to that project.
279
+ function linkedFromHtml() {
280
+ const rows = state.data?.linkedFrom || [];
281
+ // Said when it could not be checked: no line must never be read as "no General project links this one".
282
+ if (state.data?.linkedFromUnchecked) return '<div class="pa-note pa-linked" role="note"><p>FloLess couldn’t check which General projects list this one just now. Try again in a moment.</p></div>';
283
+ if (!rows.length) return '';
284
+ return '<div class="pa-note pa-linked" role="note">' + rows.map((p) => `<p>Linked from the General project “${esc(p.name)}” <button type="button" class="pa-btn" data-pa-linked-open="${esc(p.id)}" data-command-id="shell.project-access-linked-open#${esc(p.id)}" data-command-instance-label="${esc(p.name)}" data-tip="Opens that General project on its Modules step">Open</button></p>`).join('') + '</div>';
285
+ }
286
+
260
287
  function paint() {
261
288
  $sub.textContent = `Agents, schedules and workflows that reach into “${state.project?.name || 'this project'}”.`;
262
289
  if (state.loading && !state.data) { $body.innerHTML = skeleton(); $body.setAttribute('aria-busy', 'true'); paintBar(); return; }
@@ -268,14 +295,20 @@
268
295
  }
269
296
  const agents = agentRows();
270
297
  const schedules = state.data?.schedules || [];
271
- const workflows = state.data?.workflows || [];
298
+ const all = state.data?.workflows || [];
299
+ // #2470 R6.2: where the project has a Workflows step, the workflows that only belong to it are listed there; this
300
+ // sheet says how many and links to it, and keeps listing in full what the step does not show (an Agent step on this
301
+ // project, a workflow built from its Knowledge). Without that step (the other project kinds, for now) all are listed.
302
+ const stepped = window.flolessWorkspaces?.projectHasStep?.('workflows') === true;
303
+ const ownedOnly = stepped ? all.filter((w) => w.bindings.length === 1 && w.bindings[0] === 'owner') : [];
304
+ const workflows = stepped ? all.filter((w) => !ownedOnly.includes(w)) : all;
272
305
  const notes = staleHtml() + uncheckedHtml();
273
- if (!agents.length && !schedules.length && !workflows.length && notes) {
306
+ if (!agents.length && !schedules.length && !all.length && notes) {
274
307
  // Nothing listed, but something could not be read: say that, never "nothing has access".
275
- $body.innerHTML = notes; paintBar(); return;
308
+ $body.innerHTML = linkedFromHtml() + notes; paintBar(); return;
276
309
  }
277
- if (!agents.length && !schedules.length && !workflows.length) {
278
- $body.innerHTML = `<div class="pa-empty"><p class="pa-empty-title">Nothing has access to this project yet.</p>
310
+ if (!agents.length && !schedules.length && !all.length) {
311
+ $body.innerHTML = linkedFromHtml() + `<div class="pa-empty"><p class="pa-empty-title">Nothing has access to this project yet.</p>
279
312
  <p>Add it to an Agent’s “Where it works” on the Agents tab, or schedule a workflow on it.</p>
280
313
  <div class="pa-empty-actions">
281
314
  <button type="button" class="pa-btn" data-pa-go="agents" data-command-id="shell.project-access-go-agents">Open Agents</button>
@@ -283,10 +316,11 @@
283
316
  </div></div>`;
284
317
  paintBar(); return;
285
318
  }
286
- $body.innerHTML = staleHtml() + uncheckedHtml()
319
+ $body.innerHTML = linkedFromHtml() + staleHtml() + uncheckedHtml()
287
320
  + group('agents', 'Agents that can work here', agents, agentRow, (r) => (switchable(r) ? keyOf('agent', r.agentId) : null))
288
321
  + group('schedules', 'Schedules that run on this project', schedules, scheduleRow, (s) => (s.broken ? null : keyOf('schedule', s.routineId)))
289
- + group('workflows', 'Workflows that use it', workflows, workflowRow, null);
322
+ + group('workflows', 'Workflows that use it', workflows, workflowRow, null)
323
+ + ownedSummaryHtml(ownedOnly);
290
324
  paintBar();
291
325
  // A repaint replaces the control that had focus; keep focus inside the sheet so Escape and Tab still work there.
292
326
  if (isOpen() && (!document.activeElement || document.activeElement === document.body)) $panel?.focus();
@@ -431,7 +465,12 @@
431
465
  state.selected.clear(); state.confirm = null; state.rowError.clear(); state.turnedOff.clear();
432
466
  const target = state.returnFocus;
433
467
  state.returnFocus = null;
434
- if (target && document.contains(target)) target.focus();
468
+ // The control that opened the sheet may have been redrawn meanwhile (a list re-read): find it again by its Instructor
469
+ // id, else the chip, so focus never drops to the page.
470
+ const id = target?.getAttribute?.('data-command-id');
471
+ const again = target && document.contains(target) ? target
472
+ : (id && [...document.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === id)) || ($chip.hidden ? null : $chip);
473
+ again?.focus?.();
435
474
  }
436
475
 
437
476
  async function openItem(key) {
@@ -522,8 +561,28 @@
522
561
  if (el.hasAttribute('data-pa-clear')) { state.selected.clear(); state.confirm = null; paint(); return; }
523
562
  if (el.dataset.paOpen) { void openItem(el.dataset.paOpen); return; }
524
563
  if (el.hasAttribute('data-pa-retry')) { void load(); return; }
564
+ if (el.dataset.paLinkedOpen) {
565
+ const generalId = el.dataset.paLinkedOpen;
566
+ close();
567
+ void Promise.resolve(window.flolessWorkspaces?.openModulesStep?.(generalId)).catch((error) => {
568
+ console.warn('[project-access] the General project could not be opened', error);
569
+ toast('FloLess couldn’t open that General project. Open it from Workspaces.', 'warn');
570
+ });
571
+ return;
572
+ }
525
573
  if (el.dataset.paGo === 'agents') { close(); void window.flolessWorkspaces?.setMode?.('agents'); return; }
526
574
  if (el.dataset.paGo === 'routines') { close(); if (typeof openRoutines === 'function') openRoutines(); }
575
+ if (el.dataset.paGo === 'workflows') {
576
+ const projectId = state.project?.id;
577
+ close();
578
+ void Promise.resolve(window.flolessWorkspaces?.openWorkflowsStep?.(projectId)).then(() => {
579
+ // The keyboard lands where the person was sent: the step's heading.
580
+ document.querySelector('#ws-workflows [data-pw-heading]')?.focus?.();
581
+ }).catch((error) => {
582
+ console.warn('[project-access] the Workflows step could not be opened', error);
583
+ toast('FloLess couldn’t open this project’s Workflows step. Open the project and choose Workflows.', 'warn');
584
+ });
585
+ }
527
586
  });
528
587
 
529
588
  // Something else changed the projects or the workflows: the chip (and an open sheet) read again.