@qredence/fleet 0.6.0 → 0.6.2

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 (273) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/web/client/assets/agent-disclosure-CMrxF7L-.js +1 -0
  3. package/dist/web/client/assets/analytics-stub-C2vgmGm_.js +1 -0
  4. package/dist/web/client/assets/artifacts-panel-DmQghvw8.js +1 -0
  5. package/dist/web/client/assets/{bot-Bs7QWJ2q.js → bot-DbB9BKL0.js} +1 -1
  6. package/dist/web/client/assets/bundle-mjs-cJTHqqzI.js +1 -0
  7. package/dist/web/client/assets/button-Dl0ce3Y5.js +1 -0
  8. package/dist/web/client/assets/card-DCEnYd2G.js +1 -0
  9. package/dist/web/client/assets/chat-C24kD2SP.js +52 -0
  10. package/dist/web/client/assets/chat-command-palette-BIwjhE6s.js +1 -0
  11. package/dist/web/client/assets/check-B3LlvM65.js +1 -0
  12. package/dist/web/client/assets/{chevron-down-BEVGmnSb.js → chevron-down-DUUprRP5.js} +1 -1
  13. package/dist/web/client/assets/chevron-right-NVqQIoiO.js +1 -0
  14. package/dist/web/client/assets/{chunk-YOKDWASO-BAf618wr.js → chunk-YOKDWASO-Bte3iwlH.js} +6 -6
  15. package/dist/web/client/assets/citations-BUvM92nt.js +1 -0
  16. package/dist/web/client/assets/collapsible-CUxOjhDJ.js +1 -0
  17. package/dist/web/client/assets/command-Dv96gATQ.js +1 -0
  18. package/dist/web/client/assets/createBaseUIEventDetails-B58Jldei.js +1 -0
  19. package/dist/web/client/assets/createLucideIcon-_dfI7Arx.js +1 -0
  20. package/dist/web/client/assets/dialog-BCb4rQh0.js +1 -0
  21. package/dist/web/client/assets/dist-52wg4XPY.js +1 -0
  22. package/dist/web/client/assets/dist-DbHxXSgQ.js +41 -0
  23. package/dist/web/client/assets/ease-CMumuPlX.js +1 -0
  24. package/dist/web/client/assets/{eye-B0DFz5hL.js → eye-CDHqtVoE.js} +1 -1
  25. package/dist/web/client/assets/file-text-TmalmYrb.js +1 -0
  26. package/dist/web/client/assets/{folder-BC5p7qK7.js → folder-vuNT4shY.js} +1 -1
  27. package/dist/web/client/assets/{fork-picker-dialog-ByBOGVsa.js → fork-picker-dialog-CpwEwsxA.js} +1 -1
  28. package/dist/web/client/assets/gauge-BsDqNM1A.js +1 -0
  29. package/dist/web/client/assets/globals-DCtBkCSD.css +2 -0
  30. package/dist/web/client/assets/{hard-drive-CHqgr7VQ.js → hard-drive-BT7UxHQu.js} +1 -1
  31. package/dist/web/client/assets/highlighted-body-KPVGNVTW-CgT7gqvs.js +1 -0
  32. package/dist/web/client/assets/horizontal-resize-VLjLByUV.js +1 -0
  33. package/dist/web/client/assets/index-BGnQeUYE.js +12 -0
  34. package/dist/web/client/assets/input-CxZp56Im.js +1 -0
  35. package/dist/web/client/assets/input-group-D7lAfKHR.js +1 -0
  36. package/dist/web/client/assets/ipython-tool-CkHaO3PW.js +3 -0
  37. package/dist/web/client/assets/is-ref-object-BcRWZ4l7.js +1 -0
  38. package/dist/web/client/assets/{loader-circle-DjfHXUPB.js → loader-circle-B5GIZGxd.js} +1 -1
  39. package/dist/web/client/assets/markdown-BHkByC9K.js +2 -0
  40. package/dist/web/client/assets/{markdown-code-CuQcR3UO.js → markdown-code-CDTRq-HZ.js} +1 -1
  41. package/dist/web/client/assets/mermaid-HWGCJPDP-CY3N5ECk.js +1 -0
  42. package/dist/web/client/assets/message-queue-Dl8wbCOu.js +1 -0
  43. package/dist/web/client/assets/model-selector-list-CRZCXeBf.js +1 -0
  44. package/dist/web/client/assets/{notify-DgMKgZZW.js → notify-DjVixft7.js} +1 -1
  45. package/dist/web/client/assets/openui-renderer-Bkkx5kmA.js +378 -0
  46. package/dist/web/client/assets/{package-CdcJFPf2.js → package-BKBPgwMP.js} +1 -1
  47. package/dist/web/client/assets/{pencil-DcUwsKLn.js → pencil-CdO6qfv3.js} +1 -1
  48. package/dist/web/client/assets/{plug-Dt6VN0zF.js → plug-BRROUIw-.js} +1 -1
  49. package/dist/web/client/assets/prompt-input-WaGSKZCU.js +1 -0
  50. package/dist/web/client/assets/prompt-suggestions-BNyTcyWg.js +1 -0
  51. package/dist/web/client/assets/provider-catalog-C0XBIasJ.js +1 -0
  52. package/dist/web/client/assets/provider-label-Cka0ep0S.js +1 -0
  53. package/dist/web/client/assets/react-CwJFpaho.js +1 -0
  54. package/dist/web/client/assets/react-dom-DX3XddaT.js +1 -0
  55. package/dist/web/client/assets/{refresh-cw-IThTJ3j-.js → refresh-cw-l9WPHRkq.js} +1 -1
  56. package/dist/web/client/assets/repl-panel-L9dmPqio.js +1 -0
  57. package/dist/web/client/assets/{resource-helpers-Q2T0YCMO.js → resource-helpers-BuWybA8l.js} +1 -1
  58. package/dist/web/client/assets/resources-panel-mT-aMCvV.js +1 -0
  59. package/dist/web/client/assets/right-panel-context-CS8tJMzE.js +1 -0
  60. package/dist/web/client/assets/right-panel-registry-BCW7fQTG.js +2 -0
  61. package/dist/web/client/assets/{rotate-ccw-WNFNkKQD.js → rotate-ccw-CfGhzOv7.js} +1 -1
  62. package/dist/web/client/assets/routes-BWe5Iz-2.js +16 -0
  63. package/dist/web/client/assets/safe-external-url-BbAom7Bm.js +1 -0
  64. package/dist/web/client/assets/search-BjcXAUrI.js +1 -0
  65. package/dist/web/client/assets/session-insights-panel-B0rl37lo.js +1 -0
  66. package/dist/web/client/assets/session-reasoning-panel-8D2P7iaJ.js +1 -0
  67. package/dist/web/client/assets/{fleet-pi-tool-renderer-BEDIO3al.js → session-tool-renderer-3E3cv8D0.js} +30 -30
  68. package/dist/web/client/assets/settings-dialog-B8lHq2tT.js +2 -0
  69. package/dist/web/client/assets/{skeleton-CkR2VmWc.js → skeleton-C3mo31Qu.js} +1 -1
  70. package/dist/web/client/assets/skeleton-loaders-BMa_G4yX.js +1 -0
  71. package/dist/web/client/assets/{shield-check-CkA2viVW.js → sparkles-D8XIY8pN.js} +1 -1
  72. package/dist/web/client/assets/square-DQaQu9bp.js +1 -0
  73. package/dist/web/client/assets/{square-terminal-BYTN_I86.js → square-terminal-BsopiuN7.js} +1 -1
  74. package/dist/web/client/assets/{subagent-chat-panel-Yujplxpb.js → subagent-chat-panel-C5ukYiUx.js} +1 -1
  75. package/dist/web/client/assets/subagent-transcript-lqNcSVbH.js +1 -0
  76. package/dist/web/client/assets/subagents-panel-SJKhaVTr.js +1 -0
  77. package/dist/web/client/assets/{sun-BWiZFty0.js → sun-D0llhiMU.js} +1 -1
  78. package/dist/web/client/assets/surfaces-CpfsGAIA.js +1 -0
  79. package/dist/web/client/assets/switch-D3FhZU-S.js +1 -0
  80. package/dist/web/client/assets/terminal-BQAKkBY6.js +1 -0
  81. package/dist/web/client/assets/toast-lnCWGgSE.js +1 -0
  82. package/dist/web/client/assets/tokens-Ch5WqXC_.js +1 -0
  83. package/dist/web/client/assets/tool-result-B_yb2JoE.js +4 -0
  84. package/dist/web/client/assets/tool-timeline-VnMRQoLS.js +1 -0
  85. package/dist/web/client/assets/{triangle-alert-CU-gd7ui.js → triangle-alert-GAYh_5d3.js} +1 -1
  86. package/dist/web/client/assets/ui-preferences-aG2U2jjW.js +1 -0
  87. package/dist/web/client/assets/use-presence-7I2qv4qI.js +1 -0
  88. package/dist/web/client/assets/use-reduced-motion-BOcG709U.js +9 -0
  89. package/dist/web/client/assets/useBaseUiId-D9ZGPZ6f.js +1 -0
  90. package/dist/web/client/assets/useControlled-CgAAWIy9.js +1 -0
  91. package/dist/web/client/assets/utils-Brtgag-m.js +1 -0
  92. package/dist/web/client/assets/virtualized-turn-list-BgUgX6tM.js +6 -0
  93. package/dist/web/client/assets/workspace-panel-CKF5JQl2.js +1 -0
  94. package/dist/web/client/assets/workspace-path-nav-DqPbETfJ.js +2 -0
  95. package/dist/web/client/assets/{wrench-BJNNe07k.js → wrench-Myc12BTA.js} +1 -1
  96. package/dist/web/client/assets/x-BGsDD848.js +1 -0
  97. package/dist/web/client/bundle-budget.json +6 -6
  98. package/dist/web/launcher.mjs +10 -1
  99. package/dist/web/server/_tanstack-start-manifest_v-BDPifIFN-DTSNCHBX.js +91 -0
  100. package/dist/web/server/{artifacts-panel-CaKrX2XC-R37I4BHF.js → artifacts-panel-BN3DgqfV-N73J6N5Y.js} +39 -44
  101. package/dist/web/server/{chat-command-palette-7gbqEnm9-6XICQZN7.js → chat-command-palette-G8awyZRw-2QE7FXGT.js} +18 -18
  102. package/dist/web/server/{chunk-SALXCFVO.js → chunk-33QA7BQJ.js} +19 -1
  103. package/dist/web/server/{chunk-P6UMR32I.js → chunk-43S5N7SH.js} +80 -47
  104. package/dist/web/server/chunk-4EBSM4JR.js +74 -0
  105. package/dist/web/server/{chunk-BBBS5AS7.js → chunk-4OTHKQMG.js} +753 -677
  106. package/dist/web/server/{chunk-WM4PUT6M.js → chunk-6SOMNRAX.js} +535 -505
  107. package/dist/web/server/chunk-7E76R7MB.js +2138 -0
  108. package/dist/web/server/{chunk-K3BXQG3N.js → chunk-7FK6YEMA.js} +100 -95
  109. package/dist/web/server/chunk-7HXCGBUP.js +56 -0
  110. package/dist/web/server/{chunk-P66QQWUM.js → chunk-7NZ3FJDA.js} +14 -1
  111. package/dist/web/server/{chunk-WHBVQJ4K.js → chunk-7UTDOTOU.js} +11 -9
  112. package/dist/web/server/{chunk-OZO5ARFA.js → chunk-BQROC4PL.js} +11 -2
  113. package/dist/web/server/{chunk-WYL2DW5R.js → chunk-BUXJSBE3.js} +2 -2
  114. package/dist/web/server/{chunk-ZJFA4F5X.js → chunk-CAPTFJOC.js} +9 -7
  115. package/dist/web/server/{chunk-EH4BZ6QM.js → chunk-CCYLHNZJ.js} +1767 -52
  116. package/dist/web/server/{chunk-DJMHPJBP.js → chunk-CHEC7TWB.js} +3 -1
  117. package/dist/web/server/{chunk-PIOFZUOU.js → chunk-CW6KZUKT.js} +7 -6
  118. package/dist/web/server/chunk-DLA5TLKX.js +164 -0
  119. package/dist/web/server/{chunk-7SR6WDM2.js → chunk-E5HALE4M.js} +4 -4
  120. package/dist/web/server/{chunk-DZ2IC3FH.js → chunk-EDAWH2MT.js} +47 -46
  121. package/dist/web/server/{chunk-JQDLJ7KI.js → chunk-ENGEUJIH.js} +2288 -2438
  122. package/dist/web/server/{chunk-DI7XRK2H.js → chunk-ESM7OCRL.js} +4 -4
  123. package/dist/web/server/{chunk-KELEYPVK.js → chunk-FT74GAAH.js} +74861 -74854
  124. package/dist/web/server/{chunk-LZ4Q5KUJ.js → chunk-HQ5TEXHT.js} +40 -60
  125. package/dist/web/server/{chunk-YOM42BKD.js → chunk-IPV4GLJL.js} +16 -16
  126. package/dist/web/server/{chunk-KOUEJ3NU.js → chunk-IXGLKAPN.js} +54 -46
  127. package/dist/web/server/{chunk-EAE2QXRK.js → chunk-JPDRUSUD.js} +2 -3
  128. package/dist/web/server/{chunk-AGFRJQZ7.js → chunk-JVOW2NWC.js} +452 -450
  129. package/dist/web/server/chunk-K6PTNSCW.js +31 -0
  130. package/dist/web/server/{chunk-AR7O7JXD.js → chunk-KBWUBWVJ.js} +24 -1
  131. package/dist/web/server/{chunk-NXJ32VFR.js → chunk-MJXXVQNA.js} +91 -96
  132. package/dist/web/server/{chunk-N6NOTURM.js → chunk-NCK2FJAD.js} +30 -26
  133. package/dist/web/server/{chunk-LXJD6IGW.js → chunk-NMBH57JT.js} +94 -33
  134. package/dist/web/server/{chunk-EAJTWMK5.js → chunk-NZ6KQT2X.js} +2 -2
  135. package/dist/web/server/{chunk-CNXJN5HN.js → chunk-O2UYZT3Z.js} +11 -11
  136. package/dist/web/server/{chunk-YXXRP3NS.js → chunk-OMEDERPG.js} +21 -25
  137. package/dist/web/server/{chunk-BLSX7WHW.js → chunk-OSMP55KI.js} +23 -2
  138. package/dist/web/server/{chunk-S3PQ6HKH.js → chunk-OVJYUWSQ.js} +2 -2
  139. package/dist/web/server/{chunk-XLNCWZMZ.js → chunk-RXUMFFUV.js} +5 -3
  140. package/dist/web/server/{chunk-DO2O27B2.js → chunk-SDV3P3IW.js} +2 -2
  141. package/dist/web/server/chunk-TLNZNR7C.js +46 -0
  142. package/dist/web/server/{chunk-IJPCV6DH.js → chunk-UDD5W4CR.js} +32 -10
  143. package/dist/web/server/{chunk-HSJMLO36.js → chunk-UE32PAV2.js} +47 -57
  144. package/dist/web/server/{chunk-UAPNEWCA.js → chunk-WB2LJC3R.js} +29 -32
  145. package/dist/web/server/{chunk-ETTDO4UO.js → chunk-WTYNN6EV.js} +1 -26
  146. package/dist/web/server/{chunk-2ATMSG7U.js → chunk-WU6X3GPJ.js} +48 -5
  147. package/dist/web/server/{chunk-C5X6G26O.js → chunk-XJ6TGSUB.js} +45 -24
  148. package/dist/web/server/{chunk-YNUWKMNQ.js → chunk-YMPJMHXZ.js} +41 -155
  149. package/dist/web/server/{chunk-GETSIVNU.js → chunk-YVGCPUAW.js} +7 -7
  150. package/dist/web/server/{chunk-4UBOIY2S.js → chunk-ZNFXBGLK.js} +1 -1
  151. package/dist/web/server/chunk-ZOVXMNJM.js +477 -0
  152. package/dist/web/server/{fork-picker-dialog-DlINz9UQ-UWIXFDJX.js → fork-picker-dialog-YKlapaxN-DR5L74ST.js} +9 -8
  153. package/dist/web/server/{markdown-DTnMbD87-FXGGAPJD.js → markdown-BzNejPoZ-6ITTDAV6.js} +2 -3
  154. package/dist/web/server/{markdown-code-BStjFfsy-SSLWUT4S.js → markdown-code-DAwXuW6m-HHVELO6I.js} +3 -4
  155. package/dist/web/server/{fleet-message-queue-BS-cZ56r-GLZXUKDF.js → message-queue-Demph1x4-RBJUC3AT.js} +14 -10
  156. package/dist/web/server/{model-selector-list-jBTZc2Mu-OXJOS5NA.js → model-selector-list-BmzLiCx9-TK6JGGKU.js} +20 -19
  157. package/dist/web/server/{openui-renderer-Biyyjhjn-SJOEKPTJ.js → openui-renderer-moJGf0LA-QCU3PI6H.js} +17 -18
  158. package/dist/web/server/{prompt-suggestions-D4AEEY7K-RZSP7PWV.js → prompt-suggestions-yPZqX__K-3VGJC4IF.js} +7 -6
  159. package/dist/web/server/{repl-panel-D5KsoJik-BQKO53JO.js → repl-panel-CgUF1qUw-3DFD2V53.js} +10 -11
  160. package/dist/web/server/{resources-panel-CE5pD4vy-V5FXBTYC.js → resources-panel-ChUliWV--JITAGS6Q.js} +6 -7
  161. package/dist/web/server/{router-DWALoX_M-I5CBL7FQ.js → router-CPdFlpbe-LAD4MNZB.js} +3117 -241
  162. package/dist/web/server/{routes-BBVirYfL-5WXMOT7M.js → routes-hkom6S6L-DUPPQHPY.js} +8753 -7974
  163. package/dist/web/server/server.js +2 -2
  164. package/dist/web/server/{session-insights-panel-CUhdgvRt-VB2HUCQP.js → session-insights-panel-xgrkX1Rp-FDNURBXZ.js} +9 -9
  165. package/dist/web/server/{fleet-reasoning-panel-BxC2COxi-GPLMQSTT.js → session-reasoning-panel-m1RgcIph-NUXGXVKE.js} +39 -40
  166. package/dist/web/server/session-tool-renderer-CglQ2ky7-2JVYNZG2.js +45 -0
  167. package/dist/web/server/{settings-dialog-DndPbM-v-RFNXXEAN.js → settings-dialog-BCEfmgtP-T3WQEZHB.js} +1912 -3120
  168. package/dist/web/server/{subagent-chat-panel-C0RpnXav-J7VYO7QY.js → subagent-chat-panel-BTwI1kdB-LKBWA4GD.js} +32 -41
  169. package/dist/web/server/{subagents-panel-jDqIn9Nh-YEV6QLUY.js → subagents-panel-8Z9_csoV-HYMEEBHB.js} +37 -45
  170. package/dist/web/server/{fleet-tool-timeline-IB36_PB2-XJENTO6I.js → tool-timeline-QL9k5dzA-RLU26HXT.js} +6 -6
  171. package/dist/web/server/{workspace-panel-CX_Vo6As-EWO6AMPI.js → workspace-panel-BHEB9nRM-TS62SYBA.js} +64 -46
  172. package/package.json +1 -1
  173. package/dist/web/client/assets/action-swap-roll-BB8DFMuf.js +0 -1
  174. package/dist/web/client/assets/agent-activity-CwMDU7aP.js +0 -1
  175. package/dist/web/client/assets/agent-disclosure-B8SnhQXL.js +0 -1
  176. package/dist/web/client/assets/analytics-stub-Cas1He0w.js +0 -1
  177. package/dist/web/client/assets/artifacts-panel-CJ75gQub.js +0 -1
  178. package/dist/web/client/assets/artifacts-utils-N_kUFbz2.js +0 -1
  179. package/dist/web/client/assets/bundle-mjs-DKHVkVWu.js +0 -1
  180. package/dist/web/client/assets/button-BR2WWrFo.js +0 -1
  181. package/dist/web/client/assets/card-BKl76a3R.js +0 -1
  182. package/dist/web/client/assets/chat-Ci2cEQrR.js +0 -52
  183. package/dist/web/client/assets/chat-command-palette-CkISHfKE.js +0 -1
  184. package/dist/web/client/assets/check-JjHKAZas.js +0 -1
  185. package/dist/web/client/assets/chevron-right-DrJxToLs.js +0 -1
  186. package/dist/web/client/assets/chevron-up-CnSvySGH.js +0 -1
  187. package/dist/web/client/assets/circle-alert-CONlFReH.js +0 -1
  188. package/dist/web/client/assets/circle-x-CkKCB__4.js +0 -1
  189. package/dist/web/client/assets/citations-C_tPOJE_.js +0 -2
  190. package/dist/web/client/assets/cn-C8c0S2mI.js +0 -1
  191. package/dist/web/client/assets/collapsible-BoXtZZWN.js +0 -1
  192. package/dist/web/client/assets/command-_WjnervL.js +0 -1
  193. package/dist/web/client/assets/createBaseUIEventDetails-DV0dQrBX.js +0 -1
  194. package/dist/web/client/assets/createLucideIcon-DwxZHm0M.js +0 -1
  195. package/dist/web/client/assets/dialog-BEZuZhzk.js +0 -1
  196. package/dist/web/client/assets/dist-BPaFisIZ.js +0 -41
  197. package/dist/web/client/assets/earth-DGZXAN5r.js +0 -1
  198. package/dist/web/client/assets/ease-u56MhKYS.js +0 -1
  199. package/dist/web/client/assets/file-text-T-NcAlZs.js +0 -1
  200. package/dist/web/client/assets/fleet-message-queue-BCno4XP-.js +0 -1
  201. package/dist/web/client/assets/fleet-reasoning-panel-CbkO7u-v.js +0 -1
  202. package/dist/web/client/assets/fleet-subagent-list-iKUtLJKZ.js +0 -1
  203. package/dist/web/client/assets/fleet-tool-timeline-C8heL7ae.js +0 -1
  204. package/dist/web/client/assets/gauge-DNpstbBn.js +0 -1
  205. package/dist/web/client/assets/globals-B_I1Eq1u.css +0 -2
  206. package/dist/web/client/assets/highlighted-body-KPVGNVTW-sUCZ1fHv.js +0 -1
  207. package/dist/web/client/assets/horizontal-resize-CwoDojST.js +0 -1
  208. package/dist/web/client/assets/image-BbPmlw-n.js +0 -1
  209. package/dist/web/client/assets/index-DJ1fFbQu.js +0 -12
  210. package/dist/web/client/assets/input-0wwjWjKq.js +0 -1
  211. package/dist/web/client/assets/input-group-Tb5TYbzi.js +0 -1
  212. package/dist/web/client/assets/ipython-tool-ldJ9F1Cw.js +0 -3
  213. package/dist/web/client/assets/layout-gyLzPvVv.js +0 -1
  214. package/dist/web/client/assets/markdown-DInPmRUG.js +0 -2
  215. package/dist/web/client/assets/mermaid-HWGCJPDP-Bm7CuruA.js +0 -1
  216. package/dist/web/client/assets/message-square-hbDao-A1.js +0 -1
  217. package/dist/web/client/assets/model-selector-list-Ch05B2nZ.js +0 -1
  218. package/dist/web/client/assets/openui-renderer-Bf60nxNi.js +0 -378
  219. package/dist/web/client/assets/plus-DXN1Bg_z.js +0 -1
  220. package/dist/web/client/assets/prompt-input-qPIXZ-Rb.js +0 -1
  221. package/dist/web/client/assets/prompt-suggestions-Cc--lSNR.js +0 -1
  222. package/dist/web/client/assets/provider-catalog-D8G66gwc.js +0 -1
  223. package/dist/web/client/assets/provider-label-DDLRnZyC.js +0 -1
  224. package/dist/web/client/assets/react-dom-Bwxum3ti.js +0 -1
  225. package/dist/web/client/assets/repl-panel-DsPX04Xr.js +0 -1
  226. package/dist/web/client/assets/resources-panel-D867-goy.js +0 -1
  227. package/dist/web/client/assets/right-panel-context-DHlNWJsF.js +0 -1
  228. package/dist/web/client/assets/right-panel-registry-Dp8yX-oL.js +0 -2
  229. package/dist/web/client/assets/routes-DpgMJZ5n.js +0 -16
  230. package/dist/web/client/assets/safe-external-url-D3PJJIcM.js +0 -1
  231. package/dist/web/client/assets/search-eWVnAJsb.js +0 -1
  232. package/dist/web/client/assets/session-insights-panel-YnaXvTpi.js +0 -1
  233. package/dist/web/client/assets/settings-dialog-YJkvt5EB.js +0 -2
  234. package/dist/web/client/assets/skeleton-loaders-C9vHwAYV.js +0 -1
  235. package/dist/web/client/assets/sparkles-DuclzqlE.js +0 -1
  236. package/dist/web/client/assets/square-Bhn8gjr0.js +0 -1
  237. package/dist/web/client/assets/subagent-transcript-CnI-mqN0.js +0 -1
  238. package/dist/web/client/assets/subagent-utils-DDH5qm9Z.js +0 -1
  239. package/dist/web/client/assets/subagents-panel-CjXEdimj.js +0 -1
  240. package/dist/web/client/assets/surfaces-DI-U-_2a.js +0 -1
  241. package/dist/web/client/assets/switch-9rTeg6J6.js +0 -1
  242. package/dist/web/client/assets/terminal-DOS1s1gm.js +0 -1
  243. package/dist/web/client/assets/toast-Bt9p2OL4.js +0 -1
  244. package/dist/web/client/assets/tool-result-DfnPN0FQ.js +0 -4
  245. package/dist/web/client/assets/ui-preferences-CImQGZm_.js +0 -1
  246. package/dist/web/client/assets/use-reduced-motion-eORd7fqW.js +0 -9
  247. package/dist/web/client/assets/useBaseUiId-CHqXB2UQ.js +0 -1
  248. package/dist/web/client/assets/useControlled-CJJ9BOQB.js +0 -1
  249. package/dist/web/client/assets/utils-Eg7xtNmV.js +0 -1
  250. package/dist/web/client/assets/virtualized-turn-list--Vynre4D.js +0 -6
  251. package/dist/web/client/assets/workspace-panel-CPPIznT9.js +0 -1
  252. package/dist/web/client/assets/workspace-path-nav-C0AQNZyy.js +0 -1
  253. package/dist/web/client/assets/x-CsRC_tCI.js +0 -1
  254. package/dist/web/server/_tanstack-start-manifest_v-DS_CSIFQ-WB3VTKF3.js +0 -95
  255. package/dist/web/server/agent-activity-CS2rbF_C-A3R26CYH.js +0 -514
  256. package/dist/web/server/chunk-3JMESBAT.js +0 -35
  257. package/dist/web/server/chunk-42XU6WV7.js +0 -56
  258. package/dist/web/server/chunk-7SD2ZSEA.js +0 -86
  259. package/dist/web/server/chunk-AQ66E5OW.js +0 -33
  260. package/dist/web/server/chunk-BYXBJQAS.js +0 -0
  261. package/dist/web/server/chunk-FAGDMGLK.js +0 -6589
  262. package/dist/web/server/chunk-FJV6EQDW.js +0 -36
  263. package/dist/web/server/chunk-GL6HWDJB.js +0 -19
  264. package/dist/web/server/chunk-HFQTI7AX.js +0 -42
  265. package/dist/web/server/chunk-L46H6IDX.js +0 -13
  266. package/dist/web/server/chunk-ON33WDZX.js +0 -31
  267. package/dist/web/server/chunk-PVJCTQFK.js +0 -22
  268. package/dist/web/server/chunk-QPNUGF3V.js +0 -35
  269. package/dist/web/server/chunk-TWYHHG5N.js +0 -1196
  270. package/dist/web/server/chunk-YKVGQBZA.js +0 -1262
  271. package/dist/web/server/chunk-ZCVWADNW.js +0 -37
  272. package/dist/web/server/fleet-pi-tool-renderer-umKunT3K-O4GBH35V.js +0 -51
  273. package/dist/web/server/fleet-subagent-list-CpSYzCIq-JDH2LHSS.js +0 -18
@@ -1,20 +1,24 @@
1
- import {
2
- Image
3
- } from "./chunk-FJV6EQDW.js";
4
1
  import {
5
2
  notify
6
- } from "./chunk-WYL2DW5R.js";
3
+ } from "./chunk-BUXJSBE3.js";
7
4
  import {
8
- LazyMarkdown,
9
5
  useHoverCapable
10
- } from "./chunk-N6NOTURM.js";
6
+ } from "./chunk-NCK2FJAD.js";
7
+ import {
8
+ LazyMarkdown
9
+ } from "./chunk-7NZ3FJDA.js";
11
10
  import {
11
+ CircleX,
12
12
  Copy
13
- } from "./chunk-2ATMSG7U.js";
13
+ } from "./chunk-WU6X3GPJ.js";
14
+ import {
15
+ CircleCheck,
16
+ LoaderCircle
17
+ } from "./chunk-TNL4YV63.js";
14
18
  import {
15
19
  AnimatePresence,
16
20
  useReducedMotion
17
- } from "./chunk-ZJFA4F5X.js";
21
+ } from "./chunk-CAPTFJOC.js";
18
22
  import {
19
23
  ChevronRight
20
24
  } from "./chunk-3C4CFCIS.js";
@@ -22,7 +26,7 @@ import {
22
26
  EASE_OUT,
23
27
  SPRING_LAYOUT,
24
28
  m
25
- } from "./chunk-K3BXQG3N.js";
29
+ } from "./chunk-7FK6YEMA.js";
26
30
  import {
27
31
  segmentOpenUIContent
28
32
  } from "./chunk-NFRJDPB3.js";
@@ -33,16 +37,17 @@ import {
33
37
  X
34
38
  } from "./chunk-JBLHIEVG.js";
35
39
  import {
40
+ CircleAlert,
36
41
  FileText
37
- } from "./chunk-AR7O7JXD.js";
42
+ } from "./chunk-KBWUBWVJ.js";
38
43
  import {
39
44
  createLucideIcon
40
45
  } from "./chunk-4ZIEVI5O.js";
41
46
  import {
42
47
  cn
43
- } from "./chunk-DJMHPJBP.js";
48
+ } from "./chunk-CHEC7TWB.js";
44
49
 
45
- // web/app/dist/server/assets/virtualized-turn-list-atr4a0d6.js
50
+ // web/app/dist/server/assets/virtualized-turn-list-Coc3IbGL.js
46
51
  import { Fragment, Suspense, cloneElement, createContext, lazy, memo, useCallback, useContext, useEffect, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
47
52
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
48
53
  import { createPortal } from "react-dom";
@@ -86,6 +91,34 @@ var FileCode = createLucideIcon("file-code", [
86
91
  key: "yinavb"
87
92
  }]
88
93
  ]);
94
+ var Image = createLucideIcon("image", [
95
+ ["rect", {
96
+ width: "18",
97
+ height: "18",
98
+ x: "3",
99
+ y: "3",
100
+ rx: "2",
101
+ ry: "2",
102
+ key: "1m3agn"
103
+ }],
104
+ ["circle", {
105
+ cx: "9",
106
+ cy: "9",
107
+ r: "2",
108
+ key: "af1f0g"
109
+ }],
110
+ ["path", {
111
+ d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",
112
+ key: "1xmnt7"
113
+ }]
114
+ ]);
115
+ var RotateCw = createLucideIcon("rotate-cw", [["path", {
116
+ d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
117
+ key: "1p45f6"
118
+ }], ["path", {
119
+ d: "M21 3v5h-5",
120
+ key: "1q7to0"
121
+ }]]);
89
122
  var MessageSideContext = createContext(void 0);
90
123
  var MessageBubbleContext = createContext({
91
124
  animateIn: true,
@@ -145,7 +178,7 @@ function MessageBubble({ variant = "soft", align, animateIn = false, className,
145
178
  });
146
179
  }
147
180
  function bubbleContentClass(variant, interactive) {
148
- return cn("relative z-0 min-w-9 max-w-[82%] rounded-2xl px-3.5 py-2.5 text-sm leading-6 text-foreground", "[&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-background/60 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em] [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p+p]:mt-2 [&_pre]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:bg-background/60 [&_pre]:p-3 [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5", variant === "solid" && "text-background", variant === "ghost" && "w-full max-w-none rounded-none px-0 py-0", variant === "danger" && "text-destructive", interactive && "cursor-pointer text-left outline-none transition-[background-color,color,transform] duration-150 hover:brightness-[0.98] focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.99]");
181
+ return cn("relative z-0 min-w-9 max-w-[82%] rounded-2xl px-3.5 py-2.5 text-sm leading-6 text-foreground", "[&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-background/60 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[90%] [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p+p]:mt-2 [&_pre]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:bg-background/60 [&_pre]:p-3 [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5", variant === "solid" && "text-background", variant === "ghost" && "w-full max-w-none rounded-none px-0 py-0", variant === "danger" && "text-destructive", interactive && "cursor-pointer text-left outline-none transition-[background-color,color,transform] duration-150 hover:brightness-[0.98] focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.99]");
149
182
  }
150
183
  function bubbleSurfaceClass(variant, align) {
151
184
  return cn("pointer-events-none absolute inset-0 -z-10 rounded-[inherit]", align === "end" ? "origin-bottom-right" : "origin-bottom-left", variant === "solid" && "bg-foreground", variant === "soft" && "bg-muted", variant === "tint" && "bg-primary/10", variant === "outline" && "border border-border/70 bg-background", variant === "danger" && "bg-destructive/10");
@@ -159,7 +192,7 @@ function MessageBubbleContent({ render, className, children, ref, ...props }) {
159
192
  const classes = cn(bubbleContentClass(variant, interactive), className);
160
193
  const composedChildren = /* @__PURE__ */ jsxs(Fragment$1, { children: [variant !== "ghost" ? /* @__PURE__ */ jsx(m.span, {
161
194
  "aria-hidden": "true",
162
- layout: reduce ? false : "size",
195
+ layout: false,
163
196
  layoutDependency: layoutVersion,
164
197
  initial: animateIn && !reduce ? {
165
198
  opacity: 0,
@@ -747,270 +780,175 @@ function MessageContent({ className, ...props }) {
747
780
  ...props
748
781
  });
749
782
  }
750
- function ImageLightbox({ open, onClose, images, initialIndex = 0 }) {
751
- const [currentIndex, setCurrentIndex] = useState(initialIndex);
752
- const hasMultipleImages = images.length > 1;
753
- useEffect(() => {
754
- if (open) setCurrentIndex(initialIndex);
755
- }, [open, initialIndex]);
756
- const goToPrevious = useCallback((event) => {
757
- event?.stopPropagation();
758
- setCurrentIndex((prev) => prev > 0 ? prev - 1 : images.length - 1);
759
- }, [images.length]);
760
- const goToNext = useCallback((event) => {
761
- event?.stopPropagation();
762
- setCurrentIndex((prev) => prev < images.length - 1 ? prev + 1 : 0);
763
- }, [images.length]);
764
- const onLightboxKeyDown = useEffectEvent((event) => {
765
- switch (event.key) {
766
- case "ArrowLeft":
767
- event.preventDefault();
768
- if (hasMultipleImages) goToPrevious();
769
- break;
770
- case "ArrowRight":
771
- event.preventDefault();
772
- if (hasMultipleImages) goToNext();
773
- }
783
+ function isRecord$2(value) {
784
+ return typeof value === "object" && value !== null;
785
+ }
786
+ function parseStructuredJson(value) {
787
+ if (typeof value !== "string") return value;
788
+ const trimmed = value.trim();
789
+ if (!trimmed) return value;
790
+ try {
791
+ const parsed = JSON.parse(trimmed);
792
+ return isRecord$2(parsed) || Array.isArray(parsed) ? parsed : value;
793
+ } catch {
794
+ return value;
795
+ }
796
+ }
797
+ function normalizeToolPart(part) {
798
+ if (!isRecord$2(part)) return part;
799
+ if (typeof part.type !== "string" || !part.type.startsWith("tool-")) return part;
800
+ const normalizedInput = parseStructuredJson(part.input);
801
+ const normalizedOutput = parseStructuredJson(part.output);
802
+ const normalizedResult = parseStructuredJson(part.result);
803
+ const inputChanged = normalizedInput !== part.input;
804
+ const outputChanged = normalizedOutput !== part.output;
805
+ const resultChanged = normalizedResult !== part.result;
806
+ if (!inputChanged && !outputChanged && !resultChanged) return part;
807
+ const normalizedPart = { ...part };
808
+ if (inputChanged) normalizedPart.input = normalizedInput;
809
+ if (outputChanged) normalizedPart.output = normalizedOutput;
810
+ if (resultChanged) normalizedPart.result = normalizedResult;
811
+ return normalizedPart;
812
+ }
813
+ function normalizeAssistantToolParts(parts) {
814
+ let changed = false;
815
+ const normalizedParts = parts.map((part) => {
816
+ const normalizedPart = normalizeToolPart(part);
817
+ if (normalizedPart !== part) changed = true;
818
+ return normalizedPart;
774
819
  });
775
- useEffect(() => {
776
- if (!open) return;
777
- const handler = (event) => onLightboxKeyDown(event);
778
- window.addEventListener("keydown", handler, true);
779
- return () => window.removeEventListener("keydown", handler, true);
780
- }, [open]);
781
- useEffect(() => {
782
- if (!open) return;
783
- const previousOverflow = document.body.style.overflow;
784
- document.body.style.overflow = "hidden";
785
- return () => {
786
- document.body.style.overflow = previousOverflow;
787
- };
788
- }, [open]);
789
- const dialogRef = useRef(null);
790
- const onLightDismiss = useEffectEvent((event) => {
791
- if (dialogRef.current && event.target === dialogRef.current) onClose();
820
+ return changed ? normalizedParts : parts;
821
+ }
822
+ var ErrorMessage = memo(function ErrorMessage2({ title = "Something went wrong", message, className }) {
823
+ return /* @__PURE__ */ jsx("div", {
824
+ className: cn("flex justify-start", className),
825
+ children: /* @__PURE__ */ jsxs("div", {
826
+ className: "rounded-[8px] border border-red-500/30 bg-red-500/10 px-4 py-2.5 text-sm text-foreground",
827
+ children: [/* @__PURE__ */ jsx("div", {
828
+ className: "font-medium text-foreground",
829
+ children: title
830
+ }), /* @__PURE__ */ jsx("div", {
831
+ className: "mt-0.5 text-muted-foreground",
832
+ children: message
833
+ })]
834
+ })
792
835
  });
836
+ });
837
+ var timeFormatter = new Intl.DateTimeFormat("en-US", {
838
+ hour: "numeric",
839
+ minute: "2-digit",
840
+ hour12: true
841
+ });
842
+ var dateFormatter = new Intl.DateTimeFormat("en-US", {
843
+ month: "short",
844
+ day: "numeric"
845
+ });
846
+ function formatTimestamp(date) {
847
+ const now = /* @__PURE__ */ new Date();
848
+ if (date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate()) return timeFormatter.format(date);
849
+ return dateFormatter.format(date);
850
+ }
851
+ function CopyButton({ text, onCopied }) {
852
+ const [copied, setCopied] = useState(false);
853
+ const copiedTimerRef = useRef(null);
793
854
  useEffect(() => {
794
- if (!open) return;
795
- const dialog = dialogRef.current;
796
- if (!dialog) return;
797
- if (!dialog.open) dialog.showModal();
798
- const handler = (event) => onLightDismiss(event);
799
- dialog.addEventListener("click", handler);
800
855
  return () => {
801
- dialog.removeEventListener("click", handler);
802
- if (dialog.open) dialog.close();
856
+ if (copiedTimerRef.current) window.clearTimeout(copiedTimerRef.current);
803
857
  };
804
- }, [open]);
805
- if (typeof document === "undefined") return null;
806
- if (!open) return null;
807
- const currentImage = images[currentIndex] ?? images[0];
808
- if (!currentImage?.url) return null;
809
- return createPortal(/* @__PURE__ */ jsxs("dialog", {
810
- ref: dialogRef,
811
- "aria-label": "Image viewer",
812
- onClose: () => onClose(),
813
- className: "fixed inset-0 z-50 m-0 flex h-full max-h-none w-full max-w-none items-center justify-center border-0 bg-black/90 p-0 backdrop:bg-transparent",
858
+ }, []);
859
+ const handleCopy = async () => {
860
+ try {
861
+ await navigator.clipboard.writeText(text);
862
+ setCopied(true);
863
+ if (copiedTimerRef.current) window.clearTimeout(copiedTimerRef.current);
864
+ copiedTimerRef.current = window.setTimeout(() => {
865
+ setCopied(false);
866
+ copiedTimerRef.current = null;
867
+ }, 2e3);
868
+ notify.success("Copied to clipboard");
869
+ onCopied?.();
870
+ } catch {
871
+ notify.error("Failed to copy to clipboard");
872
+ }
873
+ };
874
+ return /* @__PURE__ */ jsx("button", {
875
+ type: "button",
876
+ tabIndex: -1,
877
+ "aria-label": copied ? "Copied" : "Copy message",
878
+ onClick: handleCopy,
879
+ onPointerDown: (event) => {
880
+ event.stopPropagation();
881
+ },
882
+ onMouseDown: (event) => event.stopPropagation(),
883
+ className: cn("flex size-6 items-center justify-center rounded-md transition-[background-color,opacity,transform] duration-150 ease-out active:scale-[0.97]", "bg-transparent opacity-50 hover:bg-foreground/10 hover:opacity-100"),
884
+ children: /* @__PURE__ */ jsxs("div", {
885
+ className: "relative size-3.5",
886
+ children: [/* @__PURE__ */ jsx(Copy, { className: cn("absolute inset-0 h-3.5 w-3.5 text-muted-foreground transition-[opacity,transform] duration-150 ease-out", copied ? "scale-50 opacity-0" : "scale-100 opacity-100") }), /* @__PURE__ */ jsx(Check, { className: cn("absolute inset-0 h-3.5 w-3.5 text-muted-foreground transition-[opacity,transform] duration-150 ease-out", copied ? "scale-100 opacity-100" : "scale-50 opacity-0") })]
887
+ })
888
+ });
889
+ }
890
+ function MessageToolbar({ text, timestamp, heightClass, hoverClass, isVisible, alignClass, onCopied }) {
891
+ return /* @__PURE__ */ jsxs("div", {
892
+ className: cn("pointer-events-none flex items-center gap-1 pt-1 text-xs text-muted-foreground/70 opacity-0 transition-opacity duration-100", heightClass, alignClass, hoverClass, isVisible && "pointer-events-auto opacity-100"),
893
+ onMouseDown: (event) => event.stopPropagation(),
894
+ onPointerDown: (event) => event.stopPropagation(),
895
+ children: [timestamp && /* @__PURE__ */ jsx("span", { children: timestamp }), text && /* @__PURE__ */ jsx(CopyButton, {
896
+ text,
897
+ onCopied
898
+ })]
899
+ });
900
+ }
901
+ function formatPayload(value) {
902
+ if (typeof value === "string") return value;
903
+ if (value === void 0) return "";
904
+ try {
905
+ return JSON.stringify(value, null, 2) ?? "";
906
+ } catch {
907
+ return String(value);
908
+ }
909
+ }
910
+ function PayloadPart({ part }) {
911
+ const payload = formatPayload(part.payload);
912
+ return /* @__PURE__ */ jsxs("section", {
913
+ "data-payload-kind": part.kind,
914
+ className: "w-full min-w-0 overflow-hidden rounded-xl border border-border/60 bg-muted/40 text-sm",
814
915
  children: [
815
- /* @__PURE__ */ jsx("button", {
816
- type: "button",
817
- onClick: onClose,
818
- "aria-label": "Close fullscreen (Esc)",
819
- className: "absolute top-4 right-4 z-10 inline-flex size-9 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
820
- children: /* @__PURE__ */ jsx(X, { className: "size-5" })
821
- }),
822
- hasMultipleImages && /* @__PURE__ */ jsx("button", {
823
- type: "button",
824
- onClick: goToPrevious,
825
- "aria-label": "Previous image (\u2190)",
826
- className: "absolute top-1/2 left-4 z-10 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
827
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-6" })
828
- }),
829
- /* @__PURE__ */ jsx("img", {
830
- src: currentImage.url,
831
- alt: currentImage.filename ?? "Image preview",
832
- className: "max-h-[85vh] max-w-[90vw] object-contain select-none",
833
- onClick: (event) => event.stopPropagation(),
834
- draggable: false
835
- }),
836
- hasMultipleImages && /* @__PURE__ */ jsx("button", {
837
- type: "button",
838
- onClick: goToNext,
839
- "aria-label": "Next image (\u2192)",
840
- className: "absolute top-1/2 right-4 z-10 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
841
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-6" })
916
+ /* @__PURE__ */ jsx("div", {
917
+ className: "border-b border-border/50 px-3 py-2 text-xs font-medium text-muted-foreground",
918
+ children: part.title
842
919
  }),
843
- hasMultipleImages && /* @__PURE__ */ jsxs("div", {
844
- className: "absolute bottom-6 left-1/2 flex -translate-x-1/2 flex-col items-center gap-3",
845
- children: [/* @__PURE__ */ jsx("div", {
846
- className: "flex gap-2",
847
- children: images.map((image, idx) => /* @__PURE__ */ jsx("button", {
848
- type: "button",
849
- onClick: (event) => {
850
- event.stopPropagation();
851
- setCurrentIndex(idx);
852
- },
853
- "aria-label": `Go to image ${idx + 1}`,
854
- className: cn("size-2 rounded-full transition-all", idx === currentIndex ? "scale-125 bg-white" : "bg-white/40 hover:bg-white/60")
855
- }, image.url))
856
- }), /* @__PURE__ */ jsxs("span", {
857
- className: "text-sm text-white/70",
858
- children: [
859
- currentIndex + 1,
860
- " / ",
861
- images.length
862
- ]
920
+ part.text ? /* @__PURE__ */ jsx("pre", {
921
+ className: "m-0 whitespace-pre-wrap break-words p-3 font-mono text-xs leading-5 text-foreground/80",
922
+ children: part.text
923
+ }) : null,
924
+ payload ? /* @__PURE__ */ jsxs("details", {
925
+ open: true,
926
+ className: "border-t border-border/50 px-3 py-2",
927
+ children: [/* @__PURE__ */ jsx("summary", {
928
+ className: "cursor-pointer text-xs font-medium text-muted-foreground",
929
+ children: "Payload"
930
+ }), /* @__PURE__ */ jsx("pre", {
931
+ className: "m-0 mt-2 max-w-full whitespace-pre-wrap break-words font-mono text-xs leading-5 text-foreground/70",
932
+ children: payload
863
933
  })]
864
- })
934
+ }) : null
865
935
  ]
866
- }), document.body);
936
+ });
867
937
  }
868
- function formatFileSize(bytes) {
869
- if (bytes < 1024) return `${bytes} B`;
870
- if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
871
- return `${(bytes / 1048576).toFixed(1)} MB`;
872
- }
873
- function getFileIconName(filename, isImage) {
874
- if (isImage) return "image";
875
- const ext = filename.split(".").pop()?.toLowerCase();
876
- if ([
877
- "js",
878
- "ts",
879
- "jsx",
880
- "tsx",
881
- "py",
882
- "rb",
883
- "go",
884
- "rs",
885
- "java",
886
- "kt",
887
- "swift",
888
- "c",
889
- "cpp",
890
- "h",
891
- "hpp",
892
- "cs",
893
- "php"
894
- ].includes(ext || "")) return "code";
895
- if ([
896
- "json",
897
- "yaml",
898
- "yml",
899
- "xml"
900
- ].includes(ext || "")) return "data";
901
- return "text";
902
- }
903
- function renderFileIcon(iconName) {
904
- switch (iconName) {
905
- case "image":
906
- return /* @__PURE__ */ jsx(Image, { className: "size-4 text-muted-foreground" });
907
- case "code":
908
- return /* @__PURE__ */ jsx(FileCode, { className: "size-4 text-muted-foreground" });
909
- case "data":
910
- return /* @__PURE__ */ jsx(FileBraces, { className: "size-4 text-muted-foreground" });
911
- default:
912
- return /* @__PURE__ */ jsx(FileText, { className: "size-4 text-muted-foreground" });
913
- }
914
- }
915
- function FileAttachment({ id, filename, size, isImage, url, onRemove, className, display = "chip", enableImagePreview = true }) {
916
- const [isHovered, setIsHovered] = useState(false);
917
- const [isLightboxOpen, setIsLightboxOpen] = useState(false);
918
- const iconName = getFileIconName(filename, isImage);
919
- const isImageOnly = display === "image-only" && isImage && !!url;
920
- const canPreview = Boolean(enableImagePreview && isImage && url);
921
- const openLightbox = (event) => {
922
- event?.stopPropagation();
923
- setIsLightboxOpen(true);
924
- };
925
- return /* @__PURE__ */ jsxs("div", {
926
- className: cn("relative rounded-[calc(var(--an-input-border-radius)-var(--an-context-padding))] bg-muted/50", isImageOnly ? "flex size-10 items-center justify-center" : "flex max-w-[200px] min-w-[120px] items-center gap-2 py-1 pr-2 pl-1", className),
927
- onMouseEnter: () => setIsHovered(true),
928
- onMouseLeave: () => setIsHovered(false),
929
- children: [
930
- isImageOnly ? /* @__PURE__ */ jsx("div", {
931
- className: cn("size-8 shrink-0 overflow-hidden rounded-[calc(var(--an-input-border-radius)-var(--an-context-padding)-2px)]", canPreview && "cursor-pointer"),
932
- onClick: canPreview ? openLightbox : void 0,
933
- role: canPreview ? "button" : void 0,
934
- tabIndex: canPreview ? 0 : void 0,
935
- "aria-label": canPreview ? `Preview ${filename}` : void 0,
936
- onKeyDown: canPreview ? (event) => {
937
- if (event.key === "Enter" || event.key === " ") {
938
- event.preventDefault();
939
- openLightbox();
940
- }
941
- } : void 0,
942
- children: /* @__PURE__ */ jsx("img", {
943
- src: url,
944
- alt: filename,
945
- className: "h-full w-full object-cover"
946
- })
947
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [isImage && url ? /* @__PURE__ */ jsx("div", {
948
- className: cn("w-8 shrink-0 self-stretch overflow-hidden rounded-[calc(var(--an-input-border-radius)-var(--an-context-padding)-2px)]", canPreview && "cursor-pointer"),
949
- onClick: canPreview ? openLightbox : void 0,
950
- role: canPreview ? "button" : void 0,
951
- tabIndex: canPreview ? 0 : void 0,
952
- "aria-label": canPreview ? `Preview ${filename}` : void 0,
953
- onKeyDown: canPreview ? (event) => {
954
- if (event.key === "Enter" || event.key === " ") {
955
- event.preventDefault();
956
- openLightbox();
957
- }
958
- } : void 0,
959
- children: /* @__PURE__ */ jsx("img", {
960
- src: url,
961
- alt: filename,
962
- className: "aspect-square h-full w-full object-cover"
963
- })
964
- }) : /* @__PURE__ */ jsx("div", {
965
- className: "flex w-8 shrink-0 items-center justify-center self-stretch rounded-[calc(var(--an-input-border-radius)-var(--an-context-padding)-2px)] bg-muted",
966
- children: renderFileIcon(iconName)
967
- }), /* @__PURE__ */ jsxs("div", {
968
- className: "flex min-w-0 flex-col",
969
- children: [/* @__PURE__ */ jsx("span", {
970
- className: "truncate text-sm font-medium text-foreground",
971
- title: filename,
972
- children: filename
973
- }), size !== void 0 && /* @__PURE__ */ jsx("span", {
974
- className: "text-[0.625rem] text-muted-foreground",
975
- children: formatFileSize(size)
976
- })]
977
- })] }),
978
- onRemove && /* @__PURE__ */ jsx("button", {
979
- onClick: (e) => {
980
- e.stopPropagation();
981
- onRemove();
982
- },
983
- "aria-label": `Remove ${filename}`,
984
- className: `absolute -top-1.5 -right-1.5 z-10 flex size-4 items-center justify-center rounded-full border border-border bg-background text-muted-foreground transition-[opacity,transform] duration-150 ease-out hover:text-foreground active:scale-[0.97] ${isHovered ? "opacity-100" : "opacity-0"}`,
985
- type: "button",
986
- children: /* @__PURE__ */ jsx(X, { className: "size-3" })
987
- }),
988
- canPreview && url && /* @__PURE__ */ jsx(ImageLightbox, {
989
- open: isLightboxOpen,
990
- onClose: () => setIsLightboxOpen(false),
991
- images: [{
992
- id,
993
- url,
994
- filename
995
- }]
996
- })
997
- ]
998
- });
999
- }
1000
- function isRecord$2(value) {
938
+ function isRecord$1(value) {
1001
939
  return typeof value === "object" && value !== null;
1002
940
  }
1003
941
  function isTextPart(part) {
1004
- return isRecord$2(part) && part.type === "text" && typeof part.text === "string";
942
+ return isRecord$1(part) && part.type === "text" && typeof part.text === "string";
1005
943
  }
1006
944
  function isErrorPart(part) {
1007
- return isRecord$2(part) && part.type === "error" && typeof part.message === "string";
945
+ return isRecord$1(part) && part.type === "error" && typeof part.message === "string";
1008
946
  }
1009
947
  function isPayloadPart(part) {
1010
- return isRecord$2(part) && part.type === "payload" && typeof part.kind === "string" && typeof part.title === "string";
948
+ return isRecord$1(part) && part.type === "payload" && typeof part.kind === "string" && typeof part.title === "string";
1011
949
  }
1012
950
  function isV5ToolPart(part) {
1013
- if (!isRecord$2(part)) return false;
951
+ if (!isRecord$1(part)) return false;
1014
952
  const partType = part.type;
1015
953
  return partType === "dynamic-tool" || typeof partType === "string" && partType.startsWith("tool-");
1016
954
  }
@@ -1019,284 +957,30 @@ function getTextFromParts(parts, joiner) {
1019
957
  for (const part of parts) if (isTextPart(part)) texts.push(part.text);
1020
958
  return texts.join(joiner);
1021
959
  }
1022
- function isRecord$1(value) {
1023
- return typeof value === "object" && value !== null;
1024
- }
1025
- function getImageUrlFromPart(part) {
1026
- if (!isRecord$1(part)) return null;
1027
- const type = part.type;
1028
- if (typeof type !== "string") return null;
1029
- if (type === "image") {
1030
- const imagePart = part;
1031
- return imagePart.url ?? imagePart.image ?? null;
1032
- }
1033
- if (type === "data-image") return part.data?.url ?? null;
1034
- if (type === "file") {
1035
- const filePart = part;
1036
- if (filePart.mimeType?.startsWith("image/")) {
1037
- if (filePart.url) return filePart.url;
1038
- if (filePart.data) return `data:${filePart.mimeType};base64,${filePart.data}`;
1039
- }
1040
- }
1041
- return null;
1042
- }
1043
- function getFileFromPart(part) {
1044
- if (!isRecord$1(part)) return null;
1045
- if (part.type !== "file") return null;
1046
- const filePart = part;
1047
- const filename = filePart.filename || filePart.name || filePart.fileName || "Attachment";
1048
- if (filePart.mimeType?.startsWith("image/") ?? false) return null;
1049
- return {
1050
- filename,
1051
- size: filePart.size
1052
- };
1053
- }
1054
- var UserMessage = memo(function UserMessage2({ message, className, enableImagePreview = true }) {
1055
- const [lightboxIndex, setLightboxIndex] = useState(null);
1056
- const text = (message.parts?.filter(isTextPart) ?? []).map((p) => p.text).join("");
1057
- const images = [];
1058
- const files = [];
1059
- for (const part of message.parts ?? []) {
1060
- const imageUrl = getImageUrlFromPart(part);
1061
- if (imageUrl) images.push(imageUrl);
1062
- const file = getFileFromPart(part);
1063
- if (file) files.push(file);
1064
- }
1065
- if (isRecord$1(message) && Array.isArray(message.experimental_attachments)) {
1066
- for (const att of message.experimental_attachments) if (att.contentType?.startsWith("image/") && att.url) images.push(att.url);
1067
- }
1068
- if (!text && images.length === 0 && files.length === 0) return null;
1069
- const lightboxImages = images.map((url, i) => ({
1070
- id: `${message.id}-img-${i}`,
1071
- url,
1072
- filename: `image-${i + 1}`
1073
- }));
960
+ memo(function UserTurn(props) {
961
+ const { message, UserMessageComponent, userMessageClassName, onCopied, display } = props;
962
+ const { enableImagePreview, showCopyToolbar, isMounted, isCopyVisible } = display;
963
+ const text = getTextFromParts(message.parts ?? [], "");
964
+ const hasParts = (message.parts ?? []).length > 0;
965
+ if (!text && !hasParts) return null;
966
+ const userCreatedAt = message?.createdAt;
967
+ const userCopyKey = `user-${message.id}`;
968
+ const userTimestamp = isMounted && userCreatedAt ? formatTimestamp(new Date(userCreatedAt)) : void 0;
1074
969
  return /* @__PURE__ */ jsxs("div", {
1075
- className: cn("flex flex-col items-end gap-1", className),
1076
- children: [
1077
- images.length > 0 && images.map((url, i) => /* @__PURE__ */ jsx("div", {
1078
- className: cn("max-w-[200px] rounded-an-message bg-an-foreground/4 p-1.5", enableImagePreview && "cursor-pointer"),
1079
- onClick: enableImagePreview ? () => setLightboxIndex(i) : void 0,
1080
- role: enableImagePreview ? "button" : void 0,
1081
- tabIndex: enableImagePreview ? 0 : void 0,
1082
- onKeyDown: enableImagePreview ? (event) => {
1083
- if (event.key === "Enter" || event.key === " ") {
1084
- event.preventDefault();
1085
- setLightboxIndex(i);
1086
- }
1087
- } : void 0,
1088
- children: /* @__PURE__ */ jsx("img", {
1089
- src: url,
1090
- alt: "attachment",
1091
- className: "block max-h-[120px] max-w-[184px] rounded-an-message-inner object-cover"
1092
- })
1093
- }, url)),
1094
- enableImagePreview && lightboxImages.length > 0 && /* @__PURE__ */ jsx(ImageLightbox, {
1095
- open: lightboxIndex !== null,
1096
- onClose: () => setLightboxIndex(null),
1097
- images: lightboxImages,
1098
- initialIndex: lightboxIndex ?? 0
1099
- }),
1100
- files.length > 0 && /* @__PURE__ */ jsx("div", {
1101
- className: "flex flex-col items-end gap-2",
1102
- children: files.map((file, i) => /* @__PURE__ */ jsx(FileAttachment, {
1103
- id: `${file.filename}-${i}`,
1104
- filename: file.filename,
1105
- size: file.size
1106
- }, `${file.filename}-${file.size}`))
1107
- }),
1108
- text && /* @__PURE__ */ jsx("div", {
1109
- className: "ms-[70px] max-w-[calc(95%-40px)]",
1110
- children: /* @__PURE__ */ jsx("div", {
1111
- className: "rounded-an-message bg-an-user-message-bg px-3.5 py-1.5 text-sm text-an-user-message-text transition-colors",
1112
- children: /* @__PURE__ */ jsx("p", {
1113
- className: "leading-5 wrap-break-word whitespace-pre-wrap",
1114
- children: text
1115
- })
1116
- })
1117
- })
1118
- ]
1119
- });
1120
- });
1121
- var ErrorMessage = memo(function ErrorMessage2({ title = "Something went wrong", message, className }) {
1122
- return /* @__PURE__ */ jsx("div", {
1123
- className: cn("flex justify-start", className),
1124
- children: /* @__PURE__ */ jsxs("div", {
1125
- className: "rounded-[8px] border border-red-500/30 bg-red-500/10 px-4 py-2.5 text-sm text-an-foreground",
1126
- children: [/* @__PURE__ */ jsx("div", {
1127
- className: "font-medium text-an-foreground",
1128
- children: title
1129
- }), /* @__PURE__ */ jsx("div", {
1130
- className: "mt-0.5 text-an-foreground-muted",
1131
- children: message
1132
- })]
1133
- })
1134
- });
1135
- });
1136
- function formatPayload(value) {
1137
- if (typeof value === "string") return value;
1138
- if (value === void 0) return "";
1139
- try {
1140
- return JSON.stringify(value, null, 2) ?? "";
1141
- } catch {
1142
- return String(value);
1143
- }
1144
- }
1145
- function PayloadPart({ part }) {
1146
- const payload = formatPayload(part.payload);
1147
- return /* @__PURE__ */ jsxs("section", {
1148
- "data-payload-kind": part.kind,
1149
- className: "w-full min-w-0 overflow-hidden rounded-xl border border-border/60 bg-muted/40 text-sm",
1150
- children: [
1151
- /* @__PURE__ */ jsx("div", {
1152
- className: "border-b border-border/50 px-3 py-2 text-xs font-medium text-muted-foreground",
1153
- children: part.title
1154
- }),
1155
- part.text ? /* @__PURE__ */ jsx("pre", {
1156
- className: "m-0 whitespace-pre-wrap break-words p-3 font-mono text-xs leading-5 text-foreground/80",
1157
- children: part.text
1158
- }) : null,
1159
- payload ? /* @__PURE__ */ jsxs("details", {
1160
- open: true,
1161
- className: "border-t border-border/50 px-3 py-2",
1162
- children: [/* @__PURE__ */ jsx("summary", {
1163
- className: "cursor-pointer text-xs font-medium text-muted-foreground",
1164
- children: "Payload"
1165
- }), /* @__PURE__ */ jsx("pre", {
1166
- className: "m-0 mt-2 max-w-full whitespace-pre-wrap break-words font-mono text-xs leading-5 text-foreground/70",
1167
- children: payload
1168
- })]
1169
- }) : null
1170
- ]
1171
- });
1172
- }
1173
- function isRecord(value) {
1174
- return typeof value === "object" && value !== null;
1175
- }
1176
- function parseStructuredJson(value) {
1177
- if (typeof value !== "string") return value;
1178
- const trimmed = value.trim();
1179
- if (!trimmed) return value;
1180
- try {
1181
- const parsed = JSON.parse(trimmed);
1182
- return isRecord(parsed) || Array.isArray(parsed) ? parsed : value;
1183
- } catch {
1184
- return value;
1185
- }
1186
- }
1187
- function normalizeToolPart(part) {
1188
- if (!isRecord(part)) return part;
1189
- if (typeof part.type !== "string" || !part.type.startsWith("tool-")) return part;
1190
- const normalizedInput = parseStructuredJson(part.input);
1191
- const normalizedOutput = parseStructuredJson(part.output);
1192
- const normalizedResult = parseStructuredJson(part.result);
1193
- const inputChanged = normalizedInput !== part.input;
1194
- const outputChanged = normalizedOutput !== part.output;
1195
- const resultChanged = normalizedResult !== part.result;
1196
- if (!inputChanged && !outputChanged && !resultChanged) return part;
1197
- const normalizedPart = { ...part };
1198
- if (inputChanged) normalizedPart.input = normalizedInput;
1199
- if (outputChanged) normalizedPart.output = normalizedOutput;
1200
- if (resultChanged) normalizedPart.result = normalizedResult;
1201
- return normalizedPart;
1202
- }
1203
- function normalizeAssistantToolParts(parts) {
1204
- let changed = false;
1205
- const normalizedParts = parts.map((part) => {
1206
- const normalizedPart = normalizeToolPart(part);
1207
- if (normalizedPart !== part) changed = true;
1208
- return normalizedPart;
1209
- });
1210
- return changed ? normalizedParts : parts;
1211
- }
1212
- var timeFormatter = new Intl.DateTimeFormat("en-US", {
1213
- hour: "numeric",
1214
- minute: "2-digit",
1215
- hour12: true
1216
- });
1217
- var dateFormatter = new Intl.DateTimeFormat("en-US", {
1218
- month: "short",
1219
- day: "numeric"
1220
- });
1221
- function formatTimestamp(date) {
1222
- const now = /* @__PURE__ */ new Date();
1223
- if (date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate()) return timeFormatter.format(date);
1224
- return dateFormatter.format(date);
1225
- }
1226
- function CopyButton({ text, onCopied }) {
1227
- const [copied, setCopied] = useState(false);
1228
- const copiedTimerRef = useRef(null);
1229
- useEffect(() => {
1230
- return () => {
1231
- if (copiedTimerRef.current) window.clearTimeout(copiedTimerRef.current);
1232
- };
1233
- }, []);
1234
- const handleCopy = async () => {
1235
- try {
1236
- await navigator.clipboard.writeText(text);
1237
- setCopied(true);
1238
- if (copiedTimerRef.current) window.clearTimeout(copiedTimerRef.current);
1239
- copiedTimerRef.current = window.setTimeout(() => {
1240
- setCopied(false);
1241
- copiedTimerRef.current = null;
1242
- }, 2e3);
1243
- notify.success("Copied to clipboard");
1244
- onCopied?.();
1245
- } catch {
1246
- notify.error("Failed to copy to clipboard");
1247
- }
1248
- };
1249
- return /* @__PURE__ */ jsx("button", {
1250
- type: "button",
1251
- tabIndex: -1,
1252
- "aria-label": copied ? "Copied" : "Copy message",
1253
- onClick: handleCopy,
1254
- onPointerDown: (event) => {
1255
- event.stopPropagation();
1256
- },
1257
- onMouseDown: (event) => event.stopPropagation(),
1258
- className: cn("flex size-6 items-center justify-center rounded-md transition-[background-color,opacity,transform] duration-150 ease-out active:scale-[0.97]", "bg-transparent opacity-50 hover:bg-an-foreground/10 hover:opacity-100"),
1259
- children: /* @__PURE__ */ jsxs("div", {
1260
- className: "relative size-3.5",
1261
- children: [/* @__PURE__ */ jsx(Copy, { className: cn("absolute inset-0 h-3.5 w-3.5 text-an-foreground-muted transition-[opacity,transform] duration-150 ease-out", copied ? "scale-50 opacity-0" : "scale-100 opacity-100") }), /* @__PURE__ */ jsx(Check, { className: cn("absolute inset-0 h-3.5 w-3.5 text-an-foreground-muted transition-[opacity,transform] duration-150 ease-out", copied ? "scale-100 opacity-100" : "scale-50 opacity-0") })]
1262
- })
1263
- });
1264
- }
1265
- function MessageToolbar({ text, timestamp, heightClass, hoverClass, isVisible, alignClass, onCopied }) {
1266
- return /* @__PURE__ */ jsxs("div", {
1267
- className: cn("pointer-events-none flex items-center gap-1 pt-1 text-xs text-an-foreground-muted/70 opacity-0 transition-opacity duration-100", heightClass, alignClass, hoverClass, isVisible && "pointer-events-auto opacity-100"),
1268
- onMouseDown: (event) => event.stopPropagation(),
1269
- onPointerDown: (event) => event.stopPropagation(),
1270
- children: [timestamp && /* @__PURE__ */ jsx("span", { children: timestamp }), text && /* @__PURE__ */ jsx(CopyButton, {
1271
- text,
1272
- onCopied
1273
- })]
1274
- });
1275
- }
1276
- memo(function UserTurn(props) {
1277
- const { message, UserMessageComponent, userMessageClassName, onCopied, display } = props;
1278
- const { enableImagePreview, showCopyToolbar, isMounted, isCopyVisible } = display;
1279
- const text = getTextFromParts(message.parts ?? [], "");
1280
- const hasParts = (message.parts ?? []).length > 0;
1281
- if (!text && !hasParts) return null;
1282
- const userCreatedAt = message?.createdAt;
1283
- const userCopyKey = `user-${message.id}`;
1284
- const userTimestamp = isMounted && userCreatedAt ? formatTimestamp(new Date(userCreatedAt)) : void 0;
1285
- return /* @__PURE__ */ jsxs("div", {
1286
- className: "group/user-message",
1287
- children: [/* @__PURE__ */ jsx(UserMessageComponent, {
1288
- message,
1289
- className: userMessageClassName,
1290
- enableImagePreview
1291
- }), (showCopyToolbar && Boolean(text) || Boolean(userTimestamp)) && /* @__PURE__ */ jsx(MessageToolbar, {
1292
- text: showCopyToolbar ? text : "",
1293
- timestamp: userTimestamp,
1294
- heightClass: "h-[28px]",
1295
- hoverClass: "group-hover/user-message:opacity-100 group-hover/user-message:pointer-events-auto",
1296
- isVisible: isCopyVisible,
1297
- alignClass: "justify-end",
1298
- onCopied: () => onCopied(userCopyKey)
1299
- })]
970
+ className: "group/user-message",
971
+ children: [/* @__PURE__ */ jsx(UserMessageComponent, {
972
+ message,
973
+ className: userMessageClassName,
974
+ enableImagePreview
975
+ }), (showCopyToolbar && Boolean(text) || Boolean(userTimestamp)) && /* @__PURE__ */ jsx(MessageToolbar, {
976
+ text: showCopyToolbar ? text : "",
977
+ timestamp: userTimestamp,
978
+ heightClass: "h-[28px]",
979
+ hoverClass: "group-hover/user-message:opacity-100 group-hover/user-message:pointer-events-auto",
980
+ isVisible: isCopyVisible,
981
+ alignClass: "justify-end",
982
+ onCopied: () => onCopied(userCopyKey)
983
+ })]
1300
984
  });
1301
985
  });
1302
986
  memo(function AssistantTurn(props) {
@@ -1328,141 +1012,514 @@ memo(function AssistantTurn(props) {
1328
1012
  onOpenArtifact
1329
1013
  }, msg.id);
1330
1014
  })
1331
- }), (showToolbar || isCopyVisible) && /* @__PURE__ */ jsx(MessageToolbar, {
1332
- text: toolbarText,
1333
- heightClass: "h-[48px] flex items-start w-full",
1334
- hoverClass: "group-hover/assistant-turn:opacity-100 group-hover/assistant-turn:pointer-events-auto",
1335
- isVisible: isCopyVisible,
1336
- alignClass: "justify-start",
1337
- onCopied: () => onCopied(copyKey)
1338
- })]
1015
+ }), (showToolbar || isCopyVisible) && /* @__PURE__ */ jsx(MessageToolbar, {
1016
+ text: toolbarText,
1017
+ heightClass: "h-[48px] flex items-start w-full",
1018
+ hoverClass: "group-hover/assistant-turn:opacity-100 group-hover/assistant-turn:pointer-events-auto",
1019
+ isVisible: isCopyVisible,
1020
+ alignClass: "justify-start",
1021
+ onCopied: () => onCopied(copyKey)
1022
+ })]
1023
+ });
1024
+ });
1025
+ var TOOL_CALL_KEY_PREFIX = "tool-call:";
1026
+ var UNKEYED_TOOL_KEY_PREFIX = "unkeyed-tool:";
1027
+ function getAssistantToolElementKey(messageId, part, occurrence) {
1028
+ if (part.toolCallId) return `${TOOL_CALL_KEY_PREFIX}${part.toolCallId}`;
1029
+ return `${UNKEYED_TOOL_KEY_PREFIX}${messageId}:${part.type}:${occurrence}`;
1030
+ }
1031
+ function buildAssistantElements(parts, opts) {
1032
+ const { messageId, isLast, isStreaming, suppressQuestionTool, suppressTextWhenPlanWrite = false, ToolRendererComponent, TextRendererComponent, toolRenderers, onOpenUIAction, onOpenUIArtifactReady, onOpenArtifact } = opts;
1033
+ const elems = [];
1034
+ const textChunks = [];
1035
+ const hasPlanWritePresentation = suppressTextWhenPlanWrite && parts.some((part) => isV5ToolPart(part) && part.type === "tool-PlanWrite");
1036
+ const taskPartIds = new Set(parts.filter((p) => isV5ToolPart(p) && (p.type === "tool-Task" || p.type === "tool-Agent") && typeof p.toolCallId === "string").map((p) => p.toolCallId));
1037
+ const nestedToolsMap = /* @__PURE__ */ new Map();
1038
+ const nestedToolIds = /* @__PURE__ */ new Set();
1039
+ const unkeyedToolOccurrences = /* @__PURE__ */ new Map();
1040
+ for (const part of parts) {
1041
+ if (!isV5ToolPart(part)) continue;
1042
+ if (part.type === "tool-TaskOutput") continue;
1043
+ if (!part.toolCallId || !part.toolCallId.includes(":")) continue;
1044
+ const parentId = part.toolCallId.split(":")[0];
1045
+ if (!taskPartIds.has(parentId)) continue;
1046
+ if (!nestedToolsMap.has(parentId)) nestedToolsMap.set(parentId, []);
1047
+ nestedToolsMap.get(parentId).push(part);
1048
+ nestedToolIds.add(part.toolCallId);
1049
+ }
1050
+ let i = 0;
1051
+ while (i < parts.length) {
1052
+ const part = parts[i];
1053
+ if (isV5ToolPart(part) && part.type === "tool-TaskOutput") {
1054
+ i++;
1055
+ continue;
1056
+ }
1057
+ if (isTextPart(part)) {
1058
+ const text2 = part.text;
1059
+ if (text2 && !hasPlanWritePresentation) textChunks.push(text2);
1060
+ i++;
1061
+ continue;
1062
+ }
1063
+ if (isErrorPart(part)) {
1064
+ elems.push(/* @__PURE__ */ jsx(ErrorMessage, {
1065
+ title: part.title,
1066
+ message: part.message
1067
+ }, `${messageId}-error-${part.title}-${part.message}`));
1068
+ i++;
1069
+ continue;
1070
+ }
1071
+ if (isPayloadPart(part)) {
1072
+ elems.push(/* @__PURE__ */ jsx(PayloadPart, { part }, `${messageId}-payload-${i}`));
1073
+ i++;
1074
+ continue;
1075
+ }
1076
+ if (isV5ToolPart(part)) {
1077
+ if (suppressQuestionTool && part.type === "tool-Question") {
1078
+ i++;
1079
+ continue;
1080
+ }
1081
+ if (part.toolCallId && nestedToolIds.has(part.toolCallId)) {
1082
+ i++;
1083
+ continue;
1084
+ }
1085
+ const chatStreamingStatus = isLast && isStreaming ? "streaming" : void 0;
1086
+ const toolCallId = part.toolCallId;
1087
+ const nestedTools = (part.type === "tool-Task" || part.type === "tool-Agent") && toolCallId ? nestedToolsMap.get(toolCallId) || [] : void 0;
1088
+ const occurrence = part.toolCallId ? 0 : unkeyedToolOccurrences.get(part.type) ?? 0;
1089
+ if (!part.toolCallId) unkeyedToolOccurrences.set(part.type, occurrence + 1);
1090
+ elems.push(/* @__PURE__ */ jsx(ToolRendererComponent, {
1091
+ part,
1092
+ nestedTools,
1093
+ chatStatus: chatStreamingStatus,
1094
+ toolRenderers
1095
+ }, getAssistantToolElementKey(messageId, part, occurrence)));
1096
+ i++;
1097
+ continue;
1098
+ }
1099
+ i++;
1100
+ }
1101
+ const text = textChunks.join("\n\n");
1102
+ if (text) elems.push(/* @__PURE__ */ jsx("div", {
1103
+ className: "group/assistant-text text-body",
1104
+ children: /* @__PURE__ */ jsx(TextRendererComponent, {
1105
+ content: text,
1106
+ isStreaming,
1107
+ messageId,
1108
+ onOpenUIAction,
1109
+ onOpenUIArtifactReady,
1110
+ onOpenArtifact,
1111
+ className: "leading-relaxed [&_p]:leading-relaxed"
1112
+ })
1113
+ }, `${messageId}-text-final`));
1114
+ return elems;
1115
+ }
1116
+ function AssistantParts({ msg, isLast, isStreaming, suppressQuestionTool, ToolRendererComponent, TextRendererComponent, toolRenderers, onOpenUIAction, onOpenUIArtifactReady, onOpenArtifact }) {
1117
+ const parts = useMemo(() => normalizeAssistantToolParts(msg.parts ?? []), [msg.parts]);
1118
+ const elements = useMemo(() => buildAssistantElements(parts, {
1119
+ messageId: msg.id,
1120
+ isLast,
1121
+ isStreaming,
1122
+ suppressQuestionTool,
1123
+ ToolRendererComponent,
1124
+ TextRendererComponent,
1125
+ toolRenderers,
1126
+ onOpenUIAction,
1127
+ onOpenUIArtifactReady,
1128
+ onOpenArtifact
1129
+ }), [
1130
+ parts,
1131
+ msg.id,
1132
+ isLast,
1133
+ isStreaming,
1134
+ suppressQuestionTool,
1135
+ ToolRendererComponent,
1136
+ TextRendererComponent,
1137
+ toolRenderers,
1138
+ onOpenUIAction,
1139
+ onOpenUIArtifactReady,
1140
+ onOpenArtifact
1141
+ ]);
1142
+ if (elements.length > 1) return /* @__PURE__ */ jsx("div", {
1143
+ className: "group/assistant-turn flex flex-col gap-3",
1144
+ children: elements
1145
+ });
1146
+ return /* @__PURE__ */ jsx("div", {
1147
+ className: "group/assistant-turn",
1148
+ children: elements
1149
+ });
1150
+ }
1151
+ function ImageLightbox({ open, onClose, images, initialIndex = 0 }) {
1152
+ const [currentIndex, setCurrentIndex] = useState(initialIndex);
1153
+ const hasMultipleImages = images.length > 1;
1154
+ useEffect(() => {
1155
+ if (open) setCurrentIndex(initialIndex);
1156
+ }, [open, initialIndex]);
1157
+ const goToPrevious = useCallback((event) => {
1158
+ event?.stopPropagation();
1159
+ setCurrentIndex((prev) => prev > 0 ? prev - 1 : images.length - 1);
1160
+ }, [images.length]);
1161
+ const goToNext = useCallback((event) => {
1162
+ event?.stopPropagation();
1163
+ setCurrentIndex((prev) => prev < images.length - 1 ? prev + 1 : 0);
1164
+ }, [images.length]);
1165
+ const onLightboxKeyDown = useEffectEvent((event) => {
1166
+ switch (event.key) {
1167
+ case "ArrowLeft":
1168
+ event.preventDefault();
1169
+ if (hasMultipleImages) goToPrevious();
1170
+ break;
1171
+ case "ArrowRight":
1172
+ event.preventDefault();
1173
+ if (hasMultipleImages) goToNext();
1174
+ }
1175
+ });
1176
+ useEffect(() => {
1177
+ if (!open) return;
1178
+ const handler = (event) => onLightboxKeyDown(event);
1179
+ window.addEventListener("keydown", handler, true);
1180
+ return () => window.removeEventListener("keydown", handler, true);
1181
+ }, [open]);
1182
+ useEffect(() => {
1183
+ if (!open) return;
1184
+ const previousOverflow = document.body.style.overflow;
1185
+ document.body.style.overflow = "hidden";
1186
+ return () => {
1187
+ document.body.style.overflow = previousOverflow;
1188
+ };
1189
+ }, [open]);
1190
+ const dialogRef = useRef(null);
1191
+ const onLightDismiss = useEffectEvent((event) => {
1192
+ if (dialogRef.current && event.target === dialogRef.current) onClose();
1193
+ });
1194
+ useEffect(() => {
1195
+ if (!open) return;
1196
+ const dialog = dialogRef.current;
1197
+ if (!dialog) return;
1198
+ if (!dialog.open) dialog.showModal();
1199
+ const handler = (event) => onLightDismiss(event);
1200
+ dialog.addEventListener("click", handler);
1201
+ return () => {
1202
+ dialog.removeEventListener("click", handler);
1203
+ if (dialog.open) dialog.close();
1204
+ };
1205
+ }, [open]);
1206
+ if (typeof document === "undefined") return null;
1207
+ if (!open) return null;
1208
+ const currentImage = images[currentIndex] ?? images[0];
1209
+ if (!currentImage?.url) return null;
1210
+ return createPortal(/* @__PURE__ */ jsxs("dialog", {
1211
+ ref: dialogRef,
1212
+ "aria-label": "Image viewer",
1213
+ onClose: () => onClose(),
1214
+ className: "fixed inset-0 z-50 m-0 flex h-full max-h-none w-full max-w-none items-center justify-center border-0 bg-black/90 p-0 backdrop:bg-transparent",
1215
+ children: [
1216
+ /* @__PURE__ */ jsx("button", {
1217
+ type: "button",
1218
+ onClick: onClose,
1219
+ "aria-label": "Close fullscreen (Esc)",
1220
+ className: "absolute top-4 right-4 z-10 inline-flex size-9 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
1221
+ children: /* @__PURE__ */ jsx(X, { className: "size-5" })
1222
+ }),
1223
+ hasMultipleImages && /* @__PURE__ */ jsx("button", {
1224
+ type: "button",
1225
+ onClick: goToPrevious,
1226
+ "aria-label": "Previous image (\u2190)",
1227
+ className: "absolute top-1/2 left-4 z-10 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
1228
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-6" })
1229
+ }),
1230
+ /* @__PURE__ */ jsx("img", {
1231
+ src: currentImage.url,
1232
+ alt: currentImage.filename ?? "Image preview",
1233
+ className: "max-h-[85vh] max-w-[90vw] object-contain select-none",
1234
+ onClick: (event) => event.stopPropagation(),
1235
+ draggable: false
1236
+ }),
1237
+ hasMultipleImages && /* @__PURE__ */ jsx("button", {
1238
+ type: "button",
1239
+ onClick: goToNext,
1240
+ "aria-label": "Next image (\u2192)",
1241
+ className: "absolute top-1/2 right-4 z-10 inline-flex size-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",
1242
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-6" })
1243
+ }),
1244
+ hasMultipleImages && /* @__PURE__ */ jsxs("div", {
1245
+ className: "absolute bottom-6 left-1/2 flex -translate-x-1/2 flex-col items-center gap-3",
1246
+ children: [/* @__PURE__ */ jsx("div", {
1247
+ className: "flex gap-2",
1248
+ children: images.map((image, idx) => /* @__PURE__ */ jsx("button", {
1249
+ type: "button",
1250
+ onClick: (event) => {
1251
+ event.stopPropagation();
1252
+ setCurrentIndex(idx);
1253
+ },
1254
+ "aria-label": `Go to image ${idx + 1}`,
1255
+ className: cn("size-2 rounded-full transition-all", idx === currentIndex ? "scale-125 bg-white" : "bg-white/40 hover:bg-white/60")
1256
+ }, image.url))
1257
+ }), /* @__PURE__ */ jsxs("span", {
1258
+ className: "text-sm text-white/70",
1259
+ children: [
1260
+ currentIndex + 1,
1261
+ " / ",
1262
+ images.length
1263
+ ]
1264
+ })]
1265
+ })
1266
+ ]
1267
+ }), document.body);
1268
+ }
1269
+ function formatFileSize(bytes) {
1270
+ if (bytes < 1024) return `${bytes} B`;
1271
+ if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
1272
+ return `${(bytes / 1048576).toFixed(1)} MB`;
1273
+ }
1274
+ function getFileIconName(filename, isImage) {
1275
+ if (isImage) return "image";
1276
+ const ext = filename.split(".").pop()?.toLowerCase();
1277
+ if ([
1278
+ "js",
1279
+ "ts",
1280
+ "jsx",
1281
+ "tsx",
1282
+ "py",
1283
+ "rb",
1284
+ "go",
1285
+ "rs",
1286
+ "java",
1287
+ "kt",
1288
+ "swift",
1289
+ "c",
1290
+ "cpp",
1291
+ "h",
1292
+ "hpp",
1293
+ "cs",
1294
+ "php"
1295
+ ].includes(ext || "")) return "code";
1296
+ if ([
1297
+ "json",
1298
+ "yaml",
1299
+ "yml",
1300
+ "xml"
1301
+ ].includes(ext || "")) return "data";
1302
+ return "text";
1303
+ }
1304
+ function renderFileIcon(iconName) {
1305
+ switch (iconName) {
1306
+ case "image":
1307
+ return /* @__PURE__ */ jsx(Image, { className: "size-4 text-muted-foreground" });
1308
+ case "code":
1309
+ return /* @__PURE__ */ jsx(FileCode, { className: "size-4 text-muted-foreground" });
1310
+ case "data":
1311
+ return /* @__PURE__ */ jsx(FileBraces, { className: "size-4 text-muted-foreground" });
1312
+ default:
1313
+ return /* @__PURE__ */ jsx(FileText, { className: "size-4 text-muted-foreground" });
1314
+ }
1315
+ }
1316
+ function FileAttachment({ id, filename, size, isImage, url, onRemove, className, display = "chip", enableImagePreview = true }) {
1317
+ const [isHovered, setIsHovered] = useState(false);
1318
+ const [isLightboxOpen, setIsLightboxOpen] = useState(false);
1319
+ const iconName = getFileIconName(filename, isImage);
1320
+ const isImageOnly = display === "image-only" && isImage && !!url;
1321
+ const canPreview = Boolean(enableImagePreview && isImage && url);
1322
+ const openLightbox = (event) => {
1323
+ event?.stopPropagation();
1324
+ setIsLightboxOpen(true);
1325
+ };
1326
+ return /* @__PURE__ */ jsxs("div", {
1327
+ className: cn("relative rounded-[calc(var(--chat-input-radius)-var(--chat-context-padding))] bg-muted/50", isImageOnly ? "flex size-10 items-center justify-center" : "flex max-w-[200px] min-w-[120px] items-center gap-2 py-1 pr-2 pl-1", className),
1328
+ onMouseEnter: () => setIsHovered(true),
1329
+ onMouseLeave: () => setIsHovered(false),
1330
+ children: [
1331
+ isImageOnly ? /* @__PURE__ */ jsx("div", {
1332
+ className: cn("size-8 shrink-0 overflow-hidden rounded-[calc(var(--chat-input-radius)-var(--chat-context-padding)-2px)]", canPreview && "cursor-pointer"),
1333
+ onClick: canPreview ? openLightbox : void 0,
1334
+ role: canPreview ? "button" : void 0,
1335
+ tabIndex: canPreview ? 0 : void 0,
1336
+ "aria-label": canPreview ? `Preview ${filename}` : void 0,
1337
+ onKeyDown: canPreview ? (event) => {
1338
+ if (event.key === "Enter" || event.key === " ") {
1339
+ event.preventDefault();
1340
+ openLightbox();
1341
+ }
1342
+ } : void 0,
1343
+ children: /* @__PURE__ */ jsx("img", {
1344
+ src: url,
1345
+ alt: filename,
1346
+ className: "h-full w-full object-cover"
1347
+ })
1348
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [isImage && url ? /* @__PURE__ */ jsx("div", {
1349
+ className: cn("w-8 shrink-0 self-stretch overflow-hidden rounded-[calc(var(--chat-input-radius)-var(--chat-context-padding)-2px)]", canPreview && "cursor-pointer"),
1350
+ onClick: canPreview ? openLightbox : void 0,
1351
+ role: canPreview ? "button" : void 0,
1352
+ tabIndex: canPreview ? 0 : void 0,
1353
+ "aria-label": canPreview ? `Preview ${filename}` : void 0,
1354
+ onKeyDown: canPreview ? (event) => {
1355
+ if (event.key === "Enter" || event.key === " ") {
1356
+ event.preventDefault();
1357
+ openLightbox();
1358
+ }
1359
+ } : void 0,
1360
+ children: /* @__PURE__ */ jsx("img", {
1361
+ src: url,
1362
+ alt: filename,
1363
+ className: "aspect-square h-full w-full object-cover"
1364
+ })
1365
+ }) : /* @__PURE__ */ jsx("div", {
1366
+ className: "flex w-8 shrink-0 items-center justify-center self-stretch rounded-[calc(var(--chat-input-radius)-var(--chat-context-padding)-2px)] bg-muted",
1367
+ children: renderFileIcon(iconName)
1368
+ }), /* @__PURE__ */ jsxs("div", {
1369
+ className: "flex min-w-0 flex-col",
1370
+ children: [/* @__PURE__ */ jsx("span", {
1371
+ className: "truncate text-sm font-medium text-foreground",
1372
+ title: filename,
1373
+ children: filename
1374
+ }), size !== void 0 && /* @__PURE__ */ jsx("span", {
1375
+ className: "text-micro text-muted-foreground",
1376
+ children: formatFileSize(size)
1377
+ })]
1378
+ })] }),
1379
+ onRemove && /* @__PURE__ */ jsx("button", {
1380
+ onClick: (e) => {
1381
+ e.stopPropagation();
1382
+ onRemove();
1383
+ },
1384
+ "aria-label": `Remove ${filename}`,
1385
+ className: `absolute -top-1.5 -right-1.5 z-10 flex size-4 items-center justify-center rounded-full border border-border bg-background text-muted-foreground transition-[opacity,transform] duration-150 ease-out hover:text-foreground active:scale-[0.97] ${isHovered ? "opacity-100" : "opacity-0"}`,
1386
+ type: "button",
1387
+ children: /* @__PURE__ */ jsx(X, { className: "size-3" })
1388
+ }),
1389
+ canPreview && url && /* @__PURE__ */ jsx(ImageLightbox, {
1390
+ open: isLightboxOpen,
1391
+ onClose: () => setIsLightboxOpen(false),
1392
+ images: [{
1393
+ id,
1394
+ url,
1395
+ filename
1396
+ }]
1397
+ })
1398
+ ]
1339
1399
  });
1340
- });
1341
- var TOOL_CALL_KEY_PREFIX = "tool-call:";
1342
- var UNKEYED_TOOL_KEY_PREFIX = "unkeyed-tool:";
1343
- function getAssistantToolElementKey(messageId, part, occurrence) {
1344
- if (part.toolCallId) return `${TOOL_CALL_KEY_PREFIX}${part.toolCallId}`;
1345
- return `${UNKEYED_TOOL_KEY_PREFIX}${messageId}:${part.type}:${occurrence}`;
1346
1400
  }
1347
- function buildAssistantElements(parts, opts) {
1348
- const { messageId, isLast, isStreaming, suppressQuestionTool, suppressTextWhenPlanWrite = false, ToolRendererComponent, TextRendererComponent, toolRenderers, onOpenUIAction, onOpenUIArtifactReady, onOpenArtifact } = opts;
1349
- const elems = [];
1350
- const textChunks = [];
1351
- const hasPlanWritePresentation = suppressTextWhenPlanWrite && parts.some((part) => isV5ToolPart(part) && part.type === "tool-PlanWrite");
1352
- const taskPartIds = new Set(parts.filter((p) => isV5ToolPart(p) && (p.type === "tool-Task" || p.type === "tool-Agent") && typeof p.toolCallId === "string").map((p) => p.toolCallId));
1353
- const nestedToolsMap = /* @__PURE__ */ new Map();
1354
- const nestedToolIds = /* @__PURE__ */ new Set();
1355
- const unkeyedToolOccurrences = /* @__PURE__ */ new Map();
1356
- for (const part of parts) {
1357
- if (!isV5ToolPart(part)) continue;
1358
- if (part.type === "tool-TaskOutput") continue;
1359
- if (!part.toolCallId || !part.toolCallId.includes(":")) continue;
1360
- const parentId = part.toolCallId.split(":")[0];
1361
- if (!taskPartIds.has(parentId)) continue;
1362
- if (!nestedToolsMap.has(parentId)) nestedToolsMap.set(parentId, []);
1363
- nestedToolsMap.get(parentId).push(part);
1364
- nestedToolIds.add(part.toolCallId);
1401
+ function isRecord(value) {
1402
+ return typeof value === "object" && value !== null;
1403
+ }
1404
+ function getImageUrlFromPart(part) {
1405
+ if (!isRecord(part)) return null;
1406
+ const type = part.type;
1407
+ if (typeof type !== "string") return null;
1408
+ if (type === "image") {
1409
+ const imagePart = part;
1410
+ return imagePart.url ?? imagePart.image ?? null;
1365
1411
  }
1366
- let i = 0;
1367
- while (i < parts.length) {
1368
- const part = parts[i];
1369
- if (isV5ToolPart(part) && part.type === "tool-TaskOutput") {
1370
- i++;
1371
- continue;
1372
- }
1373
- if (isTextPart(part)) {
1374
- const text2 = part.text;
1375
- if (text2 && !hasPlanWritePresentation) textChunks.push(text2);
1376
- i++;
1377
- continue;
1378
- }
1379
- if (isErrorPart(part)) {
1380
- elems.push(/* @__PURE__ */ jsx(ErrorMessage, {
1381
- title: part.title,
1382
- message: part.message
1383
- }, `${messageId}-error-${part.title}-${part.message}`));
1384
- i++;
1385
- continue;
1386
- }
1387
- if (isPayloadPart(part)) {
1388
- elems.push(/* @__PURE__ */ jsx(PayloadPart, { part }, `${messageId}-payload-${i}`));
1389
- i++;
1390
- continue;
1391
- }
1392
- if (isV5ToolPart(part)) {
1393
- if (suppressQuestionTool && part.type === "tool-Question") {
1394
- i++;
1395
- continue;
1396
- }
1397
- if (part.toolCallId && nestedToolIds.has(part.toolCallId)) {
1398
- i++;
1399
- continue;
1400
- }
1401
- const chatStreamingStatus = isLast && isStreaming ? "streaming" : void 0;
1402
- const toolCallId = part.toolCallId;
1403
- const nestedTools = (part.type === "tool-Task" || part.type === "tool-Agent") && toolCallId ? nestedToolsMap.get(toolCallId) || [] : void 0;
1404
- const occurrence = part.toolCallId ? 0 : unkeyedToolOccurrences.get(part.type) ?? 0;
1405
- if (!part.toolCallId) unkeyedToolOccurrences.set(part.type, occurrence + 1);
1406
- elems.push(/* @__PURE__ */ jsx(ToolRendererComponent, {
1407
- part,
1408
- nestedTools,
1409
- chatStatus: chatStreamingStatus,
1410
- toolRenderers
1411
- }, getAssistantToolElementKey(messageId, part, occurrence)));
1412
- i++;
1413
- continue;
1412
+ if (type === "data-image") return part.data?.url ?? null;
1413
+ if (type === "file") {
1414
+ const filePart = part;
1415
+ if (filePart.mimeType?.startsWith("image/")) {
1416
+ if (filePart.url) return filePart.url;
1417
+ if (filePart.data) return `data:${filePart.mimeType};base64,${filePart.data}`;
1414
1418
  }
1415
- i++;
1416
1419
  }
1417
- const text = textChunks.join("\n\n");
1418
- if (text) elems.push(/* @__PURE__ */ jsx("div", {
1419
- className: "group/assistant-text text-[0.875rem]",
1420
- children: /* @__PURE__ */ jsx(TextRendererComponent, {
1421
- content: text,
1422
- isStreaming,
1423
- messageId,
1424
- onOpenUIAction,
1425
- onOpenUIArtifactReady,
1426
- onOpenArtifact,
1427
- className: "leading-relaxed [&_p]:leading-relaxed"
1428
- })
1429
- }, `${messageId}-text-final`));
1430
- return elems;
1420
+ return null;
1431
1421
  }
1432
- function AssistantParts({ msg, isLast, isStreaming, suppressQuestionTool, ToolRendererComponent, TextRendererComponent, toolRenderers, onOpenUIAction, onOpenUIArtifactReady, onOpenArtifact }) {
1433
- const parts = useMemo(() => normalizeAssistantToolParts(msg.parts ?? []), [msg.parts]);
1434
- const elements = useMemo(() => buildAssistantElements(parts, {
1435
- messageId: msg.id,
1436
- isLast,
1437
- isStreaming,
1438
- suppressQuestionTool,
1439
- ToolRendererComponent,
1440
- TextRendererComponent,
1441
- toolRenderers,
1442
- onOpenUIAction,
1443
- onOpenUIArtifactReady,
1444
- onOpenArtifact
1445
- }), [
1446
- parts,
1447
- msg.id,
1448
- isLast,
1449
- isStreaming,
1450
- suppressQuestionTool,
1451
- ToolRendererComponent,
1452
- TextRendererComponent,
1453
- toolRenderers,
1454
- onOpenUIAction,
1455
- onOpenUIArtifactReady,
1456
- onOpenArtifact
1457
- ]);
1458
- if (elements.length > 1) return /* @__PURE__ */ jsx("div", {
1459
- className: "group/assistant-turn flex flex-col gap-3",
1460
- children: elements
1461
- });
1462
- return /* @__PURE__ */ jsx("div", {
1463
- className: "group/assistant-turn",
1464
- children: elements
1422
+ function getFileFromPart(part) {
1423
+ if (!isRecord(part)) return null;
1424
+ if (part.type !== "file") return null;
1425
+ const filePart = part;
1426
+ const filename = filePart.filename || filePart.name || filePart.fileName || "Attachment";
1427
+ if (filePart.mimeType?.startsWith("image/") ?? false) return null;
1428
+ return {
1429
+ filename,
1430
+ size: filePart.size
1431
+ };
1432
+ }
1433
+ var UserMessage = memo(function UserMessage2({ message, className, enableImagePreview = true }) {
1434
+ const [lightboxIndex, setLightboxIndex] = useState(null);
1435
+ const text = (message.parts?.filter(isTextPart) ?? []).map((p) => p.text).join("");
1436
+ const images = [];
1437
+ const files = [];
1438
+ for (const part of message.parts ?? []) {
1439
+ const imageUrl = getImageUrlFromPart(part);
1440
+ if (imageUrl) images.push(imageUrl);
1441
+ const file = getFileFromPart(part);
1442
+ if (file) files.push(file);
1443
+ }
1444
+ if (isRecord(message) && Array.isArray(message.experimental_attachments)) {
1445
+ for (const att of message.experimental_attachments) if (att.contentType?.startsWith("image/") && att.url) images.push(att.url);
1446
+ }
1447
+ if (!text && images.length === 0 && files.length === 0) return null;
1448
+ const lightboxImages = images.map((url, i) => ({
1449
+ id: `${message.id}-img-${i}`,
1450
+ url,
1451
+ filename: `image-${i + 1}`
1452
+ }));
1453
+ return /* @__PURE__ */ jsxs("div", {
1454
+ className: cn("flex flex-col items-end gap-1", className),
1455
+ children: [
1456
+ images.length > 0 && images.map((url, i) => /* @__PURE__ */ jsx("div", {
1457
+ className: cn("max-w-[200px] rounded-chat-message bg-foreground/4 p-1.5", enableImagePreview && "cursor-pointer"),
1458
+ onClick: enableImagePreview ? () => setLightboxIndex(i) : void 0,
1459
+ role: enableImagePreview ? "button" : void 0,
1460
+ tabIndex: enableImagePreview ? 0 : void 0,
1461
+ onKeyDown: enableImagePreview ? (event) => {
1462
+ if (event.key === "Enter" || event.key === " ") {
1463
+ event.preventDefault();
1464
+ setLightboxIndex(i);
1465
+ }
1466
+ } : void 0,
1467
+ children: /* @__PURE__ */ jsx("img", {
1468
+ src: url,
1469
+ alt: "attachment",
1470
+ width: 184,
1471
+ height: 120,
1472
+ className: "block max-h-[120px] max-w-[184px] rounded-chat-message-inner object-cover"
1473
+ })
1474
+ }, url)),
1475
+ enableImagePreview && lightboxImages.length > 0 && /* @__PURE__ */ jsx(ImageLightbox, {
1476
+ open: lightboxIndex !== null,
1477
+ onClose: () => setLightboxIndex(null),
1478
+ images: lightboxImages,
1479
+ initialIndex: lightboxIndex ?? 0
1480
+ }),
1481
+ files.length > 0 && /* @__PURE__ */ jsx("div", {
1482
+ className: "flex flex-col items-end gap-2",
1483
+ children: files.map((file, i) => /* @__PURE__ */ jsx(FileAttachment, {
1484
+ id: `${file.filename}-${i}`,
1485
+ filename: file.filename,
1486
+ size: file.size
1487
+ }, `${file.filename}-${file.size}`))
1488
+ }),
1489
+ text && /* @__PURE__ */ jsx("div", {
1490
+ className: "ms-[70px] max-w-[calc(95%-40px)]",
1491
+ children: /* @__PURE__ */ jsx("div", {
1492
+ className: "rounded-chat-message bg-muted px-3.5 py-1.5 text-sm text-foreground transition-colors",
1493
+ children: /* @__PURE__ */ jsx("p", {
1494
+ className: "leading-5 wrap-break-word whitespace-pre-wrap text-pretty",
1495
+ children: text
1496
+ })
1497
+ })
1498
+ })
1499
+ ]
1465
1500
  });
1501
+ });
1502
+ function orderedRlmChildren(children, tree) {
1503
+ const byId = new Map(children.map((child) => [child.id, child]));
1504
+ const visited = /* @__PURE__ */ new Set();
1505
+ const ordered = [];
1506
+ const visit = (id) => {
1507
+ if (visited.has(id)) return;
1508
+ visited.add(id);
1509
+ const child = byId.get(id);
1510
+ if (child) ordered.push(child);
1511
+ for (const nextId of tree?.nodes[id]?.childrenIds ?? []) visit(nextId);
1512
+ };
1513
+ for (const id of tree?.rootChildrenIds ?? []) visit(id);
1514
+ for (const child of children) visit(child.id);
1515
+ return ordered;
1516
+ }
1517
+ function rlmStatusIcon(status) {
1518
+ if (status === "done") return /* @__PURE__ */ jsx(CircleCheck, { className: "size-3.5 text-emerald-600 dark:text-emerald-400" });
1519
+ if (status === "error" || status === "failed") return /* @__PURE__ */ jsx(CircleAlert, { className: "size-3.5 text-destructive" });
1520
+ if (status === "cancelled") return /* @__PURE__ */ jsx(CircleX, { className: "size-3.5 text-muted-foreground" });
1521
+ if (status === "recovering") return /* @__PURE__ */ jsx(RotateCw, { className: "size-3.5 animate-spin text-amber-500 dark:text-amber-400" });
1522
+ return /* @__PURE__ */ jsx(LoaderCircle, { className: "size-3.5 animate-spin text-primary" });
1466
1523
  }
1467
1524
  function groupMessages(messages) {
1468
1525
  const turns = [];
@@ -1487,17 +1544,18 @@ function groupMessages(messages) {
1487
1544
  if (current) turns.push(current);
1488
1545
  return turns;
1489
1546
  }
1490
- var LazyGenerativeTextRenderer = lazy(() => import("./openui-renderer-Biyyjhjn-SJOEKPTJ.js").then((n) => n.n).then(({ GenerativeTextRenderer }) => ({ default: GenerativeTextRenderer })));
1547
+ var LazyGenerativeTextRenderer = lazy(() => import("./openui-renderer-moJGf0LA-QCU3PI6H.js").then((n) => n.n).then(({ GenerativeTextRenderer }) => ({ default: GenerativeTextRenderer })));
1491
1548
  function PlainTextFallback({ className, content }) {
1492
1549
  return /* @__PURE__ */ jsx("div", {
1493
1550
  className: className ? `${className} whitespace-pre-wrap` : "whitespace-pre-wrap",
1494
1551
  children: content
1495
1552
  });
1496
1553
  }
1497
- function FleetGenerativeTextRenderer(props) {
1554
+ function SessionGenerativeTextRenderer(props) {
1498
1555
  if (!useMemo(() => segmentOpenUIContent(props.content).some((segment) => segment.type === "openui"), [props.content])) return /* @__PURE__ */ jsx(LazyMarkdown, {
1499
1556
  className: props.className,
1500
- content: props.content
1557
+ content: props.content,
1558
+ isStreaming: props.isStreaming
1501
1559
  });
1502
1560
  return /* @__PURE__ */ jsx(Suspense, {
1503
1561
  fallback: /* @__PURE__ */ jsx(PlainTextFallback, {
@@ -1525,7 +1583,7 @@ function buildOffsets(itemKeys, measuredHeights, estimateSize, itemGap) {
1525
1583
  }
1526
1584
  function VirtualizedTurnList({ estimateSize, getItemKey, itemGap = 0, items, overscan = 1.5, renderItem, viewportRef }) {
1527
1585
  const itemKeys = useMemo(() => items.map((item, index) => getItemKey(item, index)), [getItemKey, items]);
1528
- const shouldVirtualize = items.length >= 40;
1586
+ const shouldVirtualize = items.length >= 16;
1529
1587
  const [measuredHeights, setMeasuredHeights] = useState(() => /* @__PURE__ */ new Map());
1530
1588
  const [viewport, setViewport] = useState({
1531
1589
  height: 0,
@@ -1540,6 +1598,7 @@ function VirtualizedTurnList({ estimateSize, getItemKey, itemGap = 0, items, ove
1540
1598
  const rowNodesRef = useRef(/* @__PURE__ */ new Map());
1541
1599
  const rowKeysRef = useRef(/* @__PURE__ */ new WeakMap());
1542
1600
  const rowObserverRef = useRef(null);
1601
+ const viewportRafRef = useRef(null);
1543
1602
  const updateViewport = useCallback(() => {
1544
1603
  const element = viewportRef.current;
1545
1604
  if (!element) return;
@@ -1549,6 +1608,13 @@ function VirtualizedTurnList({ estimateSize, getItemKey, itemGap = 0, items, ove
1549
1608
  };
1550
1609
  setViewport((current) => current.height === next.height && current.scrollTop === next.scrollTop ? current : next);
1551
1610
  }, [viewportRef]);
1611
+ const scheduleViewportUpdate = useCallback(() => {
1612
+ if (viewportRafRef.current != null) return;
1613
+ viewportRafRef.current = window.requestAnimationFrame(() => {
1614
+ viewportRafRef.current = null;
1615
+ updateViewport();
1616
+ });
1617
+ }, [updateViewport]);
1552
1618
  const setRowRef = useCallback((key, node) => {
1553
1619
  const previous = rowNodesRef.current.get(key);
1554
1620
  if (previous && previous !== node) {
@@ -1587,20 +1653,28 @@ function VirtualizedTurnList({ estimateSize, getItemKey, itemGap = 0, items, ove
1587
1653
  useEffect(() => {
1588
1654
  const element = viewportRef.current;
1589
1655
  if (!element) return;
1590
- element.addEventListener("scroll", updateViewport, { passive: true });
1591
- window.addEventListener("resize", updateViewport);
1656
+ element.addEventListener("scroll", scheduleViewportUpdate, { passive: true });
1657
+ window.addEventListener("resize", scheduleViewportUpdate);
1592
1658
  updateViewport();
1593
1659
  let viewportObserver;
1594
1660
  if (typeof ResizeObserver !== "undefined") {
1595
- viewportObserver = new ResizeObserver(updateViewport);
1661
+ viewportObserver = new ResizeObserver(scheduleViewportUpdate);
1596
1662
  viewportObserver.observe(element);
1597
1663
  }
1598
1664
  return () => {
1599
- element.removeEventListener("scroll", updateViewport);
1600
- window.removeEventListener("resize", updateViewport);
1665
+ element.removeEventListener("scroll", scheduleViewportUpdate);
1666
+ window.removeEventListener("resize", scheduleViewportUpdate);
1601
1667
  viewportObserver?.disconnect();
1668
+ if (viewportRafRef.current != null) {
1669
+ window.cancelAnimationFrame(viewportRafRef.current);
1670
+ viewportRafRef.current = null;
1671
+ }
1602
1672
  };
1603
- }, [updateViewport, viewportRef]);
1673
+ }, [
1674
+ scheduleViewportUpdate,
1675
+ updateViewport,
1676
+ viewportRef
1677
+ ]);
1604
1678
  const updateMeasuredHeights = useCallback((entries) => {
1605
1679
  const current = measuredHeightsRef.current;
1606
1680
  let next = current;
@@ -1698,12 +1772,14 @@ export {
1698
1772
  MessageScroller,
1699
1773
  Message,
1700
1774
  MessageContent,
1701
- FileAttachment,
1702
- UserMessage,
1703
1775
  normalizeAssistantToolParts,
1704
1776
  buildAssistantElements,
1777
+ FileAttachment,
1778
+ UserMessage,
1779
+ orderedRlmChildren,
1780
+ rlmStatusIcon,
1705
1781
  groupMessages,
1706
- FleetGenerativeTextRenderer,
1782
+ SessionGenerativeTextRenderer,
1707
1783
  VirtualizedTurnList
1708
1784
  };
1709
1785
  /**