@floless/app 0.166.0 → 0.168.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/autostart.mjs +169 -63
- package/desktop-shell.mjs +335 -0
- package/dist/floless-server.cjs +20570 -14555
- package/dist/schemas/drawing-check.profile.v1.schema.json +1 -1
- package/dist/schemas/steel.model.v2.schema.json +4 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +13 -4
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +3 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +34 -3
- package/dist/skills/floless-app-ui/SKILL.md +2 -2
- package/dist/skills/floless-app-workflows/SKILL.md +2 -2
- package/dist/templates/college-phase-exporter.flo +11 -45
- package/dist/web/agents.js +1 -1
- package/dist/web/app.css +223 -8
- package/dist/web/app.js +53 -13
- package/dist/web/aware-update-client.js +13 -5
- package/dist/web/aware.js +559 -118
- package/dist/web/chat.css +23 -0
- package/dist/web/chat.js +1003 -83
- package/dist/web/commands-filter.js +28 -5
- package/dist/web/commands-shell.js +304 -18
- package/dist/web/commands-steel.js +1 -1
- package/dist/web/desktop-window.js +435 -0
- package/dist/web/drawing-check-editor.js +18 -10
- package/dist/web/failure-copy.js +14 -1
- package/dist/web/guide.js +75 -9
- package/dist/web/index.html +72 -12
- package/dist/web/instructor.js +1 -1
- package/dist/web/leave-guard.js +347 -14
- package/dist/web/pages.js +5 -1
- package/dist/web/panels.js +5 -2
- package/dist/web/pdf-view.js +421 -0
- package/dist/web/project-history.js +133 -11
- package/dist/web/project-modules.js +3 -1
- package/dist/web/project-rfis.js +3 -1
- package/dist/web/project-workflows.js +4 -2
- package/dist/web/reference-geometry-worker.js +11 -2
- package/dist/web/revit-editor.html +1 -0
- package/dist/web/revit-editor.js +37 -8
- package/dist/web/shared-prefs.js +364 -0
- package/dist/web/steel-ai-marks.js +45 -1
- package/dist/web/steel-editor.html +265 -58
- package/dist/web/steel-filter-flo.js +243 -23
- package/dist/web/steel-filter.html +58 -16
- package/dist/web/tab-signal.js +36 -1
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +5 -0
- package/dist/web/tool-updates.js +220 -54
- package/dist/web/vector-3d.html +14 -3
- package/dist/web/vector-editor.html +10 -2
- package/dist/web/vendor/README.md +23 -0
- package/dist/web/vendor/pdfjs/LICENSE +177 -0
- package/dist/web/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/dist/web/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/dist/web/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/dist/web/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/web/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
- package/dist/web/vendor/pdfjs/iccs/LICENSE +116 -0
- package/dist/web/vendor/pdfjs/pdf.min.mjs +28 -0
- package/dist/web/vendor/pdfjs/pdf.worker.mjs +64908 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/web/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/web/vendor/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/web/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/web/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/web/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/web/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/web/workspaces.js +527 -64
- package/home-env.mjs +28 -0
- package/install-path.mjs +59 -3
- package/launch-starting-page.mjs +35 -15
- package/launch.mjs +358 -51
- package/package.json +2 -1
- package/pin-home.mjs +6 -0
- package/post-update-marker.mjs +14 -0
- package/preferences-file.mjs +289 -0
- package/supervisor-lock.mjs +195 -0
package/dist/web/workspaces.js
CHANGED
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
const { timeoutMs, ...requestOptions } = opts;
|
|
19
19
|
if (!requestOptions.signal && Number.isFinite(timeoutMs)) requestOptions.signal = AbortSignal.timeout(timeoutMs);
|
|
20
20
|
const res = await fetch(path, { headers: { 'content-type': 'application/json' }, ...requestOptions });
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
code: 'response-unreadable',
|
|
24
|
-
error: `FloLess received an unreadable response (HTTP ${res.status}).`,
|
|
25
|
-
}));
|
|
21
|
+
// An answer that is not FloLess's JSON keeps its code; the sentence comes from failureCopy below, never the status.
|
|
22
|
+
const body = await res.json().catch(() => ({ ok: false, code: 'response-unreadable' }));
|
|
26
23
|
if (!res.ok || body.ok === false) {
|
|
27
|
-
|
|
24
|
+
// #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
|
|
25
|
+
const readOnly = /^(GET|HEAD)$/.test(String(requestOptions.method || 'GET').toUpperCase());
|
|
26
|
+
const e = new Error(body.error || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text);
|
|
28
27
|
e.body = body;
|
|
29
28
|
e.status = res.status;
|
|
30
29
|
throw e;
|
|
@@ -391,6 +390,15 @@
|
|
|
391
390
|
let teklaUploadProjectId = null;
|
|
392
391
|
const teklaAdmissionFailures = new Map();
|
|
393
392
|
let currentStep = 'model';
|
|
393
|
+
// #3053: the finished-read band (see readCompletionNotice).
|
|
394
|
+
const READ_COMPLETION_SEEN = 'floless:read-complete-seen:';
|
|
395
|
+
// A read older than this is not news: without the limit, the first open after an update would announce every
|
|
396
|
+
// project's long-finished read.
|
|
397
|
+
const READ_COMPLETION_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
398
|
+
let readCompletion = null; // { projectId, seenKey, n, members, questions } for the open project, or null
|
|
399
|
+
// Newest-wins for History lookups: bumped by each lookup, a project switch and a newer read, so a late answer
|
|
400
|
+
// (A → B → A, or one that started before a new read appeared) can never install a band.
|
|
401
|
+
let readCompletionGen = 0;
|
|
394
402
|
|
|
395
403
|
// Shared drawing-file picker for both the new-project seed tile and the in-project
|
|
396
404
|
// "Attach revised drawings" button. Prefers the File System Access API so the native
|
|
@@ -1740,7 +1748,8 @@
|
|
|
1740
1748
|
// Remember WHY, so renderLanding can say "couldn't load" instead of "none yet" (they look
|
|
1741
1749
|
// identical from `projects` alone). Cleared on the next success, so a recovered load drops
|
|
1742
1750
|
// straight back to the normal empty state.
|
|
1743
|
-
|
|
1751
|
+
// The error itself, not only its text: #3097 took the status out of the text, and the hint still reads it.
|
|
1752
|
+
projectsLoadError = err || new Error('projects could not be loaded');
|
|
1744
1753
|
if (!(opts && opts.quiet)) showToast('Couldn’t load projects. Check the Workspace directory and try again.', 'warn');
|
|
1745
1754
|
}
|
|
1746
1755
|
// Paint the moment the LIST is in hand — before the archived call, not after it. That call is a
|
|
@@ -2421,10 +2430,11 @@
|
|
|
2421
2430
|
// the Knowledge viewer. Returns '' for anything unrecognised — better to show only the raw detail
|
|
2422
2431
|
// than to guess wrong about why. The raw string is shown either way, just demoted.
|
|
2423
2432
|
function projectsErrorHint(reason) {
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2433
|
+
const status = Number(reason && reason.status) || 0;
|
|
2434
|
+
const r = String((reason && reason.message) || reason || '').toLowerCase();
|
|
2435
|
+
if (status === 401 || status === 402 || /subscription|session|sign in|402/.test(r)) return 'Your sign-in needs refreshing — sign in again, then retry.';
|
|
2426
2436
|
if (/failed to fetch|networkerror|load failed|econnrefused|connection/.test(r)) return 'The local server didn’t answer.';
|
|
2427
|
-
if (/http 5\d\d/.test(r)) return 'The server hit an error listing them.';
|
|
2437
|
+
if (status >= 500 || /http 5\d\d/.test(r)) return 'The server hit an error listing them.';
|
|
2428
2438
|
return '';
|
|
2429
2439
|
}
|
|
2430
2440
|
|
|
@@ -3321,13 +3331,16 @@
|
|
|
3321
3331
|
* Start a create card's own flow. Called straight from the click, with nothing awaited first, so the native file
|
|
3322
3332
|
* picker it may open still counts as the person's own gesture.
|
|
3323
3333
|
*/
|
|
3324
|
-
async function activateSeedCard(seed, linkFrom = null) {
|
|
3334
|
+
async function activateSeedCard(seed, linkFrom = null, { buildMode = null } = {}) {
|
|
3325
3335
|
// Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
|
|
3326
3336
|
// descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
|
|
3327
3337
|
// descriptor, and the built-in id answers to no installed app.
|
|
3328
3338
|
const appId = seed.dataset.seedApp;
|
|
3329
3339
|
const templateId = seed.dataset.seedTemplate || appId;
|
|
3330
3340
|
if (!WORKSPACE_APPS[templateId]) return;
|
|
3341
|
+
// #2811: a Quick press kept for this press is used now, or dropped, whatever happens next (a cancelled picker, another
|
|
3342
|
+
// card): it never reaches a later, unrelated New project.
|
|
3343
|
+
const setupBuildMode = takePendingQuickPress(templateId, seed.dataset.seedAction, buildMode, linkFrom);
|
|
3331
3344
|
// Each create kind has its own branch below. The 'drawing' check stays a check rather than an
|
|
3332
3345
|
// assumption: a future kind must declare its own branch, not silently inherit the file picker.
|
|
3333
3346
|
if (seed.dataset.seedAction === 'drawing') {
|
|
@@ -3343,7 +3356,7 @@
|
|
|
3343
3356
|
showToast(missingWorkspaceWorkflowMessage(templateId), 'warn');
|
|
3344
3357
|
return;
|
|
3345
3358
|
}
|
|
3346
|
-
createFromDrawing(appId, templateId, files, { linkFrom });
|
|
3359
|
+
createFromDrawing(appId, templateId, files, { linkFrom, buildMode: setupBuildMode });
|
|
3347
3360
|
} else if (seed.dataset.seedAction === 'rvt') {
|
|
3348
3361
|
const file = await pickRvtFile($seedRvt);
|
|
3349
3362
|
if (file) createFromRvt(appId, templateId, file, linkFrom);
|
|
@@ -4561,7 +4574,7 @@
|
|
|
4561
4574
|
* working directory. Nothing is written while the dialog is open. Creation atomically publishes
|
|
4562
4575
|
* project.json and an unsent initial-task draft; the headless provider is not contacted here.
|
|
4563
4576
|
*/
|
|
4564
|
-
async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null } = {}) {
|
|
4577
|
+
async function createFromDrawing(appId, templateId, files, { kind = 'drawings', sourceLabel = '', teklaSource = null, returnFocus = null, linkFrom = null, buildMode = 'precise' } = {}) {
|
|
4565
4578
|
if (!$projectSetup || projectSetupState) return false;
|
|
4566
4579
|
// A Drawing Checker profile and a General project start with no source file: what goes in them comes later.
|
|
4567
4580
|
if (!Array.isArray(files) || (!files.length && !NO_FILE_SETUP_KINDS.includes(kind))) return false;
|
|
@@ -4584,8 +4597,9 @@
|
|
|
4584
4597
|
linkFrom,
|
|
4585
4598
|
askCatalogue: kind === 'drawings' && templateId === 'steel-model',
|
|
4586
4599
|
environment: null,
|
|
4587
|
-
// #2521 row 7a: Precise unless the person presses Quick; what was sent is kept in `sentBuildMode`.
|
|
4588
|
-
|
|
4600
|
+
// #2521 row 7a: Precise unless the person presses Quick; what was sent is kept in `sentBuildMode`. #2811: a card
|
|
4601
|
+
// the person clicked in a chat may open the dialog with Quick already pressed; it is asked only where Quick is.
|
|
4602
|
+
buildMode: buildMode === 'quick' && kind === 'drawings' && templateId === 'steel-model' ? 'quick' : 'precise',
|
|
4589
4603
|
// #2521 row 2c: the person's own Filter Save unless they press "Let the AI choose" (with Quick only).
|
|
4590
4604
|
filterChoice: 'person',
|
|
4591
4605
|
// Revision 3: with "Let the AI choose", the AI also approves what the read leaves out unless the person keeps it.
|
|
@@ -5042,7 +5056,13 @@
|
|
|
5042
5056
|
},
|
|
5043
5057
|
});
|
|
5044
5058
|
const uploaded = await upload.json().catch(() => ({}));
|
|
5045
|
-
|
|
5059
|
+
// #3097: the server's own sentence when it wrote one, else the shared one; never "(<status>)".
|
|
5060
|
+
if (!upload.ok || uploaded.ok === false) {
|
|
5061
|
+
console.warn('[rvt] upload refused', upload.status, uploaded);
|
|
5062
|
+
throw Object.assign(new Error(uploaded.message || uploaded.error
|
|
5063
|
+
|| failureCopy({ status: upload.status, body: uploaded }, { action: 'copy the RVT file to FloLess', unsure: 'Choose the RVT file again.' }).text),
|
|
5064
|
+
{ status: upload.status, body: uploaded });
|
|
5065
|
+
}
|
|
5046
5066
|
const receipt = uploaded.receipt;
|
|
5047
5067
|
const started = await api('/api/model-imports', { method: 'POST', body: JSON.stringify({
|
|
5048
5068
|
projectUuid: project.uuid, generation: receipt.generation, sourceSha256: receipt.sourceSha256,
|
|
@@ -5470,7 +5490,7 @@
|
|
|
5470
5490
|
// reset below; until the new document says it is ready, no step message goes to the old one.
|
|
5471
5491
|
editorBridge = null;
|
|
5472
5492
|
// #1890: a new workspace conversation suggests this project's units (the one opened last).
|
|
5473
|
-
try { localStorage.setItem('floless:last-project', p.id); } catch { /* private mode: no suggestion */ }
|
|
5493
|
+
try { if (window.flolessPrefs) window.flolessPrefs.set('lastProject', p.id); else localStorage.setItem('floless:last-project', p.id); } catch { /* private mode: no suggestion */ }
|
|
5474
5494
|
revitSourceState = null;
|
|
5475
5495
|
revitActiveOperation = null;
|
|
5476
5496
|
// Project lifecycle is project-scoped. Reset it before the first setStep so one project's model
|
|
@@ -5552,6 +5572,8 @@
|
|
|
5552
5572
|
refreshModelPresence(p.id, p.app).catch((e) => {
|
|
5553
5573
|
console.error('[workspaces] could not resolve model presence', e);
|
|
5554
5574
|
});
|
|
5575
|
+
// #3053: a read that finished while this project was closed, or before a reload, is still announced (where there is a strip).
|
|
5576
|
+
if (wsDescOf(p)?.filter) refreshReadCompletion(p).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
5555
5577
|
// BEFORE the first step renders, and that order is the fix rather than a tidy-up.
|
|
5556
5578
|
//
|
|
5557
5579
|
// `initialStep` is not always 'model' — a project re-opened from the picker keeps `currentStep`,
|
|
@@ -5821,6 +5843,24 @@
|
|
|
5821
5843
|
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
5822
5844
|
}
|
|
5823
5845
|
|
|
5846
|
+
/**
|
|
5847
|
+
* The AI's latest sentence in the AI Chat conversation running this read (`req.chatNarration`, from the Requests
|
|
5848
|
+
* poll), when it is newer than the progress record stamped `recordAt`. Null for a terminal-run read, a narration
|
|
5849
|
+
* the record already covers, or anything malformed: the record then speaks alone, exactly as before.
|
|
5850
|
+
*/
|
|
5851
|
+
// Words that belong to the software, not the drawings: the strip shows neither a record nor a chat sentence with them.
|
|
5852
|
+
const PROGRESS_INTERNAL_WORDS = /\b(?:schema|api|manifest|ledger|registration|binding|disposition|audit|reconcile|attestation|evidence|candidate|json|etag|floless-app-[a-z0-9-]+|reading-structural-drawings|steel-drawing-abbreviations|[a-z][a-z0-9.-]*\/v\d+)\b/i;
|
|
5853
|
+
|
|
5854
|
+
function chatNarrationView(req, recordAt, currentTime) {
|
|
5855
|
+
const n = req && req.chatNarration;
|
|
5856
|
+
if (req?.chatConversation?.executionOwner !== 'chat' || !n || typeof n !== 'object' || Array.isArray(n)) return null;
|
|
5857
|
+
const text = progressText(n.text);
|
|
5858
|
+
const at = typeof n.at === 'string' ? Date.parse(n.at) : NaN;
|
|
5859
|
+
if (!text || text.length > 600 || /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(text) || PROGRESS_INTERNAL_WORDS.test(text)) return null;
|
|
5860
|
+
if (!Number.isFinite(at) || at <= recordAt || currentTime - at < -PROGRESS_MAX_CLOCK_LEAD_MS) return null;
|
|
5861
|
+
return { text, at };
|
|
5862
|
+
}
|
|
5863
|
+
|
|
5824
5864
|
/**
|
|
5825
5865
|
* Turn the provider-neutral drawing checklist into the small, honest view this surface needs.
|
|
5826
5866
|
* Returns null when the record cannot be shown truthfully — the caller then says so out loud
|
|
@@ -5835,7 +5875,6 @@
|
|
|
5835
5875
|
const plainText = (value, max, nullable = false) => (nullable && value === null)
|
|
5836
5876
|
|| (typeof value === 'string' && !!value.trim() && value.length <= max
|
|
5837
5877
|
&& !/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(value));
|
|
5838
|
-
const internalVisible = /\b(?:schema|api|manifest|ledger|registration|binding|disposition|audit|reconcile|attestation|evidence|candidate|json|etag|floless-app-[a-z0-9-]+|reading-structural-drawings|steel-drawing-abbreviations|[a-z][a-z0-9.-]*\/v\d+)\b/i;
|
|
5839
5878
|
const sourceSkills = new Set([
|
|
5840
5879
|
'floless-app-steel-model', 'reading-structural-drawings', 'floless-app-steel-takeoff',
|
|
5841
5880
|
'floless-app-approval', 'steel-drawing-abbreviations',
|
|
@@ -5848,22 +5887,22 @@
|
|
|
5848
5887
|
&& exactKeys(item, ['id', 'text', 'state', 'sources', 'verification', 'note'])
|
|
5849
5888
|
&& plainText(item.id, 100) && /^[a-z0-9][a-z0-9-]*$/.test(item.id)
|
|
5850
5889
|
&& !ids.has(item.id) && !!ids.add(item.id)
|
|
5851
|
-
&& plainText(item.text, 500) && !
|
|
5890
|
+
&& plainText(item.text, 500) && !PROGRESS_INTERNAL_WORDS.test(item.text)
|
|
5852
5891
|
&& PROGRESS_ITEM_STATES.has(item.state)
|
|
5853
5892
|
&& Array.isArray(item.sources) && item.sources.length >= 1 && item.sources.length <= 10
|
|
5854
5893
|
&& item.sources.every((source) => source && typeof source === 'object' && !Array.isArray(source)
|
|
5855
5894
|
&& exactKeys(source, ['skill', 'section']) && sourceSkills.has(source.skill)
|
|
5856
5895
|
&& plainText(source.section, 200))
|
|
5857
5896
|
&& (item.verification === undefined || plainText(item.verification, 1_000))
|
|
5858
|
-
&& (item.note === undefined || (plainText(item.note, 1_000) && !
|
|
5897
|
+
&& (item.note === undefined || (plainText(item.note, 1_000) && !PROGRESS_INTERNAL_WORDS.test(item.note)))
|
|
5859
5898
|
&& (item.state !== 'done' || !!progressText(item.verification))
|
|
5860
5899
|
&& (!['blocked', 'waiting', 'provisional'].includes(item.state) || !!progressText(item.note)))
|
|
5861
5900
|
|| !Number.isSafeInteger(progress.revision) || progress.revision < 1
|
|
5862
5901
|
|| !plainText(progress.updatedAt, 50)
|
|
5863
5902
|
|| !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(progress.updatedAt)
|
|
5864
|
-
|| !plainText(progress.done, 1_000) ||
|
|
5865
|
-
|| !plainText(progress.now, 1_000, true) || (progress.now &&
|
|
5866
|
-
|| !plainText(progress.next, 1_000, true) || (progress.next &&
|
|
5903
|
+
|| !plainText(progress.done, 1_000) || PROGRESS_INTERNAL_WORDS.test(progress.done)
|
|
5904
|
+
|| !plainText(progress.now, 1_000, true) || (progress.now && PROGRESS_INTERNAL_WORDS.test(progress.now))
|
|
5905
|
+
|| !plainText(progress.next, 1_000, true) || (progress.next && PROGRESS_INTERNAL_WORDS.test(progress.next))) return null;
|
|
5867
5906
|
// The checklist shape the server guarantees per status. A record that breaks it is corrupt or
|
|
5868
5907
|
// from a future contract; either way its heading would be a claim about work nobody verified.
|
|
5869
5908
|
const nowItems = progress.items.filter((item) => item.state === 'now').length;
|
|
@@ -5876,9 +5915,13 @@
|
|
|
5876
5915
|
if (req.id && progress.requestId !== req.id) return null;
|
|
5877
5916
|
const updatedAt = Date.parse(progress.updatedAt);
|
|
5878
5917
|
if (!Number.isFinite(updatedAt)) return null;
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5918
|
+
if (currentTime - updatedAt < -PROGRESS_MAX_CLOCK_LEAD_MS) return null;
|
|
5919
|
+
// The record is the AI's checklist, rewritten only when the AI remembers to, while AI Chat shows every sentence
|
|
5920
|
+
// the AI writes as it reads. A real read narrated S-202 and S-203 in chat for eight minutes under a record still
|
|
5921
|
+
// saying it was reading the index sheets. So an active record yields to the newer chat narration, named as such.
|
|
5922
|
+
const narration = progress.status === 'active' ? chatNarrationView(req, updatedAt, currentTime) : null;
|
|
5923
|
+
const reportedAt = narration ? narration.at : updatedAt;
|
|
5924
|
+
const stale = currentTime - reportedAt >= PROGRESS_STALE_MS;
|
|
5882
5925
|
// Count only completed checklist items. Their evidence is present, but this surface has not
|
|
5883
5926
|
// independently audited it, so the UI must not promote "complete" into "verified".
|
|
5884
5927
|
const doneCount = progress.items.filter((item) => item.state === 'done').length;
|
|
@@ -5929,19 +5972,22 @@
|
|
|
5929
5972
|
now = `Return to ${backTo} for next steps.`;
|
|
5930
5973
|
next = null;
|
|
5931
5974
|
}
|
|
5975
|
+
if (narration) {
|
|
5976
|
+
nowLabel = 'Latest in AI Chat';
|
|
5977
|
+
now = narration.text;
|
|
5978
|
+
}
|
|
5932
5979
|
// A heartbeat nobody can refresh is not a heartbeat. Both arms below replace the forward-looking
|
|
5933
5980
|
// plan with a recovery route, because carrying "Next: check every connection" into a stalled or
|
|
5934
5981
|
// unreachable state presents work that is not happening as though it were queued.
|
|
5935
5982
|
if (contactLost && progress.status === 'active') {
|
|
5936
5983
|
state = 'waiting';
|
|
5937
5984
|
heading = 'Progress updates have stopped arriving';
|
|
5938
|
-
nowLabel = 'Last reported';
|
|
5939
|
-
now = progressText(progress.now) || now;
|
|
5985
|
+
nowLabel = narration ? 'Last reported in AI Chat' : 'Last reported';
|
|
5940
5986
|
next = 'FloLess could not reach its own server. This refreshes by itself when the connection returns.';
|
|
5941
5987
|
} else if (stale && progress.status === 'active') {
|
|
5942
5988
|
state = 'waiting';
|
|
5943
5989
|
heading = 'No progress update in the last 8 minutes';
|
|
5944
|
-
nowLabel = 'Last reported';
|
|
5990
|
+
nowLabel = narration ? 'Last reported in AI Chat' : 'Last reported';
|
|
5945
5991
|
next = inChat ? 'Ask the read in AI Chat to continue.' : 'Return to the same terminal AI session that prepared this read and ask it to continue.';
|
|
5946
5992
|
} else if (stale && progress.status === 'complete') {
|
|
5947
5993
|
state = 'waiting';
|
|
@@ -5960,38 +6006,57 @@
|
|
|
5960
6006
|
next,
|
|
5961
6007
|
requestId: progress.requestId,
|
|
5962
6008
|
revision: progress.revision,
|
|
5963
|
-
updatedAt: progress.updatedAt,
|
|
6009
|
+
updatedAt: narration ? new Date(narration.at).toISOString() : progress.updatedAt,
|
|
6010
|
+
...(narration ? { fromChat: true } : {}),
|
|
5964
6011
|
};
|
|
5965
6012
|
}
|
|
5966
6013
|
|
|
5967
6014
|
// #2926: no picture asked for in this long, and a conversation that is not running, means a chat-run read is not
|
|
5968
6015
|
// reading. A terminal-run read has only its pictures to prove that once its progress record is stale.
|
|
5969
6016
|
const FLO_FRESH_WORK_MS = 2 * 60_000;
|
|
6017
|
+
// A conversation still replying after it was handed this read's pictures is most likely still studying them: seen
|
|
6018
|
+
// on a real read in AI Chat (2026-11-01), all nine tiles of a sheet in under a minute, then minutes of study. It
|
|
6019
|
+
// keeps Flo thinking this long after the last picture, never longer: the reply might be to something else.
|
|
6020
|
+
const FLO_BUSY_LOOK_MS = 10 * 60_000;
|
|
5970
6021
|
const FLO_HASH = /^[0-9a-f]{64}$/;
|
|
5971
6022
|
function floLookOk(l) {
|
|
5972
6023
|
return !!l && typeof l === 'object' && typeof l.pageId === 'string' && FLO_HASH.test(l.sourceHash)
|
|
5973
6024
|
&& Number.isSafeInteger(l.pageNumber) && l.pageNumber >= 1 && Number.isSafeInteger(l.part) && l.part >= 0 && l.part <= 9
|
|
5974
6025
|
&& Number.isSafeInteger(l.seq) && Number.isFinite(l.ageMs) && l.ageMs >= 0
|
|
6026
|
+
&& (l.tiles === undefined || (Number.isSafeInteger(l.tiles) && l.tiles >= 0 && l.tiles <= 16))
|
|
5975
6027
|
&& (l.rect === null || (Array.isArray(l.rect) && l.rect.length === 4 && l.rect.every((v) => Number.isFinite(v) && v >= 0 && v <= 1)
|
|
5976
6028
|
&& l.rect[2] > l.rect[0] && l.rect[3] > l.rect[1]));
|
|
5977
6029
|
}
|
|
5978
6030
|
|
|
6031
|
+
/**
|
|
6032
|
+
* #3093: the sheets the read was handed a picture of (`steelSeen`), when it is well formed; else null, and Flo says no
|
|
6033
|
+
* count. `whole` is false when the list may be missing some (the server restarted, or forgot looks to make room).
|
|
6034
|
+
*/
|
|
6035
|
+
function floSeenOk(seen) {
|
|
6036
|
+
if (!seen || typeof seen !== 'object' || !Array.isArray(seen.sheets) || seen.sheets.length > 512) return null;
|
|
6037
|
+
const sheets = seen.sheets.filter((s) => s && FLO_HASH.test(s.sourceHash) && Number.isSafeInteger(s.pageNumber) && s.pageNumber >= 1);
|
|
6038
|
+
if (sheets.length !== seen.sheets.length) return null;
|
|
6039
|
+
return { sheets, whole: seen.sinceStart === true && seen.complete === true };
|
|
6040
|
+
}
|
|
6041
|
+
|
|
5979
6042
|
/**
|
|
5980
6043
|
* #2926: what the Drawing Filter's Flo shows for the read the progress strip speaks for, from that read's own
|
|
5981
6044
|
* signals only. `reading` while it is evidently working (with the sheet pictures it last asked for), `waiting`
|
|
5982
6045
|
* only while the AI has really asked the person something, and `off` otherwise, with the reason.
|
|
5983
6046
|
*
|
|
5984
|
-
* `view` is drawingProgressView()'s projection of the same request
|
|
6047
|
+
* `view` is drawingProgressView()'s projection of the same request: null when the AI has written no progress
|
|
6048
|
+
* record yet, or one the strip cannot show.
|
|
5985
6049
|
* ctx: { contactLost, chatAsking (AI Chat shows a question or approval on this read's conversation), pendingSave }.
|
|
5986
6050
|
*/
|
|
5987
6051
|
function filterFloState(req, view, ctx) {
|
|
5988
6052
|
ctx = ctx || {};
|
|
5989
6053
|
const off = (why) => ({ mode: 'off', why });
|
|
5990
|
-
if (!req
|
|
6054
|
+
if (!req) return off('no-read');
|
|
5991
6055
|
// Before Save, and while it holds unsaved edits, the stage is the person's own work: Flo stays off it.
|
|
5992
6056
|
if (req.filterCheckpointCurrent !== true || ctx.pendingSave) return off('not-saved');
|
|
5993
6057
|
if (ctx.contactLost) return off('contact-lost');
|
|
5994
|
-
|
|
6058
|
+
// A record the strip cannot show is no record: only its question, approval or pictures speak for the read.
|
|
6059
|
+
const progress = view ? req.steelProgress : null;
|
|
5995
6060
|
const raw = progress && progress.status;
|
|
5996
6061
|
if (raw === 'cancelled') return off('cancelled');
|
|
5997
6062
|
const chat = req.chatConversation || null;
|
|
@@ -6002,9 +6067,11 @@
|
|
|
6002
6067
|
const approval = code === 'approval' || chat?.chatState === 'awaiting-approval';
|
|
6003
6068
|
const asked = code === 'ai-question' || approval || ctx.chatAsking === true;
|
|
6004
6069
|
const chatWorking = inChat && (chat.chatState === 'starting' || chat.chatState === 'running');
|
|
6005
|
-
|
|
6006
|
-
//
|
|
6007
|
-
|
|
6070
|
+
const busy = inChat && chat.chatState === 'busy-elsewhere';
|
|
6071
|
+
// The AI writes `waiting`, then asks or stops. A conversation still replying past it has moved on (the person
|
|
6072
|
+
// pressed Save and FloLess continued the read, or typed "continue") and the record is stale until the AI next
|
|
6073
|
+
// writes it: not a question.
|
|
6074
|
+
const recordWaits = raw === 'waiting' && !chatWorking && !busy;
|
|
6008
6075
|
if (recordWaits || asked) {
|
|
6009
6076
|
const note = recordWaits ? progressText(progress.items.find((item) => item.state === 'waiting')?.note) : null;
|
|
6010
6077
|
const question = code === 'ai-question' ? progressText(req.run?.question) : null;
|
|
@@ -6013,20 +6080,31 @@
|
|
|
6013
6080
|
: code === 'ai-question' ? 'The AI has asked you a question.' : 'The AI is waiting for you in AI Chat.');
|
|
6014
6081
|
return { mode: 'waiting', text, chat: inChat };
|
|
6015
6082
|
}
|
|
6016
|
-
if (raw !== 'active') return off('not-active');
|
|
6017
6083
|
const looks = (Array.isArray(req.steelLooks) ? req.steelLooks : []).filter(floLookOk);
|
|
6018
|
-
|
|
6084
|
+
// #3093: the strip shows the AI's own sentence right above the stage, so Flo never repeats it. It says where it is,
|
|
6085
|
+
// from the looks, and how many sheets it has looked at; `note` is only for a sentence the strip does not show.
|
|
6086
|
+
const reading = (extra) => ({ mode: 'reading', looks, seen: floSeenOk(req.steelSeen), ...extra });
|
|
6087
|
+
const freshPictures = looks.some((l) => l.ageMs < (busy ? FLO_BUSY_LOOK_MS : FLO_FRESH_WORK_MS));
|
|
6088
|
+
// Seen on a real read in AI Chat (2026-11-01): the AI fetched S-201 tile by tile before it wrote its first
|
|
6089
|
+
// progress record, and Flo stayed hidden while it read. Its pictures prove the work; the words say what is unknown.
|
|
6090
|
+
// The same after Save: the record still says "waiting for you to press Save filter" (a wait the conversation has
|
|
6091
|
+
// moved past, above) until the AI next writes it.
|
|
6092
|
+
if (!view || raw === 'waiting') {
|
|
6093
|
+
return freshPictures ? reading({ note: 'Its progress list has not caught up yet.' })
|
|
6094
|
+
: off(view ? 'not-active' : 'no-record');
|
|
6095
|
+
}
|
|
6096
|
+
if (raw !== 'active') return off('not-active');
|
|
6019
6097
|
// A record the AI has not rewritten for 8 minutes is stale, but pictures it asked for in the last two, or its
|
|
6020
6098
|
// conversation still running, prove it is still at work (seen on a real read, #2926: tiles seconds old, sentence
|
|
6021
|
-
// 9 minutes old). Flo keeps going then
|
|
6099
|
+
// 9 minutes old). Flo keeps going then; the strip itself says its sentence is the last one reported.
|
|
6022
6100
|
if (view.state !== 'active') {
|
|
6023
|
-
return freshPictures || chatWorking ? {
|
|
6101
|
+
return freshPictures || chatWorking ? reading({}) : off('not-active');
|
|
6024
6102
|
}
|
|
6025
6103
|
// Pictures for this very read are proof of work even when the chat calls its turn busy elsewhere, which it
|
|
6026
6104
|
// does whenever the person typed into the read's conversation and the read carried on.
|
|
6027
6105
|
const working = freshPictures || !inChat || chatWorking;
|
|
6028
6106
|
if (!working) return off('idle');
|
|
6029
|
-
return {
|
|
6107
|
+
return reading({});
|
|
6030
6108
|
}
|
|
6031
6109
|
|
|
6032
6110
|
// Keeps the last read and view applyStageGating() painted (`syncFilterFlo.last`), so a chat question opening
|
|
@@ -6212,11 +6290,160 @@
|
|
|
6212
6290
|
|
|
6213
6291
|
function wireStageGuidanceFilterAction() {
|
|
6214
6292
|
$stageGuidance?.addEventListener('click', (e) => {
|
|
6293
|
+
const done = e.target.closest('[data-read-done]');
|
|
6294
|
+
if (done) { readCompletionAction(done.dataset.readDone); return; }
|
|
6215
6295
|
if (!e.target.closest('[data-revfilter]')) return;
|
|
6216
6296
|
openDrawingFilterNextAction();
|
|
6217
6297
|
});
|
|
6218
6298
|
}
|
|
6219
6299
|
|
|
6300
|
+
// ── #3053: "Your model is ready to view" ─────────────────────────────────────────────────────
|
|
6301
|
+
// A finished drawing read used to say so only in a toast, which a person working in the Drawing Filter, or
|
|
6302
|
+
// reading the AI's long summary, missed. The strip now keeps a completion band until they close it. It is
|
|
6303
|
+
// decided from History, never from the AI's words or a request disappearing: the newest version must be one a
|
|
6304
|
+
// drawing read saved, and no other read may be waiting, failed or staged (the strip shows those instead).
|
|
6305
|
+
// (Its state, READ_COMPLETION_* and `readCompletion`, is declared beside `currentStep`: the strip can paint early in boot.)
|
|
6306
|
+
|
|
6307
|
+
/** The completion band a project's History calls for, or null. `versions` newest first; `seen`: the newest version already closed. */
|
|
6308
|
+
function readCompletionNotice(versions, seen, now) {
|
|
6309
|
+
const tip = Array.isArray(versions) ? versions[0] : null;
|
|
6310
|
+
if (!tip || tip.kind !== 'revision-read' || !Number.isSafeInteger(tip.n) || tip.n <= seen) return null;
|
|
6311
|
+
const at = Date.parse(tip.ts || '');
|
|
6312
|
+
if (!Number.isFinite(at) || now - at > READ_COMPLETION_MAX_AGE_MS) return null;
|
|
6313
|
+
const count = (value) => (Number.isSafeInteger(value) && value >= 0 ? value : null);
|
|
6314
|
+
return { n: tip.n, members: count(tip.readiness?.physicalMemberCount), questions: count(tip.readiness?.currentUnansweredQuestionCount) };
|
|
6315
|
+
}
|
|
6316
|
+
|
|
6317
|
+
const readCompletionKey = (proj) => READ_COMPLETION_SEEN + (proj.uuid || proj.id);
|
|
6318
|
+
function readCompletionSeen(seenKey) {
|
|
6319
|
+
try { const n = Number(localStorage.getItem(seenKey)); return Number.isSafeInteger(n) ? n : 0; }
|
|
6320
|
+
catch { return 0; }
|
|
6321
|
+
}
|
|
6322
|
+
function markReadCompletionSeen(seenKey, n) {
|
|
6323
|
+
try { if (n > readCompletionSeen(seenKey)) localStorage.setItem(seenKey, String(n)); }
|
|
6324
|
+
catch { /* private mode: the band comes back on the next open, which is the safe side */ }
|
|
6325
|
+
}
|
|
6326
|
+
|
|
6327
|
+
/** Set the open project's band from its History (`vr`: an answer already in hand). Repaints the strip. */
|
|
6328
|
+
async function refreshReadCompletion(proj, vr = null) {
|
|
6329
|
+
if (!proj) return;
|
|
6330
|
+
const gen = ++readCompletionGen;
|
|
6331
|
+
let answer = vr;
|
|
6332
|
+
if (!answer) {
|
|
6333
|
+
try { answer = await api(`/api/projects/${encodeURIComponent(proj.id)}/versions`); }
|
|
6334
|
+
catch (err) {
|
|
6335
|
+
// History that cannot be read now shows no band; it is looked up again on the next open or read. No toast in
|
|
6336
|
+
// its place: a read that leaves the list unseen may have been discarded in another tab, and one applied here
|
|
6337
|
+
// was already confirmed by its review dialog ("Revision applied").
|
|
6338
|
+
if (current?.id === proj.id && gen === readCompletionGen) console.warn('[workspaces] could not read History for the drawing-read notice', err);
|
|
6339
|
+
return;
|
|
6340
|
+
}
|
|
6341
|
+
}
|
|
6342
|
+
if (current?.id !== proj.id || gen !== readCompletionGen) return;
|
|
6343
|
+
const seenKey = readCompletionKey(proj);
|
|
6344
|
+
const notice = readCompletionNotice(answer?.versions, readCompletionSeen(seenKey), Date.now());
|
|
6345
|
+
readCompletion = notice ? { projectId: proj.id, seenKey, ...notice } : null;
|
|
6346
|
+
applyStageGating();
|
|
6347
|
+
}
|
|
6348
|
+
|
|
6349
|
+
/**
|
|
6350
|
+
* A newer read for this project replaces the band of every version up to its starting point — painted or not, so
|
|
6351
|
+
* clearing that read later never announces an older one as new — and voids any History lookup still out.
|
|
6352
|
+
*/
|
|
6353
|
+
function retireReadCompletion(proj, baseVersion) {
|
|
6354
|
+
if (!proj || !Number.isSafeInteger(baseVersion) || baseVersion <= 0) return;
|
|
6355
|
+
readCompletionGen++;
|
|
6356
|
+
markReadCompletionSeen(readCompletionKey(proj), baseVersion);
|
|
6357
|
+
if (readCompletion && readCompletion.n <= baseVersion) readCompletion = null;
|
|
6358
|
+
}
|
|
6359
|
+
|
|
6360
|
+
/** The band's own contents. `step`: the open project step (Open model is left out on Model, where it would do nothing). */
|
|
6361
|
+
function buildReadCompletion(notice, step) {
|
|
6362
|
+
const el = (tag, className, text) => {
|
|
6363
|
+
const node = document.createElement(tag);
|
|
6364
|
+
if (className) node.className = className;
|
|
6365
|
+
if (text) node.textContent = text;
|
|
6366
|
+
return node;
|
|
6367
|
+
};
|
|
6368
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
6369
|
+
const head = el('div', 'wsg-head');
|
|
6370
|
+
const signal = el('span', 'wsg-signal');
|
|
6371
|
+
signal.setAttribute('aria-hidden', 'true');
|
|
6372
|
+
head.append(signal, el('strong', '', 'Your model is ready to view.'));
|
|
6373
|
+
const line = el('p', 'wsg-done-line', `Drawing read finished. Version ${notice.n} is on History`
|
|
6374
|
+
+ (notice.members === null ? '' : ` with ${plural(notice.members, 'member', 'members')}`)
|
|
6375
|
+
+ `. ${step === 'model' ? 'You can explore it here.' : 'Open the Model tab to explore it.'} It has not been checked or approved.`);
|
|
6376
|
+
const parts = [head, line];
|
|
6377
|
+
if (notice.questions) {
|
|
6378
|
+
parts.push(el('p', 'wsg-done-line', `${plural(notice.questions, 'question', 'questions')} from the read still `
|
|
6379
|
+
+ `${notice.questions === 1 ? 'needs' : 'need'} your answer.`));
|
|
6380
|
+
}
|
|
6381
|
+
const tip = el('p', 'wsg-done-line');
|
|
6382
|
+
tip.append(el('strong', '', 'We strongly recommend starting a new chat for your next task.'),
|
|
6383
|
+
document.createTextNode(' A chat that ran a drawing read holds a lot of context, so continuing in it may use more tokens and cost more.'));
|
|
6384
|
+
parts.push(tip);
|
|
6385
|
+
const actions = el('div', 'wsg-actions');
|
|
6386
|
+
const button = (action, label, className, commandId, hint) => {
|
|
6387
|
+
const b = el('button', className, label);
|
|
6388
|
+
b.type = 'button';
|
|
6389
|
+
b.dataset.readDone = action;
|
|
6390
|
+
b.dataset.commandId = commandId;
|
|
6391
|
+
b.setAttribute('data-tip', hint);
|
|
6392
|
+
actions.appendChild(b);
|
|
6393
|
+
};
|
|
6394
|
+
if (step !== 'model') button('open', 'Open model', 'btn-mini primary', 'shell.read-complete-open-model', 'Go to the Model tab to explore the model this read built');
|
|
6395
|
+
button('chat', 'Start new chat', 'btn-mini', 'shell.read-complete-new-chat', 'Open a fresh AI Chat conversation in this project. This one stays in your chat history.');
|
|
6396
|
+
button('dismiss', 'Dismiss', 'btn-mini wsg-dismiss', 'shell.read-complete-dismiss', 'Close this notice. The model and History are unchanged.');
|
|
6397
|
+
parts.push(actions);
|
|
6398
|
+
return parts;
|
|
6399
|
+
}
|
|
6400
|
+
|
|
6401
|
+
/** Paint the band into the strip: always expanded, announced once per version, never moving focus. */
|
|
6402
|
+
function paintReadCompletion(notice) {
|
|
6403
|
+
const key = `read-done:${notice.projectId}:${notice.n}:${notice.members}:${notice.questions}:${currentStep === 'model'}`;
|
|
6404
|
+
$stageGuidance.hidden = false;
|
|
6405
|
+
if ($stageGuidance._renderKey === key) return;
|
|
6406
|
+
const announced = String($stageGuidance._renderKey || '').startsWith(`read-done:${notice.projectId}:${notice.n}:`);
|
|
6407
|
+
$stageGuidance._renderKey = key;
|
|
6408
|
+
$stageGuidance.className = 'ws-stage-guidance state-complete';
|
|
6409
|
+
$stageGuidance.replaceChildren(...buildReadCompletion(notice, currentStep));
|
|
6410
|
+
markScrollable($stageGuidance);
|
|
6411
|
+
const live = document.getElementById('ws-stage-guidance-live');
|
|
6412
|
+
if (live && !announced) live.textContent = 'Drawing read finished. Your model is ready to view in the Model tab.';
|
|
6413
|
+
}
|
|
6414
|
+
|
|
6415
|
+
function readCompletionAction(action) {
|
|
6416
|
+
const notice = readCompletion;
|
|
6417
|
+
if (!notice || current?.id !== notice.projectId) return;
|
|
6418
|
+
if (action === 'open') {
|
|
6419
|
+
setStep('model');
|
|
6420
|
+
applyStageGating();
|
|
6421
|
+
// The band on Model has no Open model button, so focus follows the person to the tab they asked for.
|
|
6422
|
+
$stepTabs?.querySelector('button[data-step="model"]')?.focus();
|
|
6423
|
+
return;
|
|
6424
|
+
}
|
|
6425
|
+
if (action === 'chat') {
|
|
6426
|
+
Promise.resolve().then(() => {
|
|
6427
|
+
if (typeof window.flolessChat?.startNewChat !== 'function') {
|
|
6428
|
+
throw Object.assign(new Error('AI Chat is still loading. Try Start new chat again in a moment.'), { personCopy: true });
|
|
6429
|
+
}
|
|
6430
|
+
return window.flolessChat.startNewChat(notice.projectId);
|
|
6431
|
+
}).catch((err) => {
|
|
6432
|
+
// A reason AI Chat wrote for the person is shown as it is; anything else is an unexpected failure. Opening a
|
|
6433
|
+
// new chat changes nothing, so it is always safe to try again.
|
|
6434
|
+
if (err?.personCopy) showToast(`Couldn’t start a new chat. ${err.message}`, 'warn');
|
|
6435
|
+
else showFailureToast(err, { action: 'start a new chat', retrySafe: true });
|
|
6436
|
+
});
|
|
6437
|
+
return;
|
|
6438
|
+
}
|
|
6439
|
+
if (action !== 'dismiss') return;
|
|
6440
|
+
markReadCompletionSeen(notice.seenKey, notice.n);
|
|
6441
|
+
readCompletion = null;
|
|
6442
|
+
applyStageGating();
|
|
6443
|
+
// The button is gone with the band: put focus on the step the person is on rather than letting it drop to the page.
|
|
6444
|
+
$stepTabs?.querySelector('button[data-step].active')?.focus();
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6220
6447
|
function stageGuidanceRow(label, text) {
|
|
6221
6448
|
const row = document.createElement('div');
|
|
6222
6449
|
row.className = 'wsg-row';
|
|
@@ -6269,7 +6496,7 @@
|
|
|
6269
6496
|
const scope = projectId ?? (typeof current !== 'undefined' && current ? current.id : '');
|
|
6270
6497
|
const choices = $stageGuidance._collapseChoices ||= new Map();
|
|
6271
6498
|
const key = `${scope}:` + (progress
|
|
6272
|
-
? `progress:${progress.requestId}:${progress.state}:${progress.revision}:${progress.heading}`
|
|
6499
|
+
? `progress:${progress.requestId}:${progress.state}:${progress.revision}:${progress.heading}:${progress.updatedAt}`
|
|
6273
6500
|
: `text:${state}:${typeof content === 'string' ? content : ''}`);
|
|
6274
6501
|
$stageGuidance.hidden = false;
|
|
6275
6502
|
if ($stageGuidance._renderKey === key) return;
|
|
@@ -6574,7 +6801,8 @@
|
|
|
6574
6801
|
const unavailableInitial = initialRead && lastRevState === 'unavailable';
|
|
6575
6802
|
const ownsProgress = waitingForInitial && stageGuidanceOwnsSavedCheckpoint(revCardReq);
|
|
6576
6803
|
const liveProgress = ownsProgress ? drawingProgressView(revCardReq, Date.now(), revRequestsFailed) : null;
|
|
6577
|
-
|
|
6804
|
+
// Flo follows the read the strip owns even before its first progress record: its pictures are enough.
|
|
6805
|
+
syncFilterFlo(ownsProgress ? revCardReq : null, liveProgress);
|
|
6578
6806
|
if (ownsProgress && revCardReq?.steelProgress && !liveProgress) {
|
|
6579
6807
|
const revision = Number.isSafeInteger(revCardReq.steelProgress.revision)
|
|
6580
6808
|
? String(revCardReq.steelProgress.revision) : `invalid:${String(revCardReq.steelProgress.revision)}`;
|
|
@@ -6598,6 +6826,11 @@
|
|
|
6598
6826
|
// Saving the Filter can unlock the tabs while its initial drawing read is still running.
|
|
6599
6827
|
// Progress belongs to that read, not to the prerequisite gate; only idle guidance needs a gate.
|
|
6600
6828
|
if (!locked && !stripPending) {
|
|
6829
|
+
// #3053: with nothing else to say and no other read in flight, a finished read's band stays up until closed.
|
|
6830
|
+
if (readCompletion && current?.id === readCompletion.projectId && lastRevState === 'none' && revisionListKnown) {
|
|
6831
|
+
paintReadCompletion(readCompletion);
|
|
6832
|
+
return;
|
|
6833
|
+
}
|
|
6601
6834
|
clearStageGuidance();
|
|
6602
6835
|
return;
|
|
6603
6836
|
}
|
|
@@ -7677,6 +7910,12 @@
|
|
|
7677
7910
|
const keptEdits = onProject() && editorHasUnsavedEdits();
|
|
7678
7911
|
if (onProject() && !keptEdits) reloadModelFromServerTruth();
|
|
7679
7912
|
const fresh = onProject() ? await refreshApprovalState(project.id) : null;
|
|
7913
|
+
// #3053: an approval puts its own version on top of History, so a finished-read band saying "It has not been
|
|
7914
|
+
// checked or approved" is over: History is asked again, and an approve row at the head shows no band.
|
|
7915
|
+
// (`typeof`: the approval tests lift this function on its own, without the band's code.)
|
|
7916
|
+
if (onProject() && typeof refreshReadCompletion === 'function') {
|
|
7917
|
+
refreshReadCompletion(project).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
7918
|
+
}
|
|
7680
7919
|
// A recovered receipt's count is from when it was approved; edits made since are pending now, so a
|
|
7681
7920
|
// recovery reports the count just read back, and when that read failed it says so (null) rather than
|
|
7682
7921
|
// claiming "No changes remain pending" over work it never looked at.
|
|
@@ -8514,6 +8753,7 @@
|
|
|
8514
8753
|
let viewEpoch = 0; // invalidates in-flight preview loads
|
|
8515
8754
|
let knowledgeRenderEpoch = 0; // invalidates in-flight /status loads (poll ticks race verbs)
|
|
8516
8755
|
let kbTextAbort = null; // AbortController for the in-flight preview fetch
|
|
8756
|
+
let kbPdfView = null; // #3018: FloLess's own PDF viewer on the open preview — its worker is released with it
|
|
8517
8757
|
let lastRefsHtml = null; // exact rendered HTML of the refs host, or null to force a repaint
|
|
8518
8758
|
/* The graph's index page, stashed when the graph loads. The step header carries the ✦ Overview
|
|
8519
8759
|
button, and the header is painted from knowledgeState — which does NOT hold the graph, because
|
|
@@ -8578,6 +8818,13 @@
|
|
|
8578
8818
|
function kbAbortPreview() {
|
|
8579
8819
|
viewEpoch += 1;
|
|
8580
8820
|
if (kbTextAbort) { try { kbTextAbort.abort(); } catch { /* already settled */ } kbTextAbort = null; }
|
|
8821
|
+
kbReleasePdf();
|
|
8822
|
+
}
|
|
8823
|
+
|
|
8824
|
+
/** #3018: close the PDF viewer on the preview, if one is open, before anything replaces it. Its pdf.js worker, page
|
|
8825
|
+
* pictures and download link live outside the DOM, so emptying the host alone would leave them behind. */
|
|
8826
|
+
function kbReleasePdf() {
|
|
8827
|
+
if (kbPdfView) { kbPdfView.destroy(); kbPdfView = null; }
|
|
8581
8828
|
}
|
|
8582
8829
|
|
|
8583
8830
|
/** THE one place `viewer` changes. Detaches native `src` (an already-started iframe/image load
|
|
@@ -9901,6 +10148,7 @@
|
|
|
9901
10148
|
}
|
|
9902
10149
|
|
|
9903
10150
|
const kbPaintView = (row, bodyHtml) => {
|
|
10151
|
+
kbReleasePdf();
|
|
9904
10152
|
const host = kbViewHost();
|
|
9905
10153
|
if (host) host.innerHTML = kbViewShell(row, bodyHtml);
|
|
9906
10154
|
};
|
|
@@ -9974,7 +10222,7 @@
|
|
|
9974
10222
|
return;
|
|
9975
10223
|
}
|
|
9976
10224
|
|
|
9977
|
-
if (row.mime === 'application/pdf') kbPaintPdf(row, url);
|
|
10225
|
+
if (row.mime === 'application/pdf') await kbPaintPdf(proj, row, url, ac, alive);
|
|
9978
10226
|
else if (row.mime === 'image/png' || row.mime === 'image/jpeg' || row.mime === 'image/webp') kbPaintImage(row, url, alive);
|
|
9979
10227
|
else kbPaintText(row, url, ac, alive);
|
|
9980
10228
|
}
|
|
@@ -10334,12 +10582,34 @@
|
|
|
10334
10582
|
kbPaintNoPreview(fresh, fresh.kind === 'file' ? 'missing' : 'nofile');
|
|
10335
10583
|
}
|
|
10336
10584
|
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
kbPaintView(row,
|
|
10342
|
-
|
|
10585
|
+
/** #3018: a PDF is drawn by FloLess's own viewer (web/pdf-view.js), never the browser's in an <iframe>, whose light
|
|
10586
|
+
* scrollbar and random-id title FloLess's CSS cannot reach. It reads the file ONCE and draws exactly those bytes; the
|
|
10587
|
+
* HEAD before it proves nothing about this GET, so this answer is checked on its own (a 404 is the missing path). */
|
|
10588
|
+
async function kbPaintPdf(proj, row, url, ac, alive) {
|
|
10589
|
+
kbPaintView(row, kbViewLoading(row));
|
|
10590
|
+
let data;
|
|
10591
|
+
try {
|
|
10592
|
+
const res = await fetch(url, { signal: ac.signal, cache: 'no-store' });
|
|
10593
|
+
if (!alive()) { await res.body?.cancel().catch(() => {}); return; }
|
|
10594
|
+
if (res.status === 404) { await kbHandleMissing(proj, row, alive); return; }
|
|
10595
|
+
if (!res.ok) {
|
|
10596
|
+
kbPaintError(row, res.status === 402
|
|
10597
|
+
? 'Your session needs refreshing — sign in again and retry.'
|
|
10598
|
+
: 'The server hit an error trying to read it.');
|
|
10599
|
+
return;
|
|
10600
|
+
}
|
|
10601
|
+
data = new Uint8Array(await res.arrayBuffer());
|
|
10602
|
+
} catch (err) {
|
|
10603
|
+
if (err && err.name === 'AbortError') return; // superseded — never paint
|
|
10604
|
+
if (alive()) kbPaintError(row, 'Lost the connection while loading it.');
|
|
10605
|
+
return;
|
|
10606
|
+
}
|
|
10607
|
+
if (!alive()) return;
|
|
10608
|
+
kbPaintView(row, '');
|
|
10609
|
+
const body = kbViewHost()?.querySelector('.kb-view-body');
|
|
10610
|
+
if (!body) return;
|
|
10611
|
+
// The header above already names the file, so the viewer's toolbar does not say it twice.
|
|
10612
|
+
kbPdfView = window.flolessPdfView.mount(body, { bytes: data, name: row.filename || 'untitled.pdf', showName: false });
|
|
10343
10613
|
}
|
|
10344
10614
|
|
|
10345
10615
|
/** A 200 does NOT imply a decodable image: sniffMime matches a 3-byte JPEG (FF D8 FF) and the upload
|
|
@@ -10674,6 +10944,7 @@
|
|
|
10674
10944
|
if ($wsKnowledge.querySelector('.kb-split')) return;
|
|
10675
10945
|
// The rail and the stub are SIBLINGS of .kb-refs-host, never children of it: the host's innerHTML
|
|
10676
10946
|
// is replaced wholesale on every poll repaint, so anything inside it is destroyed 3 s later.
|
|
10947
|
+
kbReleasePdf();
|
|
10677
10948
|
$wsKnowledge.innerHTML = kbStepHeadHtml(knowledgeState) +
|
|
10678
10949
|
'<div class="kb-split">' +
|
|
10679
10950
|
'<div class="kb-refs-host" id="kb-refs-host"></div>' +
|
|
@@ -10928,8 +11199,10 @@
|
|
|
10928
11199
|
catch (err) {
|
|
10929
11200
|
if (stale()) return;
|
|
10930
11201
|
stopKnowledgePoll();
|
|
11202
|
+
// #3097: what could not be done, why and what to do, from the shared copy; the error itself is for the console.
|
|
11203
|
+
console.warn('[workspaces] the knowledge base could not be loaded', err);
|
|
10931
11204
|
kbPaintRefsMessage(
|
|
10932
|
-
`<div class="kb-empty"
|
|
11205
|
+
`<div class="kb-empty">${escapeHtml(failureCopy(err, { action: 'load the knowledge base', retrySafe: true }).text)}</div>`);
|
|
10933
11206
|
return;
|
|
10934
11207
|
}
|
|
10935
11208
|
if (stale()) return; // switched project/step — or opened a confirm — during the fetch
|
|
@@ -15401,6 +15674,8 @@
|
|
|
15401
15674
|
*/
|
|
15402
15675
|
let revisionBuildAsk = null; // #2521 row 7b: the open confirm step after the file picker, if any (askRevisionBuild)
|
|
15403
15676
|
function resetRevisionState() {
|
|
15677
|
+
readCompletion = null; // #3053: the band belongs to the project being left
|
|
15678
|
+
readCompletionGen++;
|
|
15404
15679
|
lastRevState = 'none';
|
|
15405
15680
|
revisionListKnown = false;
|
|
15406
15681
|
revCardReq = null;
|
|
@@ -16172,10 +16447,20 @@
|
|
|
16172
16447
|
// rows describing a version that had just been superseded. Clicking Details then resolved
|
|
16173
16448
|
// no receipt and did nothing at all — a control that answers a click with silence.
|
|
16174
16449
|
if (!$wsExports.hidden) safeRenderExports('after the revision read');
|
|
16175
|
-
|
|
16450
|
+
// #3053: the strip's completion band says it, and keeps saying it after a toast would have gone. An app with no
|
|
16451
|
+
// Drawing Filter (Vectorize) has no strip, so it keeps the toast.
|
|
16452
|
+
if (wsApp()?.filter) refreshReadCompletion(proj, vr).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
16453
|
+
else showToast('Revision read complete — a new version is on History', 'ok');
|
|
16176
16454
|
}
|
|
16177
16455
|
}
|
|
16456
|
+
// #3053: a reviewed read goes staged → none when the person applies it, not pending → none, and publishes its version
|
|
16457
|
+
// from the review dialog. Any read leaving the list asks History again; only a new drawing-read version shows the band.
|
|
16458
|
+
if (lastRevState !== 'none' && lastRevState !== 'pending' && state === 'none' && wsApp()?.filter) {
|
|
16459
|
+
refreshReadCompletion(proj).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
16460
|
+
}
|
|
16178
16461
|
lastRevState = state;
|
|
16462
|
+
// #3053: another read for this project starts from a version; a band for that version or an older one is over.
|
|
16463
|
+
if (activeRequest) retireReadCompletion(proj, Number.isSafeInteger(activeRequest.baseVersion) ? activeRequest.baseVersion : 0);
|
|
16179
16464
|
if (state === 'none') {
|
|
16180
16465
|
revCardReq = null;
|
|
16181
16466
|
syncDrawingRevisionRequest('');
|
|
@@ -17687,9 +17972,11 @@
|
|
|
17687
17972
|
: code === 'revision-request-retired'
|
|
17688
17973
|
? 'This review was applied elsewhere and is no longer available. Close this message to see the current project.'
|
|
17689
17974
|
: 'This drawing read has already been discarded. Close this message to attach the set again.';
|
|
17975
|
+
if (!terminal) console.warn('[revision] discard failed', error);
|
|
17690
17976
|
$revDiscardError.textContent = terminal
|
|
17691
17977
|
? conflictMessage
|
|
17692
|
-
:
|
|
17978
|
+
// #3097: the shared sentence, never the request's own text: a lost answer may have discarded it anyway.
|
|
17979
|
+
: failureCopy(error, { action: 'discard this read', unsure: 'Reopen the review to check whether it was discarded before trying again.' }).text;
|
|
17693
17980
|
$revDiscardError.hidden = false;
|
|
17694
17981
|
$revDiscardDialog.removeAttribute('aria-busy');
|
|
17695
17982
|
$revDiscardCancel.disabled = false;
|
|
@@ -17840,6 +18127,13 @@
|
|
|
17840
18127
|
if (current && current.id === st.projectId) {
|
|
17841
18128
|
current.approvedAt = undefined; // applying a read clears the sign-off; exports re-lock
|
|
17842
18129
|
if (!$wsHistory.hidden) renderHistory();
|
|
18130
|
+
// #3053: the version this review just published is the finished read the strip's band announces. The request
|
|
18131
|
+
// poll cannot see it as a completion any more (`lastRevState` is already 'none'), so do here what its completion
|
|
18132
|
+
// edge does: an applied FIRST read is what makes the model exist, so the tab gates and the approval header are
|
|
18133
|
+
// asked again (otherwise Model stays locked, and the band with it, until a reload), and History for the band.
|
|
18134
|
+
refreshModelPresence(current.id, current.app, true).catch((e) => console.error('[workspaces] post-apply model presence did not refresh', e));
|
|
18135
|
+
refreshApprovalState(current.id).catch((e) => console.error('[workspaces] approval header did not refresh after the apply', e));
|
|
18136
|
+
if (wsApp()?.filter) refreshReadCompletion(current).catch((e) => console.error('[workspaces] drawing-read notice failed', e));
|
|
17843
18137
|
}
|
|
17844
18138
|
$revReviewTitle.textContent = 'Revision applied';
|
|
17845
18139
|
$revReviewSub.textContent = `Version v${res.version?.n ?? res.versionN ?? '—'} is now on History.`;
|
|
@@ -18663,6 +18957,9 @@
|
|
|
18663
18957
|
{ key: 'removed', label: 'Removed' },
|
|
18664
18958
|
{ key: 'resized', label: 'Resized' },
|
|
18665
18959
|
{ key: 'moved', label: 'Moved' },
|
|
18960
|
+
// #2997: ends moved by less than History's move threshold (server/steel-diff.ts MOVE_THRESHOLD_TEXT, the same two
|
|
18961
|
+
// strings). Named by the rule, not "small", so a 2" base drop never reads as ignorable. Optional on the wire.
|
|
18962
|
+
{ key: 'nudged', label: 'Moved under 6 in', labelMm: 'Moved under 152.4 mm', optional: true },
|
|
18666
18963
|
{ key: 'material', label: 'Material' },
|
|
18667
18964
|
{ key: 'changed', label: 'Source questions' },
|
|
18668
18965
|
{ key: 'connections', label: 'Connections' },
|
|
@@ -18724,6 +19021,13 @@
|
|
|
18724
19021
|
if (it.ref.sheet) line.appendChild(el('span', 'hd-sheet', it.ref.sheet));
|
|
18725
19022
|
return line;
|
|
18726
19023
|
}
|
|
19024
|
+
function diffMemberNudged(it) {
|
|
19025
|
+
const line = el('div', 'hd-item');
|
|
19026
|
+
line.appendChild(el('span', 'hd-mark', it.ref.mark || it.ref.id));
|
|
19027
|
+
line.appendChild(el('span', 'hd-prof', `moved up to ${it.text}`));
|
|
19028
|
+
if (it.ref.sheet) line.appendChild(el('span', 'hd-sheet', it.ref.sheet));
|
|
19029
|
+
return line;
|
|
19030
|
+
}
|
|
18727
19031
|
function diffMemberConn(it) {
|
|
18728
19032
|
const line = el('div', 'hd-item');
|
|
18729
19033
|
line.appendChild(el('span', 'hd-mark', it.ref.mark || it.ref.id));
|
|
@@ -18743,14 +19047,15 @@
|
|
|
18743
19047
|
if (key === 'added' || key === 'removed') return diffMemberBasic(it);
|
|
18744
19048
|
if (key === 'resized' || key === 'material') return diffMemberXform(it.ref, it.from, it.to);
|
|
18745
19049
|
if (key === 'moved') return diffMemberMoved(it);
|
|
19050
|
+
if (key === 'nudged') return diffMemberNudged(it);
|
|
18746
19051
|
if (key === 'changed') return diffProvisionalChanged(it);
|
|
18747
19052
|
return diffMemberConn(it);
|
|
18748
19053
|
}
|
|
18749
|
-
function diffGroup(g, items) {
|
|
19054
|
+
function diffGroup(g, items, units) {
|
|
18750
19055
|
if (!items || !items.length) return null;
|
|
18751
19056
|
const box = el('div', `hd-group ${g.key}`);
|
|
18752
19057
|
const head = el('div', 'hd-type');
|
|
18753
|
-
head.appendChild(el('span', null, g.label.toUpperCase()));
|
|
19058
|
+
head.appendChild(el('span', null, (units === 'mm' && g.labelMm ? g.labelMm : g.label).toUpperCase()));
|
|
18754
19059
|
head.appendChild(document.createTextNode(' '));
|
|
18755
19060
|
head.appendChild(el('span', 'hd-count', `(${items.length})`));
|
|
18756
19061
|
box.appendChild(head);
|
|
@@ -18761,17 +19066,25 @@
|
|
|
18761
19066
|
// the server spells them the same way (`server/bom-units.ts`), so the pane and the sentence beneath
|
|
18762
19067
|
// it cannot disagree about what a number is.
|
|
18763
19068
|
const DIFF_TONNAGE_WORD = { 'ft-in': 'tons', mm: 't' };
|
|
19069
|
+
const DIFF_WEIGHT_WORD = { 'ft-in': 'lb', mm: 'kg' };
|
|
19070
|
+
const diffWeightFormat = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });
|
|
18764
19071
|
function diffNetHeader(t) {
|
|
18765
19072
|
const wrap = el('div', 'hd-net');
|
|
18766
|
-
const
|
|
19073
|
+
const tonnage = t && typeof t.netTonnage === 'number' ? t.netTonnage : 0;
|
|
19074
|
+
const weight = t && typeof t.netWeight === 'number' && Number.isFinite(t.netWeight) ? t.netWeight : 0;
|
|
18767
19075
|
// The units come off the comparison, never from a page-level preference: a panel showing an older
|
|
18768
19076
|
// comparison must keep saying what THAT comparison measured. `wellFormedDiff` has already refused
|
|
18769
19077
|
// anything whose `units` is not one of the two, so the fallback is unreachable rather than a guess.
|
|
18770
|
-
const
|
|
19078
|
+
const units = t && DIFF_TONNAGE_WORD[t.units] ? t.units : 'ft-in';
|
|
19079
|
+
// #2997: under a tenth of a ton the figure reads 0 and contradicts the row's own "increased by 3 lb", so
|
|
19080
|
+
// it drops to the weight — the same rule the History sentence uses (server/version-diff.ts).
|
|
19081
|
+
const byWeight = Math.abs(tonnage) < 0.1 && Math.round(Math.abs(weight)) >= 1; // a rounding residue is not a change
|
|
19082
|
+
const net = byWeight ? weight : tonnage;
|
|
19083
|
+
const shown = byWeight ? `${diffWeightFormat.format(Math.abs(weight))} ${DIFF_WEIGHT_WORD[units]}` : `${Math.abs(tonnage)} ${DIFF_TONNAGE_WORD[units]}`;
|
|
18771
19084
|
if (net === 0) wrap.classList.add('flat');
|
|
18772
19085
|
wrap.appendChild(el('span', 'hd-net-label', 'Net steel:'));
|
|
18773
19086
|
wrap.appendChild(el('span', 'hd-net-arrow', net > 0 ? '▲' : net < 0 ? '▼' : '•'));
|
|
18774
|
-
wrap.appendChild(el('span', 'hd-net-val', `${net > 0 ? '+' : ''}${
|
|
19087
|
+
wrap.appendChild(el('span', 'hd-net-val', `${net > 0 ? '+' : net < 0 ? '-' : ''}${shown}`));
|
|
18775
19088
|
// #2735: the bill prices members on ASSUMED heights, so these totals can rest on them. Say so on its own
|
|
18776
19089
|
// line under the figure (a label, not a reliability warning, so not an .hd-warn banner).
|
|
18777
19090
|
const assumed = diffAssumedNoteText(t);
|
|
@@ -18842,10 +19155,20 @@
|
|
|
18842
19155
|
panel.appendChild(diffNetHeader(diff.tonnage));
|
|
18843
19156
|
let any = false;
|
|
18844
19157
|
for (const g of DIFF_GROUPS) {
|
|
18845
|
-
const grp = diffGroup(g, diff[g.key]);
|
|
19158
|
+
const grp = diffGroup(g, diff[g.key], diff.tonnage && diff.tonnage.units);
|
|
18846
19159
|
if (grp) { panel.appendChild(grp); any = true; }
|
|
18847
19160
|
}
|
|
18848
|
-
if (!any) {
|
|
19161
|
+
if (!any && diff.tonnage && Math.round(Math.abs(Number(diff.tonnage.netWeight) || 0)) >= 1) {
|
|
19162
|
+
// #2997: never "No changes detected" beside a weight that changed — the two would contradict each other.
|
|
19163
|
+
const t = diff.tonnage;
|
|
19164
|
+
const units = DIFF_WEIGHT_WORD[t.units] ? t.units : 'ft-in';
|
|
19165
|
+
const by = `${t.netWeight > 0 ? '+' : '-'}${diffWeightFormat.format(Math.abs(t.netWeight))} ${DIFF_WEIGHT_WORD[units]}`;
|
|
19166
|
+
// A member that could not be compared may be the cause, so a partial comparison names no culprit.
|
|
19167
|
+
const uncompared = Array.isArray(diff.incomparable) ? diff.incomparable.length : 0;
|
|
19168
|
+
panel.appendChild(el('div', 'hd-empty', uncompared
|
|
19169
|
+
? `The steel weight changed by ${by}. ${uncompared} ${uncompared === 1 ? 'member' : 'members'} could not be compared, so FloLess can’t say which change caused it.`
|
|
19170
|
+
: `The steel weight changed by ${by}, but FloLess found no member change that accounts for it.${diff.unchanged ? ` ${diff.unchanged} members compared.` : ''}`));
|
|
19171
|
+
} else if (!any) {
|
|
18849
19172
|
panel.appendChild(el('div', 'hd-empty', `No changes detected${diff.unchanged ? ` — ${diff.unchanged} members unchanged` : ''}.`));
|
|
18850
19173
|
} else if (diff.unchanged) {
|
|
18851
19174
|
panel.appendChild(el('div', 'hd-tail', `${diff.unchanged} members unchanged`));
|
|
@@ -18879,9 +19202,12 @@
|
|
|
18879
19202
|
&& (!Object.prototype.hasOwnProperty.call(value, 'scaleUnknown') || typeof value.scaleUnknown === 'boolean');
|
|
18880
19203
|
const connection = (value) => !!value && typeof value === 'object' && !Array.isArray(value)
|
|
18881
19204
|
&& ref(value.ref) && typeof value.summary === 'string';
|
|
18882
|
-
const
|
|
19205
|
+
const nudged = (value) => !!value && typeof value === 'object' && !Array.isArray(value)
|
|
19206
|
+
&& ref(value.ref) && Number.isFinite(value.mm) && typeof value.text === 'string' && !!value.text;
|
|
19207
|
+
const validators = { added: ref, removed: ref, resized: xform, moved, nudged, material: xform, changed: connection, connections: connection };
|
|
18883
19208
|
if (!DIFF_GROUPS.every((group) =>
|
|
18884
|
-
|
|
19209
|
+
(group.optional && !Object.prototype.hasOwnProperty.call(diff, group.key))
|
|
19210
|
+
|| (Array.isArray(diff[group.key]) && diff[group.key].every(validators[group.key])))) return false;
|
|
18885
19211
|
return ['duplicateKeys', 'ambiguousJoints', 'mergedAmbiguous'].every((key) =>
|
|
18886
19212
|
!Object.prototype.hasOwnProperty.call(diff.warnings, key)
|
|
18887
19213
|
|| (Array.isArray(diff.warnings[key]) && diff.warnings[key].every((value) => typeof value === 'string')));
|
|
@@ -19928,6 +20254,60 @@
|
|
|
19928
20254
|
return { kind: 'create', done: activateSeedCard(seed, linkFrom) };
|
|
19929
20255
|
}
|
|
19930
20256
|
|
|
20257
|
+
/**
|
|
20258
|
+
* #2811: New project for a Steel model from drawings, from a card the person clicked in a chat or a terminal request.
|
|
20259
|
+
* Called straight from that click, with nothing awaited first, so the file picker it opens is still the person's own
|
|
20260
|
+
* gesture. `quick` presses Quick model in the dialog. The Drawing Filter question is left as the dialog always asks
|
|
20261
|
+
* it (the person's own Save): whether the AI may choose the Filter is only ever the person's click there.
|
|
20262
|
+
*/
|
|
20263
|
+
async function openNewProjectFromDrawings({ quick = false } = {}) {
|
|
20264
|
+
pendingQuickPress = 0; // a newer card replaces an older one's ask
|
|
20265
|
+
const seed = usableSteelDrawingSeed();
|
|
20266
|
+
if (seed) {
|
|
20267
|
+
// The picker opens inside the click; Workspaces is entered while it is open, so the project Create makes is the one
|
|
20268
|
+
// on screen (a card already drawn may be behind Workflows or Agents, and opening a project keeps the current view).
|
|
20269
|
+
const opened = activateSeedCard(seed, null, { buildMode: quick ? 'quick' : 'precise' });
|
|
20270
|
+
await setMode('workspaces');
|
|
20271
|
+
await opened;
|
|
20272
|
+
return { ok: true };
|
|
20273
|
+
}
|
|
20274
|
+
// Workspaces not drawn yet (another view was open), or Steel Model not set up: Workspaces, at its card. Waiting for
|
|
20275
|
+
// the cards uses up the click, so the picker cannot open from it; the person's own press on the card does that, and
|
|
20276
|
+
// a Quick asked for here is pressed for them then (within a few minutes, once).
|
|
20277
|
+
await setMode('workspaces');
|
|
20278
|
+
if (current) await leaveProjectToList();
|
|
20279
|
+
if (current) return { ok: false, said: 'You stayed in this project, so New project was not opened. Ask again when you are ready.' };
|
|
20280
|
+
for (let i = 0; i < 60 && !$landing.querySelector('[data-seed-app]'); i++) await new Promise((r) => setTimeout(r, 500));
|
|
20281
|
+
const ready = usableSteelDrawingSeed();
|
|
20282
|
+
const card = ready || $landing.querySelector('[data-seed-template="steel-model"]');
|
|
20283
|
+
card?.scrollIntoView?.({ block: 'nearest' });
|
|
20284
|
+
card?.focus?.();
|
|
20285
|
+
if (ready) {
|
|
20286
|
+
pendingQuickPress = quick ? Date.now() + PENDING_QUICK_PRESS_MS : 0;
|
|
20287
|
+
return { ok: false, said: `Workspaces is open at Steel model from drawings. Press it to choose your drawings${quick ? ', and New project opens with Quick model pressed.' : '.'}` };
|
|
20288
|
+
}
|
|
20289
|
+
return { ok: false, said: card
|
|
20290
|
+
? 'Steel Model isn’t ready to start a project yet. Workspaces is open at its card, which says what it needs.'
|
|
20291
|
+
: 'Steel Model isn’t installed here, so there is no Steel model to start. Workspaces is open.' };
|
|
20292
|
+
}
|
|
20293
|
+
function usableSteelDrawingSeed() {
|
|
20294
|
+
const seed = $landing.querySelector('[data-seed-template="steel-model"][data-seed-action="drawing"]');
|
|
20295
|
+
return seed && !seed.classList.contains('ws-seed-remedy') && !createCardRemedy(seed) ? seed : null;
|
|
20296
|
+
}
|
|
20297
|
+
/**
|
|
20298
|
+
* #2811: a Quick press a chat card asked for, kept for the person's own press on the Steel model card. Every card press
|
|
20299
|
+
* takes it, used or not, so it applies to that one press at most; an explicit choice from a card wins.
|
|
20300
|
+
*/
|
|
20301
|
+
const PENDING_QUICK_PRESS_MS = 5 * 60_000;
|
|
20302
|
+
let pendingQuickPress = 0;
|
|
20303
|
+
function takePendingQuickPress(templateId, seedAction, explicit, linkFrom) {
|
|
20304
|
+
// Only the landing's own Steel model card: a module added from a General project never inherits a chat card's ask.
|
|
20305
|
+
const quick = templateId === 'steel-model' && seedAction === 'drawing' && !linkFrom && pendingQuickPress > Date.now();
|
|
20306
|
+
pendingQuickPress = 0;
|
|
20307
|
+
if (explicit) return explicit;
|
|
20308
|
+
return quick ? 'quick' : 'precise';
|
|
20309
|
+
}
|
|
20310
|
+
|
|
19931
20311
|
/** Open a project by id, from another project's Modules step: the same open a card on the landing does. */
|
|
19932
20312
|
async function openLinkedProject(projectId) {
|
|
19933
20313
|
await setMode('workspaces');
|
|
@@ -19949,7 +20329,8 @@
|
|
|
19949
20329
|
await setMode('workspaces');
|
|
19950
20330
|
if (current) await leaveProjectToList(returnFocus);
|
|
19951
20331
|
if (current) return false;
|
|
19952
|
-
|
|
20332
|
+
// #3082: coming from another page, the list draws a moment after the switch; wait for it (bounded) before opening it.
|
|
20333
|
+
const archived = await landingPart('.ws-archived');
|
|
19953
20334
|
if (archived) { archived.open = true; archived.scrollIntoView?.({ block: 'nearest' }); archived.querySelector('summary')?.focus?.(); }
|
|
19954
20335
|
return true;
|
|
19955
20336
|
}
|
|
@@ -19962,6 +20343,86 @@
|
|
|
19962
20343
|
if (current?.id !== projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
19963
20344
|
}
|
|
19964
20345
|
|
|
20346
|
+
/**
|
|
20347
|
+
* #3082: open the one project a suggestion card named — by its id, and only while it is still that incarnation — at the
|
|
20348
|
+
* step it named (`model` or `history`) when that kind of project has it. Opening is all it does: nothing is approved,
|
|
20349
|
+
* compiled, run or exported. Resolves `{ ok: true, said? }`, `said` being a sentence when the project opened at another
|
|
20350
|
+
* step than asked; throws a sentence written for the person (`plain`) when it did not open.
|
|
20351
|
+
*/
|
|
20352
|
+
let suggestedOpenSeq = 0;
|
|
20353
|
+
/** A card's press claims its place in line when pressed, before any check, so a later press always wins. */
|
|
20354
|
+
function claimSuggestedOpen() { return ++suggestedOpenSeq; }
|
|
20355
|
+
async function openSuggestedProject(target, ticket) {
|
|
20356
|
+
// The latest navigation wins: a press whose check is still waiting gives way to a later card or any other open.
|
|
20357
|
+
const mine = Number.isInteger(ticket) ? ticket : claimSuggestedOpen();
|
|
20358
|
+
let navAtStart = openNavSeq;
|
|
20359
|
+
const overtaken = () => mine !== suggestedOpenSeq || openNavSeq !== navAtStart;
|
|
20360
|
+
const fail = (sentence) => Object.assign(new Error(sentence), { plain: true });
|
|
20361
|
+
const projectId = target?.id;
|
|
20362
|
+
const name = typeof target?.name === 'string' && target.name ? target.name : 'That project';
|
|
20363
|
+
if (typeof projectId !== 'string' || !projectId) throw fail('That project could not be opened. Open it from Workspaces.');
|
|
20364
|
+
await setMode('workspaces');
|
|
20365
|
+
if (mode !== 'workspaces') throw fail(`You stayed where you were, so ${name} was not opened.`);
|
|
20366
|
+
if (mine !== suggestedOpenSeq) return { superseded: true };
|
|
20367
|
+
navAtStart = openNavSeq; // switching to Workspaces may itself navigate; count only what happens from here
|
|
20368
|
+
// The list as the server has it now, so a project made again under the same id is never opened in its place.
|
|
20369
|
+
// A list that cannot be read proves nothing, so nothing is opened on it.
|
|
20370
|
+
let row = null;
|
|
20371
|
+
try { row = (await api('/api/projects')).projects.find((p) => p.id === projectId) || null; }
|
|
20372
|
+
catch (error) {
|
|
20373
|
+
if (overtaken()) return { superseded: true };
|
|
20374
|
+
console.warn('[workspaces] could not read the projects to open a suggested one:', error);
|
|
20375
|
+
throw fail(`FloLess couldn’t check ${name} just now, so it was not opened. Try again in a moment.`);
|
|
20376
|
+
}
|
|
20377
|
+
if (overtaken()) return { superseded: true };
|
|
20378
|
+
const sameIncarnation = (p) => !target.uuid || p?.uuid === target.uuid;
|
|
20379
|
+
if (!row || !sameIncarnation(row)) throw fail(`${name} is no longer in this workspace, so it was not opened. Choose a project on Workspaces.`);
|
|
20380
|
+
const want = target.step === 'history' ? 'history' : target.step === 'model' ? 'model' : null;
|
|
20381
|
+
const hasStep = (key) => Boolean(wsDescOf(row)?.steps?.some((st) => st.key === key));
|
|
20382
|
+
// This window still holds an older project under the same id (open, or in its list): opening by id would open that
|
|
20383
|
+
// one, and would skip the unsaved-work question for it. Open nothing; Workspaces reads the list again.
|
|
20384
|
+
const older = (current?.id === projectId && !sameIncarnation(current)) || projects.some((p) => p.id === projectId && !sameIncarnation(p));
|
|
20385
|
+
if (older) throw fail(`This window still shows an older project in ${name}’s place, so it was not opened. Go back to all projects, then open ${name} from Workspaces.`);
|
|
20386
|
+
if (current?.id === projectId) {
|
|
20387
|
+
// Already open: only its step changes, so nothing loaded in the editor is reset.
|
|
20388
|
+
if (want && hasStep(want) && currentStep !== want) setStep(want);
|
|
20389
|
+
} else {
|
|
20390
|
+
const opened = await openProject(projectId, want && hasStep(want) ? want : 'model');
|
|
20391
|
+
if (opened === STAYED_IN_PROJECT) throw fail(`You stayed in this project, so ${name} was not opened.`);
|
|
20392
|
+
if (current?.id !== projectId) throw fail(`${name} could not be opened. Open it from Workspaces to see why.`);
|
|
20393
|
+
if (!sameIncarnation(current)) throw fail(`The project open now is not the ${name} the suggestion named. Choose a project on Workspaces.`);
|
|
20394
|
+
}
|
|
20395
|
+
if (!want) return { ok: true };
|
|
20396
|
+
const label = want === 'history' ? 'History' : 'Model';
|
|
20397
|
+
if (!hasStep(want)) return { ok: true, said: `${name} has no ${label} step, so it opened at ${stepLabel(currentStep)}.` };
|
|
20398
|
+
// A step the project's stages keep locked: say where it opened and the stage's own reason. A step still being checked
|
|
20399
|
+
// opens by itself once it can.
|
|
20400
|
+
if (currentStep !== want && pendingPresenceStep?.step !== want) {
|
|
20401
|
+
const reason = stageGateFor(want);
|
|
20402
|
+
return { ok: true, said: `${name} opened at ${stepLabel(currentStep)}, because its ${label} step isn’t available yet.${reason ? ` ${reason}` : ''}` };
|
|
20403
|
+
}
|
|
20404
|
+
return { ok: true };
|
|
20405
|
+
}
|
|
20406
|
+
|
|
20407
|
+
/** #3082: the Workspaces list itself, for choosing a project when the one a suggestion named is gone. */
|
|
20408
|
+
async function showProjectList(returnFocus) {
|
|
20409
|
+
await setMode('workspaces');
|
|
20410
|
+
if (current) await leaveProjectToList(returnFocus);
|
|
20411
|
+
if (current) return false;
|
|
20412
|
+
(await landingPart('[data-open]'))?.focus?.();
|
|
20413
|
+
return true;
|
|
20414
|
+
}
|
|
20415
|
+
|
|
20416
|
+
/** One part of the Workspaces list, once it is drawn: up to five seconds after a page switch, else null. */
|
|
20417
|
+
async function landingPart(selector) {
|
|
20418
|
+
for (let i = 0; i < 25; i++) {
|
|
20419
|
+
const found = $landing.querySelector(selector);
|
|
20420
|
+
if (found) return found;
|
|
20421
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
20422
|
+
}
|
|
20423
|
+
return null;
|
|
20424
|
+
}
|
|
20425
|
+
|
|
19965
20426
|
// The Drawing Filter step of a project, where a drawing read's exclusions are saved and signed off.
|
|
19966
20427
|
async function openDrawingsStep(projectId) {
|
|
19967
20428
|
if (typeof projectId !== 'string' || !projectId) throw new Error('That project could not be opened. Open it from Workspaces.');
|
|
@@ -20480,7 +20941,9 @@
|
|
|
20480
20941
|
setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
|
|
20481
20942
|
openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, openDrawingsStep, openWorkflowsStep, openConnection, openDrawingAt, drawingFilterCheckpointSaved,
|
|
20482
20943
|
// #2470 R6.7: the Modules step of a General project (project-modules.js).
|
|
20483
|
-
moduleCreateCardsHtml, activateCreateCard, openLinkedProject, openModulesStep, showArchivedProjects,
|
|
20944
|
+
moduleCreateCardsHtml, activateCreateCard, openNewProjectFromDrawings, openLinkedProject, openModulesStep, showArchivedProjects,
|
|
20945
|
+
// #3082: a Guide or assistant card that names one project, and where to choose another when it is gone.
|
|
20946
|
+
openSuggestedProject, claimSuggestedOpen, showProjectList,
|
|
20484
20947
|
syncWorkspaceReporter, openChatOwner, openPagesHome, folderDecisionCompleted,
|
|
20485
20948
|
// Project access (project-access.js loads after this file): the project open now, or null.
|
|
20486
20949
|
currentProject: () => ($app.classList.contains('mode-workspaces') && current ? current : null),
|