@floless/app 0.134.4 → 0.135.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.
@@ -7,7 +7,7 @@ description: >-
7
7
  two-phase Drawing Filter process: first prepare and save the deterministic Filter, then read only the
8
8
  selected evidence into model-global members, registered plan views, observations, and revision history.
9
9
  metadata:
10
- version: 0.29.1
10
+ version: 0.30.0
11
11
  ---
12
12
 
13
13
  # Steel Takeoff — read drawings into `steel.model/v2`
@@ -119,7 +119,7 @@ The ledger must close all of these inventories:
119
119
  - building massing and coordinate frames were stated before members were interpreted;
120
120
  - every Filter layer was classified, and every human-excluded line weight and colour was classified;
121
121
  - every manifest line is either supported by an active observation or has a reviewed `lineDisposition`;
122
- - every reference marker resolves through the drawing graph to a reviewed page, or names the missing sheet;
122
+ - every `referenceCandidates` row the manifest GET publishes (never a candidate `kind` filter) resolves through the drawing graph to a reviewed page, or names the missing sheet;
123
123
  - every detail/connection marker maps to a real joint/connection, an explicit non-model disposition, or RFI;
124
124
  - every new or changed joint has a dependency review tied to the exact members, recipe, parameters, and details;
125
125
  - every built connection has measured bearing, head/nut contact, grip, bolt length, clash clearance,
@@ -139,11 +139,10 @@ The manifest GET returns derived fields you cannot compute yourself. Copy them e
139
139
  recompute, or omit them.
140
140
 
141
141
  - **`pageShards`** — one `{ pageId, candidateShardHash, candidateCount }` per manifest page. Give every
142
- page **exactly one** review: `{ pageId, kind: "whole", candidateShardHash, note }`. There is no
143
- second review per page, no `bbox`, and no `elementIds` — the server binds the page's own bounds and
144
- its whole candidate set into the shard, so echoing candidate ids proves nothing and the fields are
145
- gone. A missing page, a duplicate `pageId`, a foreign `pageId`, or a hash from another page or an
146
- older manifest blocks `visual-coverage`.
142
+ page **exactly one** review: `{ pageId, kind: "whole", candidateShardHash, note }`. No second review
143
+ per page, no `bbox`, no `elementIds` — the shard already binds the page's bounds and its whole
144
+ candidate set. A missing page, a duplicate `pageId`, a foreign `pageId`, or a hash from another page
145
+ or an older manifest blocks `visual-coverage`.
147
146
  - **`layerLineCounts`** — each `layers[]` row carries `lineCounts: { model, evidence }`, the number of
148
147
  ledger lines that layer holds on model pages and on evidence-only pages. The server recomputes both
149
148
  and `layer-census` blocks on any mismatch. A layer with non-zero counts on **both** roles means one
@@ -164,14 +163,12 @@ recompute, or omit them.
164
163
  When **`strained`** is `true`, writing one explicit row for every line would not fit: this set only
165
164
  works if observations, the wholesale shorthand and grouping between them save enough bytes. Model
166
165
  what is genuinely a member, dismiss wholesale what the Filter authorises, group the rest by shared
167
- reason — and tell the human up front if none of those will be enough. `impossible` is a sound
168
- refusal, not a complete detector: a set can pass it and still admit no proof that fits, and
169
- `strained` is the signal for exactly that case. The remaining figures are advisory and refuse
170
- nothing.
171
-
172
- `facetExclusions[]` is the thickness/colour sibling of `layers[]`, and it exists because a dismissal is
173
- now decided on a dimension with no semantic name attached — `0.2 pt` says nothing about whether it is
174
- steel, where `A-ANNO-TEXT` at least claims to. Each row is
166
+ reason — and tell the human up front if none of those will be enough. `impossible` is sound but not
167
+ complete: a set can pass it and still admit no proof that fits, which is what `strained` catches.
168
+ The remaining figures are advisory and refuse nothing.
169
+
170
+ `facetExclusions[]` is the thickness/colour sibling of `layers[]`: a dismissal decided on a dimension
171
+ with no semantic name — `0.2 pt` says nothing about whether it is steel. Each row is
175
172
  `{ dim, value, disposition, note, lineCounts }`, with the same five dispositions `layers[]` uses.
176
173
  Attest `member` or `mixed` when a band really does carry steel: that is not a failure, it is the
177
174
  mechanism, and every line failing that dimension on that value then needs its own row.
package/dist/web/aware.js CHANGED
@@ -633,6 +633,13 @@
633
633
  // Declared here, above its first use in api(), rather than beside the recovery helper that reads
634
634
  // it — a `let` referenced before its declaration executes is a TDZ crash, not a false.
635
635
  let awareMaintenanceRefused = false;
636
+ // Reloading or leaving the workspace aborts fetches owned by the retired document. Chromium reports
637
+ // those aborts as the same `TypeError: Failed to fetch` used for a live outage, so remember the page
638
+ // lifecycle and let reportErr() distinguish teardown noise from an error the user can still act on.
639
+ // `pageshow` matters for a document restored from the back-forward cache.
640
+ let awarePageUnloading = false;
641
+ window.addEventListener('pagehide', () => { awarePageUnloading = true; });
642
+ window.addEventListener('pageshow', () => { awarePageUnloading = false; });
636
643
 
637
644
  async function api(path, opts) {
638
645
  const res = await fetch(path, {
@@ -7590,6 +7597,7 @@
7590
7597
  }
7591
7598
 
7592
7599
  function reportErr(e) {
7600
+ if (awarePageUnloading && e instanceof TypeError && e.message === 'Failed to fetch') return;
7593
7601
  console.error(e);
7594
7602
  showToast(e.message || String(e), 'err');
7595
7603
  }
@@ -8210,7 +8218,7 @@
8210
8218
  /** Fields whose change makes the upload handoff modal's guidance or Start policy stale. */
8211
8219
  function requestHelpStateKey(r) {
8212
8220
  if (!r) return '';
8213
- return [r.status, !!r.prepassReady, !!r.filterSaved, !!r.canRun, r.runWhy || '',
8221
+ return [r.status, !!r.prepassReady, !!r.filterCheckpointCurrent, !!r.canRun, r.runWhy || '',
8214
8222
  r.run && r.run.state || '', r.resumeCommand || '', !!r.desktopHandoffs].join('|');
8215
8223
  }
8216
8224
 
@@ -8588,7 +8596,7 @@
8588
8596
  }
8589
8597
  return 'This drawing read uses a status this version of FloLess does not recognize. Update FloLess, then open Requests again. If it still appears, clear it and attach the drawing set again.';
8590
8598
  }
8591
- if (r.filterSaved) {
8599
+ if (r.filterCheckpointCurrent) {
8592
8600
  return 'Drawing Filter saved. Return to the same terminal AI session that prepared it and tell it to continue the drawing read.';
8593
8601
  }
8594
8602
  if (r.prepassReady) {
@@ -8605,7 +8613,7 @@
8605
8613
  if (r.status && r.status !== 'pending') return '';
8606
8614
  if (r.refusalCode === 'steel-manifest-extraction-timeout'
8607
8615
  || r.run?.refusalCode === 'steel-manifest-extraction-timeout') return '';
8608
- if (r.filterSaved) {
8616
+ if (r.filterCheckpointCurrent) {
8609
8617
  return 'Next step: return to the same terminal AI session that prepared this Drawing Filter and tell it to continue the drawing read. Do not start the request again.';
8610
8618
  }
8611
8619
  if (r.prepassReady) {
@@ -907,7 +907,7 @@
907
907
  <span class="rtn-spinner" aria-hidden="true"></span>
908
908
  <div>
909
909
  <p class="rhrs-title" id="request-help-run-title"></p>
910
- <p class="rhrs-sub">This can take a few minutes, and you don’t need to wait. Keep working — the row in Requests updates as it goes.</p>
910
+ <p class="rhrs-sub">Larger drawing sets take longer. You don’t need to wait here — leave FloLess open, and the row in Requests updates as it goes.</p>
911
911
  </div>
912
912
  </div>
913
913
  <div class="request-help-note" id="request-help-note">FloLess cannot start the first read automatically yet: your terminal AI must create the starting project checkpoint, then wait for you to review and save the Drawing Filter. After you save, tell the terminal AI to continue.</div>
@@ -368,7 +368,7 @@ body.publication-blocked #empty{position:static;flex:1}
368
368
  </div>
369
369
  <span id="src" class="stat"></span>
370
370
  <span class="sp"></span>
371
- <span id="saved" class="stat"></span>
371
+ <span id="saved" class="stat" role="status" aria-live="polite" aria-atomic="true"></span>
372
372
  <span id="saveRequiredStatus" class="stat required-step" role="status" aria-live="polite" tabindex="-1" hidden>Ready — press Save filter</span>
373
373
  <button id="save" data-command-id="filter.save" class="primary" disabled>Save filter</button>
374
374
  </header>
@@ -491,9 +491,13 @@ const APP_ID = new URLSearchParams(location.search).get('app') || '';
491
491
  // Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
492
492
  const PROJECT = new URLSearchParams(location.search).get('project') || '';
493
493
  let revisionRequest = new URLSearchParams(location.search).get('revisionRequest') || '';
494
- // Monotonic ownership for async Save results. The id alone cannot distinguish A→empty (A's own
495
- // completion) from A→B→empty (B arrived and was then cleared while A was still in flight).
494
+ let revisionFilterSavedEtag = new URLSearchParams(location.search).get('revisionFilterSavedEtag') || '';
495
+ // Monotonic ownership for async Save results. Saved evidence may advance many times for one request;
496
+ // only an actual A→B/A→empty identity transition increments this generation.
496
497
  let revisionCheckpointGeneration = 0;
498
+ // A request can retain its identity across many exact saved-filter receipts. Decision surfaces and
499
+ // in-flight previews belong to one such receipt, so they need a separate evidence generation.
500
+ let revisionCheckpointEvidenceGeneration = 0;
497
501
  const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
498
502
  const CONTRACT_QS = PROJECT ? (PROJECT_QS + '&quietMissing=1') : PROJECT_QS;
499
503
  const SVGNS = 'http://www.w3.org/2000/svg';
@@ -677,7 +681,8 @@ function setRequiredSaveCue(checkpoint, ready){
677
681
  function syncRequiredSaveCue(){
678
682
  if(saveInFlight){ setRequiredSaveCue(false, false); saveBtn.disabled = true; return; }
679
683
  if(checkpointSaveBlocked){ setRequiredSaveCue(false, false); saveBtn.disabled = true; return; }
680
- const checkpoint = !!revisionRequest && !!C && !!F && !!sel && !conflicted;
684
+ const checkpointCurrent = !!revisionRequest && !!revisionFilterSavedEtag && revisionFilterSavedEtag === serverEtag;
685
+ const checkpoint = !!revisionRequest && !checkpointCurrent && !!C && !!F && !!sel && !conflicted;
681
686
  const ready = checkpoint && sheets.some(sheet => (sheet.elements || []).some(el => matchesActive(el, mode, sel)));
682
687
  setRequiredSaveCue(checkpoint, ready);
683
688
  // The checkpoint always explains the next action, but only a non-empty selection can be saved.
@@ -714,36 +719,50 @@ function setFilterEditingLocked(locked){
714
719
  // Same-origin parent bridge: polling may complete, fail, or clear a checkpoint while this editor has
715
720
  // unsaved facet changes. Update only the checkpoint state and URL; never reload the document away.
716
721
  window.__floRevisionCheckpoint = {
717
- setRequest(value){
722
+ setRequest(value, savedEtag){
718
723
  const nextRequest = String(value || '');
719
- if(nextRequest !== revisionRequest){
724
+ const nextSavedEtag = nextRequest ? String(savedEtag || '') : '';
725
+ const requestChanged = nextRequest !== revisionRequest;
726
+ const evidenceChanged = nextSavedEtag !== revisionFilterSavedEtag;
727
+ // The 3-second poll ordinarily repeats the same projection. It must be a true no-op: retiring
728
+ // focus, repainting the live status, or re-running cue state on every identical tick is churn.
729
+ if(!requestChanged && !evidenceChanged) return true;
730
+ // The contract PUT intentionally invalidates the old receipt before `/filter-saved` can publish
731
+ // the replacement. A poll can observe that E1→empty window while this exact Save owns the editor.
732
+ // Defer only same-request evidence changes: request replacement/settlement must still supersede the
733
+ // Save. The parent honours `false` by preserving its prior iframe target until this Save reports its
734
+ // outcome, so neither the decision state nor the reloadable URL can regress to the transient gap.
735
+ if(saveInFlight && !requestChanged && evidenceChanged) return false;
736
+ if(requestChanged){
720
737
  revisionCheckpointGeneration += 1;
721
- // The sign-off list belongs to the exact checkpoint that opened it. Keeping it visible after
722
- // polling advances to another request would let an old list be approved against the new read
723
- // when the layer names happen to match.
724
- retireSignOffForCheckpointChange();
725
- checkpointSaveBlocked = false;
726
- // Reload-only recovery belongs to the exact checkpoint that failed. If polling advances,
727
- // replaces, or clears that request, remove its stale alert before the new checkpoint can enable
728
- // Save; otherwise the screen simultaneously says “Reload is the only way forward” and offers a
729
- // working Save button. Preserve ordinary unsaved filter state for the new request.
730
- const recovery = document.getElementById('conflictBanner');
731
- if(recovery && recovery.dataset.requiredRecovery === 'true'){
732
- recovery.remove();
733
- lastBanner = undefined;
734
- // `conflicted` belongs to checkpoint A's refused conditional write. Carrying it into B makes
735
- // B look usable while every Save silently reopens A's vanished warning. Retire the latch with
736
- // the exact required-recovery banner; an ordinary external-edit conflict remains untouched.
737
- conflicted = false;
738
- setSaved(dirty ? 'dirty' : '');
739
- }
738
+ }
739
+ revisionCheckpointEvidenceGeneration += 1;
740
+ // The sign-off list belongs to the exact request + saved evidence that opened it. A same-request
741
+ // E1→E2/E1→empty transition is just as invalidating as request replacement: otherwise an old
742
+ // exclusion decision or dismissed refusal can be approved against the newer checkpoint.
743
+ retireSignOffForCheckpointChange();
744
+ checkpointSaveBlocked = false;
745
+ // Reload-only recovery belongs to the exact checkpoint that failed. Retire it on either identity
746
+ // or evidence change while preserving the user's facet selections and ordinary dirty state.
747
+ const recovery = document.getElementById('conflictBanner');
748
+ if(recovery && recovery.dataset.requiredRecovery === 'true'){
749
+ recovery.remove();
750
+ lastBanner = undefined;
751
+ // `conflicted` belongs to the refused conditional write that produced this recovery surface.
752
+ // An unrelated external-edit conflict has no requiredRecovery marker and remains untouched.
753
+ conflicted = false;
740
754
  }
741
755
  revisionRequest = nextRequest;
756
+ revisionFilterSavedEtag = nextSavedEtag;
742
757
  const url = new URL(location.href);
743
758
  if(revisionRequest) url.searchParams.set('revisionRequest', revisionRequest);
744
759
  else url.searchParams.delete('revisionRequest');
760
+ if(revisionFilterSavedEtag) url.searchParams.set('revisionFilterSavedEtag', revisionFilterSavedEtag);
761
+ else url.searchParams.delete('revisionFilterSavedEtag');
745
762
  history.replaceState(null, '', url.pathname + url.search);
763
+ if(!dirty) setSaved(revisionRequest && revisionFilterSavedEtag === serverEtag ? 'saved' : '');
746
764
  syncRequiredSaveCue();
765
+ return true;
747
766
  },
748
767
  };
749
768
 
@@ -1060,6 +1079,7 @@ function initFromFilter(){
1060
1079
  buildFacet('colors', F.colors || [], it => it.hex);
1061
1080
  buildSheetSwitcher();
1062
1081
  setSheet(active);
1082
+ if(revisionRequest && revisionFilterSavedEtag && revisionFilterSavedEtag === serverEtag) setSaved('saved');
1063
1083
  syncRequiredSaveCue();
1064
1084
  }
1065
1085
 
@@ -2305,6 +2325,8 @@ async function saveNow(){
2305
2325
  // the same checkpoint it started, so capture the id once and use it for both requests.
2306
2326
  const checkpointRequest = revisionRequest;
2307
2327
  const checkpointGeneration = revisionCheckpointGeneration;
2328
+ let checkpointEvidenceGeneration = revisionCheckpointEvidenceGeneration;
2329
+ let completedCheckpoint = false;
2308
2330
  try {
2309
2331
  const headers = { 'content-type': 'application/json', 'x-floless-mutation-id': mid };
2310
2332
  // TOTAL, as of P1c: a write with no precondition is refused (428). No tag means we read through the
@@ -2350,6 +2372,18 @@ async function saveNow(){
2350
2372
  // actually returned — assembled there rather than here so this write cannot invent an approval
2351
2373
  // the human never saw.
2352
2374
  if(pendingSignOff) body.exclusionSignOff = pendingSignOff;
2375
+ // The successful contract PUT has already cleared the historical receipt on the server. Adopt
2376
+ // that expected transition locally only AFTER snapshotting the sign-off body: retiring it through
2377
+ // the parent bridge here would erase the approval this very POST must carry. Advance our baseline
2378
+ // so the Save does not mistake its own E1→empty invalidation for a superseding actor.
2379
+ if(revisionRequest === checkpointRequest && revisionFilterSavedEtag){
2380
+ revisionFilterSavedEtag = '';
2381
+ revisionCheckpointEvidenceGeneration += 1;
2382
+ checkpointEvidenceGeneration = revisionCheckpointEvidenceGeneration;
2383
+ const url = new URL(location.href);
2384
+ url.searchParams.delete('revisionFilterSavedEtag');
2385
+ history.replaceState(null, '', url.pathname + url.search);
2386
+ }
2353
2387
  const checkpoint = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(checkpointRequest)}/filter-saved`, {
2354
2388
  method:'POST', headers:{'content-type':'application/json'}, body:JSON.stringify(body),
2355
2389
  });
@@ -2396,19 +2430,31 @@ async function saveNow(){
2396
2430
  throw new Error(payload ? (payload.error || JSON.stringify(payload)) : 'the Drawing Filter checkpoint was refused');
2397
2431
  }
2398
2432
  if(revisionRequest === checkpointRequest){
2399
- revisionRequest = '';
2433
+ revisionFilterSavedEtag = serverEtag;
2434
+ completedCheckpoint = true;
2400
2435
  const url = new URL(location.href);
2401
- url.searchParams.delete('revisionRequest');
2436
+ url.searchParams.set('revisionRequest', revisionRequest);
2437
+ url.searchParams.set('revisionFilterSavedEtag', revisionFilterSavedEtag);
2402
2438
  history.replaceState(null, '', url.pathname + url.search);
2403
2439
  }
2404
2440
  }
2405
2441
  // A newer request can become the required checkpoint after BOTH of A's writes succeeded. A's
2406
2442
  // success is real, but it cannot satisfy B or turn off B's required Save cue. Leave the editor's
2407
2443
  // existing dirty state intact so the user is still told exactly what the new checkpoint needs.
2408
- const checkpointAdvanced = checkpointRequest && revisionCheckpointGeneration !== checkpointGeneration;
2409
- const ownBroadcastClear = checkpointAdvanced && !revisionRequest
2410
- && revisionCheckpointGeneration === checkpointGeneration + 1;
2411
- if(checkpointAdvanced && !ownBroadcastClear){ setSaved(dirty ? 'dirty' : ''); syncRequiredSaveCue(); return; }
2444
+ const checkpointAdvanced = checkpointRequest && (
2445
+ revisionCheckpointGeneration !== checkpointGeneration
2446
+ || revisionCheckpointEvidenceGeneration !== checkpointEvidenceGeneration
2447
+ );
2448
+ if(checkpointAdvanced){ setSaved(dirty ? 'dirty' : ''); syncRequiredSaveCue(); return; }
2449
+ if(completedCheckpoint){
2450
+ revisionCheckpointEvidenceGeneration += 1;
2451
+ // Invalidate every parent `/api/requests` read that began before this receipt committed, adopt
2452
+ // the exact ETag into the iframe target, then let the parent start a fresh authoritative poll.
2453
+ // Without this handshake an older response can replay E1/empty over this local E2 success.
2454
+ globalThis.parent?.flolessWorkspaces?.drawingFilterCheckpointSaved({
2455
+ projectId: PROJECT, requestId: revisionRequest, savedEtag: revisionFilterSavedEtag,
2456
+ });
2457
+ }
2412
2458
  dirty = false; setSaved('saved'); syncRequiredSaveCue();
2413
2459
  } catch(e){
2414
2460
  // The id is deliberately KEPT here. No response arrived, so we do not know whether the write landed —
@@ -55,7 +55,18 @@ export function validateClientSteelModelV2(doc, schema) {
55
55
  // browser. Say it directly rather than leaving it to be inferred from an unresolved control: with the
56
56
  // rows unpairable every reader falls back to the override string, so the controls DO resolve and the
57
57
  // only visible symptom of a rebound axis list would be the dimension and view anchors.
58
- if (axes.filter((a) => object(a) && a.dir === dir).length !== n) issues.push(`grid-axis-count at $.grid.axes`);
58
+ // Both halves of the comparison, named (#918) — the bare `grid-axis-count at $.grid.axes` never
59
+ // said that the entries it counts come from the `$.grid.x`/`$.grid.y` spacing string, so an author
60
+ // who had populated only the axis rows could not act on it.
61
+ //
62
+ // NOT USER-VISIBLE TODAY, and deliberately left that way: these strings become
63
+ // `V2CommandError.details` (steel-model-v2-commands.js), and steel-editor.html toasts only
64
+ // `err.message`. This is PARITY with the server's message, for the debugger and for whatever ever
65
+ // does render `details` — not a fix for anything a user reads. Surfacing the array in the toast
66
+ // would put raw JSON paths in front of a human, which is a worse answer than the generic sentence
67
+ // they get now. (Codex review, #918.)
68
+ const declared = axes.filter((a) => object(a) && a.dir === dir).length;
69
+ if (declared !== n) issues.push(`grid-axis-count at $.grid.axes — $.grid.${dir} parses to ${n} ${dir} ${n === 1 ? 'entry' : 'entries'} but $.grid.axes declares ${declared} ${dir} ${declared === 1 ? 'axis' : 'axes'}`);
59
70
  for (const label of axisLabelsFor(doc.grid, dir, style, n)) counts.set(label, (counts.get(label) || 0) + 1);
60
71
  return counts;
61
72
  };
@@ -1886,7 +1886,7 @@
1886
1886
  // stages until this probe produces a real lifecycle answer.
1887
1887
  if (projectContractLifecycle === 'unknown') return '';
1888
1888
  if (step === 'model') {
1889
- if (waitingForInitial && revCardReq?.filterSaved) return 'The Drawing Filter is saved. Return to the same terminal AI session that prepared it and tell it to continue the drawing read.';
1889
+ if (waitingForInitial && revCardReq?.filterCheckpointCurrent) return 'The Drawing Filter is saved. Return to the same terminal AI session that prepared it and tell it to continue the drawing read.';
1890
1890
  if (waitingForInitial && revCardReq?.prepassReady) return 'Review the selected lines, then press Save filter. After Save, return to the terminal AI that prepared it and tell it to continue.';
1891
1891
  if (waitingForInitial) return 'The initial drawing read is waiting for your terminal AI. The model unlocks after you review the Drawing Filter and press Save filter.';
1892
1892
  if (projectContractLifecycle === 'filter-checkpoint') return 'Attach the drawing set again in Drawing Filter to restart the read. The earlier request is no longer available to receive a saved filter.';
@@ -1962,7 +1962,7 @@
1962
1962
  : `The drawing read failed · ${revCardReq?.clearWhy || 'FloLess cannot safely release this drawing read yet.'} Open Requests for the available recovery.`)
1963
1963
  : unavailableInitial
1964
1964
  ? 'This drawing read uses a status this version of FloLess does not recognize · Open Requests for details and update FloLess before continuing.'
1965
- : waitingForInitial && revCardReq?.filterSaved
1965
+ : waitingForInitial && revCardReq?.filterCheckpointCurrent
1966
1966
  ? 'Stage 1 of 4 complete · The Drawing Filter is saved. Return to the same terminal AI session that prepared it and tell it to continue the drawing read. Model, Exports, and History unlock when it finishes.'
1967
1967
  : waitingForInitial && revCardReq?.prepassReady
1968
1968
  ? 'Stage 1 of 4 · Review the selected layers, line weights, and colours below. Then press Save filter in the top-right corner, return to the terminal AI that prepared it, and tell it to continue. Model, Exports, and History unlock when the read finishes.'
@@ -5605,6 +5605,13 @@
5605
5605
  let revisionOwnerGen = 0; // bumped only when navigation retires actions owned by the current project
5606
5606
  let revisionAttachGen = 0; // newest Attach owns its delayed copy/modal completion within that project
5607
5607
  let revRequestsFailed = false; // one log per outage, not one per 3-second poll tick
5608
+ // A full-page navigation aborts any revision-card fetch that happens to be in flight. Chromium
5609
+ // reports that teardown as `TypeError: Failed to fetch`, indistinguishable from a live outage by
5610
+ // error shape alone. Track the page lifecycle so the retired document does not emit a false console
5611
+ // error; `pageshow` resets the flag when the same document returns from the back-forward cache.
5612
+ let workspacePageUnloading = false;
5613
+ window.addEventListener('pagehide', () => { workspacePageUnloading = true; });
5614
+ window.addEventListener('pageshow', () => { workspacePageUnloading = false; });
5608
5615
  /**
5609
5616
  * Every piece of revision state above is PER-PROJECT, so opening or closing one must clear all of
5610
5617
  * it — and until this existed only `lastRevState` was. What the other three left behind:
@@ -5722,7 +5729,7 @@
5722
5729
 
5723
5730
  function buildPendingCard(req) {
5724
5731
  const n = (req.sourceRefs && req.sourceRefs.length) || (req.snapshots && req.snapshots.length) || 1;
5725
- if (req.prepassReady && req.filterSaved) {
5732
+ if (req.prepassReady && req.filterCheckpointCurrent) {
5726
5733
  const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
5727
5734
  const txt = revEl('span', 'wrc-text');
5728
5735
  txt.appendChild(revEl('b', null, 'Drawing Filter saved.'));
@@ -5749,7 +5756,11 @@
5749
5756
  const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
5750
5757
  const txt = revEl('span', 'wrc-text');
5751
5758
  txt.appendChild(revEl('b', null, `${isInitialRevisionRead(req) ? 'Initial' : 'Updated'} drawing read is running.`));
5752
- txt.appendChild(document.createTextNode(` Your terminal AI is preparing ${n} file${n > 1 ? 's' : ''}. You can keep working in FloLess; progress and the next required step will appear here. Open Requests if you need to stop it.`));
5759
+ // Reachable ONLY for an updated read: `run` exists only for a FloLess-started headless run,
5760
+ // which needs canRun, which run-relay refuses for a first read. So no stage gate applies and
5761
+ // "keep working" is true here. "Leave FloLess open" is load-bearing, not padding - stopAllRuns
5762
+ // kills every spawned run on shutdown.
5763
+ txt.appendChild(document.createTextNode(` Your terminal AI is preparing ${n} file${n > 1 ? 's' : ''}. Leave FloLess open — you can keep working elsewhere in it. Progress and what to do next appear here. Open Requests if you need to stop it.`));
5753
5764
  return [dot, txt];
5754
5765
  }
5755
5766
  // `pending` means the request is waiting for the terminal AI handoff; it does not prove that an
@@ -5763,7 +5774,16 @@
5763
5774
  const handoff = !isInitialRevisionRead(req) && req.canRun
5764
5775
  ? 'Open Requests. If Start automatically is shown, choose it; otherwise copy the request into Claude Code, Codex, or OpenCode.'
5765
5776
  : 'Open Requests and copy the request into Claude Code, Codex, or OpenCode.';
5766
- txt.appendChild(document.createTextNode(` ${n} file${n > 1 ? 's' : ''} queued. ${handoff} Then return here. This may take up to 30 minutes.`));
5777
+ // No numeric cap. "up to 30 minutes" was a promise this card cannot keep: the read runs in
5778
+ // someone else's terminal AI over a drawing set whose size we do not bound, and a stated
5779
+ // ceiling that is routinely blown past reads as a stall or a hang rather than as normal work.
5780
+ // "How long" is unanswerable, so this says what happens NEXT instead - the prepassReady branch
5781
+ // above is the card that replaces this one, and startRevisionPoll repaints every 3s.
5782
+ // Deliberately carries NO "keep working meanwhile" either. Unlike the running card, this one
5783
+ // renders for an INITIAL read, where stageGateFor locks Model/Exports/History and bounces the
5784
+ // user back to a Drawing Filter that is not ready yet - and the stage banner above already
5785
+ // says so. The duration warning is unconditional because the cap was false for both states.
5786
+ txt.appendChild(document.createTextNode(` ${n} file${n > 1 ? 's' : ''} queued. ${handoff} Then return here. Larger drawing sets take longer; FloLess updates this card when the Drawing Filter is ready for your review.`));
5767
5787
  const copy = revEl('button', 'btn-mini', '⧉ Copy');
5768
5788
  copy.type = 'button'; copy.dataset.revcopy = ''; copy.dataset.commandId = 'shell.revision-request-copy';
5769
5789
  copy.setAttribute('data-tip', 'Copy the instruction again');
@@ -5876,6 +5896,7 @@
5876
5896
  reqs = Array.isArray(b) ? b : (b.requests || []);
5877
5897
  revRequestsFailed = false;
5878
5898
  } catch (e) {
5899
+ if (workspacePageUnloading) return;
5879
5900
  if (!revRequestsFailed) console.error('[workspaces] could not load requests for the revision card', e);
5880
5901
  revRequestsFailed = true;
5881
5902
  return;
@@ -5971,20 +5992,23 @@
5971
5992
  // returning to Drawing Filter briefly resurrects the old "reading" state and can leave Save filter
5972
5993
  // unaware that the terminal prepass finished until a later poll happens to repaint the tab.
5973
5994
  revCardReq = failed || staged || pending || activeRequest;
5974
- syncDrawingRevisionRequest(pending?.prepassReady && !pending.filterSaved ? pending.id : '');
5995
+ syncDrawingRevisionRequest(
5996
+ pending?.prepassReady ? pending.id : '',
5997
+ pending?.prepassReady && pending.filterCheckpointCurrent ? pending.filterSavedEtag : '',
5998
+ );
5975
5999
  if (currentStep !== 'drawings') { $revisionCard.hidden = true; applyStageGating(); return; } // card is Drawing Filter-scoped
5976
6000
  // A REVIEW IS OPEN — leave the card alone. Repainting it would replace the button focus returns to,
5977
6001
  // and the modal is the authority on this request until it closes. If the request vanished from
5978
6002
  // under it, the modal's own confirm learns that from the server and closes; the next tick then
5979
6003
  // paints the truth.
5980
6004
  if (revReviewState || revDiscardState) return;
5981
- const cardKey = `${state}:${revCardReq ? revCardReq.id : ''}:${pending && pending.filterSaved ? 'filter-saved' : pending && pending.prepassReady ? 'filter-ready' : 'read-pending'}:${pending && pending.run ? pending.run.state || '' : ''}`
6005
+ const cardKey = `${state}:${revCardReq ? revCardReq.id : ''}:${pending && pending.filterCheckpointCurrent ? 'filter-saved' : pending && pending.prepassReady ? 'filter-ready' : 'read-pending'}:${pending && pending.run ? pending.run.state || '' : ''}`
5982
6006
  + (staged ? `:${staged.baseVersion}:${staged.headVersion}:${staged.stageId || ''}:${staged.canDiscardRevision === true}:${staged.discardState || ''}:${staged.discardWhy || ''}:${staged.canClear === true}:${staged.clearWhy || ''}:${unavailableRevisionReviewStages.has(staged.stageId)}` : '');
5983
6007
  if ($revisionCard._renderKey === cardKey && !$revisionCard.hidden) return; // preserve focus across the 3 s poll
5984
6008
  const restoreFocus = typeof document !== 'undefined' && $revisionCard.contains(document.activeElement);
5985
6009
  $revisionCard._renderKey = cardKey;
5986
6010
  $revisionCard.className = 'ws-revision-card state-' + state
5987
- + (pending && pending.filterSaved ? ' state-filter-saved' : pending && pending.prepassReady ? ' state-filter-ready' : '')
6011
+ + (pending && pending.filterCheckpointCurrent ? ' state-filter-saved' : pending && pending.prepassReady ? ' state-filter-ready' : '')
5988
6012
  + (staged && isRevisionStale(staged) ? ' state-stale' : '');
5989
6013
  $revisionCard.replaceChildren(...(
5990
6014
  state === 'failed' ? buildFailedCard(failed)
@@ -5997,25 +6021,54 @@
5997
6021
  }
5998
6022
 
5999
6023
  /** Keep the request checkpoint in the already-open Drawing Filter without navigating away edits. */
6000
- function syncDrawingRevisionRequest(targetRequest) {
6024
+ function syncDrawingRevisionRequest(targetRequest, targetSavedEtag = '') {
6001
6025
  const frame = frames.drawings;
6002
6026
  if (!frame?.dataset.want) return;
6003
6027
  const requestId = String(targetRequest || '');
6028
+ const savedEtag = requestId ? String(targetSavedEtag || '') : '';
6029
+ let bridged = false;
6030
+ if (frame.dataset.loaded) {
6031
+ try {
6032
+ const checkpoint = frame.contentWindow?.__floRevisionCheckpoint;
6033
+ if (checkpoint && typeof checkpoint.setRequest === 'function') {
6034
+ // `false` means this exact child Save owns a transient E1→empty invalidation. Do not let the
6035
+ // same stale poll rewrite dataset.want either, or the next iframe load would replay the gap.
6036
+ if (checkpoint.setRequest(requestId, savedEtag) === false) return false;
6037
+ bridged = true;
6038
+ }
6039
+ } catch { /* not ready or not same-origin yet — reconcile through the target URL below */ }
6040
+ }
6004
6041
  const wanted = new URL(frame.dataset.want, location.origin);
6005
6042
  if (requestId) wanted.searchParams.set('revisionRequest', requestId);
6006
6043
  else wanted.searchParams.delete('revisionRequest');
6044
+ if (savedEtag) wanted.searchParams.set('revisionFilterSavedEtag', savedEtag);
6045
+ else wanted.searchParams.delete('revisionFilterSavedEtag');
6007
6046
  frame.dataset.want = wanted.pathname + wanted.search;
6008
- if (!frame.dataset.loaded) return;
6047
+ if (!frame.dataset.loaded || bridged) return true;
6009
6048
  try {
6010
- const checkpoint = frame.contentWindow?.__floRevisionCheckpoint;
6011
- if (checkpoint && typeof checkpoint.setRequest === 'function') {
6012
- checkpoint.setRequest(requestId);
6013
- return;
6014
- }
6015
6049
  const shown = new URL(frame.contentWindow.location.href);
6016
- if ((shown.searchParams.get('revisionRequest') || '') === requestId) return;
6050
+ if ((shown.searchParams.get('revisionRequest') || '') === requestId
6051
+ && (shown.searchParams.get('revisionFilterSavedEtag') || '') === savedEtag) return true;
6017
6052
  } catch { /* not ready or not same-origin yet — navigate to the authoritative target below */ }
6018
6053
  frame.src = frame.dataset.want;
6054
+ return true;
6055
+ }
6056
+
6057
+ /**
6058
+ * The child completed both halves of a required Filter Save. Invalidate any request-list poll that
6059
+ * began before that commit, adopt the exact receipt immediately, and start a fresh authoritative
6060
+ * read. ETags are hashes, not ordered versions, so a child-side "keep whichever looks newer" rule
6061
+ * cannot distinguish a stale poll from a genuine later invalidation; the existing poll generation can.
6062
+ */
6063
+ function drawingFilterCheckpointSaved(notice) {
6064
+ const projectId = String(notice?.projectId || '');
6065
+ const requestId = String(notice?.requestId || '');
6066
+ const savedEtag = String(notice?.savedEtag || '');
6067
+ if (!current || current.id !== projectId || !requestId || !savedEtag) return false;
6068
+ revisionGen += 1;
6069
+ syncDrawingRevisionRequest(requestId, savedEtag);
6070
+ void renderRevisionCard();
6071
+ return true;
6019
6072
  }
6020
6073
 
6021
6074
  /**
@@ -8278,6 +8331,9 @@
8278
8331
  renderKnowledge();
8279
8332
  }
8280
8333
 
8281
- window.flolessWorkspaces = { setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind, openHistory: wsOpenHistory, openKnowledgePage };
8334
+ window.flolessWorkspaces = {
8335
+ setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
8336
+ openHistory: wsOpenHistory, openKnowledgePage, drawingFilterCheckpointSaved,
8337
+ };
8282
8338
  applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
8283
8339
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.134.4",
3
+ "version": "0.135.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": {