@floless/app 0.127.0 → 0.127.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +3986 -1832
- package/dist/web/app.css +15 -0
- package/dist/web/aware.js +31 -9
- package/dist/web/steel-editor.html +23 -10
- package/dist/web/steel-filter.html +16 -2
- package/dist/web/workspaces.js +29 -1
- package/package.json +1 -1
package/dist/web/app.css
CHANGED
|
@@ -2054,6 +2054,19 @@
|
|
|
2054
2054
|
.req-run-note { margin: 0; color: var(--text-muted); line-height: 1.45; }
|
|
2055
2055
|
.req-run-where { font-family: var(--mono); font-size: 10px; color: var(--text-dim);
|
|
2056
2056
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2057
|
+
/* §F's only recovery action: copy the server-stamped command, then continue in the user's own
|
|
2058
|
+
terminal. It is a button rather than an input so it cannot resemble somewhere to answer the
|
|
2059
|
+
parked question; long commands wrap instead of truncating the one thing the user must recover. */
|
|
2060
|
+
.req-run-resume { display: flex; flex-direction: column; gap: 4px; }
|
|
2061
|
+
.req-run-resume-label { color: var(--text-muted); font-size: 10.5px; font-weight: 600; }
|
|
2062
|
+
.req-run-resume-command { appearance: none; width: 100%; min-height: 30px; padding: 6px 8px;
|
|
2063
|
+
text-align: left; cursor: pointer; color: var(--accent-bright); background: var(--surface-2);
|
|
2064
|
+
border: 1px solid var(--border-strong); border-radius: 4px; font-family: var(--mono); font-size: 10.5px;
|
|
2065
|
+
line-height: 1.45; overflow-wrap: anywhere; transition: border-color 0.12s, background 0.12s, color 0.12s; }
|
|
2066
|
+
.req-run-resume-command code { font: inherit; }
|
|
2067
|
+
.req-run-resume-command:hover { border-color: var(--accent-dim); background: var(--accent-soft); color: var(--text); }
|
|
2068
|
+
.req-run-resume-command:active { background: var(--surface-3); }
|
|
2069
|
+
.req-run-resume-command:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
2057
2070
|
/* The agent's question, VERBATIM. A quote, deliberately — the warn rule and the italic say
|
|
2058
2071
|
"somebody said this to you", where a plain paragraph would read as floless's own prose and a
|
|
2059
2072
|
field would read as somewhere to answer. There is nowhere to answer; that is the point. */
|
|
@@ -4819,6 +4832,8 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
4819
4832
|
flight and an animation would say otherwise. */
|
|
4820
4833
|
.ws-revision-card.state-staged { border-left:3px solid var(--accent); }
|
|
4821
4834
|
.ws-revision-card.state-staged .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); }
|
|
4835
|
+
.ws-revision-card.state-filter-ready { border-left:3px solid var(--accent); }
|
|
4836
|
+
.ws-revision-card.state-filter-ready .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); }
|
|
4822
4837
|
.ws-revision-card .wrc-actions { display:flex; gap:6px; flex:none; }
|
|
4823
4838
|
@media (prefers-reduced-motion: reduce) { .ws-revision-card .wrc-spin { animation:none; } }
|
|
4824
4839
|
.hist .gate-badge.ai-read { background:var(--accent-soft); border-color:var(--accent-dim); color:var(--accent-bright); }
|
package/dist/web/aware.js
CHANGED
|
@@ -7074,11 +7074,24 @@
|
|
|
7074
7074
|
stopped: { badge: 'Stopped', cls: 'muted', note: () => 'You stopped this run.' },
|
|
7075
7075
|
};
|
|
7076
7076
|
|
|
7077
|
-
|
|
7077
|
+
// A parked run is a hand-off, not a browser-owned conversation (§G). The server stamps a command
|
|
7078
|
+
// only for this explicit recovery set, but retain the same guard here: a newer/malformed server
|
|
7079
|
+
// response must not turn an arbitrary terminal state into an implied "resume" instruction.
|
|
7080
|
+
const RESUMABLE_RUN_STATES = new Set(['needs-you', 'stopped', 'interrupted', 'contract-violation', 'exited-unresolved']);
|
|
7081
|
+
|
|
7082
|
+
async function copyResumeCommand(command) {
|
|
7083
|
+
if (!command) return 'empty';
|
|
7084
|
+
return (await copyToClipboard(command)) ? 'ok' : 'denied';
|
|
7085
|
+
}
|
|
7086
|
+
|
|
7087
|
+
function runStatusHtml(run, stampedResumeCommand) {
|
|
7078
7088
|
if (!run || !run.state) return '';
|
|
7079
7089
|
const v = RUN_VIEW[run.state] || { badge: String(run.state), cls: 'muted', note: () => '' };
|
|
7080
7090
|
const rt = runtimeLabel(run.runtime);
|
|
7081
7091
|
const note = v.note(rt);
|
|
7092
|
+
// `resumeCommand` belongs to the SERVER'S request view, not persisted `run` metadata: the
|
|
7093
|
+
// store deliberately carries only runtime/session identity, while terminal-runtime.ts owns argv.
|
|
7094
|
+
const resumeCommand = RESUMABLE_RUN_STATES.has(run.state) ? stampedResumeCommand : null;
|
|
7082
7095
|
return `
|
|
7083
7096
|
<div class="req-run-status">
|
|
7084
7097
|
<div class="req-run-head">
|
|
@@ -7087,7 +7100,8 @@
|
|
|
7087
7100
|
</div>
|
|
7088
7101
|
${note ? `<p class="req-run-note">${escapeHtml(note)}</p>` : ''}
|
|
7089
7102
|
${run.question ? `<p class="req-run-question">${escapeHtml(run.question)}</p>` : ''}
|
|
7090
|
-
${
|
|
7103
|
+
${resumeCommand ? `<div class="req-run-resume"><span class="req-run-resume-label">Continue in terminal</span><button type="button" class="req-run-resume-command" data-resume-command="${escapeAttr(resumeCommand)}" data-tip="Copy command to continue this session" aria-label="Copy resume command: ${escapeAttr(resumeCommand)}"><code>${escapeHtml(resumeCommand)}</code></button></div>` : ''}
|
|
7104
|
+
${run.cwd ? `<div class="req-run-where">Run in · ${escapeHtml(run.cwd)}</div>` : ''}
|
|
7091
7105
|
${run.lastOutput ? `<details class="req-run-output"><summary>Show what it printed</summary><pre>${escapeHtml(run.lastOutput)}</pre></details>` : ''}
|
|
7092
7106
|
</div>`;
|
|
7093
7107
|
}
|
|
@@ -7611,11 +7625,11 @@
|
|
|
7611
7625
|
? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
|
|
7612
7626
|
: inFlight
|
|
7613
7627
|
? '<span class="req-lifecycle" data-tip="Stop the run first — clearing it now would leave the agent working on a request that no longer exists">running</span>'
|
|
7614
|
-
: `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="Clear this request">×</button>`;
|
|
7615
|
-
// A
|
|
7616
|
-
// second headless
|
|
7617
|
-
//
|
|
7618
|
-
const canRunNow = headlessReady() && r.canRun && !inFlight && !
|
|
7628
|
+
: `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="${r.resumeCommand ? 'Clear this request and discard its saved terminal session' : 'Clear this request'}">×</button>`;
|
|
7629
|
+
// A server-stamped handoff gets NO re-run. The original terminal session may already be live;
|
|
7630
|
+
// starting a second headless agent would put two writers in one folder. The browser decides no
|
|
7631
|
+
// policy here: it simply withholds ▶ whenever the server supplied the resume command.
|
|
7632
|
+
const canRunNow = headlessReady() && r.canRun && !inFlight && !r.resumeCommand;
|
|
7619
7633
|
const runBtn = inFlight
|
|
7620
7634
|
? `<button class="req-stop" data-id="${escapeAttr(r.id)}" data-tip="Stop this run">■</button>`
|
|
7621
7635
|
: canRunNow
|
|
@@ -7627,12 +7641,12 @@
|
|
|
7627
7641
|
<div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
|
|
7628
7642
|
<div class="req-instruction">${highlightQuery(instructionFor(r), requestQuery) || 'This request has no instruction, so it can’t be handed to your terminal AI. Clear it and queue it again.'}</div>
|
|
7629
7643
|
${r.snapshots && r.snapshots.length ? `<div class="req-thumbs">${r.snapshots.map((sp, i) => { const pdf = /\.pdf$/i.test(String(sp)); return `<button type="button" class="req-thumb" data-id="${escapeAttr(r.id)}" data-n="${i}" aria-label="View ${pdf ? 'PDF' : 'screenshot'} ${i + 1}">${pdf ? '<span class="req-thumb-pdf">PDF</span>' : `<img src="/api/requests/${encodeURIComponent(r.id)}/snapshot/${i}" alt="">`}</button>`; }).join('')}</div>` : ''}
|
|
7630
|
-
${runStatusHtml(run)}
|
|
7644
|
+
${runStatusHtml(run, r.resumeCommand)}
|
|
7631
7645
|
${!r.canRun && r.runWhy && anyRunnable ? `<div class="req-why-not">Runs only from your terminal — ${escapeHtml(r.runWhy)}</div>` : ''}
|
|
7632
7646
|
</div>
|
|
7633
7647
|
<div class="req-actions">
|
|
7634
7648
|
${runBtn}
|
|
7635
|
-
|
|
7649
|
+
${r.resumeCommand ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>`}
|
|
7636
7650
|
${del}
|
|
7637
7651
|
</div>
|
|
7638
7652
|
</div>`;
|
|
@@ -7658,6 +7672,14 @@
|
|
|
7658
7672
|
else showToast(...copyFailToast(res));
|
|
7659
7673
|
};
|
|
7660
7674
|
});
|
|
7675
|
+
$list.querySelectorAll('.req-run-resume-command').forEach((b) => {
|
|
7676
|
+
b.onclick = async () => {
|
|
7677
|
+
const res = await copyResumeCommand(b.dataset.resumeCommand || '');
|
|
7678
|
+
if (res === 'ok') showToast('Copied — run it in the folder shown below', 'ok');
|
|
7679
|
+
else if (res === 'empty') showToast('Nothing to copy — this run has no resume command', 'err');
|
|
7680
|
+
else showToast('Could not copy — select the command and copy it manually', 'err');
|
|
7681
|
+
};
|
|
7682
|
+
});
|
|
7661
7683
|
$list.querySelectorAll('.req-del').forEach((b) => { b.onclick = () => deleteOneRequest(b.dataset.id); });
|
|
7662
7684
|
$list.querySelectorAll('.req-thumb').forEach((b) => {
|
|
7663
7685
|
b.onclick = () => window.open(`/api/requests/${encodeURIComponent(b.dataset.id)}/snapshot/${b.dataset.n}`, '_blank');
|
|
@@ -1613,7 +1613,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1613
1613
|
<!-- The spinner is `connImportModal`'s own `.ci-prog`/`.ci-spin` (see the CSS above), reused rather
|
|
1614
1614
|
than re-invented: this stage sat as static text for up to six seconds before its honest
|
|
1615
1615
|
"still working" message appeared, which reads as hung next to the sibling modal that spins. -->
|
|
1616
|
-
<div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt>Reading the file…</span></div></div>
|
|
1616
|
+
<div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt role=status aria-live=polite>Reading the file…</span></div><div id=riProgNote style="display:none">You can close this — FloLess will keep importing this model.</div></div>
|
|
1617
1617
|
<div id=riConfirmStage style="display:none">
|
|
1618
1618
|
<div id=riSays></div>
|
|
1619
1619
|
<div class=rirow><span class=pn>Schema</span><span class=pv id=riSchema>—</span></div>
|
|
@@ -11146,7 +11146,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11146
11146
|
// that guard could never fire from this UI, because the browser never disconnected — Cancel left the
|
|
11147
11147
|
// request in flight, so a cancelled 66 MB read went on holding the single run lock for its full
|
|
11148
11148
|
// duration and the next import queued behind the file the user had just given up on.
|
|
11149
|
-
let riRun=0,riAbort=null;
|
|
11149
|
+
let riRun=0,riAbort=null,riMutationId=null;
|
|
11150
11150
|
/** End the current attempt: nothing it started may touch the modal, and its upload stops now. */
|
|
11151
11151
|
const riStop=()=>{riRun++;if(riAbort){try{riAbort.abort();}catch(_){/* already settled */}riAbort=null;}};
|
|
11152
11152
|
const riClearSoft=()=>{if(riSoftT){clearTimeout(riSoftT);riSoftT=null;}};
|
|
@@ -11157,7 +11157,8 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11157
11157
|
ri$('riProgStage').style.display=s==='prog'?'':'none';
|
|
11158
11158
|
ri$('riConfirmStage').style.display=s==='confirm'?'':'none';
|
|
11159
11159
|
ri$('riInsert').style.display=s==='confirm'?'':'none';
|
|
11160
|
-
ri$('riClose').style.display=s==='prog'?'none':'';
|
|
11160
|
+
ri$('riClose').style.display=s==='prog'?'none':'';
|
|
11161
|
+
ri$('riProgNote').style.display='none';
|
|
11161
11162
|
ri$('riTitle').textContent=s==='prog'?'Reading the file':s==='confirm'?'Add this reference?':'Add a reference model';};
|
|
11162
11163
|
const riProg=(label,soft)=>{riClearSoft();ri$('riProgTxt').textContent=label;
|
|
11163
11164
|
if(soft)riSoftT=setTimeout(()=>{ri$('riProgTxt').textContent=soft;},6000);}; // an honest "still working", never a fake %
|
|
@@ -11171,7 +11172,18 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11171
11172
|
riBuildPick(null); // and the picker, so a cancelled file's storeys never show under a new name
|
|
11172
11173
|
riStage('drop');ri$('refImportModal').style.display='flex';}
|
|
11173
11174
|
window.openRefImport=openRefImport;
|
|
11174
|
-
function riClose(){
|
|
11175
|
+
function riClose(){
|
|
11176
|
+
// A reference insert is intentionally detached from this modal once accepted. Closing is a
|
|
11177
|
+
// backgrounding action, never an implicit cancellation of an expensive model read.
|
|
11178
|
+
if(riBusy&&riStageNow==='prog'){
|
|
11179
|
+
// The server broadcasts before its HTTP response. Once the user backgrounds this attempt, its
|
|
11180
|
+
// mutation may no longer suppress that broadcast or the contract can commit invisibly here.
|
|
11181
|
+
if(riMutationId){releaseMutation(riMutationId);riMutationId=null;}
|
|
11182
|
+
riRun++;riAbort=null;riBusy=false;riClearSoft();ri$('riCancel').textContent='Cancel';ri$('refImportModal').style.display='none';
|
|
11183
|
+
toast('Import continues in the background.');return;
|
|
11184
|
+
}
|
|
11185
|
+
riStop();riClearSoft();ri$('refImportModal').style.display='none';
|
|
11186
|
+
}
|
|
11175
11187
|
|
|
11176
11188
|
const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
|
|
11177
11189
|
// Mirrors MAX_OBJECTS / WARN_OBJECTS in server/reference-import.ts (pinned by the same parity test).
|
|
@@ -11517,9 +11529,10 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11517
11529
|
const riNative=nativeModelCentre();
|
|
11518
11530
|
const riFilterBody=riBuildFilter(); // computed ONCE — it was called twice in one expression
|
|
11519
11531
|
const riOriginShift=takeOrigin&&riProbeCentre?riProbeCentre.map((v,i)=>riNative[i]-v):null;
|
|
11520
|
-
riStage('prog');riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
|
|
11532
|
+
riStage('prog');ri$('riProgNote').style.display='block';ri$('riCancel').textContent='Continue in background';riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
|
|
11533
|
+
let mid=null;
|
|
11521
11534
|
try{
|
|
11522
|
-
|
|
11535
|
+
mid=newMutationId();riMutationId=mid;claimMutation(mid);
|
|
11523
11536
|
const res=await fetch(refApi(''),{method:'POST',signal,headers:{'content-type':'application/json','x-floless-mutation-id':mid},
|
|
11524
11537
|
// The placement rides the INSERT, so the choice the user made in the modal is committed with
|
|
11525
11538
|
// the reference rather than by a debounced PUT afterwards. Applying it in the presentation
|
|
@@ -11539,7 +11552,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11539
11552
|
// own echo would not be replayed at us, and if the write DID land, suppressing its broadcast
|
|
11540
11553
|
// is precisely what would leave a reference committed on disk and invisible in the editor —
|
|
11541
11554
|
// where the next full save could quietly drop it. Released, the broadcast reconciles instead.
|
|
11542
|
-
releaseMutation(mid);
|
|
11555
|
+
releaseMutation(mid);if(riMutationId===mid)riMutationId=null;
|
|
11543
11556
|
return;
|
|
11544
11557
|
}
|
|
11545
11558
|
riClearSoft();
|
|
@@ -11568,9 +11581,9 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11568
11581
|
}catch(e){
|
|
11569
11582
|
// Aborted: no response at all, so we cannot know whether the write landed. Same reasoning as
|
|
11570
11583
|
// above — release the claim so a broadcast that does arrive is applied rather than swallowed.
|
|
11571
|
-
if(mine!==riRun||(e&&e.name==='AbortError')){releaseMutation(mid);return;}
|
|
11584
|
+
if(mine!==riRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);if(riMutationId===mid)riMutationId=null;return;}
|
|
11572
11585
|
riClearSoft();riStage('drop');riErr('Could not add that reference.');console.error('[reference] insert failed',e);return;}
|
|
11573
|
-
finally{riBusy=false;if(
|
|
11586
|
+
finally{if(mine===riRun){riBusy=false;riAbort=null;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
|
|
11574
11587
|
// ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
|
|
11575
11588
|
// it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
|
|
11576
11589
|
// already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
|
|
@@ -11610,7 +11623,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
|
|
|
11610
11623
|
// exit — and the backdrop, a full-viewport overlay that looks like nothing at all, quietly offered
|
|
11611
11624
|
// the same abort to a stray click just outside the panel. Hiding one of two identical exits and
|
|
11612
11625
|
// leaving the invisible one is the version of that rule that does not hold. (UX review, #580.)
|
|
11613
|
-
ri$('riBackdrop').onclick=()=>
|
|
11626
|
+
ri$('riBackdrop').onclick=()=>riClose();
|
|
11614
11627
|
ri$('riInsert').onclick=riInsert;
|
|
11615
11628
|
ri$('riPickToggle').onclick=()=>riSetPickOpen(ri$('riPick').style.display==='none');
|
|
11616
11629
|
// The tri-state header toggle: `null` (all) and a full Set are the same selection but not the
|
|
@@ -116,6 +116,9 @@ footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
|
|
|
116
116
|
#canvas image.bg{opacity:.28}
|
|
117
117
|
#canvas path.el{pointer-events:stroke}
|
|
118
118
|
#canvas text.el{pointer-events:all;cursor:pointer;user-select:none}
|
|
119
|
+
/* Filtered-out vector content stays as quiet, non-selectable drawing context. The selector must beat
|
|
120
|
+
the text rule above, otherwise dim labels still open the eyedropper. */
|
|
121
|
+
#canvas .el.is-context{opacity:.2;pointer-events:none}
|
|
119
122
|
#empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;color:var(--mut)}
|
|
120
123
|
#empty.show{display:flex}
|
|
121
124
|
#empty>div{max-width:44ch}
|
|
@@ -291,6 +294,7 @@ import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, c
|
|
|
291
294
|
const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
292
295
|
// Workspaces: project-keyed contract (see steel-editor.html). Empty = legacy app-keyed URLs.
|
|
293
296
|
const PROJECT = new URLSearchParams(location.search).get('project') || '';
|
|
297
|
+
let revisionRequest = new URLSearchParams(location.search).get('revisionRequest') || '';
|
|
294
298
|
const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
|
|
295
299
|
const CONTRACT_QS = PROJECT ? (PROJECT_QS + '&quietMissing=1') : PROJECT_QS;
|
|
296
300
|
const SVGNS = 'http://www.w3.org/2000/svg';
|
|
@@ -972,10 +976,12 @@ function syncFacetChecks(){
|
|
|
972
976
|
function apply(){
|
|
973
977
|
for(const { node, el } of nodes){
|
|
974
978
|
const vis = matchesActive(el, mode, sel);
|
|
975
|
-
node.
|
|
979
|
+
node.classList.toggle('is-context', !vis);
|
|
980
|
+
node.setAttribute('aria-hidden', String(!vis));
|
|
976
981
|
}
|
|
982
|
+
if(eyeEl && !matchesActive(eyeEl, mode, sel)) closeEye();
|
|
977
983
|
const cur = (sheets[active] && sheets[active].elements) || [];
|
|
978
|
-
let html = '<b>' + countShown(cur, mode, sel) + '</b> of <b>' + cur.length + '</b> shown';
|
|
984
|
+
let html = '<b>' + countShown(cur, mode, sel) + '</b> selected of <b>' + cur.length + '</b> · remaining elements shown as context';
|
|
979
985
|
if(sheets.length > 1){
|
|
980
986
|
let sa = 0, ta = 0;
|
|
981
987
|
for(const s of sheets){ const els = s.elements || []; sa += countShown(els, mode, sel); ta += els.length; }
|
|
@@ -1122,6 +1128,14 @@ async function saveNow(){
|
|
|
1122
1128
|
// external change and reload itself the instant the user saved. The id is consumed by that echo, or
|
|
1123
1129
|
// dropped when the write fails, or discarded when the SSE channel closes (nothing can echo after that).
|
|
1124
1130
|
const t = res.headers.get('ETag'); if(t) serverEtag = t;
|
|
1131
|
+
if(revisionRequest && PROJECT && serverEtag){
|
|
1132
|
+
const checkpoint = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(revisionRequest)}/filter-saved`, {
|
|
1133
|
+
method:'POST', headers:{'content-type':'application/json'}, body:JSON.stringify({etag:serverEtag}),
|
|
1134
|
+
});
|
|
1135
|
+
if(!checkpoint.ok) throw new Error(await checkpoint.text());
|
|
1136
|
+
revisionRequest = '';
|
|
1137
|
+
history.replaceState(null, '', location.pathname + PROJECT_QS);
|
|
1138
|
+
}
|
|
1125
1139
|
dirty = false; setSaved('saved');
|
|
1126
1140
|
} catch(e){
|
|
1127
1141
|
// The id is deliberately KEPT here. No response arrived, so we do not know whether the write landed —
|
package/dist/web/workspaces.js
CHANGED
|
@@ -5289,6 +5289,7 @@
|
|
|
5289
5289
|
function resetRevisionState() {
|
|
5290
5290
|
lastRevState = 'none';
|
|
5291
5291
|
revCardReq = null;
|
|
5292
|
+
$revisionCard._renderKey = '';
|
|
5292
5293
|
revisionGen++; // voids any render still in flight for the project being left
|
|
5293
5294
|
stopRevisionPoll();
|
|
5294
5295
|
$revisionCard.hidden = true;
|
|
@@ -5356,6 +5357,18 @@
|
|
|
5356
5357
|
|
|
5357
5358
|
function buildPendingCard(req) {
|
|
5358
5359
|
const n = (req.sourceRefs && req.sourceRefs.length) || (req.snapshots && req.snapshots.length) || 1;
|
|
5360
|
+
if (req.prepassReady) {
|
|
5361
|
+
// The terminal AI has completed the deterministic pre-read; it is now waiting on the real Filter
|
|
5362
|
+
// Save checkpoint below, not on another pasted instruction. A static dot avoids claiming work is
|
|
5363
|
+
// still running, and the real action only focuses the existing Filter iframe — it never fakes Save.
|
|
5364
|
+
const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
|
|
5365
|
+
const txt = revEl('span', 'wrc-text');
|
|
5366
|
+
txt.appendChild(revEl('b', null, 'Steel Filter is ready.'));
|
|
5367
|
+
txt.appendChild(document.createTextNode(' Review the Steel Filter and Save to continue the read.'));
|
|
5368
|
+
const review = revEl('button', 'btn-mini', 'Review Filter');
|
|
5369
|
+
review.type = 'button'; review.dataset.revfilter = ''; review.setAttribute('data-tip', 'Focus the Steel Filter below');
|
|
5370
|
+
return [dot, txt, review];
|
|
5371
|
+
}
|
|
5359
5372
|
const spin = revEl('span', 'wrc-spin'); spin.setAttribute('aria-hidden', 'true');
|
|
5360
5373
|
const txt = revEl('span', 'wrc-text');
|
|
5361
5374
|
txt.appendChild(revEl('b', null, `Reading the ${isInitialRevisionRead(req) ? 'initial' : 'revised'} set…`));
|
|
@@ -5489,12 +5502,25 @@
|
|
|
5489
5502
|
// paints the truth.
|
|
5490
5503
|
if (revReviewState) return;
|
|
5491
5504
|
revCardReq = failed || staged || pending;
|
|
5492
|
-
|
|
5505
|
+
if (pending?.prepassReady && frames.drawings.dataset.want) {
|
|
5506
|
+
const u = new URL(frames.drawings.dataset.want, location.origin);
|
|
5507
|
+
if (u.searchParams.get('revisionRequest') !== pending.id) {
|
|
5508
|
+
u.searchParams.set('revisionRequest', pending.id);
|
|
5509
|
+
frames.drawings.dataset.want = u.pathname + u.search;
|
|
5510
|
+
if (frames.drawings.dataset.loaded) frames.drawings.src = frames.drawings.dataset.want;
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
const cardKey = `${state}:${revCardReq ? revCardReq.id : ''}:${pending && pending.prepassReady ? 'filter-ready' : 'read-pending'}`;
|
|
5514
|
+
if ($revisionCard._renderKey === cardKey && !$revisionCard.hidden) return; // preserve focus across the 3 s poll
|
|
5515
|
+
const restoreFocus = typeof document !== 'undefined' && $revisionCard.contains(document.activeElement);
|
|
5516
|
+
$revisionCard._renderKey = cardKey;
|
|
5517
|
+
$revisionCard.className = 'ws-revision-card state-' + state + (pending && pending.prepassReady ? ' state-filter-ready' : '');
|
|
5493
5518
|
$revisionCard.replaceChildren(...(
|
|
5494
5519
|
state === 'failed' ? buildFailedCard(failed)
|
|
5495
5520
|
: state === 'staged' ? buildStagedCard(staged)
|
|
5496
5521
|
: buildPendingCard(pending)));
|
|
5497
5522
|
$revisionCard.hidden = false;
|
|
5523
|
+
if (restoreFocus) $revisionCard.querySelector('button')?.focus();
|
|
5498
5524
|
}
|
|
5499
5525
|
|
|
5500
5526
|
$revisionCard.addEventListener('click', async (e) => {
|
|
@@ -5509,6 +5535,8 @@
|
|
|
5509
5535
|
if (res === 'ok') showToast('Instruction copied', 'ok');
|
|
5510
5536
|
else if (res === 'empty') showToast('Nothing to copy — this request has no instruction', 'err');
|
|
5511
5537
|
else showToast('Copy blocked — use the Requests panel', 'warn');
|
|
5538
|
+
} else if (e.target.closest('[data-revfilter]')) {
|
|
5539
|
+
frames.drawings?.focus();
|
|
5512
5540
|
} else if (e.target.closest('[data-revdismiss]')) {
|
|
5513
5541
|
try { await api(`/api/requests/${encodeURIComponent(req.id)}`, { method: 'DELETE' }); } catch { /* already gone */ }
|
|
5514
5542
|
lastRevState = 'none';
|