@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.
Files changed (261) hide show
  1. package/autostart.mjs +169 -63
  2. package/desktop-shell.mjs +335 -0
  3. package/dist/floless-server.cjs +20570 -14555
  4. package/dist/schemas/drawing-check.profile.v1.schema.json +1 -1
  5. package/dist/schemas/steel.model.v2.schema.json +4 -2
  6. package/dist/skills/floless-app-onboarding/SKILL.md +13 -4
  7. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +3 -0
  8. package/dist/skills/floless-app-steel-takeoff/SKILL.md +34 -3
  9. package/dist/skills/floless-app-ui/SKILL.md +2 -2
  10. package/dist/skills/floless-app-workflows/SKILL.md +2 -2
  11. package/dist/templates/college-phase-exporter.flo +11 -45
  12. package/dist/web/agents.js +1 -1
  13. package/dist/web/app.css +223 -8
  14. package/dist/web/app.js +53 -13
  15. package/dist/web/aware-update-client.js +13 -5
  16. package/dist/web/aware.js +559 -118
  17. package/dist/web/chat.css +23 -0
  18. package/dist/web/chat.js +1003 -83
  19. package/dist/web/commands-filter.js +28 -5
  20. package/dist/web/commands-shell.js +304 -18
  21. package/dist/web/commands-steel.js +1 -1
  22. package/dist/web/desktop-window.js +435 -0
  23. package/dist/web/drawing-check-editor.js +18 -10
  24. package/dist/web/failure-copy.js +14 -1
  25. package/dist/web/guide.js +75 -9
  26. package/dist/web/index.html +72 -12
  27. package/dist/web/instructor.js +1 -1
  28. package/dist/web/leave-guard.js +347 -14
  29. package/dist/web/pages.js +5 -1
  30. package/dist/web/panels.js +5 -2
  31. package/dist/web/pdf-view.js +421 -0
  32. package/dist/web/project-history.js +133 -11
  33. package/dist/web/project-modules.js +3 -1
  34. package/dist/web/project-rfis.js +3 -1
  35. package/dist/web/project-workflows.js +4 -2
  36. package/dist/web/reference-geometry-worker.js +11 -2
  37. package/dist/web/revit-editor.html +1 -0
  38. package/dist/web/revit-editor.js +37 -8
  39. package/dist/web/shared-prefs.js +364 -0
  40. package/dist/web/steel-ai-marks.js +45 -1
  41. package/dist/web/steel-editor.html +265 -58
  42. package/dist/web/steel-filter-flo.js +243 -23
  43. package/dist/web/steel-filter.html +58 -16
  44. package/dist/web/tab-signal.js +36 -1
  45. package/dist/web/tekla-editor.html +1 -0
  46. package/dist/web/terminal-requests.js +5 -0
  47. package/dist/web/tool-updates.js +220 -54
  48. package/dist/web/vector-3d.html +14 -3
  49. package/dist/web/vector-editor.html +10 -2
  50. package/dist/web/vendor/README.md +23 -0
  51. package/dist/web/vendor/pdfjs/LICENSE +177 -0
  52. package/dist/web/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  53. package/dist/web/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  54. package/dist/web/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  55. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  56. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  57. package/dist/web/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  58. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  59. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  60. package/dist/web/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  61. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  62. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  63. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  64. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  65. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  66. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  67. package/dist/web/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  68. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  69. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  70. package/dist/web/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  71. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  72. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  73. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  74. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  75. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  76. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  77. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  78. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  79. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  80. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  81. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  82. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  83. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  84. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  85. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  86. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  87. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  88. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  89. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  90. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  91. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  92. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  93. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  94. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  95. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  96. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  97. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  98. package/dist/web/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  99. package/dist/web/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  100. package/dist/web/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  101. package/dist/web/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  102. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  103. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  104. package/dist/web/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  105. package/dist/web/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  106. package/dist/web/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  107. package/dist/web/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  108. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  109. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  110. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  111. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  112. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  113. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  114. package/dist/web/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  115. package/dist/web/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  116. package/dist/web/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  117. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  118. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  119. package/dist/web/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  120. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  121. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  122. package/dist/web/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  123. package/dist/web/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  124. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  125. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  126. package/dist/web/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  127. package/dist/web/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  128. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  129. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  130. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  131. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  132. package/dist/web/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  133. package/dist/web/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  134. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  135. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  136. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  137. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  138. package/dist/web/vendor/pdfjs/cmaps/H.bcmap +0 -0
  139. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  140. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  141. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  142. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  143. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  144. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  145. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  146. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  147. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  148. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  149. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  150. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  151. package/dist/web/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  152. package/dist/web/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  153. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  154. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  155. package/dist/web/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  156. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  157. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  158. package/dist/web/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  159. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  160. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  161. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  162. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  163. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  164. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  165. package/dist/web/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  166. package/dist/web/vendor/pdfjs/cmaps/LICENSE +36 -0
  167. package/dist/web/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  168. package/dist/web/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  169. package/dist/web/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  170. package/dist/web/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  171. package/dist/web/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  172. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  173. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  174. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  175. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  176. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  177. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  178. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  179. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  180. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  181. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  182. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  183. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  184. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  185. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  186. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  187. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  188. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  189. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  190. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  191. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  192. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  193. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  194. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  195. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  196. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  197. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  198. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  199. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  200. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  201. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  202. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  203. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  204. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  205. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  206. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  207. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  208. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  209. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  210. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  211. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  212. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  213. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  214. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  215. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  216. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  217. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  218. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  219. package/dist/web/vendor/pdfjs/cmaps/V.bcmap +0 -0
  220. package/dist/web/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  221. package/dist/web/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  222. package/dist/web/vendor/pdfjs/iccs/LICENSE +116 -0
  223. package/dist/web/vendor/pdfjs/pdf.min.mjs +28 -0
  224. package/dist/web/vendor/pdfjs/pdf.worker.mjs +64908 -0
  225. package/dist/web/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  226. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  227. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  228. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  229. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  230. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  231. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  232. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  233. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  234. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  235. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  236. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  237. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  238. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  239. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  240. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  241. package/dist/web/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  242. package/dist/web/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  243. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  244. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  245. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  246. package/dist/web/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
  247. package/dist/web/vendor/pdfjs/wasm/jbig2.wasm +0 -0
  248. package/dist/web/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  249. package/dist/web/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
  250. package/dist/web/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  251. package/dist/web/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
  252. package/dist/web/workspaces.js +527 -64
  253. package/home-env.mjs +28 -0
  254. package/install-path.mjs +59 -3
  255. package/launch-starting-page.mjs +35 -15
  256. package/launch.mjs +358 -51
  257. package/package.json +2 -1
  258. package/pin-home.mjs +6 -0
  259. package/post-update-marker.mjs +14 -0
  260. package/preferences-file.mjs +289 -0
  261. package/supervisor-lock.mjs +195 -0
package/dist/web/aware.js CHANGED
@@ -317,6 +317,12 @@
317
317
  return response.json();
318
318
  }
319
319
 
320
+ // The person's sentence for a failed request the server explained no further (web/failure-copy.js, loaded first).
321
+ function apiFailureText(error, retrySafe) {
322
+ if (typeof failureCopy === 'function') return failureCopy(error, { retrySafe }).text;
323
+ return 'Couldn’t finish that, and FloLess couldn’t tell why. If it keeps happening, use Report an issue at the bottom of the window.';
324
+ }
325
+
320
326
  async function api(path, opts = {}) {
321
327
  await globalThis.flolessStartupAdmission?.admit(path, { method: opts?.method, signal: opts?.signal });
322
328
  const { timeoutMs, ...requestOptions } = opts;
@@ -325,10 +331,16 @@
325
331
  headers: { 'content-type': 'application/json' },
326
332
  ...requestOptions,
327
333
  });
334
+ // A read (GET/HEAD) may be told to try again; a change is told to check first, because it may have gone through.
335
+ const method = String(requestOptions.method || 'GET').toUpperCase();
336
+ const readOnly = method === 'GET' || method === 'HEAD';
337
+ // #3097: no status number in anything a person may read; `err.status` below still carries it for callers.
328
338
  const body = await res.json().catch(() => ({
329
339
  ok: false,
330
340
  code: 'response-unreadable',
331
- error: `FloLess received an unreadable response (HTTP ${res.status}).`,
341
+ error: readOnly
342
+ ? 'FloLess sent an answer this window couldn’t read. Reload this window, then try again.'
343
+ : 'FloLess sent an answer this window couldn’t read, so it can’t tell whether that went through. Reload this window and check before trying again.',
332
344
  }));
333
345
  if (!res.ok || body.ok === false) {
334
346
  // Centralised so EVERY caller that spawns `aware` reports the refusal honestly rather than
@@ -341,11 +353,13 @@
341
353
  // rather than at each call site: every `aware`-spawning route funnels through api().
342
354
  awareMaintenanceRefused = true;
343
355
  }
344
- const err = new Error(
345
- (body.code === 'maintenance-busy' && body.message) || body.error || `HTTP ${res.status}`,
346
- );
356
+ // The server's own words when it gave some; otherwise the shared failure sentence (#3097), never "HTTP 500".
357
+ const serverText = (body.code === 'maintenance-busy' && body.message) || body.error;
358
+ const err = new Error(serverText || apiFailureText({ status: res.status, body }, readOnly));
347
359
  err.body = body; // preserve the in-band payload (e.g. credentialIssue) for callers
348
360
  err.status = res.status; // callers need to distinguish a terminal refusal from a transient outage
361
+ // False: the message is one of FloLess's own generic sentences, not the server's reason for this request.
362
+ err.serverText = Boolean(serverText) && body.code !== 'response-unreadable';
349
363
  throw err;
350
364
  }
351
365
  return body;
@@ -2694,7 +2708,7 @@
2694
2708
  closeCombo(false);
2695
2709
  const res = await formModal({
2696
2710
  title: 'Duplicate workflow',
2697
- sub: 'Makes an independent copy you can edit and run separately — compiled and ready.',
2711
+ sub: 'Makes a copy that is yours to change. FloLess updates never replace it; the original keeps getting them.',
2698
2712
  fields: [{ name: 'name', label: 'New name', type: 'text', value: `${srcId}-copy`, placeholder: 'e.g. tekla-bom-by-phase-copy' }],
2699
2713
  okLabel: 'Duplicate',
2700
2714
  });
@@ -2888,28 +2902,47 @@
2888
2902
  expectedToVersion: repair.toVersion, expectedTemplateHash: repair.templateHash } : {};
2889
2903
  } catch (e) { reportErr(e); return; }
2890
2904
  const ok = await formModal({
2891
- title: 'Restore the official version?',
2892
- sub: 'Re-installs the official workflow and discards any changes made to its logic. Your saved inputs are kept.'
2893
- + (sourceOnly ? ' This restores the source only. Review it afterwards, then press Compile yourself before running it.' : ''),
2905
+ title: 'Restore FloLess’s version?',
2906
+ sub: 'Puts FloLess’s version of this workflow back and makes it ready to run. Your changes to its steps are replaced; your saved data is kept, and a backup is saved first so you can undo.',
2894
2907
  fields: [],
2895
2908
  okLabel: 'Restore',
2896
2909
  });
2897
2910
  if (!ok) return;
2898
- showToast('Restoring…', 'ok');
2911
+ // Say it is working the moment the person confirms: a restore recompiles and can take a while.
2912
+ const $restore = document.getElementById('restore-btn');
2913
+ const restoreLabel = $restore ? $restore.textContent : '';
2914
+ if ($restore) { $restore.disabled = true; $restore.textContent = 'Restoring…'; $restore.setAttribute('data-blocked-reason', 'Restoring this workflow now.'); }
2915
+ const working = showToast('Restoring… a backup is saved first.', 'progress');
2899
2916
  try {
2900
2917
  const restored = await api(`/api/app/${encodeURIComponent(id)}/restore`, { method: 'POST', body: JSON.stringify(review) });
2901
- await loadApps();
2902
- if (currentId === id) await loadApp(id);
2903
- await refreshWorkflowUpdates(); // back on the channel — re-offer any pending update
2904
- showToast(restored.needsCompile ? 'The official workflow source was restored. Review it, then press Compile yourself before running it.'
2905
- : 'Restored to the official version.', 'ok');
2918
+ working(true);
2919
+ _wfRowState.set(id, { state: 'done', offer: null, toVersion: restored.version, backupPath: restored.backupPath || null, sourceHash: restored.sourceHash });
2920
+ const text = `Restored “${wfDisplayName(id)}” to ${restored.version}. It’s ready to run.`;
2921
+ if (restored.backupPath) {
2922
+ // The Undo stays a full minute (closable sooner): the backup is the way back, so the way to it must not vanish while
2923
+ // the person reads, but it must not sit over their work for good either.
2924
+ const closeUndo = showToast(text, 'ok',
2925
+ { persistent: true, action: { label: 'Undo', commandId: 'shell.workflow-update-undo#' + id, onClick: () => { void undoWfChange(id); } } });
2926
+ if (typeof closeUndo === 'function') setTimeout(closeUndo, 60000)?.unref?.();
2927
+ } else showToast(text, 'ok');
2928
+ if (restored.warning) showToast(restored.warning, 'warn');
2929
+ await wfRefreshAfter(id); // back on the channel — re-offer any pending update
2906
2930
  } catch (e) {
2931
+ working(true);
2907
2932
  if (e.body && (e.body.code === 'update-changed' || e.body.code === 'workflow-changed')) {
2908
2933
  showToast('The workflow or its official version changed after you reviewed it. Your work was kept. Open Restore again to review the current versions.', 'warn');
2909
2934
  return;
2910
2935
  }
2911
2936
  console.error(e);
2912
- showToast('We couldn’t restore that workflow because FloLess could not save it. Try again.', 'warn');
2937
+ showToast(e && e.body && e.body.code === 'rollback-failed'
2938
+ ? 'Couldn’t restore, and FloLess couldn’t put your workflow back as it was, so it may not run. Ask for help: your version is kept in the backup.'
2939
+ : e && e.body && e.body.code === 'needs-consent'
2940
+ ? 'FloLess’s version has an AI step whose answer may differ each run, and you haven’t confirmed that yet, so nothing was changed. Approve the workflow yourself and tick the box, or restore it with AI Chat.'
2941
+ : e && e.body && (e.body.code === 'restore-not-started' || e.body.code === 'restore-failed')
2942
+ ? 'Couldn’t restore that workflow. It is unchanged. Try again.'
2943
+ : 'FloLess couldn’t confirm the restore finished. Reload FloLess to see the workflow, then try again if it still shows your changes.', 'warn');
2944
+ } finally {
2945
+ if ($restore) { $restore.disabled = false; $restore.textContent = restoreLabel; $restore.removeAttribute('data-blocked-reason'); }
2913
2946
  }
2914
2947
  }
2915
2948
 
@@ -3469,10 +3502,16 @@
3469
3502
  body: JSON.stringify({ appId: app.id, inputName: name, ...(sourceName ? { sourceName } : {}), snapshots: files.map((f) => ({ name: f.name, dataUrl: f.dataUrl })) }),
3470
3503
  });
3471
3504
  if (r.status === 413) { showToast('those files are too large to queue together — attach fewer or smaller sheets', 'warn'); return; }
3472
- const out = await r.json().catch(() => ({ ok: false, error: `re-bake failed (${r.status})` }));
3473
- if (!out || !out.ok) { showToast((out && out.error) || 'could not queue re-bake', 'err'); return; }
3505
+ // #3097: an answer that isn't FloLess's JSON says so in words; the status number stays in the console.
3506
+ const out = await r.json().catch(() => null);
3507
+ if (!out) {
3508
+ console.warn('re-bake: unreadable answer', r.status);
3509
+ showToast('FloLess may not have queued the re-read. Check the queued requests, then queue it again if it isn’t there.', 'err');
3510
+ return;
3511
+ }
3512
+ if (!out.ok) { showToast(out.error || 'Couldn’t queue the re-read.', 'err'); return; }
3474
3513
  showToast(`Queued — your terminal AI will re-read ${n} drawing${n > 1 ? 's' : ''} and update this workflow, then ask you to approve.`, 'ok');
3475
- } catch { showToast('could not queue re-bake', 'err'); }
3514
+ } catch { showToast('Couldn’t queue the re-read. Make sure FloLess is still running, then check the queued requests before trying again.', 'err'); }
3476
3515
  }
3477
3516
 
3478
3517
  // Per-app declared-input values, set via the input node's double-click dialog.
@@ -3922,10 +3961,16 @@
3922
3961
  headers: { 'content-type': 'application/json' },
3923
3962
  body: JSON.stringify({ appId: app.id, name: inp.name, dataUrl: v }),
3924
3963
  });
3925
- const up = await r.json().catch(() => ({ ok: false, error: `upload failed (${r.status})` }));
3926
- if (!up || !up.ok) { showToast((up && up.error) || 'could not store the file', 'err'); return; }
3964
+ // #3097: an answer that isn't FloLess's JSON says so in words; the status number stays in the console.
3965
+ const up = await r.json().catch(() => null);
3966
+ if (!up) {
3967
+ console.warn('visual input upload: unreadable answer', r.status);
3968
+ showToast('Couldn’t store the file. FloLess sent an answer this window couldn’t read. Reload this window, then set this input again.', 'err');
3969
+ return;
3970
+ }
3971
+ if (!up.ok) { showToast(up.error || 'Couldn’t store the file.', 'err'); return; }
3927
3972
  store[inp.name] = up.path;
3928
- } catch { showToast('could not upload the file', 'err'); return; }
3973
+ } catch { showToast('Couldn’t upload the file. Make sure FloLess is still running, then set this input again.', 'err'); return; }
3929
3974
  } else if (typeof v === 'string' && v) {
3930
3975
  store[inp.name] = v; // unchanged existing path
3931
3976
  } // cleared/empty → omit (no value)
@@ -4265,7 +4310,10 @@
4265
4310
  await ensureReportDiscoverySession();
4266
4311
  answer = await api(`/api/pages/${encodeURIComponent(home)}/${encodeURIComponent(id)}/versions/${encodeURIComponent(n)}/full-report`);
4267
4312
  } catch (error) {
4268
- showToast(error?.message && !/^HTTP \d+$/.test(error.message) ? error.message : 'FloLess couldn’t open the full report. Try again in a moment.', 'warn');
4313
+ console.warn('full report did not open', error);
4314
+ // The server's reason when it gave one (#3097: api() marks it); a lost connection or an unexplained failure gets
4315
+ // the shared sentence for this read, never the browser's "Failed to fetch".
4316
+ showToast(error?.serverText ? error.message : failureCopy(error, { action: 'open the full report', retrySafe: true }).text, 'warn');
4269
4317
  return false;
4270
4318
  }
4271
4319
  if (typeof answer?.handle !== 'string' || !answer.handle) {
@@ -8518,6 +8566,13 @@
8518
8566
  // The apply body, extracted so the popover's "Update now" can drive it with the
8519
8567
  // polled target version (no textContent scrape). Preserves the npm-vs-desktop
8520
8568
  // branch verbatim: npm copies the command; desktop confirms → relaunch.
8569
+ // The server waits for a person to answer the FloLess window's close guard (up to 10 minutes after a 5 s acknowledgement),
8570
+ // so the tab must wait longer than that or it would call a slow answer a failure.
8571
+ const APP_UPDATE_APPLY_TIMEOUT_MS = 11 * 60 * 1000;
8572
+ // The server answers 409 { paused | alreadyUpdating, error } when an update did not start on purpose.
8573
+ function appUpdateNotice(body) {
8574
+ return body && (body.paused || body.alreadyUpdating) && typeof body.error === 'string' && body.error ? body.error : null;
8575
+ }
8521
8576
  async function applyAppUpdate(version) {
8522
8577
  if (!$appUpdate) return;
8523
8578
  // ONLY the desktop (Velopack) build can self-apply — it is the one with Update.exe. Everything
@@ -8558,8 +8613,19 @@
8558
8613
  $appUpdate.disabled = true;
8559
8614
  $appUpdate.textContent = '↑ Updating…';
8560
8615
  try {
8561
- const r = await fetch('/api/update/apply', { method: 'POST', headers: { 'content-type': 'application/json' }, signal: AbortSignal.timeout(5 * 60 * 1000) });
8616
+ const r = await fetch('/api/update/apply', { method: 'POST', headers: { 'content-type': 'application/json' }, signal: AbortSignal.timeout(APP_UPDATE_APPLY_TIMEOUT_MS) });
8562
8617
  const d = await r.json().catch(() => ({}));
8618
+ // The update did not start, on purpose: the person kept the FloLess window open, or one is already getting ready.
8619
+ // That is news, not a failure: say what the server said and put the pill back.
8620
+ const notice = appUpdateNotice(d);
8621
+ if (notice) {
8622
+ $appUpdate.disabled = false;
8623
+ _updateApplying = null;
8624
+ try { localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ }
8625
+ showToast(notice, 'info');
8626
+ refreshUpdate();
8627
+ return;
8628
+ }
8563
8629
  if (!r.ok || !d.ok) throw new Error(d.error || 'update failed');
8564
8630
  // Success: the server is exiting + Update.exe relaunches the new build. The health
8565
8631
  // poll flips to offline (R1 overlay), then the new version reconnects on its own.
@@ -8636,116 +8702,452 @@
8636
8702
  // safe to call before this block initialises.
8637
8703
  const $wfUpdate = document.getElementById('wf-update');
8638
8704
  const $wfUpdateModal = document.getElementById('wf-update-modal');
8639
- let _wfUpdateApplying = false;
8640
- let _wfReviewedUpdate = null;
8705
+ let _wfModalOffer = null; // the offer the header dialog shows, frozen as it was opened
8641
8706
  function wfUpdateFor(id) { return _wfUpdates.find((u) => u.id === id) || null; }
8642
8707
  function renderWfUpdatePill() {
8643
8708
  const el = document.getElementById('wf-update');
8644
8709
  if (!el) return;
8645
8710
  const u = currentId ? wfUpdateFor(currentId) : null;
8646
8711
  if (u) {
8647
- el.textContent = '↑ Update to v' + u.available;
8712
+ el.textContent = '↑ Update available';
8648
8713
  el.setAttribute('data-command-id', 'shell.workflow-update#' + u.id);
8649
8714
  el.setAttribute('data-command-instance-label', apps.get(u.id)?.displayName || u.id);
8650
- el.dataset.tip = 'A newer version of this workflow is available — see what changed';
8715
+ el.dataset.tip = `Version ${u.available} of this workflow is available. See what is new and update it in one click.`;
8651
8716
  el.hidden = false;
8652
8717
  } else {
8653
8718
  el.hidden = true;
8654
8719
  }
8655
8720
  }
8656
- async function refreshWorkflowUpdates() {
8721
+ /**
8722
+ * Read the offers again. The one source for both update dialogs and the footer count (#3081), so they never disagree.
8723
+ * Answers the list read, or null when the read failed: a failed read keeps the last list on screen, because a dropped
8724
+ * request is not "nothing to update". A read sent earlier that answers after a later one is not applied, and answers
8725
+ * with the later read instead, so every caller ends on the same list.
8726
+ */
8727
+ let _wfUpdatesTicket = 0;
8728
+ let _wfUpdatesLatest = null; // the newest call; a call overtaken by it answers with it, which follows any later one in turn
8729
+ function refreshWorkflowUpdates() {
8730
+ const ticket = ++_wfUpdatesTicket;
8731
+ const call = (async () => {
8732
+ const list = await readWorkflowUpdates();
8733
+ if (ticket !== _wfUpdatesTicket) return _wfUpdatesLatest;
8734
+ if (list) _wfUpdates = list;
8735
+ renderWfUpdatePill();
8736
+ wfRowsChanged();
8737
+ return list;
8738
+ })();
8739
+ _wfUpdatesLatest = call;
8740
+ return call;
8741
+ }
8742
+ /** One read of the offers: the list, or null when it could not be read (the reason is logged). */
8743
+ async function readWorkflowUpdates() {
8657
8744
  try {
8658
8745
  await globalThis.flolessStartupAdmission?.admit('/api/workflows/updates');
8659
8746
  const r = await fetch('/api/workflows/updates');
8660
8747
  const d = await r.json();
8661
- _wfUpdates = (r.ok && d.ok && Array.isArray(d.updates)) ? d.updates : [];
8662
- } catch { _wfUpdates = []; }
8663
- renderWfUpdatePill();
8748
+ if (r.ok && d.ok && Array.isArray(d.updates)) return d.updates;
8749
+ console.warn('workflow updates read failed', { status: r.status, error: d && d.error });
8750
+ } catch (e) { console.warn('workflow updates read failed', e); }
8751
+ return null;
8664
8752
  }
8665
- function openWfUpdateModal(u) {
8666
- if (!$wfUpdateModal) return;
8667
- // Confirm exactly the offer displayed here, even if background polling replaces the live list.
8668
- _wfReviewedUpdate = Object.freeze({ ...u });
8669
- const a = apps.get(u.id);
8670
- const name = (a && a.displayName) || u.id;
8671
- document.getElementById('wf-update-title').textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? `Repair “${name}” compatibility`
8672
- : u.sourceUpdate?.mode === 'steel-review' ? `Review the update for “${name}”` : `Update “${name}” to v${u.available}`;
8673
- document.getElementById('wf-update-sub').textContent = `${name} ${u.installed} → ${u.available}${u.sourceUpdate?.mode === 'steel-compatibility' ? ' available · compatibility repair only' : '. What’s new:'}`;
8674
- const note = $wfUpdateModal.querySelector('.wf-update-note');
8675
- if (note) note.textContent = u.sourceUpdate ? `${u.sourceUpdate.explanation} A backup is saved before any source change. Afterwards return to Review and approve your model.` : u.sourceOnly
8676
- ? 'This updates the unchanged older workflow file and saves a backup. It does not approve it. Review the updated workflow, then press Compile yourself before running it.'
8677
- : "Your work is safe — this updates the workflow's steps and keeps your data. A backup of the current version is saved first.";
8678
- const apply = document.getElementById('wf-update-ok');
8679
- if (apply) apply.textContent = u.sourceUpdate?.mode === 'steel-compatibility' ? 'Back up & repair compatibility'
8680
- : u.sourceUpdate?.mode === 'steel-review' ? 'Review in AI Chat' : '↑ Back up & update';
8681
- const changelog = Array.isArray(u.changelog) ? u.changelog : [];
8682
- document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
8683
- const changes = Array.isArray(e.changes) && e.changes.length
8684
- ? '<ul>' + e.changes.map((c) => `<li>${escapeHtml(String(c))}</li>`).join('') + '</ul>' : '';
8685
- return `<div class="wf-ver"><div class="wf-ver-head">v${escapeHtml(String(e.version))}</div>`
8686
- + (e.summary ? `<div class="wf-ver-sum">${escapeHtml(String(e.summary))}</div>` : '') + changes + '</div>';
8687
- }).join('') || '<div class="wf-ver-sum">No changelog provided.</div>';
8688
- showModal($wfUpdateModal);
8753
+
8754
+ // ── One-click workflow update (owner ruling 2026-11-02) ──────────────────────────────────────────────────────────
8755
+ // "As soon as they click update, it should update", with a backup so the person can always go back. One row model is
8756
+ // shared by the header dialog (the open workflow) and the status-bar dialog (every workflow): the same states, the same
8757
+ // request, the same Undo. A workflow the person changed is the one case that warns first, because the update replaces
8758
+ // their changes (they stay in the backup). A Steel Model with changes FloLess cannot carry over is reviewed in AI Chat.
8759
+ const _wfRowState = new Map(); // id → { state: 'busy'|'done'|'failed'|'undoing'|'undone', ... }
8760
+ // After Undo anyway, the later work's backup: its own record, so nothing that happens to the row (a new update, a failed
8761
+ // one, the dialog opening) can drop the one handle on that work. Cleared only when its Undo succeeds or the backup is gone.
8762
+ // A list per workflow, newest last: a second Undo anyway never replaces the first one's handle, and each toast keeps its own.
8763
+ const _wfRecovery = new Map(); // id → [{ backupPath, sourceHash, laterChanges? }]
8764
+ const wfRecoveryOf = (id) => (_wfRecovery.get(id) || []).at(-1);
8765
+ function wfRecoverySet(id, backupPath, next) { // next: the new handle, or null to drop it
8766
+ const list = [...(_wfRecovery.get(id) || [])];
8767
+ const at = list.findIndex((h) => h.backupPath === backupPath);
8768
+ if (at < 0) { if (next) list.push(next); } else if (next) list[at] = next; else list.splice(at, 1);
8769
+ if (list.length) _wfRecovery.set(id, list); else _wfRecovery.delete(id);
8770
+ }
8771
+ // Failures that leave the workflow exactly as it was: refused before anything was written, or rolled back from the backup.
8772
+ const WF_UNCHANGED_CODES = new Set(['update-not-started', 'update-failed', 'up-to-date', 'not-installed', 'no-template', 'not-published', 'needs-review', 'needs-consent']);
8773
+ const WF_CHANGED_WARNING = 'You changed this workflow. Updating replaces your changes. They’re kept in the backup.';
8774
+ function wfDisplayName(id) {
8775
+ const a = apps.get(id);
8776
+ return (a && a.displayName) || _wfUpdates.find((u) => u.id === id)?.displayName || _wfRowState.get(id)?.offer?.displayName || id;
8689
8777
  }
8690
- function dismissWfUpdateModal() {
8691
- _wfReviewedUpdate = null;
8692
- hideModal($wfUpdateModal);
8778
+ /**
8779
+ * #3081: what tells apart update rows that share a name (three copies of Steel Model, say): the project the workflow
8780
+ * belongs to, or its own id when the project is shared or there is none. Null when no other row has the name, so most
8781
+ * rows read as before. Copies are never merged because their names match.
8782
+ */
8783
+ function wfUpdateContext(id) {
8784
+ const name = wfDisplayName(id);
8785
+ const twins = wfUpdateRowsForDialog().filter((o) => o.id !== id && wfDisplayName(o.id) === name).map((o) => o.id);
8786
+ if (!twins.length) return null;
8787
+ const project = (x) => wfLibrary.find((a) => a.id === x)?.ownerLabel || '';
8788
+ const mine = project(id);
8789
+ return mine && !twins.some((x) => project(x) === mine) ? { kind: 'project', text: mine } : { kind: 'id', text: id };
8790
+ }
8791
+ /** The name a person reads, and hears, for one update row: with what tells it apart when another row has the same name. */
8792
+ function wfUpdateLabel(id) {
8793
+ const ctx = wfUpdateContext(id);
8794
+ return !ctx ? wfDisplayName(id) : ctx.kind === 'project' ? `${wfDisplayName(id)} in ${ctx.text}` : `${wfDisplayName(id)} (${ctx.text})`;
8795
+ }
8796
+ function wfWhatsNew(u) {
8797
+ if (u.sourceUpdate?.explanation) return u.sourceUpdate.explanation;
8798
+ const first = Array.isArray(u.changelog) ? u.changelog.find((e) => e && e.summary) : null;
8799
+ return first ? String(first.summary) : 'A newer version from FloLess. Your saved data is kept.';
8800
+ }
8801
+ /** A Steel Model: its update is reviewed in AI Chat, never applied in one click (owner ruling 2026-11-02). */
8802
+ function wfNeedsReview(u) { return !!u.sourceUpdate; }
8803
+ /** Whether the row must warn that updating replaces the person's changes: the offer says so, or the server just did. */
8804
+ function wfRowChanged(s, u) {
8805
+ return !wfNeedsReview(u) && (s.state === 'idle' || s.state === 'failed' || s.state === 'undone') && (!!u.hasChanges || !!s.hasChanges);
8693
8806
  }
8694
- async function applyWfUpdate(u) {
8695
- if (_wfUpdateApplying) return;
8696
- if (u.sourceUpdate?.mode === 'steel-review') {
8697
- if (typeof window.flolessChat?.openDraft !== 'function' || typeof window.flolessBridge?.openApp !== 'function') {
8698
- showToast('AI Chat is still starting. Keep this review open and try again in a moment.', 'warn'); return;
8699
- }
8700
- _wfUpdateApplying = true;
8701
- const button = document.getElementById('wf-update-ok');
8702
- if (button) { button.disabled = true; button.setAttribute('data-blocked-reason', 'Opening this workflow’s chat review.'); }
8703
- try {
8704
- // Installed workflows use Workspace chat. Opening the exact workflow first leaves a project
8705
- // conversation safely; openDraft then preserves/appends the destination draft or offers a provider.
8706
- await window.flolessBridge.openApp(u.id);
8707
- await window.flolessChat.openDraft(`Review the installed workflow ${u.id} (${u.installed}) against its bundled maintained template ${u.templateId} (${u.available}). Preserve all my customizations, baked content, models and approval history. Explain the changes before editing; do not compile or approve anything for me.`);
8708
- dismissWfUpdateModal();
8709
- showToast('The update review is ready in AI Chat. Send it when you are ready; nothing was changed.', 'ok');
8710
- } catch (error) { showToast('The review could not open in this workflow’s AI Chat. Your drafts were kept. Try again.', 'warn'); }
8711
- finally { _wfUpdateApplying = false; if (button) { button.disabled = false; button.removeAttribute('data-blocked-reason'); } }
8712
- return;
8713
- }
8714
- _wfUpdateApplying = true;
8715
- const $ok = document.getElementById('wf-update-ok');
8716
- const prev = $ok ? $ok.textContent : '';
8717
- if ($ok) { $ok.disabled = true; $ok.setAttribute('data-blocked-reason', 'Updating this workflow now.'); $ok.textContent = 'Updating…'; }
8807
+ /**
8808
+ * What Update all updates, and what its button counts: every offer the person has not changed that is not being worked on
8809
+ * or already updated (its offer can outlive the update until the list refreshes; sending it again would lose its Undo).
8810
+ */
8811
+ function wfUpdateAllTargets() {
8812
+ return _wfUpdates.filter((u) => !u.hasChanges && !wfNeedsReview(u) && !['busy', 'undoing', 'done'].includes(_wfRowState.get(u.id)?.state));
8813
+ }
8814
+ /** #3081: the offers still waiting, split into what a click applies and what is reviewed in AI Chat. Updated rows are not counted. */
8815
+ function wfUpdatesWaiting() {
8816
+ const open = _wfUpdates.filter((u) => _wfRowState.get(u.id)?.state !== 'done');
8817
+ const review = open.filter(wfNeedsReview).length;
8818
+ return { apply: open.length - review, review };
8819
+ }
8820
+ function wfRowsChanged() {
8821
+ if (_wfModalOffer) paintWfUpdateModal();
8822
+ globalThis.dispatchEvent?.(new CustomEvent('floless:workflow-update-rows'));
8823
+ }
8824
+ /** Offers still waiting plus the rows this page updated or undid (they stay listed, with Undo, until the page reloads). */
8825
+ function wfUpdateRowsForDialog() {
8826
+ const ids = new Set(_wfUpdates.map((u) => u.id));
8827
+ const kept = [..._wfRowState.entries()].filter(([id, s]) => !ids.has(id) && s.offer).map(([, s]) => s.offer);
8828
+ // A stable order by name, so a row does not jump when it is updated and leaves the live list.
8829
+ return [..._wfUpdates, ...kept].sort((a, b) => wfDisplayName(a.id).localeCompare(wfDisplayName(b.id)));
8830
+ }
8831
+ function wfUpdateRequestBody(u, replaceChanges) {
8832
+ const steel = u.sourceUpdate;
8833
+ return { expectedFromVersion: u.installed, expectedToVersion: u.available,
8834
+ expectedSourceHash: steel ? steel.sourceHash : (u.bindSourceHash || u.sourceHash),
8835
+ expectedTemplateHash: steel ? steel.templateHash : (u.bindTemplateHash || u.templateHash),
8836
+ ...(steel ? { sourceUpdateMode: steel.mode } : {}), ...(replaceChanges ? { replaceChanges: true } : {}) };
8837
+ }
8838
+ async function runWfUpdate(u, opts = {}) {
8839
+ const prior = _wfRowState.get(u.id);
8840
+ if (prior && (prior.state === 'busy' || prior.state === 'undoing')) return false;
8841
+ _wfRowState.set(u.id, { state: 'busy', offer: u });
8842
+ wfRowsChanged();
8718
8843
  try {
8719
8844
  const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' },
8720
- body: JSON.stringify({ expectedFromVersion: u.installed, expectedToVersion: u.available,
8721
- ...(u.sourceOnly ? { expectedSourceHash: u.sourceHash, expectedTemplateHash: u.templateHash } : {}),
8722
- ...(u.sourceUpdate ? { sourceUpdateMode: u.sourceUpdate.mode, expectedSourceHash: u.sourceUpdate.sourceHash, expectedTemplateHash: u.sourceUpdate.templateHash } : {}) }) });
8845
+ body: JSON.stringify(wfUpdateRequestBody(u, !!opts.replaceChanges)) });
8723
8846
  const d = await r.json().catch(() => ({}));
8724
- if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || 'update failed'), { code: d.code });
8725
- dismissWfUpdateModal();
8726
- showToast(d.compatibilityRepaired ? `3D Viewer compatibility repaired. Workflow v${d.toVersion} and your work were preserved; a backup was saved. Return to Review and approve your model.`
8727
- : d.needsCompile ? `Updated to v${d.toVersion}. A backup was saved. Review the workflow, then press Compile yourself before running it.`
8728
- : `Updated to v${d.toVersion} — your data is preserved, a backup was saved.`, 'ok');
8847
+ if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || ''), { code: d.code });
8848
+ _wfRowState.set(u.id, { state: 'done', offer: u, toVersion: d.toVersion, backupPath: d.backupPath, sourceHash: d.sourceHash });
8849
+ wfRowsChanged();
8850
+ document.getElementById('wf-update-announce')?.replaceChildren(`Updated ${wfUpdateLabel(u.id)} to ${d.toVersion}.`);
8851
+ if (!opts.quiet) {
8852
+ const text = `Updated “${wfUpdateLabel(u.id)}” to ${d.toVersion}. It’s ready to run.`;
8853
+ if (d.backupPath) {
8854
+ // The Undo stays a full minute (closable sooner), as after a Restore.
8855
+ const closeUndo = showToast(text, 'ok', { persistent: true,
8856
+ action: { label: 'Undo', commandId: 'shell.workflow-update-undo#' + u.id, onClick: () => { void undoWfChange(u.id); } } });
8857
+ if (typeof closeUndo === 'function') setTimeout(closeUndo, 60000)?.unref?.();
8858
+ } else showToast(text, 'ok');
8859
+ }
8860
+ } catch (e) {
8861
+ const message = e.code === 'has-changes' ? WF_CHANGED_WARNING
8862
+ : e.code === 'update-changed' ? 'This update changed a moment ago. Nothing was changed. Check what’s new, then update again.'
8863
+ : e.code === 'in-progress' ? 'This workflow is already being updated.'
8864
+ : e.code === 'forked' ? 'This workflow is your own copy, so FloLess updates don’t replace it. Nothing was changed.'
8865
+ : e.code === 'needs-review' ? 'Steel Model updates are reviewed in AI Chat, so nothing was changed. Review the update in AI Chat; it keeps your model.'
8866
+ : e.code === 'needs-consent' ? 'This workflow has an AI step whose answer may differ each run, and you haven’t confirmed that yet, so nothing was changed. Approve the workflow yourself and tick the box, or update it with AI Chat.'
8867
+ // Put back from the backup failed too: the one outcome where "unchanged" would be untrue.
8868
+ : e.code === 'rollback-failed' ? 'Couldn’t update, and FloLess couldn’t put your workflow back as it was, so it may not run. Restore it, or ask for help: your previous version is kept in the backup.'
8869
+ // Each of these leaves the workflow exactly as it was (refused before, or rolled back from the backup).
8870
+ : WF_UNCHANGED_CODES.has(e.code) ? 'Couldn’t update. Your workflow is unchanged.'
8871
+ // No answer (the connection dropped, or something unexpected): whether it finished is not known.
8872
+ : 'FloLess couldn’t confirm the update finished. Reload FloLess to see the workflow, then try again if it is not updated.';
8873
+ _wfRowState.set(u.id, { state: 'failed', offer: u, message, hasChanges: e.code === 'has-changes' });
8874
+ if (e.code === 'update-changed') {
8875
+ await wfRefreshAfter(null);
8876
+ // The header dialog confirms exactly the offer it shows: show the current one before another click can apply it.
8877
+ if (_wfModalOffer && _wfModalOffer.id === u.id) {
8878
+ const fresh = wfUpdateFor(u.id);
8879
+ if (fresh) { _wfModalOffer = Object.freeze({ ...fresh }); _wfRowState.set(u.id, { state: 'failed', offer: fresh, message }); }
8880
+ else _wfRowState.set(u.id, { state: 'failed', offer: u, message: 'There is no update for this workflow now. Nothing was changed.' });
8881
+ paintWfUpdateModal();
8882
+ }
8883
+ } else wfRowsChanged();
8884
+ return false;
8885
+ }
8886
+ await wfRefreshAfter(u.id);
8887
+ return true;
8888
+ }
8889
+ /** What the screen shows after a change that succeeded: a failed refresh is said, never reported as a failed change. */
8890
+ async function wfRefreshAfter(id) {
8891
+ try {
8892
+ if (id) await loadApps();
8729
8893
  await refreshWorkflowUpdates();
8730
8894
  globalThis.dispatchEvent?.(new CustomEvent('floless:workflow-updates-changed'));
8731
- if (currentId === u.id) await loadApp(currentId); // reload to show the new structure
8895
+ if (id && currentId === id) await loadApp(id);
8732
8896
  } catch (e) {
8733
- if (e.code === 'update-changed') {
8734
- dismissWfUpdateModal();
8735
- await refreshWorkflowUpdates();
8897
+ console.warn('[workflow-update] refresh after a change failed', e);
8898
+ showToast('The change is saved, but FloLess couldn’t refresh the screen. Reload FloLess to see it.', 'warn');
8899
+ }
8900
+ }
8901
+ const WF_LATER_CHANGES = 'This workflow changed after the update. Undo would replace those later changes; FloLess backs them up first, with their own Undo.';
8902
+ /**
8903
+ * Undo the last update or restore this page made of `id`, from the backup it saved first. When the workflow changed since,
8904
+ * the server says what Undo would replace and the person may Undo anyway: `replaceLater` is that state, exactly as shown.
8905
+ */
8906
+ async function undoWfChange(id, opts = {}) {
8907
+ const s = _wfRowState.get(id) || { state: 'idle' };
8908
+ // `recovery` undoes an Undo anyway (brings that later work back): `true` is the newest, a handle is that exact one (a
8909
+ // toast's). Otherwise this undoes the row's update or restore.
8910
+ const handle = typeof opts.recovery === 'object' ? (_wfRecovery.get(id) || []).find((h) => h.backupPath === opts.recovery.backupPath)
8911
+ : opts.recovery ? wfRecoveryOf(id) : s;
8912
+ if (!handle || !handle.backupPath || s.state === 'undoing' || s.state === 'busy') return;
8913
+ const putBack = (patch = {}) => { _wfRowState.set(id, { ...s, ...patch }); if (s.state === 'idle' && !Object.keys(patch).length) _wfRowState.delete(id); };
8914
+ _wfRowState.set(id, { ...s, state: 'undoing' });
8915
+ wfRowsChanged();
8916
+ try {
8917
+ const r = await fetch(`/api/workflows/${encodeURIComponent(id)}/undo-update`, { method: 'POST', headers: { 'content-type': 'application/json' },
8918
+ body: JSON.stringify({ backupPath: handle.backupPath, expectedSourceHash: handle.sourceHash, ...(opts.replaceLater ? { replaceLater: opts.replaceLater } : {}) }) });
8919
+ const d = await r.json().catch(() => ({}));
8920
+ if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || ''), { code: d.code, current: d.current });
8921
+ if (opts.recovery) wfRecoverySet(id, handle.backupPath, null);
8922
+ // After Undo anyway, the later work is in its own backup, with its own Undo.
8923
+ const later = d.replacedLater && d.backupPath ? { backupPath: d.backupPath, sourceHash: d.sourceHash } : null;
8924
+ if (later) wfRecoverySet(id, later.backupPath, later);
8925
+ _wfRowState.set(id, { state: 'undone', offer: s.offer, version: d.version });
8926
+ const text = `Put “${wfUpdateLabel(id)}” back to ${d.version}.`
8927
+ + (d.replacedLater ? ' The changes made after the update are in a backup.' : '')
8928
+ + (d.knowledgePinNotRestored ? ' Its pinned knowledge was not brought back: pin it again in Knowledge if it needs it.' : '');
8929
+ if (later) {
8930
+ const closeUndo = showToast(text, 'ok', { persistent: true,
8931
+ action: { label: 'Undo', commandId: 'shell.workflow-update-undo#' + id, onClick: () => { void undoWfChange(id, { recovery: later }); } } });
8932
+ if (typeof closeUndo === 'function') setTimeout(closeUndo, 60000)?.unref?.();
8933
+ } else showToast(text, 'ok');
8934
+ } catch (e) {
8935
+ if (e.code === 'later-changes' && e.current) {
8936
+ // Not a refusal: say what Undo would replace, and let the person choose.
8937
+ if (opts.recovery) { wfRecoverySet(id, handle.backupPath, { ...handle, laterChanges: e.current }); putBack(); }
8938
+ else putBack({ state: 'done', laterChanges: e.current });
8939
+ wfRowsChanged();
8940
+ showToast(WF_LATER_CHANGES, 'warn', { persistent: true, action: { label: 'Undo anyway', commandId: 'shell.workflow-update-undo-anyway#' + id,
8941
+ onClick: () => { void undoWfChange(id, { ...(opts.recovery ? { recovery: handle } : {}), replaceLater: e.current }); } } });
8942
+ return;
8736
8943
  }
8737
- showToast(e.code === 'update-changed'
8738
- ? 'The workflow or its update changed after you opened this review. Your work was kept. Open the update again to review the current version.'
8739
- : 'We couldn’t update this workflow because FloLess could not save the change. Try again.', 'warn');
8740
- } finally {
8741
- _wfUpdateApplying = false;
8742
- if ($ok) { $ok.disabled = false; $ok.removeAttribute('data-blocked-reason'); $ok.textContent = prev; }
8944
+ // A backup that is gone, or an Undo that broke partway, cannot be retried from here: stop offering it.
8945
+ const final = e.code === 'no-backup' || e.code === 'undo-rollback-failed';
8946
+ if (opts.recovery) { wfRecoverySet(id, handle.backupPath, final ? null : { ...handle, laterChanges: null }); putBack(); }
8947
+ else putBack({ state: 'done', laterChanges: null, ...(final ? { backupPath: null } : {}) });
8948
+ wfRowsChanged();
8949
+ showToast(e.code === 'update-changed' ? 'Open the workflow again before undoing. Nothing was changed.'
8950
+ : e.code === 'no-backup' ? 'That backup is missing or incomplete, so this can’t be undone. Your workflow is unchanged.'
8951
+ : e.code === 'undo-rollback-failed' ? 'Undo stopped partway and couldn’t put the workflow back as it was, so it may not run. Restore it, or ask for help: both earlier versions are kept in the backup.'
8952
+ : e.code === 'undo-failed' ? 'Couldn’t undo, so nothing was changed. The backup is still saved. Try again.'
8953
+ : 'FloLess couldn’t confirm the undo finished. Reload FloLess to see the workflow, then try again if it is not undone.', 'warn');
8954
+ return;
8955
+ }
8956
+ await wfRefreshAfter(id);
8957
+ }
8958
+ /** Update every listed workflow the person has not changed, one after another. Changed ones stay, each with its own choice. */
8959
+ async function updateAllWorkflows() {
8960
+ const plain = wfUpdateAllTargets();
8961
+ let updated = 0;
8962
+ for (const u of [...plain]) { if (await runWfUpdate(u, { quiet: true })) updated++; }
8963
+ if (updated) showToast(`Updated ${updated === 1 ? '1 workflow' : updated + ' workflows'}. Each one has Undo in the list.`, 'ok');
8964
+ return updated;
8965
+ }
8966
+ function openKeepMyChanges(u) {
8967
+ if (typeof window.flolessChat?.openDraft !== 'function' || typeof window.flolessBridge?.openApp !== 'function') {
8968
+ showToast('AI Chat is still starting. Try again in a moment.', 'warn'); return;
8743
8969
  }
8970
+ dismissWfUpdateModal();
8971
+ globalThis.flolessToolUpdates?.close?.();
8972
+ void (async () => {
8973
+ try {
8974
+ await window.flolessBridge.openApp(u.id);
8975
+ await window.flolessChat.openDraft(`Bring my own changes in the installed workflow ${u.id} (${u.installed}) into FloLess’s newer version ${u.available} of ${u.templateId}. Explain what you will carry across before editing. Keep my saved data. Do not approve anything for me.`);
8976
+ showToast('Your request is ready in AI Chat. Nothing changes until you send it.', 'ok');
8977
+ } catch { showToast('AI Chat could not open for this workflow. Nothing was changed. Try again.', 'warn'); }
8978
+ })();
8979
+ }
8980
+ function wfButton(label, commandId, instance, onClick, cls) {
8981
+ const b = document.createElement('button');
8982
+ b.type = 'button';
8983
+ b.className = 'tool-updates-open' + (cls ? ' ' + cls : '');
8984
+ b.textContent = label;
8985
+ b.setAttribute('data-command-id', commandId + '#' + instance);
8986
+ b.setAttribute('data-command-instance-label', wfUpdateLabel(instance));
8987
+ // Rows that share a name have buttons that read the same: say which workflow each one acts on (#3081).
8988
+ if (wfUpdateContext(instance)) b.setAttribute('aria-label', `${label}: ${wfUpdateLabel(instance)}`);
8989
+ b.addEventListener('click', onClick);
8990
+ return b;
8991
+ }
8992
+ /** One row: name and versions, what is new or where it stands, and the one button that does the next thing. */
8993
+ function wfUpdateRow(u, opts = {}) {
8994
+ const s = _wfRowState.get(u.id) || { state: 'idle' };
8995
+ const row = document.createElement('div');
8996
+ row.className = 'tool-updates-needs wf-upd-row';
8997
+ row.setAttribute('data-template-update', u.id);
8998
+ row.setAttribute('data-state', s.state);
8999
+ const recovery = wfRecoveryOf(u.id);
9000
+ if ((s.state === 'done' && s.laterChanges) || (s.state !== 'done' && recovery?.laterChanges)) row.setAttribute('data-next', 'undo-anyway');
9001
+ if (s.state === 'busy' || s.state === 'undoing') row.setAttribute('aria-busy', 'true');
9002
+ const text = document.createElement('div');
9003
+ text.className = 'tool-updates-needs-text';
9004
+ const name = document.createElement('span');
9005
+ name.className = 'tool-updates-needs-name';
9006
+ name.append(wfDisplayName(u.id) + ' ');
9007
+ const ctx = wfUpdateContext(u.id);
9008
+ if (ctx) {
9009
+ const where = document.createElement('span');
9010
+ where.className = 'wf-upd-ctx';
9011
+ where.setAttribute('data-context-kind', ctx.kind);
9012
+ where.textContent = ctx.kind === 'project' ? `in ${ctx.text}` : ctx.text;
9013
+ where.setAttribute('data-tip', ctx.kind === 'project' ? `The project this copy of ${wfDisplayName(u.id)} belongs to.`
9014
+ : `This copy’s workflow id. It tells it apart from the other workflows named ${wfDisplayName(u.id)}.`);
9015
+ name.append(where, ' ');
9016
+ }
9017
+ const ver = document.createElement('span');
9018
+ ver.className = 'wf-upd-ver';
9019
+ ver.textContent = s.state === 'done' ? `now ${s.toVersion}` : s.state === 'undone' ? `back to ${s.version}` : `${u.installed} → ${u.available}`;
9020
+ name.appendChild(ver);
9021
+ // The header dialog already names the workflow, its versions and what is new: its row says only where it stands.
9022
+ if (!opts.textOnly) text.appendChild(name);
9023
+ const line = document.createElement('span');
9024
+ line.className = 'tool-updates-needs-sentence';
9025
+ const changed = wfRowChanged(s, u);
9026
+ if (s.state === 'busy') line.textContent = 'Updating… a backup is saved first.';
9027
+ else if (s.state === 'undoing') line.textContent = 'Putting your previous version back…';
9028
+ else if (s.state === 'done') line.textContent = s.laterChanges ? WF_LATER_CHANGES : 'Updated and ready to run. Your previous version is saved.';
9029
+ else if (recovery?.laterChanges) line.textContent = WF_LATER_CHANGES;
9030
+ else if (s.state === 'undone') line.textContent = recovery ? 'Your previous version is back. The changes made after the update are in a backup.' : 'Your previous version is back.';
9031
+ else if (s.state === 'failed' && !s.hasChanges) line.textContent = s.message;
9032
+ else if (!opts.textOnly) { line.textContent = wfWhatsNew(u); line.setAttribute('data-tip', wfWhatsNew(u)); line.classList.add('wf-upd-new'); }
9033
+ if (line.textContent) text.appendChild(line);
9034
+ if (changed) {
9035
+ const warn = document.createElement('span');
9036
+ warn.className = 'wf-upd-warn';
9037
+ warn.textContent = WF_CHANGED_WARNING;
9038
+ text.appendChild(warn);
9039
+ }
9040
+ row.appendChild(text);
9041
+ if (opts.textOnly) return row;
9042
+ const actions = document.createElement('div');
9043
+ actions.className = 'wf-upd-actions';
9044
+ if (s.state === 'busy' || s.state === 'undoing') {
9045
+ const b = wfButton(s.state === 'busy' ? 'Updating…' : 'Undoing…', 'shell.workflow-update-apply', u.id, () => {});
9046
+ b.disabled = true; b.setAttribute('data-blocked-reason', 'Already working on this workflow.');
9047
+ actions.appendChild(b);
9048
+ } else if (s.state === 'done') {
9049
+ if (s.backupPath && s.laterChanges) {
9050
+ const later = s.laterChanges;
9051
+ actions.appendChild(wfButton('Undo anyway', 'shell.workflow-update-undo-anyway', u.id, () => { void undoWfChange(u.id, { replaceLater: later }); }));
9052
+ } else if (s.backupPath) actions.appendChild(wfButton('Undo', 'shell.workflow-update-undo', u.id, () => { void undoWfChange(u.id); }));
9053
+ } else {
9054
+ // After Undo anyway the later work stays one click back, whatever happens to the row next.
9055
+ if (recovery) {
9056
+ const later = recovery.laterChanges;
9057
+ actions.appendChild(later
9058
+ ? wfButton('Undo anyway', 'shell.workflow-update-undo-anyway', u.id, () => { void undoWfChange(u.id, { recovery: true, replaceLater: later }); })
9059
+ : wfButton('Undo', 'shell.workflow-update-undo', u.id, () => { void undoWfChange(u.id, { recovery: true }); }));
9060
+ }
9061
+ if (s.state === 'undone' && !wfUpdateFor(u.id)) {
9062
+ // The row says the earlier version is back, and the offer returns on the next check.
9063
+ } else if (wfNeedsReview(u)) {
9064
+ actions.appendChild(wfButton('Review in AI Chat', 'shell.workflow-update-keep-mine', u.id, () => openKeepMyChanges(u), 'wf-upd-primary'));
9065
+ } else {
9066
+ // Waiting, failed, or put back with the update offered again: it can be updated (again) from here.
9067
+ if (changed) actions.appendChild(wfButton('Keep my changes (AI)', 'shell.workflow-update-keep-mine', u.id, () => openKeepMyChanges(u)));
9068
+ actions.appendChild(wfButton(s.state === 'failed' && !changed ? 'Try again' : changed ? 'Update anyway' : 'Update',
9069
+ 'shell.workflow-update-apply', u.id, () => { void runWfUpdate(u, { replaceChanges: changed }); }, 'wf-upd-primary'));
9070
+ }
9071
+ }
9072
+ row.appendChild(actions);
9073
+ return row;
9074
+ }
9075
+
9076
+ // The header dialog: what is new in the open workflow, and the same row, updated in place.
9077
+ function paintWfUpdateModal() {
9078
+ const u = _wfModalOffer;
9079
+ if (!u || !$wfUpdateModal) return;
9080
+ const name = wfUpdateLabel(u.id);
9081
+ const s = _wfRowState.get(u.id) || { state: 'idle' };
9082
+ document.getElementById('wf-update-title').textContent = `Update “${name}”`;
9083
+ // A Steel Model is reviewed in AI Chat, not updated here: this dialog must not promise a backup and Undo it never makes.
9084
+ document.getElementById('wf-update-sub').textContent = wfNeedsReview(u)
9085
+ ? `${u.installed} → ${u.available}. You review this one in AI Chat, and nothing changes until you send the request there.`
9086
+ : `${u.installed} → ${u.available}. Your saved data is kept, and a backup is saved first so you can undo.`;
9087
+ const changelog = Array.isArray(u.changelog) ? u.changelog : [];
9088
+ document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
9089
+ const changes = Array.isArray(e.changes) && e.changes.length
9090
+ ? '<ul>' + e.changes.map((c) => `<li>${escapeHtml(String(c))}</li>`).join('') + '</ul>' : '';
9091
+ return `<div class="wf-ver"><div class="wf-ver-head">${escapeHtml(String(e.version))}</div>`
9092
+ + (e.summary ? `<div class="wf-ver-sum">${escapeHtml(String(e.summary))}</div>` : '') + changes + '</div>';
9093
+ }).join('') || '<div class="wf-ver-sum">No list of changes came with this version.</div>';
9094
+ const host = document.getElementById('wf-update-row');
9095
+ if (host) { const row = wfUpdateRow(u, { textOnly: true }); host.replaceChildren(...(row.textContent ? [row] : [])); }
9096
+ const changed = wfRowChanged(s, u);
9097
+ const ok = document.getElementById('wf-update-ok');
9098
+ const ai = document.getElementById('wf-update-ai');
9099
+ const cancel = document.getElementById('wf-update-cancel');
9100
+ const review = wfNeedsReview(u) && !['busy', 'undoing', 'done', 'undone'].includes(s.state);
9101
+ if (ai) ai.hidden = !changed;
9102
+ if (ok) {
9103
+ ok.disabled = s.state === 'busy' || s.state === 'undoing';
9104
+ if (ok.disabled) ok.setAttribute('data-blocked-reason', 'Already working on this workflow.'); else ok.removeAttribute('data-blocked-reason');
9105
+ ok.textContent = s.state === 'busy' ? 'Updating…' : s.state === 'undoing' ? 'Undoing…'
9106
+ : s.state === 'done' ? (s.laterChanges ? 'Undo anyway' : 'Undo')
9107
+ : s.state === 'undone' ? 'Done' : review ? 'Review in AI Chat'
9108
+ : s.state === 'failed' && !changed ? 'Try again' : changed ? 'Update anyway' : 'Update';
9109
+ ok.setAttribute('data-command-id', s.state === 'undone' ? 'shell.dialog-cancel#the workflow update'
9110
+ : (s.state === 'done' ? (s.laterChanges ? 'shell.workflow-update-undo-anyway' : 'shell.workflow-update-undo')
9111
+ : review ? 'shell.workflow-update-keep-mine' : 'shell.workflow-update-apply') + '#' + u.id);
9112
+ ok.setAttribute('data-command-instance-label', name);
9113
+ // Same-named copies: the button says which workflow it acts on, as the row buttons do (#3081).
9114
+ if (wfUpdateContext(u.id)) ok.setAttribute('aria-label', `${ok.textContent}: ${name}`); else ok.removeAttribute('aria-label');
9115
+ }
9116
+ if (cancel) {
9117
+ cancel.textContent = s.state === 'done' ? 'Close' : 'Not now';
9118
+ cancel.hidden = s.state === 'undone'; // Done is the only thing left to do
9119
+ }
9120
+ }
9121
+ function openWfUpdateModal(u) {
9122
+ if (!$wfUpdateModal) return;
9123
+ // Confirm exactly the offer displayed here, even if background polling replaces the live list.
9124
+ _wfModalOffer = Object.freeze({ ...u });
9125
+ const s = _wfRowState.get(u.id);
9126
+ // Offered again after an Undo: the dialog updates. Undo anyway's backup is not row state, so it stays one click back.
9127
+ if (s && s.state === 'undone') _wfRowState.delete(u.id);
9128
+ paintWfUpdateModal();
9129
+ showModal($wfUpdateModal);
9130
+ }
9131
+ function dismissWfUpdateModal() {
9132
+ _wfModalOffer = null;
9133
+ hideModal($wfUpdateModal);
9134
+ }
9135
+ function onWfUpdateOk() {
9136
+ const u = _wfModalOffer;
9137
+ if (!u) return;
9138
+ const s = _wfRowState.get(u.id) || { state: 'idle' };
9139
+ if (s.state === 'busy' || s.state === 'undoing') return;
9140
+ if (s.state === 'done') { void undoWfChange(u.id, s.laterChanges ? { replaceLater: s.laterChanges } : {}); return; }
9141
+ if (s.state === 'undone') { dismissWfUpdateModal(); return; }
9142
+ if (wfNeedsReview(u)) { openKeepMyChanges(u); return; }
9143
+ const changed = wfRowChanged(s, u);
9144
+ void runWfUpdate(u, { replaceChanges: changed });
8744
9145
  }
8745
9146
  if ($wfUpdate) {
8746
9147
  $wfUpdate.onclick = () => { const u = currentId && wfUpdateFor(currentId); if (u) openWfUpdateModal(u); };
8747
9148
  const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = dismissWfUpdateModal;
8748
- const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = () => { if (_wfReviewedUpdate) return applyWfUpdate(_wfReviewedUpdate); };
9149
+ const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = onWfUpdateOk;
9150
+ const $ai = document.getElementById('wf-update-ai'); if ($ai) $ai.onclick = () => { if (_wfModalOffer) openKeepMyChanges(_wfModalOffer); };
8749
9151
  if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, dismissWfUpdateModal);
8750
9152
  }
8751
9153
 
@@ -9584,11 +9986,17 @@
9584
9986
  // compare has a real value). Reveals once: if a pending self-update version was
9585
9987
  // recorded before the relaunch AND the now-running build matches it AND the user
9586
9988
  // hasn't already dismissed that version, fetch its notes and show the panel.
9587
- function maybeShowWhatsNew() {
9588
- if (whatsNewShown) return;
9989
+ let whatsNewChecking = false;
9990
+ async function maybeShowWhatsNew() {
9991
+ if (whatsNewShown || whatsNewChecking) return;
9589
9992
  let pending, seen;
9590
- try { pending = localStorage.getItem('floless.whatsNew.pending'); seen = localStorage.getItem('floless.whatsNew.seen'); } catch { return; }
9993
+ try { pending = localStorage.getItem('floless.whatsNew.pending'); } catch { return; }
9591
9994
  if (!pending) return;
9995
+ // "Seen" is shared with the other FloLess client (#2963), so wait for the server's answer (bounded; the browser's own copy otherwise).
9996
+ whatsNewChecking = true;
9997
+ try { await window.flolessPrefs?.ready(); } finally { whatsNewChecking = false; }
9998
+ if (whatsNewShown) return;
9999
+ try { seen = window.flolessPrefs ? window.flolessPrefs.get('whatsNewSeen') : localStorage.getItem('floless.whatsNew.seen'); } catch { return; }
9592
10000
  const appVer = (document.getElementById('app-version')?.textContent || '').replace(/[^0-9.]/g, '');
9593
10001
  if (appVer !== pending || seen === pending) { try { localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ } return; }
9594
10002
 
@@ -9621,7 +10029,10 @@
9621
10029
  // Dismiss — no confirm; persist the seen version so it never re-reveals.
9622
10030
  if ($dismiss) {
9623
10031
  $dismiss.onclick = () => {
9624
- try { localStorage.setItem('floless.whatsNew.seen', pending); localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ }
10032
+ try {
10033
+ if (window.flolessPrefs) window.flolessPrefs.set('whatsNewSeen', pending); else localStorage.setItem('floless.whatsNew.seen', pending);
10034
+ localStorage.removeItem('floless.whatsNew.pending');
10035
+ } catch { /* private mode */ }
9625
10036
  panel.hidden = true;
9626
10037
  document.getElementById('app')?.classList.remove('has-whats-new');
9627
10038
  };
@@ -9933,7 +10344,7 @@
9933
10344
  `<div class="so-card" role="status" tabindex="-1">
9934
10345
  <div class="so-spinner" aria-hidden="true"></div>
9935
10346
  <h1>Reconnecting to FloLess…</h1>
9936
- <p>FloLess isn’t responding. This tab will keep trying to reconnect.</p>
10347
+ <p>FloLess isn’t responding. ${document.documentElement.classList.contains('desktop') ? 'FloLess' : 'This tab'} will keep trying to reconnect.</p>
9937
10348
  <p class="so-status" id="so-status"></p>
9938
10349
  <div class="so-actions">
9939
10350
  <button type="button" id="so-refresh" data-command-id="app.reconnect-refresh" class="secondary" hidden>Refresh page</button>
@@ -10199,7 +10610,7 @@
10199
10610
  if (view === 'node-recheck-failed') {
10200
10611
  h1.textContent = 'Node.js is installed';
10201
10612
  body.textContent = "FloLess couldn't carry on setting up AWARE by itself. Choose Try again to continue.";
10202
- if (job.recheckError) remediation.textContent = job.recheckError;
10613
+ // #3097: the server's reason (job.detail) is diagnosis only; this card's sentence already says what to do.
10203
10614
  retry.hidden = false;
10204
10615
  return { spinner: false };
10205
10616
  }
@@ -10226,7 +10637,7 @@
10226
10637
  h1.textContent = "Node.js didn't install";
10227
10638
  body.textContent = (job && job.error) || 'The install stopped before Node.js was installed.';
10228
10639
  offer.textContent = 'Try the install again';
10229
- if (job && job.lastLine && job.lastLine !== job.error) remediation.textContent = job.lastLine;
10640
+ // #3097: never the installer's last output line or exit code; those stay in job.detail for diagnosis.
10230
10641
  } else {
10231
10642
  h1.textContent = 'Node.js is needed';
10232
10643
  body.textContent = "AWARE runs on Node.js, which isn't installed on this computer. FloLess can install it for you, or you can install it yourself.";
@@ -10277,10 +10688,11 @@
10277
10688
  }
10278
10689
  } catch (err) {
10279
10690
  console.warn('node install did not start', err);
10280
- // The server answered (err.status) with its own reason, or it did not answer at all.
10281
- statusText = err && err.status
10282
- ? `Couldn't start the install: ${err.message}`
10283
- : "Couldn't start the install — FloLess's server didn't answer. Try again in a moment.";
10691
+ // #3097: the server's own reason when it gave one (api() marks it); otherwise the shared sentence. A start is a
10692
+ // change, so an unexplained failure asks the person to check before starting it again.
10693
+ statusText = err && err.serverText
10694
+ ? `Couldn’t start the install. ${err.message}`
10695
+ : failureCopy(err, { action: 'start the install', unsure: 'If Windows asks for permission in a moment, allow it; if nothing happens, choose Install again.' }).text;
10284
10696
  } finally {
10285
10697
  nodeInstall.startInFlight = false;
10286
10698
  rerenderBootstrap();
@@ -10297,7 +10709,8 @@
10297
10709
  const next = isLine ? { epoch: rest.epoch, id: rest.id, rev: rest.rev, status: rest.status, method: rest.method, lastLine: line } : rest;
10298
10710
  if (!adoptNodeJob(next)) return;
10299
10711
  if (rest.status === 'succeeded') nodeInstall.recheckSeen = false;
10300
- if (isLine) setBootstrapLogLine(line);
10712
+ // #3097: the installer's own output (winget, msiexec) is not shown; the running card's sentence and spinner say
10713
+ // it is working. The line is kept on the job for diagnosis only.
10301
10714
  rerenderBootstrap();
10302
10715
  }
10303
10716
 
@@ -10358,8 +10771,8 @@
10358
10771
  // job, so a missed "finished" event cannot leave the card spinning forever.
10359
10772
  if (nodeView === 'node-running' || nodeView === 'node-checking' || nodeView === 'node-unknown') refreshNodeInstallJob();
10360
10773
  spin = paintNodeInstallView(nodeView, els).spinner;
10361
- if (nodeView !== 'node-running' && log) log.textContent = '';
10362
- if (nodeView === 'node-running' && nodeInstall.job && nodeInstall.job.lastLine && log && !log.textContent) log.textContent = nodeInstall.job.lastLine;
10774
+ // #3097: no installer output on the Node.js card in any view (the ticker belongs to the AWARE install).
10775
+ if (log) log.textContent = '';
10363
10776
  } else if (status === 'failed') {
10364
10777
  // No spinner on failure — absence of motion is the signal (no error icon).
10365
10778
  spin = false;
@@ -15079,7 +15492,13 @@
15079
15492
  box.querySelectorAll('.cmd-save').forEach((btn) => {
15080
15493
  btn.onclick = () => saveAgentCommandTemplate(btn.dataset.agent, btn.dataset.cmd);
15081
15494
  });
15082
- } catch (e) { box.innerHTML = `<div class="cmd-desc">error: ${escapeHtml(e.message)}</div>`; }
15495
+ } catch (e) {
15496
+ // #3097: the server's reason when it gave one (api() marks it), else the shared sentence for this read; never
15497
+ // "error: " plus the browser's exception text. The error itself goes to the console.
15498
+ console.warn('agent commands unavailable', id, e);
15499
+ const said = e && e.serverText ? e.message : failureCopy(e, { action: 'load this agent’s commands', retrySafe: true }).text;
15500
+ box.innerHTML = `<div class="cmd-desc">${escapeHtml(said)}</div>`;
15501
+ }
15083
15502
  }
15084
15503
 
15085
15504
  async function saveAgentCommandTemplate(agent, command) {
@@ -15767,6 +16186,10 @@
15767
16186
  if (!why && slot.unavailableCode === 'scope-missing' && integration.id === 'google-workspace') {
15768
16187
  why = `AI Chat lists your Drive files, so it needs the Drive file list. Tick “also let FloLess list your Google Drive files” and click ${slot.alias ? 'Reconnect this account' : 'Reconnect'} to allow it.`;
15769
16188
  }
16189
+ // #2466: a sign-in from before FloLess asked for the chat reads holds identity only.
16190
+ if (!why && slot.unavailableCode === 'scope-missing' && integration.id === 'microsoft-365') {
16191
+ why = `AI Chat needs your permission to read your Microsoft 365 files, mail, Planner and Teams. Click ${slot.alias ? 'Reconnect this account' : 'Reconnect'} to allow it.`;
16192
+ }
15770
16193
  if (!why) {
15771
16194
  // A server reason is shown only when it is ordinary language; internal wording gets the plain fallback.
15772
16195
  const raw = slot.unavailableReason || '';
@@ -15902,6 +16325,12 @@
15902
16325
  // Disconnect when its row asks for one.
15903
16326
  const reconnect = google ? google.reconnect
15904
16327
  : i.id === MICROSOFT_INTEGRATION_ID && i.status === 'connected' ? reconnectButtonHtml(i) : '';
16328
+ // #2466: what a Microsoft sign-in asks for, said before the person clicks (FLOLESS_M365_SCOPES, server/oauth-presets.ts).
16329
+ const microsoftHelp = i.id === MICROSOFT_INTEGRATION_ID
16330
+ ? '<div class="int-drive-help is-flush" id="int-microsoft-access-help">When you sign in, FloLess asks Microsoft to let AI Chat read your OneDrive and SharePoint files, '
16331
+ + 'Excel workbooks, Outlook mail, Planner and Teams chats. It only reads. Excel’s permission also allows changes '
16332
+ + '(Microsoft has no read-only one), but FloLess never edits a file.</div>'
16333
+ : '';
15905
16334
  return `
15906
16335
  <div class="int-item int-${i.status}" data-integration-id="${escapeAttr(i.id)}" tabindex="-1">
15907
16336
  <div class="int-icon" aria-hidden="true">${escapeHtml(VENDOR_ICON[i.vendor] || (i.name[0] || '?'))}</div>
@@ -15910,6 +16339,7 @@
15910
16339
  <div class="int-kind">${i.agent === 'first-party' ? 'Built-in integration' : `${escapeHtml(i.vendor || 'integration')} · tool <code>${escapeHtml(i.agent)}</code>`}</div>
15911
16340
  <div class="int-scopes">${escapeHtml((i.network || []).join(' · ') || '—')}</div>
15912
16341
  <div class="int-meta">${escapeHtml(meta)}</div>
16342
+ ${microsoftHelp}
15913
16343
  ${renderIntegrationAccounts(i)}
15914
16344
  <div class="conn-int" data-conn-int="${escapeAttr(i.id)}"></div>
15915
16345
  ${google ? google.notice + google.driveChoice + google.driveNote : ''}
@@ -16533,7 +16963,9 @@
16533
16963
  return { label: 'blocked', dotClass: 'skipped', tip: why, sr: `Status: blocked — ${why}` };
16534
16964
  }
16535
16965
  if (state === 'error') {
16536
- const why = (ss && ss.error) || 'The watcher exited with an error';
16966
+ // #3097: ss.error is the watcher's stderr tail, kept in the status for diagnosis and never shown. The tip says
16967
+ // what happened and how to start watching again.
16968
+ const why = 'The watcher stopped because of an error. Turn it off and on again; if it stops again, use Report an issue at the bottom of the window.';
16537
16969
  return { label: 'error', dotClass: 'failed', tip: why, sr: `Status: error — ${why}` };
16538
16970
  }
16539
16971
  if (state === 'listening') {
@@ -19718,9 +20150,18 @@
19718
20150
  async reviewWorkflowUpdate(appId) {
19719
20151
  await refreshWorkflowUpdates();
19720
20152
  const offer = wfUpdateFor(appId);
19721
- if (!offer) throw new Error('No bundled workflow update is currently available. Ask AI Chat to review the workflow requirements.');
20153
+ if (!offer) throw new Error('This workflow has no update from FloLess right now.');
19722
20154
  openWfUpdateModal(offer);
19723
20155
  },
20156
+ // One-click update (2026-11-02): the status-bar dialog lists and acts on the same rows as the header dialog.
20157
+ workflowUpdateRows: () => wfUpdateRowsForDialog(),
20158
+ workflowUpdateRow: (offer) => wfUpdateRow(offer),
20159
+ updateAllWorkflows: () => updateAllWorkflows(),
20160
+ updateAllCount: () => wfUpdateAllTargets().length,
20161
+ /** #3081: one read of the offers feeds the footer count and both dialogs. Answers the list, or null when the read failed. */
20162
+ refreshWorkflowUpdates: () => refreshWorkflowUpdates(),
20163
+ /** #3081: what still waits in the list: updates a click applies, and ones reviewed in AI Chat. */
20164
+ workflowUpdatesWaiting: () => wfUpdatesWaiting(),
19724
20165
  /** #2046: the ≡ menu's New workflow, opened from a Guide suggestion with its name filled in. */
19725
20166
  newWorkflow: (prefill) => requestNewWorkflow(prefill),
19726
20167
  // #2185: a Guide card's Build it — straight to its own conversation, no dialog.