@tylertech/forge-ai 0.15.3-dev.1 → 0.16.0-dev.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 +5757 -15411
  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 +1 -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 +156 -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 +39 -103
  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
@@ -1,60 +0,0 @@
1
- import { McpAppHostCapabilities, McpAppHostContext, McpAppResourceCsp, McpAppResourcePermissions, ToolCall } from '../../ai-chatbot';
2
- import { IMcpAppBridge, McpAppViewToolResult } from './mcp-app-bridge-types.js';
3
- /**
4
- * The view→host handler slots the element supplies; registered on the bridge BEFORE
5
- * `connect()` so they are live for the very first widget request.
6
- */
7
- export type McpAppHandlers = Pick<IMcpAppBridge, 'oncalltool' | 'onreadresource' | 'onopenlink' | 'onmessage' | 'onloggingmessage' | 'onsizechange' | 'onrequestdisplaymode' | 'onupdatemodelcontext' | 'onrequestteardown'>;
8
- export interface McpAppConnectConfig {
9
- iframe: HTMLIFrameElement;
10
- sandboxUrl: string;
11
- html: string;
12
- hostContext: McpAppHostContext;
13
- hostCapabilities: McpAppHostCapabilities;
14
- csp: McpAppResourceCsp;
15
- permissions: McpAppResourcePermissions;
16
- sandbox?: string;
17
- handlers: McpAppHandlers;
18
- }
19
- /**
20
- * Serialize the declared CSP domains for the sandbox `?csp=` param. The sandbox origin
21
- * builds the actual CSP header from these; empty lists are omitted.
22
- */
23
- export declare function buildCspParam(csp: McpAppResourceCsp): string;
24
- /**
25
- * The requested permissions the sandbox can enforce, normalized to the spec shape. A key
26
- * is requested when present (`{ camera: {} }`); `false`/`null` values are ignored.
27
- */
28
- export declare function enforcedPermissions(permissions: McpAppResourcePermissions): McpAppResourcePermissions;
29
- /** Map requested permissions onto the iframe `allow` attribute. */
30
- export declare function buildAllowAttribute(permissions: McpAppResourcePermissions): string;
31
- /**
32
- * Build the View's `CallToolResult` from the raw MCP result + structured content — never
33
- * from the model-facing `result`. When the backend omitted a field (size caps) the View
34
- * gets what remains; when both are missing it gets an empty `content` array, flagged
35
- * `isError` only if the tool call itself errored.
36
- */
37
- export declare function buildViewToolResult(toolCall: ToolCall): McpAppViewToolResult;
38
- /**
39
- * Drives an {@link IMcpAppBridge} through the sandbox handshake and the streaming
40
- * tool-call lifecycle. Bridge-agnostic — talks to the interface only.
41
- *
42
- * The controller owns the OUTER sandbox iframe DOM (its `src` with the `?csp=` param and
43
- * its `allow` attribute); the bridge owns the postMessage lifecycle.
44
- */
45
- export declare class McpAppBridgeController {
46
- #private;
47
- constructor(bridge: IMcpAppBridge);
48
- connect(config: McpAppConnectConfig): Promise<void>;
49
- /**
50
- * Reconcile the widget with the current tool-call state. Streams partial args, sends
51
- * final args once, then exactly one of `tool-result` (complete/error) or
52
- * `tool-cancelled` — all gated on the `initialized` handshake. Safe to call on every
53
- * `toolCall` update.
54
- */
55
- syncToolCall(toolCall: ToolCall): void;
56
- /** Forward a host-context change; the bridge holds it until the View is initialized. */
57
- sendHostContextChange(hostContext: McpAppHostContext): void;
58
- /** Send `ui/resource-teardown` and release the bridge; the iframe is removed without waiting for the ack. */
59
- teardown(): void;
60
- }
@@ -1,147 +0,0 @@
1
- const PERMISSION_FEATURES = {
2
- camera: "camera",
3
- microphone: "microphone",
4
- geolocation: "geolocation",
5
- clipboardWrite: "clipboard-write"
6
- };
7
- const UNSAFE_CSP_SOURCE = /[\s;,'"]/;
8
- const CSP_PARAM_KEYS = ["connectDomains", "resourceDomains", "frameDomains", "baseUriDomains"];
9
- function buildCspParam(csp) {
10
- const declared = {};
11
- for (const key of CSP_PARAM_KEYS) {
12
- const safe = (csp[key] ?? []).filter((domain) => !!domain && !UNSAFE_CSP_SOURCE.test(domain));
13
- if (safe.length) {
14
- declared[key] = safe;
15
- }
16
- }
17
- return JSON.stringify(declared);
18
- }
19
- function enforcedPermissions(permissions) {
20
- const keys = Object.keys(PERMISSION_FEATURES).filter((key) => {
21
- const value = permissions[key];
22
- return value !== void 0 && value !== null && value !== false;
23
- });
24
- return Object.fromEntries(keys.map((key) => [key, {}]));
25
- }
26
- function buildAllowAttribute(permissions) {
27
- return Object.keys(enforcedPermissions(permissions)).map((key) => PERMISSION_FEATURES[key]).join("; ");
28
- }
29
- function buildViewToolResult(toolCall) {
30
- const mcpResult = toolCall.mcpResultOmitted ? void 0 : toolCall.mcpResult;
31
- const structuredContent = toolCall.structuredContentOmitted ? void 0 : toolCall.structuredContent;
32
- const isError = mcpResult?.isError ?? (toolCall.status === "error" || void 0);
33
- return {
34
- content: Array.isArray(mcpResult?.content) ? mcpResult.content : [],
35
- ...structuredContent !== void 0 ? { structuredContent } : {},
36
- ...isError !== void 0 ? { isError } : {},
37
- ...mcpResult?._meta !== void 0 ? { _meta: mcpResult._meta } : {}
38
- };
39
- }
40
- class McpAppBridgeController {
41
- #bridge;
42
- #connected = null;
43
- #lastArgsSent = null;
44
- #inputSent = false;
45
- #outcome = "pending";
46
- constructor(bridge) {
47
- this.#bridge = bridge;
48
- }
49
- connect(config) {
50
- if (this.#connected) {
51
- return this.#connected;
52
- }
53
- Object.assign(this.#bridge, config.handlers);
54
- const { iframe, sandboxUrl, csp, permissions } = config;
55
- const outerAllow = buildAllowAttribute(permissions);
56
- if (outerAllow) {
57
- iframe.setAttribute("allow", outerAllow);
58
- } else {
59
- iframe.removeAttribute("allow");
60
- }
61
- const sandboxWindow = iframe.contentWindow;
62
- if (!sandboxWindow) {
63
- return Promise.reject(new Error("sandbox iframe has no contentWindow"));
64
- }
65
- let sandboxOrigin;
66
- try {
67
- sandboxOrigin = new URL(sandboxUrl, window.location.href).origin;
68
- } catch {
69
- return Promise.reject(new Error(`invalid sandbox URL: ${sandboxUrl}`));
70
- }
71
- if (sandboxOrigin === "null" || sandboxOrigin === window.location.origin) {
72
- return Promise.reject(new Error("sandbox URL must be on a distinct, non-opaque origin"));
73
- }
74
- this.#connected = this.#bridge.connect({
75
- sandboxWindow,
76
- sandboxOrigin,
77
- html: config.html,
78
- hostContext: config.hostContext,
79
- hostCapabilities: config.hostCapabilities,
80
- permissions: enforcedPermissions(permissions),
81
- sandbox: config.sandbox
82
- });
83
- const separator = sandboxUrl.includes("?") ? "&" : "?";
84
- iframe.src = `${sandboxUrl}${separator}csp=${encodeURIComponent(buildCspParam(csp))}`;
85
- return this.#connected;
86
- }
87
- /**
88
- * Reconcile the widget with the current tool-call state. Streams partial args, sends
89
- * final args once, then exactly one of `tool-result` (complete/error) or
90
- * `tool-cancelled` — all gated on the `initialized` handshake. Safe to call on every
91
- * `toolCall` update.
92
- */
93
- syncToolCall(toolCall) {
94
- if (!this.#connected || this.#outcome !== "pending") {
95
- return;
96
- }
97
- void this.#connected.then(() => {
98
- if (this.#outcome !== "pending") {
99
- return;
100
- }
101
- if (toolCall.status === "cancelled") {
102
- this.#outcome = "cancel-sent";
103
- this.#bridge.sendToolCancelled();
104
- return;
105
- }
106
- const partialArgs = this.#coerceArgs(toolCall.args);
107
- const partialString = JSON.stringify(partialArgs);
108
- if (!this.#inputSent && Object.keys(partialArgs).length && partialString !== this.#lastArgsSent) {
109
- this.#lastArgsSent = partialString;
110
- this.#bridge.sendToolInputPartial(partialArgs);
111
- }
112
- const isFinished = toolCall.status === "complete" || toolCall.status === "error";
113
- if ((toolCall.status === "executing" || isFinished) && !this.#inputSent) {
114
- this.#inputSent = true;
115
- this.#bridge.sendToolInput(this.#coerceArgs(toolCall.args));
116
- }
117
- if (isFinished) {
118
- this.#outcome = "result-sent";
119
- this.#bridge.sendToolResult(buildViewToolResult(toolCall));
120
- }
121
- });
122
- }
123
- /** Forward a host-context change; the bridge holds it until the View is initialized. */
124
- sendHostContextChange(hostContext) {
125
- if (this.#connected) {
126
- this.#bridge.sendHostContextChange(hostContext);
127
- }
128
- }
129
- /** Send `ui/resource-teardown` and release the bridge; the iframe is removed without waiting for the ack. */
130
- teardown() {
131
- if (!this.#connected) {
132
- return;
133
- }
134
- this.#outcome = "torn-down";
135
- this.#bridge.sendTeardown();
136
- }
137
- #coerceArgs(args) {
138
- return args && typeof args === "object" ? args : {};
139
- }
140
- }
141
- export {
142
- McpAppBridgeController,
143
- buildAllowAttribute,
144
- buildCspParam,
145
- buildViewToolResult,
146
- enforcedPermissions
147
- };
@@ -1,124 +0,0 @@
1
- import { McpAppDisplayMode, McpAppHostCapabilities, McpAppHostContext, McpAppResourcePermissions, McpModelContextUpdateParams, McpResourceReadParams, McpToolCallParams, McpToolResult } from '../../ai-chatbot';
2
- /**
3
- * The host-side bridge surface `mcp-app-bridge.ts` (`McpAppBridge`) implements. The
4
- * element + controller depend on this interface only.
5
- */
6
- /**
7
- * A View's `tools/call` as received by the bridge. The bridge has no widget identity;
8
- * the element adds its `toolCallId` before forwarding to the host.
9
- */
10
- export type McpAppToolCallRequest = Omit<McpToolCallParams, 'toolCallId'>;
11
- /** A View's `resources/read` as received by the bridge (no widget identity). */
12
- export type McpAppResourceReadRequest = Omit<McpResourceReadParams, 'toolCallId'>;
13
- /** The `CallToolResult` delivered to the View via `ui/notifications/tool-result`. */
14
- export interface McpAppViewToolResult extends McpToolResult {
15
- structuredContent?: unknown;
16
- }
17
- /** Parameters a widget passes to `ui/open-link`. */
18
- export interface McpAppOpenLinkParams {
19
- url: string;
20
- }
21
- /**
22
- * Result of a View request the host may decline (`ui/open-link`, `ui/message`): `{}` on
23
- * success, `{ isError: true }` when the host refused or could not deliver it.
24
- */
25
- export interface McpAppRequestResult {
26
- isError?: boolean;
27
- }
28
- /** Parameters a widget passes to `ui/message`. `role` is always `user` (never trusted from the View). */
29
- export interface McpAppMessageParams {
30
- /** The View's MCP content blocks, unvalidated. */
31
- content: unknown[];
32
- role: 'user';
33
- }
34
- /** Parameters a widget passes to `ui/update-model-context` (no widget identity). */
35
- export type McpAppUpdateModelContextParams = Omit<McpModelContextUpdateParams, 'toolCallId'>;
36
- /** Parameters a widget passes to `ui/request-display-mode`. */
37
- export interface McpAppRequestDisplayModeParams {
38
- mode: McpAppDisplayMode;
39
- /** Modes the View declared in `ui/initialize` (`appCapabilities.availableDisplayModes`). */
40
- appDisplayModes: McpAppDisplayMode[];
41
- }
42
- /** Result the host returns for a display-mode request — echoes the mode actually set. */
43
- export interface McpAppRequestDisplayModeResult {
44
- mode: McpAppDisplayMode;
45
- }
46
- /** Payload for a widget `notifications/message` (logging). */
47
- export interface McpAppLoggingMessage {
48
- level: string;
49
- data?: unknown;
50
- logger?: string;
51
- }
52
- /** Payload for a widget `size-changed` notification. */
53
- export interface McpAppSizeChange {
54
- width?: number;
55
- height: number;
56
- }
57
- /**
58
- * Config for the `ui/initialize` handshake and injecting the resource into the sandbox.
59
- *
60
- * The controller owns the outer sandbox iframe DOM (setting `src` with the `?csp=` query
61
- * param, JSON of the declared CSP domain lists that the sandbox origin turns into the CSP
62
- * header, + the outer `allow` attribute); it hands the bridge the loaded iframe's
63
- * `contentWindow` so the bridge can scope its transport to that window and drive the
64
- * `sandbox-proxy-ready` → `sandbox-resource-ready` → `initialized` handshake. All fields
65
- * are bridge-agnostic (no ext-apps types leak through this surface).
66
- */
67
- export interface McpAppBridgeConnectConfig {
68
- /** The loaded outer sandbox proxy iframe's window; the bridge scopes its transport here. */
69
- sandboxWindow: Window;
70
- /** Origin of the sandbox proxy; only messages from it are accepted and all posts target it. */
71
- sandboxOrigin: string;
72
- /** The complete standalone app HTML to inject into the inner sandboxed frame. */
73
- html: string;
74
- /** Initial host context sent to the widget on `ui/initialize`. */
75
- hostContext: McpAppHostContext;
76
- /** Iframe permission policy forwarded to the inner frame via `sandbox-resource-ready`. */
77
- permissions?: McpAppResourcePermissions;
78
- /** Optional override for the inner iframe's `sandbox` attribute. */
79
- sandbox?: string;
80
- /** Advertised to the View in the `ui/initialize` result. */
81
- hostCapabilities: McpAppHostCapabilities;
82
- }
83
- export interface IMcpAppBridge {
84
- /**
85
- * Connect to the loaded sandbox proxy: perform the `ui/initialize` handshake and send
86
- * the resource in via `sandbox-resource-ready`. Resolves once the widget has sent
87
- * `initialized`. The host MUST NOT send tool input before this resolves.
88
- */
89
- connect(config: McpAppBridgeConnectConfig): Promise<void>;
90
- /** Streaming partial tool arguments (each args delta). */
91
- sendToolInputPartial(args: Record<string, unknown>): void;
92
- /** Final, complete tool arguments (args complete). */
93
- sendToolInput(args: Record<string, unknown>): void;
94
- /** The final tool result, built from the raw MCP result + structured content. */
95
- sendToolResult(result: McpAppViewToolResult): void;
96
- /** Notify the widget its tool call was cancelled. */
97
- sendToolCancelled(reason?: string): void;
98
- /**
99
- * Push an updated host context (e.g. theme or container-size change). Before the View
100
- * is initialized the change is held and returned from `ui/initialize` / flushed on
101
- * `initialized` instead of being sent.
102
- */
103
- sendHostContextChange(hostContext: McpAppHostContext): void;
104
- /** Notify the widget it is being torn down (`ui/resource-teardown`) and release the bridge without waiting for the ack. */
105
- sendTeardown(): void;
106
- /** Widget forwarded a `tools/call` to the server. Rejections become JSON-RPC errors. */
107
- oncalltool?: (params: McpAppToolCallRequest) => Promise<unknown>;
108
- /** Widget forwarded a `resources/read` to the server. Rejections become JSON-RPC errors. */
109
- onreadresource?: (params: McpAppResourceReadRequest) => Promise<unknown>;
110
- /** Widget requested opening an external link. Absent → `{ isError: true }`. */
111
- onopenlink?: (params: McpAppOpenLinkParams) => Promise<McpAppRequestResult>;
112
- /** Widget sent a chat message (`ui/message`). Absent → `{ isError: true }`. */
113
- onmessage?: (params: McpAppMessageParams) => Promise<McpAppRequestResult>;
114
- /** Widget emitted a logging message (`notifications/message`). */
115
- onloggingmessage?: (params: McpAppLoggingMessage) => void;
116
- /** Widget reported a size change. */
117
- onsizechange?: (params: McpAppSizeChange) => void;
118
- /** Widget requested a display-mode change; the host echoes the resulting mode. */
119
- onrequestdisplaymode?: (params: McpAppRequestDisplayModeParams) => Promise<McpAppRequestDisplayModeResult>;
120
- /** Widget requested a silent model-context update. */
121
- onupdatemodelcontext?: (params: McpAppUpdateModelContextParams) => Promise<void>;
122
- /** Widget asked the host to tear it down (`ui/notifications/request-teardown`). */
123
- onrequestteardown?: () => void;
124
- }
@@ -1,41 +0,0 @@
1
- import { McpAppHostContext } from '../../ai-chatbot';
2
- import { IMcpAppBridge, McpAppBridgeConnectConfig, McpAppViewToolResult } from './mcp-app-bridge-types.js';
3
- /**
4
- * Hand-rolled, zero-dependency {@link IMcpAppBridge}. A `postMessage` listener speaking
5
- * JSON-RPC 2.0 directly: no SDK, no zod, no schema validation. The cross-origin sandbox
6
- * iframe is the security boundary here, not message-schema checking — every inbound
7
- * field is narrowed defensively before use.
8
- *
9
- * Drives the handshake against the sandbox proxy (`packages/ai/sandbox/sandbox.js`):
10
- * `sandbox-proxy-ready` -> `sandbox-resource-ready` -> `ui/initialize` ->
11
- * `ui/notifications/initialized`, then streaming `ui/notifications/*`. Forwards
12
- * non-`ui/` methods (`tools/call`, `resources/read`) to the same handler slots the
13
- * interface defines.
14
- */
15
- export declare class McpAppBridge implements IMcpAppBridge {
16
- #private;
17
- oncalltool?: IMcpAppBridge['oncalltool'];
18
- onreadresource?: IMcpAppBridge['onreadresource'];
19
- onopenlink?: IMcpAppBridge['onopenlink'];
20
- onmessage?: IMcpAppBridge['onmessage'];
21
- onloggingmessage?: IMcpAppBridge['onloggingmessage'];
22
- onsizechange?: IMcpAppBridge['onsizechange'];
23
- onrequestdisplaymode?: IMcpAppBridge['onrequestdisplaymode'];
24
- onupdatemodelcontext?: IMcpAppBridge['onupdatemodelcontext'];
25
- onrequestteardown?: IMcpAppBridge['onrequestteardown'];
26
- constructor(hostInfo: {
27
- name: string;
28
- version: string;
29
- });
30
- connect(config: McpAppBridgeConnectConfig): Promise<void>;
31
- sendToolInputPartial(args: Record<string, unknown>): void;
32
- sendToolInput(args: Record<string, unknown>): void;
33
- sendToolResult(result: McpAppViewToolResult): void;
34
- sendToolCancelled(reason?: string): void;
35
- sendHostContextChange(hostContext: McpAppHostContext): void;
36
- /**
37
- * Send `ui/resource-teardown` and dispose immediately; the host doesn't wait for the ack,
38
- * so the iframe is removed right away. A View that never initialized isn't messaged.
39
- */
40
- sendTeardown(): void;
41
- }
@@ -1,293 +0,0 @@
1
- const PROTOCOL_VERSION = "2026-01-26";
2
- const METHOD_NOT_FOUND = -32601;
3
- const INVALID_PARAMS = -32602;
4
- const SERVER_ERROR = -32e3;
5
- const DISPLAY_MODES = ["inline", "fullscreen", "pip"];
6
- class JsonRpcError extends Error {
7
- constructor(config) {
8
- super(config.message);
9
- this.code = config.code;
10
- }
11
- }
12
- function invalidParams(message) {
13
- return new JsonRpcError({ code: INVALID_PARAMS, message });
14
- }
15
- function methodNotFound(method) {
16
- return new JsonRpcError({ code: METHOD_NOT_FOUND, message: `Method not found: ${method}` });
17
- }
18
- function asParams(params) {
19
- if (params === void 0 || params === null) {
20
- return {};
21
- }
22
- if (typeof params !== "object" || Array.isArray(params)) {
23
- throw invalidParams("params must be an object");
24
- }
25
- return params;
26
- }
27
- function asJsonRpc(data) {
28
- if (!data || typeof data !== "object") {
29
- return null;
30
- }
31
- const payload = data;
32
- return payload.jsonrpc === "2.0" ? payload : null;
33
- }
34
- function asDisplayModes(value) {
35
- return Array.isArray(value) ? DISPLAY_MODES.filter((mode) => value.includes(mode)) : [];
36
- }
37
- class McpAppBridge {
38
- #hostInfo;
39
- #capabilities = {};
40
- #phase = "idle";
41
- #sandboxWindow = null;
42
- #sandboxOrigin = "";
43
- #hostContext = { theme: "light" };
44
- /** The host context the View last received (in the `ui/initialize` result or a change notification). */
45
- #deliveredHostContext = null;
46
- #appDisplayModes = [];
47
- #nextId = 1;
48
- #pending = /* @__PURE__ */ new Map();
49
- #resolveProxyReady;
50
- #initialized = null;
51
- #resolveInitialized;
52
- constructor(hostInfo) {
53
- this.#hostInfo = hostInfo;
54
- }
55
- connect(config) {
56
- if (this.#phase !== "idle") {
57
- throw new Error("Bridge has already been connected; create a new bridge per widget.");
58
- }
59
- this.#phase = "connecting";
60
- this.#capabilities = config.hostCapabilities;
61
- this.#hostContext = config.hostContext;
62
- this.#sandboxWindow = config.sandboxWindow;
63
- this.#sandboxOrigin = config.sandboxOrigin;
64
- window.addEventListener("message", this.#handleMessage);
65
- const proxyReady = new Promise((resolve) => {
66
- this.#resolveProxyReady = resolve;
67
- });
68
- this.#initialized = new Promise((resolve) => {
69
- this.#resolveInitialized = resolve;
70
- }).then(() => {
71
- this.#phase = "ready";
72
- this.#flushHostContext();
73
- });
74
- return proxyReady.then(
75
- () => this.#sendNotification("ui/notifications/sandbox-resource-ready", {
76
- html: config.html,
77
- permissions: config.permissions,
78
- sandbox: config.sandbox
79
- })
80
- ).then(() => this.#initialized);
81
- }
82
- sendToolInputPartial(args) {
83
- this.#sendNotification("ui/notifications/tool-input-partial", { arguments: args });
84
- }
85
- sendToolInput(args) {
86
- this.#sendNotification("ui/notifications/tool-input", { arguments: args });
87
- }
88
- sendToolResult(result) {
89
- this.#sendNotification("ui/notifications/tool-result", result);
90
- }
91
- sendToolCancelled(reason) {
92
- this.#sendNotification("ui/notifications/tool-cancelled", { reason: reason ?? "cancelled" });
93
- }
94
- sendHostContextChange(hostContext) {
95
- this.#hostContext = hostContext;
96
- if (this.#phase === "ready") {
97
- this.#flushHostContext();
98
- }
99
- }
100
- /**
101
- * Send `ui/resource-teardown` and dispose immediately; the host doesn't wait for the ack,
102
- * so the iframe is removed right away. A View that never initialized isn't messaged.
103
- */
104
- sendTeardown() {
105
- if (this.#phase === "ready") {
106
- this.#sendRequest("ui/resource-teardown", {}).catch(() => void 0);
107
- }
108
- this.#dispose();
109
- }
110
- #flushHostContext() {
111
- if (this.#hostContext === this.#deliveredHostContext) {
112
- return;
113
- }
114
- this.#deliveredHostContext = this.#hostContext;
115
- this.#sendNotification("ui/notifications/host-context-changed", this.#hostContext);
116
- }
117
- /** Release the `message` listener + reject any in-flight requests. Idempotent. */
118
- #dispose() {
119
- this.#phase = "disposed";
120
- window.removeEventListener("message", this.#handleMessage);
121
- for (const pending of this.#pending.values()) {
122
- pending.reject(new Error("Bridge disposed"));
123
- }
124
- this.#pending.clear();
125
- this.#sandboxWindow = null;
126
- }
127
- #handleMessage = (event) => {
128
- if (event.source !== this.#sandboxWindow || event.origin !== this.#sandboxOrigin) {
129
- return;
130
- }
131
- const payload = asJsonRpc(event.data);
132
- if (!payload || typeof payload.method !== "string") {
133
- if (payload && payload.id !== void 0) {
134
- this.#handleResponse(payload);
135
- } else if (payload) {
136
- console.warn("[forge-ai-mcp-app] Ignoring malformed JSON-RPC message", event.data);
137
- }
138
- return;
139
- }
140
- if (payload.id !== void 0) {
141
- void this.#handleRequest(payload.method, payload.params, payload.id);
142
- } else {
143
- this.#handleNotification(payload.method, payload.params);
144
- }
145
- };
146
- #handleResponse(payload) {
147
- const id = payload.id;
148
- const pending = this.#pending.get(id);
149
- if (!pending) {
150
- return;
151
- }
152
- this.#pending.delete(id);
153
- if (payload.error) {
154
- pending.reject(new Error(payload.error.message));
155
- } else {
156
- pending.resolve(payload.result);
157
- }
158
- }
159
- async #handleRequest(method, params, id) {
160
- try {
161
- const result = await this.#dispatchRequest(method, params);
162
- this.#post({ jsonrpc: "2.0", id, result: result ?? {} });
163
- } catch (error) {
164
- this.#post({
165
- jsonrpc: "2.0",
166
- id,
167
- error: {
168
- code: error instanceof JsonRpcError ? error.code : SERVER_ERROR,
169
- message: error instanceof Error ? error.message : "Request failed"
170
- }
171
- });
172
- }
173
- }
174
- /** Unknown or unadvertised methods (`tools/list`, `sampling/createMessage`, `ui/download-file`, …) reject with -32601. */
175
- async #dispatchRequest(method, params) {
176
- const p = asParams(params);
177
- switch (method) {
178
- case "ui/initialize": {
179
- const appCapabilities = p.appCapabilities ?? {};
180
- this.#appDisplayModes = asDisplayModes(appCapabilities.availableDisplayModes);
181
- this.#deliveredHostContext = this.#hostContext;
182
- return {
183
- protocolVersion: PROTOCOL_VERSION,
184
- hostInfo: this.#hostInfo,
185
- hostCapabilities: this.#capabilities,
186
- hostContext: this.#hostContext
187
- };
188
- }
189
- case "ui/open-link":
190
- if (typeof p.url !== "string") {
191
- throw invalidParams("ui/open-link requires a string url");
192
- }
193
- return await this.onopenlink?.({ url: p.url }) ?? { isError: true };
194
- case "ui/message":
195
- if (!Array.isArray(p.content)) {
196
- throw invalidParams("ui/message requires a content array");
197
- }
198
- return await this.onmessage?.({ content: p.content, role: "user" }) ?? { isError: true };
199
- case "ui/update-model-context":
200
- await this.onupdatemodelcontext?.({
201
- content: Array.isArray(p.content) ? p.content : void 0,
202
- structuredContent: p.structuredContent
203
- });
204
- return {};
205
- case "ui/request-display-mode": {
206
- const current = this.#hostContext.displayMode ?? "inline";
207
- const [mode] = asDisplayModes([p.mode]);
208
- if (!mode || !this.onrequestdisplaymode) {
209
- return { mode: current };
210
- }
211
- return this.onrequestdisplaymode({ mode, appDisplayModes: this.#appDisplayModes });
212
- }
213
- case "ui/resource-teardown":
214
- case "ping":
215
- return {};
216
- case "tools/call":
217
- if (!this.oncalltool || !this.#capabilities.serverTools) {
218
- throw methodNotFound(method);
219
- }
220
- this.#assertReady(method);
221
- if (typeof p.name !== "string" || !p.name) {
222
- throw invalidParams("tools/call requires a tool name");
223
- }
224
- return this.oncalltool({ name: p.name, arguments: asParams(p.arguments) });
225
- case "resources/read":
226
- if (!this.onreadresource) {
227
- throw methodNotFound(method);
228
- }
229
- this.#assertReady(method);
230
- if (typeof p.uri !== "string" || !p.uri) {
231
- throw invalidParams("resources/read requires a uri");
232
- }
233
- return this.onreadresource({ uri: p.uri });
234
- default:
235
- throw methodNotFound(method);
236
- }
237
- }
238
- /** Server-bound requests reach the adapter only after the View completes the handshake. */
239
- #assertReady(method) {
240
- if (this.#phase !== "ready") {
241
- throw new JsonRpcError({
242
- code: SERVER_ERROR,
243
- message: `${method} is not allowed before ui/notifications/initialized`
244
- });
245
- }
246
- }
247
- #handleNotification(method, params) {
248
- const p = params && typeof params === "object" ? params : {};
249
- switch (method) {
250
- case "ui/notifications/sandbox-proxy-ready":
251
- this.#resolveProxyReady?.();
252
- return;
253
- case "ui/notifications/initialized":
254
- this.#resolveInitialized?.();
255
- return;
256
- case "ui/notifications/size-changed":
257
- this.onsizechange?.({
258
- width: typeof p.width === "number" ? p.width : void 0,
259
- height: typeof p.height === "number" ? p.height : 0
260
- });
261
- return;
262
- case "notifications/message":
263
- this.onloggingmessage?.({
264
- level: typeof p.level === "string" ? p.level : "info",
265
- logger: typeof p.logger === "string" ? p.logger : void 0,
266
- data: p.data
267
- });
268
- return;
269
- case "ui/notifications/request-teardown":
270
- this.onrequestteardown?.();
271
- return;
272
- default:
273
- console.warn(`[forge-ai-mcp-app] Unhandled notification method: ${method}`);
274
- return;
275
- }
276
- }
277
- #sendNotification(method, params) {
278
- this.#post({ jsonrpc: "2.0", method, params });
279
- }
280
- #sendRequest(method, params) {
281
- const id = this.#nextId++;
282
- return new Promise((resolve, reject) => {
283
- this.#pending.set(id, { resolve, reject });
284
- this.#post({ jsonrpc: "2.0", id, method, params });
285
- });
286
- }
287
- #post(data) {
288
- this.#sandboxWindow?.postMessage(data, this.#sandboxOrigin);
289
- }
290
- }
291
- export {
292
- McpAppBridge
293
- };