@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/chat.js CHANGED
@@ -64,7 +64,7 @@
64
64
  // #1890 PR 3b: the workspace history's pointer rows, the move notice on screen, and moves being followed now.
65
65
  movedChats: [], movedChatsKnown: null, moveNotice: null, moveNoticeTimer: null, followingMoves: new Set(), movingPoll: null,
66
66
  sessionReady: false, sessionOperation: null, sessionLifecycle: 0, sessionDisposed: false, sessionRecoveryHint: null,
67
- scope: null, chats: [], archivedChats: [], unreadableChats: [], chat: null, events: [], capability: null, signInPending: new Set(), desktop: null,
67
+ scope: null, chats: [], archivedChats: [], unreadableChats: [], chat: null, events: [], capability: null, signInPending: new Set(), signInLandedAt: new Map(), desktop: null,
68
68
  source: null, eventReconnectTimer: null, eventReconnectAttempt: 0, eventReconnectChatId: null, attachments: [], imageLimitChatId: null, followupSubmitting: false, followupUnknownId: null, resolvingFollowupIds: new Set(), retryingFollowupIds: new Set(), integrations: null, historyOpen: false, historyOpenings: 0, historyFilter: 'all', archivedHistoryOpen: false,
69
69
  instructorAnswers: [], historyLoading: false, historyRequestGeneration: 0, picker: null, loading: false,
70
70
  draftTimer: null, localDraft: null, backgroundDrafts: new Map(), draftWrites: new Map(), draftVersions: new Map(), unknownFollowups: new Map(), refreshTimer: null, scopeGeneration: 0, selectionGeneration: 0, openInGeneration: 0, choosingProvider: false,
@@ -75,6 +75,9 @@
75
75
  // Latched so the 5 s account poll logs an outage once instead of twelve times a minute; cleared
76
76
  // on the next successful read, so a later, separate outage is logged too.
77
77
  accountReadWarned: false,
78
+ // #3095: what the feed was drawn from at the last poll that repainted it (feedPollKey), and whether the feed's last
79
+ // draw, by anyone, finished: unchanged and finished, the poll leaves the feed be.
80
+ feedPollKey: undefined, feedDrawn: false,
78
81
  // The last sentence a suggestion card's action reported, keyed by the card's request id.
79
82
  filterCardMessages: new Map(),
80
83
  // #1859: per message (client submission id), why the open Drawing Filter's selection did not go with it.
@@ -200,9 +203,24 @@
200
203
  throw error;
201
204
  }
202
205
  const contentType = response.headers.get('content-type') || '';
203
- const body = contentType.includes('application/json') ? await response.json() : await response.text();
206
+ const readOnly = /^(GET|HEAD)$/.test(String(options.method || 'GET').toUpperCase());
207
+ // #3097: JSON that does not parse is an answer this window could not read: the parser's own text goes to the console,
208
+ // the person reads the shared sentence.
209
+ const unreadable = (cause) => {
210
+ console.warn('[chat] a request was answered with JSON this window could not read', path, response.status, cause);
211
+ return Object.assign(new Error(failureCopy({ status: response.status, body: { ok: false, code: 'response-unreadable' } }, { retrySafe: readOnly }).text),
212
+ { code: 'response-unreadable', status: response.status });
213
+ };
214
+ const body = contentType.includes('application/json')
215
+ ? await response.json().catch((cause) => { if (response.ok) throw unreadable(cause); return null; })
216
+ : await response.text();
204
217
  if (!response.ok) {
205
- const error = new Error(body?.error || body || `Chat request failed (${response.status})`);
218
+ // #3097: the server's own sentence when it wrote one, else the shared one; never "(<status>)". A text answer (an
219
+ // HTML error page, a proxy's plain text) is not FloLess's JSON, so it goes to the console, never into the message.
220
+ const json = body && typeof body === 'object' ? body : null;
221
+ if (!json) console.warn('[chat] a request was answered with something other than FloLess JSON', path, response.status, String(body ?? '').slice(0, 200));
222
+ const said = personText(json);
223
+ const error = new Error(said || failureCopy({ status: response.status, body: json || {} }, { retrySafe: readOnly }).text);
206
224
  error.code = body?.code || null;
207
225
  error.reason = body?.reason || null;
208
226
  error.recovery = Array.isArray(body?.recovery) ? body.recovery : null;
@@ -434,6 +452,23 @@
434
452
  || /^(?:Claude Code returned an error result: )?No conversation found with session ID: [0-9a-f-]{36}$/i.test(raw.trim())) {
435
453
  return `${providerLabels[state.chat?.provider] || 'This AI app'} can no longer open this conversation’s saved history. Start a new conversation to continue.`;
436
454
  }
455
+ // Claude Code's own sign-in failures, in a Claude conversation only. Anchored at the start (the CLI's sentence runs on
456
+ // past what is matched), so quoted or nested text such as "Bash output: …" never matches. errorNeedingSignIn offers
457
+ // its Sign in… button wherever this copy says "sign in to Claude again", and tells the busy renewal apart by its
458
+ // opening words: keep both, or move its tests with them.
459
+ if (state.chat?.provider === 'claude') {
460
+ // Another Claude process held the sign-in renewal (busy, or one that died mid-renewal) and Claude gave up. It
461
+ // clears itself within a minute (the CLI treats a lock as abandoned 60 s after its last update), so waiting and
462
+ // resending comes first; signing in again is the fallback.
463
+ if (/^(?:Claude Code returned an error result: )?(?:Failed to refresh OAuth token: another Claude Code process is refreshing it|Could not refresh your login because another Claude Code process is refreshing it)/.test(raw.trim())) {
464
+ return 'Claude couldn’t finish renewing its sign-in, so its reply stopped. Check anything it already did above, wait a minute, then send your message again. If it keeps happening, sign in to Claude again.';
465
+ }
466
+ // Claude's service refused its sign-in (an invalid, revoked or expired token it could not renew): reloading never
467
+ // fixes that, signing in does.
468
+ if (/^(?:Claude Code returned an error result: )?Failed to authenticate\b/.test(raw.trim())) {
469
+ return 'Claude couldn’t sign in, so its reply stopped. Sign in to Claude again, check anything it already did above, then send your message again.';
470
+ }
471
+ }
437
472
  if (/process exited|app-server|command-line runtime|did not return a session|provider .* unavailable/i.test(raw)) {
438
473
  return 'The selected AI service could not complete this request. Check your sign-in and try again.';
439
474
  }
@@ -841,10 +876,17 @@
841
876
  return { text: stream.shown, streaming: stream.shown.length < stream.target.length };
842
877
  }
843
878
 
879
+ // Read state is shared between the FloLess window and the browser tab through web/shared-prefs.js (#2963); without it, this browser's own storage.
844
880
  function readCursor(chatId) {
881
+ if (window.flolessPrefs) return window.flolessPrefs.chatCursor(chatId);
845
882
  try { return Number(localStorage.getItem(`floless:chat-read:${chatId}`) || 0); } catch { return 0; }
846
883
  }
847
884
 
885
+ function storeReadCursor(chatId, sequence) {
886
+ if (window.flolessPrefs) { window.flolessPrefs.markChatRead(chatId, sequence); return; }
887
+ try { localStorage.setItem(`floless:chat-read:${chatId}`, String(sequence)); } catch { /* private mode */ }
888
+ }
889
+
848
890
  function isUnreadConversation(chat) {
849
891
  return Boolean(chat) && (chat.lastEventSequence || 0) > readCursor(chat.chatId);
850
892
  }
@@ -852,9 +894,23 @@
852
894
  // A browser seeing an owner's history for the first time has no honest way to call its existing
853
895
  // backlog unread. Establish a one-time baseline, then retain unread state for conversations that
854
896
  // receive later events. This prevents a migrated chat history from showing hundreds of old events.
855
- function seedReadCursors(chats, owner = state.scope?.owner) {
897
+ async function seedReadCursors(chats, owner = state.scope?.owner) {
856
898
  if (!owner) return;
857
899
  const ownerId = owner.kind === 'project' ? owner.projectId : owner.kind === 'workflow' ? owner.workflowId : 'workspace';
900
+ // Shared (#2963): the baseline is taken once per owner across the window and the browser tab, after the server's answer is in. A client
901
+ // that finds the owner already seeded sets nothing, so a chat the server has no cursor for stays unread. Without the server it falls back to
902
+ // this browser's own one-time baseline (inside seedOwner).
903
+ if (window.flolessPrefs) {
904
+ const cursors = {};
905
+ for (const chat of chats.slice(0, 500)) cursors[chat.chatId] = chat.lastEventSequence || 0;
906
+ // History must never wait on the preferences queue: past ~5 s the baseline is taken from this browser's own storage instead.
907
+ let timer;
908
+ const limit = new Promise((resolve) => { timer = setTimeout(() => resolve(false), 5000); });
909
+ const seeded = window.flolessPrefs.seedOwner(`${owner.kind}:${ownerId}`, cursors).then(() => true, () => true);
910
+ const inTime = await Promise.race([seeded, limit]);
911
+ clearTimeout(timer);
912
+ if (inTime) return;
913
+ }
858
914
  const key = `floless:chat-read-seeded:${owner.kind}:${ownerId}`;
859
915
  try {
860
916
  if (localStorage.getItem(key)) return;
@@ -866,14 +922,14 @@
866
922
  function markRead(chat = state.chat) {
867
923
  if (!chat || document.hidden || ui.feed.closest('[hidden]')
868
924
  || document.querySelector('.app')?.classList.contains('left-collapsed')) return;
869
- try { localStorage.setItem(`floless:chat-read:${chat.chatId}`, String(chat.lastEventSequence || 0)); } catch { /* private mode */ }
925
+ storeReadCursor(chat.chatId, chat.lastEventSequence || 0);
870
926
  paintUnread();
871
927
  }
872
928
 
873
929
  function markReadThrough(chat, sequence) {
874
930
  if (!chat) return;
875
931
  const through = Math.max(readCursor(chat.chatId), Math.min(Number(sequence) || 0, chat.lastEventSequence || 0));
876
- try { localStorage.setItem(`floless:chat-read:${chat.chatId}`, String(through)); } catch { /* private mode */ }
932
+ storeReadCursor(chat.chatId, through);
877
933
  paintUnread();
878
934
  }
879
935
 
@@ -2378,6 +2434,13 @@
2378
2434
  const CITATION_READ = {
2379
2435
  'whole-sheet': 'yes, the whole sheet', tiles: 'yes, enlarged in 9 tiles', yes: 'yes', no: 'no', unknown: 'not recorded',
2380
2436
  };
2437
+ /** #3093: where a single enlarged tile sits on its sheet, left to right and top to bottom. */
2438
+ const TILE_PLACES = ['', 'top-left', 'top-middle', 'top-right', 'middle-left', 'middle', 'middle-right', 'bottom-left', 'bottom-middle', 'bottom-right'];
2439
+ /** The one tile the AI was shown, or 0 when it saw the sheet whole or all its tiles. */
2440
+ const citedTile = (entry) => {
2441
+ const part = entry?.read === 'tiles' ? entry.ref?.part : undefined;
2442
+ return Number.isSafeInteger(part) && part >= 1 && part <= 9 ? part : 0;
2443
+ };
2381
2444
 
2382
2445
  function citationIndex(turnId) {
2383
2446
  const byAnchor = new Map();
@@ -2411,16 +2474,17 @@
2411
2474
  const row = byAnchor.get(anchor);
2412
2475
  if (!row) continue;
2413
2476
  row.choices = made;
2414
- const live = made.filter((choice) => decisionLiveOn(row, choice)).at(-1);
2477
+ // #3100: a choice the person went on from as an assumption, after its source was found gone, is history.
2478
+ const live = made.filter((choice) => !choice.superseded && decisionLiveOn(row, choice)).at(-1);
2415
2479
  if (live) row.choice = live;
2416
2480
  }
2417
- // #2642: the person's assumption. The live one (none while a live choice stands) is the claim's current decision;
2418
- // otherwise its first record is history ("Earlier assumed").
2481
+ // #2642: the person's assumption. The live one (none while a live choice stands; #3100 the latest when two hold) is
2482
+ // the claim's current decision; otherwise its first record is history ("Earlier assumed").
2419
2483
  for (const record of citationAssumptions(turnId)) {
2420
2484
  const row = byAnchor.get(record.anchor);
2421
2485
  if (!row) continue;
2422
2486
  const live = !row.choice && decisionLiveOn(row, record);
2423
- if (live && !row.assumptionLive) { row.assumption = record; row.assumptionLive = true; }
2487
+ if (live) { row.assumption = record; row.assumptionLive = true; }
2424
2488
  else if (!row.assumption) row.assumption = record;
2425
2489
  }
2426
2490
  // #3000: an entry the answer never marks is not a claim: it is listed apart as "Also consulted", unnumbered, and
@@ -2529,23 +2593,63 @@
2529
2593
  const out = new Map();
2530
2594
  if (!turnId) return out;
2531
2595
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2532
- for (const event of state.events) {
2533
- if (event.type !== 'citation-choice') continue;
2596
+ const byId = new Map();
2597
+ state.events.forEach((event, at) => {
2598
+ if (event.type === 'citation-assumption') {
2599
+ // #3100: an assumption recorded on a chosen source found gone supersedes the earlier choice of this claim it names
2600
+ // (`supersededChoiceIds`): the choice stays on record as made, and is history from then on.
2601
+ const named = assumptionRecordOf(event, turnId)?.chosenGone;
2602
+ const choice = named ? byId.get(named.choiceId) : null;
2603
+ const p = event.payload;
2604
+ // The named choice and every earlier one of the claim: one it replaced must never become its source again.
2605
+ if (choice && choice.anchor === p.anchor && choice.citationId.toLowerCase() === p.citationId.toLowerCase() && claimHeld(p.citationId, turnId, p.anchor)) {
2606
+ for (const earlier of out.get(p.anchor) ?? []) { earlier.superseded = true; if (earlier === choice) break; }
2607
+ }
2608
+ return;
2609
+ }
2610
+ if (event.type !== 'citation-choice') return;
2534
2611
  const p = event.payload || {};
2535
2612
  if (p.turnId !== turnId || typeof p.turnId !== 'string' || !uuid.test(p.turnId) || typeof p.citationId !== 'string' || !uuid.test(p.citationId)
2536
2613
  || typeof p.anchor !== 'string' || !CITE_ANCHOR.test(p.anchor) || !(p.claim === null || citeText(p.claim, 300))
2537
- || !citeText(p.chosenBy, 200) || !citeText(p.chosenAt, 40) || Number.isNaN(Date.parse(p.chosenAt)) || p.via !== 'chip') continue;
2614
+ || !citeText(p.chosenBy, 200) || !citeText(p.chosenAt, 40) || Number.isNaN(Date.parse(p.chosenAt)) || p.via !== 'chip') return;
2538
2615
  const source = chosenSourceOf(p.source);
2539
2616
  const basis = goneBasisOf(p.basis);
2540
- if (!source || basis === null) continue;
2541
- if (!claimHeld(p.citationId, turnId, p.anchor) || !basisHeld({ citationId: p.citationId, anchor: p.anchor, basis }, turnId)) continue;
2617
+ if (!source || basis === null) return;
2618
+ if (!claimHeld(p.citationId, turnId, p.anchor) || !basisHeld({ citationId: p.citationId, anchor: p.anchor, basis }, turnId)) return;
2542
2619
  const made = out.get(p.anchor) ?? [];
2543
- made.push({ eventId: event.eventId, anchor: p.anchor, citationId: p.citationId, chosenBy: p.chosenBy, chosenAt: p.chosenAt, source, ...(basis ? { basis } : {}) });
2620
+ const choice = { eventId: event.eventId, anchor: p.anchor, citationId: p.citationId, chosenBy: p.chosenBy, chosenAt: p.chosenAt, source, ...(basis ? { basis } : {}) };
2621
+ made.push(choice);
2622
+ byId.set(String(event.eventId).toLowerCase(), choice);
2544
2623
  out.set(p.anchor, made);
2545
- }
2624
+ });
2546
2625
  return out;
2547
2626
  }
2548
2627
 
2628
+ /**
2629
+ * #3100: the source a person chose that an assumption on its chosen source found gone names, as `chosenGone`: undefined
2630
+ * when there is none, null when one is there but is not what the route writes (`normalizeChosenGone`).
2631
+ */
2632
+ function chosenGoneOf(value) {
2633
+ if (value === undefined) return undefined;
2634
+ if (!value || typeof value !== 'object' || Array.isArray(value) || Object.keys(value).some((key) => !['choiceId', 'state', 'checkedAt'].includes(key))) return null;
2635
+ if (typeof value.choiceId !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value.choiceId)
2636
+ || !GONE_SOURCE_STATES.includes(value.state) || typeof value.checkedAt !== 'string' || value.checkedAt.length > 40 || Number.isNaN(Date.parse(value.checkedAt))) return null;
2637
+ return { choiceId: value.choiceId.toLowerCase(), state: value.state, checkedAt: value.checkedAt };
2638
+ }
2639
+
2640
+ /** An assumption row as `normalizeCitationAssumption` reads it, for this turn: its basis and chosen-gone basis, or null. */
2641
+ function assumptionRecordOf(event, turnId) {
2642
+ const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2643
+ const p = event.payload || {};
2644
+ if (p.turnId !== turnId || typeof p.turnId !== 'string' || !uuid.test(p.turnId) || typeof p.citationId !== 'string' || !uuid.test(p.citationId)
2645
+ || typeof p.anchor !== 'string' || !CITE_ANCHOR.test(p.anchor) || !(p.claim === null || citeText(p.claim, 300))
2646
+ || !citeText(p.assumedBy, 200) || !citeText(p.assumedAt, 40) || Number.isNaN(Date.parse(p.assumedAt)) || p.via !== 'chip') return null;
2647
+ const basis = goneBasisOf(p.basis);
2648
+ const chosenGone = chosenGoneOf(p.chosenGone);
2649
+ if (basis === null || chosenGone === null) return null;
2650
+ return { basis, chosenGone };
2651
+ }
2652
+
2549
2653
  function citeText(x, max) { return typeof x === 'string' && x.length > 0 && x.length <= max && !/[\u0000-\u001F\u007F]/.test(x); }
2550
2654
 
2551
2655
  /**
@@ -2598,26 +2702,32 @@
2598
2702
  * #2642: the person's "go on with this as an assumption" on this answer's claims — the server's validity rule
2599
2703
  * (`liveCitationAssumptions`): what it names holds the claim (`claimHeld`); the first record per claim wins. #3017: one
2600
2704
  * per claim with no source, and one per claim and citation decided on a cited source found gone; which of them is live
2601
- * is `decisionLiveOn`, decided where the claim's current entry is known (`citationIndex`).
2705
+ * is `decisionLiveOn`, decided where the claim's current entry is known (`citationIndex`). #3100: and one per claim and
2706
+ * the earlier choice of it, on the same citation, whose chosen source FloLess found gone (`chosenGone`).
2602
2707
  */
2603
2708
  function citationAssumptions(turnId) {
2604
2709
  const out = new Map();
2605
2710
  if (!turnId) return [];
2606
- const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
2607
- const text = (x, max) => typeof x === 'string' && x.length > 0 && x.length <= max && !/[\u0000-\u001F\u007F]/.test(x);
2711
+ const choices = [...citationChoices(turnId).values()].flat();
2712
+ const seenIds = new Set();
2608
2713
  for (const event of state.events) {
2714
+ if (event.type === 'citation-choice') { seenIds.add(String(event.eventId).toLowerCase()); continue; }
2609
2715
  if (event.type !== 'citation-assumption') continue;
2610
2716
  const p = event.payload || {};
2611
2717
  // Every check `normalizeCitationAssumption` makes: a row the server would not tell the AI about is never shown as one.
2612
- if (p.turnId !== turnId || typeof p.turnId !== 'string' || !uuid.test(p.turnId) || typeof p.citationId !== 'string' || !uuid.test(p.citationId)
2613
- || typeof p.anchor !== 'string' || !CITE_ANCHOR.test(p.anchor) || !(p.claim === null || text(p.claim, 300))
2614
- || !text(p.assumedBy, 200) || !text(p.assumedAt, 40) || Number.isNaN(Date.parse(p.assumedAt)) || p.via !== 'chip') continue;
2615
- const basis = goneBasisOf(p.basis);
2616
- const slot = basis ? `${p.anchor}\u0000${p.citationId.toLowerCase()}` : p.anchor;
2617
- if (basis === null || out.has(slot)) continue;
2718
+ const read = assumptionRecordOf(event, turnId);
2719
+ if (!read) continue;
2720
+ const { basis, chosenGone } = read;
2721
+ // #3100: one per claim and the choice it supersedes, which must be an earlier choice of this claim, on this citation.
2722
+ const slot = chosenGone ? `${p.anchor}\u0000chosen\u0000${chosenGone.choiceId}` : basis ? `${p.anchor}\u0000${p.citationId.toLowerCase()}` : p.anchor;
2723
+ if (out.has(slot)) continue;
2618
2724
  if (!claimHeld(p.citationId, turnId, p.anchor) || !basisHeld({ citationId: p.citationId, anchor: p.anchor, basis }, turnId)) continue;
2725
+ const choice = chosenGone && seenIds.has(chosenGone.choiceId) ? choices.find((made) => String(made.eventId).toLowerCase() === chosenGone.choiceId
2726
+ && made.anchor === p.anchor && made.citationId.toLowerCase() === p.citationId.toLowerCase()) : null;
2727
+ if (chosenGone && !choice) continue;
2619
2728
  // #3000: the claim's own words are kept with it, so the record always says which claim it is about.
2620
- out.set(slot, { anchor: p.anchor, citationId: p.citationId, claim: p.claim, assumedBy: p.assumedBy, assumedAt: p.assumedAt, ...(basis ? { basis } : {}) });
2729
+ out.set(slot, { anchor: p.anchor, citationId: p.citationId, claim: p.claim, assumedBy: p.assumedBy, assumedAt: p.assumedAt, ...(basis ? { basis } : {}),
2730
+ ...(chosenGone ? { chosenGone, choice } : {}) });
2621
2731
  }
2622
2732
  return [...out.values()];
2623
2733
  }
@@ -2691,18 +2801,25 @@
2691
2801
  }
2692
2802
  return entry.read === 'sent' ? 'not recorded, it went with your question' : 'not recorded';
2693
2803
  }
2804
+ const tile = citedTile(entry);
2805
+ if (tile) return `yes, only its ${TILE_PLACES[tile]} part, enlarged`;
2694
2806
  return CITATION_READ[entry.read] || CITATION_READ.no;
2695
2807
  }
2696
2808
 
2697
- function citationProvenance(entry) {
2698
- // #2643: a source the person chose says who chose it, and claims no AI read: the choice records none.
2699
- if (entry.chosen) return `Found: yes · Chosen by ${assumedWho({ assumedBy: entry.chosen.chosenBy })}, ${assumedWhen({ assumedAt: entry.chosen.chosenAt })} · Read by AI: this choice records none · Checked: no`;
2809
+ function citationProvenance(entry, seen) {
2810
+ // #2643: a source the person chose says who chose it, and claims no AI read: the choice records none. #3039: and where
2811
+ // it stands now, when FloLess found it changed or gone since it was chosen.
2812
+ if (entry.chosen) {
2813
+ const found = CHOSEN_FOUND[seen] ? `${CHOSEN_FOUND[seen]} ${chosenSince(entry.chosen, seen)}` : 'Found: yes';
2814
+ return `${found} · Chosen by ${assumedWho({ assumedBy: entry.chosen.chosenBy })}, ${assumedWhen({ assumedAt: entry.chosen.chosenAt })} · Read by AI: this choice records none · Checked: no`;
2815
+ }
2700
2816
  return `Found: yes · Read by AI: ${citationReadWords(entry)} · Checked: no`;
2701
2817
  }
2702
2818
 
2703
2819
  /** The chip's tag, in words: never a colour or a tick. */
2704
- function citationMarks(entry) {
2705
- if (entry.chosen) return `FOUND · CHOSEN BY ${assumedWho({ assumedBy: entry.chosen.chosenBy }).toUpperCase()}`;
2820
+ function citationMarks(entry, seen) {
2821
+ // #3039: a chosen source's state takes FOUND's place, in the words every chip uses; who chose it stays.
2822
+ if (entry.chosen) return `${CHOSEN_FOUND[seen] ? SOURCE_MARKS[seen] : 'FOUND'} · CHOSEN BY ${assumedWho({ assumedBy: entry.chosen.chosenBy }).toUpperCase()}`;
2706
2823
  if (entry.kind === 'attachment' && entry.read === 'sent') return 'FOUND · SENT WITH QUESTION';
2707
2824
  return ['whole-sheet', 'tiles', 'yes', 'mentioned', 'looked', 'in-message'].includes(entry.read) ? 'FOUND · READ BY AI' : 'FOUND';
2708
2825
  }
@@ -2900,11 +3017,13 @@
2900
3017
  const assumed = !sourced && row?.assumptionLive ? row.assumption : null;
2901
3018
  // #2930: the AI named a member that exists the wrong way: its reference to correct, not a claim without a source.
2902
3019
  const misnamed = !sourced && !assumed && referenceProblem(row?.entry);
2903
- const label = resolved ? citationLabel(row.entry) : chosen ? citationLabel(chosenViewRow(row, chosen).entry) : assumed ? 'assumption, no source'
3020
+ // #3100: an assumption made after the source the person chose was found gone had a source: it is never "no source".
3021
+ const goneChosen = assumed?.chosenGone ? `The source ${assumedWho({ assumedBy: assumed.choice.chosenBy })} chose, ${citationLabel(assumed.choice.source)}, ${GONE_SAID[assumed.chosenGone.state]} when FloLess checked` : '';
3022
+ const label = resolved ? citationLabel(row.entry) : chosen ? citationLabel(chosenViewRow(row, chosen).entry) : goneChosen ? 'assumption' : assumed ? 'assumption, no source'
2904
3023
  : misnamed ? 'source needs correcting' : 'no source';
2905
3024
  // No citation for this anchor on this page is "none recorded", not "none found": the AI may have given none, or the
2906
3025
  // record has not reached this page yet.
2907
- const missing = assumed ? `${assumed.basis ? `The cited source ${GONE_SAID[assumed.basis.state]} when FloLess checked` : 'No source'}. Assumed by ${assumedWho(assumed)} on ${assumedWhen(assumed)}`
3026
+ const missing = assumed ? `${goneChosen || (assumed.basis ? `The cited source ${GONE_SAID[assumed.basis.state]} when FloLess checked` : 'No source')}. Assumed by ${assumedWho(assumed)} on ${assumedWhen(assumed)}`
2908
3027
  : misnamed === 'kb-source' ? (row.entry.match === 'bytes' ? 'Source needs correcting: the file is in Knowledge, but the AI cited FloLess’s copy of it'
2909
3028
  : 'Source needs correcting: the AI cited FloLess’s copy of a file that may be one of the reference files in Knowledge')
2910
3029
  : misnamed ? 'Source needs correcting: the member exists, but the AI named it wrongly'
@@ -2929,7 +3048,7 @@
2929
3048
  const tag = document.createElement('span'); tag.className = 'ai-chat-assume by-person';
2930
3049
  tag.textContent = 'Assumption';
2931
3050
  tag.dataset.tip = `${assumedWho(assumed) === 'you' ? 'You' : assumedWho(assumed)} recorded this as an assumption (${assumedWhen(assumed)}). `
2932
- + (assumed.basis ? `Its cited source ${GONE_SAID[assumed.basis.state]} when FloLess checked.` : 'It has no source.');
3051
+ + (goneChosen ? `${goneChosen}.` : assumed.basis ? `Its cited source ${GONE_SAID[assumed.basis.state]} when FloLess checked.` : 'It has no source.');
2933
3052
  marker.after(tag);
2934
3053
  }
2935
3054
  }
@@ -3099,6 +3218,8 @@
3099
3218
  number.textContent = row.number ? String(row.number) : '?';
3100
3219
  chip.append(number);
3101
3220
  if (row.choice) return chosenChip(chip, turnId, row);
3221
+ // #3100: the person went on with a claim whose CHOSEN source FloLess found gone.
3222
+ if (row.assumptionLive && row.assumption.chosenGone) return chosenGoneAssumedChip(chip, turnId, row, number);
3102
3223
  const entry = row.entry;
3103
3224
  // #3017: the person went on with a claim whose cited source FloLess found gone.
3104
3225
  if (entry.status === 'resolved' && row.assumptionLive) return goneAssumedChip(chip, turnId, row, number);
@@ -3291,6 +3412,45 @@
3291
3412
  return chip;
3292
3413
  }
3293
3414
 
3415
+ /**
3416
+ * #3100: the person's assumption on a claim whose source THEY had chosen, after FloLess found that source gone. Still
3417
+ * "?": an assumption is not a source. It names the source they chose and what FloLess found when it looked, never that
3418
+ * the claim had no source; the choice stays on record as made, and its source still opens (it may be back).
3419
+ */
3420
+ function chosenGoneAssumedChip(chip, turnId, row, number) {
3421
+ const record = row.assumption;
3422
+ const choice = record.choice;
3423
+ const who = assumedWho({ assumedBy: choice.chosenBy });
3424
+ const said = `The source ${who === 'you' ? 'you' : who} chose, ${citationLabel(choice.source)}, ${GONE_SAID[record.chosenGone.state]} when FloLess checked`;
3425
+ chip.classList.add('assumed', 'gone');
3426
+ // #3100: the source on record is one a person chose, so the row never says the AI gave it, or that there was none.
3427
+ chip.dataset.chosenGone = 'true';
3428
+ number.setAttribute('aria-label', `Assumption. ${said}`);
3429
+ const why = document.createElement('span'); why.className = 'ai-chat-source-why';
3430
+ why.textContent = `Assumed by ${assumedWho(record)}, ${assumedWhen(record)}. ${said}.`;
3431
+ const marks = document.createElement('span'); marks.className = 'ai-chat-source-marks';
3432
+ marks.textContent = 'ASSUMPTION';
3433
+ marks.dataset.tip = 'Your decision to go on without the source you chose. The choice stays on record as it was made. Nothing checked this claim. The AI is reminded of it with each message you send';
3434
+ const label = citationLabel(choice.source);
3435
+ const open = button('Open the source you chose', 'shell.chat-cite-open-chosen', 'ai-chat-source-action quiet');
3436
+ open.dataset.commandInstanceLabel = label;
3437
+ open.setAttribute('aria-label', `Open the source you chose: ${label}`);
3438
+ open.dataset.tip = `What was chosen: ${label}`;
3439
+ open.addEventListener('click', () => openCitedSource(chosenViewRow(row, choice), turnId));
3440
+ const choose = button('Choose a source…', 'shell.chat-cite-choose', 'ai-chat-source-action quiet');
3441
+ choose.dataset.commandInstanceLabel = label;
3442
+ choose.setAttribute('aria-label', 'Choose a source for this claim');
3443
+ choose.setAttribute('aria-haspopup', 'dialog');
3444
+ choose.dataset.tip = 'Pick the sheet, model member, Knowledge page or attached file this claim comes from. It is recorded as chosen by you, with the date; nothing checks the claim';
3445
+ choose.addEventListener('click', () => openSourcePicker(row, turnId, null));
3446
+ const claimed = record.claim ? claimCited(`“${record.claim}”`, 'The claim you recorded as an assumption') : null;
3447
+ // A choice made after the AI's cited source was found gone keeps that cited source to open, as its chip did.
3448
+ chip.append(...(claimed ? [claimed] : []), why, marks, sourceActions(open, choose, ...(record.basis ? [citedSourceOpener(turnId, row)] : [])));
3449
+ const saved = citationNote(row, turnId);
3450
+ if (saved) chip.append(saved);
3451
+ return chip;
3452
+ }
3453
+
3294
3454
  /** The person's ways on from a claim with no source, in one row that wraps between buttons, never inside one. */
3295
3455
  function sourceActions(...buttons) {
3296
3456
  const actions = document.createElement('span'); actions.className = 'ai-chat-source-actions';
@@ -3305,7 +3465,12 @@
3305
3465
  function chosenChip(chip, turnId, row) {
3306
3466
  const view = chosenViewRow(row, row.choice);
3307
3467
  const entry = view.entry;
3468
+ // #3039: where the chosen source stands now, as FloLess last found it (the answer's check or its viewer). The choice
3469
+ // itself is unchanged: only its state is shown.
3470
+ const seen = CHOSEN_FOUND[seenSource(view)] ? seenSource(view) : undefined;
3471
+ const gone = GONE_SOURCE_STATES.includes(seen);
3308
3472
  chip.classList.add('chosen');
3473
+ chip.classList.toggle('stale', gone);
3309
3474
  if (entry.kind === 'sheet') {
3310
3475
  const thumb = document.createElement('img'); thumb.alt = ''; thumb.loading = 'lazy';
3311
3476
  // Only the picture FloLess held when it was chosen, byte for byte (never a render); a changed picture has none.
@@ -3320,22 +3485,37 @@
3320
3485
  const label = citationLabel(entry);
3321
3486
  const open = button(label, 'shell.chat-cite-open-chosen', 'ai-chat-answer-open ai-chat-source-open');
3322
3487
  open.dataset.commandInstanceLabel = label;
3323
- open.setAttribute('aria-label', `Open ${label}`);
3324
- open.dataset.tip = citationProvenance(entry);
3488
+ open.setAttribute('aria-label', `Open ${label}${seen ? `, ${chosenSince(row.choice, seen)}` : ''}`);
3489
+ open.dataset.tip = citationProvenance(entry, seen);
3325
3490
  open.addEventListener('click', () => openCitedSource(view, turnId));
3326
3491
  const marks = document.createElement('span'); marks.className = 'ai-chat-source-marks';
3327
- marks.textContent = citationMarks(entry);
3328
- marks.dataset.tip = 'A person picked this source. No AI read is recorded for this choice, and nothing checked the claim';
3329
- const change = button('Change…', 'shell.chat-cite-change', 'ai-chat-source-action quiet');
3492
+ marks.textContent = citationMarks(entry, seen);
3493
+ marks.dataset.tip = gone ? 'A person picked this source. When FloLess checked, it was gone; the choice stays as it was made'
3494
+ : 'A person picked this source. No AI read is recorded for this choice, and nothing checked the claim';
3495
+ // A gone source makes Change… the way on.
3496
+ const change = button('Change…', 'shell.chat-cite-change', `ai-chat-source-action${gone ? '' : ' quiet'}`);
3330
3497
  change.setAttribute('aria-label', 'Change the source for this claim');
3331
3498
  change.setAttribute('aria-haspopup', 'dialog');
3332
3499
  change.dataset.tip = 'Pick a different source. The earlier choice stays in the record';
3333
3500
  change.addEventListener('click', () => openSourcePicker(row, turnId, row.choice.eventId));
3501
+ // #3100: a gone chosen source may also be gone on from as an assumption, as a gone cited one may. FloLess checks the
3502
+ // chosen source again before it records it; the choice stays on record.
3503
+ let assume = null;
3504
+ if (gone) {
3505
+ assume = button(ASSUME_LABEL, 'shell.chat-cite-assume', 'ai-chat-source-action quiet');
3506
+ assume.dataset.commandInstanceLabel = label;
3507
+ assume.setAttribute('aria-label', `${ASSUME_LABEL}: the claim whose chosen source, ${label}, is gone`);
3508
+ assume.dataset.tip = 'Saves your decision with your name and the date, and labels the claim Assumption. The source you chose stays on record. Nothing runs now: the AI receives it with your next message';
3509
+ assume.addEventListener('click', () => assumeClaim(row, turnId, assume.closest('.ai-chat-source'), assume, null, row.choice));
3510
+ }
3334
3511
  // #3017: chosen after FloLess found the cited source gone: what it found and when, and the cited source to open.
3335
3512
  const basis = row.choice.basis;
3336
- chip.append(open, marks, basis ? sourceActions(change, citedSourceOpener(turnId, row)) : change);
3513
+ const ways = [change, ...(assume ? [assume] : []), ...(basis ? [citedSourceOpener(turnId, row)] : [])];
3514
+ chip.append(open, marks, ways.length > 1 ? sourceActions(...ways) : change);
3337
3515
  const earlier = row.choices.length > 1 ? row.choices[row.choices.length - 2] : null;
3338
- const before = [basis ? `The cited source ${citationLabel(row.entry)} ${GONE_SAID[basis.state]} when FloLess checked` : '',
3516
+ const said = gone ? chosenSince(row.choice, seen) : '';
3517
+ const before = [said ? `${said[0].toUpperCase()}${said.slice(1)}. The choice stays on record` : '',
3518
+ basis ? `The cited source ${citationLabel(row.entry)} ${GONE_SAID[basis.state]} when FloLess checked` : '',
3339
3519
  row.assumption ? `Earlier assumed by ${assumedWho(row.assumption)}, ${assumedWhen(row.assumption)}` : '',
3340
3520
  earlier ? `Changed from ${earlier.source.label}` : ''].filter(Boolean);
3341
3521
  if (before.length) {
@@ -3351,24 +3531,28 @@
3351
3531
  * the server writes it with the signed-in account and the date. The conversation is the one the chip was painted for:
3352
3532
  * a reply that lands after the person moved to another conversation changes nothing on screen.
3353
3533
  */
3354
- async function assumeClaim(row, turnId, chip, assume, goneIndex = null) {
3534
+ async function assumeClaim(row, turnId, chip, assume, goneIndex = null, goneChoice = null) {
3355
3535
  if (assume.getAttribute('aria-busy') === 'true' || !row.chatId) return;
3356
3536
  chip.querySelector('.ai-chat-source-note')?.remove();
3357
3537
  // Busy, not disabled: a disabled button drops the keyboard focus to the page.
3358
3538
  assume.setAttribute('aria-busy', 'true'); assume.setAttribute('aria-disabled', 'true');
3359
3539
  assume.textContent = 'Saving…';
3360
3540
  const claim = unsourcedClaimWords(turnId, row.anchor);
3361
- let saved = null; let problem = '';
3541
+ let saved = null; let problem = ''; let lastError = '';
3362
3542
  try {
3363
- const result = await request(`/api/chat/conversations/${encodeURIComponent(row.chatId)}/citations/${encodeURIComponent(row.citationId)}/assume`, {
3543
+ // #3100: on a chosen source found gone, the claim is the one the choice holds, and the choice is named.
3544
+ const citationId = goneChoice ? goneChoice.citationId : row.citationId;
3545
+ const result = await request(`/api/chat/conversations/${encodeURIComponent(row.chatId)}/citations/${encodeURIComponent(citationId)}/assume`, {
3364
3546
  method: 'POST', body: JSON.stringify({ owner: row.ownerObject, turnId, anchor: row.anchor, claim: claim || null,
3365
3547
  // #3017: a claim the AI cited, whose source FloLess found gone: FloLess checks that again before recording.
3366
- ...(goneIndex === null ? {} : { sourceGone: { index: goneIndex } }) }),
3548
+ ...(goneIndex === null ? {} : { sourceGone: { index: goneIndex } }),
3549
+ ...(goneChoice ? { chosenGone: { choiceId: goneChoice.eventId } } : {}) }),
3367
3550
  });
3368
3551
  saved = result?.event ?? null;
3369
3552
  } catch (error) {
3553
+ lastError = error?.code ?? '';
3370
3554
  // The server's own sentence when it says why nothing was recorded; anything else is a plain "try again".
3371
- problem = ['chat-cite-assume-stale', 'chat-cite-assume-unknown', 'chat-cite-assume-unreadable', 'chat-cite-assume-source-there'].includes(error?.code)
3555
+ problem =['chat-cite-assume-stale', 'chat-cite-assume-unknown', 'chat-cite-assume-unreadable', 'chat-cite-assume-source-there'].includes(error?.code)
3372
3556
  ? String(error.message) : 'Could not save your choice. Try again.';
3373
3557
  }
3374
3558
  if (state.chat?.chatId !== row.chatId) return;
@@ -3380,7 +3564,8 @@
3380
3564
  const after = [...ui.feed.querySelectorAll('.ai-chat-source')].find((node) => node.dataset.turnId === (turnId || '') && node.dataset.anchor === row.anchor);
3381
3565
  after?.querySelector('[data-command-id="shell.chat-cite-ask"], [data-command-id="shell.chat-cite-choose"]')?.focus({ preventScroll: true });
3382
3566
  const record = citationIndex(turnId).byAnchor.get(row.anchor)?.assumption;
3383
- announce(record ? `Marked as an assumption by ${assumedWho(record)}, ${assumedWhen(record)}. No source.` : 'Your choice was saved.');
3567
+ // #3100: a claim whose chosen source was found gone had a source; it is never announced as having none.
3568
+ announce(record ? `Marked as an assumption by ${assumedWho(record)}, ${assumedWhen(record)}. ${record.chosenGone ? 'The source you chose stays on record.' : 'No source.'}` : 'Your choice was saved.');
3384
3569
  return;
3385
3570
  }
3386
3571
  assume.removeAttribute('aria-busy'); assume.removeAttribute('aria-disabled');
@@ -3388,6 +3573,13 @@
3388
3573
  const note = document.createElement('span'); note.className = 'ai-chat-source-note warn'; note.setAttribute('role', 'status');
3389
3574
  note.textContent = problem;
3390
3575
  chip.append(note);
3576
+ // #3100: FloLess found the source the person chose there after all: the chip asks again where it stands, so it no
3577
+ // longer reads REMOVED beside a button that would be refused again. The reason is said aloud, as the repaint drops it.
3578
+ if (goneChoice && lastError === 'chat-cite-assume-source-there') {
3579
+ announce(problem);
3580
+ probedTurns.delete(`${row.chatId}\u0000${turnId}`);
3581
+ probeSources(turnId, citationIndex(turnId));
3582
+ }
3391
3583
  }
3392
3584
 
3393
3585
  /** #2692: what the picker can list, in order: the project's drawings and model, its Knowledge, and this conversation's files. */
@@ -3865,7 +4057,7 @@
3865
4057
  }
3866
4058
  const head = document.createElement('span'); head.className = 'ai-chat-sources-head';
3867
4059
  // #2643: a source a person chose is not one the AI gave, so a row holding one says neither.
3868
- const chosen = chips.some((chip) => chip.classList.contains('chosen'));
4060
+ const chosen = chips.some((chip) => chip.classList.contains('chosen') || chip.dataset.chosenGone === 'true');
3869
4061
  // #2999: a row of claims the AI named no source for says so, never that the AI gave sources.
3870
4062
  const none = !chosen && chips.every((chip) => chip.dataset.bare === 'true');
3871
4063
  head.textContent = none ? 'Claims with no source' : chosen ? 'Sources for this answer' : 'Sources the AI gave for this answer';
@@ -4104,6 +4296,8 @@
4104
4296
  // Closing is done here, not left to the dialog's own `close` event, which an embedding browser may never fire: the
4105
4297
  // viewer is removed, its picture released and focus handed back to the chip, once, whichever way it closes.
4106
4298
  let picture = null;
4299
+ // #3018: a PDF drawn by FloLess's own viewer, whose worker and pages are released when the viewer closes.
4300
+ let pdfView = null;
4107
4301
  let finished = false;
4108
4302
  const controller = new AbortController();
4109
4303
  let loadingTimer = null;
@@ -4116,6 +4310,7 @@
4116
4310
  if (dialog.open) dialog.close();
4117
4311
  hide();
4118
4312
  if (picture) URL.revokeObjectURL(picture);
4313
+ pdfView?.destroy();
4119
4314
  liveCitationOpener(turnId, row.anchor)?.focus({ preventScroll: true });
4120
4315
  };
4121
4316
  close.addEventListener('click', finish);
@@ -4125,7 +4320,8 @@
4125
4320
  // #3017: what this open found, for the chip and for this line, which never says "Found: yes" over a source found gone.
4126
4321
  const found = (seen) => {
4127
4322
  viewerFound(row, turnId, seen);
4128
- if (!entry.chosen && SOURCE_FOUND[seen]) note.textContent = `${SOURCE_FOUND[seen]} · Read by AI: ${citationReadWords(entry)} · Checked: no`;
4323
+ if (entry.chosen) { if (CHOSEN_FOUND[seen] || seen === 'same') note.textContent = citationProvenance(entry, seen); }
4324
+ else if (SOURCE_FOUND[seen]) note.textContent = `${SOURCE_FOUND[seen]} · Read by AI: ${citationReadWords(entry)} · Checked: no`;
4129
4325
  };
4130
4326
  const body = document.createElement('div'); body.className = 'ai-chat-source-viewer-body';
4131
4327
  const status = Object.assign(document.createElement('p'), { className: 'ai-chat-source-viewer-status', textContent: 'Opening…' });
@@ -4155,7 +4351,12 @@
4155
4351
  dialog.append(again);
4156
4352
  };
4157
4353
  const refused = async (response) => {
4158
- if (response.status === 404) return 'FloLess no longer holds this source, or its project is no longer part of this conversation.';
4354
+ if (response.status === 404) {
4355
+ // #3041: a file the server says was removed is said as removed; any other 404 stays the plain "not here".
4356
+ const said = entry.kind === 'attachment' ? await response.json().catch(() => null) : null;
4357
+ return said?.code === 'citation-source-removed' && typeof said.message === 'string' && said.message ? said.message
4358
+ : 'FloLess no longer holds this source, or its project is no longer part of this conversation.';
4359
+ }
4159
4360
  if (response.status === 410) {
4160
4361
  // #2692: a chosen source says it changed since the person chose it, never since an answer cited it.
4161
4362
  if (entry.kind !== 'attachment') {
@@ -4194,6 +4395,8 @@
4194
4395
  const response = await fetch(citationUrl(row, 'image'), { credentials: 'same-origin', cache: 'no-store', signal: controller.signal });
4195
4396
  if (!response.ok) { const why = await refused(response); if (!finished) { status.textContent = why; retry(); } return; }
4196
4397
  const shown = response.headers.get('X-FloLess-Shown') || 'as-seen';
4398
+ // #3038: the picture the AI was shown, or established as no longer the stored one; tiles or unchecked say nothing.
4399
+ found({ 'as-seen': 'same', 'from-source:changed': 'changed', 'from-source:missing': 'changed' }[shown] ?? null);
4197
4400
  const bytes = await response.blob();
4198
4401
  // Checked after every wait: a viewer closed meanwhile creates nothing it would never release.
4199
4402
  if (finished) return;
@@ -4201,11 +4404,13 @@
4201
4404
  const image = Object.assign(document.createElement('img'), { src: picture, alt: `${entry.label}${shown === 'as-seen' ? '' : ', rendered from the source drawing'}` });
4202
4405
  if (!await mountDrawing().setImage(image, () => !finished, true)) return;
4203
4406
  loaded();
4204
- status.textContent = SHOWN[shown] || SHOWN['as-seen'];
4407
+ const tile = shown === 'from-source:tiles' && !entry.chosen ? citedTile(entry) : 0;
4408
+ status.textContent = tile ? `The whole sheet, rendered from its source drawing. The AI saw only its ${TILE_PLACES[tile]} part, enlarged.`
4409
+ : SHOWN[shown] || SHOWN['as-seen'];
4205
4410
  return;
4206
4411
  }
4207
4412
  if (entry.kind === 'member') { await showCitedMember(row, { dialog, body, status, finish, refused, done: () => finished, found }); return; }
4208
- if (entry.kind === 'kb-source') { await showCitedKnowledgeFile(row, { body, status, refused, retry, signal: controller.signal, done: () => finished, picture: (url) => { picture = url; }, mountDrawing, loaded, stale: (state) => {
4413
+ if (entry.kind === 'kb-source') { await showCitedKnowledgeFile(row, { body, status, refused, retry, signal: controller.signal, done: () => finished, picture: (url) => { picture = url; }, pdf: (handle) => { pdfView = handle; }, mountDrawing, loaded, stale: (state) => {
4209
4414
  // The viewer's own provenance line says it too: it must not still say "Found: yes" over a removed file.
4210
4415
  knowledgeFileStale(row, turnId, state);
4211
4416
  if (KNOWLEDGE_FILE_TIPS[state]) note.textContent = KNOWLEDGE_FILE_TIPS[state];
@@ -4234,9 +4439,12 @@
4234
4439
  if (entry.kind === 'attachment') {
4235
4440
  const response = await fetch(citationUrl(row, 'attachment'), { credentials: 'same-origin', cache: 'no-store', signal: controller.signal });
4236
4441
  // #3017: what this open found, for the chip: the attached file changed, or no longer the one attached.
4237
- // A 404 is said for a file gone and for one no longer as attached alike, so it tells the chip nothing.
4238
- found(response.ok ? 'same' : response.status !== 410 ? null
4239
- : await response.clone().json().then((said) => (said?.code === 'citation-source-not-as-attached' ? 'not-as-attached' : 'changed'), () => null));
4442
+ // #3041: a 404 tells the chip only when the server established the file was removed; a plain 404 tells it nothing.
4443
+ const said = response.ok ? null : await response.clone().json().catch(() => null);
4444
+ found(response.ok ? 'same'
4445
+ : response.status === 404 ? (said?.code === 'citation-source-removed' ? 'removed' : null)
4446
+ : response.status !== 410 || !said ? null
4447
+ : said.code === 'citation-source-not-as-attached' ? 'not-as-attached' : 'changed');
4240
4448
  if (!response.ok) { const why = await refused(response); if (!finished) { status.textContent = why; retry(); } return; }
4241
4449
  const type = (response.headers.get('Content-Type') || '').split(';')[0].trim().toLowerCase();
4242
4450
  if (type.startsWith('image/')) {
@@ -4278,6 +4486,7 @@
4278
4486
  const why = {
4279
4487
  'chat-page-closed': 'This conversation is no longer the one open here. Open it again, then press Open in its default app.',
4280
4488
  'citation-source-unavailable': 'FloLess no longer holds this file in this conversation, so there is nothing to open.',
4489
+ 'citation-source-removed': 'This file was removed from this conversation, so there is nothing to open. Attach it again if you still need it.',
4281
4490
  'citation-source-changed': entry.chosen ? 'This file has changed since you chose it, so FloLess does not open it as the file you chose.'
4282
4491
  : 'This file has changed since the answer cited it, so FloLess does not open it as the cited file.',
4283
4492
  'citation-source-not-as-attached': entry.chosen ? CHOSEN_NOT_AS_ATTACHED : 'This file is no longer the plain file that was attached, so FloLess does not open it as the cited file. Attach the file again if you still need it.',
@@ -4291,6 +4500,8 @@
4291
4500
  return;
4292
4501
  }
4293
4502
  const response = await fetch(citationUrl(row, 'page'), { credentials: 'same-origin', cache: 'no-store', signal: controller.signal });
4503
+ // #3038: the page as cited, or changed since; a 404 (gone, or no longer this conversation's) says nothing.
4504
+ found(response.ok ? 'same' : response.status === 410 ? 'changed' : null);
4294
4505
  if (!response.ok) { const why = await refused(response); if (!finished) { status.textContent = why; retry(); } return; }
4295
4506
  const { page } = await response.json();
4296
4507
  if (finished) return;
@@ -4363,17 +4574,17 @@
4363
4574
  return;
4364
4575
  }
4365
4576
  if (!bytes.ok) { const why = await refused(bytes); if (!done()) status.textContent = why; return; }
4366
- const blob = await bytes.blob();
4367
- if (done()) return;
4368
- const url = URL.createObjectURL(blob);
4369
- view.picture(url);
4370
4577
  if (mime === 'application/pdf') {
4371
- const frame = document.createElement('iframe');
4372
- frame.className = 'ai-chat-source-viewer-pdf';
4373
- frame.setAttribute('aria-label', `${name}, as it was cited`);
4374
- frame.src = url;
4375
- body.append(frame);
4578
+ // #3018: FloLess draws these same verified bytes itself, never the browser's viewer in a frame, and never refetches.
4579
+ const data = new Uint8Array(await bytes.arrayBuffer());
4580
+ if (done()) return;
4581
+ view.pdf(window.flolessPdfView.mount(body, { bytes: data, name }));
4582
+ view.loaded();
4376
4583
  } else {
4584
+ const blob = await bytes.blob();
4585
+ if (done()) return;
4586
+ const url = URL.createObjectURL(blob);
4587
+ view.picture(url);
4377
4588
  const image = Object.assign(document.createElement('img'), { src: url, alt: name });
4378
4589
  if (!await view.mountDrawing().setImage(image, () => !done(), true)) return;
4379
4590
  view.loaded();
@@ -4417,6 +4628,17 @@
4417
4628
  changed: 'changed after this answer', removed: 'removed after this answer', unavailable: 'not available from this conversation now',
4418
4629
  'not-as-attached': 'no longer the file that was attached',
4419
4630
  };
4631
+ /**
4632
+ * #3039: a chosen source, by the same states: what FloLess found since it was chosen, said of the source, never of the
4633
+ * choice (the record stands as made). `chosenSince` names who chose it, as its chip does.
4634
+ */
4635
+ const CHOSEN_FOUND = { changed: 'Found: yes, but', removed: 'Found: no,', unavailable: 'Found: no,', 'not-as-attached': 'Found: no,' };
4636
+ function chosenSince(choice, seen) {
4637
+ const who = assumedWho({ assumedBy: choice.chosenBy });
4638
+ const since = who === 'you' ? 'since you chose it' : `since ${who} chose it`;
4639
+ return seen === 'changed' ? `changed ${since}` : seen === 'removed' ? `removed ${since}`
4640
+ : seen === 'unavailable' ? 'not available from this conversation now' : 'no longer the file that was chosen';
4641
+ }
4420
4642
  /** #3017: a decided claim's cited source, as what FloLess found when it checked, never that it still is so. */
4421
4643
  const GONE_SAID = { removed: 'was removed', unavailable: 'could not be reached from this conversation', 'not-as-attached': 'was no longer the file that was attached' };
4422
4644
  const PROBE_STATES = new Set(['same', 'changed', 'removed', 'unavailable', 'not-as-attached']);
@@ -4466,11 +4688,14 @@
4466
4688
 
4467
4689
  /**
4468
4690
  * #3017: what the viewer of a cited project file, attachment or member found, kept for its chip as the Knowledge file's
4469
- * is. A source the person chose has no AI chip to mark.
4691
+ * is. #3039: a source the person chose too, under its own record; its chip is drawn again from that.
4470
4692
  */
4471
4693
  function viewerFound(row, turnId, seen) {
4472
- if (row.entry.chosen || (seen !== 'same' && !SOURCE_MARKS[seen])) return;
4694
+ if (seen !== 'same' && !SOURCE_MARKS[seen]) return;
4473
4695
  seeSource(knowledgeFileKey(row), seen, Date.now());
4696
+ // A chosen source's chip is drawn from its own record, which this finding is now kept under. The chip at this claim
4697
+ // may by now be another one (the AI cited the claim since), so a chosen viewer never marks a chip in place.
4698
+ if (row.entry.chosen) { paintEvents(); return; }
4474
4699
  const chip = sourceChip(turnId, row.anchor);
4475
4700
  const wasGone = !!chip?.classList.contains('stale');
4476
4701
  markSourceChip(chip, seen, row.entry);
@@ -4488,7 +4713,7 @@
4488
4713
  const chatId = state.chat?.chatId;
4489
4714
  if (!chatId || !turnId || answerRunning(turnId)) return;
4490
4715
  const key = `${chatId}\u0000${turnId}`;
4491
- if (probedTurns.has(key) || ![...index.byAnchor.values()].some((row) => row.entry.status === 'resolved' && !row.entry.bare)) return;
4716
+ if (probedTurns.has(key) || ![...index.byAnchor.values()].some((row) => (row.entry.status === 'resolved' && !row.entry.bare) || row.choice)) return;
4492
4717
  probedTurns.add(key);
4493
4718
  const at = Date.now();
4494
4719
  request(`/api/chat/conversations/${encodeURIComponent(chatId)}/turns/${encodeURIComponent(turnId)}/source-states?${ownerQuery()}`).then((result) => {
@@ -4909,7 +5134,7 @@
4909
5134
  for (const live of statuses) if (live?.id) state.requestCards.set(live.id, live);
4910
5135
  // Only an authoritative removal retires transient state; folding or a conversation repaint does not.
4911
5136
  for (const live of statuses) if (live?.id && live.found === false) requestCardUi.delete(live.id);
4912
- // A hidden card's line reads these on the conversation's next repaint (the chat poll, every 5 s).
5137
+ // A hidden card's line reads these on the conversation's next repaint: the chat poll repaints when one changed (#3095).
4913
5138
  for (const card of ui.feed.querySelectorAll('.ai-chat-request-card[data-request-id]')) paintRequestCard(card);
4914
5139
  }
4915
5140
 
@@ -4972,7 +5197,9 @@
4972
5197
  }
4973
5198
  if (done.body?.code === 'request-held' && done.body.hold) { entry.busy = null; askStopThenDismiss(requestId, done.body.hold); return; }
4974
5199
  if (done.status === 404 || done.body?.code === 'request-already-set-aside') { void refreshRequestCards({ force: true }); return; }
4975
- cardNotice(requestId, done.body?.error || 'FloLess couldn’t dismiss that request. It is still in Requests; try Dismiss again.');
5200
+ cardNotice(requestId, personText(done.body) || (done.body?.diagnostic
5201
+ ? 'FloLess couldn’t tell whether that request was dismissed. Check Requests before trying Dismiss again.'
5202
+ : 'FloLess couldn’t dismiss that request. It is still in Requests; try Dismiss again.'));
4976
5203
  } catch {
4977
5204
  cardNotice(requestId, 'FloLess couldn’t reach the server, so the request was not dismissed. Try Dismiss again in a moment.');
4978
5205
  } finally {
@@ -5069,7 +5296,12 @@
5069
5296
  let restored = false;
5070
5297
  try {
5071
5298
  const done = await lifecycleCall(requestId, 'restore');
5072
- if (!done.ok) { cardNotice(requestId, done.body?.error || 'FloLess couldn’t put that request back. It is still in Requests → Done; try Undo again.'); return; }
5299
+ if (!done.ok) {
5300
+ cardNotice(requestId, personText(done.body) || (done.body?.diagnostic
5301
+ ? 'FloLess couldn’t tell whether that request was put back. Check Requests before trying Undo again.'
5302
+ : 'FloLess couldn’t put that request back. It is still in Requests → Done; try Undo again.'));
5303
+ return;
5304
+ }
5073
5305
  item = liveRequestCard(requestId);
5074
5306
  if (item) forgetHiddenRequestCard(item.dataset.cardEventId);
5075
5307
  await refreshRequestCards({ force: true });
@@ -5192,6 +5424,19 @@
5192
5424
  const label = document.createElement('strong');
5193
5425
  label.textContent = autoReceiptLabel(event);
5194
5426
  const payload = event.payload || {};
5427
+ if (payload.protectedCommand === true) {
5428
+ // A "don't ask again" choice let a protected command run: say so plainly, with the command in its tooltip.
5429
+ label.textContent = 'Ran without asking';
5430
+ const grant = String(payload.grantLabel || 'This exact command');
5431
+ const about = grant.startsWith('This exact command') ? 'this exact command' : `${grant.charAt(0).toLowerCase()}${grant.slice(1)}`;
5432
+ item.append(label, document.createTextNode(` · because you said not to ask again ${payload.scope === 'request' ? 'during this reply' : 'in this conversation'} about ${about}.`));
5433
+ // Newer servers send the command alone; an older receipt carried the card text cut short, often before its command.
5434
+ const summary = String(payload.summary || '');
5435
+ const command = summary.includes('\nCommand: ') ? summary.split('\nCommand: ').slice(1).join('\nCommand: ')
5436
+ : summary.includes('\nWhy: ') ? '' : summary;
5437
+ if (command) item.dataset.tip = command.slice(0, 300);
5438
+ return item;
5439
+ }
5195
5440
  const what = payload.scopeAdd ? `Added ${payload.scopeAdd.target?.kind || 'project'} “${payload.scopeAdd.label}” to this chat`
5196
5441
  : payload.create ? `Created the workflow “${payload.create.name}”`
5197
5442
  : String(payload.summary || payload.grantLabel || 'An action').slice(0, 200);
@@ -5661,6 +5906,78 @@
5661
5906
  return control;
5662
5907
  }
5663
5908
 
5909
+ /**
5910
+ * #3131 F2: an action's inputs exactly as they run: each key as it is spelled, each text as written, and a number, yes/no
5911
+ * or empty value as its literal (a text that reads like one is quoted), and a list says it is one, so two different
5912
+ * inputs never look the same.
5913
+ */
5914
+ function exactInputsTree(data) {
5915
+ const literal = (text) => assistantNode('span', 'ai-chat-action-input-literal', text);
5916
+ const value = (v) => {
5917
+ if (v !== null && typeof v === 'object') return exactInputsTree(v);
5918
+ if (typeof v !== 'string') return literal(JSON.stringify(v));
5919
+ return v === '' || v.trim() !== v || /^(true|false|null|-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?)$/.test(v) ? literal(JSON.stringify(v)) : document.createTextNode(v);
5920
+ };
5921
+ const list = document.createElement('dl');
5922
+ list.className = 'assistant-card-result-list';
5923
+ const entries = Array.isArray(data) ? data.map((v, i) => [`${i + 1}`, v]) : Object.entries(data);
5924
+ if (!entries.length) return literal(Array.isArray(data) ? '[]' : '{}');
5925
+ for (const [key, v] of entries) {
5926
+ const dd = document.createElement('dd');
5927
+ dd.append(value(v));
5928
+ list.append(assistantNode('dt', '', key), dd);
5929
+ }
5930
+ if (!Array.isArray(data)) return list;
5931
+ const items = document.createDocumentFragment();
5932
+ items.append(literal(`list of ${data.length}`), list);
5933
+ return items;
5934
+ }
5935
+
5936
+ /**
5937
+ * #3131 F2: every input the action uses, as FloLess stored it with the card: each value whole, or one too long to read
5938
+ * named by its size and fingerprint (and listed by name). The summary may be shortened; this never is, so what the person
5939
+ * confirms is what runs. Open from the start when the summary was cut or a value is named, and kept as the person left it
5940
+ * when the card repaints.
5941
+ */
5942
+ function actionInputs(payload, proposalId, summaryText, entry) {
5943
+ const inputs = payload.inputs;
5944
+ if (inputs === undefined || inputs === null || (typeof inputs === 'object' && !Object.keys(inputs).length)) return null;
5945
+ const named = Array.isArray(payload.inputsNamed) ? payload.inputsNamed.map(String) : [];
5946
+ const withheld = Array.isArray(payload.inputsWithheld) ? payload.inputsWithheld.map(String) : [];
5947
+ if (typeof entry.inputsOpen !== 'boolean') entry.inputsOpen = payload.summaryCut === true || named.length > 0;
5948
+ const wrap = document.createElement('div');
5949
+ wrap.className = 'ai-chat-action-inputs';
5950
+ const label = (open) => (open ? 'Hide exact inputs' : 'Show exact inputs');
5951
+ const toggle = actionButton(label(entry.inputsOpen), 'shell.chat-action-inputs', proposalId, summaryText, 'assistant-card-result-more');
5952
+ toggle.dataset.tip = 'Shows every input this action uses.';
5953
+ const body = assistantNode('div', 'assistant-card-result-body assistant-card-result-full ai-chat-action-inputs-body');
5954
+ body.id = `ai-chat-action-inputs-${proposalId}`;
5955
+ body.tabIndex = 0;
5956
+ body.setAttribute('role', 'group');
5957
+ body.setAttribute('aria-label', 'Exact inputs');
5958
+ if (payload.summaryCut === true) body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note', 'The summary above is shortened. Every input this action uses is listed here.'));
5959
+ if (named.length) {
5960
+ body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note',
5961
+ `Too long to show here, but sent whole: ${named.join(', ')}. Each is named by its size and a fingerprint of its exact content.`));
5962
+ }
5963
+ if (withheld.length) {
5964
+ body.append(assistantNode('p', 'ai-chat-filter-note ai-chat-action-inputs-note',
5965
+ `Not shown because it looks like a password or key, but sent as given: ${withheld.join(', ')}.`));
5966
+ }
5967
+ body.append(typeof inputs === 'object' ? exactInputsTree(inputs) : assistantNode('p', 'ai-chat-filter-note', String(inputs)));
5968
+ const show = (open) => {
5969
+ entry.inputsOpen = open;
5970
+ body.hidden = !open;
5971
+ toggle.textContent = label(open);
5972
+ toggle.setAttribute('aria-expanded', String(open));
5973
+ };
5974
+ toggle.setAttribute('aria-controls', body.id);
5975
+ toggle.addEventListener('click', () => show(!entry.inputsOpen));
5976
+ show(entry.inputsOpen);
5977
+ wrap.append(toggle, body);
5978
+ return wrap;
5979
+ }
5980
+
5664
5981
  /**
5665
5982
  * Show one connection in its project's model editor, selected and framed (#2450). Resolves the editor's
5666
5983
  * own outcome (see `openConnection` in workspaces.js), or null when the shell cannot do it here. Throws
@@ -5960,6 +6277,8 @@
5960
6277
  terms.append(label, document.createTextNode(String(payload.terms)));
5961
6278
  card.append(terms);
5962
6279
  }
6280
+ const inputs = actionInputs(payload, proposalId, summaryText, entry);
6281
+ if (inputs) card.append(inputs);
5963
6282
 
5964
6283
  if (handedOver) {
5965
6284
  card.classList.add('is-handed-over');
@@ -6961,7 +7280,9 @@
6961
7280
  note: 'Opens New workflow with its name filled in. Nothing is built until you confirm there.' };
6962
7281
  // An Open card only shows a page: there is no next step to confirm.
6963
7282
  case 'open':
6964
- return guideText ? { ...guideText, note: 'This only opens the page. Nothing changes.' } : null;
7283
+ // #3082: an Open card for one project or workflow opens that, not a page.
7284
+ return guideText ? { ...guideText, note: move.project ? 'This only opens the project. Nothing changes.'
7285
+ : move.workflow ? 'This only opens the workflow. Nothing changes.' : 'This only opens the page. Nothing changes.' } : null;
6965
7286
  default:
6966
7287
  return guideText ? { ...guideText, note: 'Nothing happens until you confirm in the next step.' } : null;
6967
7288
  }
@@ -7430,12 +7751,18 @@
7430
7751
  let opened = false;
7431
7752
  // #2520: a screen that refuses in its own words (a connection no longer in the model) says that, not the generic line.
7432
7753
  let refused = '';
7754
+ let said = '';
7433
7755
  try {
7434
7756
  if (answer.outcome === 'screen') opened = await openActionScreen(answer.screen);
7435
7757
  else if (answer.move?.kind === 'create-workflow' && typeof window.flolessBridge?.newWorkflow === 'function') {
7436
7758
  opened = true;
7437
7759
  void window.flolessBridge.newWorkflow({ name: answer.move.name });
7438
- } else if (answer.move) opened = Boolean(await window.flolessGuide?.openFlow?.(answer.move));
7760
+ } else if (answer.move) {
7761
+ const outcome = await window.flolessGuide?.openFlow?.(answer.move);
7762
+ opened = Boolean(outcome);
7763
+ // #3082: a project that opened at another step than the card named says so.
7764
+ if (typeof outcome?.said === 'string' && outcome.said) { said = outcome.said; }
7765
+ }
7439
7766
  } catch (error) {
7440
7767
  if (error?.plain === true && error.message) refused = error.message;
7441
7768
  else console.warn('[assistant] a suggestion could not open its place:', error);
@@ -7447,8 +7774,9 @@
7447
7774
  entry.focus = 'status'; repaintAssistantCard(entry); return;
7448
7775
  }
7449
7776
  entry.fold = null;
7777
+ if (said) { entry.error = said; entry.focus = 'status'; }
7450
7778
  repaintAssistantCard(entry);
7451
- announce(`Opened: ${title}.`);
7779
+ announce(said || `Opened: ${title}.`);
7452
7780
  }
7453
7781
 
7454
7782
  /** The follow-up into a box that holds something else, as the person chose: below it, or instead of it. Never sends. */
@@ -7832,6 +8160,37 @@
7832
8160
  announce(`${kind.label} card expanded.`);
7833
8161
  }
7834
8162
 
8163
+ /**
8164
+ * #3095: the 5 s poll leaves an unchanged conversation as it is, yet every card in it keeps itself current, as the old
8165
+ * redraw on every poll did: each card is drawn again, which runs its own live reads (a height question's, a connection's,
8166
+ * an action's, a filter suggestion's). A folded card's line is updated where it is. A card that did not change is the
8167
+ * very same node, or one its renderer built anew that says exactly what the one on screen says (isEqualNode), and is
8168
+ * left where it is. Any other change (a card that changed, folded by itself once settled, came back, or is new) redraws
8169
+ * the conversation, whose redraw keeps the keyboard, the caret and the scroll where they were.
8170
+ */
8171
+ function refreshFeedCardsInPlace() {
8172
+ const shown = new Map([...ui.feed.querySelectorAll('[data-event-id]')].map((item) => [item.dataset.eventId, item]));
8173
+ let changed = false;
8174
+ for (const event of state.events) {
8175
+ if (!feedCardKind(event)) continue;
8176
+ const node = renderEvent(event);
8177
+ if (!node) continue;
8178
+ const id = event.eventId;
8179
+ const open = feedCardShells.get(id);
8180
+ if (open?.isConnected) {
8181
+ if (open.firstElementChild !== node && !open.firstElementChild?.isEqualNode(node)) changed = true;
8182
+ continue;
8183
+ }
8184
+ if (feedCardLines.get(id)?.isConnected) {
8185
+ if (feedCard(node, event) !== feedCardLines.get(id)) changed = true; // still folded: its line was updated in place
8186
+ continue;
8187
+ }
8188
+ const current = shown.get(id); // a card that comes as it is (a one-line row)
8189
+ if (current !== node && !current?.isEqualNode(node)) changed = true;
8190
+ }
8191
+ if (changed) paintEvents();
8192
+ }
8193
+
7835
8194
  function renderEvent(event) {
7836
8195
  if (event.type === 'height-question-state') { applyHeightQuestionState(event); return null; }
7837
8196
  if (event.type === 'user-message' && event.payload?.source === 'request' && event.payload?.filterAi) return renderFilterQuestion(event);
@@ -8109,13 +8468,41 @@
8109
8468
  const heightInModelValue = (mm, units) => (displayUnitsModule ? displayUnitsModule.formatElevation(mm, units) : `${Math.round(mm)} mm`);
8110
8469
  const heightInModelText = (snapshot, units) => {
8111
8470
  if (!snapshot) return '';
8112
- if (snapshot.state === 'unknown' || typeof snapshot.value !== 'number') return 'In the model when asked: no height.';
8471
+ if (snapshot.state === 'unknown' || typeof snapshot.value !== 'number') {
8472
+ const drawn = heightDrawnText(snapshot, units);
8473
+ return `In the model when asked: no height.${drawn ? ` ${drawn}` : ''}`;
8474
+ }
8113
8475
  const value = heightInModelValue(snapshot.value, units);
8114
8476
  const tail = snapshot.state === 'assumed' ? ' (placed, not from the drawings)' : snapshot.state === 'answered' ? ' (your earlier answer)'
8115
8477
  // #2521: chosen by the AI in a Quick model build. Said plainly, so the person never takes it for a drawn height.
8116
8478
  : snapshot.state === 'decided' ? ' (chosen by the AI in the Quick model, not from the drawings or you)' : '';
8117
- return `In the model when asked: ${value}${tail}.`;
8479
+ const drawn = heightDrawnText(snapshot, units);
8480
+ return `In the model when asked: ${value}${tail}.${drawn ? ` ${drawn}` : ''}`;
8118
8481
  };
8482
+ /*
8483
+ * #2628 slice B: what this read's drawings state for an existing member's end, beside the height the model holds. ONE
8484
+ * helper, through `heightInModelText`, for every surface a person answers on (the card, the tray, several together),
8485
+ * so none can show the held height without the drawings. The server decides `prior`; this only words it.
8486
+ */
8487
+ const HEIGHT_DRAWN_TOLERANCE_MM = 0.5; // drawn-height-conflict.ts OVER_DRAWING_TOLERANCE_MM
8488
+ function heightDrawnText(snapshot, units) {
8489
+ const drawn = snapshot?.drawn;
8490
+ if (!drawn) return '';
8491
+ if (drawn.state === 'unchecked') return 'FloLess has not checked this end against this read’s drawings.';
8492
+ if (drawn.state === 'none') return drawn.complete ? 'FloLess found no drawn height for this end in this read.' : 'FloLess could not read the drawn heights for this end.';
8493
+ const { low, high, observations } = drawn.stated;
8494
+ const lowText = heightInModelValue(low, units), highText = heightInModelValue(high, units);
8495
+ const range = `${lowText === highText ? lowText : `${lowText} to ${highText}`} (${observations} ${observations === 1 ? 'reading' : 'readings'})`;
8496
+ const held = typeof snapshot.value === 'number' ? snapshot.value : null;
8497
+ const differs = held !== null && (Math.abs(held - low) > HEIGHT_DRAWN_TOLERANCE_MM || Math.abs(held - high) > HEIGHT_DRAWN_TOLERANCE_MM);
8498
+ // UX review: say what the drawings differ from or match; "now" only where something did change since an answer.
8499
+ const said = drawn.prior === 'changed' ? `The drawings now give ${range}; they have changed since your earlier answer.`
8500
+ : drawn.prior === 'unrecorded' ? `The drawings now give ${range}. FloLess did not record which drawings you answered against, so they may have changed.`
8501
+ : drawn.prior === 'acknowledged' ? `The drawings give ${range}, the same drawings you answered against.`
8502
+ : held === null ? `The drawings give ${range}.`
8503
+ : differs ? `The drawings give ${range}, which differs from the model’s height.` : `The drawings give ${range}, matching the model’s height.`;
8504
+ return drawn.complete ? said : `${said} FloLess could not read every drawn height for this end, so others may exist.`;
8505
+ }
8119
8506
  const HEIGHT_PROPOSED_TEXT = 'Proposed in the review; the model changes only if you accept it there.';
8120
8507
  // The server's sentence, then what to do next when it names a step (a damaged record says to discard the read).
8121
8508
  const heightErrorText = (error, fallback) => {
@@ -8781,7 +9168,13 @@
8781
9168
  if (response.status === 410) text = 'no longer available';
8782
9169
  else if (!response.ok) {
8783
9170
  const body = (response.headers.get('content-type') || '').includes('application/json') ? await response.json().catch(() => null) : null;
8784
- text = body?.error ? `could not be shown: ${body.error}` : `could not be shown (FloLess answered ${response.status})`;
9171
+ // #3097: the server's own sentence when it wrote one; otherwise why and what to do, never the status number.
9172
+ const said = personText(body);
9173
+ if (!said) console.warn('[chat] a recorded picture could not be shown', url, response.status, body?.error || '');
9174
+ // The shared sentence's cause and next step; for an unexplained failure its "couldn’t tell why" is kept too.
9175
+ const parts = said ? null : failureParts({ status: response.status, body: body || {} }, { action: 'show this picture', retrySafe: true });
9176
+ text = said ? `could not be shown: ${said}`
9177
+ : `could not be shown${parts.kind === 'unexpected' ? ', and FloLess couldn’t tell why' : ''}. ${parts.detail}`;
8785
9178
  }
8786
9179
  } catch { text = 'could not be shown: FloLess did not answer. Make sure it is still running.'; }
8787
9180
  slot.textContent = text;
@@ -10527,14 +10920,14 @@
10527
10920
  }
10528
10921
 
10529
10922
  // paintEvents rebuilds every control in the feed, so a control that held keyboard focus is put
10530
- // back on its replacement. The empty state's sign-in is one of them: the repaint that follows its
10923
+ // back on its replacement. The empty state's and a failed reply's error-row sign-in are among them: the repaint that follows its
10531
10924
  // own click would otherwise drop focus to the page just as it turns to "Sign-in window open".
10532
10925
  // That button is `aria-disabled`, not `disabled`, so it passes the filter (#1514).
10533
10926
  function restoreFeedFocus(focusedCommand) {
10534
10927
  if (!focusedCommand?.startsWith('shell.chat-followup-') && !focusedCommand?.startsWith('shell.chat-filter-')
10535
10928
  && !focusedCommand?.startsWith('shell.chat-question') && !focusedCommand?.startsWith('shell.chat-height-')
10536
10929
  && !focusedCommand?.startsWith('shell.chat-setup-') && !focusedCommand?.startsWith('shell.chat-answer-')
10537
- && focusedCommand !== 'shell.chat-sign-in') return null;
10930
+ && focusedCommand !== 'shell.chat-sign-in' && focusedCommand !== 'shell.chat-error-sign-in') return null;
10538
10931
  const control = [...ui.feed.querySelectorAll('[data-command-id]')]
10539
10932
  .find(control => control.dataset.commandId === focusedCommand && !control.disabled);
10540
10933
  control?.focus({ preventScroll: true });
@@ -10542,6 +10935,7 @@
10542
10935
  }
10543
10936
 
10544
10937
  function paintEvents(options = {}) {
10938
+ state.feedDrawn = false; // #3095: until the end below, so a draw that throws part-way is drawn again by the next poll
10545
10939
  announceLiveResponseOnce();
10546
10940
  const focusedCommand = ui.feed.contains(document.activeElement)
10547
10941
  ? document.activeElement?.dataset?.commandId : null;
@@ -10554,6 +10948,9 @@
10554
10948
  const focusedChip = chipNode ? { turnId: chipNode.dataset.turnId, anchor: chipNode.dataset.anchor, command: focusedNode.dataset?.commandId || '' } : null;
10555
10949
  // #3001: an answer's control for its numbers with no marker is rebuilt with the answer: the keyboard stays on that answer's.
10556
10950
  const focusedUncited = focusedNode?.closest?.('.ai-chat-uncited-row')?.dataset.answerKey ?? null;
10951
+ // #3039: a message the person clicked (it takes focus to be read or explained) stays theirs when a late source check
10952
+ // repaints its answer: the keyboard stays on the same message, never dropped to the page.
10953
+ const focusedMessage = focusedNode?.matches?.('.ai-chat-message[data-event-id]') ? focusedNode.dataset.eventId : null;
10557
10954
  if (options.forceBottom) state.feedLeftEnd = false; // the person just sent: the end is where they are going
10558
10955
  const nearBottom = !state.feedLeftEnd && ui.feed.scrollHeight - ui.feed.scrollTop - ui.feed.clientHeight < 56;
10559
10956
  const scrollTop = ui.feed.scrollTop;
@@ -10595,6 +10992,7 @@
10595
10992
  if (node) { if (links.length && links[0].turnId !== turnId) flushLinks(); links.push({ turnId, node }); }
10596
10993
  };
10597
10994
  const flushLinks = () => { if (links.length) { ui.feed.append(...receiptFold(links)); links = []; } };
10995
+ const signInError = errorNeedingSignIn();
10598
10996
  for (const event of state.events) {
10599
10997
  // #2642/#2643: the person's assumption or chosen source is painted on its claim's chip; it never starts or ends an answer group (it has no turn).
10600
10998
  if (event.type === 'citation-assumption' || event.type === 'citation-choice') continue;
@@ -10666,6 +11064,7 @@
10666
11064
  // #2678: a card comes in its shell, with its chevron, or as the one line it left (an ordinary message or a one-line row comes
10667
11065
  // as it is).
10668
11066
  const node = feedCard(renderEvent(event), event);
11067
+ if (node && event === signInError) node.append(errorSignIn(event));
10669
11068
  if (node) ui.feed.append(node);
10670
11069
  if (event.type === 'assistant-message') holdUncitedClaims(event.turnId);
10671
11070
  }
@@ -10706,6 +11105,10 @@
10706
11105
  // #2678: the card folded by itself (answered) under the keyboard: the keyboard stays with it, on its line.
10707
11106
  refocused = feedCardLines.get(focusedShell.feedCardId);
10708
11107
  refocused.focus({ preventScroll: true });
11108
+ } else if (focusedMessage) {
11109
+ refocused = [...ui.feed.querySelectorAll('.ai-chat-message[data-event-id]')].find((node) => node.dataset.eventId === focusedMessage) ?? null;
11110
+ if (refocused) refocused.focus({ preventScroll: true });
11111
+ else refocused = restoreFeedFocus(focusedCommand);
10709
11112
  } else refocused = restoreFeedFocus(focusedCommand);
10710
11113
  // #2643: an open "Choose a source…" list lives outside the feed, so a repaint keeps it (and what is typed in it); it
10711
11114
  // follows its claim's rebuilt chip, and closes with its conversation.
@@ -10734,6 +11137,7 @@
10734
11137
  }
10735
11138
  updateOffscreenActivity();
10736
11139
  });
11140
+ state.feedDrawn = true;
10737
11141
  }
10738
11142
 
10739
11143
  // The feed's empty state. Four cases, in the order they must win: a sign-in window FloLess
@@ -10818,6 +11222,51 @@
10818
11222
  return signIn;
10819
11223
  }
10820
11224
 
11225
+ // Owner, 2026-11-04: a reply that failed because Claude could not sign in must offer the sign-in right there. The
11226
+ // newest error in a Claude conversation, written after the newest message the person sent, whose sentence tells them
11227
+ // to sign in to Claude, while nothing is running or held in recovery: that error carries the same sign-in as the empty
11228
+ // state (one switchAccount(), one pending set). Receipts the failed turn writes after it (a queued follow-up marked not
11229
+ // sent) do not move on from it; a new message does, so an older error stays text only. Keyed on the sentence
11230
+ // errorMessage wrote, so the button appears exactly where the advice to sign in does.
11231
+ //
11232
+ // Owner ruling, 2026-11-04: a busy renewal (another Claude process holds it; it clears within a minute) offers the
11233
+ // button only when it has happened before in this conversation, as its own sentence says ("If it keeps happening").
11234
+ // Signing in signs Claude Code out first, and that sign-in is shared with every Claude Code session on the computer,
11235
+ // so a one-off transient lock must not invite signing them all out.
11236
+ function errorNeedingSignIn() {
11237
+ const chat = state.chat;
11238
+ if (chat?.provider !== 'claude' || chat.activeTurn || chat.state === 'recovery' || turnIsVisiblyActive()) return null;
11239
+ const advice = (event) => event.type === 'error' && event.payload?.plain !== true ? errorMessage(payloadText(event)) : '';
11240
+ // An earlier busy renewal counts whatever became of it; it is the evidence that it keeps happening.
11241
+ const renewing = (event) => advice(event).startsWith('Claude couldn’t finish renewing its sign-in');
11242
+ const lastMessage = state.events.findLastIndex((event) => event.type === 'user-message');
11243
+ const index = state.events.findLastIndex((event) => event.type === 'error');
11244
+ const error = index > lastMessage ? state.events[index] : null;
11245
+ // The error the button sits on must be a turn FloLess knows has ended (outcome failed): one left by a recovery the
11246
+ // person ended is of unknown outcome, and "send your message again" is not advice to give over it.
11247
+ if (error?.payload?.outcome !== 'failed' || !/\bsign in to Claude again\b/i.test(advice(error))) return null;
11248
+ if (renewing(error) && !state.events.slice(0, index).some(renewing)) return null;
11249
+ return error;
11250
+ }
11251
+
11252
+ // Its own command id: its own carrier, in its own place (the empty state's rule). Once a sign-in landed after this
11253
+ // error, and Claude still reads as signed in, the error says so instead: another click would sign the CLI out again
11254
+ // for nothing. Both times come from this computer's clock.
11255
+ function errorSignIn(error) {
11256
+ const landedAt = state.signInLandedAt.get('claude') || 0;
11257
+ if (landedAt > Date.parse(error.createdAt || '') && capabilityAnswer(state.capability).state !== 'signed-out') {
11258
+ const done = document.createElement('div');
11259
+ done.className = 'ai-chat-error-signin-done';
11260
+ done.setAttribute('role', 'status');
11261
+ done.textContent = 'Signed in. Send your message again.';
11262
+ return done;
11263
+ }
11264
+ const signIn = emptySignInButton(providerLabels.claude || 'Claude', state.signInPending.has('claude'));
11265
+ signIn.className = 'ai-chat-provider-switch ai-chat-error-signin';
11266
+ signIn.dataset.commandId = 'shell.chat-error-sign-in';
11267
+ return signIn;
11268
+ }
11269
+
10821
11270
  /*
10822
11271
  * Owner, 2026-10-23: "Any card should have that functionality". An approval, a proposal or the AI's own question above the
10823
11272
  * message box hides to one line by hand (× or Esc), like a drawing read's card. Hiding answers, allows or denies nothing:
@@ -11010,12 +11459,19 @@
11010
11459
  // block, exactly as it will run (spacing kept, long tokens wrapped, a long one scrolls). Nothing else is split.
11011
11460
  const commandAt = approval.protectedCommand === true && !connector ? approval.summary.indexOf('\nCommand: ') : -1;
11012
11461
  if (commandAt >= 0) {
11013
- copy.textContent = approval.summary.slice(0, commandAt);
11462
+ // #2893: a newer server puts one "\nWhy: <which part matched, and why>" line before the command.
11463
+ const head = approval.summary.slice(0, commandAt);
11464
+ const matchedAt = head.indexOf('\nWhy: ');
11465
+ copy.textContent = matchedAt >= 0 ? head.slice(0, matchedAt) : head;
11014
11466
  // #2224 item 1: why it asks although actions may be approved for this request or conversation.
11015
11467
  const why = document.createElement('p');
11016
11468
  why.className = 'ai-chat-approval-note';
11017
- why.textContent = 'This command names, or could match, a workflow’s approved lock, record or conversations, so FloLess '
11018
- + 'asks every time, even when actions are approved for this request or conversation.';
11469
+ // A card FloLess can remember says how to stop the question; one that names a record asks every time.
11470
+ const always = protectedGrantable(approval)
11471
+ ? 'Approve for this request or conversation also lets this exact command run again without asking.'
11472
+ : 'FloLess asks every time about this one: a wider choice covers your other actions and approves just this command.';
11473
+ why.textContent = matchedAt >= 0 ? `${head.slice(matchedAt + '\nWhy: '.length)} ${always}`
11474
+ : `This command names, or might reach, a workflow’s approved version, its approval record or its saved chats. ${always}`;
11019
11475
  nodes.push(why);
11020
11476
  const block = document.createElement('pre');
11021
11477
  block.className = 'ai-chat-approval-cmd';
@@ -11566,6 +12022,17 @@
11566
12022
  return list;
11567
12023
  }
11568
12024
 
12025
+ /**
12026
+ * The server's reading of a protected command when a "don't ask again" choice may remember it (the same rule as
12027
+ * `protectedGrantKey` in server/chat-approval-grants.ts), else null: a command that names a record, one whose folder is
12028
+ * unknown, or a card from a server that sent no reading, keeps today's choices.
12029
+ */
12030
+ function protectedGrantable(approval) {
12031
+ const analysis = approval?.protectedCommand === true ? approval.protectedAnalysis : null;
12032
+ if (!analysis || analysis.v !== 1 || analysis.namesRecord !== false || analysis.pinned !== true) return null;
12033
+ return analysis;
12034
+ }
12035
+
11569
12036
  /*
11570
12037
  * Epic #2185 Slice A (owner ruling 7): EVERY approval card offers Deny, Approve once, Approve for this request and
11571
12038
  * Approve for this conversation. `approvalOffer` says, for the card on screen, exactly WHAT each wider choice covers (the
@@ -11581,12 +12048,20 @@
11581
12048
  const create = approval.create && typeof approval.create === 'object' ? approval.create : null;
11582
12049
  const check = approval.connectionCheck && typeof approval.connectionCheck === 'object' ? approval.connectionCheck : null;
11583
12050
  const connector = approval.connector && typeof approval.connector === 'object' ? approval.connector : null;
11584
- // #2196 follow-up: a command that names, or could match, a workflow's records is outside every grant. Its card keeps
11585
- // the full set of choices (owner ruling 7), and the wider ones say plainly that they approve THIS command once and
11586
- // cover other actions only.
12051
+ // #2196 follow-up: a command that names, or might reach, a workflow's records is outside every ordinary grant. Its card
12052
+ // keeps the full set of choices (owner ruling 7). A card FloLess can remember (plan 2026-11-03, "don't ask again")
12053
+ // offers exactly that; one that names a record approves THIS command once and covers other actions only.
11587
12054
  const protectedCommand = approval.protectedCommand === true
11588
- ? { protectedNote: ' This command is approved once: a command that names or could match a workflow’s records still asks every time.' } : {};
12055
+ ? { protectedNote: ' This command is approved once. FloLess asks again whenever a command names, or might reach, a workflow’s approved version, its approval record or its saved chats.' } : {};
11589
12056
  const base = { requestRevision, decision: 'allow-chat', warning: '', ...protectedCommand };
12057
+ if (protectedGrantable(approval)) {
12058
+ // The click also approves the command on screen: say so first (UX review). Only the identical command, in the same
12059
+ // folder, is remembered (server: protectedGrantKey).
12060
+ return { ...base, kind: 'protected', key: 'protected', revision: chat.approvalGrants?.revision ?? 0,
12061
+ what: 'Approve this and don’t ask again for this exact command',
12062
+ protectedNote: ' Any other command, even a small edit to this one, still asks. Commands that name a workflow’s approved version, its approval record or its saved chats always ask.',
12063
+ commandId: 'shell.chat-approval-grant-chat', instance: 'this exact command' };
12064
+ }
11590
12065
  const PROTECTED_NOTE = ' A workflow’s own records (its .lock, settings and conversations) always ask.';
11591
12066
  if (change) {
11592
12067
  if (change.refused || change.busy) return null;
@@ -12682,9 +13157,10 @@
12682
13157
  const snapshot = captureChat();
12683
13158
  const before = answerKey(state.capability?.account);
12684
13159
  state.signInPending.add(chat.provider);
12685
- // Both carriers of this action flip to waiting at the click, not at the next 5 s poll — the
13160
+ // Every carrier of this action flips to waiting at the click, not at the next 5 s poll — the
12686
13161
  // settings strip to "Waiting for sign-in…", the empty state to its "Waiting for sign-in…" title
12687
- // over a "Sign-in window open" button: that button is the one a new user just pressed.
13162
+ // over a "Sign-in window open" button (that button is the one a new user just pressed), and a
13163
+ // failed reply's error row to its own "Sign-in window open".
12688
13164
  paintSettings(); paintEvents();
12689
13165
  try {
12690
13166
  await request(`/api/terminal-runtimes/${encodeURIComponent(chat.provider)}/sign-in`, { method: 'POST' });
@@ -12692,7 +13168,8 @@
12692
13168
  // much of the empty state a short panel still paints (#1514). Only now: before this await
12693
13169
  // resolves there is no window to point at.
12694
13170
  if (sameChat(snapshot)) announce(`Waiting for sign-in. Finish signing in to ${providerLabels[chat.provider] || 'AI'} using the window FloLess opened.`);
12695
- await waitForSignIn(chat.provider, before);
13171
+ // A sign-in that landed answers an error that asked for it (errorSignIn): that error stops offering another one.
13172
+ if (await waitForSignIn(chat.provider, before)) state.signInLandedAt.set(chat.provider, Date.now());
12696
13173
  if (sameChat(snapshot)) await loadCapability();
12697
13174
  } catch (error) {
12698
13175
  const code = String(error && error.code || '');
@@ -12707,7 +13184,8 @@
12707
13184
  state.signInPending.delete(chat.provider);
12708
13185
  // This runs outside every try above, and the click handler calls switchAccount() with `void`:
12709
13186
  // a throw from the repaint would surface as an unhandled rejection with nothing to catch it.
12710
- // The feed's empty state carries the same button and the waiting copy, so it repaints too.
13187
+ // The feed's empty state carries the same button and the waiting copy, and so does a failed reply's error row, so
13188
+ // the feed repaints too.
12711
13189
  try { if (sameChat(snapshot)) { paintSettings(); paintEvents(); updateSendState(); } } catch (error) {
12712
13190
  console.warn('floless: could not repaint the provider row after a sign-in', error);
12713
13191
  }
@@ -12737,8 +13215,9 @@
12737
13215
  if (answer.state === 'unknown') continue;
12738
13216
  // A 'signed-out' is FloLess's own doing (above), not the sign-in the user went off to make.
12739
13217
  if (answer.state === 'signed-out') { signedOutSeen = true; continue; }
12740
- if (signedOutSeen || answerKey(answer) !== before) return;
13218
+ if (signedOutSeen || answerKey(answer) !== before) return true;
12741
13219
  }
13220
+ return false;
12742
13221
  }
12743
13222
 
12744
13223
  /**
@@ -13277,7 +13756,12 @@
13277
13756
  if (index >= 0) state.chats[index] = chat;
13278
13757
  paintConversation();
13279
13758
  if (reconnect) connectEvents();
13280
- } catch (error) { if (sameChat(snapshot)) report(error, 'Could not refresh chat'); }
13759
+ } catch (error) {
13760
+ if (!sameChat(snapshot)) return;
13761
+ // #3123: a timeout here means FloLess is busy, not stopped, and what the person already sees stays.
13762
+ if (error?.code === 'local-timeout') report(error, '', { 'local-timeout': 'FloLess is busy, so this conversation hasn’t refreshed yet. Your messages are still here. Reopen the conversation in a moment to see anything new.' });
13763
+ else report(error, 'Could not refresh chat');
13764
+ }
13281
13765
  }
13282
13766
 
13283
13767
  function showConversationLoading(chatId) {
@@ -13501,7 +13985,8 @@
13501
13985
  if (generation !== state.scopeGeneration) return;
13502
13986
  state.chats = result.chats || [];
13503
13987
  state.unreadableChats = result.unreadableChats || []; noteMovedChats(result.movedChats);
13504
- seedReadCursors(state.chats, scope.owner);
13988
+ await seedReadCursors(state.chats, scope.owner);
13989
+ if (generation !== state.scopeGeneration) return;
13505
13990
  paintHistory(); paintUnread();
13506
13991
  // #2007: a scope may name the conversation it is for (an agent run's); otherwise the newest one opens.
13507
13992
  const wanted = scope.chatId && state.chats.some((chat) => chat.chatId === scope.chatId) ? scope.chatId : state.chats[0]?.chatId;
@@ -13537,7 +14022,7 @@
13537
14022
  // project was opened in this browser, or its units cannot be read: then the conversation suggests nothing.
13538
14023
  async function lastProjectUnits() {
13539
14024
  let projectId = null;
13540
- try { projectId = localStorage.getItem('floless:last-project'); } catch { /* private mode: no suggestion */ }
14025
+ try { projectId = window.flolessPrefs ? window.flolessPrefs.get('lastProject') : localStorage.getItem('floless:last-project'); } catch { /* private mode: no suggestion */ }
13541
14026
  if (!projectId) return null;
13542
14027
  try {
13543
14028
  const body = await request(`/api/projects/${encodeURIComponent(projectId)}/display-units`);
@@ -14131,6 +14616,10 @@
14131
14616
  if (code === 'scope-missing' && row?.integration === 'google-workspace') {
14132
14617
  return 'This account was connected without permission to read these files. In Integrations, tick the Drive file list on Google Workspace and click Reconnect.';
14133
14618
  }
14619
+ // #2466: a Microsoft sign-in made before FloLess asked for the chat reads.
14620
+ if (code === 'scope-missing' && row?.integration === 'microsoft-365') {
14621
+ return 'This Microsoft 365 account was signed in before FloLess asked for these permissions. Open Integrations and click Reconnect.';
14622
+ }
14134
14623
  if (Object.hasOwn(INTEGRATION_REASON_COPY, code)) return INTEGRATION_REASON_COPY[code];
14135
14624
  const raw = String(row?.reason || '');
14136
14625
  if (!raw) return 'This connected account is unavailable.';
@@ -16281,11 +16770,42 @@
16281
16770
  }
16282
16771
  await recheckManagedCopy(scope, generation);
16283
16772
  if (!sameScope(scope, generation)) return;
16284
- if (state.chat) { paintSettings(); paintRecovery(); paintApproval(); paintEvents(); updateSendState(); }
16773
+ if (state.chat) {
16774
+ paintSettings(); paintRecovery(); paintApproval();
16775
+ // #3095: the feed is rebuilt only when something it draws from changed since the last poll; otherwise every
16776
+ // node the person is reading, pointing at or has selected stays, and only the cards' own live reads run.
16777
+ const feedKey = feedPollKey();
16778
+ // A draw that failed part-way, here or anywhere else, left the feed unfinished: it is drawn again whatever the key says.
16779
+ if (feedKey === null || feedKey !== state.feedPollKey || !state.feedDrawn) { paintEvents(); state.feedPollKey = feedKey; }
16780
+ else {
16781
+ try { refreshFeedCards(); } catch (error) { console.warn('floless: the chat cards could not read their state again', error); }
16782
+ }
16783
+ updateSendState();
16784
+ }
16285
16785
  if (state.historyOpen && state.historyFilter === 'instructor-answers') refreshInstructorAnswers();
16286
16786
  } catch { /* SSE or the next poll will recover */ }
16287
16787
  }
16288
16788
 
16789
+ // #3095: what the conversation shows, outside its cards, that can change without anything painting it: the record (its
16790
+ // active turn, state, approval), who answers and whether it is ready, a sign-in window, the live connection, the events.
16791
+ // The cards keep themselves current (refreshFeedCards). Everything else that changes the feed (a streamed word, a card
16792
+ // answered, a source checked) repaints it itself. A record that cannot be written down has no key, and the poll
16793
+ // repaints as it always did.
16794
+ function feedPollKey() {
16795
+ const last = state.events.at(-1);
16796
+ try {
16797
+ return JSON.stringify([state.chat, state.capability, state.events.length, last?.eventId ?? null, last?.sequence ?? null,
16798
+ Boolean(state.chat?.provider && state.signInPending.has(state.chat.provider)), state.source?.readyState ?? null]);
16799
+ } catch { return null; }
16800
+ }
16801
+
16802
+ // #3095: what the redraw on every poll did for the cards, without the redraw: the request cards read their live state,
16803
+ // and every card is drawn again in place (refreshFeedCardsInPlace).
16804
+ function refreshFeedCards() {
16805
+ void refreshRequestCards();
16806
+ refreshFeedCardsInPlace();
16807
+ }
16808
+
16289
16809
  // #1657: FloLess's own copy of this conversation's AI can be moved away, or start re-installing, while
16290
16810
  // the conversation is open — and nothing else re-reads the capability, so the chat kept an enabled
16291
16811
  // Send and no setup card. The managed-runtimes read is cheap (no CLI launch). Only when this AI's copy
@@ -16927,7 +17447,9 @@
16927
17447
  const revoke = button('Revoke', grant.which === 'request' ? 'shell.chat-request-grant-revoke' : 'shell.chat-approval-grant-revoke', 'ai-chat-connector-revoke');
16928
17448
  revoke.dataset.commandInstanceLabel = grant.label;
16929
17449
  revoke.setAttribute('aria-label', `Revoke: ${grant.label}, ${grant.which === 'request' ? 'this reply' : 'this conversation'}`);
16930
- revoke.dataset.tip = `${grant.label} will ask you again. Something already approved may finish.`;
17450
+ revoke.dataset.tip = grant.kind === 'protected'
17451
+ ? 'This command will ask you again. Something already approved may finish.'
17452
+ : `${grant.label} will ask you again. Something already approved may finish.`;
16931
17453
  revoke.disabled = state.grantRevoking === id;
16932
17454
  revoke.addEventListener('click', () => { void revokeApprovalGrant(grant); });
16933
17455
  pill.append(name, revoke);
@@ -17605,6 +18127,15 @@
17605
18127
  currentProvider: () => state.chat?.provider ?? null,
17606
18128
  // #2926: the conversation on screen, so the Drawing Filter's Flo knows a question shown here is its read's.
17607
18129
  currentChatId: () => state.chat?.chatId ?? null,
18130
+ // What the 3D model's Flo shows for this conversation (workspaces.js syncModelFlo): Your call while a suggested
18131
+ // action waits on its card, the live row's own mood (thinking / working) while the AI replies, else idle. A
18132
+ // pending approval or question is read from the shell's approvalPending, as the other indicators are.
18133
+ floMood: () => {
18134
+ const proposed = state.events.some((event) => event.type === 'action-proposal'
18135
+ && actionProposalState(String(event.payload?.proposalId || event.eventId || '')).state === 'proposed');
18136
+ if (proposed) return 'yourcall';
18137
+ return turnIsVisiblyActive() ? liveFloMood() : 'idle';
18138
+ },
17608
18139
  // The project this panel's conversations belong to; an object card offers Show in chat only for it (#1653).
17609
18140
  scopeProjectId: () => (state.scope?.owner?.kind === 'project' ? state.scope.owner.projectId : null),
17610
18141
  // #3003: a Knowledge page rendered the way the chat viewers show it, for the Knowledge step's page panel.