@kitn.ai/ui 0.16.0 → 0.18.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 (493) hide show
  1. package/README.md +55 -17
  2. package/dist/components/artifact.d.ts +39 -1
  3. package/dist/components/attachment-types.d.ts +12 -0
  4. package/dist/components/attachments.d.ts +2 -10
  5. package/dist/components/card.d.ts +27 -0
  6. package/dist/components/chain-of-thought.d.ts +78 -2
  7. package/dist/components/chat-scope-picker.d.ts +7 -0
  8. package/dist/components/chat-thread.d.ts +39 -16
  9. package/dist/components/choice-card.d.ts +27 -0
  10. package/dist/components/coachmark.d.ts +49 -0
  11. package/dist/components/composer-dom.d.ts +35 -0
  12. package/dist/components/composer-highlight.d.ts +48 -0
  13. package/dist/components/composer-history.d.ts +34 -0
  14. package/dist/components/composer.d.ts +86 -0
  15. package/dist/components/confirm-card.d.ts +17 -0
  16. package/dist/components/conversation-item.d.ts +9 -0
  17. package/dist/components/conversation-list.d.ts +36 -1
  18. package/dist/components/dismissed-stub.d.ts +22 -0
  19. package/dist/components/file-tree.d.ts +15 -0
  20. package/dist/components/form.d.ts +34 -0
  21. package/dist/components/markdown.d.ts +3 -0
  22. package/dist/components/message.d.ts +71 -2
  23. package/dist/components/model-switcher.d.ts +7 -0
  24. package/dist/components/prompt-input.d.ts +13 -4
  25. package/dist/components/prompt-suggestion.d.ts +9 -1
  26. package/dist/components/reasoning.d.ts +14 -1
  27. package/dist/components/response-compare-types.d.ts +66 -0
  28. package/dist/components/response-compare.d.ts +65 -0
  29. package/dist/components/screen.d.ts +46 -0
  30. package/dist/components/tasks-card.d.ts +50 -1
  31. package/dist/components/toast.d.ts +58 -0
  32. package/dist/components/tool-types.d.ts +10 -0
  33. package/dist/components/tool.d.ts +8 -8
  34. package/dist/components/use-card-resolution.d.ts +10 -6
  35. package/dist/components/voice-input.d.ts +27 -0
  36. package/dist/components/voice-output.d.ts +33 -0
  37. package/dist/core-C8fzo39E.js +12 -0
  38. package/dist/custom-elements.json +8472 -1691
  39. package/dist/elements/agent-card.d.ts +1 -0
  40. package/dist/elements/agent-card.js +1 -0
  41. package/dist/elements/artifact.js +1 -0
  42. package/dist/elements/attachments.js +1 -0
  43. package/dist/elements/autoloader.d.ts +2 -0
  44. package/dist/elements/autoloader.js +1 -0
  45. package/dist/elements/avatar.d.ts +1 -0
  46. package/dist/elements/avatar.js +1 -0
  47. package/dist/elements/badge.d.ts +1 -0
  48. package/dist/elements/badge.js +1 -0
  49. package/dist/elements/button.d.ts +1 -0
  50. package/dist/elements/button.js +1 -0
  51. package/dist/elements/card.js +1 -0
  52. package/dist/elements/cards.d.ts +1 -0
  53. package/dist/elements/cards.js +1 -0
  54. package/dist/elements/chain-of-thought.d.ts +0 -12
  55. package/dist/elements/chain-of-thought.js +1 -0
  56. package/dist/elements/chat-scope-picker.js +1 -0
  57. package/dist/elements/chat-types.d.ts +8 -2
  58. package/dist/elements/chat-workspace.js +1 -0
  59. package/dist/elements/chat.js +1 -0
  60. package/dist/elements/checkpoint.js +1 -0
  61. package/dist/elements/choice.js +1 -0
  62. package/dist/elements/chunks/Icon-DLLBeLG5.js +1 -0
  63. package/dist/elements/chunks/action-icons-UB4V5FNq.js +1 -0
  64. package/dist/elements/chunks/arrow-left-C-gwlUmx.js +1 -0
  65. package/dist/elements/chunks/attachments-CgbErf1r.js +1 -0
  66. package/dist/elements/chunks/badge-DTQpgB6N.js +1 -0
  67. package/dist/elements/chunks/bash-InADTalH.js +1 -0
  68. package/dist/elements/chunks/button-XDUM6lXs.js +1 -0
  69. package/dist/elements/chunks/card-CBlFZ-7I.js +1 -0
  70. package/dist/elements/chunks/card-routing-C986KuUA.js +1 -0
  71. package/dist/elements/chunks/chat-thread-BIhmqwNL.js +1 -0
  72. package/dist/elements/chunks/check-hGUoVIKb.js +1 -0
  73. package/dist/elements/chunks/chevron-down-DDoaSUtO.js +1 -0
  74. package/dist/elements/chunks/chevron-right-CdGEUakB.js +1 -0
  75. package/dist/elements/chunks/circle-BKAZdmzb.js +1 -0
  76. package/dist/elements/chunks/circle-check-CmYG-y3I.js +1 -0
  77. package/dist/elements/chunks/circle-x-DewgAEym.js +1 -0
  78. package/dist/elements/chunks/cn-CU7UAWzk.js +1 -0
  79. package/dist/elements/chunks/code-block-DedwxwFI.js +1 -0
  80. package/dist/elements/chunks/collapsible-FfgmTHtM.js +1 -0
  81. package/dist/elements/chunks/composer-Cfbw5HKT.js +65 -0
  82. package/dist/elements/chunks/context-DwJmxlRE.js +1 -0
  83. package/dist/elements/chunks/conversation-list-DsCQMfPq.js +1 -0
  84. package/dist/elements/chunks/core-AYMC6_lb.js +12 -0
  85. package/dist/elements/chunks/css-M7EaDHN_.js +1 -0
  86. package/dist/elements/chunks/default-input-BuqsoENC.js +1 -0
  87. package/dist/elements/chunks/define-rGsaWsLL.js +1 -0
  88. package/dist/elements/chunks/disclosure-CwoAkpMH.js +1 -0
  89. package/dist/elements/chunks/download-DJ06G3Bz.js +1 -0
  90. package/dist/elements/chunks/dropdown-BFg8ri_R.js +1 -0
  91. package/dist/elements/chunks/ellipsis-dlN6YvGw.js +1 -0
  92. package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +141 -0
  93. package/dist/elements/chunks/external-link-DBX2lc_R.js +1 -0
  94. package/dist/elements/chunks/file-text-HfwUx4F9.js +1 -0
  95. package/dist/elements/chunks/file-tree-C6Toj71u.js +1 -0
  96. package/dist/elements/chunks/folder-MYuqa9Xp.js +1 -0
  97. package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +1 -0
  98. package/dist/elements/chunks/github-light-JYsPkUQd.js +1 -0
  99. package/dist/elements/chunks/hover-card-gE7iyXdW.js +1 -0
  100. package/dist/elements/chunks/html-CPZ3oZQ7.js +1 -0
  101. package/dist/elements/chunks/icon-Vqz4ivrY.js +1 -0
  102. package/dist/elements/chunks/index-BCRhi84a.js +1 -0
  103. package/dist/elements/chunks/info-B_toFS0l.js +1 -0
  104. package/dist/elements/chunks/input-gzbHYZvQ.js +1 -0
  105. package/dist/elements/chunks/javascript-C25yR2R2.js +1 -0
  106. package/dist/elements/chunks/json-DxJze_jm.js +1 -0
  107. package/dist/elements/chunks/kbd-n49c4KZm.js +1 -0
  108. package/dist/elements/chunks/link-CKPs9yM0.js +1 -0
  109. package/dist/elements/chunks/loader-q6MamGus.js +1 -0
  110. package/dist/elements/chunks/markdown-DBrcqq4S.js +64 -0
  111. package/dist/elements/chunks/message-CTqaYI0s.js +1 -0
  112. package/dist/elements/chunks/message-feedback-Cvzm03w0.js +1 -0
  113. package/dist/elements/chunks/message-square-CUg9eRCi.js +1 -0
  114. package/dist/elements/chunks/minimize-2-l2klxP6K.js +1 -0
  115. package/dist/elements/chunks/model-switcher-CmyjiHO1.js +1 -0
  116. package/dist/elements/chunks/overlay-C8sOYqjT.js +1 -0
  117. package/dist/elements/chunks/paperclip-42Ia7xHD.js +1 -0
  118. package/dist/elements/chunks/progress-bar-tzKMWAwO.js +1 -0
  119. package/dist/elements/chunks/prompt-suggestion-D3F6vP_A.js +1 -0
  120. package/dist/elements/chunks/reasoning-BJNmmyov.js +1 -0
  121. package/dist/elements/chunks/resizable-BRsk19qI.js +1 -0
  122. package/dist/elements/chunks/rotate-cw-BgcggLHC.js +1 -0
  123. package/dist/elements/chunks/scroll-area-CgGbFFbT.js +1 -0
  124. package/dist/elements/chunks/separator-8hM4GdHE.js +1 -0
  125. package/dist/elements/chunks/settings-CaUIYOg-.js +1 -0
  126. package/dist/elements/chunks/settings-group-CYjOVIZQ.js +1 -0
  127. package/dist/elements/chunks/share-BTYM3Ddt.js +1 -0
  128. package/dist/elements/chunks/skeleton-DsTYrPUe.js +1 -0
  129. package/dist/elements/chunks/slots-DkZ-Cmha.js +1 -0
  130. package/dist/elements/chunks/star-9R3LBQ9n.js +1 -0
  131. package/dist/elements/chunks/store-CYl5Y0_u.js +1 -0
  132. package/dist/elements/chunks/svelte--5p79yCD.js +1 -0
  133. package/dist/elements/chunks/text-shimmer-CaYGv8Se.js +1 -0
  134. package/dist/elements/chunks/textarea-NEr2SLcD.js +1 -0
  135. package/dist/elements/chunks/thumbs-up-DZYZkFfc.js +1 -0
  136. package/dist/elements/chunks/toast-store-ClxVZRcc.js +1 -0
  137. package/dist/elements/chunks/tool-CHZOmoe9.js +1 -0
  138. package/dist/elements/chunks/tooltip-WpHElELC.js +1 -0
  139. package/dist/elements/chunks/triangle-alert-BlS80PUg.js +1 -0
  140. package/dist/elements/chunks/tsx-B8rCNbgL.js +1 -0
  141. package/dist/elements/chunks/typescript-RycA9KXf.js +1 -0
  142. package/dist/elements/chunks/use-card-resolution-VSVoxDeJ.js +1 -0
  143. package/dist/elements/chunks/video-DxTPZqT8.js +1 -0
  144. package/dist/elements/chunks/vue-BmIZj4XD.js +1 -0
  145. package/dist/elements/chunks/x-C1qtndxn.js +1 -0
  146. package/dist/elements/coachmark.d.ts +1 -0
  147. package/dist/elements/coachmark.js +1 -0
  148. package/dist/elements/code-block.js +1 -0
  149. package/dist/elements/command.d.ts +1 -0
  150. package/dist/elements/command.js +1 -0
  151. package/dist/elements/compare.d.ts +1 -0
  152. package/dist/elements/compare.js +1 -0
  153. package/dist/elements/composer.d.ts +1 -0
  154. package/dist/elements/composer.js +1 -0
  155. package/dist/elements/confirm-card.js +1 -0
  156. package/dist/elements/context-meter.js +1 -0
  157. package/dist/elements/conversation-list.d.ts +1 -11
  158. package/dist/elements/conversation-list.js +1 -0
  159. package/dist/elements/default-input.d.ts +20 -9
  160. package/dist/elements/define.d.ts +11 -0
  161. package/dist/elements/dialog.d.ts +1 -0
  162. package/dist/elements/dialog.js +1 -0
  163. package/dist/elements/disclosure.d.ts +37 -0
  164. package/dist/elements/editable-label.d.ts +1 -0
  165. package/dist/elements/editable-label.js +1 -0
  166. package/dist/elements/embed.js +1 -0
  167. package/dist/elements/empty.js +1 -0
  168. package/dist/elements/feedback-bar.js +1 -0
  169. package/dist/elements/file-tree.js +1 -0
  170. package/dist/elements/file-upload.js +1 -0
  171. package/dist/elements/form.js +1 -0
  172. package/dist/elements/hover-card.d.ts +1 -0
  173. package/dist/elements/hover-card.js +1 -0
  174. package/dist/elements/icon.d.ts +1 -0
  175. package/dist/elements/icon.js +1 -0
  176. package/dist/elements/image.js +1 -0
  177. package/dist/elements/input.d.ts +1 -0
  178. package/dist/elements/input.js +1 -0
  179. package/dist/elements/kbd.d.ts +1 -0
  180. package/dist/elements/kbd.js +1 -0
  181. package/dist/elements/link-preview.js +1 -0
  182. package/dist/elements/loader.js +1 -0
  183. package/dist/elements/markdown.js +1 -0
  184. package/dist/elements/menu.d.ts +1 -0
  185. package/dist/elements/menu.js +1 -0
  186. package/dist/elements/message-skills.d.ts +0 -16
  187. package/dist/elements/message-skills.js +1 -0
  188. package/dist/elements/message.js +1 -0
  189. package/dist/elements/model-switcher.d.ts +1 -11
  190. package/dist/elements/model-switcher.js +1 -0
  191. package/dist/elements/nav.d.ts +1 -0
  192. package/dist/elements/nav.js +1 -0
  193. package/dist/elements/notice.d.ts +1 -0
  194. package/dist/elements/notice.js +1 -0
  195. package/dist/elements/pane-group.d.ts +1 -0
  196. package/dist/elements/pane-group.js +1 -0
  197. package/dist/elements/pane.d.ts +1 -0
  198. package/dist/elements/pane.js +1 -0
  199. package/dist/elements/popover.js +1 -0
  200. package/dist/elements/progress-bar.d.ts +1 -0
  201. package/dist/elements/progress-bar.js +1 -0
  202. package/dist/elements/prompt-dock.d.ts +1 -0
  203. package/dist/elements/prompt-dock.js +1 -0
  204. package/dist/elements/prompt-input.d.ts +1 -9
  205. package/dist/elements/prompt-input.js +1 -0
  206. package/dist/elements/prompt-suggestions.d.ts +0 -6
  207. package/dist/elements/prompt-suggestions.js +1 -0
  208. package/dist/elements/reasoning.js +1 -0
  209. package/dist/elements/register.d.ts +10 -0
  210. package/dist/elements/remote.js +1 -0
  211. package/dist/elements/resizable.d.ts +1 -17
  212. package/dist/elements/resizable.js +1 -0
  213. package/dist/elements/response-stream.js +14 -0
  214. package/dist/elements/screen.d.ts +1 -0
  215. package/dist/elements/screen.js +1 -0
  216. package/dist/elements/scroll-area.d.ts +1 -0
  217. package/dist/elements/scroll-area.js +1 -0
  218. package/dist/elements/scroll-button.js +1 -0
  219. package/dist/elements/search.d.ts +1 -0
  220. package/dist/elements/search.js +1 -0
  221. package/dist/elements/segmented.d.ts +1 -0
  222. package/dist/elements/segmented.js +1 -0
  223. package/dist/elements/separator.d.ts +1 -0
  224. package/dist/elements/separator.js +1 -0
  225. package/dist/elements/setting-item.d.ts +1 -0
  226. package/dist/elements/setting-item.js +1 -0
  227. package/dist/elements/settings-group.d.ts +1 -0
  228. package/dist/elements/settings-group.js +1 -0
  229. package/dist/elements/skeleton.d.ts +1 -0
  230. package/dist/elements/skeleton.js +1 -0
  231. package/dist/elements/slots.d.ts +176 -0
  232. package/dist/elements/source.d.ts +0 -17
  233. package/dist/elements/source.js +1 -0
  234. package/dist/elements/status.d.ts +1 -0
  235. package/dist/elements/status.js +1 -0
  236. package/dist/elements/switch.js +1 -0
  237. package/dist/elements/tabs.d.ts +1 -0
  238. package/dist/elements/tabs.js +1 -0
  239. package/dist/elements/tasks.js +1 -0
  240. package/dist/elements/text-shimmer.js +1 -0
  241. package/dist/elements/thinking-bar.js +1 -0
  242. package/dist/elements/toast.d.ts +1 -0
  243. package/dist/elements/toast.js +1 -0
  244. package/dist/elements/tool.js +1 -0
  245. package/dist/elements/tooltip.d.ts +1 -0
  246. package/dist/elements/tooltip.js +1 -0
  247. package/dist/elements/voice-input.js +1 -0
  248. package/dist/elements/voice-output.d.ts +1 -0
  249. package/dist/elements/voice-output.js +1 -0
  250. package/dist/elements.d.ts +772 -61
  251. package/dist/engine-javascript-C1x7zo1_.js +141 -0
  252. package/dist/index.d.ts +15 -2
  253. package/dist/index.js +14405 -9810
  254. package/dist/kai.es.js +1 -0
  255. package/dist/llms/llms-full.txt +1234 -107
  256. package/dist/llms/llms.txt +4 -4
  257. package/dist/mcp.es.js +217 -6
  258. package/dist/primitives/card-contract.d.ts +20 -4
  259. package/dist/primitives/card-recovery.d.ts +55 -0
  260. package/dist/primitives/composer-model.d.ts +22 -0
  261. package/dist/primitives/composer-triggers.d.ts +19 -0
  262. package/dist/primitives/create-kai-chat.d.ts +38 -0
  263. package/dist/primitives/message-feedback.d.ts +35 -0
  264. package/dist/primitives/toast-store.d.ts +118 -0
  265. package/dist/primitives/use-speech-recognition.d.ts +26 -0
  266. package/dist/react/index.d.ts +1166 -98
  267. package/dist/react/runtime.d.ts +9 -2
  268. package/dist/react/use-kai-chat.d.ts +41 -0
  269. package/dist/react.js +575 -186
  270. package/dist/register-impl-CYWGkgbI.js +141 -0
  271. package/dist/schemas/choice.schema.json +5 -0
  272. package/dist/schemas/tasks.schema.json +7 -2
  273. package/dist/state/index.d.ts +4 -0
  274. package/dist/state/messages.d.ts +11 -0
  275. package/dist/state/stream.d.ts +22 -0
  276. package/dist/state/suggestions.d.ts +4 -0
  277. package/dist/state.js +117 -0
  278. package/dist/theme.tokens.css +87 -0
  279. package/dist/types.d.ts +4 -0
  280. package/dist/ui/agent-card.d.ts +61 -0
  281. package/dist/ui/button.d.ts +5 -2
  282. package/dist/ui/card.d.ts +61 -0
  283. package/dist/ui/collapsible.d.ts +15 -1
  284. package/dist/ui/command.d.ts +33 -0
  285. package/dist/ui/dialog.d.ts +42 -0
  286. package/dist/ui/dropdown.d.ts +95 -1
  287. package/dist/ui/editable-label.d.ts +26 -0
  288. package/dist/ui/hover-card.d.ts +13 -1
  289. package/dist/ui/icon.d.ts +18 -0
  290. package/dist/ui/input.d.ts +33 -0
  291. package/dist/ui/kbd.d.ts +21 -0
  292. package/dist/ui/nav.d.ts +62 -0
  293. package/dist/ui/notice.d.ts +31 -0
  294. package/dist/ui/overlay.d.ts +12 -0
  295. package/dist/ui/pane-grid.d.ts +58 -0
  296. package/dist/ui/pane-group.d.ts +75 -0
  297. package/dist/ui/pane.d.ts +78 -0
  298. package/dist/ui/popover.d.ts +11 -1
  299. package/dist/ui/progress-bar.d.ts +23 -0
  300. package/dist/ui/prompt-dock.d.ts +96 -0
  301. package/dist/ui/resizable.d.ts +12 -0
  302. package/dist/ui/scroll-area.d.ts +4 -0
  303. package/dist/ui/segmented.d.ts +28 -0
  304. package/dist/ui/settings-group.d.ts +32 -0
  305. package/dist/ui/skeleton.d.ts +12 -0
  306. package/dist/ui/stat.d.ts +16 -0
  307. package/dist/ui/status.d.ts +13 -0
  308. package/dist/ui/switch.d.ts +8 -1
  309. package/dist/ui/tabs.d.ts +35 -0
  310. package/dist/ui/tooltip.d.ts +20 -1
  311. package/frameworks/react/index.tsx +1100 -163
  312. package/frameworks/react/runtime.tsx +30 -1
  313. package/frameworks/react/use-kai-chat.tsx +87 -0
  314. package/llms-full.txt +1234 -107
  315. package/llms.txt +4 -4
  316. package/package.json +36 -12
  317. package/src/agent-tooling/mcp/manifest.ts +14 -0
  318. package/src/agent-tooling/mcp/tools/debug.ts +194 -6
  319. package/src/agent-tooling/mcp/tools/reference.ts +32 -0
  320. package/src/agent-tooling/mcp/tools/scaffold.ts +162 -1
  321. package/src/components/artifact.tsx +98 -13
  322. package/src/components/attachment-types.ts +13 -0
  323. package/src/components/attachments.tsx +4 -14
  324. package/src/components/card.tsx +109 -15
  325. package/src/components/chain-of-thought.tsx +210 -1
  326. package/src/components/chat-scope-picker.tsx +13 -3
  327. package/src/components/chat-thread.tsx +238 -137
  328. package/src/components/choice-card.tsx +136 -15
  329. package/src/components/coachmark.tsx +245 -0
  330. package/src/components/component-meta.json +921 -108
  331. package/src/components/composer-dom.ts +159 -0
  332. package/src/components/composer-highlight.ts +242 -0
  333. package/src/components/composer-history.ts +82 -0
  334. package/src/components/composer.tsx +979 -0
  335. package/src/components/confirm-card.tsx +69 -2
  336. package/src/components/conversation-item.tsx +69 -7
  337. package/src/components/conversation-list.tsx +134 -37
  338. package/src/components/dismissed-stub.tsx +80 -0
  339. package/src/components/file-tree.tsx +197 -47
  340. package/src/components/form-widgets.tsx +9 -7
  341. package/src/components/form.tsx +161 -20
  342. package/src/components/image.tsx +3 -5
  343. package/src/components/link-preview.tsx +5 -4
  344. package/src/components/markdown.tsx +5 -2
  345. package/src/components/message.tsx +174 -14
  346. package/src/components/model-switcher.tsx +19 -4
  347. package/src/components/prompt-input.tsx +46 -75
  348. package/src/components/prompt-suggestion.tsx +48 -16
  349. package/src/components/reasoning.tsx +29 -6
  350. package/src/components/response-compare-types.ts +127 -0
  351. package/src/components/response-compare.tsx +460 -0
  352. package/src/components/screen.tsx +176 -0
  353. package/src/components/tasks-card.tsx +374 -23
  354. package/src/components/toast.tsx +486 -0
  355. package/src/components/tool-types.ts +10 -0
  356. package/src/components/tool.tsx +22 -16
  357. package/src/components/use-card-resolution.ts +24 -8
  358. package/src/components/voice-input.tsx +102 -19
  359. package/src/components/voice-output.tsx +202 -0
  360. package/src/elements/agent-card.tsx +67 -0
  361. package/src/elements/artifact.tsx +53 -4
  362. package/src/elements/attachments.tsx +1 -0
  363. package/src/elements/autoloader.ts +89 -0
  364. package/src/elements/avatar.tsx +33 -0
  365. package/src/elements/badge.tsx +32 -0
  366. package/src/elements/button.tsx +126 -0
  367. package/src/elements/card-media.jpg +0 -0
  368. package/src/elements/card.tsx +124 -31
  369. package/src/elements/cards.tsx +81 -7
  370. package/src/elements/chain-of-thought.tsx +77 -32
  371. package/src/elements/chat-scope-picker.tsx +35 -8
  372. package/src/elements/chat-types.ts +9 -2
  373. package/src/elements/chat-workspace.tsx +157 -43
  374. package/src/elements/chat.tsx +49 -25
  375. package/src/elements/choice.tsx +71 -19
  376. package/src/elements/coachmark.tsx +90 -0
  377. package/src/elements/command.tsx +209 -0
  378. package/src/elements/compare.tsx +110 -0
  379. package/src/elements/compiled.css +1 -1
  380. package/src/elements/composer.tsx +151 -0
  381. package/src/elements/confirm-card.tsx +36 -11
  382. package/src/elements/conversation-list.tsx +80 -11
  383. package/src/elements/default-input.tsx +75 -53
  384. package/src/elements/define.tsx +47 -6
  385. package/src/elements/dialog.tsx +98 -0
  386. package/src/elements/disclosure.ts +73 -0
  387. package/src/elements/editable-label.tsx +125 -0
  388. package/src/elements/element-manifest.json +310 -0
  389. package/src/elements/element-meta.json +5954 -1605
  390. package/src/elements/element-types.d.ts +771 -60
  391. package/src/elements/file-tree.tsx +12 -2
  392. package/src/elements/file-upload.tsx +1 -1
  393. package/src/elements/form.tsx +54 -11
  394. package/src/elements/hover-card.tsx +80 -0
  395. package/src/elements/icon-names.json +48 -0
  396. package/src/elements/icon.tsx +41 -0
  397. package/src/elements/input.tsx +203 -0
  398. package/src/elements/kbd.tsx +45 -0
  399. package/src/elements/menu.tsx +217 -0
  400. package/src/elements/message.tsx +84 -55
  401. package/src/elements/model-switcher.tsx +27 -1
  402. package/src/elements/nav.tsx +87 -0
  403. package/src/elements/notice.tsx +53 -0
  404. package/src/elements/pane-group.tsx +119 -0
  405. package/src/elements/pane.tsx +129 -0
  406. package/src/elements/popover.tsx +39 -17
  407. package/src/elements/progress-bar.tsx +39 -0
  408. package/src/elements/prompt-dock.tsx +81 -0
  409. package/src/elements/prompt-input.tsx +112 -63
  410. package/src/elements/prompt-suggestions.tsx +25 -9
  411. package/src/elements/reasoning.tsx +30 -9
  412. package/src/elements/register-impl.ts +41 -3
  413. package/src/elements/register.ts +20 -3
  414. package/src/elements/remote.tsx +4 -0
  415. package/src/elements/resizable.tsx +48 -11
  416. package/src/elements/screen.tsx +90 -0
  417. package/src/elements/scroll-area.tsx +33 -0
  418. package/src/elements/search.tsx +180 -0
  419. package/src/elements/segmented.tsx +135 -0
  420. package/src/elements/separator.tsx +36 -0
  421. package/src/elements/setting-item.tsx +50 -0
  422. package/src/elements/settings-group.tsx +37 -0
  423. package/src/elements/skeleton.tsx +45 -0
  424. package/src/elements/slots.ts +607 -0
  425. package/src/elements/source.tsx +13 -6
  426. package/src/elements/status.tsx +42 -0
  427. package/src/elements/styles.css +19 -0
  428. package/src/elements/switch.tsx +89 -14
  429. package/src/elements/tabs.tsx +95 -0
  430. package/src/elements/tasks.tsx +70 -14
  431. package/src/elements/toast.tsx +89 -0
  432. package/src/elements/tool.tsx +43 -9
  433. package/src/elements/tooltip.tsx +85 -0
  434. package/src/elements/video-poster.jpg +0 -0
  435. package/src/elements/voice-input.tsx +66 -16
  436. package/src/elements/voice-output.tsx +69 -0
  437. package/src/index.ts +35 -2
  438. package/src/primitives/card-contract.ts +14 -5
  439. package/src/primitives/card-recovery.ts +149 -0
  440. package/src/primitives/card-routing.ts +3 -0
  441. package/src/primitives/card-schemas/choice.schema.json +5 -0
  442. package/src/primitives/card-schemas/tasks.schema.json +7 -2
  443. package/src/primitives/composer-model.ts +49 -0
  444. package/src/primitives/composer-triggers.ts +35 -0
  445. package/src/primitives/create-kai-chat.ts +66 -0
  446. package/src/primitives/message-feedback.ts +123 -0
  447. package/src/primitives/toast-store.ts +276 -0
  448. package/src/primitives/use-speech-recognition.ts +135 -0
  449. package/src/state/index.ts +6 -0
  450. package/src/state/messages.ts +36 -0
  451. package/src/state/stream.ts +92 -0
  452. package/src/state/suggestions.ts +9 -0
  453. package/src/types.ts +4 -0
  454. package/src/ui/agent-card.tsx +212 -0
  455. package/src/ui/button.tsx +16 -5
  456. package/src/ui/card.tsx +245 -0
  457. package/src/ui/collapsible.tsx +30 -4
  458. package/src/ui/command.tsx +99 -0
  459. package/src/ui/dialog.tsx +217 -0
  460. package/src/ui/dropdown.tsx +375 -13
  461. package/src/ui/editable-label.tsx +112 -0
  462. package/src/ui/hover-card.tsx +28 -5
  463. package/src/ui/icon.tsx +110 -0
  464. package/src/ui/input.tsx +132 -0
  465. package/src/ui/kbd.tsx +118 -0
  466. package/src/ui/nav.tsx +282 -0
  467. package/src/ui/notice.tsx +84 -0
  468. package/src/ui/overlay.tsx +108 -2
  469. package/src/ui/pane-grid.tsx +116 -0
  470. package/src/ui/pane-group.tsx +280 -0
  471. package/src/ui/pane.tsx +193 -0
  472. package/src/ui/popover.tsx +16 -2
  473. package/src/ui/progress-bar.tsx +83 -0
  474. package/src/ui/prompt-dock.tsx +145 -0
  475. package/src/ui/resizable.tsx +69 -1
  476. package/src/ui/scroll-area.tsx +14 -3
  477. package/src/ui/segmented.tsx +109 -0
  478. package/src/ui/settings-group.tsx +67 -0
  479. package/src/ui/skeleton.tsx +62 -5
  480. package/src/ui/stat.tsx +41 -0
  481. package/src/ui/status.tsx +48 -0
  482. package/src/ui/switch.tsx +49 -23
  483. package/src/ui/tabs.tsx +168 -0
  484. package/src/ui/tooltip.tsx +57 -7
  485. package/theme.css +113 -0
  486. package/dist/components/slash-command.d.ts +0 -15
  487. package/dist/kitn-chat.es.js +0 -1
  488. package/dist/register-impl-wCsFPoh9.js +0 -77
  489. package/dist/register-ujhr1nBS.js +0 -1
  490. package/src/components/slash-command.tsx +0 -232
  491. package/src/elements/framework-usage.json +0 -563
  492. /package/dist/{kitn-chat-provider.d.ts → kai-provider.d.ts} +0 -0
  493. /package/dist/{kitn-chat-provider.es.js → kai-provider.es.js} +0 -0
@@ -2,29 +2,18 @@ import { createEffect, createSignal, onMount, onCleanup } from 'solid-js';
2
2
  import { defineWebComponent } from './define';
3
3
  import { DefaultPromptInput } from './default-input';
4
4
  import type { AttachmentData } from '../components/attachments';
5
- import type { SlashCommandItem } from '../components/slash-command';
6
5
  import type { CustomAction } from './chat-types';
7
-
8
- /** Parse a single light-DOM `<kai-slash-command>` element into a SlashCommandItem.
9
- * Attribute mapping:
10
- * - `command` → SlashCommandItem.id (required; empty string fallback)
11
- * - textContent → SlashCommandItem.label (primary); `label` attr as fallback
12
- * - `description` → SlashCommandItem.description
13
- * - `category` → SlashCommandItem.category
14
- */
15
- export function parseKaiSlashCommandElement(n: Element): SlashCommandItem {
16
- return {
17
- id: n.getAttribute('command') ?? '',
18
- label: n.textContent?.trim() || n.getAttribute('label') || n.getAttribute('command') || '',
19
- description: n.getAttribute('description') ?? undefined,
20
- category: n.getAttribute('category') ?? undefined,
21
- };
22
- }
6
+ import type { TriggerDef, ComposerChange } from '../components/composer';
7
+ import { type ComposerDoc, type EntityRef, normalizeValue, serializeToText, entitiesOf } from '../primitives/composer-model';
23
8
 
24
9
  interface Props extends Record<string, unknown> {
25
- /** Controlled value of the input. When set, the host owns the text and must
26
- * update it on `kai-value-change`; leave unset for uncontrolled behavior. */
27
- value?: string;
10
+ /** Value of the input, as a JS property. A **string** is the controlled text
11
+ * mirror (the host owns it and updates on `kai-value-change`). A **ComposerDoc**
12
+ * (array of text/entity segments) is a one-time **seed** that pre-populates
13
+ * pills (skills/agents/plugins); the user then edits freely. Leave unset for
14
+ * uncontrolled behavior. `kai-submit`/`kai-value-change` always emit `value`
15
+ * as the flattened string (back-compat) plus the structured `doc` + `entities`. */
16
+ value?: string | ComposerDoc;
28
17
  /** Placeholder text shown in the empty input. */
29
18
  placeholder?: string;
30
19
  /** Disable the input and submit button entirely (non-interactive). */
@@ -38,13 +27,6 @@ interface Props extends Record<string, unknown> {
38
27
  /** What clicking a suggestion does: `'submit'` (default) sends it immediately
39
28
  * as if typed and submitted; `'fill'` just places it in the input. */
40
29
  suggestionMode?: 'submit' | 'fill';
41
- /** Slash commands — when set, typing `/` opens the command palette. Set as a
42
- * JS property. */
43
- slashCommands?: SlashCommandItem[];
44
- /** Command ids to highlight as active. */
45
- slashActiveIds?: string[];
46
- /** Single-line palette rows. */
47
- slashCompact?: boolean;
48
30
  /** Show a Search (Globe) button in the left toolbar; clicking it fires a
49
31
  * `search` event. */
50
32
  search?: boolean;
@@ -54,22 +36,45 @@ interface Props extends Record<string, unknown> {
54
36
  /** When set and `loading` is true, the send button is replaced by a Stop
55
37
  * button (square icon, "Stop" aria-label). Clicking it fires `kai-stop`. */
56
38
  stoppable?: boolean;
39
+ /** Send-button visibility. `'always'` (default) always shows it; `'auto'` shows
40
+ * it only when there's text/attachments (an empty composer hides it — Enter
41
+ * still submits). To hide it entirely (Enter-only), it's pure CSS:
42
+ * `::part(send){display:none}` — no prop needed. Restyle via `::part(send)`.
43
+ * The Stop button (`stoppable` + `loading`) is unaffected. */
44
+ submit?: 'always' | 'auto';
45
+ /** When `false`, hides the built-in paperclip attach button even though the
46
+ * element otherwise supports attachments. Use this when a `+` menu in
47
+ * `toolbar-start` already exposes "Add files", to avoid a duplicate control.
48
+ * Defaults to `true`. */
49
+ attach?: boolean;
57
50
  /** Attachments to seed the input with (so a consumer can pre-populate staged
58
51
  * files without an upload). Set as a JS property; the element then manages its
59
52
  * own attachment state from there (add via the paperclip, remove per chip). */
60
53
  attachments?: AttachmentData[];
54
+ /** Rich entity triggers — each `{ char, kind, items }` opens a caret-anchored
55
+ * menu that inserts an atomic pill. Convention: `/` → skills, `@` → agents
56
+ * (plugins are the grouping/provenance of those items). Set as a JS property. */
57
+ triggers?: TriggerDef[];
58
+ /** Default icon per entity kind (kind → image URL/data-URI) for pills/menu items
59
+ * without their own `icon`. Overrides the built-in agent/plugin glyphs. JS property. */
60
+ kindIcons?: Record<string, string>;
61
61
  }
62
62
 
63
63
  /** Events fired by `<kai-prompt-input>`. */
64
64
  interface Events {
65
- /** The user submitted the prompt (Enter or send button) with its attachments. */
66
- 'kai-submit': { value: string; attachments: AttachmentData[] };
67
- /** The input text changed (fires on every keystroke). */
68
- 'kai-value-change': { value: string };
65
+ /** The user submitted the prompt (Enter or send button). `value` is the
66
+ * flattened text (back-compat); `doc` is the structured document and
67
+ * `entities` the inserted pills (skills/agents) for downstream expansion. */
68
+ 'kai-submit': { value: string; doc: ComposerDoc; entities: EntityRef[]; attachments: AttachmentData[] };
69
+ /** The input changed (fires on every edit). Carries the flattened `value`
70
+ * plus the structured `doc` + `entities`. */
71
+ 'kai-value-change': { value: string; doc: ComposerDoc; entities: EntityRef[] };
72
+ /** The staged attachments changed — a file was added (via the paperclip) or
73
+ * removed (per-chip ×). Carries the full current list so a consumer can react
74
+ * in real time (validate, show upload progress, toggle the send button). */
75
+ 'kai-attachments-change': { attachments: AttachmentData[] };
69
76
  /** A suggestion was clicked while `suggestion-mode="fill"`. */
70
77
  'kai-suggestion-click': { value: string };
71
- /** A slash command was chosen from the palette. */
72
- 'kai-slash-select': { command: SlashCommandItem };
73
78
  /** The Search (Globe) toolbar button was clicked. */
74
79
  'kai-search': Record<string, never>;
75
80
  /** The Voice (Mic) toolbar button was clicked. */
@@ -88,15 +93,16 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
88
93
  loading: false,
89
94
  suggestions: undefined,
90
95
  suggestionMode: 'submit',
91
- slashCommands: undefined,
92
- slashActiveIds: undefined,
93
- slashCompact: false,
94
96
  search: false,
95
97
  voice: false,
96
98
  stoppable: false,
99
+ submit: 'always',
100
+ attach: true,
97
101
  attachments: undefined,
98
- }, (props, { dispatch, flag, element }) => {
99
- const [internal, setInternal] = createSignal(props.value ?? '');
102
+ triggers: undefined,
103
+ kindIcons: undefined,
104
+ }, (props, { dispatch, flag, element, expose }) => {
105
+ const [internal, setInternal] = createSignal<string | ComposerDoc>(props.value ?? '');
100
106
  // Seed staged attachments from the `attachments` property; the element manages
101
107
  // its own state from there (paperclip adds, per-chip remove deletes).
102
108
  const [attachments, setAttachments] = createSignal<AttachmentData[]>(props.attachments ?? []);
@@ -106,11 +112,10 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
106
112
  if (props.attachments) setAttachments(props.attachments);
107
113
  });
108
114
 
109
- // Read declarative <kai-action> and <kai-slash-command> children from light DOM —
110
- // same pattern as kai-message. Shadow DOM with no <slot> suppresses them visually;
111
- // they are invisible data carriers. One MutationObserver covers both element types.
115
+ // Read declarative <kai-action> children from light DOM — same pattern as
116
+ // kai-message. Shadow DOM with no <slot> suppresses them visually; they are
117
+ // invisible data carriers.
112
118
  const [toolbarActions, setToolbarActions] = createSignal<CustomAction[]>([]);
113
- const [slottedSlashCommands, setSlottedSlashCommands] = createSignal<SlashCommandItem[]>([]);
114
119
  onMount(() => {
115
120
  const readActions = () => {
116
121
  const nodes = [...element.querySelectorAll('kai-action')];
@@ -121,22 +126,45 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
121
126
  tooltip: n.getAttribute('tooltip') ?? undefined,
122
127
  })));
123
128
  };
124
- const readSlashCommands = () => {
125
- const nodes = [...element.querySelectorAll('kai-slash-command')];
126
- setSlottedSlashCommands(nodes.map(parseKaiSlashCommandElement));
127
- };
128
- const readAll = () => { readActions(); readSlashCommands(); };
129
- readAll();
130
- const observer = new MutationObserver(readAll);
129
+ readActions();
130
+ const observer = new MutationObserver(readActions);
131
131
  observer.observe(element, { childList: true, attributes: true, subtree: true });
132
132
  onCleanup(() => observer.disconnect());
133
133
  });
134
134
 
135
- const current = () => props.value ?? internal();
135
+ // A string `value` is controlled (the host owns it). A ComposerDoc `value` is a
136
+ // one-time seed: it lives in `internal` and the user's edits (which arrive as
137
+ // strings) replace it there, so the seed never fights the edits.
138
+ const current = (): string | ComposerDoc =>
139
+ typeof props.value === 'string' ? props.value : internal();
140
+
141
+ // Latest structured change from the composer (doc + entities). Captured before
142
+ // the string value-change fires (the bridge calls onComposerChange first), so
143
+ // the dispatched events can carry the doc. Reset to a text-only doc when a value
144
+ // is set that didn't come from the composer (e.g. a suggestion fill).
145
+ let lastChange: ComposerChange = { doc: [], text: '', entities: [] };
136
146
 
137
- const handleChange = (v: string) => { setInternal(v); dispatch('kai-value-change', { value: v }); };
147
+ // Seed from a ComposerDoc `value`: push it into `internal` (so `current()`
148
+ // reflects the seed) and into `lastChange` (so a submit-WITHOUT-edit still
149
+ // carries the seeded doc + entities). Re-runs only when `value` is reassigned.
150
+ createEffect(() => {
151
+ const v = props.value;
152
+ if (v != null && typeof v !== 'string') {
153
+ const doc = normalizeValue(v);
154
+ setInternal(doc);
155
+ lastChange = { doc, text: serializeToText(doc), entities: entitiesOf(doc) };
156
+ }
157
+ });
158
+
159
+ const handleChange = (v: string) => {
160
+ setInternal(v);
161
+ if (v !== lastChange.text) lastChange = { doc: normalizeValue(v), text: v, entities: [] };
162
+ dispatch('kai-value-change', { value: v, doc: lastChange.doc, entities: lastChange.entities });
163
+ };
138
164
  const handleSubmit = () => {
139
- dispatch('kai-submit', { value: current(), attachments: attachments() });
165
+ // `value` is always the flattened string (back-compat); a seeded doc is
166
+ // serialized. The structured `doc`/`entities` carry the pills.
167
+ dispatch('kai-submit', { value: serializeToText(normalizeValue(current())), doc: lastChange.doc, entities: lastChange.entities, attachments: attachments() });
140
168
  setAttachments([]);
141
169
  };
142
170
  const handleSuggestionClick = (v: string) => {
@@ -145,16 +173,36 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
145
173
  dispatch('kai-suggestion-click', { value: v });
146
174
  } else {
147
175
  // Default: behave as if the user typed the suggestion and pressed submit.
148
- dispatch('kai-submit', { value: v, attachments: attachments() });
176
+ dispatch('kai-submit', { value: v, doc: normalizeValue(v), entities: [], attachments: attachments() });
149
177
  setAttachments([]);
150
178
  }
151
179
  };
152
180
 
153
- // Prop slash commands take precedence; slotted children are appended after.
154
- const allSlashCommands = () => [
155
- ...(props.slashCommands ?? []),
156
- ...slottedSlashCommands(),
157
- ];
181
+ // ── Imperative API (instance methods on the host) ──────────────────────────
182
+ // The input half of the interaction surface; counterpart to the kai-* events.
183
+ expose({
184
+ /** Focus the text editor inside the shadow root (not the hidden file input). */
185
+ focus: (options?: FocusOptions) => {
186
+ const root = element.shadowRoot;
187
+ const target =
188
+ root?.querySelector<HTMLElement>('[contenteditable]:not([contenteditable="false"]), textarea') ??
189
+ root?.querySelector<HTMLElement>('input:not([type="file"])');
190
+ target?.focus(options);
191
+ },
192
+ /** Blur the focused input control. */
193
+ blur: () =>
194
+ (element.shadowRoot?.activeElement as HTMLElement | null)?.blur(),
195
+ /** Clear the text and any staged attachments (fires kai-value-change /
196
+ * kai-attachments-change so a controlled consumer can react). */
197
+ clear: () => {
198
+ handleChange('');
199
+ if (attachments().length) { setAttachments([]); dispatch('kai-attachments-change', { attachments: [] }); }
200
+ },
201
+ /** Send the current value programmatically — same path as Enter / the send
202
+ * button (fires kai-submit, then clears staged attachments). Named `send`,
203
+ * not `submit`, to avoid colliding with the `submit` prop. */
204
+ send: () => handleSubmit(),
205
+ });
158
206
 
159
207
  return (
160
208
  <DefaultPromptInput
@@ -163,22 +211,23 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
163
211
  disabled={flag('disabled')}
164
212
  loading={flag('loading')}
165
213
  stoppable={flag('stoppable')}
214
+ submit={props.submit as 'always' | 'auto'}
215
+ attach={flag('attach')}
166
216
  suggestions={props.suggestions}
167
217
  attachments={attachments()}
168
- slashCommands={allSlashCommands().length ? allSlashCommands() : undefined}
169
- slashActiveIds={props.slashActiveIds}
170
- slashCompact={flag('slashCompact')}
171
218
  search={flag('search')}
172
219
  voice={flag('voice')}
173
220
  toolbarActions={toolbarActions()}
221
+ triggers={props.triggers}
222
+ kindIcons={props.kindIcons as Record<string, string> | undefined}
223
+ onComposerChange={(c) => { lastChange = c; }}
174
224
  onValueChange={handleChange}
175
225
  onSubmit={handleSubmit}
176
226
  onSuggestionClick={handleSuggestionClick}
177
- onAttachmentsChange={setAttachments}
227
+ onAttachmentsChange={(a) => { setAttachments(a); dispatch('kai-attachments-change', { attachments: a }); }}
178
228
  onSearch={() => dispatch('kai-search')}
179
229
  onVoice={() => dispatch('kai-voice')}
180
230
  onStop={() => dispatch('kai-stop')}
181
- onSlashSelect={(command) => dispatch('kai-slash-select', { command })}
182
231
  onAction={(id) => dispatch('kai-toolbar-action', { action: id })}
183
232
  />
184
233
  );
@@ -2,7 +2,7 @@ import { For, createSignal, onMount, onCleanup } from 'solid-js';
2
2
  import { defineWebComponent } from './define';
3
3
  import { PromptSuggestion } from '../components/prompt-suggestion';
4
4
 
5
- type Item = string | { label: string; value?: string };
5
+ type Item = string | { label: string; value?: string; icon?: string };
6
6
 
7
7
  interface Props extends Record<string, unknown> {
8
8
  /** The suggestions. Strings, or `{ label, value }` when the displayed text
@@ -10,9 +10,13 @@ interface Props extends Record<string, unknown> {
10
10
  suggestions: Item[];
11
11
  /** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
12
12
  variant?: 'outline' | 'ghost' | 'default';
13
- /** Size preset for each chip. Defaults to the pill default (`'lg'`); pass
14
- * `'sm'` for smaller pills (or `'md'`). */
15
- size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
13
+ /** Row height for `layout="list"`: `'md'` (default) or `'lg'` for taller rows.
14
+ * Chips are unaffected. */
15
+ size?: 'md' | 'lg';
16
+ /** Layout: `'chips'` (default) renders a wrapping row of rounded pills;
17
+ * `'list'` renders a vertical, full-width "Ideas for you" list — each row
18
+ * is left-aligned with a leading `icon`, a label, and a hover background. */
19
+ layout?: 'chips' | 'list';
16
20
  /** Full-width left-aligned rows instead of pills. */
17
21
  block?: boolean;
18
22
  /** Substring to highlight within each suggestion. */
@@ -27,18 +31,20 @@ interface Events {
27
31
 
28
32
  const labelOf = (s: Item) => (typeof s === 'string' ? s : s.label);
29
33
  const valueOf = (s: Item) => (typeof s === 'string' ? s : s.value ?? s.label);
34
+ const iconOf = (s: Item) => (typeof s === 'string' ? undefined : s.icon);
30
35
 
31
36
  /** Parse a single `<kai-suggestion>` node into an `Item` descriptor. */
32
37
  export function parseSuggestionNode(n: Element): Item {
33
38
  const text = n.textContent?.trim() ?? '';
34
39
  const value = n.getAttribute('value') ?? text;
35
- return { label: text, value };
40
+ return { label: text, value, icon: n.getAttribute('icon') ?? undefined };
36
41
  }
37
42
 
38
43
  /**
39
44
  * `<kai-suggestions>` — a row/list of suggestion chips. Data via the
40
- * `suggestions` property; `variant`/`block`/`highlight` attributes; emits
41
- * `select`.
45
+ * `suggestions` property; `variant`/`layout`/`block`/`highlight` attributes;
46
+ * emits `select`. `layout="list"` renders the vertical "Ideas for you" list
47
+ * (leading icon + label + hover background) instead of pills.
42
48
  *
43
49
  * Alternatively, declare chips as `<kai-suggestion>` child elements
44
50
  * (light-DOM data carriers — hidden by the Shadow DOM):
@@ -53,7 +59,8 @@ export function parseSuggestionNode(n: Element): Item {
53
59
  defineWebComponent<Props, Events>('kai-suggestions', {
54
60
  suggestions: [],
55
61
  variant: 'outline',
56
- size: undefined,
62
+ size: 'md',
63
+ layout: 'chips',
57
64
  block: false,
58
65
  highlight: undefined,
59
66
  }, (props, { dispatch, flag, element }) => {
@@ -74,14 +81,23 @@ defineWebComponent<Props, Events>('kai-suggestions', {
74
81
  // Merge prop suggestions (first) with declarative children (after).
75
82
  const allSuggestions = () => [...(props.suggestions ?? []), ...slottedSuggestions()];
76
83
 
84
+ const isList = () => props.layout === 'list';
85
+
86
+ const containerClass = () =>
87
+ isList() ? 'flex flex-col gap-0.5'
88
+ : flag('block') ? 'flex flex-col gap-2'
89
+ : 'flex flex-wrap gap-2';
90
+
77
91
  return (
78
- <div class={flag('block') ? 'flex flex-col gap-2' : 'flex flex-wrap gap-2'}>
92
+ <div class={containerClass()}>
79
93
  <For each={allSuggestions()}>
80
94
  {(s) => (
81
95
  <PromptSuggestion
82
96
  variant={props.variant}
83
97
  size={props.size}
98
+ icon={iconOf(s)}
84
99
  block={flag('block')}
100
+ list={isList()}
85
101
  highlight={props.highlight}
86
102
  onClick={() => dispatch('kai-select', { value: valueOf(s) })}
87
103
  >
@@ -1,46 +1,67 @@
1
1
  import { defineWebComponent } from './define';
2
- import { Reasoning, ReasoningTrigger, ReasoningContent } from '../components/reasoning';
2
+ import { Reasoning, ReasoningTrigger, ReasoningContent, type ReasoningController } from '../components/reasoning';
3
3
  import { ChatConfig, useChatConfig } from '../primitives/chat-config';
4
+ import { wireDisclosure } from './disclosure';
4
5
 
5
6
  interface Props extends Record<string, unknown> {
6
7
  /** The reasoning text to display. */
7
8
  text: string;
8
9
  /** Trigger label. */
9
10
  label?: string;
10
- /** Controlled open state set as a property (`el.open = true`). Omit for
11
- * uncontrolled (the trigger toggles it). */
11
+ /** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
12
+ * attribute; the element still self-manages on trigger click + while
13
+ * streaming). Set `el.open = true`; listen for `kai-open-change`. */
12
14
  open?: boolean;
15
+ /** Initial open state on mount (uncontrolled seed). */
16
+ defaultOpen?: boolean;
13
17
  /** While true, auto-expands (and re-collapses when it flips false). */
14
18
  streaming?: boolean;
15
19
  /** Render `text` as markdown. */
16
20
  markdown?: boolean;
21
+ /** Gate the disclosure trigger — programmatic `show()/hide()/toggle()` still
22
+ * work, but the trigger click no longer toggles. */
23
+ disabled?: boolean;
17
24
  }
18
25
 
19
26
  /** Events fired by `<kai-reasoning>`. */
20
27
  interface Events {
21
- /** Open state changed (via the trigger or streaming auto-open). */
28
+ /** The reasoning block expanded or collapsed (via the trigger, streaming
29
+ * auto-open, or a method). */
22
30
  'kai-open-change': { open: boolean };
23
31
  }
24
32
 
25
33
  /**
26
34
  * `<kai-reasoning>` — a collapsible reasoning/thinking block that auto-expands
27
- * while `streaming`. Text via the `text` property; `markdown`/`streaming` flags;
28
- * `open` is a controlled property; emits `kai-open-change`.
35
+ * while `streaming`. Text via the `text` property; `markdown`/`streaming` flags.
36
+ * Open state is the standard disclosure surface: settable+reflecting `open`,
37
+ * `kai-open-change`, and `show()`/`hide()`/`toggle()` (gated by `disabled`);
38
+ * seed with `defaultOpen`.
29
39
  */
30
40
  defineWebComponent<Props, Events>('kai-reasoning', {
31
41
  text: '',
32
42
  label: 'Reasoning',
33
43
  open: undefined,
44
+ defaultOpen: undefined,
34
45
  streaming: false,
35
46
  markdown: true,
36
- }, (props, { dispatch, flag }) => {
47
+ disabled: undefined,
48
+ }, (props, ctx) => {
49
+ const { flag } = ctx;
37
50
  const outer = useChatConfig();
51
+ let api: ReasoningController | undefined;
52
+
53
+ // The standard disclosure surface: settable+reflecting `open`, kai-open-change,
54
+ // show/hide/toggle, disabled-gating. See ./disclosure. This is the SOLE emitter
55
+ // of kai-open-change — we no longer dispatch it from Reasoning's onOpenChange.
56
+ wireDisclosure(ctx, () => api, () => props.open);
57
+
38
58
  return (
39
59
  <ChatConfig portalMount={outer.portalMount()}>
40
60
  <Reasoning
41
- open={props.open}
61
+ defaultOpen={flag('defaultOpen')}
42
62
  isStreaming={flag('streaming')}
43
- onOpenChange={(open) => dispatch('kai-open-change', { open })}
63
+ disabled={flag('disabled')}
64
+ controllerRef={(a) => (api = a)}
44
65
  >
45
66
  <ReasoningTrigger>{props.label}</ReasoningTrigger>
46
67
  <ReasoningContent markdown={flag('markdown')}>{props.text}</ReasoningContent>
@@ -22,9 +22,6 @@ import './context-meter';
22
22
  import './feedback-bar';
23
23
  import './chat-scope-picker';
24
24
  // Phase 3 — input ecosystem
25
- // (NB: SlashCommand is context-bound to PromptInput — it observes the input
26
- // value via usePromptInput() — so it is NOT a standalone element. It will fold
27
- // into <kai-prompt-input> as a `slash-commands` property in a later pass.)
28
25
  import './prompt-suggestions';
29
26
  import './file-upload';
30
27
  import './voice-input';
@@ -37,6 +34,13 @@ import './message-skills';
37
34
  import './source';
38
35
  import './response-stream';
39
36
  import './empty';
37
+ import './status';
38
+ import './nav';
39
+ import './progress-bar';
40
+ import './coachmark';
41
+ import './tabs';
42
+ import './voice-output';
43
+ import './screen';
40
44
  import './chain-of-thought';
41
45
  import './resizable';
42
46
  import './file-tree';
@@ -44,6 +48,17 @@ import './artifact';
44
48
  import './scroll-button';
45
49
  import './popover';
46
50
  import './switch';
51
+ import './button';
52
+ import './avatar';
53
+ import './badge';
54
+ import './tooltip';
55
+ import './notice';
56
+ import './icon';
57
+ import './separator';
58
+ import './scroll-area';
59
+ import './hover-card';
60
+ import './skeleton';
61
+ import './toast';
47
62
  // Generative-UI cards (Card Contract)
48
63
  import './card';
49
64
  import './form';
@@ -53,3 +68,26 @@ import './confirm-card';
53
68
  import './tasks';
54
69
  import './choice';
55
70
  import './cards';
71
+ // Dual-response comparison (preference capture)
72
+ import './compare';
73
+ // Rich text composer with entity pills, trigger menus, and keyword highlighting
74
+ import './composer';
75
+ // W3 phase 2: cascading action menu from a JSON items-tree
76
+ import './menu';
77
+ // W4 phase 1: grouped filterable command/mention palette
78
+ import './command';
79
+ // Prompt dock + settings building blocks (graduated from SolidJS prototypes)
80
+ import './prompt-dock';
81
+ import './segmented';
82
+ import './settings-group';
83
+ import './setting-item';
84
+ // Multi-agent workspace primitives (graduated from SolidJS prototypes)
85
+ import './pane';
86
+ import './pane-group';
87
+ import './agent-card';
88
+ import './dialog';
89
+ // Input & search field family
90
+ import './input';
91
+ import './search';
92
+ import './kbd';
93
+ import './editable-label';
@@ -13,10 +13,27 @@
13
13
  // Registration is async (a microtask after this module loads). Consumers that
14
14
  // need the upgraded element (e.g. the React runtime) guard with
15
15
  // customElements.whenDefined(), which resolves once the impl chunk has run.
16
- if (typeof window !== 'undefined' && typeof customElements !== 'undefined') {
17
- void import('./register-impl');
18
- }
16
+ /** Resolves once the kai-* elements are registered (browser); inert on the server.
17
+ * Await this instead of customElements.whenDefined for a single ready signal.
18
+ *
19
+ * NOTE: this MUST stay an exported binding. A bare `void import('./register-impl')`
20
+ * is a result-unused dynamic import that the single-entry register-all build
21
+ * (vite.config.ts → dist/kai.es.js) tree-shakes away as dead code, leaving the
22
+ * bundle with NOTHING registered. Exporting the promise keeps the import live. */
23
+ export const elementsReady: Promise<unknown> =
24
+ typeof window !== 'undefined' && typeof customElements !== 'undefined'
25
+ ? import('./register-impl')
26
+ : Promise.resolve();
19
27
 
20
28
  export type { ChatMessage, ChatMessageAction } from './chat-types';
21
29
  export { configureCodeHighlighting, isCodeHighlightingEnabled } from '../primitives/highlighter';
22
30
  export type { CodeHighlightingOptions } from '../primitives/highlighter';
31
+
32
+ // Imperative toast API — usable directly from the elements entry so consumers
33
+ // who only import the web-components bundle still get `toast()`. The store is
34
+ // SSR-safe (no DOM touched until the first toast is raised on the client).
35
+ export { toast, configureToasts } from '../primitives/toast-store';
36
+ export type {
37
+ ToastConfig,
38
+ ToastItem, ToastVariant, ToastAction, ToastOptions, ToastHandle,
39
+ } from '../primitives/toast-store';
@@ -81,6 +81,10 @@ function buildWrappedPolicy(element: HTMLElement, userPolicy: CardPolicy | undef
81
81
  emit({ kind: 'dismiss', cardId });
82
82
  userPolicy?.onDismiss?.(cardId);
83
83
  },
84
+ onReopen(cardId) {
85
+ emit({ kind: 'reopen', cardId });
86
+ userPolicy?.onReopen?.(cardId);
87
+ },
84
88
  onError(cardId, message) {
85
89
  emit({ kind: 'error', cardId, message });
86
90
  userPolicy?.onError?.(cardId, message);