@floless/app 0.148.1 → 0.149.1
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/bin/floless.mjs +1 -1
- package/dist/floless-server.cjs +29115 -18888
- package/dist/schemas/drawing-check.profile.v1.schema.json +156 -0
- package/dist/schemas/steel.model.v2.schema.json +43 -1
- package/dist/schemas/tekla.model.v2.schema.json +6 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +54 -11
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +9 -5
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +128 -15
- package/dist/skills/floless-app-vectorize/SKILL.md +7 -4
- package/dist/templates/check-drawings.flo +46 -0
- package/dist/templates/drawing-check.flo +55 -0
- package/dist/templates/tekla-parser.flo +6 -2
- package/dist/web/app.css +143 -8
- package/dist/web/aware.js +444 -39
- package/dist/web/chat.css +189 -12
- package/dist/web/chat.js +2203 -772
- package/dist/web/commands-drawing-check.js +53 -0
- package/dist/web/commands-shell.js +299 -6
- package/dist/web/commands-steel.js +1 -0
- package/dist/web/commands-tekla-parser.js +3 -0
- package/dist/web/commands.js +1 -1
- package/dist/web/connections.js +382 -0
- package/dist/web/display-units.js +15 -1
- package/dist/web/drawing-check-editor.html +289 -0
- package/dist/web/drawing-check-editor.js +1242 -0
- package/dist/web/drawing-check-overlay.js +36 -0
- package/dist/web/filter-ai-proposal.js +32 -13
- package/dist/web/index.html +29 -3
- package/dist/web/instructor.js +2 -2
- package/dist/web/local-discovery.js +144 -2
- package/dist/web/model-display-units.js +23 -9
- package/dist/web/model-viewport-revit-adapter.js +12 -2
- package/dist/web/revit-editor.css +5 -0
- package/dist/web/revit-editor.js +141 -20
- package/dist/web/steel-editor.html +166 -27
- package/dist/web/steel-filter.html +60 -166
- package/dist/web/steel-model-v2-commands.js +13 -3
- package/dist/web/steel-model-v2-projection.js +20 -0
- package/dist/web/steel-units.js +3 -1
- package/dist/web/workspaces.js +306 -22
- package/launch.mjs +5 -5
- package/package.json +3 -1
- package/dist/web/filter-ai-context.js +0 -92
|
@@ -891,7 +891,6 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
891
891
|
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, eyedropperHas, eyedropperRemove, countShown, liveOverlayElements, bgRect, textBox, textDraw, textString, applySelToFilter, hasUnsupportedSingleSheetFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, dismissibleFacetValues, switchOffBlockers, FACET_DIMS, FACET_DIM_BY_CONTROL, MODE_ORDER, facetKey, facetRowIndicesFor, NOTE_TEXT, coarseCurveNote, proofSizeNotice, sizeCheckFailureIsQuiet, SIZE_CHECK_FAILED_NOTICE } from './steel-filter-core.js';
|
|
892
892
|
import { checkpointStandard } from './checkpoint-standard.js';
|
|
893
893
|
import { filterAiBlockedLayerKeys, filterAiTouchesUnreadLayer, parseFilterAiProposal } from './filter-ai-proposal.js';
|
|
894
|
-
import { readOnlyFilterContext, rankFilterControls, filterViewFingerprint } from './filter-ai-context.js';
|
|
895
894
|
import { hitIndexBuilder, hitTest, textRunRect } from './steel-filter-hit.js';
|
|
896
895
|
|
|
897
896
|
const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
@@ -942,13 +941,13 @@ const filterHelp = window.FilterGuidance;
|
|
|
942
941
|
document.getElementById('filterScope').textContent = filterHelp.scope;
|
|
943
942
|
document.getElementById('filterCanvasRule').textContent = filterHelp.canvas;
|
|
944
943
|
// AI help about this filter lives in the shell's AI Chat panel; this page has no chat surface of its own. It owns
|
|
945
|
-
// the drawing, so it
|
|
946
|
-
// a reviewed suggestion; the chat reaches all of that through `window.__floFilterAi` below.
|
|
944
|
+
// the drawing, so it describes it to AI Chat (chatSnapshot), keeps each suggestion's base selection, and applies or
|
|
945
|
+
// undoes a reviewed suggestion; the chat reaches all of that through `window.__floFilterAi` below.
|
|
947
946
|
let filterAiFocused = null;
|
|
948
947
|
let filterAiSheetEpoch = 0; // Navigation changes the evidence used for a Change suggestion, even when facets are global.
|
|
949
948
|
let filterAiUndo = null;
|
|
950
|
-
// One record per
|
|
951
|
-
//
|
|
949
|
+
// One record per suggestion this page instance has adopted from AI Chat's server record (adoptFilterAi), with
|
|
950
|
+
// the base the AI saw. Undo lives only here, so it belongs to the page session that applied the suggestion.
|
|
952
951
|
const filterAiRecords = new Map();
|
|
953
952
|
const FILTER_AI_UNKNOWN = 'This suggestion was made before the Drawing Filter was last opened or reloaded. Ask again from the current filter to apply it.';
|
|
954
953
|
const FILTER_AI_EDITED = 'You edited the selection after applying this suggestion, so Undo is no longer available. Your edits remain.';
|
|
@@ -983,159 +982,10 @@ function focusFilterFacet(dim,label,key=facetKey(dim,label)){
|
|
|
983
982
|
notifyFilterAi();
|
|
984
983
|
}
|
|
985
984
|
|
|
986
|
-
function filterAiSnapshot(instruction=''){
|
|
987
|
-
if(!F || !sel) return { ready:false, note:'The drawing filter has not loaded yet.' };
|
|
988
|
-
const maxControls = 600;
|
|
989
|
-
const controls = [];
|
|
990
|
-
// The same canonical refusal Change uses, so a Question never advises a tick the row refuses.
|
|
991
|
-
const blockedLayerKeys = filterAiBlockedLayerKeys(F);
|
|
992
|
-
for(const dim of MODE_ORDER){
|
|
993
|
-
const descriptor = FACET_DIMS[dim];
|
|
994
|
-
const selected = sel[descriptor.control];
|
|
995
|
-
for(const row of F[descriptor.control] || []){
|
|
996
|
-
const key = facetKey(dim, row[descriptor.rowKey]);
|
|
997
|
-
controls.push({ dimension:dim, value:key === undefined ? null : (typeof key === 'string' ? key.slice(0,100) : key),
|
|
998
|
-
label:String(row[descriptor.rowKey] ?? '').slice(0,100), checked:key !== undefined && selected.has(key),
|
|
999
|
-
count:Number(row.count) || 0, notRead:dim === 'layer' && key !== undefined && blockedLayerKeys.has(key) });
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
const sheet = sheets[active];
|
|
1003
|
-
const textSamples = [];
|
|
1004
|
-
let textTotal = 0;
|
|
1005
|
-
for(const el of (sheet?.elements || [])){
|
|
1006
|
-
if(el.kind !== 'text' || !String(el.text || '').trim()) continue;
|
|
1007
|
-
textTotal++;
|
|
1008
|
-
if(textSamples.length >= 40) continue;
|
|
1009
|
-
textSamples.push({ text:String(el.text).slice(0,120), layer:String(el.layer || '').slice(0,100), selected:matchesActive(el,mode,sel) });
|
|
1010
|
-
}
|
|
1011
|
-
return { ready:true, project:PROJECT, app:APP_ID, revisionRequest:revisionRequest || null,
|
|
1012
|
-
sheet:sheetLabel(sheet, active), sheetCount:sheets.length, mode,
|
|
1013
|
-
controls:rankFilterControls(controls,instruction,filterAiFocused).slice(0,maxControls), controlTotal:controls.length,
|
|
1014
|
-
sheetTextSamples:textSamples, textTotal,
|
|
1015
|
-
focusedControl:filterAiFocused,
|
|
1016
|
-
pickedElement:eyeEl ? {kind:eyeEl.kind,layer:eyeEl.layer,text:eyeEl.text || null,w:eyeEl.w,color:eyeEl.color} : null };
|
|
1017
|
-
}
|
|
1018
|
-
function filterAiReadOnlyContext(instruction){
|
|
1019
|
-
return readOnlyFilterContext(filterAiSnapshot(instruction), instruction, filterHelp.scope);
|
|
1020
|
-
}
|
|
1021
|
-
function filterAiProjectLabel(){
|
|
1022
|
-
return window.parent !== window ? window.parent.flolessBridge?.requestScopeLabel?.(PROJECT) || PROJECT : PROJECT;
|
|
1023
|
-
}
|
|
1024
|
-
function filterAiChangeContext(instruction){
|
|
1025
|
-
if(!F || !sel) throw new Error('The Drawing Filter is still loading. Try again when its layers appear.');
|
|
1026
|
-
const facts = [filterHelp.scope, ('Sheet '+sheetLabel(sheets[active],active)+'; matching criteria '+mode+'. Checked properties must all match.').slice(0,500)];
|
|
1027
|
-
const controlRows = [];
|
|
1028
|
-
const blockedLayerKeys = filterAiBlockedLayerKeys(F);
|
|
1029
|
-
for(const dim of ['layer','thickness','color']){
|
|
1030
|
-
const descriptor = FACET_DIMS[dim];
|
|
1031
|
-
for(const row of F[descriptor.control] || []){
|
|
1032
|
-
const key = facetKey(dim,row[descriptor.rowKey]);
|
|
1033
|
-
if(key === undefined || String(key).length > 90) continue;
|
|
1034
|
-
if(dim === 'layer' && blockedLayerKeys.has(key)) continue;
|
|
1035
|
-
controlRows.push({dimension:dim,key,row,label:String(key),checked:sel[descriptor.control].has(key)});
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
const rankedRows = rankFilterControls(controlRows,instruction,filterAiFocused);
|
|
1039
|
-
let chunk = '';
|
|
1040
|
-
let listed = 0;
|
|
1041
|
-
const allowed = new Set();
|
|
1042
|
-
for(const {dimension:dim,key,row} of rankedRows){
|
|
1043
|
-
const descriptor = FACET_DIMS[dim];
|
|
1044
|
-
const entry = JSON.stringify([dim,key,sel[descriptor.control].has(key),Number(row.count)||0]);
|
|
1045
|
-
if(entry.length > 470) continue;
|
|
1046
|
-
if(chunk && chunk.length + entry.length + 1 > 490){ facts.push('Controls '+chunk); chunk = ''; }
|
|
1047
|
-
if(facts.length >= 9) break;
|
|
1048
|
-
chunk += (chunk ? ',' : '') + entry;
|
|
1049
|
-
listed++;
|
|
1050
|
-
allowed.add(dim+'\0'+String(key));
|
|
1051
|
-
}
|
|
1052
|
-
if(chunk) facts.push('Controls '+chunk);
|
|
1053
|
-
if(listed < rankedRows.length) facts.push('Only '+listed+' of '+rankedRows.length+' controls are listed, prioritised by this question and likely steel evidence. Do not claim a complete audit. Propose only listed controls.');
|
|
1054
|
-
// Every Drawing Filter message takes this path, so a question about a layer FloLess did not read
|
|
1055
|
-
// still gets the fact. Informational only: those layers are never in `allowed`, so none can be applied.
|
|
1056
|
-
// Whole names only, the ones the message names first (longest first, so S-ANNO-TEXT leads TEXT
|
|
1057
|
-
// when the message names S-ANNO-TEXT), so the one asked about is never cut off.
|
|
1058
|
-
if(blockedLayerKeys.size){
|
|
1059
|
-
const asked = String(instruction).toLowerCase();
|
|
1060
|
-
const rank = key => asked.includes(String(key).toLowerCase()) ? -String(key).length : 1;
|
|
1061
|
-
const unread = [...blockedLayerKeys].sort((a,b) => rank(a) - rank(b));
|
|
1062
|
-
let names = '', shown = 0;
|
|
1063
|
-
for(const key of unread){
|
|
1064
|
-
const next = (names ? names+', ' : '')+JSON.stringify(key);
|
|
1065
|
-
if(next.length > 4000) break;
|
|
1066
|
-
names = next; shown++;
|
|
1067
|
-
}
|
|
1068
|
-
if(shown) facts.push('Not read by FloLess, so they cannot be changed here: '+names
|
|
1069
|
-
+(shown < unread.length ? ' (and '+(unread.length-shown)+' more)' : ''));
|
|
1070
|
-
}
|
|
1071
|
-
// THE SHEET'S WORDS, not seven of them.
|
|
1072
|
-
//
|
|
1073
|
-
// This was `slice(0,7)` then `.slice(0,500)`: seven text items, cut at 500 characters, out of a
|
|
1074
|
-
// sheet with dozens. It is the list the AI answers a question about text FROM, and at that size
|
|
1075
|
-
// it mostly answered "I cannot tell from the samples". The sheet itself now travels with the
|
|
1076
|
-
// question as a picture, so this list no longer has to carry the whole burden — but there is also
|
|
1077
|
-
// no reason to ration it, and a wider one is what makes a text question answerable at all.
|
|
1078
|
-
const texts = filterAiSnapshot().sheetTextSamples || [];
|
|
1079
|
-
if(texts.length) facts.push(('Text on this sheet: '+texts.map(row=>JSON.stringify([row.layer,row.text,row.selected])).join(',')).slice(0,18000));
|
|
1080
|
-
// NO REFUSAL ON COUNT. This used to throw above twelve facts and the person got
|
|
1081
|
-
// "This filter has too many values for one AI message. Ask about one specific layer instead." —
|
|
1082
|
-
// a busy sheet could not be asked about at all, which is the opposite of what a busy sheet needs.
|
|
1083
|
-
// The budget is generous and the honest line below says what was listed; nothing is refused for
|
|
1084
|
-
// being large.
|
|
1085
|
-
// Room left for what the server appends (the sheet note, the tiles sentence, one per attached
|
|
1086
|
-
// file). Clamping to exactly the server's 200 meant those pushed it over and the message died.
|
|
1087
|
-
if(facts.length > 150) facts.length = 150;
|
|
1088
|
-
return { context:{ subject:instruction, commandId:'filter.ask-ai-change', surface:'steel-filter', tone:'idle', facts }, allowed };
|
|
1089
|
-
}
|
|
1090
985
|
function filterAiSelectionCopy(){
|
|
1091
986
|
return { mode, layers:new Set(sel.layers), thicknesses:new Set(sel.thicknesses), colors:new Set(sel.colors) };
|
|
1092
987
|
}
|
|
1093
|
-
function filterAiLocalFingerprint(){
|
|
1094
|
-
return sel ? filterViewFingerprint(active,filterAiSelectionCopy()) : null;
|
|
1095
|
-
}
|
|
1096
988
|
function filterAiSelected(state,dim,value){ return state[FACET_DIMS[dim].control].has(value); }
|
|
1097
|
-
/** Capture this filter's context and base selection, then create the read-only guide request. */
|
|
1098
|
-
// The one length limit on a Drawing Filter message, matching AI Chat's FILTER_MESSAGE_LIMIT and the
|
|
1099
|
-
// server's MAX_SUBJECT_CHARS. It was 300, which refused ordinary questions (#1681).
|
|
1100
|
-
const FILTER_MESSAGE_LIMIT = 4000;
|
|
1101
|
-
async function createFilterAiRequest(kind, text, pictures){
|
|
1102
|
-
const instruction = String(text ?? '').trim();
|
|
1103
|
-
if(kind !== 'question' && kind !== 'change') return { ok:false, message:'FloLess could not send this message. Nothing was sent. Send it again.' };
|
|
1104
|
-
if(!instruction) return { ok:false, message:'Write a question or the change you want first. Nothing was sent.' };
|
|
1105
|
-
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.' };
|
|
1106
|
-
if(!F || !sel) return { ok:false, message:'The Drawing Filter is still loading. Try again when its layers appear. Nothing was sent.' };
|
|
1107
|
-
let context, allowed = null;
|
|
1108
|
-
try {
|
|
1109
|
-
if(kind === 'change') ({ context, allowed } = filterAiChangeContext(instruction));
|
|
1110
|
-
else context = filterAiReadOnlyContext(instruction);
|
|
1111
|
-
} catch(error) { return { ok:false, message:error instanceof Error ? error.message : 'This filter cannot be described to AI right now. Nothing was sent.' }; }
|
|
1112
|
-
const record = { kind, base:filterAiSelectionCopy(), etag:serverEtag, revisionRequest, allowed,
|
|
1113
|
-
sheetEpoch:filterAiSheetEpoch, localFingerprint:filterAiLocalFingerprint(), disposition:'pending', note:'' };
|
|
1114
|
-
// A deadline, so a request that never settles cannot leave AI Chat's Send blocked.
|
|
1115
|
-
const controller = new AbortController();
|
|
1116
|
-
// Pictures ride in this body, so the deadline is no longer sized for a few hundred bytes of
|
|
1117
|
-
// narration. Long enough for a handful of screenshots on a slow disk; still a deadline, so a
|
|
1118
|
-
// request that never settles cannot leave AI Chat's Send blocked.
|
|
1119
|
-
const deadline = setTimeout(() => controller.abort(), Array.isArray(pictures) && pictures.length ? 60000 : 15000);
|
|
1120
|
-
let response, created = null;
|
|
1121
|
-
try {
|
|
1122
|
-
response = await fetch('/api/guide', { method:'POST', headers:{'content-type':'application/json'}, signal:controller.signal,
|
|
1123
|
-
body:JSON.stringify({ appId:APP_ID, ...(PROJECT ? { project:PROJECT, projectLabel:filterAiProjectLabel() } : {}), instructorContext:context,
|
|
1124
|
-
// The pictures AI Chat read off the composer. The server copies them beside the request and
|
|
1125
|
-
// hands them to the headless run on its command line; this page never opens them itself.
|
|
1126
|
-
...(Array.isArray(pictures) && pictures.length ? { snapshots:pictures } : {}) }) });
|
|
1127
|
-
created = await response.json().catch(() => null);
|
|
1128
|
-
} catch {
|
|
1129
|
-
// A deadline and a lost connection look alike here: either way the request may or may not exist.
|
|
1130
|
-
return { ok:false, message:'FloLess could not confirm whether this request started. Check Requests before sending it again.' };
|
|
1131
|
-
}
|
|
1132
|
-
finally { clearTimeout(deadline); }
|
|
1133
|
-
if(!response.ok) return { ok:false, status:response.status, reason:created?.reason ?? null,
|
|
1134
|
-
message:'FloLess could not start this request. Nothing was sent. Send it again; if it still fails, reload the Drawing Filter.' };
|
|
1135
|
-
if(!created?.request?.id) return { ok:false, message:'FloLess could not start this request. Nothing was sent. Send it again; if it still fails, reload the Drawing Filter.' };
|
|
1136
|
-
filterAiRecords.set(created.request.id, record);
|
|
1137
|
-
return { ok:true, request:created.request };
|
|
1138
|
-
}
|
|
1139
989
|
/**
|
|
1140
990
|
* Refusals shared by the chat card (inspectFilterAi) and applyFilterAi, so the card offers Apply only
|
|
1141
991
|
* when Apply would go ahead. Apply adds only the record's own kind / already-handled checks.
|
|
@@ -1144,7 +994,9 @@ function filterAiApplyCheck(record, proposal){
|
|
|
1144
994
|
// The confirmation lists what THIS selection dismisses; a programmatic activation (the chat, or
|
|
1145
995
|
// Instructor) still lands here, so refuse rather than change `sel` under it.
|
|
1146
996
|
if(!signoffOverlay.hidden) return { ok:false, message:'Close the dismissal confirmation first. Nothing was applied.' };
|
|
1147
|
-
|
|
997
|
+
// The server's record names the sheet the suggestion was made on.
|
|
998
|
+
if(record.sheet !== sheetLabel(sheets[active], active))
|
|
999
|
+
return { ok:false, message:'This suggestion was made on another sheet view. Ask again on this sheet to apply it.' };
|
|
1148
1000
|
if(saveInFlight || conflicted || checkpointSaveBlocked || serverEtag !== record.etag || revisionRequest !== record.revisionRequest)
|
|
1149
1001
|
return { ok:false, message:'This suggestion is out of date. Ask again to get a current one.' };
|
|
1150
1002
|
let parsed;
|
|
@@ -1177,12 +1029,7 @@ function inspectFilterAi(requestId, proposal){
|
|
|
1177
1029
|
const record = filterAiRecords.get(requestId);
|
|
1178
1030
|
if(!record) return { known:false, applicable:false, reason:FILTER_AI_UNKNOWN };
|
|
1179
1031
|
const result = { known:true, kind:record.kind, disposition:record.disposition, note:record.note,
|
|
1180
|
-
undo:filterAiUndo?.requestId === requestId, applicable:false, reason:null
|
|
1181
|
-
if(record.kind === 'question'){
|
|
1182
|
-
result.stale = serverEtag !== record.etag || revisionRequest !== record.revisionRequest
|
|
1183
|
-
|| filterAiLocalFingerprint() !== record.localFingerprint;
|
|
1184
|
-
return result;
|
|
1185
|
-
}
|
|
1032
|
+
undo:filterAiUndo?.requestId === requestId, applicable:false, reason:null };
|
|
1186
1033
|
if(record.disposition !== 'pending') return result;
|
|
1187
1034
|
const check = filterAiApplyCheck(record, proposal);
|
|
1188
1035
|
result.applicable = check.ok;
|
|
@@ -1265,19 +1112,66 @@ function keepFilterAi(requestId){
|
|
|
1265
1112
|
notifyFilterAi();
|
|
1266
1113
|
return { ok:true, message:record.note };
|
|
1267
1114
|
}
|
|
1115
|
+
/**
|
|
1116
|
+
* What AI Chat sends with a message while this filter is open (#1859): the sheet on screen, its selection and
|
|
1117
|
+
* EVERY control, whole — the server bounds it, lists what fits and keeps the rest readable, and works out which
|
|
1118
|
+
* controls a suggestion may name from the project's contract. No ranking, no cap here: owner ruling 2026-10-02.
|
|
1119
|
+
*/
|
|
1120
|
+
function filterAiChatSnapshot(){
|
|
1121
|
+
if(!F || !sel) return null;
|
|
1122
|
+
// A name past 300 characters is sent one character over, so the server sees it was cut (and never offers it for
|
|
1123
|
+
// a suggestion) without the message carrying the whole of an absurd name.
|
|
1124
|
+
const cutName = (value) => (typeof value === 'string' && value.length > 301 ? value.slice(0, 301) : value);
|
|
1125
|
+
const blockedLayerKeys = filterAiBlockedLayerKeys(F);
|
|
1126
|
+
const controls = [];
|
|
1127
|
+
for(const dim of MODE_ORDER){
|
|
1128
|
+
const descriptor = FACET_DIMS[dim];
|
|
1129
|
+
const selected = sel[descriptor.control];
|
|
1130
|
+
for(const row of F[descriptor.control] || []){
|
|
1131
|
+
const key = facetKey(dim, row[descriptor.rowKey]);
|
|
1132
|
+
if(key === undefined) continue;
|
|
1133
|
+
controls.push({ dimension:dim, value:cutName(key), label:cutName(String(row[descriptor.rowKey] ?? '')), checked:selected.has(key),
|
|
1134
|
+
count:Number(row.count) || 0, notRead:dim === 'layer' && blockedLayerKeys.has(key) });
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const sheet = sheets[active];
|
|
1138
|
+
const textSamples = [];
|
|
1139
|
+
let textTotal = 0;
|
|
1140
|
+
for(const el of (sheet?.elements || [])){
|
|
1141
|
+
if(el.kind !== 'text' || !String(el.text || '').trim()) continue;
|
|
1142
|
+
textTotal++;
|
|
1143
|
+
if(textSamples.length >= 200) continue;
|
|
1144
|
+
textSamples.push({ text:String(el.text).slice(0,200), layer:String(el.layer || '').slice(0,100), selected:matchesActive(el,mode,sel) });
|
|
1145
|
+
}
|
|
1146
|
+
return { sheet:sheetLabel(sheet, active), sheetEpoch:filterAiSheetEpoch, sheetCount:sheets.length, mode,
|
|
1147
|
+
selection:{ layers:[...sel.layers].map(cutName), thicknesses:[...sel.thicknesses], colors:[...sel.colors].map(cutName) },
|
|
1148
|
+
etag:serverEtag || null, revisionRequest:revisionRequest || null, controls, textSamples, textTotal };
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Take a suggestion AI Chat's server recorded against a snapshot (#1859): its base is what the person saw when the
|
|
1152
|
+
* AI wrote it, so the usual checks (same sheet, same saved filter, nothing changed under it) decide whether it
|
|
1153
|
+
* still fits. Recorded once per page instance; a reload adopts it again and starts with no Undo.
|
|
1154
|
+
*/
|
|
1155
|
+
function adoptFilterAi(key, base){
|
|
1156
|
+
if(filterAiRecords.has(key) || !base || typeof base !== 'object' || !base.selection) return;
|
|
1157
|
+
const set = (values) => new Set(Array.isArray(values) ? values : []);
|
|
1158
|
+
filterAiRecords.set(key, { kind:'change', base:{ mode:String(base.mode || mode), layers:set(base.selection.layers),
|
|
1159
|
+
thicknesses:set(base.selection.thicknesses), colors:set(base.selection.colors) }, etag:base.etag ?? null,
|
|
1160
|
+
// The page holds '' for "no drawing read", the snapshot null: one empty value, or every card reads as out of date.
|
|
1161
|
+
revisionRequest:base.revisionRequest || '', allowed:null, sheet:String(base.sheet ?? ''), disposition:'pending', note:'' });
|
|
1162
|
+
}
|
|
1268
1163
|
function filterAiSummary(){
|
|
1269
1164
|
if(document.getElementById('empty').classList.contains('show')) return { state:'unavailable' };
|
|
1270
1165
|
if(!F || !sel) return { state:'loading' };
|
|
1271
1166
|
return { state:'ready', sheet:sheetLabel(sheets[active], active), sheetCount:sheets.length,
|
|
1272
1167
|
focused:filterAiFocused ? { dimension:filterAiFocused.dimension, label:filterAiFocused.label } : null };
|
|
1273
1168
|
}
|
|
1274
|
-
// Same-origin bridge for the shell's AI Chat. Every call is synchronous
|
|
1275
|
-
//
|
|
1276
|
-
// ever be refused.
|
|
1169
|
+
// Same-origin bridge for the shell's AI Chat. Every call is synchronous, and each call that acts on a
|
|
1170
|
+
// suggestion re-checks the live page state itself, so a stale chat card can only ever be refused.
|
|
1277
1171
|
window.__floFilterAi = Object.freeze({
|
|
1278
1172
|
summary:filterAiSummary,
|
|
1279
|
-
|
|
1280
|
-
|
|
1173
|
+
chatSnapshot:filterAiChatSnapshot,
|
|
1174
|
+
adopt:(key, base) => adoptFilterAi(String(key), base),
|
|
1281
1175
|
inspect:(requestId, proposal) => inspectFilterAi(String(requestId), proposal),
|
|
1282
1176
|
apply:(requestId, proposal) => applyFilterAi(String(requestId), proposal),
|
|
1283
1177
|
undo:(requestId) => undoFilterAi(String(requestId)),
|
|
@@ -54,7 +54,15 @@ const elevMm = (mm) => ({ known: Math.round(Number(mm) * 1e9) / 1e9 });
|
|
|
54
54
|
*/
|
|
55
55
|
const carryAssumed = (prev, next) => (prev && prev.assumed === true
|
|
56
56
|
? { ...next, assumed: true, why: prev.why, checked: prev.checked }
|
|
57
|
-
|
|
57
|
+
// A height the PERSON answered on a question card (#1882) rides along only while it is still the height
|
|
58
|
+
// they gave: a move that keeps the height keeps the provenance; any change of height drops it, because
|
|
59
|
+
// the new number is no longer what they answered (and a typed elevation is their own statement anyway).
|
|
60
|
+
: prev && prev.answered && typeof prev.answered === 'object' && next && next.known === prev.known
|
|
61
|
+
? { ...next, answered: prev.answered }
|
|
62
|
+
: next);
|
|
63
|
+
|
|
64
|
+
/** A copied member is a NEW member: an answer the person gave about the original is not an answer about it. */
|
|
65
|
+
const withoutAnswer = (z) => (z && z.answered ? { known: z.known } : z);
|
|
58
66
|
|
|
59
67
|
/*
|
|
60
68
|
* The drag-start snapshot `moveWorkPoints` compares against — every field the gizmo's availability, its
|
|
@@ -1205,8 +1213,8 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
1205
1213
|
copy.id = mintId();
|
|
1206
1214
|
copy.provenance = 'manual';
|
|
1207
1215
|
copy.source = { kind: 'copy', copiedFrom: source.id };
|
|
1208
|
-
copy.from = sheetPxToWorld(worldPoint(source.from, plan, offsetPx), plan, clone(source.from.z));
|
|
1209
|
-
copy.to = sheetPxToWorld(worldPoint(source.to, plan, offsetPx), plan, clone(source.to.z));
|
|
1216
|
+
copy.from = sheetPxToWorld(worldPoint(source.from, plan, offsetPx), plan, withoutAnswer(clone(source.from.z)));
|
|
1217
|
+
copy.to = sheetPxToWorld(worldPoint(source.to, plan, offsetPx), plan, withoutAnswer(clone(source.to.z)));
|
|
1210
1218
|
const dz = Number(offsetPx[2] || 0); // MILLIMETRES, like `translateMembers` above — only x/y are pixels
|
|
1211
1219
|
if (dz) {
|
|
1212
1220
|
// Without `carryAssumed` this laundered or not DEPENDING ON THE OFFSET: with `dz === 0`
|
|
@@ -1247,6 +1255,8 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
1247
1255
|
member.from.z = carryAssumed(source.from.z, { known: known(source.from.z, `${source.id}.from`) + dz });
|
|
1248
1256
|
member.to.z = carryAssumed(source.to.z, { known: known(source.to.z, `${source.id}.to`) + dz });
|
|
1249
1257
|
if (copy) {
|
|
1258
|
+
member.from.z = withoutAnswer(member.from.z);
|
|
1259
|
+
member.to.z = withoutAnswer(member.to.z);
|
|
1250
1260
|
member.id = mintId();
|
|
1251
1261
|
member.provenance = 'manual';
|
|
1252
1262
|
member.source = { kind: 'copy', copiedFrom: source.id };
|
|
@@ -66,6 +66,26 @@ export function memberViewIds(model, memberId) {
|
|
|
66
66
|
return (model.plans || []).filter((p) => memberPresence(model, p, member).visible).map(planViewId);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The PLAN views that display this member (#1880) — `memberViewIds` restricted to `viewKind: 'plan'`.
|
|
71
|
+
*
|
|
72
|
+
* `createV2Projection` builds a plan-space projection and refuses anything that is not a plan, by design.
|
|
73
|
+
* A member read from a frame elevation (an X-brace on grid H) is displayed by that elevation and by no
|
|
74
|
+
* plan, so every "which projection draws this member" lookup that walked `memberViewIds` handed the
|
|
75
|
+
* elevation to `createV2Projection` and the throw took the whole editor down. Ask this instead whenever
|
|
76
|
+
* the answer is going to be projected. `memberViewIds` stays the honest answer to "which views show it".
|
|
77
|
+
*
|
|
78
|
+
* A row with NO `viewKind` is not a plan here either: it is never reclassified as one (see the MUST-MATCH
|
|
79
|
+
* in steel-editor-v2-must-match.test.ts), and the editor refuses such a document at boot.
|
|
80
|
+
*/
|
|
81
|
+
export function memberPlanViewIds(model, memberId) {
|
|
82
|
+
const member = (model.members || []).find((m) => m?.id === memberId);
|
|
83
|
+
if (!member) return [];
|
|
84
|
+
return (model.plans || [])
|
|
85
|
+
.filter((p) => p && p.viewKind === 'plan' && memberPresence(model, p, member).visible)
|
|
86
|
+
.map(planViewId);
|
|
87
|
+
}
|
|
88
|
+
|
|
69
89
|
/**
|
|
70
90
|
* The PAGES this member appears on — deduplicated, for display only.
|
|
71
91
|
*
|
package/dist/web/steel-units.js
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
export const FT_TO_MM = 304.8;
|
|
26
26
|
/** Millimetres per inch. Exact by international definition since 1959. */
|
|
27
27
|
export const IN_TO_MM = 25.4;
|
|
28
|
+
/** Kilograms per pound. Exact: the international avoirdupois pound is defined as 0.45359237 kg. */
|
|
29
|
+
export const LB_TO_KG = 0.45359237;
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Kilograms per metre in one pound per foot. Exact, like its two neighbours: a pound IS
|
|
@@ -36,4 +38,4 @@ export const IN_TO_MM = 25.4;
|
|
|
36
38
|
* columns convert through THIS at the display edge only. A weight crossing that edge without
|
|
37
39
|
* passing through a named constant is exactly the untagged-unit bug the epic exists to prevent.
|
|
38
40
|
*/
|
|
39
|
-
export const LB_PER_FT_TO_KG_PER_M =
|
|
41
|
+
export const LB_PER_FT_TO_KG_PER_M = LB_TO_KG / 0.3048;
|