@floless/app 0.167.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.
Files changed (257) hide show
  1. package/autostart.mjs +169 -63
  2. package/desktop-shell.mjs +335 -0
  3. package/dist/floless-server.cjs +14518 -11361
  4. package/dist/schemas/steel.model.v2.schema.json +2 -1
  5. package/dist/skills/floless-app-onboarding/SKILL.md +13 -4
  6. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +3 -0
  7. package/dist/skills/floless-app-steel-takeoff/SKILL.md +21 -2
  8. package/dist/skills/floless-app-ui/SKILL.md +2 -2
  9. package/dist/skills/floless-app-workflows/SKILL.md +2 -2
  10. package/dist/web/agents.js +1 -1
  11. package/dist/web/app.css +165 -8
  12. package/dist/web/app.js +53 -13
  13. package/dist/web/aware-update-client.js +13 -5
  14. package/dist/web/aware.js +183 -39
  15. package/dist/web/chat.css +2 -1
  16. package/dist/web/chat.js +410 -80
  17. package/dist/web/commands-filter.js +5 -5
  18. package/dist/web/commands-shell.js +172 -10
  19. package/dist/web/commands-steel.js +1 -1
  20. package/dist/web/desktop-window.js +435 -0
  21. package/dist/web/drawing-check-editor.js +18 -10
  22. package/dist/web/failure-copy.js +14 -1
  23. package/dist/web/guide.js +75 -9
  24. package/dist/web/index.html +64 -6
  25. package/dist/web/instructor.js +1 -1
  26. package/dist/web/leave-guard.js +347 -14
  27. package/dist/web/pages.js +5 -1
  28. package/dist/web/panels.js +5 -2
  29. package/dist/web/pdf-view.js +421 -0
  30. package/dist/web/project-history.js +2 -1
  31. package/dist/web/project-modules.js +3 -1
  32. package/dist/web/project-rfis.js +3 -1
  33. package/dist/web/project-workflows.js +4 -2
  34. package/dist/web/reference-geometry-worker.js +11 -2
  35. package/dist/web/revit-editor.html +1 -0
  36. package/dist/web/revit-editor.js +37 -8
  37. package/dist/web/shared-prefs.js +364 -0
  38. package/dist/web/steel-editor.html +204 -43
  39. package/dist/web/steel-filter-flo.js +74 -18
  40. package/dist/web/steel-filter.html +22 -6
  41. package/dist/web/tab-signal.js +36 -1
  42. package/dist/web/tekla-editor.html +1 -0
  43. package/dist/web/tool-updates.js +159 -38
  44. package/dist/web/vector-3d.html +14 -3
  45. package/dist/web/vector-editor.html +10 -2
  46. package/dist/web/vendor/README.md +23 -0
  47. package/dist/web/vendor/pdfjs/LICENSE +177 -0
  48. package/dist/web/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  49. package/dist/web/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  50. package/dist/web/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  51. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  52. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  53. package/dist/web/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  54. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  55. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  56. package/dist/web/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  57. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  58. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  59. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  60. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  61. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  62. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  63. package/dist/web/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  64. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  65. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  66. package/dist/web/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  67. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  68. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  69. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  70. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  71. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  72. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  73. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  74. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  75. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  76. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  77. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  78. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  79. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  80. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  81. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  82. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  83. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  84. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  85. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  86. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  87. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  88. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  89. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  90. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  91. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  92. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  93. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  94. package/dist/web/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  95. package/dist/web/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  96. package/dist/web/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  97. package/dist/web/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  98. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  99. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  100. package/dist/web/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  101. package/dist/web/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  102. package/dist/web/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  103. package/dist/web/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  104. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  105. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  106. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  107. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  108. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  109. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  110. package/dist/web/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  111. package/dist/web/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  112. package/dist/web/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  113. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  114. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  115. package/dist/web/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  116. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  117. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  118. package/dist/web/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  119. package/dist/web/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  120. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  121. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  122. package/dist/web/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  123. package/dist/web/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  124. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  125. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  126. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  127. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  128. package/dist/web/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  129. package/dist/web/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  130. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  131. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  132. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  133. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  134. package/dist/web/vendor/pdfjs/cmaps/H.bcmap +0 -0
  135. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  136. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  137. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  138. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  139. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  140. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  141. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  142. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  143. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  144. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  145. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  146. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  147. package/dist/web/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  148. package/dist/web/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  149. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  150. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  151. package/dist/web/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  152. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  153. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  154. package/dist/web/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  155. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  156. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  157. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  158. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  159. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  160. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  161. package/dist/web/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  162. package/dist/web/vendor/pdfjs/cmaps/LICENSE +36 -0
  163. package/dist/web/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  164. package/dist/web/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  165. package/dist/web/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  166. package/dist/web/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  167. package/dist/web/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  168. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  169. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  170. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  171. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  172. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  173. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  174. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  175. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  176. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  177. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  178. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  179. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  180. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  181. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  182. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  183. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  184. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  185. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  186. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  187. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  188. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  189. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  190. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  191. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  192. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  193. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  194. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  195. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  196. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  197. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  198. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  199. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  200. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  201. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  202. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  203. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  204. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  205. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  206. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  207. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  208. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  209. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  210. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  211. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  212. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  213. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  214. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  215. package/dist/web/vendor/pdfjs/cmaps/V.bcmap +0 -0
  216. package/dist/web/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  217. package/dist/web/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  218. package/dist/web/vendor/pdfjs/iccs/LICENSE +116 -0
  219. package/dist/web/vendor/pdfjs/pdf.min.mjs +28 -0
  220. package/dist/web/vendor/pdfjs/pdf.worker.mjs +64908 -0
  221. package/dist/web/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  222. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  223. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  224. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  225. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  226. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  227. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  228. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  229. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  230. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  231. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  232. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  233. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  234. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  235. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  236. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  237. package/dist/web/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  238. package/dist/web/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  239. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  240. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  241. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  242. package/dist/web/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
  243. package/dist/web/vendor/pdfjs/wasm/jbig2.wasm +0 -0
  244. package/dist/web/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  245. package/dist/web/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
  246. package/dist/web/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  247. package/dist/web/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
  248. package/dist/web/workspaces.js +167 -26
  249. package/home-env.mjs +28 -0
  250. package/install-path.mjs +59 -3
  251. package/launch-starting-page.mjs +35 -15
  252. package/launch.mjs +358 -51
  253. package/package.json +2 -1
  254. package/pin-home.mjs +6 -0
  255. package/post-update-marker.mjs +14 -0
  256. package/preferences-file.mjs +289 -0
  257. package/supervisor-lock.mjs +195 -0
@@ -153,10 +153,12 @@
153
153
  },
154
154
  stop: {
155
155
  title: 'Stop FloLess?',
156
- clean: 'FloLess will close on this computer. Open it again from the Start menu or the desktop shortcut whenever you need it.',
156
+ clean: 'FloLess will close on this computer, and nothing will run until it is open again. You can open it from the Start menu or the desktop shortcut.',
157
157
  unsaved: 'Some of your work is not saved yet. Save it before FloLess closes?',
158
158
  running: 'A workflow is running. Stopping FloLess ends it.',
159
159
  confirm: 'Stop FloLess', save: 'Save and stop', discard: 'Stop without saving',
160
+ // The safe answer is the default one here: stopping ends routines and watchers, so the first button keeps FloLess running.
161
+ cancel: 'Keep running',
160
162
  working: 'Stopping FloLess…',
161
163
  failed: 'FloLess could not stop just now, so it is still running. Try again in a moment.',
162
164
  },
@@ -169,6 +171,17 @@
169
171
  working: 'Signing out…',
170
172
  failed: 'FloLess could not sign you out just now, so you are still signed in. Try again in a moment.',
171
173
  },
174
+ // The FloLess window's own close (web/desktop-window.js answers the shell's close request through confirmClose). Closing
175
+ // the window does not stop the server, so a running workflow carries on.
176
+ close: {
177
+ title: 'Close FloLess?',
178
+ clean: 'This window will close. FloLess keeps running in the background, so you can open the window again from the Start menu or the desktop shortcut. To end FloLess completely, use Stop FloLess in the menu.',
179
+ unsaved: 'Some of your work is not saved yet. Save it before this window closes?',
180
+ running: 'A workflow is running. Closing the window does not stop it. It keeps running in the background, and you can open FloLess again to see the result.',
181
+ confirm: 'Close window', save: 'Save and close', discard: 'Close without saving',
182
+ working: 'Closing…',
183
+ failed: 'The window could not close just now. Try again in a moment.',
184
+ },
172
185
  // Switching to another project, or back to the project list, replaces the open project's editors.
173
186
  // An AI Chat read keeps going and is there when you come back, so it is not part of this question.
174
187
  project: {
@@ -184,6 +197,8 @@
184
197
 
185
198
  var $modal = null;
186
199
  var openPromise = null;
200
+ var openActionName = null; // the open question's action ('stop', 'signout', …), or null
201
+ var extras = null; // the open Stop question's painter of "what stopping means", re-run after every render()
187
202
  // The open question's handlers. The buttons, backdrop and keys are wired ONCE (wireOnce) and
188
203
  // route here, so no listener is left behind between questions.
189
204
  var current = null;
@@ -196,6 +211,8 @@
196
211
  el('leave-guard-confirm').addEventListener('click', route('confirm'));
197
212
  el('leave-guard-discard').addEventListener('click', route('discard'));
198
213
  el('leave-guard-save').addEventListener('click', route('save'));
214
+ el('leave-guard-wait').addEventListener('click', route('wait'));
215
+ el('leave-guard-autostart').addEventListener('click', route('autostart'));
199
216
  $modal.addEventListener('mousedown', route('backdropDown'));
200
217
  $modal.addEventListener('click', route('backdropClick'));
201
218
  // Capture: this question sits above every other dialog, so its keys must not reach them.
@@ -245,6 +262,95 @@
245
262
  el('leave-guard-confirm').hidden = unsaved;
246
263
  el('leave-guard-save').hidden = !unsaved;
247
264
  el('leave-guard-discard').hidden = !unsaved;
265
+ paintCancel(action);
266
+ if (extras) extras();
267
+ }
268
+
269
+ /** The safe button's words: "Keep running" for Stop FloLess, "Cancel" everywhere else (its Instructor id follows the words). */
270
+ function paintCancel(action) {
271
+ var cancel = el('leave-guard-cancel');
272
+ var keep = COPY[action] && COPY[action].cancel;
273
+ cancel.textContent = keep || 'Cancel';
274
+ cancel.setAttribute('data-command-id', keep ? 'leave.keep-running' : 'shell.dialog-cancel#the stop or sign-out prompt');
275
+ }
276
+
277
+ /* What stopping means right now. Read from the server when the Stop question opens; a failure or a sign-in answer shows nothing
278
+ extra, never an error: the question still works exactly as it did. */
279
+ async function loadTrayStatus() {
280
+ // `unknown` marks a check that failed in a way the person should hear about; a sign-in answer (402) stays silent.
281
+ var unknown = { unknown: true, runsInProgress: 0, watchers: 0, nextRoutine: null, autostart: false };
282
+ try {
283
+ var res = await fetch('/api/desktop/tray-status', { cache: 'no-store' });
284
+ if (!res) return unknown;
285
+ if (res.status === 402) return null;
286
+ if (!res.ok) return unknown;
287
+ var body = await res.json();
288
+ if (!body || typeof body !== 'object' || body.ok === false) return unknown;
289
+ var n = function (v) { return typeof v === 'number' && isFinite(v) && v > 0 ? Math.floor(v) : 0; };
290
+ return {
291
+ runsInProgress: n(body.runsInProgress),
292
+ watchers: n(body.watchers),
293
+ nextRoutine: body.nextRoutine && typeof body.nextRoutine === 'object' && typeof body.nextRoutine.at === 'string'
294
+ ? { at: body.nextRoutine.at, name: typeof body.nextRoutine.name === 'string' ? body.nextRoutine.name : '' } : null,
295
+ autostart: !!(body.autostart && body.autostart.enabled === true),
296
+ // Whether this computer has the Start with Windows setting at all (#3070): only then is the link offered.
297
+ autostartSupported: !!(body.autostart && body.autostart.supported === true),
298
+ // #3072: what the server's stop machine says. Absent on an older server: then there is no drain to see.
299
+ stop: body.stop && typeof body.stop === 'object' ? {
300
+ draining: body.stop.draining === true,
301
+ committing: body.stop.committing === true,
302
+ stopping: body.stop.stopping === true,
303
+ attempt: typeof body.stop.attempt === 'number' ? body.stop.attempt : 0,
304
+ waitingOn: n(body.stop.waitingOn),
305
+ stopFailure: typeof body.stop.stopFailure === 'string' && body.stop.stopFailure ? body.stop.stopFailure : null,
306
+ } : null,
307
+ };
308
+ } catch (_) { return unknown; }
309
+ }
310
+
311
+ /** While FloLess waits: one short status sentence (the live region), and a fixed hint that is exact about what is and is not waited for. */
312
+ function drainText(waitingOn) {
313
+ if (!waitingOn) return 'Finishing up…';
314
+ return 'Waiting for ' + (waitingOn === 1 ? '1 workflow run' : waitingOn + ' workflow runs') + ' to finish. FloLess then stops by itself, and no new runs start.';
315
+ }
316
+ var DRAIN_HINT = [
317
+ 'Not waited for: watcher events, AI Chat and Requests work. They end when FloLess stops. Routines that fall due meanwhile do not start.',
318
+ 'Closing this window does not cancel the wait; Keep running does. Save work in other windows now. If a run never finishes, choose Stop anyway.',
319
+ ];
320
+ var UNREACHED = 'FloLess could not be reached just now, so it is not known whether it is stopping. Trying again… Keep running works once it is back.';
321
+ /** Assign only when it changed: a live region rewritten every poll is read out again by some screen readers. */
322
+ function setText(node, text) { if (node.textContent !== text) node.textContent = text; }
323
+
324
+ /** POST to the stop machine's own routes. { status, body } or { network: true }. */
325
+ async function postStopRoute(url, payload) {
326
+ var res;
327
+ try {
328
+ res = await fetch(url, payload === undefined ? { method: 'POST' } : { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) });
329
+ } catch (_) { return { network: true }; }
330
+ var body = await res.json().catch(function () { return {}; });
331
+ return { status: res.status, body: body || {} };
332
+ }
333
+
334
+ /** "at 14:30" today, "on Wed 4 Nov at 14:30" another day; null when the time cannot be read. */
335
+ function whenText(iso) {
336
+ var d = new Date(iso);
337
+ if (isNaN(d.getTime())) return null;
338
+ var time = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
339
+ if (d.toDateString() === new Date().toDateString()) return 'at ' + time;
340
+ return 'on ' + d.toLocaleDateString([], { weekday: 'short', day: 'numeric', month: 'short' }) + ' at ' + time;
341
+ }
342
+
343
+ function stopLines(s) {
344
+ var out = [];
345
+ if (!s) return out;
346
+ if (s.unknown) out.push('FloLess could not check whether a run is in progress.');
347
+ if (s.nextRoutine) {
348
+ var when = whenText(s.nextRoutine.at);
349
+ if (when) out.push('Next routine: ' + (s.nextRoutine.name || 'a routine') + ' ' + when + '. It will not run while FloLess is stopped; missed routines are listed the next time FloLess starts.');
350
+ }
351
+ if (s.watchers > 0) out.push(s.watchers === 1 ? '1 watcher will stop listening.' : s.watchers + ' watchers will stop listening.');
352
+ if (s.autostart) out.push('FloLess starts again the next time you sign in to Windows.');
353
+ return out;
248
354
  }
249
355
 
250
356
  /** Resolves like `p`, or false once `ms` pass — a save that never answers counts as not saved,
@@ -274,13 +380,13 @@
274
380
  * dialog, which stays open (nothing was discarded, nothing was left).
275
381
  */
276
382
  function confirm(opts) {
277
- var action = opts && opts.action === 'refresh' ? 'refresh' : opts && opts.action === 'signout' ? 'signout' : opts && opts.action === 'project' ? 'project' : 'stop';
383
+ var action = opts && opts.action === 'refresh' ? 'refresh' : opts && opts.action === 'signout' ? 'signout' : opts && opts.action === 'project' ? 'project' : opts && opts.action === 'close' ? 'close' : 'stop';
278
384
  var only = onlyFor(opts);
279
385
  if (openPromise) return openPromise;
280
386
  $modal = $modal || el('leave-guard-modal');
281
387
  var other = el('confirm-modal');
282
388
  // Recovery may cover a pending confirmation. Keep it intact and inert below this question.
283
- if (!$modal || (action !== 'refresh' && other && other.classList.contains('show'))) return Promise.resolve(false);
389
+ if (!$modal || (action !== 'refresh' && action !== 'close' && other && other.classList.contains('show'))) return Promise.resolve(false);
284
390
 
285
391
  openPromise = new Promise(function (resolve) {
286
392
  var returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -291,10 +397,109 @@
291
397
  var snapshot = { items: [], running: null };
292
398
  var busy = false;
293
399
  var settled = false;
400
+ // Stop FloLess only: what stopping means, and the server-owned wait for the runs (#3072). `drain` is the attempt this question
401
+ // has seen on the server (started here or already waiting from another window); `intent` is what a Save / Stop click commits.
402
+ var stopState = action === 'stop' ? { status: null, drain: null, intent: 'stop', lost: 0, committing: false, timer: null } : null;
403
+
404
+ function paintStop() {
405
+ if (!stopState) return;
406
+ var s = stopState.status;
407
+ var runs = s ? s.runsInProgress : 0;
408
+ var live = runs > 0;
409
+ var list = el('leave-guard-effects');
410
+ list.replaceChildren();
411
+ stopLines(s).forEach(function (line) { var li = document.createElement('li'); li.textContent = line; list.appendChild(li); });
412
+ list.hidden = !list.children.length;
413
+ // A way to the setting, for a person who wants FloLess to stay stopped after they sign in. Not a third answer. Not offered
414
+ // behind the sign-in wall (#license-gate covers the window): the ≡ menu it opens would be covered too, so the link would lead nowhere.
415
+ el('leave-guard-autostart-row').hidden = !(s && s.autostartSupported === true) || !!document.getElementById('license-gate');
416
+ var runEl = el('leave-guard-running');
417
+ if (stopState.drain) {
418
+ runEl.textContent = ''; runEl.hidden = true; // the waiting line below says it
419
+ } else if (live) {
420
+ runEl.textContent = runs === 1 ? 'A run is in progress. Stopping FloLess ends it.' : runs + ' runs are in progress. Stopping FloLess ends them.';
421
+ runEl.hidden = false;
422
+ } else {
423
+ runEl.textContent = snapshot.running ? COPY.stop.running : '';
424
+ runEl.hidden = !snapshot.running;
425
+ }
426
+ setText(el('leave-guard-waiting'), stopState.drain
427
+ ? (stopState.lost > 0 ? UNREACHED : stopState.committing ? 'The runs are done. FloLess is stopping now…' : drainText(stopState.drain.waitingOn))
428
+ : '');
429
+ var hint = el('leave-guard-hint');
430
+ hint.replaceChildren();
431
+ if (stopState.drain) DRAIN_HINT.forEach(function (line) { var p = document.createElement('p'); p.textContent = line; hint.appendChild(p); });
432
+ hint.hidden = !stopState.drain;
433
+ // Nothing is stopped yet while waiting, and the title says so.
434
+ el('leave-guard-title').textContent = stopState.drain ? 'Waiting to stop FloLess' : COPY.stop.title;
435
+ el('leave-guard-wait').hidden = !live || !!stopState.drain;
436
+ // With a run going, the stop button says what it does to it; a second click is always the person's own.
437
+ el('leave-guard-confirm').textContent = live || stopState.drain ? 'Stop anyway' : COPY.stop.confirm;
438
+ if (stopState.drain) {
439
+ // Armed: the choices about unsaved work were made; only Keep running and Stop anyway are left, so a stale Save or Discard cannot re-commit the wait.
440
+ el('leave-guard-save').hidden = true; el('leave-guard-discard').hidden = true; el('leave-guard-confirm').hidden = false;
441
+ }
442
+ if (stopState.intent === 'drain' && !stopState.drain) {
443
+ // Unsaved work was in the way of the wait: the same Save and Discard choices now commit the wait, not an immediate stop.
444
+ el('leave-guard-save').textContent = 'Save, then stop when runs finish';
445
+ el('leave-guard-discard').textContent = 'Stop when runs finish, without saving';
446
+ }
447
+ }
448
+
449
+ /* While the server waits, look at it: it says when the stop was accepted, when the wait ended elsewhere, and why a stop could not go ahead. */
450
+ function pollDrain() {
451
+ if (stopState.timer) clearTimeout(stopState.timer);
452
+ stopState.timer = setTimeout(async function () {
453
+ stopState.timer = null;
454
+ if (settled || !stopState.drain) return;
455
+ var s = await loadTrayStatus();
456
+ if (settled || !stopState.drain) return;
457
+ if (!s || s.unknown || !s.stop) {
458
+ // Not reached: never "stopped". The page's own offline notice covers a server that is truly gone.
459
+ stopState.lost += 1;
460
+ paintStop();
461
+ pollDrain();
462
+ return;
463
+ }
464
+ stopState.lost = 0;
465
+ stopState.status = s;
466
+ if (s.stop.stopping) { window.__flolessLeaving = true; done(true); return; } // accepted: the server is about to exit
467
+ if (s.stop.committing) {
468
+ // The runs are done and FloLess is stopping its background helper: too late to cancel, and not yet gone. Say so; the next look tells which.
469
+ stopState.committing = true;
470
+ paintStop();
471
+ pollDrain();
472
+ return;
473
+ }
474
+ stopState.committing = false;
475
+ if (!s.stop.draining) {
476
+ // Cancelled in another window, never started (a lost answer), or the stop could not go ahead: back to the ordinary question, with the reason.
477
+ var uncertain = stopState.drain.uncertain === true;
478
+ stopState.drain = null; stopState.intent = 'stop';
479
+ render(action, snapshot, s.stop.stopFailure || (uncertain ? 'FloLess did not start waiting, so nothing was changed.' : 'Stopping was cancelled in another window. FloLess is still running.'));
480
+ setBusy(false);
481
+ focusDefault();
482
+ return;
483
+ }
484
+ stopState.drain = { attempt: s.stop.attempt, waitingOn: s.stop.waitingOn }; // a confirmed wait: no longer uncertain
485
+ paintStop();
486
+ pollDrain();
487
+ }, api.drainPollMs);
488
+ }
489
+
490
+ /* A wait this question did not start (another window did) or just started: show it and keep watching. */
491
+ function showWaiting(attemptNumber, waitingOn, uncertain) {
492
+ stopState.drain = { attempt: attemptNumber, waitingOn: waitingOn || 0, uncertain: uncertain === true };
493
+ stopState.committing = false;
494
+ stopState.lost = 0;
495
+ el('leave-guard-sub').textContent = 'FloLess will stop by itself when the workflow runs are done.';
496
+ paintStop();
497
+ pollDrain();
498
+ }
294
499
 
295
500
  function setBusy(on, label) {
296
501
  busy = on;
297
- ['leave-guard-confirm', 'leave-guard-save', 'leave-guard-discard'].forEach(function (id) { el(id).disabled = on; });
502
+ ['leave-guard-confirm', 'leave-guard-save', 'leave-guard-discard', 'leave-guard-wait'].forEach(function (id) { el(id).disabled = on; });
298
503
  $modal.setAttribute('aria-busy', on ? 'true' : 'false');
299
504
  if (label) el('leave-guard-save').textContent = label;
300
505
  }
@@ -302,6 +507,14 @@
302
507
  function done(result) {
303
508
  if (settled) return;
304
509
  settled = true;
510
+ if (stopState) { stopState.drain = null; if (stopState.timer) { clearTimeout(stopState.timer); stopState.timer = null; } }
511
+ extras = null;
512
+ openActionName = null;
513
+ var effects = el('leave-guard-effects'); if (effects) { effects.replaceChildren(); effects.hidden = true; }
514
+ var autostartRow = el('leave-guard-autostart-row'); if (autostartRow) autostartRow.hidden = true;
515
+ el('leave-guard-waiting').textContent = '';
516
+ var leftoverHint = el('leave-guard-hint'); if (leftoverHint) { leftoverHint.replaceChildren(); leftoverHint.hidden = true; }
517
+ el('leave-guard-wait').hidden = true;
305
518
  $modal.classList.remove('show');
306
519
  covered.forEach(function (c) {
307
520
  c.m.inert = c.inert;
@@ -331,17 +544,29 @@
331
544
  return;
332
545
  }
333
546
  if (opts && typeof opts.commit === 'function') {
334
- el('leave-guard-sub').textContent = COPY[action].working;
547
+ var draining = !!stopState && stopState.intent === 'drain';
548
+ el('leave-guard-sub').textContent = draining ? 'Asking FloLess to wait for the workflow runs…' : COPY[action].working;
335
549
  var outcome = null;
336
- try { outcome = await opts.commit(); } catch (_) { outcome = null; }
550
+ try { outcome = await opts.commit({ intent: stopState ? stopState.intent : 'stop' }); } catch (_) { outcome = null; }
337
551
  if (settled) return;
338
552
  if (!outcome || !outcome.ok) {
553
+ if (stopState) stopState.intent = 'stop';
339
554
  snapshot = fresh;
340
555
  render(action, snapshot, (outcome && outcome.message) || COPY[action].failed);
341
556
  setBusy(false);
342
557
  focusDefault();
343
558
  return;
344
559
  }
560
+ if (outcome.draining) {
561
+ // Accepted: the server waits and stops by itself. This question stays open, watching, until it does (or the person keeps FloLess running).
562
+ snapshot = fresh;
563
+ render(action, snapshot);
564
+ showWaiting(outcome.attempt, outcome.waitingOn, outcome.uncertain);
565
+ setBusy(false);
566
+ focusDefault();
567
+ return;
568
+ }
569
+ if (draining) discardAll = false; // the stop comes later and takes the page with it: nothing is thrown away now
345
570
  }
346
571
  if (discardAll) fresh.items.forEach(function (i) { if (typeof i.discard === 'function') i.discard(); });
347
572
  // Leaving a project stays in the page, so its later reloads keep the browser's own prompt.
@@ -381,7 +606,7 @@
381
606
  function focusDefault() { setTimeout(function () { el('leave-guard-cancel').focus(); }, 0); }
382
607
 
383
608
  function onKey(e) {
384
- if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); if (!busy) done(false); return; }
609
+ if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); if (!busy) cancelQuestion(); return; }
385
610
  if (e.key !== 'Tab') return;
386
611
  e.stopPropagation();
387
612
  var focusable = Array.from($modal.querySelectorAll('button:not([disabled]):not([hidden])'))
@@ -392,20 +617,79 @@
392
617
  else if (!e.shiftKey && (document.activeElement === last || !$modal.contains(document.activeElement))) { e.preventDefault(); first.focus(); }
393
618
  }
394
619
 
620
+ /* Keep running, Esc and a backdrop click are ONE decision: with a wait armed on the server it is cancelled first, and the question closes only once
621
+ the server says so (or says it is already stopping). Closing the window itself is not this: the wait stays the server's. */
622
+ async function cancelQuestion() {
623
+ if (busy) return;
624
+ if (!stopState || !stopState.drain) { done(false); return; }
625
+ setBusy(true);
626
+ var r = await postStopRoute('/api/app/drain/cancel', typeof stopState.drain.attempt === 'number' ? { attempt: stopState.drain.attempt } : {});
627
+ if (settled) return;
628
+ if (r.network) {
629
+ el('leave-guard-note').textContent = 'FloLess could not be reached to cancel the wait, so it may still stop. Try Keep running again.';
630
+ el('leave-guard-note').hidden = false;
631
+ } else if (r.status === 200) { done(false); return; }
632
+ else if (r.status === 409 && r.body && r.body.code === 'already-stopping') {
633
+ el('leave-guard-note').textContent = 'FloLess has already started stopping, so it could not be kept running.';
634
+ el('leave-guard-note').hidden = false;
635
+ } else if (r.status === 409 && r.body && r.body.code === 'stale-attempt') {
636
+ // Another window replaced the wait: show the one that is there now, and let the person decide again.
637
+ stopState.drain = { attempt: typeof r.body.attempt === 'number' ? r.body.attempt : stopState.drain.attempt, waitingOn: stopState.drain.waitingOn };
638
+ el('leave-guard-note').textContent = 'The wait was started again from another window. Choose Keep running again to cancel it.';
639
+ el('leave-guard-note').hidden = false;
640
+ } else {
641
+ el('leave-guard-note').textContent = 'FloLess could not cancel the wait just now. Try Keep running again.';
642
+ el('leave-guard-note').hidden = false;
643
+ }
644
+ setBusy(false);
645
+ focusDefault();
646
+ }
647
+
395
648
  var downOnBackdrop = false;
396
649
  wireOnce();
397
650
  current = {
398
- cancel: function () { if (!busy) done(false); },
399
- confirm: function () { if (busy) return; setBusy(true); proceed(snapshot, false); },
651
+ cancel: cancelQuestion,
652
+ // "Change Start with Windows": closes this question the way Keep running does (FloLess keeps running, nothing is
653
+ // stopped) and shows the setting itself: the ≡ menu opens with the switch pointed at (app.js revealStartOnLogin).
654
+ autostart: async function () {
655
+ if (busy) return;
656
+ await cancelQuestion(); // ends a wait in progress the same way Keep running does
657
+ if (!settled) return;
658
+ setTimeout(function () { if (typeof window.revealStartOnLogin === 'function') window.revealStartOnLogin(); }, 0);
659
+ },
660
+ confirm: function () { if (busy) return; if (stopState) stopState.intent = 'stop'; setBusy(true); proceed(snapshot, false); },
400
661
  discard: function () { if (busy) return; setBusy(true); proceed(snapshot, true); },
401
662
  save: function () { if (!busy) saveAll(); },
663
+ // "Let workflow runs finish": FloLess itself waits for the runs and then stops, so it is a stop with a delay and takes the same road as
664
+ // one. Unsaved work is asked about first (the save choices stay, now committing the wait); only then is the wait started on the server.
665
+ wait: async function () {
666
+ if (busy || !stopState || stopState.drain) return;
667
+ stopState.intent = 'drain';
668
+ setBusy(true);
669
+ var fresh = await collect(only);
670
+ if (settled) return;
671
+ if (fresh.items.length) {
672
+ snapshot = fresh;
673
+ render(action, snapshot, 'You have unsaved changes. Save them, or continue without saving. FloLess then waits for the runs and stops.');
674
+ setBusy(false);
675
+ focusDefault();
676
+ return;
677
+ }
678
+ proceed(fresh, false);
679
+ },
402
680
  // A backdrop click closes only when the press also began on it (a text-selection drag doesn't).
403
681
  backdropDown: function (e) { downOnBackdrop = e.target === $modal; },
404
- backdropClick: function (e) { var hit = e.target === $modal && downOnBackdrop; downOnBackdrop = false; if (hit && !busy) done(false); },
682
+ backdropClick: function (e) { var hit = e.target === $modal && downOnBackdrop; downOnBackdrop = false; if (hit && !busy) cancelQuestion(); },
405
683
  key: onKey,
406
684
  };
407
685
 
408
686
  // Show the dialog at once (modal: nothing is edited behind it while we look), then fill it in.
687
+ openActionName = action;
688
+ extras = stopState ? paintStop : null;
689
+ paintCancel(action);
690
+ el('leave-guard-effects').hidden = true;
691
+ el('leave-guard-wait').hidden = true;
692
+ el('leave-guard-hint').hidden = true;
409
693
  el('leave-guard-title').textContent = COPY[action].title;
410
694
  el('leave-guard-sub').textContent = 'Checking for unsaved work…';
411
695
  el('leave-guard-unsaved').hidden = true;
@@ -417,6 +701,15 @@
417
701
  setBusy(true);
418
702
  $modal.classList.add('show');
419
703
  focusDefault();
704
+ if (stopState) {
705
+ loadTrayStatus().then(function (st) {
706
+ if (settled) return;
707
+ stopState.status = st;
708
+ // A wait another window started is still the server's: show it, and let Keep running cancel it.
709
+ if (st && st.stop && st.stop.draining && !stopState.drain) { showWaiting(st.stop.attempt, st.stop.waitingOn); return; }
710
+ paintStop();
711
+ });
712
+ }
420
713
  collect(only).then(function (s) {
421
714
  if (settled) return;
422
715
  snapshot = s;
@@ -442,6 +735,20 @@
442
735
  return confirm(opts);
443
736
  }
444
737
 
738
+ /**
739
+ * The shell's close request: resolves true when the window may close NOW. A clean page answers at once, with no dialog;
740
+ * unsaved work shows "Close FloLess?" with its save choices and waits as long as the person needs.
741
+ */
742
+ async function confirmClose(opts) {
743
+ // Another question may be open (say "Leave this project?"). confirm() would hand its answer back for THIS question,
744
+ // and that question only covered one project's editors: answering it must not authorize closing the whole window
745
+ // while workflow inputs it never showed are still dirty. Let it finish, then ask the close question afresh.
746
+ if (openPromise) { try { await openPromise; } catch (_) { /* its caller handles it */ } }
747
+ var go = await confirmIfUnsaved({ action: 'close', returnFocus: (opts && opts.returnFocus) || document.getElementById('menu-btn') });
748
+ if (go) window.__flolessLeaving = true; // no browser "Leave site?" prompt on top of the answer
749
+ return go === true;
750
+ }
751
+
445
752
  /* ── Stop FloLess ──────────────────────────────────────────────────────── */
446
753
 
447
754
  var stopping = false;
@@ -464,6 +771,9 @@
464
771
  if (overlay) overlay.remove();
465
772
  }
466
773
 
774
+ /** Inside the FloLess window (the shell's bridge is present): wording that says "tab" says "window". */
775
+ function inWindow() { return document.documentElement.classList.contains('desktop'); }
776
+
467
777
  function renderStopped() {
468
778
  if (document.getElementById('app-stopped')) return;
469
779
  var mark = document.querySelector('header .brand .mark svg');
@@ -477,7 +787,9 @@
477
787
  '<div class="as-card" tabindex="-1">' +
478
788
  '<div class="as-mark" aria-hidden="true"></div>' +
479
789
  '<h1 id="app-stopped-title">FloLess has stopped</h1>' +
480
- '<p id="app-stopped-body">FloLess is no longer running. You can close this tab.</p>' +
790
+ '<p id="app-stopped-body">' + (inWindow()
791
+ ? 'FloLess is no longer running. You can close this window. To use it again, open FloLess from the Start menu or the desktop shortcut.'
792
+ : 'FloLess is no longer running. You can close this tab.') + '</p>' +
481
793
  '<a class="as-start" id="app-stopped-start" href="floless://start" data-command-id="app.start-again"' +
482
794
  ' data-tip="Opens FloLess again on this computer">Start FloLess again</a>' +
483
795
  '<p class="as-status" id="app-stopped-status" role="status"></p>' +
@@ -488,8 +800,9 @@
488
800
  document.body.appendChild(wrap);
489
801
  // A real link the user clicks: a scripted click on an external protocol is dropped by Chromium.
490
802
  document.getElementById('app-stopped-start').addEventListener('click', function () {
491
- document.getElementById('app-stopped-status').textContent =
492
- 'Starting FloLess… When it is ready, reload this tab. If nothing happens, open FloLess from the Start menu.';
803
+ document.getElementById('app-stopped-status').textContent = inWindow()
804
+ ? 'Starting FloLess… If nothing happens, open FloLess from the Start menu.'
805
+ : 'Starting FloLess… When it is ready, reload this tab. If nothing happens, open FloLess from the Start menu.';
493
806
  });
494
807
  wrap.querySelector('.as-card').focus();
495
808
  }
@@ -497,7 +810,23 @@
497
810
  /** The server's answer to POST /api/app/stop, in words for the dialog. Only a refusal the server
498
811
  * words for people is passed through; anything else gets the generic sentence. */
499
812
  var STOP_REFUSALS = { 'supervisor-still-running': true };
500
- async function requestStop() {
813
+ async function requestDrain() {
814
+ var r = await postStopRoute('/api/app/drain');
815
+ if (r.network) {
816
+ // The answer may have been lost after the server accepted it: ask the server, never guess.
817
+ var s = await loadTrayStatus();
818
+ if (s && s.stop && s.stop.draining) return { ok: true, draining: true, attempt: s.stop.attempt, waitingOn: s.stop.waitingOn };
819
+ if (s && s.stop && s.stop.stopping) return { ok: true };
820
+ // Neither the answer nor the status came back: the server may have accepted the wait. Keep it as an uncertain wait the dialog can cancel and reconcile.
821
+ return { ok: true, draining: true, attempt: null, waitingOn: 0, uncertain: true };
822
+ }
823
+ if (r.status === 202 && r.body && r.body.alreadyStopping) return { ok: true };
824
+ if (r.status === 202 && r.body && r.body.draining) return { ok: true, draining: true, attempt: typeof r.body.attempt === 'number' ? r.body.attempt : 0, waitingOn: typeof r.body.waitingOn === 'number' ? r.body.waitingOn : 0 };
825
+ return { ok: false, message: 'FloLess could not start waiting for the runs just now, so nothing was changed. Try again in a moment.' };
826
+ }
827
+
828
+ async function requestStop(ctx) {
829
+ if (ctx && ctx.intent === 'drain') return requestDrain();
501
830
  var res;
502
831
  try { res = await fetch('/api/app/stop', { method: 'POST' }); }
503
832
  catch (_) {
@@ -525,13 +854,17 @@
525
854
 
526
855
  var api = window.flolessLeaveGuard = {
527
856
  saveTimeoutMs: 20000, // how long one item's save may take before it counts as not saved
857
+ drainPollMs: 1000, // how often the question looks at the server while it waits for the runs
528
858
  register: register,
529
859
  registerFrame: registerFrame,
530
860
  probeFrame: probeFrame,
531
861
  collect: collect,
532
862
  confirm: confirm,
533
863
  confirmIfUnsaved: confirmIfUnsaved,
864
+ confirmClose: confirmClose,
534
865
  isProjectItem: isProjectItem,
535
866
  stopApp: stopApp,
867
+ /** The action of the question that is open right now ('stop', 'signout', …), or null. The shell's tray command checks it. */
868
+ openAction: function () { return openActionName; },
536
869
  };
537
870
  })();
package/dist/web/pages.js CHANGED
@@ -18,7 +18,11 @@
18
18
  await globalThis.flolessStartupAdmission?.admit(path, { method: opts?.method, signal: opts?.signal });
19
19
  const res = await fetch(path, { ...opts, headers: { 'Content-Type': 'application/json', ...(opts.headers || {}) } });
20
20
  const body = await res.json().catch(() => ({}));
21
- if (!res.ok || body.ok === false) { const err = new Error(body.error || `HTTP ${res.status}`); err.status = res.status; err.body = body; throw err; }
21
+ if (!res.ok || body.ok === false) {
22
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
23
+ const readOnly = /^(GET|HEAD)$/.test(String(opts.method || 'GET').toUpperCase());
24
+ const err = new Error(body.error || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text); err.status = res.status; err.body = body; throw err;
25
+ }
22
26
  return body;
23
27
  });
24
28
  const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
@@ -20,10 +20,13 @@
20
20
  const { timeoutMs, ...requestOptions } = opts;
21
21
  if (!requestOptions.signal && Number.isFinite(timeoutMs)) requestOptions.signal = AbortSignal.timeout(timeoutMs);
22
22
  const res = await fetch(path, { headers: { 'content-type': 'application/json' }, ...requestOptions });
23
- const body = await res.json().catch(() => ({ ok: false, error: `HTTP ${res.status}` }));
23
+ const body = await res.json().catch(() => ({ ok: false, code: 'response-unreadable' }));
24
24
  if (!res.ok || body.ok === false) {
25
- const err = new Error(body.error || `HTTP ${res.status}`);
25
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "HTTP <status>".
26
+ const readOnly = /^(GET|HEAD)$/.test(String(requestOptions.method || 'GET').toUpperCase());
27
+ const err = new Error(body.error || failureCopy({ status: res.status, body }, { retrySafe: readOnly }).text);
26
28
  err.body = body;
29
+ err.status = res.status;
27
30
  throw err;
28
31
  }
29
32
  return body;