@tylertech/forge-ai 0.15.3-dev.1 → 0.16.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 (446) hide show
  1. package/MIGRATION.md +192 -0
  2. package/README.md +76 -2
  3. package/custom-elements.json +5442 -15097
  4. package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.mjs +9 -0
  5. package/dist/ai-agent-info/ai-agent-info.mjs +4 -78
  6. package/dist/ai-agent-info/ai-agent-info2.mjs +55 -0
  7. package/dist/ai-agent-info/index.d.ts +1 -1
  8. package/dist/ai-agent-info/index.mjs +1 -5
  9. package/dist/ai-agent-selector/ai-agent-selector.d.ts +2 -2
  10. package/dist/ai-agent-selector/ai-agent-selector.mjs +4 -439
  11. package/dist/ai-agent-selector/ai-agent-selector2.mjs +344 -0
  12. package/dist/ai-agent-selector/index.mjs +1 -5
  13. package/dist/ai-artifact/ai-artifact.mjs +4 -39
  14. package/dist/ai-artifact/ai-artifact2.mjs +31 -0
  15. package/dist/ai-artifact/index.d.ts +1 -1
  16. package/dist/ai-artifact/index.mjs +1 -5
  17. package/dist/ai-artifact-card/ai-artifact-card.mjs +4 -142
  18. package/dist/ai-artifact-card/ai-artifact-card2.mjs +103 -0
  19. package/dist/ai-artifact-card/index.d.ts +1 -1
  20. package/dist/ai-artifact-card/index.mjs +1 -5
  21. package/dist/ai-artifact-card-group/ai-artifact-card-group.mjs +4 -137
  22. package/dist/ai-artifact-card-group/ai-artifact-card-group2.mjs +100 -0
  23. package/dist/ai-artifact-card-group/index.d.ts +1 -1
  24. package/dist/ai-artifact-card-group/index.mjs +1 -5
  25. package/dist/ai-assistant-response/ai-assistant-response.d.ts +1 -2
  26. package/dist/ai-assistant-response/ai-assistant-response.mjs +4 -236
  27. package/dist/ai-assistant-response/ai-assistant-response2.mjs +137 -0
  28. package/dist/ai-assistant-response/index.d.ts +1 -1
  29. package/dist/ai-assistant-response/index.mjs +1 -5
  30. package/dist/ai-canvas/ai-canvas.d.ts +3 -3
  31. package/dist/ai-canvas/ai-canvas.mjs +4 -95
  32. package/dist/ai-canvas/ai-canvas2.mjs +74 -0
  33. package/dist/ai-canvas/index.d.ts +1 -1
  34. package/dist/ai-canvas/index.mjs +1 -5
  35. package/dist/ai-chain-of-thought/ai-chain-of-thought.mjs +4 -45
  36. package/dist/ai-chain-of-thought/ai-chain-of-thought2.mjs +35 -0
  37. package/dist/ai-chain-of-thought/index.d.ts +5 -5
  38. package/dist/ai-chain-of-thought/index.mjs +6 -17
  39. package/dist/ai-chain-of-thought/thought-base/index.mjs +1 -5
  40. package/dist/ai-chain-of-thought/thought-base/thought-base.mjs +4 -43
  41. package/dist/ai-chain-of-thought/thought-base/thought-base2.mjs +31 -0
  42. package/dist/ai-chain-of-thought/thought-detail/index.mjs +1 -5
  43. package/dist/ai-chain-of-thought/thought-detail/thought-detail.mjs +4 -34
  44. package/dist/ai-chain-of-thought/thought-detail/thought-detail2.mjs +26 -0
  45. package/dist/ai-chain-of-thought/thought-image/index.mjs +1 -5
  46. package/dist/ai-chain-of-thought/thought-image/thought-image.mjs +4 -43
  47. package/dist/ai-chain-of-thought/thought-image/thought-image2.mjs +30 -0
  48. package/dist/ai-chain-of-thought/thought-search-result/index.mjs +1 -5
  49. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.mjs +4 -62
  50. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result2.mjs +45 -0
  51. package/dist/ai-chat-header/ai-chat-header.d.ts +7 -5
  52. package/dist/ai-chat-header/ai-chat-header.mjs +4 -439
  53. package/dist/ai-chat-header/ai-chat-header2.mjs +319 -0
  54. package/dist/ai-chat-header/index.d.ts +2 -2
  55. package/dist/ai-chat-header/index.mjs +1 -5
  56. package/dist/ai-chat-interface/ai-chat-interface.d.ts +1 -0
  57. package/dist/ai-chat-interface/ai-chat-interface.mjs +4 -103
  58. package/dist/ai-chat-interface/ai-chat-interface2.mjs +73 -0
  59. package/dist/ai-chat-interface/index.mjs +1 -5
  60. package/dist/ai-client-message/ai-client-message.d.ts +5 -6
  61. package/dist/ai-client-message/ai-client-message.mjs +4 -112
  62. package/dist/ai-client-message/ai-client-message2.mjs +76 -0
  63. package/dist/ai-client-message/index.mjs +1 -5
  64. package/dist/ai-context-chip/ai-context-chip.d.ts +1 -1
  65. package/dist/ai-context-chip/ai-context-chip.mjs +4 -169
  66. package/dist/ai-context-chip/ai-context-chip2.mjs +113 -0
  67. package/dist/ai-context-chip/index.mjs +1 -5
  68. package/dist/ai-context-items/ai-context-items.d.ts +11 -5
  69. package/dist/ai-context-items/ai-context-items.mjs +4 -78
  70. package/dist/ai-context-items/ai-context-items2.mjs +53 -0
  71. package/dist/ai-context-items/index.d.ts +1 -1
  72. package/dist/ai-context-items/index.mjs +1 -5
  73. package/dist/ai-conversations-panel/ai-conversations-panel.d.ts +2 -2
  74. package/dist/ai-conversations-panel/ai-conversations-panel.mjs +4 -632
  75. package/dist/ai-conversations-panel/ai-conversations-panel2.mjs +531 -0
  76. package/dist/ai-conversations-panel/index.mjs +1 -5
  77. package/dist/ai-copy-button/ai-copy-button.mjs +4 -116
  78. package/dist/ai-copy-button/ai-copy-button2.mjs +88 -0
  79. package/dist/ai-copy-button/index.mjs +1 -5
  80. package/dist/ai-dialog/ai-dialog.mjs +4 -304
  81. package/dist/ai-dialog/ai-dialog2.mjs +237 -0
  82. package/dist/ai-dialog/index.d.ts +1 -1
  83. package/dist/ai-dialog/index.mjs +1 -5
  84. package/dist/ai-disclaimer/ai-disclaimer.mjs +4 -70
  85. package/dist/ai-disclaimer/ai-disclaimer2.mjs +46 -0
  86. package/dist/ai-disclaimer/index.d.ts +1 -1
  87. package/dist/ai-disclaimer/index.mjs +1 -5
  88. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.mjs +4 -80
  89. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group2.mjs +51 -0
  90. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.d.ts +5 -1
  91. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.mjs +4 -330
  92. package/dist/ai-dropdown-menu/ai-dropdown-menu-item2.mjs +280 -0
  93. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.mjs +4 -26
  94. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator2.mjs +19 -0
  95. package/dist/ai-dropdown-menu/ai-dropdown-menu.d.ts +5 -0
  96. package/dist/ai-dropdown-menu/ai-dropdown-menu.mjs +4 -351
  97. package/dist/ai-dropdown-menu/ai-dropdown-menu2.mjs +268 -0
  98. package/dist/ai-dropdown-menu/index.d.ts +1 -0
  99. package/dist/ai-dropdown-menu/index.mjs +5 -10
  100. package/dist/ai-dropdown-menu/navigation-controller.d.ts +9 -1
  101. package/dist/ai-dropdown-menu/navigation-controller.mjs +214 -204
  102. package/dist/ai-dropdown-menu/selection-manager.mjs +202 -182
  103. package/dist/ai-edit-thread/ai-edit-thread.d.ts +1 -1
  104. package/dist/ai-edit-thread/ai-edit-thread.mjs +4 -137
  105. package/dist/ai-edit-thread/ai-edit-thread2.mjs +96 -0
  106. package/dist/ai-edit-thread/index.d.ts +1 -1
  107. package/dist/ai-edit-thread/index.mjs +1 -5
  108. package/dist/ai-empty-state/ai-empty-state.mjs +4 -38
  109. package/dist/ai-empty-state/ai-empty-state2.mjs +28 -0
  110. package/dist/ai-empty-state/index.d.ts +1 -1
  111. package/dist/ai-empty-state/index.mjs +1 -5
  112. package/dist/ai-error-message/ai-error-message.mjs +4 -80
  113. package/dist/ai-error-message/ai-error-message2.mjs +62 -0
  114. package/dist/ai-error-message/index.mjs +1 -5
  115. package/dist/ai-fab/ai-fab.mjs +4 -81
  116. package/dist/ai-fab/ai-fab2.mjs +54 -0
  117. package/dist/ai-fab/index.d.ts +1 -1
  118. package/dist/ai-fab/index.mjs +1 -5
  119. package/dist/ai-file-picker/ai-file-picker.d.ts +1 -0
  120. package/dist/ai-file-picker/ai-file-picker.mjs +4 -224
  121. package/dist/ai-file-picker/ai-file-picker2.mjs +172 -0
  122. package/dist/ai-file-picker/index.mjs +1 -4
  123. package/dist/ai-gradient-container/ai-gradient-container.mjs +4 -61
  124. package/dist/ai-gradient-container/ai-gradient-container2.mjs +38 -0
  125. package/dist/ai-gradient-container/index.d.ts +1 -1
  126. package/dist/ai-gradient-container/index.mjs +1 -5
  127. package/dist/ai-icon/ai-icon.d.ts +3 -0
  128. package/dist/ai-icon/ai-icon.mjs +4 -71
  129. package/dist/ai-icon/ai-icon2.mjs +41 -0
  130. package/dist/ai-icon/index.d.ts +1 -1
  131. package/dist/ai-icon/index.mjs +1 -5
  132. package/dist/ai-message-thread/ai-message-thread.d.ts +4 -3
  133. package/dist/ai-message-thread/ai-message-thread.mjs +4 -360
  134. package/dist/ai-message-thread/ai-message-thread2.mjs +279 -0
  135. package/dist/ai-message-thread/index.mjs +1 -5
  136. package/dist/ai-modal/ai-modal.mjs +4 -178
  137. package/dist/ai-modal/ai-modal2.mjs +141 -0
  138. package/dist/ai-modal/index.mjs +1 -4
  139. package/dist/ai-prompt/ai-prompt.d.ts +10 -6
  140. package/dist/ai-prompt/ai-prompt.mjs +4 -534
  141. package/dist/ai-prompt/ai-prompt2.mjs +438 -0
  142. package/dist/ai-prompt/index.mjs +1 -5
  143. package/dist/ai-reasoning/ai-reasoning.mjs +4 -44
  144. package/dist/ai-reasoning/ai-reasoning2.mjs +35 -0
  145. package/dist/ai-reasoning/index.d.ts +2 -2
  146. package/dist/ai-reasoning/index.mjs +4 -8
  147. package/dist/ai-reasoning/reasoning-content/index.d.ts +1 -1
  148. package/dist/ai-reasoning/reasoning-content/index.mjs +1 -5
  149. package/dist/ai-reasoning/reasoning-content/reasoning-content.mjs +4 -90
  150. package/dist/ai-reasoning/reasoning-content/reasoning-content2.mjs +68 -0
  151. package/dist/ai-reasoning-header/ai-reasoning-header.d.ts +7 -1
  152. package/dist/ai-reasoning-header/ai-reasoning-header.mjs +4 -68
  153. package/dist/ai-reasoning-header/ai-reasoning-header2.mjs +51 -0
  154. package/dist/ai-reasoning-header/index.d.ts +1 -1
  155. package/dist/ai-reasoning-header/index.mjs +1 -5
  156. package/dist/ai-response-message/ai-response-message.mjs +4 -25
  157. package/dist/ai-response-message/ai-response-message2.mjs +17 -0
  158. package/dist/ai-response-message/index.mjs +1 -5
  159. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.d.ts +1 -1
  160. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.mjs +4 -230
  161. package/dist/ai-response-message-toolbar/ai-response-message-toolbar2.mjs +171 -0
  162. package/dist/ai-response-message-toolbar/index.mjs +1 -5
  163. package/dist/ai-sidebar/ai-sidebar.d.ts +4 -4
  164. package/dist/ai-sidebar/ai-sidebar.mjs +4 -256
  165. package/dist/ai-sidebar/ai-sidebar2.mjs +211 -0
  166. package/dist/ai-sidebar/index.d.ts +2 -2
  167. package/dist/ai-sidebar/index.mjs +1 -5
  168. package/dist/ai-slash-command-menu/ai-slash-command-menu.d.ts +2 -1
  169. package/dist/ai-slash-command-menu/ai-slash-command-menu.mjs +4 -200
  170. package/dist/ai-slash-command-menu/ai-slash-command-menu2.mjs +160 -0
  171. package/dist/ai-slash-command-menu/index.mjs +1 -5
  172. package/dist/ai-spinner/ai-spinner.mjs +4 -41
  173. package/dist/ai-spinner/ai-spinner2.mjs +29 -0
  174. package/dist/ai-spinner/index.d.ts +1 -1
  175. package/dist/ai-spinner/index.mjs +1 -5
  176. package/dist/ai-steps/ai-steps.mjs +4 -163
  177. package/dist/ai-steps/ai-steps2.mjs +133 -0
  178. package/dist/ai-steps/index.d.ts +1 -1
  179. package/dist/ai-steps/index.mjs +1 -5
  180. package/dist/ai-suggestions/ai-suggestions.d.ts +2 -5
  181. package/dist/ai-suggestions/ai-suggestions.mjs +4 -164
  182. package/dist/ai-suggestions/ai-suggestions2.mjs +125 -0
  183. package/dist/ai-suggestions/index.d.ts +2 -1
  184. package/dist/ai-suggestions/index.mjs +1 -5
  185. package/dist/ai-thinking-indicator/ai-thinking-indicator.d.ts +2 -1
  186. package/dist/ai-thinking-indicator/ai-thinking-indicator.mjs +4 -160
  187. package/dist/ai-thinking-indicator/ai-thinking-indicator2.mjs +143 -0
  188. package/dist/ai-thinking-indicator/index.d.ts +1 -1
  189. package/dist/ai-thinking-indicator/index.mjs +1 -5
  190. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.d.ts +2 -2
  191. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.mjs +4 -152
  192. package/dist/ai-thread-actions-menu/ai-thread-actions-menu2.mjs +109 -0
  193. package/dist/ai-thread-actions-menu/index.d.ts +1 -1
  194. package/dist/ai-thread-actions-menu/index.mjs +1 -5
  195. package/dist/ai-threads-search/ai-threads-search.d.ts +3 -4
  196. package/dist/ai-threads-search/ai-threads-search.mjs +4 -602
  197. package/dist/ai-threads-search/ai-threads-search2.mjs +495 -0
  198. package/dist/ai-threads-search/index.d.ts +1 -1
  199. package/dist/ai-threads-search/index.mjs +1 -5
  200. package/dist/ai-tool-call/ai-tool-call.d.ts +21 -0
  201. package/dist/ai-tool-call/ai-tool-call.mjs +4 -0
  202. package/dist/ai-tool-call/ai-tool-call2.mjs +132 -0
  203. package/dist/{ai-chatbot → ai-tool-call}/create-tool-renderer.d.ts +1 -1
  204. package/dist/ai-tool-call/create-tool-renderer.mjs +10 -0
  205. package/dist/ai-tool-call/index.d.ts +6 -0
  206. package/dist/ai-tool-call/index.mjs +5 -0
  207. package/dist/{ai-chatbot → ai-tool-call}/tool-canvas.d.ts +1 -1
  208. package/dist/ai-tool-call/tool-canvas.mjs +135 -0
  209. package/dist/ai-tool-call/utils.d.ts +12 -0
  210. package/dist/ai-tool-call/utils.mjs +20 -0
  211. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.d.ts +1 -1
  212. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.mjs +4 -331
  213. package/dist/ai-tool-call-indicator/ai-tool-call-indicator2.mjs +225 -0
  214. package/dist/ai-tool-call-indicator/index.mjs +1 -5
  215. package/dist/ai-user-message/ai-user-message.mjs +4 -151
  216. package/dist/ai-user-message/ai-user-message2.mjs +105 -0
  217. package/dist/ai-user-message/index.mjs +1 -5
  218. package/dist/ai-user-message-toolbar/ai-user-message-toolbar.mjs +4 -160
  219. package/dist/ai-user-message-toolbar/ai-user-message-toolbar2.mjs +102 -0
  220. package/dist/ai-user-message-toolbar/index.mjs +1 -5
  221. package/dist/ai-voice-input/ai-voice-input.d.ts +1 -1
  222. package/dist/ai-voice-input/ai-voice-input.mjs +4 -113
  223. package/dist/ai-voice-input/ai-voice-input2.mjs +92 -0
  224. package/dist/ai-voice-input/index.d.ts +1 -1
  225. package/dist/ai-voice-input/index.mjs +1 -5
  226. package/dist/core/drag-controller.mjs +196 -221
  227. package/dist/core/index.d.ts +3 -2
  228. package/dist/core/index.mjs +7 -8
  229. package/dist/core/overlay/index.mjs +1 -4
  230. package/dist/core/overlay/overlay.d.ts +1 -1
  231. package/dist/core/overlay/overlay.mjs +4 -180
  232. package/dist/core/overlay/overlay2.mjs +146 -0
  233. package/dist/core/popover/index.mjs +1 -4
  234. package/dist/core/popover/popover.mjs +4 -98
  235. package/dist/core/popover/popover2.mjs +71 -0
  236. package/dist/core/resize-controller.mjs +132 -154
  237. package/dist/core/tooltip/index.mjs +1 -4
  238. package/dist/core/tooltip/tooltip.mjs +4 -279
  239. package/dist/core/tooltip/tooltip2.mjs +213 -0
  240. package/dist/index.d.ts +45 -53
  241. package/dist/index.mjs +100 -214
  242. package/dist/jsx.d.ts +895 -0
  243. package/dist/tools/ai-data-table/ai-data-table.d.ts +1 -2
  244. package/dist/tools/ai-data-table/ai-data-table.mjs +4 -257
  245. package/dist/tools/ai-data-table/ai-data-table2.mjs +185 -0
  246. package/dist/tools/ai-data-table/index.d.ts +0 -1
  247. package/dist/tools/ai-data-table/index.mjs +1 -6
  248. package/dist/tools/ai-paginator/ai-paginator.d.ts +14 -0
  249. package/dist/tools/ai-paginator/ai-paginator.mjs +4 -115
  250. package/dist/tools/ai-paginator/ai-paginator2.mjs +90 -0
  251. package/dist/tools/ai-paginator/index.mjs +1 -4
  252. package/dist/tools/ai-steps/ai-steps.d.ts +2 -3
  253. package/dist/tools/ai-steps/ai-steps.mjs +4 -49
  254. package/dist/tools/ai-steps/ai-steps2.mjs +30 -0
  255. package/dist/tools/ai-steps/index.d.ts +0 -1
  256. package/dist/tools/ai-steps/index.mjs +1 -6
  257. package/dist/tools/index.d.ts +3 -3
  258. package/dist/tools/index.mjs +7 -12
  259. package/dist/types/chat.d.ts +102 -0
  260. package/dist/types/feature.d.ts +1 -0
  261. package/dist/types/file.d.ts +36 -0
  262. package/dist/types/index.d.ts +6 -0
  263. package/dist/types/index.mjs +0 -0
  264. package/dist/types/thread.d.ts +14 -0
  265. package/dist/types/tool.d.ts +197 -0
  266. package/dist/utils/csv-utils.mjs +37 -57
  267. package/dist/utils/delete-thread-controller.d.ts +1 -1
  268. package/dist/utils/delete-thread-controller.mjs +48 -71
  269. package/dist/utils/dom.d.ts +14 -0
  270. package/dist/utils/dom.mjs +30 -0
  271. package/dist/utils/format.d.ts +9 -0
  272. package/dist/utils/format.mjs +27 -0
  273. package/dist/utils/index.d.ts +9 -6
  274. package/dist/utils/index.mjs +6 -16
  275. package/dist/utils/infinite-scroll-controller.mjs +88 -94
  276. package/dist/utils/keyboard-navigation-controller.mjs +62 -70
  277. package/dist/utils/markdown-stream-controller.mjs +48 -0
  278. package/dist/utils/markdown.d.ts +10 -1
  279. package/dist/utils/markdown.mjs +261 -40
  280. package/dist/utils/storage-utils.mjs +30 -24
  281. package/package.json +40 -104
  282. package/dist/ai-agent-info/ai-agent-info.scss.mjs +0 -4
  283. package/dist/ai-agent-selector/ai-agent-selector.scss.mjs +0 -4
  284. package/dist/ai-artifact/ai-artifact.scss.mjs +0 -4
  285. package/dist/ai-artifact-card/ai-artifact-card.scss.mjs +0 -283
  286. package/dist/ai-artifact-card-group/ai-artifact-card-group.scss.mjs +0 -173
  287. package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +0 -4
  288. package/dist/ai-attachment/ai-attachment.d.ts +0 -39
  289. package/dist/ai-attachment/ai-attachment.mjs +0 -130
  290. package/dist/ai-attachment/ai-attachment.scss.mjs +0 -4
  291. package/dist/ai-attachment/index.d.ts +0 -1
  292. package/dist/ai-attachment/index.mjs +0 -5
  293. package/dist/ai-button/ai-button.d.ts +0 -21
  294. package/dist/ai-button/ai-button.mjs +0 -68
  295. package/dist/ai-button/ai-button.scss.mjs +0 -4
  296. package/dist/ai-button/index.d.ts +0 -1
  297. package/dist/ai-button/index.mjs +0 -5
  298. package/dist/ai-canvas/ai-canvas.scss.mjs +0 -4
  299. package/dist/ai-chain-of-thought/ai-chain-of-thought.scss.mjs +0 -4
  300. package/dist/ai-chain-of-thought/thought-base/thought-base.scss.mjs +0 -4
  301. package/dist/ai-chain-of-thought/thought-detail/thought-detail.scss.mjs +0 -4
  302. package/dist/ai-chain-of-thought/thought-image/thought-image.scss.mjs +0 -4
  303. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.scss.mjs +0 -4
  304. package/dist/ai-chat-header/ai-chat-header.scss.mjs +0 -4
  305. package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +0 -4
  306. package/dist/ai-chatbot/ag-ui-adapter.d.ts +0 -24
  307. package/dist/ai-chatbot/ag-ui-adapter.mjs +0 -388
  308. package/dist/ai-chatbot/agent-adapter.d.ts +0 -310
  309. package/dist/ai-chatbot/agent-adapter.mjs +0 -221
  310. package/dist/ai-chatbot/agent-runner.d.ts +0 -41
  311. package/dist/ai-chatbot/agent-runner.mjs +0 -265
  312. package/dist/ai-chatbot/ai-chatbot-base.d.ts +0 -179
  313. package/dist/ai-chatbot/ai-chatbot-base.mjs +0 -684
  314. package/dist/ai-chatbot/ai-chatbot-tool-call.d.ts +0 -19
  315. package/dist/ai-chatbot/ai-chatbot-tool-call.mjs +0 -182
  316. package/dist/ai-chatbot/ai-chatbot-tool-call.scss.mjs +0 -4
  317. package/dist/ai-chatbot/ai-chatbot.d.ts +0 -196
  318. package/dist/ai-chatbot/ai-chatbot.mjs +0 -502
  319. package/dist/ai-chatbot/ai-chatbot.scss.mjs +0 -4
  320. package/dist/ai-chatbot/create-tool-renderer.mjs +0 -16
  321. package/dist/ai-chatbot/event-emitter.d.ts +0 -43
  322. package/dist/ai-chatbot/event-emitter.mjs +0 -81
  323. package/dist/ai-chatbot/file-upload-manager.d.ts +0 -27
  324. package/dist/ai-chatbot/file-upload-manager.mjs +0 -106
  325. package/dist/ai-chatbot/http-agent-with-credentials.d.ts +0 -8
  326. package/dist/ai-chatbot/http-agent-with-credentials.mjs +0 -14
  327. package/dist/ai-chatbot/index.d.ts +0 -18
  328. package/dist/ai-chatbot/index.mjs +0 -40
  329. package/dist/ai-chatbot/markdown-stream-controller.mjs +0 -50
  330. package/dist/ai-chatbot/message-state-controller.d.ts +0 -72
  331. package/dist/ai-chatbot/message-state-controller.mjs +0 -392
  332. package/dist/ai-chatbot/request-serialization.d.ts +0 -33
  333. package/dist/ai-chatbot/request-serialization.mjs +0 -31
  334. package/dist/ai-chatbot/tool-canvas.mjs +0 -128
  335. package/dist/ai-chatbot/types.d.ts +0 -582
  336. package/dist/ai-chatbot/utils.d.ts +0 -49
  337. package/dist/ai-chatbot/utils.mjs +0 -114
  338. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +0 -190
  339. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +0 -986
  340. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +0 -4
  341. package/dist/ai-chatbot-launcher/index.d.ts +0 -1
  342. package/dist/ai-chatbot-launcher/index.mjs +0 -5
  343. package/dist/ai-client-message/ai-client-message.scss.mjs +0 -4
  344. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.d.ts +0 -34
  345. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.mjs +0 -134
  346. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.scss.mjs +0 -4
  347. package/dist/ai-confirmation-prompt/index.d.ts +0 -1
  348. package/dist/ai-confirmation-prompt/index.mjs +0 -5
  349. package/dist/ai-context-chip/ai-context-chip.scss.mjs +0 -4
  350. package/dist/ai-context-items/ai-context-items.scss.mjs +0 -4
  351. package/dist/ai-conversations-panel/ai-conversations-panel.scss.mjs +0 -4
  352. package/dist/ai-copy-button/ai-copy-button.scss.mjs +0 -4
  353. package/dist/ai-dialog/ai-dialog.scss.mjs +0 -4
  354. package/dist/ai-disclaimer/ai-disclaimer.scss.mjs +0 -4
  355. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.scss.mjs +0 -4
  356. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.scss.mjs +0 -4
  357. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.scss.mjs +0 -4
  358. package/dist/ai-dropdown-menu/ai-dropdown-menu.scss.mjs +0 -4
  359. package/dist/ai-edit-thread/ai-edit-thread.scss.mjs +0 -4
  360. package/dist/ai-embedded-chat/ai-embedded-chat.d.ts +0 -64
  361. package/dist/ai-embedded-chat/ai-embedded-chat.mjs +0 -173
  362. package/dist/ai-embedded-chat/ai-embedded-chat.scss.mjs +0 -4
  363. package/dist/ai-embedded-chat/index.d.ts +0 -1
  364. package/dist/ai-embedded-chat/index.mjs +0 -5
  365. package/dist/ai-empty-state/ai-empty-state.scss.mjs +0 -4
  366. package/dist/ai-error-message/ai-error-message.scss.mjs +0 -4
  367. package/dist/ai-fab/ai-fab.scss.mjs +0 -4
  368. package/dist/ai-file-picker/ai-file-picker.scss.mjs +0 -4
  369. package/dist/ai-floating-chat/ai-floating-chat.d.ts +0 -53
  370. package/dist/ai-floating-chat/ai-floating-chat.mjs +0 -147
  371. package/dist/ai-floating-chat/ai-floating-chat.scss.mjs +0 -4
  372. package/dist/ai-floating-chat/index.d.ts +0 -1
  373. package/dist/ai-floating-chat/index.mjs +0 -5
  374. package/dist/ai-gradient-container/ai-gradient-container.scss.mjs +0 -4
  375. package/dist/ai-icon/ai-icon.scss.mjs +0 -4
  376. package/dist/ai-icon-button/ai-icon-button.d.ts +0 -19
  377. package/dist/ai-icon-button/ai-icon-button.mjs +0 -66
  378. package/dist/ai-icon-button/ai-icon-button.scss.mjs +0 -4
  379. package/dist/ai-icon-button/index.d.ts +0 -1
  380. package/dist/ai-icon-button/index.mjs +0 -5
  381. package/dist/ai-message-thread/ai-message-thread.scss.mjs +0 -4
  382. package/dist/ai-modal/ai-modal.scss.mjs +0 -4
  383. package/dist/ai-prompt/ai-prompt.scss.mjs +0 -4
  384. package/dist/ai-prompt/prompt-button/index.d.ts +0 -1
  385. package/dist/ai-prompt/prompt-button/index.mjs +0 -5
  386. package/dist/ai-prompt/prompt-button/prompt-button.d.ts +0 -16
  387. package/dist/ai-prompt/prompt-button/prompt-button.mjs +0 -40
  388. package/dist/ai-prompt/prompt-button/prompt-button.scss.mjs +0 -4
  389. package/dist/ai-reasoning/ai-reasoning.scss.mjs +0 -4
  390. package/dist/ai-reasoning/reasoning-content/reasoning-content.scss.mjs +0 -4
  391. package/dist/ai-reasoning-header/ai-reasoning-header.scss.mjs +0 -4
  392. package/dist/ai-response-message/ai-response-message.scss.mjs +0 -4
  393. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.scss.mjs +0 -4
  394. package/dist/ai-sidebar/ai-sidebar.scss.mjs +0 -4
  395. package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +0 -54
  396. package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +0 -163
  397. package/dist/ai-sidebar-chat/ai-sidebar-chat.scss.mjs +0 -4
  398. package/dist/ai-sidebar-chat/index.d.ts +0 -1
  399. package/dist/ai-sidebar-chat/index.mjs +0 -5
  400. package/dist/ai-slash-command-menu/ai-slash-command-menu.scss.mjs +0 -4
  401. package/dist/ai-spinner/ai-spinner.scss.mjs +0 -4
  402. package/dist/ai-steps/ai-steps.scss.mjs +0 -4
  403. package/dist/ai-suggestions/ai-suggestions.scss.mjs +0 -500
  404. package/dist/ai-thinking-indicator/ai-thinking-indicator.scss.mjs +0 -143
  405. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.scss.mjs +0 -4
  406. package/dist/ai-threads/ai-threads.d.ts +0 -82
  407. package/dist/ai-threads/ai-threads.mjs +0 -343
  408. package/dist/ai-threads/ai-threads.scss.mjs +0 -4
  409. package/dist/ai-threads/index.d.ts +0 -1
  410. package/dist/ai-threads/index.mjs +0 -5
  411. package/dist/ai-threads-search/ai-threads-search.scss.mjs +0 -4
  412. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.scss.mjs +0 -4
  413. package/dist/ai-user-message/ai-user-message.scss.mjs +0 -4
  414. package/dist/ai-user-message-toolbar/ai-user-message-toolbar.scss.mjs +0 -4
  415. package/dist/ai-voice-input/ai-voice-input.scss.mjs +0 -4
  416. package/dist/core/canvas-controller.d.ts +0 -81
  417. package/dist/core/canvas-controller.mjs +0 -221
  418. package/dist/core/chatbot-core-controller.d.ts +0 -57
  419. package/dist/core/chatbot-core-controller.mjs +0 -545
  420. package/dist/core/overlay/overlay.scss.mjs +0 -4
  421. package/dist/core/popover/popover.scss.mjs +0 -4
  422. package/dist/core/tooltip/tooltip.scss.mjs +0 -4
  423. package/dist/tools/ai-data-table/ai-data-table-definition.d.ts +0 -2
  424. package/dist/tools/ai-data-table/ai-data-table-definition.mjs +0 -43
  425. package/dist/tools/ai-data-table/ai-data-table.scss.mjs +0 -4
  426. package/dist/tools/ai-mcp-app/ai-mcp-app.d.ts +0 -70
  427. package/dist/tools/ai-mcp-app/ai-mcp-app.mjs +0 -589
  428. package/dist/tools/ai-mcp-app/ai-mcp-app.scss.mjs +0 -4
  429. package/dist/tools/ai-mcp-app/index.d.ts +0 -3
  430. package/dist/tools/ai-mcp-app/index.mjs +0 -6
  431. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.d.ts +0 -60
  432. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.mjs +0 -147
  433. package/dist/tools/ai-mcp-app/mcp-app-bridge-types.d.ts +0 -124
  434. package/dist/tools/ai-mcp-app/mcp-app-bridge.d.ts +0 -41
  435. package/dist/tools/ai-mcp-app/mcp-app-bridge.mjs +0 -293
  436. package/dist/tools/ai-mcp-app/mcp-app-context.d.ts +0 -46
  437. package/dist/tools/ai-mcp-app/mcp-app-context.mjs +0 -5
  438. package/dist/tools/ai-paginator/ai-paginator.scss.mjs +0 -4
  439. package/dist/tools/ai-steps/ai-steps-definition.d.ts +0 -2
  440. package/dist/tools/ai-steps/ai-steps-definition.mjs +0 -51
  441. package/dist/tools/ai-steps/ai-steps.scss.mjs +0 -4
  442. package/dist/utils/inert-outside.d.ts +0 -7
  443. package/dist/utils/inert-outside.mjs +0 -28
  444. package/dist/utils.d.ts +0 -32
  445. package/dist/utils.mjs +0 -57
  446. /package/dist/{ai-chatbot → utils}/markdown-stream-controller.d.ts +0 -0
@@ -0,0 +1,495 @@
1
+ import __decorate from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.mjs";
2
+ import "../ai-modal/ai-modal2.mjs";
3
+ import { DeleteThreadController } from "../utils/delete-thread-controller.mjs";
4
+ import { InfiniteScrollController } from "../utils/infinite-scroll-controller.mjs";
5
+ import "../ai-error-message/index.mjs";
6
+ import "../ai-thread-actions-menu/index.mjs";
7
+ import "../ai-edit-thread/index.mjs";
8
+ import "../ai-spinner/index.mjs";
9
+ import { formatRelativeTime } from "../utils/format.mjs";
10
+ import ai_threads_search_default from "./ai-threads-search.mjs";
11
+ import { LitElement, html, nothing, unsafeCSS } from "lit";
12
+ import { customElement, property, query, state } from "lit/decorators.js";
13
+ import { when } from "lit/directives/when.js";
14
+ //#region src/lib/ai-threads-search/ai-threads-search.ts
15
+ var AiThreadsSearchComponentTagName = "forge-ai-threads-search";
16
+ var AiThreadsSearchComponent = class AiThreadsSearchComponent extends LitElement {
17
+ constructor(..._args) {
18
+ super(..._args);
19
+ this.threads = [];
20
+ this.headerTitle = "All chats";
21
+ this.showNewChatButton = true;
22
+ this.showBackButton = false;
23
+ this.showSearch = true;
24
+ this.totalChats = 0;
25
+ this.placeholder = "Find a chat";
26
+ this.showThreadRename = false;
27
+ this.showThreadDelete = false;
28
+ this.selectedThreadId = null;
29
+ this._searchQuery = "";
30
+ this._isSearching = false;
31
+ this._searchResults = [];
32
+ this._editingThreadId = null;
33
+ this._hiddenThreadIds = /* @__PURE__ */ new Set();
34
+ this._openMenuThreadId = null;
35
+ this.#focusRowIndexAfterLoad = null;
36
+ this.#deleteThreadController = new DeleteThreadController(this, { onConfirm: (thread) => this.#confirmDelete(thread) });
37
+ this.#infiniteScrollController = new InfiniteScrollController(this, { onLoadMore: () => this.#loadMore() });
38
+ }
39
+ static {
40
+ this.styles = unsafeCSS(ai_threads_search_default);
41
+ }
42
+ #focusRowIndexAfterLoad;
43
+ #deleteThreadController;
44
+ #infiniteScrollController;
45
+ get #shouldEnablePagination() {
46
+ if (this.totalChats <= 0) return false;
47
+ return this.#displayedThreads.length < this.totalChats;
48
+ }
49
+ firstUpdated() {
50
+ if (this.#shouldEnablePagination && this._resultsContainer) this.#infiniteScrollController.attach(this._resultsContainer);
51
+ }
52
+ updated(changedProperties) {
53
+ if (changedProperties.has("threads") || changedProperties.has("totalChats")) {
54
+ this.#infiniteScrollController.reset();
55
+ if (this.#shouldEnablePagination) {
56
+ if (this._resultsContainer) this.#infiniteScrollController.attach(this._resultsContainer);
57
+ } else this.#infiniteScrollController.detach();
58
+ }
59
+ }
60
+ disconnectedCallback() {
61
+ super.disconnectedCallback();
62
+ clearTimeout(this._searchTimeout);
63
+ }
64
+ #handleSearchInput(e) {
65
+ const input = e.target;
66
+ this._searchQuery = input.value;
67
+ clearTimeout(this._searchTimeout);
68
+ this._searchTimeout = window.setTimeout(() => {
69
+ this.#performSearch();
70
+ }, 300);
71
+ }
72
+ #performSearch() {
73
+ const searchQuery = this._searchQuery.trim();
74
+ this.#focusRowIndexAfterLoad = null;
75
+ this.#infiniteScrollController.reset();
76
+ const searchEvent = new CustomEvent("forge-ai-threads-search-query", {
77
+ detail: {
78
+ query: searchQuery,
79
+ setResults: (results) => {
80
+ this._searchResults = results;
81
+ this._isSearching = false;
82
+ }
83
+ },
84
+ bubbles: true,
85
+ composed: true,
86
+ cancelable: true
87
+ });
88
+ this.dispatchEvent(searchEvent);
89
+ if (searchEvent.defaultPrevented) this._isSearching = true;
90
+ else {
91
+ this._searchResults = this.threads.filter((thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()));
92
+ this.#infiniteScrollController.setHasMore(false);
93
+ }
94
+ }
95
+ #handleLoadMoreClick() {
96
+ if (this.#infiniteScrollController.isLoadingMore) return;
97
+ this.#focusRowIndexAfterLoad = this.#displayedThreads.length;
98
+ this.#infiniteScrollController.setLoadingState(true);
99
+ this.#loadMore();
100
+ }
101
+ #focusRow(index) {
102
+ (this.shadowRoot?.querySelectorAll(".forge-list-item > button") ?? [])[index]?.focus();
103
+ }
104
+ #loadMore() {
105
+ const loadMoreEvent = new CustomEvent("forge-ai-threads-search-load-more", {
106
+ detail: {
107
+ query: this._searchQuery,
108
+ appendResults: (results) => {
109
+ const focusRowIndex = this.#focusRowIndexAfterLoad;
110
+ this.#focusRowIndexAfterLoad = null;
111
+ if (results.length === 0) this.#infiniteScrollController.setHasMore(false);
112
+ else {
113
+ if (this._searchQuery) this._searchResults = [...this._searchResults, ...results];
114
+ else this.threads = [...this.threads, ...results];
115
+ if (focusRowIndex !== null) this.updateComplete.then(() => this.#focusRow(focusRowIndex));
116
+ }
117
+ this.#infiniteScrollController.setLoadingState(false);
118
+ }
119
+ },
120
+ bubbles: true,
121
+ composed: true
122
+ });
123
+ this.dispatchEvent(loadMoreEvent);
124
+ }
125
+ #handleThreadSelect(thread) {
126
+ const event = new CustomEvent("forge-ai-threads-search-select", {
127
+ detail: {
128
+ id: thread.id,
129
+ title: thread.title
130
+ },
131
+ bubbles: true,
132
+ composed: true
133
+ });
134
+ this.dispatchEvent(event);
135
+ }
136
+ #handleNewChatClick() {
137
+ const event = new CustomEvent("forge-ai-threads-search-new-chat", {
138
+ bubbles: true,
139
+ composed: true
140
+ });
141
+ this.dispatchEvent(event);
142
+ }
143
+ #handleBackClick() {
144
+ const event = new CustomEvent("forge-ai-threads-search-back", {
145
+ bubbles: true,
146
+ composed: true
147
+ });
148
+ this.dispatchEvent(event);
149
+ }
150
+ #handleRetryClick() {
151
+ if (this._searchQuery.trim()) {
152
+ this.#performSearch();
153
+ return;
154
+ }
155
+ const event = new CustomEvent("forge-ai-threads-search-retry", {
156
+ bubbles: true,
157
+ composed: true
158
+ });
159
+ this.dispatchEvent(event);
160
+ }
161
+ #handleMenuRename(e) {
162
+ this._editingThreadId = e.detail.id;
163
+ this._openMenuThreadId = null;
164
+ }
165
+ #handleMenuOpen(e) {
166
+ this._openMenuThreadId = e.detail.id;
167
+ }
168
+ #handleMenuClose() {
169
+ this._openMenuThreadId = null;
170
+ }
171
+ #handleMenuDeleteClick(e) {
172
+ const { id } = e.detail;
173
+ const thread = this.#displayedThreads.find((t) => t.id === id);
174
+ if (!thread) return;
175
+ const event = new CustomEvent("forge-ai-threads-search-delete-confirm", {
176
+ detail: { thread },
177
+ bubbles: true,
178
+ composed: true,
179
+ cancelable: true
180
+ });
181
+ if (this.dispatchEvent(event)) this.#deleteThreadController.show(thread);
182
+ }
183
+ #confirmDelete(thread) {
184
+ const onSuccess = () => {
185
+ this._hiddenThreadIds.add(thread.id);
186
+ this.requestUpdate();
187
+ };
188
+ const onError = (error) => {
189
+ this._hiddenThreadIds.delete(thread.id);
190
+ this.requestUpdate();
191
+ if (error) console.error("Delete failed:", error);
192
+ };
193
+ const event = new CustomEvent("forge-ai-threads-search-delete", {
194
+ detail: {
195
+ id: thread.id,
196
+ thread,
197
+ onSuccess,
198
+ onError
199
+ },
200
+ bubbles: true,
201
+ composed: true,
202
+ cancelable: true
203
+ });
204
+ if (this.dispatchEvent(event)) {
205
+ this._hiddenThreadIds.add(thread.id);
206
+ this.requestUpdate();
207
+ }
208
+ }
209
+ /**
210
+ * Completes a delete that a host intercepted via `forge-ai-threads-search-delete-confirm`
211
+ * (calling preventDefault() to show its own confirmation instead of this component's
212
+ * built-in one). Call once the host's own confirmation has been accepted.
213
+ */
214
+ confirmThreadDelete(thread) {
215
+ this.#confirmDelete(thread);
216
+ }
217
+ #handleEditSave(e) {
218
+ const { id, oldTitle, newTitle } = e.detail;
219
+ const thread = this.#displayedThreads.find((t) => t.id === id);
220
+ if (!thread) return;
221
+ const onSuccess = () => {
222
+ thread.title = newTitle;
223
+ this.requestUpdate();
224
+ };
225
+ const onError = (error) => {
226
+ thread.title = oldTitle;
227
+ this.requestUpdate();
228
+ if (error) console.error("Rename failed:", error);
229
+ };
230
+ const event = new CustomEvent("forge-ai-threads-search-rename", {
231
+ detail: {
232
+ id,
233
+ oldTitle,
234
+ newTitle,
235
+ onSuccess,
236
+ onError
237
+ },
238
+ bubbles: true,
239
+ composed: true,
240
+ cancelable: true
241
+ });
242
+ if (this.dispatchEvent(event)) {
243
+ thread.title = newTitle;
244
+ this.requestUpdate();
245
+ }
246
+ this._editingThreadId = null;
247
+ }
248
+ #handleEditCancel() {
249
+ this._editingThreadId = null;
250
+ }
251
+ #handleClearSearch() {
252
+ this.resetSearch();
253
+ this._searchInput?.focus();
254
+ }
255
+ /**
256
+ * Discards the current query and its results so the list shows every loaded chat again.
257
+ * Dispatches no search event and moves no focus, so a host may call it on a surface that is
258
+ * currently hidden (e.g. a popover that stays mounted between opens).
259
+ */
260
+ resetSearch() {
261
+ clearTimeout(this._searchTimeout);
262
+ this._searchQuery = "";
263
+ this._searchResults = [];
264
+ this._isSearching = false;
265
+ this.#focusRowIndexAfterLoad = null;
266
+ this.#infiniteScrollController.reset();
267
+ }
268
+ /**
269
+ * Moves focus into the component: the search input when shown, otherwise the first chat in
270
+ * the list, otherwise the first header button.
271
+ */
272
+ focus() {
273
+ (this._searchInput ?? this.shadowRoot?.querySelector(".forge-list-item > button") ?? this.shadowRoot?.querySelector("button"))?.focus();
274
+ }
275
+ get #displayedThreads() {
276
+ return (this._searchQuery ? this._searchResults : this.threads).filter((thread) => !this._hiddenThreadIds.has(thread.id));
277
+ }
278
+ get #header() {
279
+ return html`
280
+ <div class="header">
281
+ <div class="header-start">
282
+ ${when(this.showBackButton, () => html`
283
+ <button class="back-button forge-icon-button forge-icon-button--medium" @click=${this.#handleBackClick} aria-label="Back">
284
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true">
285
+ <path fill="none" d="M0 0h24v24H0z" />
286
+ <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z" />
287
+ </svg>
288
+ </button>
289
+ `)}
290
+ <div class="header-title">
291
+ <span class="title">${this.headerTitle}</span>
292
+ </div>
293
+ </div>
294
+ <div class="header-end">
295
+ ${when(this.showNewChatButton, () => html`
296
+ <button class="forge-button new-chat-button" @click=${this.#handleNewChatClick}>
297
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon" aria-hidden="true">
298
+ <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
299
+ </svg>
300
+ New chat
301
+ </button>
302
+ `)}
303
+ <slot name="header-actions"></slot>
304
+ </div>
305
+ </div>
306
+ `;
307
+ }
308
+ get #searchField() {
309
+ return html`
310
+ <div class="forge-field forge-field--small search-field">
311
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon" aria-hidden="true">
312
+ <path fill="none" d="M0 0h24v24H0z" />
313
+ <path
314
+ d="M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14" />
315
+ </svg>
316
+ <input
317
+ id="threads-search-input"
318
+ type="text"
319
+ autocomplete="off"
320
+ aria-label="Search"
321
+ placeholder=${this.placeholder}
322
+ .value=${this._searchQuery}
323
+ @input=${this.#handleSearchInput} />
324
+ ${when(this._isSearching, () => html`<forge-ai-spinner size="extra-small"></forge-ai-spinner>`)}
325
+ ${when(this._searchQuery.length, () => html`
326
+ <button class="forge-icon-button forge-icon-button--small" type="button" aria-label="Clear search" @click=${this.#handleClearSearch}>
327
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon" aria-hidden="true">
328
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
329
+ </svg>
330
+ </button>
331
+ `)}
332
+ </div>
333
+ `;
334
+ }
335
+ #renderThreadItem(thread) {
336
+ const isEditing = this._editingThreadId === thread.id;
337
+ const hasOpenMenu = this._openMenuThreadId === thread.id;
338
+ const isSelected = this.selectedThreadId === thread.id;
339
+ return html`
340
+ <li class="forge-list-item ${isSelected ? "forge-list-item--selected" : ""} ${hasOpenMenu ? "forge-list-item--menu-open" : ""}" role="listitem">
341
+ ${when(isEditing, () => html`
342
+ <forge-ai-edit-thread
343
+ .thread=${thread}
344
+ .value=${thread.title}
345
+ @forge-ai-edit-thread-save=${this.#handleEditSave}
346
+ @forge-ai-edit-thread-cancel=${this.#handleEditCancel}>
347
+ </forge-ai-edit-thread>
348
+ `, () => html`
349
+ <button type="button" aria-current=${isSelected ? "true" : nothing} @click=${() => this.#handleThreadSelect(thread)}>${thread.title}</button>
350
+ <span class="thread-time">${formatRelativeTime(thread.createdAt)}</span>
351
+ ${when(this.showThreadRename || this.showThreadDelete, () => html`
352
+ <div class="thread-item-actions">
353
+ <forge-ai-thread-actions-menu
354
+ .thread=${thread}
355
+ ?show-rename=${this.showThreadRename}
356
+ ?show-delete=${this.showThreadDelete}
357
+ @forge-ai-thread-actions-menu-rename=${this.#handleMenuRename}
358
+ @forge-ai-thread-actions-menu-delete-click=${this.#handleMenuDeleteClick}
359
+ @forge-ai-thread-actions-menu-open=${this.#handleMenuOpen}
360
+ @forge-ai-thread-actions-menu-close=${this.#handleMenuClose}>
361
+ </forge-ai-thread-actions-menu>
362
+ </div>
363
+ `)}
364
+ `)}
365
+ </li>
366
+ `;
367
+ }
368
+ get #errorState() {
369
+ return html`
370
+ <div class="error-state">
371
+ <forge-ai-error-message density="small">
372
+ <span slot="title">Error</span>
373
+ <p class="error-state__message">${this.errorMessage}</p>
374
+ <button class="forge-button forge-button--outlined forge-button--dense error-state__retry" type="button" @click=${this.#handleRetryClick}>
375
+ Retry
376
+ </button>
377
+ </forge-ai-error-message>
378
+ </div>
379
+ `;
380
+ }
381
+ /** The single-line variant, used when threads are already on screen and the list stays visible. */
382
+ get #compactError() {
383
+ return html`
384
+ <forge-ai-error-message class="compact-error" density="small">
385
+ <div class="compact-error__body">
386
+ <span>${this.errorMessage}</span>
387
+ <button class="forge-button forge-button--outlined forge-button--dense compact-error__retry" type="button" @click=${this.#handleRetryClick}>
388
+ Retry
389
+ </button>
390
+ </div>
391
+ </forge-ai-error-message>
392
+ `;
393
+ }
394
+ /**
395
+ * A failure that arrives while a page is in flight is a pagination failure, so it reads at the
396
+ * bottom of the list where the load-more spinner would have been. Any other failure - a rejected
397
+ * thread selection, for instance - is not tied to the end of the list, so it sits above it.
398
+ */
399
+ get #errorPlacement() {
400
+ if (!this.errorMessage || this.#displayedThreads.length === 0) return "none";
401
+ return this.#infiniteScrollController.isLoadingMore ? "list-footer" : "above-list";
402
+ }
403
+ get #emptyState() {
404
+ const message = this._searchQuery.trim() ? "No chats found" : "No chats yet";
405
+ return html`
406
+ <div class="empty-state">
407
+ <p>${message}</p>
408
+ </div>
409
+ `;
410
+ }
411
+ get #listFooter() {
412
+ if (this.#errorPlacement === "list-footer") return this.#compactError;
413
+ if (this.#infiniteScrollController.isLoadingMore) return html`
414
+ <div class="loading-more-indicator">
415
+ <forge-ai-spinner></forge-ai-spinner>
416
+ </div>
417
+ `;
418
+ if (this.#shouldEnablePagination && this.#infiniteScrollController.hasMoreResults) return html`
419
+ <div class="loading-more-indicator">
420
+ <button type="button" class="forge-button forge-button--dense load-more-button" @click=${this.#handleLoadMoreClick}>Load more</button>
421
+ </div>
422
+ `;
423
+ return nothing;
424
+ }
425
+ get #resultsList() {
426
+ const displayThreads = this.#displayedThreads;
427
+ if (displayThreads.length === 0) return html`<div class="results-container">${this.errorMessage ? this.#errorState : this.#emptyState}</div>`;
428
+ return html`
429
+ <div class="results-container">
430
+ <ul class="forge-list forge-list--dense forge-list--navlist" role="list">
431
+ ${displayThreads.map((thread) => this.#renderThreadItem(thread))}
432
+ </ul>
433
+ ${this.#listFooter}
434
+ </div>
435
+ `;
436
+ }
437
+ render() {
438
+ return html`
439
+ <div class="threads-search-container">
440
+ ${this.#header} ${when(this.showSearch, () => this.#searchField)} ${when(this.#errorPlacement === "above-list", () => this.#compactError)}
441
+ ${this.#resultsList}
442
+ </div>
443
+ ${this.#deleteThreadController.template}
444
+ `;
445
+ }
446
+ };
447
+ __decorate([property({ type: Array })], AiThreadsSearchComponent.prototype, "threads", void 0);
448
+ __decorate([property({
449
+ type: String,
450
+ attribute: "header-title"
451
+ })], AiThreadsSearchComponent.prototype, "headerTitle", void 0);
452
+ __decorate([property({
453
+ type: Boolean,
454
+ attribute: "show-new-chat-button"
455
+ })], AiThreadsSearchComponent.prototype, "showNewChatButton", void 0);
456
+ __decorate([property({
457
+ type: Boolean,
458
+ attribute: "show-back-button"
459
+ })], AiThreadsSearchComponent.prototype, "showBackButton", void 0);
460
+ __decorate([property({
461
+ type: Boolean,
462
+ attribute: "show-search"
463
+ })], AiThreadsSearchComponent.prototype, "showSearch", void 0);
464
+ __decorate([property({
465
+ type: Number,
466
+ attribute: "total-chats"
467
+ })], AiThreadsSearchComponent.prototype, "totalChats", void 0);
468
+ __decorate([property({ type: String })], AiThreadsSearchComponent.prototype, "placeholder", void 0);
469
+ __decorate([property({
470
+ type: String,
471
+ attribute: "error-message"
472
+ })], AiThreadsSearchComponent.prototype, "errorMessage", void 0);
473
+ __decorate([property({
474
+ type: Boolean,
475
+ attribute: "show-thread-rename"
476
+ })], AiThreadsSearchComponent.prototype, "showThreadRename", void 0);
477
+ __decorate([property({
478
+ type: Boolean,
479
+ attribute: "show-thread-delete"
480
+ })], AiThreadsSearchComponent.prototype, "showThreadDelete", void 0);
481
+ __decorate([property({
482
+ type: String,
483
+ attribute: "selected-thread-id"
484
+ })], AiThreadsSearchComponent.prototype, "selectedThreadId", void 0);
485
+ __decorate([query(".results-container")], AiThreadsSearchComponent.prototype, "_resultsContainer", void 0);
486
+ __decorate([query("#threads-search-input")], AiThreadsSearchComponent.prototype, "_searchInput", void 0);
487
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_searchQuery", void 0);
488
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_isSearching", void 0);
489
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_searchResults", void 0);
490
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_editingThreadId", void 0);
491
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_hiddenThreadIds", void 0);
492
+ __decorate([state()], AiThreadsSearchComponent.prototype, "_openMenuThreadId", void 0);
493
+ AiThreadsSearchComponent = __decorate([customElement(AiThreadsSearchComponentTagName)], AiThreadsSearchComponent);
494
+ //#endregion
495
+ export { AiThreadsSearchComponent, AiThreadsSearchComponentTagName };
@@ -1 +1 @@
1
- export * from './ai-threads-search';
1
+ export * from './ai-threads-search.js';
@@ -1,5 +1 @@
1
- import { AiThreadsSearchComponent, AiThreadsSearchComponentTagName } from "./ai-threads-search.mjs";
2
- export {
3
- AiThreadsSearchComponent,
4
- AiThreadsSearchComponentTagName
5
- };
1
+ export { AiThreadsSearchComponent, AiThreadsSearchComponentTagName } from "./ai-threads-search2.mjs";
@@ -0,0 +1,21 @@
1
+ import { LitElement, TemplateResult, nothing, PropertyValues, CSSResult } from 'lit';
2
+ import { ToolCall, AnyToolDefinition } from '../types/index.js';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'forge-ai-tool-call': AiToolCallComponent;
6
+ }
7
+ }
8
+ export declare const AiToolCallComponentTagName: keyof HTMLElementTagNameMap;
9
+ /**
10
+ * @tag forge-ai-tool-call
11
+ *
12
+ * @event {CustomEvent<void>} forge-ai-message-thread-scroll-request - Fired when the rendered content changes size and the containing message thread should scroll to keep it in view.
13
+ */
14
+ export declare class AiToolCallComponent extends LitElement {
15
+ #private;
16
+ static styles: CSSResult;
17
+ toolCall: ToolCall;
18
+ toolDefinition?: AnyToolDefinition;
19
+ updated(changedProperties: PropertyValues<this>): void;
20
+ render(): TemplateResult | typeof nothing;
21
+ }
@@ -0,0 +1,4 @@
1
+ //#region src/lib/ai-tool-call/ai-tool-call.scss?inline
2
+ var ai_tool_call_default = ":host {\n display: block;\n margin-block-end: var(--forge-spacing-small, 12px);\n}";
3
+ //#endregion
4
+ export { ai_tool_call_default as default };
@@ -0,0 +1,132 @@
1
+ import __decorate from "../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.mjs";
2
+ import { createToolCanvas, requestCanvasClose, requestCanvasOpen, resolveToolCanvasActionLabel, resolveToolCanvasIcon, resolveToolCanvasInline, resolveToolCanvasSubtitle, resolveToolCanvasTitle, toolCanvasHostContext } from "./tool-canvas.mjs";
3
+ import { shouldShowToolRenderer } from "./utils.mjs";
4
+ import "../ai-artifact-card/index.mjs";
5
+ import ai_tool_call_default from "./ai-tool-call.mjs";
6
+ import { LitElement, html, nothing, unsafeCSS } from "lit";
7
+ import { customElement, property } from "lit/decorators.js";
8
+ import { createRef, ref } from "lit/directives/ref.js";
9
+ import { ContextConsumer } from "@lit/context";
10
+ //#region src/lib/ai-tool-call/ai-tool-call.ts
11
+ var AiToolCallComponentTagName = "forge-ai-tool-call";
12
+ var AiToolCallComponent = class AiToolCallComponent extends LitElement {
13
+ static {
14
+ this.styles = unsafeCSS(ai_tool_call_default);
15
+ }
16
+ #customRendererRef = createRef();
17
+ #renderedElement;
18
+ #renderedCanvas;
19
+ #canvasHostConsumer = new ContextConsumer(this, {
20
+ context: toolCanvasHostContext,
21
+ subscribe: true,
22
+ callback: () => this.requestUpdate()
23
+ });
24
+ get #shouldRenderCustom() {
25
+ return shouldShowToolRenderer(this.toolCall, this.toolDefinition);
26
+ }
27
+ /** Tools without a canvas config stay plain `inline` even when the host offers a canvas. */
28
+ get #presentation() {
29
+ if (!this.toolDefinition?.canvas) return "inline";
30
+ return this.#canvasHostConsumer.value?.presentation ?? "inline";
31
+ }
32
+ get #isOpenInCanvas() {
33
+ return this.#canvasHostConsumer.value?.openToolCallId === this.toolCall.id;
34
+ }
35
+ #canvasControls;
36
+ get #canvas() {
37
+ const available = this.#presentation === "inline-expandable";
38
+ const isOpen = this.#isOpenInCanvas;
39
+ if (this.#canvasControls?.available !== available || this.#canvasControls.isOpen !== isOpen) this.#canvasControls = createToolCanvas({
40
+ available,
41
+ isOpen: () => this.#isOpenInCanvas,
42
+ open: (options) => requestCanvasOpen(this, {
43
+ toolCallId: this.toolCall.id,
44
+ toolName: this.toolCall.name,
45
+ title: options?.title
46
+ }),
47
+ close: () => requestCanvasClose(this, { toolCallId: this.toolCall.id })
48
+ });
49
+ return this.#canvasControls;
50
+ }
51
+ get #showsArtifactCard() {
52
+ if (!this.toolDefinition || this.#presentation !== "inline-expandable") return false;
53
+ switch (resolveToolCanvasInline(this.toolDefinition)) {
54
+ case "card": return true;
55
+ case "card-while-open": return this.#isOpenInCanvas;
56
+ default: return false;
57
+ }
58
+ }
59
+ #artifactCard(toolDefinition) {
60
+ const active = this.#isOpenInCanvas;
61
+ const icon = resolveToolCanvasIcon(this.toolCall, toolDefinition);
62
+ icon?.setAttribute("slot", "icon");
63
+ return html`
64
+ <forge-ai-artifact-card
65
+ title-text=${resolveToolCanvasTitle(this.toolCall, toolDefinition)}
66
+ .subtitleText=${resolveToolCanvasSubtitle(this.toolCall, toolDefinition) ?? ""}
67
+ action-label=${resolveToolCanvasActionLabel(this.toolCall, toolDefinition, active)}
68
+ asset-id=${this.toolCall.id}
69
+ ?active=${active}
70
+ @forge-ai-artifact-card-open=${() => this.#canvas.toggle()}>
71
+ ${icon ?? nothing}
72
+ </forge-ai-artifact-card>
73
+ `;
74
+ }
75
+ #dispatchScrollRequest() {
76
+ this.dispatchEvent(new CustomEvent("forge-ai-message-thread-scroll-request", {
77
+ bubbles: true,
78
+ composed: true
79
+ }));
80
+ }
81
+ get #customRenderer() {
82
+ const toolDefinition = this.toolDefinition;
83
+ const renderer = toolDefinition?.renderer;
84
+ if (!toolDefinition || !renderer || !this.#shouldRenderCustom) return nothing;
85
+ if (this.#showsArtifactCard) return this.#artifactCard(toolDefinition);
86
+ if (renderer.elementTag || renderer.render) return html`<div ${ref(this.#customRendererRef)}></div>`;
87
+ return nothing;
88
+ }
89
+ updated(changedProperties) {
90
+ super.updated(changedProperties);
91
+ const container = this.#customRendererRef.value;
92
+ if (!container || !this.#shouldRenderCustom) return;
93
+ const renderer = this.toolDefinition?.renderer;
94
+ const canvas = this.#canvas;
95
+ const mounted = container.childNodes.length > 0;
96
+ const changed = changedProperties.has("toolCall") || changedProperties.has("toolDefinition");
97
+ if (renderer?.elementTag) {
98
+ if (mounted && this.#renderedElement instanceof HTMLElement && this.#renderedElement.tagName.toLowerCase() === renderer.elementTag) {
99
+ const existing = this.#renderedElement;
100
+ existing.toolCall = this.toolCall;
101
+ existing.presentation = this.#presentation;
102
+ existing.canvas = canvas;
103
+ return;
104
+ }
105
+ const element = document.createElement(renderer.elementTag);
106
+ element.toolCall = this.toolCall;
107
+ element.presentation = this.#presentation;
108
+ element.canvas = canvas;
109
+ this.#replaceRenderedElement(container, element);
110
+ } else if (renderer?.render && (changed || !mounted || canvas !== this.#renderedCanvas)) {
111
+ this.#renderedCanvas = canvas;
112
+ this.#replaceRenderedElement(container, renderer.render(this.toolCall, {
113
+ presentation: this.#presentation,
114
+ canvas
115
+ }));
116
+ }
117
+ }
118
+ #replaceRenderedElement(container, element) {
119
+ if (this.#renderedElement && container.contains(this.#renderedElement)) container.removeChild(this.#renderedElement);
120
+ this.#renderedElement = element;
121
+ container.appendChild(element);
122
+ this.#dispatchScrollRequest();
123
+ }
124
+ render() {
125
+ return this.#customRenderer;
126
+ }
127
+ };
128
+ __decorate([property({ attribute: false })], AiToolCallComponent.prototype, "toolCall", void 0);
129
+ __decorate([property({ attribute: false })], AiToolCallComponent.prototype, "toolDefinition", void 0);
130
+ AiToolCallComponent = __decorate([customElement(AiToolCallComponentTagName)], AiToolCallComponent);
131
+ //#endregion
132
+ export { AiToolCallComponent, AiToolCallComponentTagName };
@@ -1,4 +1,4 @@
1
- import { ToolRenderFunction, ToolRenderer } from './types.js';
1
+ import { ToolRenderFunction, ToolRenderer } from '../types/index.js';
2
2
  export interface CreateToolRendererElementConfig {
3
3
  elementTag: keyof HTMLElementTagNameMap;
4
4
  }
@@ -0,0 +1,10 @@
1
+ //#region src/lib/ai-tool-call/create-tool-renderer.ts
2
+ function isElementConfig(config) {
3
+ return "elementTag" in config;
4
+ }
5
+ function createToolRenderer(config) {
6
+ if (isElementConfig(config)) return { elementTag: config.elementTag };
7
+ return { render: config.render };
8
+ }
9
+ //#endregion
10
+ export { createToolRenderer };