@floless/app 0.141.0 → 0.142.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +4283 -2494
- package/dist/web/account-menu.js +168 -0
- package/dist/web/app.css +97 -9
- package/dist/web/app.js +2 -0
- package/dist/web/aware.js +771 -72
- package/dist/web/chat.css +70 -0
- package/dist/web/chat.js +1331 -109
- package/dist/web/commands-revit.js +1 -1
- package/dist/web/commands-shell.js +143 -9
- package/dist/web/commands-steel.js +4 -0
- package/dist/web/index.html +78 -2
- package/dist/web/instructor.js +2 -2
- package/dist/web/leave-guard.js +480 -0
- package/dist/web/left-pane.js +43 -0
- package/dist/web/model-clip-session.js +2 -3
- package/dist/web/model-navigation-controls.js +17 -3
- package/dist/web/model-orientation-overlay.js +2 -3
- package/dist/web/model-panel-bridge.js +15 -3
- package/dist/web/model-viewport-revit-adapter.js +1 -0
- package/dist/web/model-viewport-toolbar.js +0 -2
- package/dist/web/revit-editor.js +4 -6
- package/dist/web/steel-3d-view.js +79 -45
- package/dist/web/steel-editor.html +167 -15
- package/dist/web/steel-filter.html +19 -9
- package/dist/web/steel-model-commands.js +0 -1
- package/dist/web/vector-editor.html +20 -3
- package/dist/web/workspaces.js +405 -41
- package/launch.mjs +32 -1
- package/package.json +1 -1
|
@@ -784,7 +784,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
784
784
|
which broadcast) — that failure is the AI's to report, in the terminal where the user asked
|
|
785
785
|
for it — and a re-bake whose result is canonically equal to what is already stored, where
|
|
786
786
|
there is nothing new to show. -->
|
|
787
|
-
<p class="hint" style="margin-top:8px;max-width:340px">
|
|
787
|
+
<p class="hint" style="margin-top:8px;max-width:340px">The AI reading your drawings prepares this filter. Its layers, line weights and colours will appear here automatically when ready.</p>
|
|
788
788
|
</div>
|
|
789
789
|
</div>
|
|
790
790
|
<!-- The ONLY fit/zoom controls -- plus, after the divider, Hover info, which is a canvas READ tool
|
|
@@ -1063,11 +1063,14 @@ function filterAiLocalFingerprint(){
|
|
|
1063
1063
|
}
|
|
1064
1064
|
function filterAiSelected(state,dim,value){ return state[FACET_DIMS[dim].control].has(value); }
|
|
1065
1065
|
/** Capture this filter's context and base selection, then create the read-only guide request. */
|
|
1066
|
-
|
|
1066
|
+
// The one length limit on a Drawing Filter message, matching AI Chat's FILTER_MESSAGE_LIMIT and the
|
|
1067
|
+
// server's MAX_SUBJECT_CHARS. It was 300, which refused ordinary questions (#1681).
|
|
1068
|
+
const FILTER_MESSAGE_LIMIT = 4000;
|
|
1069
|
+
async function createFilterAiRequest(kind, text, pictures){
|
|
1067
1070
|
const instruction = String(text ?? '').trim();
|
|
1068
1071
|
if(kind !== 'question' && kind !== 'change') return { ok:false, message:'FloLess could not send this message. Nothing was sent. Send it again.' };
|
|
1069
1072
|
if(!instruction) return { ok:false, message:'Write a question or the change you want first. Nothing was sent.' };
|
|
1070
|
-
if(instruction.length >
|
|
1073
|
+
if(instruction.length > FILTER_MESSAGE_LIMIT) return { ok:false, message:'Shorten your message to '+FILTER_MESSAGE_LIMIT+' characters, then send it again. Nothing was sent.' };
|
|
1071
1074
|
if(!F || !sel) return { ok:false, message:'The Drawing Filter is still loading. Try again when its layers appear. Nothing was sent.' };
|
|
1072
1075
|
let context, allowed = null;
|
|
1073
1076
|
try {
|
|
@@ -1078,11 +1081,17 @@ async function createFilterAiRequest(kind, text){
|
|
|
1078
1081
|
sheetEpoch:filterAiSheetEpoch, localFingerprint:filterAiLocalFingerprint(), disposition:'pending', note:'' };
|
|
1079
1082
|
// A deadline, so a request that never settles cannot leave AI Chat's Send blocked.
|
|
1080
1083
|
const controller = new AbortController();
|
|
1081
|
-
|
|
1084
|
+
// Pictures ride in this body, so the deadline is no longer sized for a few hundred bytes of
|
|
1085
|
+
// narration. Long enough for a handful of screenshots on a slow disk; still a deadline, so a
|
|
1086
|
+
// request that never settles cannot leave AI Chat's Send blocked.
|
|
1087
|
+
const deadline = setTimeout(() => controller.abort(), Array.isArray(pictures) && pictures.length ? 60000 : 15000);
|
|
1082
1088
|
let response, created = null;
|
|
1083
1089
|
try {
|
|
1084
1090
|
response = await fetch('/api/guide', { method:'POST', headers:{'content-type':'application/json'}, signal:controller.signal,
|
|
1085
|
-
body:JSON.stringify({ appId:APP_ID, ...(PROJECT ? { project:PROJECT, projectLabel:filterAiProjectLabel() } : {}), instructorContext:context
|
|
1091
|
+
body:JSON.stringify({ appId:APP_ID, ...(PROJECT ? { project:PROJECT, projectLabel:filterAiProjectLabel() } : {}), instructorContext:context,
|
|
1092
|
+
// The pictures AI Chat read off the composer. The server copies them beside the request and
|
|
1093
|
+
// hands them to the headless run on its command line; this page never opens them itself.
|
|
1094
|
+
...(Array.isArray(pictures) && pictures.length ? { snapshots:pictures } : {}) }) });
|
|
1086
1095
|
created = await response.json().catch(() => null);
|
|
1087
1096
|
} catch {
|
|
1088
1097
|
// A deadline and a lost connection look alike here: either way the request may or may not exist.
|
|
@@ -1866,8 +1875,8 @@ async function bootOnce(){
|
|
|
1866
1875
|
// No filter at all IS "nobody has prepared this yet", and the bare empty state says so correctly.
|
|
1867
1876
|
if(!F){ showEmpty(); return; }
|
|
1868
1877
|
// A filter that WAS prepared and legitimately carries nothing is a different thing, and the bare
|
|
1869
|
-
// empty state
|
|
1870
|
-
//
|
|
1878
|
+
// empty state says the AI reading their drawings "prepares this filter" — about a filter their AI
|
|
1879
|
+
// already prepared. There is no way out of that loop: re-baking reproduces the same
|
|
1871
1880
|
// empty screen, and nothing on it distinguishes "not started" from "started and found nothing".
|
|
1872
1881
|
//
|
|
1873
1882
|
// This is the same failure the 402/500 branch above was given its own copy to avoid, quoted there:
|
|
@@ -1877,7 +1886,7 @@ async function bootOnce(){
|
|
|
1877
1886
|
// hundreds of thousands of phantom ones. A raster-only sheet lands here for the same reason.
|
|
1878
1887
|
if(!sheets.some(s => Array.isArray(s.elements) && s.elements.length)){
|
|
1879
1888
|
showEmpty('This drawing set has nothing to filter.', false,
|
|
1880
|
-
'
|
|
1889
|
+
'The AI read this drawing set and found no vector linework or text on any sheet — a scan with no drawn lines reads this way. If that looks wrong, ask it to re-read the source file.');
|
|
1881
1890
|
return;
|
|
1882
1891
|
}
|
|
1883
1892
|
document.getElementById('empty').classList.remove('show');
|
|
@@ -1929,7 +1938,8 @@ function showEmpty(msg, publicationBlocked = false, detail = ''){
|
|
|
1929
1938
|
body.hidden = !detail;
|
|
1930
1939
|
if(msg){
|
|
1931
1940
|
e.querySelector('h1').textContent = msg;
|
|
1932
|
-
// The hint below explains how a filter gets BAKED ("
|
|
1941
|
+
// The hint below explains how a filter gets BAKED ("The AI reading your drawings prepares this
|
|
1942
|
+
// filter…" — deliberately naming no terminal, because AI Chat may be the thing reading). Under an
|
|
1933
1943
|
// error headline — "Could not reach the server.", a 402, "No app specified." — that answers a question
|
|
1934
1944
|
// nobody asked and implies the thing is merely pending, so it goes away with the good news.
|
|
1935
1945
|
const hint = e.querySelector('.hint');
|
|
@@ -149,7 +149,6 @@
|
|
|
149
149
|
*/
|
|
150
150
|
|
|
151
151
|
import { V2CommandError, dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
|
|
152
|
-
import { IN_TO_MM as IN_MM } from './steel-units.js';
|
|
153
152
|
import { gridLabelPatch, sheetScaleMm } from './grid-core.js';
|
|
154
153
|
|
|
155
154
|
/** Display-pixel scale for one plan — the shared guard, not a fourth copy to keep in lock-step. */
|
|
@@ -587,20 +587,37 @@
|
|
|
587
587
|
const bar = document.getElementById('conflictBanner'); if (bar) bar.remove();
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
+
let pendingWrites = 0; // queued or in-flight PUTs — contractSaveState() reads 'saving' until they settle
|
|
590
591
|
function persistServer() {
|
|
591
592
|
if (!editable || !C) return Promise.resolve(true);
|
|
592
593
|
const gen = ++saveGen;
|
|
594
|
+
pendingWrites += 1;
|
|
593
595
|
saveQueue = saveQueue.then(() => (gen === saveGen ? doPut() : true)); // superseded → the newer write carries C
|
|
594
|
-
|
|
596
|
+
const tail = saveQueue;
|
|
597
|
+
const settle = () => { pendingWrites -= 1; };
|
|
598
|
+
tail.then(settle, settle);
|
|
599
|
+
return tail;
|
|
595
600
|
}
|
|
596
|
-
function scheduleSave() { if (!editable) return; setSaved('dirty'); clearTimeout(saveT); saveT = setTimeout(persistServer, 500); }
|
|
601
|
+
function scheduleSave() { if (!editable) return; setSaved('dirty'); clearTimeout(saveT); saveT = setTimeout(() => { saveT = 0; persistServer(); }, 500); }
|
|
597
602
|
// The shell's Approve button awaits this before baking — throw so a rejected save aborts the bake.
|
|
598
603
|
window.flushContract = async function flushContract() {
|
|
599
604
|
if (!editable) return;
|
|
600
|
-
clearTimeout(saveT);
|
|
605
|
+
clearTimeout(saveT); saveT = 0;
|
|
601
606
|
const ok = await persistServer(); // queued behind any in-flight write → latest state, in order
|
|
602
607
|
if (!ok) throw new Error('Save failed — the edited contract was rejected; fix it before Approve');
|
|
603
608
|
};
|
|
609
|
+
// Mirrors the steel editor's contractSaveState() so the shell's leave guard (Stop FloLess / Sign
|
|
610
|
+
// Out) can tell a saved drawing from one with a queued or failed write. Only 'clean' is saved.
|
|
611
|
+
window.contractSaveState = function contractSaveState() {
|
|
612
|
+
if (!editable) return 'clean'; // a read-only view holds nothing to lose
|
|
613
|
+
const el = $('saveStat');
|
|
614
|
+
if (conflicted || (el && el.classList.contains('conflict'))) return 'conflict';
|
|
615
|
+
if (pendingWrites > 0) return 'saving';
|
|
616
|
+
if (saveT) return 'dirty';
|
|
617
|
+
if (el && el.classList.contains('err')) return 'error';
|
|
618
|
+
if (el && el.classList.contains('dirty')) return 'dirty';
|
|
619
|
+
return 'clean';
|
|
620
|
+
};
|
|
604
621
|
|
|
605
622
|
// ── weak-trace review: Accept clears the flag (absent = trusted), Delete removes with 1-level Undo ──
|
|
606
623
|
function isWeak(el) { return el.confidence != null && el.confidence < WEAK; }
|