@floless/app 0.167.0 → 0.169.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 (277) hide show
  1. package/autostart.mjs +169 -63
  2. package/cli-actions.mjs +8 -1
  3. package/desktop-shell.mjs +335 -0
  4. package/dist/floless-server.cjs +73121 -55759
  5. package/dist/schemas/steel.model.v2.schema.json +2 -1
  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-rfi/SKILL.md +4 -2
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +21 -2
  10. package/dist/skills/floless-app-ui/SKILL.md +2 -2
  11. package/dist/skills/floless-app-workflows/SKILL.md +2 -2
  12. package/dist/templates/college-phase-exporter.flo +7 -2
  13. package/dist/templates/trimble-list-projects.flo +10 -2
  14. package/dist/web/agent-steps.js +2 -2
  15. package/dist/web/agents.js +50 -14
  16. package/dist/web/app.css +209 -11
  17. package/dist/web/app.js +99 -16
  18. package/dist/web/aware-update-client.js +14 -6
  19. package/dist/web/aware.js +583 -69
  20. package/dist/web/chat.css +12 -1
  21. package/dist/web/chat.js +627 -96
  22. package/dist/web/commands-drawing-check.js +3 -0
  23. package/dist/web/commands-filter.js +5 -5
  24. package/dist/web/commands-shell.js +283 -14
  25. package/dist/web/commands-steel.js +9 -2
  26. package/dist/web/commands-vector.js +69 -0
  27. package/dist/web/desktop-window.js +435 -0
  28. package/dist/web/drawing-check-editor.html +10 -0
  29. package/dist/web/drawing-check-editor.js +515 -187
  30. package/dist/web/failure-copy.js +33 -2
  31. package/dist/web/flo-3d.js +310 -0
  32. package/dist/web/flo-card.js +72 -0
  33. package/dist/web/guide.js +78 -10
  34. package/dist/web/index.html +90 -10
  35. package/dist/web/instructor.js +4 -1
  36. package/dist/web/leave-guard.js +347 -14
  37. package/dist/web/model-editor-steel-adapter.js +41 -1
  38. package/dist/web/model-viewport-toolbar.js +11 -0
  39. package/dist/web/pages.js +21 -14
  40. package/dist/web/panels.js +5 -2
  41. package/dist/web/pdf-view.js +421 -0
  42. package/dist/web/project-history.js +3 -2
  43. package/dist/web/project-modules.js +5 -3
  44. package/dist/web/project-reconciliation.js +1 -1
  45. package/dist/web/project-rfis.js +4 -2
  46. package/dist/web/project-workflows.js +8 -4
  47. package/dist/web/reference-geometry-worker.js +11 -2
  48. package/dist/web/renderers.js +6 -0
  49. package/dist/web/report-csp.js +68 -0
  50. package/dist/web/revit-editor.html +1 -0
  51. package/dist/web/revit-editor.js +37 -8
  52. package/dist/web/run-history.js +2 -3
  53. package/dist/web/shared-prefs.js +364 -0
  54. package/dist/web/steel-3d-flo.js +309 -0
  55. package/dist/web/steel-3d-view.js +159 -0
  56. package/dist/web/steel-editor.html +329 -47
  57. package/dist/web/steel-filter-flo.js +74 -18
  58. package/dist/web/steel-filter.html +22 -6
  59. package/dist/web/tab-signal.js +36 -1
  60. package/dist/web/tekla-editor.html +1 -0
  61. package/dist/web/terminal-requests.js +78 -0
  62. package/dist/web/tool-updates.js +160 -38
  63. package/dist/web/vector-3d.html +14 -3
  64. package/dist/web/vector-editor.html +60 -10
  65. package/dist/web/vendor/README.md +23 -0
  66. package/dist/web/vendor/pdfjs/LICENSE +177 -0
  67. package/dist/web/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  68. package/dist/web/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  69. package/dist/web/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  70. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  71. package/dist/web/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  72. package/dist/web/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  73. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  74. package/dist/web/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  75. package/dist/web/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  76. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  77. package/dist/web/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  78. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  79. package/dist/web/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  80. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  81. package/dist/web/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  82. package/dist/web/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  83. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  84. package/dist/web/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  85. package/dist/web/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  86. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  87. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  88. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  89. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  90. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  91. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  92. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  93. package/dist/web/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  94. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  95. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  96. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  97. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  98. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  99. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  100. package/dist/web/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  101. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  102. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  103. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  104. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  105. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  106. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  107. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  108. package/dist/web/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  109. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  110. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  111. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  112. package/dist/web/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  113. package/dist/web/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  114. package/dist/web/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  115. package/dist/web/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  116. package/dist/web/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  117. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  118. package/dist/web/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  119. package/dist/web/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  120. package/dist/web/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  121. package/dist/web/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  122. package/dist/web/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  123. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  124. package/dist/web/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  125. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  126. package/dist/web/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  127. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  128. package/dist/web/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  129. package/dist/web/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  130. package/dist/web/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  131. package/dist/web/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  132. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  133. package/dist/web/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  134. package/dist/web/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  135. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  136. package/dist/web/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  137. package/dist/web/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  138. package/dist/web/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  139. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  140. package/dist/web/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  141. package/dist/web/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  142. package/dist/web/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  143. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  144. package/dist/web/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  145. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  146. package/dist/web/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  147. package/dist/web/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  148. package/dist/web/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  149. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  150. package/dist/web/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  151. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  152. package/dist/web/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  153. package/dist/web/vendor/pdfjs/cmaps/H.bcmap +0 -0
  154. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  155. package/dist/web/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  156. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  157. package/dist/web/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  158. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  159. package/dist/web/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  160. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  161. package/dist/web/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  162. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  163. package/dist/web/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  164. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  165. package/dist/web/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  166. package/dist/web/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  167. package/dist/web/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  168. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  169. package/dist/web/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  170. package/dist/web/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  171. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  172. package/dist/web/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  173. package/dist/web/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  174. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  175. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  176. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  177. package/dist/web/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  178. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  179. package/dist/web/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  180. package/dist/web/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  181. package/dist/web/vendor/pdfjs/cmaps/LICENSE +36 -0
  182. package/dist/web/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  183. package/dist/web/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  184. package/dist/web/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  185. package/dist/web/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  186. package/dist/web/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  187. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  188. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  189. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  190. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  191. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  192. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  193. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  194. package/dist/web/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  195. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  196. package/dist/web/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  197. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  198. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  199. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  200. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  201. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  202. package/dist/web/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  203. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  204. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  205. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  206. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  207. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  208. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  209. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  210. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  211. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  212. package/dist/web/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  213. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  214. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  215. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  216. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  217. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  218. package/dist/web/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  219. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  220. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  221. package/dist/web/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  222. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  223. package/dist/web/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  224. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  225. package/dist/web/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  226. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  227. package/dist/web/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  228. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  229. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  230. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  231. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  232. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  233. package/dist/web/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  234. package/dist/web/vendor/pdfjs/cmaps/V.bcmap +0 -0
  235. package/dist/web/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  236. package/dist/web/vendor/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  237. package/dist/web/vendor/pdfjs/iccs/LICENSE +116 -0
  238. package/dist/web/vendor/pdfjs/pdf.min.mjs +28 -0
  239. package/dist/web/vendor/pdfjs/pdf.worker.mjs +64908 -0
  240. package/dist/web/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  241. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  242. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  243. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  244. package/dist/web/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  245. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  246. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  247. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  248. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  249. package/dist/web/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  250. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  251. package/dist/web/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  252. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  253. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  254. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  255. package/dist/web/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  256. package/dist/web/vendor/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  257. package/dist/web/vendor/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  258. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  259. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  260. package/dist/web/vendor/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  261. package/dist/web/vendor/pdfjs/wasm/LICENSE_QCMS +21 -0
  262. package/dist/web/vendor/pdfjs/wasm/jbig2.wasm +0 -0
  263. package/dist/web/vendor/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  264. package/dist/web/vendor/pdfjs/wasm/openjpeg.wasm +0 -0
  265. package/dist/web/vendor/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  266. package/dist/web/vendor/pdfjs/wasm/qcms_bg.wasm +0 -0
  267. package/dist/web/workspace-root-management.js +1 -1
  268. package/dist/web/workspaces.js +792 -165
  269. package/home-env.mjs +28 -0
  270. package/install-path.mjs +59 -3
  271. package/launch-starting-page.mjs +35 -15
  272. package/launch.mjs +363 -51
  273. package/package.json +9 -8
  274. package/pin-home.mjs +6 -0
  275. package/post-update-marker.mjs +14 -0
  276. package/preferences-file.mjs +289 -0
  277. 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) || personText(body);
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;
@@ -3488,10 +3502,16 @@
3488
3502
  body: JSON.stringify({ appId: app.id, inputName: name, ...(sourceName ? { sourceName } : {}), snapshots: files.map((f) => ({ name: f.name, dataUrl: f.dataUrl })) }),
3489
3503
  });
3490
3504
  if (r.status === 413) { showToast('those files are too large to queue together — attach fewer or smaller sheets', 'warn'); return; }
3491
- const out = await r.json().catch(() => ({ ok: false, error: `re-bake failed (${r.status})` }));
3492
- 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; }
3493
3513
  showToast(`Queued — your terminal AI will re-read ${n} drawing${n > 1 ? 's' : ''} and update this workflow, then ask you to approve.`, 'ok');
3494
- } 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'); }
3495
3515
  }
3496
3516
 
3497
3517
  // Per-app declared-input values, set via the input node's double-click dialog.
@@ -3941,10 +3961,16 @@
3941
3961
  headers: { 'content-type': 'application/json' },
3942
3962
  body: JSON.stringify({ appId: app.id, name: inp.name, dataUrl: v }),
3943
3963
  });
3944
- const up = await r.json().catch(() => ({ ok: false, error: `upload failed (${r.status})` }));
3945
- 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; }
3946
3972
  store[inp.name] = up.path;
3947
- } 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; }
3948
3974
  } else if (typeof v === 'string' && v) {
3949
3975
  store[inp.name] = v; // unchanged existing path
3950
3976
  } // cleared/empty → omit (no value)
@@ -4284,7 +4310,10 @@
4284
4310
  await ensureReportDiscoverySession();
4285
4311
  answer = await api(`/api/pages/${encodeURIComponent(home)}/${encodeURIComponent(id)}/versions/${encodeURIComponent(n)}/full-report`);
4286
4312
  } catch (error) {
4287
- 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');
4288
4317
  return false;
4289
4318
  }
4290
4319
  if (typeof answer?.handle !== 'string' || !answer.handle) {
@@ -4486,7 +4515,8 @@
4486
4515
  $reportOverlay.append(mkEl('div', 'spinner'), mkEl('div', null, 'Loading 3D view…'));
4487
4516
  } else {
4488
4517
  $reportFrame3d.hidden = true; $reportFrame3d.removeAttribute('src');
4489
- $reportFrame.hidden = false; $reportFrame.srcdoc = html;
4518
+ // #3130: the report's own content rules ride at its top; lastPaintedHtml keeps exactly what the run produced.
4519
+ $reportFrame.hidden = false; $reportFrame.srcdoc = window.FlolessReportCsp.withReportCsp(html);
4490
4520
  $reportOverlay.hidden = true; $reportOverlay.replaceChildren();
4491
4521
  $reportShare.hidden = false;
4492
4522
  }
@@ -4500,7 +4530,7 @@
4500
4530
  function paintReportWithFiles(html, entry) {
4501
4531
  $reportFrame3d.hidden = true; $reportFrame3d.removeAttribute('src');
4502
4532
  $reportFrame.hidden = false;
4503
- $reportFrame.srcdoc = html;
4533
+ $reportFrame.srcdoc = window.FlolessReportCsp.withReportCsp(html); // #3130
4504
4534
  $reportOverlay.hidden = true; $reportOverlay.replaceChildren();
4505
4535
  $reportOpen.hidden = true;
4506
4536
  $reportShare.hidden = true;
@@ -4574,6 +4604,9 @@
4574
4604
  // and the section speaks to that editor while it is open — the same tabs, by the same code, as the
4575
4605
  // workspace's Model step (web/model-panel-bridge.js).
4576
4606
  let contractEditorApp = null; // the workflow the editor was opened for: Approve bakes that one
4607
+ // What the overlay is showing, for Close's unsaved-work question (#3143): the name that question uses, and whether
4608
+ // the page is one whose unsaved edits Close must ask about through its save state (renderer `asksBeforeClose`).
4609
+ let overlaySurface = { name: 'the editor', asksBeforeClose: false };
4577
4610
  // The regions of #app the overlay covers. Covering them is not enough: Tab from the Close button or the left panel
4578
4611
  // would still reach the header, canvas and footer under it, and Enter there runs or compiles the workflow. Cards
4579
4612
  // drawn above the overlay (#fullscreen-nudge, #ix-ask-menu) are not covered, so they are not listed and stay usable.
@@ -4611,6 +4644,7 @@
4611
4644
  const r = window.CONTRACT_RENDERERS && window.CONTRACT_RENDERERS[type];
4612
4645
  if (!r) return false;
4613
4646
  contractEditorApp = appId;
4647
+ overlaySurface = { name: r.name || 'the editor', asksBeforeClose: !!r.asksBeforeClose };
4614
4648
  overlayModelPanel(!!r.modelPanel);
4615
4649
  coverShell(r.modelPanel ? OVERLAY_COVERS : FULL_WINDOW_COVERS);
4616
4650
  // The editor bakes the .lock on Approve — that control belongs to an editable contract editor, not
@@ -4636,6 +4670,7 @@
4636
4670
  function openLocalViewer(appId, type) {
4637
4671
  const r = window.CONTRACT_RENDERERS && window.CONTRACT_RENDERERS[type];
4638
4672
  if (!r || !r.viewerUrl) return false;
4673
+ overlaySurface = { name: 'the 3D view', asksBeforeClose: false };
4639
4674
  overlayModelPanel(false);
4640
4675
  coverShell(FULL_WINDOW_COVERS);
4641
4676
  const ap = document.getElementById('contract-editor-approve'); if (ap) ap.hidden = true;
@@ -4652,6 +4687,7 @@
4652
4687
  // steel-filter.html (layer/thickness/colour facets + eyedropper). Same seam as the editor: the
4653
4688
  // iframe talks to /api/contract directly and Save writes contract.filter.
4654
4689
  function openFilterView(appId) {
4690
+ overlaySurface = { name: 'the Drawing Filter', asksBeforeClose: false }; // it asks through its own __floGuard
4655
4691
  overlayModelPanel(false);
4656
4692
  coverShell(FULL_WINDOW_COVERS);
4657
4693
  // The filter view has its own Save; the overlay's "Approve & bake lock" (editor-only) would
@@ -4666,19 +4702,78 @@
4666
4702
  $contractEditor.hidden = false;
4667
4703
  return true;
4668
4704
  }
4705
+ // #3143: an editor that autosaves and keeps no copy of its own (the vector editor) exposes contractSaveState() and
4706
+ // flushContract() rather than a __floGuard. An unfinished write is finished first, quietly; whatever is still not
4707
+ // saved after that — a refused write (conflict), a failed one, one still running, or a state that cannot be read —
4708
+ // is asked about, because closing tears the page down and those edits with it. True = close, false = keep it open.
4709
+ const CLOSE_FLUSH_MS = 20000;
4710
+ async function savedOrLetGo(name) {
4711
+ let win = null;
4712
+ try { win = $contractEditorFrame.contentWindow; } catch (_) { win = null; }
4713
+ const read = () => {
4714
+ try { return win && typeof win.contractSaveState === 'function' ? win.contractSaveState() : 'clean'; }
4715
+ catch (_) { return 'unknown'; }
4716
+ };
4717
+ // The wait is capped, the save is not: a save still running at the cap keeps running, and waiting again waits
4718
+ // for THAT save rather than starting another one behind it.
4719
+ let pending = null;
4720
+ const flush = async () => {
4721
+ if (!win || typeof win.flushContract !== 'function') return;
4722
+ if (!pending) {
4723
+ pending = Promise.resolve().then(() => win.flushContract())
4724
+ .catch(() => { /* read() says what is left */ })
4725
+ .finally(() => { pending = null; });
4726
+ }
4727
+ let timer = null;
4728
+ try { await Promise.race([pending, new Promise((resolve) => { timer = setTimeout(resolve, CLOSE_FLUSH_MS); })]); }
4729
+ finally { clearTimeout(timer); }
4730
+ };
4731
+ let state = read();
4732
+ if (state === 'dirty' || state === 'saving') { await flush(); state = read(); }
4733
+ while (state !== 'clean') {
4734
+ const ask = state === 'conflict'
4735
+ ? [`Someone else saved this drawing while you had ${name} open, so your latest changes were not saved. If you close now, they are lost. To keep them, choose Keep editing, then click Save conflict at the top of the editor to pick which version to keep.`,
4736
+ { discard: 'Close without saving', cancel: 'Keep editing', hideSave: true, initialFocus: 'cancel' }]
4737
+ : state === 'unknown'
4738
+ ? [`FloLess couldn’t check whether your changes in ${name} are saved. If you close now, any that are not saved are lost.`,
4739
+ { discard: 'Close anyway', cancel: 'Keep editing', hideSave: true, initialFocus: 'cancel' }]
4740
+ : state === 'saving'
4741
+ ? [`FloLess is still saving your latest changes in ${name}. It is taking longer than usual. If you close now, the save may still finish, or your latest changes may be lost. Wait for the save, or keep editing.`,
4742
+ { confirm: 'Wait for the save', discard: 'Close anyway', cancel: 'Keep editing', initialFocus: 'cancel' }]
4743
+ : [`FloLess couldn’t save your latest changes in ${name}, so they are not saved yet. If you close now, they are lost. Try saving again, or keep editing.`,
4744
+ { confirm: 'Try saving again', discard: 'Close without saving', cancel: 'Keep editing', initialFocus: 'cancel' }];
4745
+ const choice = await confirmUnsavedSwitch('', ask[0], 'Your latest changes aren’t saved', ask[1]);
4746
+ if (choice === 'discard') return true;
4747
+ if (choice !== 'save') return false;
4748
+ state = read(); // the save may have landed while the question was up
4749
+ if (state !== 'clean') { await flush(); state = read(); }
4750
+ }
4751
+ return true;
4752
+ }
4753
+ // One close at a time, from Close and Esc alike (#3143): a second click while the first is still saving or asking
4754
+ // would otherwise run its own close and tear the editor down after the person chose Keep editing.
4755
+ let overlayClosing = false;
4669
4756
  async function closeContractEditor() {
4757
+ if (overlayClosing) return;
4758
+ overlayClosing = true;
4759
+ try { await closeContractEditorOnce(); } finally { overlayClosing = false; }
4760
+ }
4761
+ async function closeContractEditorOnce() {
4670
4762
  // A surface inside the iframe (the steel filter) can expose a same-origin dirty-guard so we show
4671
4763
  // OUR styled confirm modal instead of its native beforeunload "Leave site?" (#170). Cross-origin
4672
4764
  // (about:blank) access throws — treat that as "no guard".
4765
+ const surface = overlaySurface; // each opener sets a new one, so a different editor opened meanwhile is not closed
4766
+ const name = surface.name;
4673
4767
  let guard = null;
4674
4768
  try { guard = $contractEditorFrame.contentWindow && $contractEditorFrame.contentWindow.__floGuard; }
4675
4769
  catch (_) { guard = null; }
4676
4770
  if (guard && typeof guard.isDirty === 'function' && guard.isDirty()) {
4677
- const choice = await confirmUnsavedSwitch('', 'You have unsaved changes to the Drawing Filter. What would you like to do?', 'Unsaved Drawing Filter changes');
4771
+ const choice = await confirmUnsavedSwitch('', `You have unsaved changes in ${name}. What would you like to do?`, `Unsaved changes in ${name}`);
4678
4772
  if (choice === 'cancel') return; // keep the view open
4679
4773
  if (choice === 'save') { const ok = await guard.save(); if (!ok) return; } // save failed → stay open
4680
4774
  else if (choice === 'discard') { try { guard.discard(); } catch (_) {} } // silence the backstop
4681
- }
4775
+ } else if (surface.asksBeforeClose && !(await savedOrLetGo(name))) return; // keep the editor open
4776
+ if (overlaySurface !== surface) return; // the overlay shows something else now; that one closes on its own terms
4682
4777
  $contractEditor.hidden = true;
4683
4778
  overlayModelPanel(false); // the left Model section goes back to the workspace
4684
4779
  // Unhook the focus-on-load first: about:blank loading would otherwise pull focus into the now-hidden frame,
@@ -5240,17 +5335,19 @@
5240
5335
  if (!currentId) return;
5241
5336
  const verb = currentlyFrozen ? 'unfreeze' : 'freeze';
5242
5337
  try {
5243
- await api(`/api/app/${encodeURIComponent(currentId)}/${verb}`, { method: 'POST', body: JSON.stringify({ nodeId }) });
5338
+ const res = await api(`/api/app/${encodeURIComponent(currentId)}/${verb}`, { method: 'POST', body: JSON.stringify({ nodeId }) });
5244
5339
  await loadApp(currentId); // re-read → frozen badge/state repaints
5340
+ // #3132: the workflow had changes nobody approved, so the step changed but the approval did not — say that, not "done".
5341
+ if (res && res.approvalPending && typeof res.notice === 'string') { showToast(res.notice, 'warn'); return; }
5245
5342
  showToast(currentlyFrozen
5246
5343
  ? 'Node unfrozen — it will run normally.'
5247
5344
  : 'Output frozen — this node will replay its last result on the next run.',
5248
5345
  currentlyFrozen ? 'info' : 'ok');
5249
5346
  } catch (e) {
5250
- // Surface the real aware reason the route attached as body.reason — otherwise the friendly
5251
- // lead hides the actual cause. First non-empty line, capped, keeps the warn toast sane.
5347
+ // A reason the route marked diagnostic (AWARE's own output) is for the log and the AI, never
5348
+ // the toast (#3097); any other reason is shown, first non-empty line, capped.
5252
5349
  const lead = (e && e.message) || `Could not ${verb} this node.`;
5253
- const raw = e && e.body && typeof e.body.reason === 'string' ? e.body.reason.trim() : '';
5350
+ const raw = e && e.body && !e.body.diagnostic && typeof e.body.reason === 'string' ? e.body.reason.trim() : '';
5254
5351
  const reason = raw ? (raw.split('\n').find((l) => l.trim()) || '').trim().slice(0, 200) : '';
5255
5352
  showToast(reason ? `${lead} — ${reason}` : lead, 'warn');
5256
5353
  }
@@ -5670,6 +5767,7 @@
5670
5767
  $dont.textContent = (actionLabels && actionLabels.discard) || 'Don’t save';
5671
5768
  $cancel.textContent = (actionLabels && actionLabels.cancel) || 'Cancel';
5672
5769
  $dont.hidden = !!(actionLabels && actionLabels.hideDiscard);
5770
+ $save.hidden = !!(actionLabels && actionLabels.hideSave); // when there is nothing safe to save (a refused write)
5673
5771
  $title.textContent = titleMsg || 'Unsaved input changes'; // reset each call (default = the inputs-switch copy)
5674
5772
  $sub.textContent = subMsg || `You changed the inputs for “${appName}” but haven’t saved them yet. What would you like to do?`;
5675
5773
  showModal($confirmModal);
@@ -5687,6 +5785,7 @@
5687
5785
  else modal.setAttribute('aria-hidden', ariaHidden);
5688
5786
  });
5689
5787
  $dont.hidden = false;
5788
+ $save.hidden = false;
5690
5789
  document.removeEventListener('keydown', onKey, true);
5691
5790
  $save.onclick = $dont.onclick = $cancel.onclick = $confirmModal.onclick = null;
5692
5791
  if (returnFocus && returnFocus.isConnected && !returnFocus.matches(':disabled,[aria-disabled="true"]')) returnFocus.focus();
@@ -6608,7 +6707,7 @@
6608
6707
  try {
6609
6708
  await api(endpoint, { method: 'POST', body: JSON.stringify({ path: currentSavedPath }) });
6610
6709
  } catch (e) {
6611
- const detail = e && e.body && e.body.error;
6710
+ const detail = personText(e && e.body);
6612
6711
  showToast(detail ? `${failMsg} — ${detail}` : failMsg, 'warn');
6613
6712
  }
6614
6713
  }
@@ -6706,10 +6805,11 @@
6706
6805
  $reportOpen.onclick = () => {
6707
6806
  const html = lastPaintedHtml || $reportFrame.srcdoc;
6708
6807
  if (!html) return;
6709
- // Open via a blob: URL — an opaque origin, so the report can't script the
6710
- // app origin (mirrors the iframe's sandbox intent).
6711
- const url = URL.createObjectURL(new Blob([html], { type: 'text/html' }));
6712
- window.open(url, '_blank');
6808
+ // #3130: a blob: URL has THIS page's origin, so the report is never the blob itself — it would run as FloLess. The blob
6809
+ // is a script-free page holding the report in a sandboxed, opaque-origin frame (web/report-csp.js).
6810
+ const doc = window.FlolessReportCsp.openDocument(html, lastPaintedInteractive, apps.get(currentId)?.displayName);
6811
+ const url = URL.createObjectURL(new Blob([doc], { type: 'text/html' }));
6812
+ window.open(url, '_blank', 'noopener');
6713
6813
  setTimeout(() => URL.revokeObjectURL(url), 30000);
6714
6814
  };
6715
6815
 
@@ -7007,6 +7107,7 @@
7007
7107
  document.getElementById('bake-cancel').onclick = () => hideModal($bakeModal);
7008
7108
  document.getElementById('bake-confirm').onclick = () => runBake();
7009
7109
  onBackdropDismiss($bakeModal, () => hideModal($bakeModal), () => !document.getElementById('bake-confirm').disabled);
7110
+ onEscapeDismiss($bakeModal, () => hideModal($bakeModal), () => !document.getElementById('bake-cancel').disabled);
7010
7111
 
7011
7112
  // ── Graft into agent ────────────────────────────────────────────────────────
7012
7113
  // Build an agent from a foreign tool (DLL / C# source / NuGet / OpenAPI / …).
@@ -8537,6 +8638,13 @@
8537
8638
  // The apply body, extracted so the popover's "Update now" can drive it with the
8538
8639
  // polled target version (no textContent scrape). Preserves the npm-vs-desktop
8539
8640
  // branch verbatim: npm copies the command; desktop confirms → relaunch.
8641
+ // The server waits for a person to answer the FloLess window's close guard (up to 10 minutes after a 5 s acknowledgement),
8642
+ // so the tab must wait longer than that or it would call a slow answer a failure.
8643
+ const APP_UPDATE_APPLY_TIMEOUT_MS = 11 * 60 * 1000;
8644
+ // The server answers 409 { paused | alreadyUpdating, error } when an update did not start on purpose.
8645
+ function appUpdateNotice(body) {
8646
+ return body && (body.paused || body.alreadyUpdating) && typeof body.error === 'string' && body.error ? body.error : null;
8647
+ }
8540
8648
  async function applyAppUpdate(version) {
8541
8649
  if (!$appUpdate) return;
8542
8650
  // ONLY the desktop (Velopack) build can self-apply — it is the one with Update.exe. Everything
@@ -8577,8 +8685,19 @@
8577
8685
  $appUpdate.disabled = true;
8578
8686
  $appUpdate.textContent = '↑ Updating…';
8579
8687
  try {
8580
- const r = await fetch('/api/update/apply', { method: 'POST', headers: { 'content-type': 'application/json' }, signal: AbortSignal.timeout(5 * 60 * 1000) });
8688
+ const r = await fetch('/api/update/apply', { method: 'POST', headers: { 'content-type': 'application/json' }, signal: AbortSignal.timeout(APP_UPDATE_APPLY_TIMEOUT_MS) });
8581
8689
  const d = await r.json().catch(() => ({}));
8690
+ // The update did not start, on purpose: the person kept the FloLess window open, or one is already getting ready.
8691
+ // That is news, not a failure: say what the server said and put the pill back.
8692
+ const notice = appUpdateNotice(d);
8693
+ if (notice) {
8694
+ $appUpdate.disabled = false;
8695
+ _updateApplying = null;
8696
+ try { localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ }
8697
+ showToast(notice, 'info');
8698
+ refreshUpdate();
8699
+ return;
8700
+ }
8582
8701
  if (!r.ok || !d.ok) throw new Error(d.error || 'update failed');
8583
8702
  // Success: the server is exiting + Update.exe relaunches the new build. The health
8584
8703
  // poll flips to offline (R1 overlay), then the new version reconnects on its own.
@@ -8671,15 +8790,37 @@
8671
8790
  el.hidden = true;
8672
8791
  }
8673
8792
  }
8674
- async function refreshWorkflowUpdates() {
8793
+ /**
8794
+ * Read the offers again. The one source for both update dialogs and the footer count (#3081), so they never disagree.
8795
+ * Answers the list read, or null when the read failed: a failed read keeps the last list on screen, because a dropped
8796
+ * request is not "nothing to update". A read sent earlier that answers after a later one is not applied, and answers
8797
+ * with the later read instead, so every caller ends on the same list.
8798
+ */
8799
+ let _wfUpdatesTicket = 0;
8800
+ let _wfUpdatesLatest = null; // the newest call; a call overtaken by it answers with it, which follows any later one in turn
8801
+ function refreshWorkflowUpdates() {
8802
+ const ticket = ++_wfUpdatesTicket;
8803
+ const call = (async () => {
8804
+ const list = await readWorkflowUpdates();
8805
+ if (ticket !== _wfUpdatesTicket) return _wfUpdatesLatest;
8806
+ if (list) _wfUpdates = list;
8807
+ renderWfUpdatePill();
8808
+ wfRowsChanged();
8809
+ return list;
8810
+ })();
8811
+ _wfUpdatesLatest = call;
8812
+ return call;
8813
+ }
8814
+ /** One read of the offers: the list, or null when it could not be read (the reason is logged). */
8815
+ async function readWorkflowUpdates() {
8675
8816
  try {
8676
8817
  await globalThis.flolessStartupAdmission?.admit('/api/workflows/updates');
8677
8818
  const r = await fetch('/api/workflows/updates');
8678
8819
  const d = await r.json();
8679
- _wfUpdates = (r.ok && d.ok && Array.isArray(d.updates)) ? d.updates : [];
8680
- } catch { _wfUpdates = []; }
8681
- renderWfUpdatePill();
8682
- wfRowsChanged();
8820
+ if (r.ok && d.ok && Array.isArray(d.updates)) return d.updates;
8821
+ console.warn('workflow updates read failed', { status: r.status, error: d && d.error });
8822
+ } catch (e) { console.warn('workflow updates read failed', e); }
8823
+ return null;
8683
8824
  }
8684
8825
 
8685
8826
  // ── One-click workflow update (owner ruling 2026-11-02) ──────────────────────────────────────────────────────────
@@ -8706,6 +8847,24 @@
8706
8847
  const a = apps.get(id);
8707
8848
  return (a && a.displayName) || _wfUpdates.find((u) => u.id === id)?.displayName || _wfRowState.get(id)?.offer?.displayName || id;
8708
8849
  }
8850
+ /**
8851
+ * #3081: what tells apart update rows that share a name (three copies of Steel Model, say): the project the workflow
8852
+ * 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
8853
+ * rows read as before. Copies are never merged because their names match.
8854
+ */
8855
+ function wfUpdateContext(id) {
8856
+ const name = wfDisplayName(id);
8857
+ const twins = wfUpdateRowsForDialog().filter((o) => o.id !== id && wfDisplayName(o.id) === name).map((o) => o.id);
8858
+ if (!twins.length) return null;
8859
+ const project = (x) => wfLibrary.find((a) => a.id === x)?.ownerLabel || '';
8860
+ const mine = project(id);
8861
+ return mine && !twins.some((x) => project(x) === mine) ? { kind: 'project', text: mine } : { kind: 'id', text: id };
8862
+ }
8863
+ /** The name a person reads, and hears, for one update row: with what tells it apart when another row has the same name. */
8864
+ function wfUpdateLabel(id) {
8865
+ const ctx = wfUpdateContext(id);
8866
+ return !ctx ? wfDisplayName(id) : ctx.kind === 'project' ? `${wfDisplayName(id)} in ${ctx.text}` : `${wfDisplayName(id)} (${ctx.text})`;
8867
+ }
8709
8868
  function wfWhatsNew(u) {
8710
8869
  if (u.sourceUpdate?.explanation) return u.sourceUpdate.explanation;
8711
8870
  const first = Array.isArray(u.changelog) ? u.changelog.find((e) => e && e.summary) : null;
@@ -8724,6 +8883,12 @@
8724
8883
  function wfUpdateAllTargets() {
8725
8884
  return _wfUpdates.filter((u) => !u.hasChanges && !wfNeedsReview(u) && !['busy', 'undoing', 'done'].includes(_wfRowState.get(u.id)?.state));
8726
8885
  }
8886
+ /** #3081: the offers still waiting, split into what a click applies and what is reviewed in AI Chat. Updated rows are not counted. */
8887
+ function wfUpdatesWaiting() {
8888
+ const open = _wfUpdates.filter((u) => _wfRowState.get(u.id)?.state !== 'done');
8889
+ const review = open.filter(wfNeedsReview).length;
8890
+ return { apply: open.length - review, review };
8891
+ }
8727
8892
  function wfRowsChanged() {
8728
8893
  if (_wfModalOffer) paintWfUpdateModal();
8729
8894
  globalThis.dispatchEvent?.(new CustomEvent('floless:workflow-update-rows'));
@@ -8745,7 +8910,7 @@
8745
8910
  async function runWfUpdate(u, opts = {}) {
8746
8911
  const prior = _wfRowState.get(u.id);
8747
8912
  if (prior && (prior.state === 'busy' || prior.state === 'undoing')) return false;
8748
- _wfRowState.set(u.id, { state: 'busy', offer: u });
8913
+ _wfRowState.set(u.id, { state: 'busy', offer: u, since: Date.now() });
8749
8914
  wfRowsChanged();
8750
8915
  try {
8751
8916
  const r = await fetch(`/api/workflows/${encodeURIComponent(u.id)}/update`, { method: 'POST', headers: { 'content-type': 'application/json' },
@@ -8754,9 +8919,9 @@
8754
8919
  if (!r.ok || !d.ok) throw Object.assign(new Error(d.error || ''), { code: d.code });
8755
8920
  _wfRowState.set(u.id, { state: 'done', offer: u, toVersion: d.toVersion, backupPath: d.backupPath, sourceHash: d.sourceHash });
8756
8921
  wfRowsChanged();
8757
- document.getElementById('wf-update-announce')?.replaceChildren(`Updated ${wfDisplayName(u.id)} to ${d.toVersion}.`);
8922
+ document.getElementById('wf-update-announce')?.replaceChildren(`Updated ${wfUpdateLabel(u.id)} to ${d.toVersion}.`);
8758
8923
  if (!opts.quiet) {
8759
- const text = `Updated “${wfDisplayName(u.id)}” to ${d.toVersion}. It’s ready to run.`;
8924
+ const text = `Updated “${wfUpdateLabel(u.id)}” to ${d.toVersion}. It’s ready to run.`;
8760
8925
  if (d.backupPath) {
8761
8926
  // The Undo stays a full minute (closable sooner), as after a Restore.
8762
8927
  const closeUndo = showToast(text, 'ok', { persistent: true,
@@ -8818,7 +8983,7 @@
8818
8983
  : opts.recovery ? wfRecoveryOf(id) : s;
8819
8984
  if (!handle || !handle.backupPath || s.state === 'undoing' || s.state === 'busy') return;
8820
8985
  const putBack = (patch = {}) => { _wfRowState.set(id, { ...s, ...patch }); if (s.state === 'idle' && !Object.keys(patch).length) _wfRowState.delete(id); };
8821
- _wfRowState.set(id, { ...s, state: 'undoing' });
8986
+ _wfRowState.set(id, { ...s, state: 'undoing', since: Date.now() });
8822
8987
  wfRowsChanged();
8823
8988
  try {
8824
8989
  const r = await fetch(`/api/workflows/${encodeURIComponent(id)}/undo-update`, { method: 'POST', headers: { 'content-type': 'application/json' },
@@ -8830,7 +8995,9 @@
8830
8995
  const later = d.replacedLater && d.backupPath ? { backupPath: d.backupPath, sourceHash: d.sourceHash } : null;
8831
8996
  if (later) wfRecoverySet(id, later.backupPath, later);
8832
8997
  _wfRowState.set(id, { state: 'undone', offer: s.offer, version: d.version });
8833
- const text = `Put “${wfDisplayName(id)}” back to ${d.version}.`
8998
+ // Paint it now: the refresh below may fail, and the dialog must not keep Not now waiting on a finished Undo (#3147).
8999
+ wfRowsChanged();
9000
+ const text = `Put “${wfUpdateLabel(id)}” back to ${d.version}.`
8834
9001
  + (d.replacedLater ? ' The changes made after the update are in a backup.' : '')
8835
9002
  + (d.knowledgePinNotRestored ? ' Its pinned knowledge was not brought back: pin it again in Knowledge if it needs it.' : '');
8836
9003
  if (later) {
@@ -8890,7 +9057,9 @@
8890
9057
  b.className = 'tool-updates-open' + (cls ? ' ' + cls : '');
8891
9058
  b.textContent = label;
8892
9059
  b.setAttribute('data-command-id', commandId + '#' + instance);
8893
- b.setAttribute('data-command-instance-label', wfDisplayName(instance));
9060
+ b.setAttribute('data-command-instance-label', wfUpdateLabel(instance));
9061
+ // Rows that share a name have buttons that read the same: say which workflow each one acts on (#3081).
9062
+ if (wfUpdateContext(instance)) b.setAttribute('aria-label', `${label}: ${wfUpdateLabel(instance)}`);
8894
9063
  b.addEventListener('click', onClick);
8895
9064
  return b;
8896
9065
  }
@@ -8909,6 +9078,16 @@
8909
9078
  const name = document.createElement('span');
8910
9079
  name.className = 'tool-updates-needs-name';
8911
9080
  name.append(wfDisplayName(u.id) + ' ');
9081
+ const ctx = wfUpdateContext(u.id);
9082
+ if (ctx) {
9083
+ const where = document.createElement('span');
9084
+ where.className = 'wf-upd-ctx';
9085
+ where.setAttribute('data-context-kind', ctx.kind);
9086
+ where.textContent = ctx.kind === 'project' ? `in ${ctx.text}` : ctx.text;
9087
+ where.setAttribute('data-tip', ctx.kind === 'project' ? `The project this copy of ${wfDisplayName(u.id)} belongs to.`
9088
+ : `This copy’s workflow id. It tells it apart from the other workflows named ${wfDisplayName(u.id)}.`);
9089
+ name.append(where, ' ');
9090
+ }
8912
9091
  const ver = document.createElement('span');
8913
9092
  ver.className = 'wf-upd-ver';
8914
9093
  ver.textContent = s.state === 'done' ? `now ${s.toVersion}` : s.state === 'undone' ? `back to ${s.version}` : `${u.installed} → ${u.available}`;
@@ -8918,8 +9097,11 @@
8918
9097
  const line = document.createElement('span');
8919
9098
  line.className = 'tool-updates-needs-sentence';
8920
9099
  const changed = wfRowChanged(s, u);
8921
- if (s.state === 'busy') line.textContent = 'Updating… a backup is saved first.';
8922
- else if (s.state === 'undoing') line.textContent = 'Putting your previous version back…';
9100
+ // In the header dialog the row also says why Not now waits, or that it no longer has to (#3147).
9101
+ const waits = !opts.textOnly ? '' : wfWaitedLong(s) ? ' This is taking longer than usual. You can close this; it still finishes.'
9102
+ : ' You can close this when it finishes.';
9103
+ if (s.state === 'busy') line.textContent = 'Updating… a backup is saved first.' + waits;
9104
+ else if (s.state === 'undoing') line.textContent = 'Putting your previous version back…' + waits;
8923
9105
  else if (s.state === 'done') line.textContent = s.laterChanges ? WF_LATER_CHANGES : 'Updated and ready to run. Your previous version is saved.';
8924
9106
  else if (recovery?.laterChanges) line.textContent = WF_LATER_CHANGES;
8925
9107
  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.';
@@ -8972,10 +9154,13 @@
8972
9154
  function paintWfUpdateModal() {
8973
9155
  const u = _wfModalOffer;
8974
9156
  if (!u || !$wfUpdateModal) return;
8975
- const name = wfDisplayName(u.id);
9157
+ const name = wfUpdateLabel(u.id);
8976
9158
  const s = _wfRowState.get(u.id) || { state: 'idle' };
8977
9159
  document.getElementById('wf-update-title').textContent = `Update “${name}”`;
8978
- document.getElementById('wf-update-sub').textContent = `${u.installed} → ${u.available}. Your saved data is kept, and a backup is saved first so you can undo.`;
9160
+ // A Steel Model is reviewed in AI Chat, not updated here: this dialog must not promise a backup and Undo it never makes.
9161
+ document.getElementById('wf-update-sub').textContent = wfNeedsReview(u)
9162
+ ? `${u.installed} → ${u.available}. You review this one in AI Chat, and nothing changes until you send the request there.`
9163
+ : `${u.installed} → ${u.available}. Your saved data is kept, and a backup is saved first so you can undo.`;
8979
9164
  const changelog = Array.isArray(u.changelog) ? u.changelog : [];
8980
9165
  document.getElementById('wf-update-changelog').innerHTML = changelog.map((e) => {
8981
9166
  const changes = Array.isArray(e.changes) && e.changes.length
@@ -9002,12 +9187,36 @@
9002
9187
  : (s.state === 'done' ? (s.laterChanges ? 'shell.workflow-update-undo-anyway' : 'shell.workflow-update-undo')
9003
9188
  : review ? 'shell.workflow-update-keep-mine' : 'shell.workflow-update-apply') + '#' + u.id);
9004
9189
  ok.setAttribute('data-command-instance-label', name);
9190
+ // Same-named copies: the button says which workflow it acts on, as the row buttons do (#3081).
9191
+ if (wfUpdateContext(u.id)) ok.setAttribute('aria-label', `${ok.textContent}: ${name}`); else ok.removeAttribute('aria-label');
9005
9192
  }
9006
9193
  if (cancel) {
9007
9194
  cancel.textContent = s.state === 'done' ? 'Close' : 'Not now';
9008
9195
  cancel.hidden = s.state === 'undone'; // Done is the only thing left to do
9196
+ // #3147: closing mid-update would hide work still running, then a toast and a reload would land from nowhere.
9197
+ cancel.disabled = wfModalWorking();
9198
+ if (cancel.disabled) cancel.setAttribute('data-blocked-reason', s.state === 'busy' ? 'Still updating. You can close this when it finishes.'
9199
+ : 'Still putting your previous version back. You can close this when it finishes.');
9200
+ else cancel.removeAttribute('data-blocked-reason');
9201
+ // A run that never answers must not hold the dialog open: repaint when the wait is up, and Not now comes back.
9202
+ clearTimeout(_wfModalWaitTimer);
9203
+ if (cancel.disabled) {
9204
+ _wfModalWaitTimer = setTimeout(paintWfUpdateModal, WF_MODAL_WAIT_MS - (Date.now() - s.since) + 50);
9205
+ _wfModalWaitTimer?.unref?.();
9206
+ }
9009
9207
  }
9010
9208
  }
9209
+ const WF_MODAL_WAIT_MS = 30000;
9210
+ let _wfModalWaitTimer = null;
9211
+ /** An update or Undo still running after the wait: the dialog may close, and says the work goes on (#3147). */
9212
+ function wfWaitedLong(s) {
9213
+ return (s.state === 'busy' || s.state === 'undoing') && Date.now() - (s.since || 0) >= WF_MODAL_WAIT_MS;
9214
+ }
9215
+ /** The dialog's update or Undo is running: Not now, Escape and the backdrop wait for it, up to the wait (#3147). */
9216
+ function wfModalWorking() {
9217
+ const s = _wfModalOffer && _wfRowState.get(_wfModalOffer.id);
9218
+ return !!s && (s.state === 'busy' || s.state === 'undoing') && !wfWaitedLong(s);
9219
+ }
9011
9220
  function openWfUpdateModal(u) {
9012
9221
  if (!$wfUpdateModal) return;
9013
9222
  // Confirm exactly the offer displayed here, even if background polling replaces the live list.
@@ -9038,7 +9247,10 @@
9038
9247
  const $cancel = document.getElementById('wf-update-cancel'); if ($cancel) $cancel.onclick = dismissWfUpdateModal;
9039
9248
  const $ok = document.getElementById('wf-update-ok'); if ($ok) $ok.onclick = onWfUpdateOk;
9040
9249
  const $ai = document.getElementById('wf-update-ai'); if ($ai) $ai.onclick = () => { if (_wfModalOffer) openKeepMyChanges(_wfModalOffer); };
9041
- if ($wfUpdateModal) onBackdropDismiss($wfUpdateModal, dismissWfUpdateModal);
9250
+ if ($wfUpdateModal) {
9251
+ onBackdropDismiss($wfUpdateModal, dismissWfUpdateModal, () => !wfModalWorking());
9252
+ onEscapeDismiss($wfUpdateModal, dismissWfUpdateModal, () => !wfModalWorking());
9253
+ }
9042
9254
  }
9043
9255
 
9044
9256
  // The poll deliberately does NOT start here. Module init runs before the boot sequence, so the
@@ -9876,11 +10088,17 @@
9876
10088
  // compare has a real value). Reveals once: if a pending self-update version was
9877
10089
  // recorded before the relaunch AND the now-running build matches it AND the user
9878
10090
  // hasn't already dismissed that version, fetch its notes and show the panel.
9879
- function maybeShowWhatsNew() {
9880
- if (whatsNewShown) return;
10091
+ let whatsNewChecking = false;
10092
+ async function maybeShowWhatsNew() {
10093
+ if (whatsNewShown || whatsNewChecking) return;
9881
10094
  let pending, seen;
9882
- try { pending = localStorage.getItem('floless.whatsNew.pending'); seen = localStorage.getItem('floless.whatsNew.seen'); } catch { return; }
10095
+ try { pending = localStorage.getItem('floless.whatsNew.pending'); } catch { return; }
9883
10096
  if (!pending) return;
10097
+ // "Seen" is shared with the other FloLess client (#2963), so wait for the server's answer (bounded; the browser's own copy otherwise).
10098
+ whatsNewChecking = true;
10099
+ try { await window.flolessPrefs?.ready(); } finally { whatsNewChecking = false; }
10100
+ if (whatsNewShown) return;
10101
+ try { seen = window.flolessPrefs ? window.flolessPrefs.get('whatsNewSeen') : localStorage.getItem('floless.whatsNew.seen'); } catch { return; }
9884
10102
  const appVer = (document.getElementById('app-version')?.textContent || '').replace(/[^0-9.]/g, '');
9885
10103
  if (appVer !== pending || seen === pending) { try { localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ } return; }
9886
10104
 
@@ -9913,7 +10131,10 @@
9913
10131
  // Dismiss — no confirm; persist the seen version so it never re-reveals.
9914
10132
  if ($dismiss) {
9915
10133
  $dismiss.onclick = () => {
9916
- try { localStorage.setItem('floless.whatsNew.seen', pending); localStorage.removeItem('floless.whatsNew.pending'); } catch { /* private mode */ }
10134
+ try {
10135
+ if (window.flolessPrefs) window.flolessPrefs.set('whatsNewSeen', pending); else localStorage.setItem('floless.whatsNew.seen', pending);
10136
+ localStorage.removeItem('floless.whatsNew.pending');
10137
+ } catch { /* private mode */ }
9917
10138
  panel.hidden = true;
9918
10139
  document.getElementById('app')?.classList.remove('has-whats-new');
9919
10140
  };
@@ -10225,7 +10446,7 @@
10225
10446
  `<div class="so-card" role="status" tabindex="-1">
10226
10447
  <div class="so-spinner" aria-hidden="true"></div>
10227
10448
  <h1>Reconnecting to FloLess…</h1>
10228
- <p>FloLess isn’t responding. This tab will keep trying to reconnect.</p>
10449
+ <p>FloLess isn’t responding. ${document.documentElement.classList.contains('desktop') ? 'FloLess' : 'This tab'} will keep trying to reconnect.</p>
10229
10450
  <p class="so-status" id="so-status"></p>
10230
10451
  <div class="so-actions">
10231
10452
  <button type="button" id="so-refresh" data-command-id="app.reconnect-refresh" class="secondary" hidden>Refresh page</button>
@@ -10491,7 +10712,7 @@
10491
10712
  if (view === 'node-recheck-failed') {
10492
10713
  h1.textContent = 'Node.js is installed';
10493
10714
  body.textContent = "FloLess couldn't carry on setting up AWARE by itself. Choose Try again to continue.";
10494
- if (job.recheckError) remediation.textContent = job.recheckError;
10715
+ // #3097: the server's reason (job.detail) is diagnosis only; this card's sentence already says what to do.
10495
10716
  retry.hidden = false;
10496
10717
  return { spinner: false };
10497
10718
  }
@@ -10518,7 +10739,7 @@
10518
10739
  h1.textContent = "Node.js didn't install";
10519
10740
  body.textContent = (job && job.error) || 'The install stopped before Node.js was installed.';
10520
10741
  offer.textContent = 'Try the install again';
10521
- if (job && job.lastLine && job.lastLine !== job.error) remediation.textContent = job.lastLine;
10742
+ // #3097: never the installer's last output line or exit code; those stay in job.detail for diagnosis.
10522
10743
  } else {
10523
10744
  h1.textContent = 'Node.js is needed';
10524
10745
  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.";
@@ -10569,10 +10790,11 @@
10569
10790
  }
10570
10791
  } catch (err) {
10571
10792
  console.warn('node install did not start', err);
10572
- // The server answered (err.status) with its own reason, or it did not answer at all.
10573
- statusText = err && err.status
10574
- ? `Couldn't start the install: ${err.message}`
10575
- : "Couldn't start the install — FloLess's server didn't answer. Try again in a moment.";
10793
+ // #3097: the server's own reason when it gave one (api() marks it); otherwise the shared sentence. A start is a
10794
+ // change, so an unexplained failure asks the person to check before starting it again.
10795
+ statusText = err && err.serverText
10796
+ ? `Couldn’t start the install. ${err.message}`
10797
+ : failureCopy(err, { action: 'start the install', unsure: 'If Windows asks for permission in a moment, allow it; if nothing happens, choose Install again.' }).text;
10576
10798
  } finally {
10577
10799
  nodeInstall.startInFlight = false;
10578
10800
  rerenderBootstrap();
@@ -10589,7 +10811,8 @@
10589
10811
  const next = isLine ? { epoch: rest.epoch, id: rest.id, rev: rest.rev, status: rest.status, method: rest.method, lastLine: line } : rest;
10590
10812
  if (!adoptNodeJob(next)) return;
10591
10813
  if (rest.status === 'succeeded') nodeInstall.recheckSeen = false;
10592
- if (isLine) setBootstrapLogLine(line);
10814
+ // #3097: the installer's own output (winget, msiexec) is not shown; the running card's sentence and spinner say
10815
+ // it is working. The line is kept on the job for diagnosis only.
10593
10816
  rerenderBootstrap();
10594
10817
  }
10595
10818
 
@@ -10650,8 +10873,8 @@
10650
10873
  // job, so a missed "finished" event cannot leave the card spinning forever.
10651
10874
  if (nodeView === 'node-running' || nodeView === 'node-checking' || nodeView === 'node-unknown') refreshNodeInstallJob();
10652
10875
  spin = paintNodeInstallView(nodeView, els).spinner;
10653
- if (nodeView !== 'node-running' && log) log.textContent = '';
10654
- if (nodeView === 'node-running' && nodeInstall.job && nodeInstall.job.lastLine && log && !log.textContent) log.textContent = nodeInstall.job.lastLine;
10876
+ // #3097: no installer output on the Node.js card in any view (the ticker belongs to the AWARE install).
10877
+ if (log) log.textContent = '';
10655
10878
  } else if (status === 'failed') {
10656
10879
  // No spinner on failure — absence of motion is the signal (no error icon).
10657
10880
  spin = false;
@@ -11047,7 +11270,9 @@
11047
11270
  document.getElementById('app')?.removeAttribute('inert');
11048
11271
  }
11049
11272
  if (!licensed) {
11050
- renderGate(status || { state: 'unlicensed' });
11273
+ // #3134: Core opens on the chosen account's signed subscription, so a sign-in with several accounts chooses first.
11274
+ if (status?.reason === 'account-selection-required') renderAccountGate(status.accounts);
11275
+ else renderGate(status || { state: 'unlicensed' });
11051
11276
  return false;
11052
11277
  }
11053
11278
  return true;
@@ -11515,6 +11740,10 @@
11515
11740
  if (access?.reason === 'session-expired') return 'Your FloLess sign-in has expired. Sign in again, then try again.';
11516
11741
  if (access?.reason === 'signed-out') return 'You are signed out of FloLess. Sign in again, then try again.';
11517
11742
  if (access?.reason === 'seat-taken') return 'Your FloLess session has ended. Sign in again, then try again.';
11743
+ // #3134: three reasons that signing in does not fix.
11744
+ if (access?.reason === 'account-selection-required') return 'Your sign-in belongs to more than one FloLess account. Reload FloLess and choose the account to use, then try again.';
11745
+ if (access?.reason === 'core-unavailable') return 'FloLess couldn’t reach floless.io to confirm your subscription. Check your internet connection, then try again.';
11746
+ if (access?.reason === 'update-required') return 'floless.io no longer accepts this version of FloLess. Install the latest FloLess, then try again.';
11518
11747
  return 'Sign in to FloLess to check your account access, then try again.';
11519
11748
  }
11520
11749
 
@@ -14331,7 +14560,9 @@
14331
14560
  try {
14332
14561
  await api(`/api/requests/${encodeURIComponent(id)}/restore`, { method: 'POST', body: '{}' });
14333
14562
  } catch (error) {
14334
- showToast(error?.body?.error || 'FloLess couldn’t restore that request. It is still in Done; try again.', 'warn');
14563
+ showToast(personText(error?.body) || (error?.body?.diagnostic
14564
+ ? 'FloLess couldn’t tell whether that request was restored. Check Requests before trying again.'
14565
+ : 'FloLess couldn’t restore that request. It is still in Done; try again.'), 'warn');
14335
14566
  return false;
14336
14567
  }
14337
14568
  await loadRequests().catch(() => {});
@@ -14354,7 +14585,9 @@
14354
14585
  const body = error?.body;
14355
14586
  if (body?.code === 'request-held' && body.hold) return askDismissHeld(r, body.hold);
14356
14587
  if (body?.code === 'request-already-set-aside' || error?.status === 404) { await loadRequests().catch(() => {}); renderRequests(); return 'gone'; }
14357
- showToast(body?.error || 'FloLess couldn’t set that request aside. It is still in Requests; try again.', 'warn');
14588
+ showToast(personText(body) || (body?.diagnostic
14589
+ ? 'FloLess couldn’t tell whether that request was set aside. Check Requests before trying again.'
14590
+ : 'FloLess couldn’t set that request aside. It is still in Requests; try again.'), 'warn');
14358
14591
  return 'error';
14359
14592
  }
14360
14593
  return afterDismissed(r);
@@ -14485,7 +14718,11 @@
14485
14718
  if (result.failed > 0) {
14486
14719
  showToast(`${result.restored ? `${put} ` : ''}${result.failed} couldn’t be put back, so ${result.failed === 1 ? 'it is' : 'they are'} still in Done. Press Undo again to retry.`, 'warn');
14487
14720
  } else showToast(put, 'ok');
14488
- } catch (error) { showToast(error?.body?.error || 'FloLess couldn’t undo that. The requests are still in Done.', 'warn'); }
14721
+ } catch (error) {
14722
+ showToast(personText(error?.body) || (error?.body?.diagnostic
14723
+ ? 'FloLess couldn’t tell whether the requests were put back. Check Requests before pressing Undo again.'
14724
+ : 'FloLess couldn’t undo that. The requests are still in Done.'), 'warn');
14725
+ }
14489
14726
  await loadRequests().catch(() => {}); renderRequests();
14490
14727
  };
14491
14728
  const close = document.createElement('button');
@@ -15371,7 +15608,13 @@
15371
15608
  box.querySelectorAll('.cmd-save').forEach((btn) => {
15372
15609
  btn.onclick = () => saveAgentCommandTemplate(btn.dataset.agent, btn.dataset.cmd);
15373
15610
  });
15374
- } catch (e) { box.innerHTML = `<div class="cmd-desc">error: ${escapeHtml(e.message)}</div>`; }
15611
+ } catch (e) {
15612
+ // #3097: the server's reason when it gave one (api() marks it), else the shared sentence for this read; never
15613
+ // "error: " plus the browser's exception text. The error itself goes to the console.
15614
+ console.warn('agent commands unavailable', id, e);
15615
+ const said = e && e.serverText ? e.message : failureCopy(e, { action: 'load this agent’s commands', retrySafe: true }).text;
15616
+ box.innerHTML = `<div class="cmd-desc">${escapeHtml(said)}</div>`;
15617
+ }
15375
15618
  }
15376
15619
 
15377
15620
  async function saveAgentCommandTemplate(agent, command) {
@@ -16059,6 +16302,10 @@
16059
16302
  if (!why && slot.unavailableCode === 'scope-missing' && integration.id === 'google-workspace') {
16060
16303
  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.`;
16061
16304
  }
16305
+ // #2466: a sign-in from before FloLess asked for the chat reads holds identity only.
16306
+ if (!why && slot.unavailableCode === 'scope-missing' && integration.id === 'microsoft-365') {
16307
+ 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.`;
16308
+ }
16062
16309
  if (!why) {
16063
16310
  // A server reason is shown only when it is ordinary language; internal wording gets the plain fallback.
16064
16311
  const raw = slot.unavailableReason || '';
@@ -16194,6 +16441,12 @@
16194
16441
  // Disconnect when its row asks for one.
16195
16442
  const reconnect = google ? google.reconnect
16196
16443
  : i.id === MICROSOFT_INTEGRATION_ID && i.status === 'connected' ? reconnectButtonHtml(i) : '';
16444
+ // #2466: what a Microsoft sign-in asks for, said before the person clicks (FLOLESS_M365_SCOPES, server/oauth-presets.ts).
16445
+ const microsoftHelp = i.id === MICROSOFT_INTEGRATION_ID
16446
+ ? '<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, '
16447
+ + 'Excel workbooks, Outlook mail, Planner and Teams chats. It only reads. Excel’s permission also allows changes '
16448
+ + '(Microsoft has no read-only one), but FloLess never edits a file.</div>'
16449
+ : '';
16197
16450
  return `
16198
16451
  <div class="int-item int-${i.status}" data-integration-id="${escapeAttr(i.id)}" tabindex="-1">
16199
16452
  <div class="int-icon" aria-hidden="true">${escapeHtml(VENDOR_ICON[i.vendor] || (i.name[0] || '?'))}</div>
@@ -16202,6 +16455,7 @@
16202
16455
  <div class="int-kind">${i.agent === 'first-party' ? 'Built-in integration' : `${escapeHtml(i.vendor || 'integration')} · tool <code>${escapeHtml(i.agent)}</code>`}</div>
16203
16456
  <div class="int-scopes">${escapeHtml((i.network || []).join(' · ') || '—')}</div>
16204
16457
  <div class="int-meta">${escapeHtml(meta)}</div>
16458
+ ${microsoftHelp}
16205
16459
  ${renderIntegrationAccounts(i)}
16206
16460
  <div class="conn-int" data-conn-int="${escapeAttr(i.id)}"></div>
16207
16461
  ${google ? google.notice + google.driveChoice + google.driveNote : ''}
@@ -16825,7 +17079,9 @@
16825
17079
  return { label: 'blocked', dotClass: 'skipped', tip: why, sr: `Status: blocked — ${why}` };
16826
17080
  }
16827
17081
  if (state === 'error') {
16828
- const why = (ss && ss.error) || 'The watcher exited with an error';
17082
+ // #3097: ss.error is the watcher's stderr tail, kept in the status for diagnosis and never shown. The tip says
17083
+ // what happened and how to start watching again.
17084
+ 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.';
16829
17085
  return { label: 'error', dotClass: 'failed', tip: why, sr: `Status: error — ${why}` };
16830
17086
  }
16831
17087
  if (state === 'listening') {
@@ -18640,7 +18896,8 @@
18640
18896
  riRenderSuccess(r.ref || '', importFailure && r.importDetailsAttached === false ? importFailure.operationId : null, r.queued === true);
18641
18897
  } catch (e) {
18642
18898
  riSubmitting = false;
18643
- const err = (e && e.body && e.body.error) || '';
18899
+ // A code that picks the branch (riSendFailureCopy says the sentence), so the raw `error`, never shown.
18900
+ const err = (e && e.body && typeof e.body.error === 'string' && e.body.error) || '';
18644
18901
  if (err === 'signed_out') {
18645
18902
  riRenderSignIn(); // the action isn't possible until signed in — hide the form, don't grey it out
18646
18903
  } else if (err === 'rate_limited') {
@@ -19048,13 +19305,16 @@
19048
19305
  const duplicate = duplicateNames.get(account.displayName) > 1;
19049
19306
  const role = account.role === 'owner' ? 'Owner' : 'Member';
19050
19307
  const discriminator = duplicate ? ` · account …${String(account.accountId).slice(-8)}` : '';
19308
+ // Named before the discriminator so it survives wrapping; the row stays selectable (the gate then explains).
19309
+ const core = account.coreStatus === 'inactive' ? ' · No active subscription' : '';
19051
19310
  return `<div class="wf-option" role="option" aria-selected="false" tabindex="${index === 0 ? '0' : '-1'}" data-account-id="${escapeHtml(account.accountId)}">
19052
19311
  <span class="ag-option-copy"><span class="wf-option-name">${escapeHtml(account.displayName)}</span>
19053
- <span class="wf-option-meta">${role}${escapeHtml(discriminator)}</span></span></div>`;
19312
+ <span class="wf-option-meta">${role}${core}${escapeHtml(discriminator)}</span></span></div>`;
19054
19313
  }).join('');
19055
19314
  wrap.innerHTML = `<section class="ag-card" role="dialog"${moduleOnly ? '' : ' aria-modal="true"'} aria-labelledby="ag-title" aria-describedby="ag-copy">
19056
19315
  <h1 id="ag-title">Choose an account</h1>
19057
- <p class="ag-copy" id="ag-copy">Your sign-in belongs to more than one FloLess account. Choose which account to use for ${escapeHtml(moduleLabel)} access.</p>
19316
+ <p class="ag-copy" id="ag-copy">Your sign-in belongs to more than one FloLess account. ${moduleOnly
19317
+ ? `Choose which account to use for ${escapeHtml(moduleLabel)} access.` : 'Choose the account to use FloLess with.'}</p>
19058
19318
  ${rows.length ? `<div class="ag-list" id="ag-list" role="listbox" aria-label="FloLess accounts">${options}</div>`
19059
19319
  : '<p class="ag-copy" role="alert">No account is available for this sign-in. Ask your FloLess account owner to add you, or sign in with a different account.</p>'}
19060
19320
  <div class="ag-actions">${moduleOnly ? '<button type="button" id="ag-not-now">Not now</button>' : '<button type="button" id="ag-signout">Sign out</button>'}
@@ -19109,6 +19369,19 @@
19109
19369
  try {
19110
19370
  const response = await api('/api/license/account', { method: 'POST', body: JSON.stringify({ accountId: selected.dataset.accountId }) });
19111
19371
  const access = response.desktopAccess || {};
19372
+ if (access.state === 'active' && !moduleOnly) {
19373
+ // #3134: the choice decides Core. Open FloLess through the ordinary start (live updates, workspace) once the
19374
+ // licence confirms it; an account without an active subscription is asked about here, with the others still listed.
19375
+ let licence = null;
19376
+ try { licence = await api('/api/license/status'); } catch { /* the reload below shows whatever holds */ }
19377
+ if (licence?.reason === 'account-selection-required') {
19378
+ setStatus('That account has no active FloLess subscription. Choose another account, or sign out.', true);
19379
+ return;
19380
+ }
19381
+ setStatus('Confirmed. Opening FloLess…');
19382
+ location.reload();
19383
+ return;
19384
+ }
19112
19385
  if (access.state === 'active') {
19113
19386
  wrap.remove();
19114
19387
  if (appRoot) appRoot.inert = false;
@@ -19182,6 +19455,14 @@
19182
19455
  'signed-out': { headline: 'Sign in to continue',
19183
19456
  body: 'Sign in with your FloLess account to use floless.app.',
19184
19457
  secondary: { label: 'No subscription yet? Subscribe →', href: subUrl } },
19458
+ // #3134: FloLess opens only on floless.io's signed answer about the subscription. Neither of these is fixed by
19459
+ // signing in, so Try again comes first and signing in stays available as a plain link-style button.
19460
+ 'core-unavailable': { headline: 'Can’t confirm your subscription',
19461
+ body: 'FloLess couldn’t reach floless.io to check your subscription. Check your internet connection, then try again.',
19462
+ secondary: null, retry: 'Still couldn’t reach floless.io. Check your connection, then try again.' },
19463
+ 'update-required': { headline: 'Update FloLess to continue',
19464
+ body: 'floless.io no longer accepts this version of FloLess. Install the latest FloLess, then open it again.',
19465
+ secondary: null, retry: 'This version still isn’t accepted. Install the latest FloLess, then open it again.' },
19185
19466
  };
19186
19467
  let copy = COPY[reason] || COPY['signed-out']; // neutral fallback for an unknown/absent reason
19187
19468
  // A lost seat carries a sub-reason; only a genuine takeover should claim "another device".
@@ -19214,6 +19495,11 @@
19214
19495
  #license-gate .lg-status{min-height:18px;margin:14px 0 0;font-size:12.5px;color:var(--text-muted,#9aa5b6);}
19215
19496
  #license-gate .lg-sub{display:inline-block;margin-top:6px;font-size:12.5px;color:var(--accent,#3b82f6);text-decoration:none;}
19216
19497
  #license-gate .lg-sub:hover{text-decoration:underline;}
19498
+ #license-gate .lg-link{appearance:none;background:none;border:none;padding:2px 4px;margin-top:6px;cursor:pointer;
19499
+ font:inherit;font-size:12.5px;color:var(--accent,#3b82f6);}
19500
+ #license-gate .lg-link:hover{text-decoration:underline;}
19501
+ #license-gate .lg-link:disabled{opacity:.6;cursor:default;text-decoration:none;}
19502
+ #license-gate .primary:focus-visible,#license-gate .lg-link:focus-visible{outline:2px solid var(--accent,#3b82f6);outline-offset:2px;}
19217
19503
  #license-gate .lg-version{margin:18px 0 0;font-size:11px;font-family:var(--mono,monospace);color:var(--text-muted,#9aa5b6);}`;
19218
19504
  document.head.appendChild(style);
19219
19505
  const wrap = document.createElement('div');
@@ -19233,8 +19519,10 @@
19233
19519
  </svg></div>
19234
19520
  <h1>${escapeHtml(copy.headline)}</h1>
19235
19521
  <p>${escapeHtml(copy.body)}</p>
19236
- <button id="lg-signin" class="primary" data-command-id="shell.license-sign-in" aria-describedby="lg-status">Sign in at floless.io</button>
19522
+ ${copy.retry ? '<button id="lg-retry" class="primary" data-command-id="shell.license-retry" aria-describedby="lg-status">Try again</button>'
19523
+ : '<button id="lg-signin" class="primary" data-command-id="shell.license-sign-in" aria-describedby="lg-status">Sign in at floless.io</button>'}
19237
19524
  <p class="lg-status" id="lg-status" role="status"></p>
19525
+ ${copy.retry ? '<button id="lg-signin" class="lg-link" data-command-id="shell.license-sign-in" aria-describedby="lg-status">Sign in again</button>' : ''}
19238
19526
  ${copy.secondary ? `<a class="lg-sub" href="${copy.secondary.href}" target="_blank" rel="noopener">${escapeHtml(copy.secondary.label)}</a>` : ''}
19239
19527
  <p class="lg-version" id="lg-version"></p>
19240
19528
  </div>`;
@@ -19251,7 +19539,8 @@
19251
19539
  // #2786: one watcher, while a sign-in is under way. It reloads once FloLess is signed in, and says how the latest
19252
19540
  // sign-in ended wherever it was started (here, the report dialog, AI Chat or `floless login`), once per sign-in.
19253
19541
  const view = { waiting: false, shown: null, doneOnly: false };
19254
- const stop = (message) => { view.waiting = false; s.textContent = message; signIn.textContent = 'Try again'; };
19542
+ const signInLabel = copy.retry ? 'Sign in again' : 'Sign in at floless.io';
19543
+ const stop = (message) => { view.waiting = false; s.textContent = message; signIn.textContent = copy.retry ? signInLabel : 'Try again'; };
19255
19544
  let generation = 0;
19256
19545
  const watch = async (g = ++generation) => {
19257
19546
  let st; try { st = await api('/api/license/status'); } catch { st = null; }
@@ -19265,7 +19554,7 @@
19265
19554
  generation += 1; // an older watch stops here, so it cannot write over this sign-in while it registers
19266
19555
  view.waiting = false;
19267
19556
  s.textContent = 'Opening sign-in in your browser…';
19268
- signIn.textContent = 'Sign in at floless.io';
19557
+ signIn.textContent = signInLabel;
19269
19558
  // Starting registers the sign-in with floless.io first, so it can take a moment: one start at a time.
19270
19559
  signIn.disabled = true;
19271
19560
  signIn.setAttribute('data-blocked-reason', SIGN_IN_STARTING);
@@ -19280,6 +19569,46 @@
19280
19569
  watch();
19281
19570
  };
19282
19571
  watch(); // a sign-in started before this screen showed (or one that already ended) is said here too
19572
+ const retry = document.getElementById('lg-retry');
19573
+ if (retry) {
19574
+ // Asks the server again. FloLess opens through its ordinary start once floless.io confirms the subscription (or
19575
+ // asks which account to use); otherwise the screen says it still could not, and the button stays.
19576
+ // Anything but the same answer opens FloLess or shows the screen that answer needs, through the ordinary start.
19577
+ const changed = (st) => !!st && (st.state === 'valid' || st.state === 'offline-grace'
19578
+ || (st.state === 'expired' ? 'expired' : st.reason) !== reason);
19579
+ retry.onclick = async () => {
19580
+ if (retry.disabled) return;
19581
+ retry.disabled = true; retry.setAttribute('aria-busy', 'true');
19582
+ s.textContent = 'Checking with floless.io…';
19583
+ let st = null;
19584
+ try { st = await api('/api/license/status?fresh=1'); } catch { st = null; }
19585
+ if (changed(st)) {
19586
+ s.textContent = st.state === 'valid' || st.state === 'offline-grace' ? 'Confirmed. Opening FloLess…' : '';
19587
+ location.reload();
19588
+ return;
19589
+ }
19590
+ retry.disabled = false; retry.removeAttribute('aria-busy');
19591
+ s.textContent = copy.retry;
19592
+ retry.focus();
19593
+ };
19594
+ retry.focus();
19595
+ // A passing outage (floless.io slow to answer, or this PC still busy starting FloLess) should not need a click:
19596
+ // while this screen shows, ask again quietly every 20 s. Each ask is a fresh check (the server keeps any answer a
19597
+ // minute otherwise, and lets at most one fresh check through every few seconds whoever asks).
19598
+ if (reason === 'core-unavailable') {
19599
+ const quiet = async () => {
19600
+ if (!retry.isConnected) return;
19601
+ if (!retry.disabled) {
19602
+ let st = null;
19603
+ try { st = await api('/api/license/status?fresh=1'); } catch { st = null; }
19604
+ if (!retry.isConnected) return;
19605
+ if (changed(st)) { location.reload(); return; }
19606
+ }
19607
+ setTimeout(quiet, 20_000);
19608
+ };
19609
+ setTimeout(quiet, 20_000);
19610
+ }
19611
+ }
19283
19612
  }
19284
19613
 
19285
19614
  // ── Custom Panels bridge (web/panels.js) ─────────────────────────────────────
@@ -19375,6 +19704,9 @@
19375
19704
  // The Workflows tab's home, the counterpart of the Workspaces landing: a create card and one card per workflow. It
19376
19705
  // renders AWARE's library listing; it composes nothing.
19377
19706
  const $wfLanding = document.getElementById('wf-landing');
19707
+ // The workflow card ⋯ menu (openWorkflowCardMenu) and which card it is open for: { key (the owned workflowId), name, canCopy }.
19708
+ const $wfCardMenu = document.getElementById('wf-card-menu');
19709
+ let wfCardMenuFor = null;
19378
19710
  // #2866: a changed Sort by choice repaints the Workflows tab (the render keeps search, focus and open sections).
19379
19711
  globalThis.flolessLandingSort?.onChange('workflows', () => { if (wfLanding) renderWorkflowsLanding(); });
19380
19712
  // The landing search's query, kept outside the input because the landing re-renders with innerHTML.
@@ -19390,6 +19722,7 @@
19390
19722
  if (next && !wfLanding) wfLandingQuery = ''; // a fresh visit starts unfiltered
19391
19723
  wfLanding = next;
19392
19724
  if (wfLanding) closeDraftView();
19725
+ syncWorkflowCardMenu();
19393
19726
  document.body.classList.toggle('wf-landing-open', wfLanding);
19394
19727
  if ($wfLanding) $wfLanding.hidden = !wfLanding;
19395
19728
  // Nothing reads routines at startup (only the Routines window, routine events and a few report paths do), so the
@@ -19510,8 +19843,152 @@
19510
19843
  if (keepCaret) { const box = $wfLanding.querySelector('#wf-landing-search'); box?.focus(); box?.setSelectionRange?.(keepCaret[0], keepCaret[1]); }
19511
19844
  }
19512
19845
 
19846
+ // ── Workflow card ⋯ menu (Workflows page) — the same Rename… / Duplicate / Archive a project card offers, run
19847
+ // through the dialogs the workflow picker already uses, so every check and message is the picker's own. Only a card of
19848
+ // a workflow of yours (compiled or draft) has one. An installed card has none: renaming or copying an installed
19849
+ // workflow makes an installed app the Workflows page does not list, so a renamed one vanishes and a copy never
19850
+ // appears (#3182).
19851
+ function placeWorkflowCardMenu(anchor) {
19852
+ const r = anchor.getBoundingClientRect();
19853
+ // 288 = the menu's 280px width (.menu) + an 8px margin; flip above the ⋯ when the window has no room below.
19854
+ $wfCardMenu.style.left = Math.round(Math.max(8, Math.min(r.right - 280, window.innerWidth - 288))) + 'px';
19855
+ const below = r.bottom + 6;
19856
+ const height = $wfCardMenu.offsetHeight;
19857
+ $wfCardMenu.style.top = Math.round(below + height <= window.innerHeight - 8 ? below : Math.max(8, r.top - 6 - height)) + 'px';
19858
+ anchor.setAttribute('aria-expanded', 'true');
19859
+ // Where the ⋯ was when the menu was placed: a scroll that moves it from here closes the menu.
19860
+ if (wfCardMenuFor) wfCardMenuFor.placedAt = { top: r.top, left: r.left };
19861
+ }
19862
+ function workflowCardMenuAnchor() {
19863
+ return wfCardMenuFor && $wfLanding?.querySelector(`[data-wf-kebab="${CSS.escape(wfCardMenuFor.key)}"]`);
19864
+ }
19865
+ // focusInstead: a visible control to take focus when the ⋯ may be out of view (a scroll closed the menu).
19866
+ function closeWorkflowCardMenu(returnFocus, focusInstead = null) {
19867
+ if (!$wfCardMenu || $wfCardMenu.hidden) { wfCardMenuFor = null; return; }
19868
+ const anchor = workflowCardMenuAnchor();
19869
+ // Focus on the menu or on its own ⋯ (a click there focuses it) belongs to the menu, and moves with it.
19870
+ const hadFocus = $wfCardMenu.contains(document.activeElement) || (!!anchor && document.activeElement === anchor);
19871
+ $wfCardMenu.hidden = true;
19872
+ $wfCardMenu.classList.remove('show');
19873
+ anchor?.setAttribute('aria-expanded', 'false');
19874
+ // Give focus back to the ⋯ before an item's dialog opens, so the dialog returns it to a live control, not <body>.
19875
+ // Closing never scrolls the page (preventScroll).
19876
+ const target = focusInstead || anchor;
19877
+ if (target && (returnFocus || hadFocus)) target.focus(target === anchor ? { focusVisible: true, preventScroll: true } : { preventScroll: true });
19878
+ wfCardMenuFor = null;
19879
+ }
19880
+ // Called after each repaint of the landing (any tab) and on show/hide: the menu lives outside the landing, so a repaint
19881
+ // leaves it open. Keep it pinned to the rebuilt ⋯, or close it when the landing is hidden, another tab is showing, or
19882
+ // that card is gone (archived). A rename keeps the card: the menu is keyed by the workflow's id, not its name.
19883
+ function syncWorkflowCardMenu() {
19884
+ if (!wfCardMenuFor) return;
19885
+ const anchor = wfLanding && wfLandingTab === 'workflows' ? workflowCardMenuAnchor() : null;
19886
+ if (!anchor) { closeWorkflowCardMenu(false); return; }
19887
+ // A card the search filter hid (it hides every card it rules out, then any section left empty), or one in a closed
19888
+ // section, has left the page too: focus goes to the title.
19889
+ const card = anchor.closest('.ws-card');
19890
+ if (!card || card.hidden || card.closest('details.wf-section:not([open])')) {
19891
+ closeWorkflowCardMenu(false, $wfLanding.querySelector('#wf-landing-title'));
19892
+ return;
19893
+ }
19894
+ // Renamed elsewhere, or a draft that gained its file: rebuild the items, so they name it and offer what it has now.
19895
+ if (anchor.dataset.wfKebabName !== wfCardMenuFor.name || (anchor.dataset.wfKebabNoCopy !== '1') !== wfCardMenuFor.canCopy) {
19896
+ openWorkflowCardMenu(anchor, $wfCardMenu.contains(document.activeElement));
19897
+ } else placeWorkflowCardMenu(anchor);
19898
+ }
19899
+ function openWorkflowCardMenu(anchor, focusFirst = false) {
19900
+ if (!$wfCardMenu) return;
19901
+ closeWorkflowCardMenu(false);
19902
+ const d = anchor.dataset;
19903
+ wfCardMenuFor = { key: d.wfKebab, name: d.wfKebabName, canCopy: d.wfKebabNoCopy !== '1' };
19904
+ const { key, name } = wfCardMenuFor;
19905
+ // Each item's Instructor carrier is passed whole by its caller: a command id is never assembled from parts.
19906
+ const item = (act, carrier, text) => `<button type="button" class="menu-item" role="menuitem" tabindex="-1" data-wf-card-act="${act}" ${carrier}`
19907
+ + ` data-command-instance-label="${escapeAttr(name)}"><span class="menu-label">${escapeHtml(text)}</span></button>`;
19908
+ $wfCardMenu.setAttribute('aria-label', `Actions for ${name}`);
19909
+ $wfCardMenu.innerHTML = item('rename', `data-command-id="shell.workflows-landing-rename#${escapeAttr(key)}"`, 'Rename…')
19910
+ + (wfCardMenuFor.canCopy ? item('duplicate', `data-command-id="shell.workflows-landing-duplicate#${escapeAttr(key)}"`, 'Duplicate') : '')
19911
+ + '<div class="menu-divider" role="separator"></div>' + item('archive', `data-command-id="shell.workflows-landing-archive#${escapeAttr(key)}"`, 'Archive');
19912
+ document.dispatchEvent(new Event('floless:passive-overlay-yield'));
19913
+ $wfCardMenu.hidden = false;
19914
+ $wfCardMenu.classList.add('show');
19915
+ placeWorkflowCardMenu(anchor);
19916
+ if (focusFirst) $wfCardMenu.querySelector('.menu-item')?.focus();
19917
+ }
19918
+ if ($wfCardMenu) {
19919
+ $wfCardMenu.addEventListener('click', (event) => {
19920
+ const act = event.target.closest('[data-wf-card-act]');
19921
+ if (!act || !wfCardMenuFor) return;
19922
+ const t = wfCardMenuFor;
19923
+ closeWorkflowCardMenu(true);
19924
+ const which = act.dataset.wfCardAct;
19925
+ // The dialogs report their own failures; this catches one that escapes them (before their try), so a click never
19926
+ // ends in silence.
19927
+ const run = (pending, what) => Promise.resolve(pending).catch((error) => reportErr(error, what));
19928
+ if (which === 'rename') void run(renameOwnedWorkflow(t.key, t.name), 'rename this workflow');
19929
+ else if (which === 'duplicate') void run(copyOwnedWorkflow(t.key, t.name), 'copy this workflow');
19930
+ else if (which === 'archive') {
19931
+ // An archived card and its ⋯ are gone after the repaint: focus goes to the Your workflows heading (which now
19932
+ // counts one fewer), or the page title once that section is empty. Cancel leaves focus on the ⋯, so it is untouched.
19933
+ void run(archiveOwnedWorkflow(t.key, t.name), 'archive this workflow').then(() => {
19934
+ if (!wfLanding || document.activeElement !== document.body) return;
19935
+ ($wfLanding.querySelector('.wf-section[data-wf-section="yours"] > summary') || $wfLanding.querySelector('#wf-landing-title'))?.focus();
19936
+ });
19937
+ }
19938
+ });
19939
+ $wfCardMenu.addEventListener('keydown', (event) => {
19940
+ // A shortcut (Ctrl+R Routines, Ctrl+G…) opens its own surface without moving focus: close the menu first and let
19941
+ // the shortcut through, so the next Escape reaches that surface instead of this menu.
19942
+ if (event.ctrlKey || event.metaKey || event.altKey) { closeWorkflowCardMenu(false); return; }
19943
+ const items = [...$wfCardMenu.querySelectorAll('.menu-item')];
19944
+ const at = items.indexOf(document.activeElement);
19945
+ if (event.key === 'Escape' || event.key === 'Tab') {
19946
+ event.preventDefault(); event.stopPropagation(); closeWorkflowCardMenu(true);
19947
+ } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
19948
+ event.preventDefault();
19949
+ const step = event.key === 'ArrowDown' ? 1 : -1;
19950
+ items[(at + step + items.length) % items.length]?.focus();
19951
+ } else if (event.key === 'Home' || event.key === 'End') {
19952
+ event.preventDefault();
19953
+ items[event.key === 'Home' ? 0 : items.length - 1]?.focus();
19954
+ }
19955
+ });
19956
+ // The menu follows focus: it closes once focus moves anywhere but the menu or its own ⋯ (Tab to another card, a
19957
+ // dialog or a shortcut taking focus), so it never stays open under something else.
19958
+ document.addEventListener('focusin', (event) => {
19959
+ if (!$wfCardMenu.hidden && !$wfCardMenu.contains(event.target) && event.target !== workflowCardMenuAnchor()) closeWorkflowCardMenu(false);
19960
+ });
19961
+ // Focus is normally inside the open menu, whose own handler takes Escape. When it is on the ⋯ itself or nowhere (a
19962
+ // click on the divider), Escape still closes the menu. Capture phase, so nothing under the menu takes that Escape.
19963
+ document.addEventListener('keydown', (event) => {
19964
+ if (event.key !== 'Escape' || $wfCardMenu.hidden || document.querySelector('.modal-backdrop.show')) return;
19965
+ if (event.target !== document.body && event.target !== workflowCardMenuAnchor()) return;
19966
+ event.preventDefault(); event.stopPropagation(); closeWorkflowCardMenu(true);
19967
+ }, true);
19968
+ document.addEventListener('mousedown', (event) => {
19969
+ if ($wfCardMenu.hidden) return;
19970
+ if (!$wfCardMenu.contains(event.target) && !event.target.closest?.('[data-wf-kebab]')) closeWorkflowCardMenu(false);
19971
+ });
19972
+ window.addEventListener('resize', () => closeWorkflowCardMenu(false));
19973
+ // A scroll that moves the ⋯ (the card list, or the whole page in the narrow layout) would leave the fixed menu hanging
19974
+ // away from it, so it closes the menu. A scroll that does not move it is ignored: AI Chat streaming beside the page,
19975
+ // the page's own scroll a moment after coming back to Workflows, a scroll that had already landed when the ⋯ was
19976
+ // clicked. 2px of slack: the card's hover lift moves the ⋯ 1px when the pointer goes into the menu. Focus that was
19977
+ // in the menu or on the ⋯ goes to the Workflows title: in the sticky heading it stays in view; in the narrow layout,
19978
+ // where the whole page scrolls, it is the top of the page, with the search box next in Tab order.
19979
+ document.addEventListener('scroll', (event) => {
19980
+ if ($wfCardMenu.hidden || $wfCardMenu.contains(event.target)) return;
19981
+ const anchor = workflowCardMenuAnchor();
19982
+ const at = wfCardMenuFor?.placedAt;
19983
+ const r = anchor?.getBoundingClientRect();
19984
+ if (anchor && at && Math.abs(r.top - at.top) <= 2 && Math.abs(r.left - at.left) <= 2) return;
19985
+ closeWorkflowCardMenu(false, $wfLanding.querySelector('#wf-landing-title'));
19986
+ }, true);
19987
+ }
19988
+
19513
19989
  function renderWorkflowsLanding() {
19514
19990
  if (!$wfLanding) return;
19991
+ if (wfLandingTab !== 'workflows') syncWorkflowCardMenu(); // the card ⋯ menu lives on the Workflows tab only
19515
19992
  if (wfLandingTab === 'pages') { renderWorkflowsPagesTab(); return; }
19516
19993
  if (wfLandingTab === 'history') { renderWorkflowsHistoryTab(); return; }
19517
19994
  const focusedTab = document.activeElement?.closest?.('#wf-landing [data-wf-tab]')?.dataset.wfTab || null;
@@ -19520,6 +19997,7 @@
19520
19997
  const keepCaret = search ? [search.selectionStart, search.selectionEnd] : null;
19521
19998
  const clearFocused = document.activeElement?.id === 'wf-search-clear';
19522
19999
  const focusedDraft = document.activeElement?.closest?.('#wf-landing [data-wf-draft]')?.dataset.wfDraft || null;
20000
+ const focusedKebab = document.activeElement?.closest?.('#wf-landing [data-wf-kebab]')?.dataset.wfKebab || null;
19523
20001
  const focusedRestore = document.activeElement?.closest?.('[data-wf-restore]')?.dataset.wfRestore || null;
19524
20002
  // Every section (Your workflows, Installed, Archived) is the same disclosure, and each keeps its open state across
19525
20003
  // repaints (apps-changed, search, restore, coming back to the tab); focus on a card inside implies open. Focus on
@@ -19535,6 +20013,8 @@
19535
20013
  const focusedRestored = document.activeElement?.closest?.('[data-wf-restored]')?.dataset.wfRestored || null;
19536
20014
  // #2866: a background repaint (apps-changed, routines) must not drop a keyboard user off the Sort by controls.
19537
20015
  const focusedSort = document.activeElement?.closest?.('#wf-landing .ls-sort button')?.id || null;
20016
+ // The page title takes focus when the landing opens and when a scroll closes a card menu; keep it across a repaint.
20017
+ const titleFocused = document.activeElement?.id === 'wf-landing-title';
19538
20018
  const esc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
19539
20019
  // #2866: the page's Sort by choice orders the cards inside each section; the sections keep their order. Your own
19540
20020
  // workflows carry FloLess's record of when they were created and last changed (made, compiled, renamed, archived);
@@ -19575,6 +20055,13 @@
19575
20055
  // C12 (#1337): owned workflows whose installed copy AWARE could not read show as drafts that need compiling again.
19576
20056
  const unreadableOwned = new Set(wfUnreadable.map((row) => row.workflowId).filter(Boolean));
19577
20057
  const unreadableNote = unreadableWorkflowsNoteHtml(wfUnreadable, esc);
20058
+ // The ⋯ on a card of a workflow of yours (openWorkflowCardMenu): Rename… / Duplicate / Archive. The menu reads what it
20059
+ // acts on from these attributes. A draft with no workflow file yet has nothing to copy, so it is not offered Duplicate.
20060
+ // Installed cards get none (#3182).
20061
+ const kebabHtml = (workflowId, name, canCopy = true) =>
20062
+ `<button type="button" class="ws-kebab wf-kebab" data-wf-kebab="${esc(workflowId)}" data-wf-kebab-name="${esc(name)}"${canCopy ? '' : ' data-wf-kebab-no-copy="1"'}`
20063
+ + ` data-command-id="shell.workflows-landing-actions#${esc(workflowId)}" data-command-instance-label="${esc(name)}"`
20064
+ + ` aria-label="Actions for ${esc(name)}" aria-haspopup="menu" aria-expanded="false" data-tip="${canCopy ? 'Rename · Duplicate · Archive' : 'Rename · Archive'}">⋯</button>`;
19578
20065
  const draftCard = (row) => {
19579
20066
  const recompile = Boolean(row.activePublication);
19580
20067
  const name = row.displayName;
@@ -19583,7 +20070,8 @@
19583
20070
  return `<div class="ws-card wf-card wf-card-draft" role="button" tabindex="0" data-wf-draft="${esc(row.workflowId)}" data-command-id="shell.workflows-landing-open-draft#${esc(name)}" data-command-instance-label="${esc(name)}">`
19584
20071
  + `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind is-draft">${chip}</span>`
19585
20072
  + `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(meta)}</div>`
19586
- + (dateLine(row) ? `<div class="ws-meta wf-card-nodes">${esc(dateLine(row))}</div>` : '') + `</div></div></div>`;
20073
+ + (dateLine(row) ? `<div class="ws-meta wf-card-nodes">${esc(dateLine(row))}</div>` : '') + `</div>`
20074
+ + kebabHtml(row.workflowId, name, Boolean(row.hasSource)) + `</div></div>`;
19587
20075
  };
19588
20076
  const card = (row) => {
19589
20077
  const ownedRow = row.ownedWorkflow;
@@ -19595,7 +20083,8 @@
19595
20083
  + `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind">${chip}</span>`
19596
20084
  + (scheduledTip ? `<span class="ws-kind wf-kind wf-scheduled" data-tip="${esc(scheduledTip)}">Scheduled</span>` : '')
19597
20085
  + `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(where)}</div>`
19598
- + `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row) + (dateLine(row) ? ` · ${dateLine(row)}` : ''))}</div></div></div></div>`;
20086
+ + `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row) + (dateLine(row) ? ` · ${dateLine(row)}` : ''))}</div></div>`
20087
+ + (ownedRow ? kebabHtml(ownedRow.workflowId, name) : '') + `</div></div>`;
19599
20088
  };
19600
20089
  // One section: a disclosure whose summary names it and counts its cards. Your workflows and Installed start open,
19601
20090
  // Archived starts closed; a section the person opened or closed stays that way (keptSections). The summary's
@@ -19632,14 +20121,19 @@
19632
20121
  if (focusedTab) $wfLanding.querySelector(`[data-wf-tab="${focusedTab}"]`)?.focus();
19633
20122
  if (focusedId) $wfLanding.querySelector(`[data-wf-id="${CSS.escape(focusedId)}"]`)?.focus();
19634
20123
  if (focusedDraft) $wfLanding.querySelector(`[data-wf-draft="${CSS.escape(focusedDraft)}"]`)?.focus();
20124
+ if (focusedKebab) $wfLanding.querySelector(`[data-wf-kebab="${CSS.escape(focusedKebab)}"]`)?.focus();
19635
20125
  if (focusedRestore) $wfLanding.querySelector(`[data-wf-restore="${CSS.escape(focusedRestore)}"]:not(:disabled)`)?.focus();
19636
20126
  if (focusedRestored) $wfLanding.querySelector(`[data-wf-restored="${CSS.escape(focusedRestored)}"]`)?.focus();
19637
20127
  if (focusedSort) $wfLanding.querySelector(`#${CSS.escape(focusedSort)}`)?.focus({ preventScroll: true });
20128
+ if (titleFocused) $wfLanding.querySelector('#wf-landing-title')?.focus({ preventScroll: true });
19638
20129
  // #2603: project-workflows.js paints the set-apart folders it owns the answers for (globalThis: harnesses lack it).
19639
20130
  globalThis.flolessProjectWorkflows?.renderLandingSetApart?.($wfLanding.querySelector('.wf-setapart-slot'), wfSetApart, () => loadApps());
19640
20131
  if (keepCaret) $wfLanding.querySelector('#wf-landing-search')?.focus();
19641
20132
  applyWorkflowsLandingSearch(keepCaret);
19642
20133
  if (clearFocused) $wfLanding.querySelector('#wf-search-clear')?.focus(); // it only exists once the filter ran
20134
+ // Last, once the search filter and the set-apart folders have painted: the open card menu is measured and placed
20135
+ // against the cards as they finally sit, or closed if the filter hid its card.
20136
+ syncWorkflowCardMenu();
19643
20137
  }
19644
20138
 
19645
20139
  /** Hide the workflow cards that don't match the landing search: every typed word must appear somewhere in the
@@ -19967,6 +20461,13 @@
19967
20461
  if (event.target.closest('[data-wf-new]')) { requestNewWorkflow(); return; }
19968
20462
  // Clearing empties the message the button sits in, so focus goes back to the search box.
19969
20463
  if (event.target.closest('#wf-search-clear')) { setWorkflowsLandingQuery(''); $wfLanding.querySelector('#wf-landing-search')?.focus(); return; }
20464
+ const kebab = event.target.closest('[data-wf-kebab]');
20465
+ if (kebab) {
20466
+ // A click opens with focus on the first item, as Enter does, so Tab, the arrows and Escape work straight away.
20467
+ if (wfCardMenuFor?.key === kebab.dataset.wfKebab) closeWorkflowCardMenu(true);
20468
+ else openWorkflowCardMenu(kebab, true);
20469
+ return;
20470
+ }
19970
20471
  const draftEl = event.target.closest('[data-wf-draft]');
19971
20472
  if (draftEl) { if (!landingOpening) openDraftWorkflow(draftEl.dataset.wfDraft); return; }
19972
20473
  const cardEl = event.target.closest('[data-wf-id]');
@@ -19993,6 +20494,13 @@
19993
20494
  setWorkflowsLandingTab(order[to], true);
19994
20495
  return;
19995
20496
  }
20497
+ // Opening the ⋯ menu from the keyboard puts focus on its first item, so the arrows work straight away.
20498
+ const kebab = event.target.closest?.('[data-wf-kebab]');
20499
+ if (kebab && (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown')) {
20500
+ event.preventDefault();
20501
+ openWorkflowCardMenu(kebab, true);
20502
+ return;
20503
+ }
19996
20504
  if (event.key !== 'Enter' && event.key !== ' ') return;
19997
20505
  const target = event.target.closest('[data-wf-id], [data-wf-new], [data-wf-draft]');
19998
20506
  if (!target || target !== event.target) return;
@@ -20018,6 +20526,10 @@
20018
20526
  workflowUpdateRow: (offer) => wfUpdateRow(offer),
20019
20527
  updateAllWorkflows: () => updateAllWorkflows(),
20020
20528
  updateAllCount: () => wfUpdateAllTargets().length,
20529
+ /** #3081: one read of the offers feeds the footer count and both dialogs. Answers the list, or null when the read failed. */
20530
+ refreshWorkflowUpdates: () => refreshWorkflowUpdates(),
20531
+ /** #3081: what still waits in the list: updates a click applies, and ones reviewed in AI Chat. */
20532
+ workflowUpdatesWaiting: () => wfUpdatesWaiting(),
20021
20533
  /** #2046: the ≡ menu's New workflow, opened from a Guide suggestion with its name filled in. */
20022
20534
  newWorkflow: (prefill) => requestNewWorkflow(prefill),
20023
20535
  // #2185: a Guide card's Build it — straight to its own conversation, no dialog.
@@ -20242,6 +20754,8 @@
20242
20754
  // writer — the workflow combo keeps updating underneath in Workspaces mode). Pass the open
20243
20755
  // project's name, 'Workspaces' on the landing, or null to hand the tab back to the workflow.
20244
20756
  setWorkspaceTitle(name, landing = false, projectId = null, kind = null) {
20757
+ // Every mode switch ends here; a name means Workspaces or Agents is on screen, where no workflow card is.
20758
+ if (name) closeWorkflowCardMenu(false);
20245
20759
  wsTitleName = name || null;
20246
20760
  wsTitleKind = wsTitleName && kind === 'agents' ? 'agents' : null;
20247
20761
  wsTitleLanding = !!(wsTitleName && landing);