@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
package/README.md CHANGED
@@ -11,7 +11,7 @@ It can be consumed two ways:
11
11
 
12
12
  - **~50 composable components** across three layers: headless primitives → accessible UI primitives (built in-house, WCAG 2.1 AA — no third-party UI dependency) → AI feature components.
13
13
  - **Shadow-DOM web components** — zero CSS conflicts in any host. The host's styles can't leak in; the kit's Tailwind can't leak out.
14
- - **Lightweight by design** — a markdown-only `<kai-chat>` is **~110 KB gzip** (one file). Syntax highlighting (Shiki) is loaded **on demand, per-language, with no WASM** and never loads at all if you don't render code.
14
+ - **Load it your way** — register every element in one import, cherry-pick per-element with a bundler, or drop in a CDN autoloader that loads each on demand. Syntax highlighting loads lazily, per language, only when you render code.
15
15
  - **Tailwind v4** design tokens — rebrand by overriding `--color-*` custom properties.
16
16
 
17
17
  ## Install
@@ -33,7 +33,7 @@ npm install solid-js
33
33
  Build the bundle, then import it as a side-effect (it registers the custom elements):
34
34
 
35
35
  ```bash
36
- npm run build # emits dist/kitn-chat.es.js
36
+ npm run build # emits dist/kai.es.js
37
37
  ```
38
38
 
39
39
  ```html
@@ -43,6 +43,10 @@ npm run build # emits dist/kitn-chat.es.js
43
43
  <script type="module">
44
44
  import '@kitn.ai/ui/elements';
45
45
 
46
+ // Registration is async (SSR-safe) — wait for the element to be defined
47
+ // before setting properties, or the upgrade clobbers them.
48
+ await customElements.whenDefined('kai-chat');
49
+
46
50
  const chat = document.querySelector('kai-chat');
47
51
 
48
52
  // Rich data is set as JS properties (not HTML attributes)
@@ -50,8 +54,8 @@ npm run build # emits dist/kitn-chat.es.js
50
54
  { id: '1', role: 'assistant', content: 'Hello! How can I help?' },
51
55
  ];
52
56
 
53
- // Events are CustomEvents dispatched on the element (they do not bubble)
54
- chat.addEventListener('submit', (e) => {
57
+ // Events are non-bubbling kai-* CustomEvents dispatched on the element
58
+ chat.addEventListener('kai-submit', (e) => {
55
59
  console.log('user sent:', e.detail.value);
56
60
  });
57
61
  </script>
@@ -66,14 +70,14 @@ The element bundle is a self-contained ES module — load it directly from [jsDe
66
70
 
67
71
  ```html
68
72
  <script type="module">
69
- import 'https://cdn.jsdelivr.net/npm/@kitn.ai/ui/dist/kitn-chat.es.js';
70
- // …or unpkg: import 'https://unpkg.com/@kitn.ai/ui/dist/kitn-chat.es.js';
73
+ import 'https://cdn.jsdelivr.net/npm/@kitn.ai/ui/dist/kai.es.js';
74
+ // …or unpkg: import 'https://unpkg.com/@kitn.ai/ui/dist/kai.es.js';
71
75
  </script>
72
76
 
73
77
  <kai-chat></kai-chat>
74
78
  ```
75
79
 
76
- The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.4.0/dist/kitn-chat.es.js`): pinned URLs are immutable and cached far more aggressively, and — since this package is pre-1.0 — pinning shields you from breaking changes in a future minor release. SolidJS and the kit's CSS are bundled in, and the lazy code-highlighting chunks load from the same CDN on demand. To override design tokens, also include `theme.css`:
80
+ The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.16.0/dist/kai.es.js`): pinned URLs are immutable and cached far more aggressively, and — since this package is pre-1.0 — pinning shields you from breaking changes in a future minor release. SolidJS and the kit's CSS are bundled in, and the lazy code-highlighting chunks load from the same CDN on demand. To override design tokens, also include `theme.css`:
77
81
 
78
82
  ```html
79
83
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@kitn.ai/ui/theme.css">
@@ -109,7 +113,7 @@ function App() {
109
113
  }
110
114
  ```
111
115
 
112
- The SolidJS entry (`.`) is the kit's raw source (`src/index.ts`) — your bundler compiles it, so it tree-shakes to just what you import.
116
+ The SolidJS entry (`.`) ships compiled — your bundler tree-shakes it to just the components you import.
113
117
 
114
118
  ## Integrations
115
119
 
@@ -127,10 +131,13 @@ The components are deliberately **transport-agnostic**: `<kai-chat>` just render
127
131
  <script type="module">
128
132
  import '@kitn.ai/ui/elements';
129
133
 
134
+ // Registration is async (SSR-safe) — wait for the element before using it.
135
+ await customElements.whenDefined('kai-chat');
136
+
130
137
  const chat = document.getElementById('chat');
131
138
  chat.messages = [];
132
139
 
133
- chat.addEventListener('submit', async (e) => {
140
+ chat.addEventListener('kai-submit', async (e) => {
134
141
  const text = e.detail.value.trim();
135
142
  if (!text) return;
136
143
 
@@ -259,6 +266,29 @@ You can trigger either option from the streaming completion (auto-read replies)
259
266
 
260
267
  > **Speech-to-text** (the other direction) is already built in — the kit ships a `VoiceInput` component for capturing microphone input. See Storybook (`npm run dev`).
261
268
 
269
+ ## State helpers & hooks
270
+
271
+ `@kitn.ai/ui/state` ships immutable helpers (`appendMessage`, `upsertMessage`, `updateMessage`, `removeMessage`, `appendContent`) and a streaming handle (`createAssistantStream`) so you don't hand-roll array mutations. React apps get `useKaiChat` (from `@kitn.ai/ui/react`); SolidJS apps get `createKaiChat` (from `@kitn.ai/ui`). Both return a `bind` object to spread directly onto the element:
272
+
273
+ ```tsx
274
+ import { Chat, useKaiChat } from '@kitn.ai/ui/react';
275
+ import { createAssistantStream } from '@kitn.ai/ui/state';
276
+
277
+ function App() {
278
+ const chat = useKaiChat({
279
+ async onSubmit({ value }) {
280
+ chat.append({ id: crypto.randomUUID(), role: 'user', content: value });
281
+ const s = chat.streamAssistant();
282
+ for await (const part of backend(value)) s.appendText(part);
283
+ s.done();
284
+ },
285
+ });
286
+ return <Chat {...chat.bind} />;
287
+ }
288
+ ```
289
+
290
+ Each hook instance owns its own message list — instantiate multiple times for multiple independent chats on one page. Full API: [ui.kitn.ai/guides/state-and-hooks/](https://ui.kitn.ai/guides/state-and-hooks/).
291
+
262
292
  ## Code highlighting (optional, on-demand)
263
293
 
264
294
  Syntax highlighting uses [Shiki](https://shiki.style) and is wired to be as light as possible:
@@ -351,7 +381,7 @@ A set of runnable examples and a hosted component playground are included in the
351
381
  The composable showcase demonstrates every individual element in one page. Build the package first, then serve from the repo root:
352
382
 
353
383
  ```bash
354
- npm run build # produces dist/kitn-chat.es.js
384
+ npm run build # produces dist/kai.es.js
355
385
  npm run examples # static server at http://localhost:8000
356
386
  ```
357
387
 
@@ -392,12 +422,20 @@ cd examples/vue && npm install && npm run dev
392
422
  - **[docs/web-components.md](docs/web-components.md)** — full element API: every property, event, and the `ChatMessage` schema.
393
423
  - **[llms.txt](llms.txt)** / **[llms-full.txt](llms-full.txt)** — dense machine-readable references for AI coding agents.
394
424
 
395
- ## Bundle size
425
+ ## Loading
426
+
427
+ Three ways to load the elements — register all (the simple default), cherry-pick per-element, or a CDN autoloader:
428
+
429
+ | How you load | What it does |
430
+ |---|---|
431
+ | `import '@kitn.ai/ui/elements'` | registers every element — the simple default |
432
+ | `import '@kitn.ai/ui/elements/chat'` | one element, bundler tree-shakes |
433
+ | `import '@kitn.ai/ui/autoloader'` (opt-in **DOM autoloader**) | loads each element's module **on demand** as `<kai-*>` appears |
396
434
 
397
- | Scenario | Loaded |
398
- |---|--:|
399
- | `<kai-chat>`, markdown only (no code blocks) | **~110 KB gzip** (~413 KB raw), one file |
400
- | + a code block | adds Shiki core + JS engine + that language + theme, lazily |
401
- | Highlighting disabled | Shiki never loads |
435
+ The autoloader watches the DOM (initial scan + `MutationObserver`) and dynamically imports only the
436
+ elements actually present — so a page with just `<kai-chat>` never downloads the others. It's additive:
437
+ the register-all bundle stays the default. (Direct per-element imports and the autoloader are client-side;
438
+ SSR apps use the register-all `@kitn.ai/ui/elements` or render client-only.)
402
439
 
403
- The build is ES-module onlya UMD/IIFE build can't code-split and would inline every lazy chunk into one multi-MB file, so it's intentionally omitted.
440
+ Code highlighting (Shiki) is always lazyloaded per-language on first code block, with no WASM, and never
441
+ at all if you don't render code. The build is ES-module only (a UMD/IIFE build can't code-split).
@@ -3,13 +3,42 @@ import { FileTreeFile } from './file-tree';
3
3
  export type ArtifactTab = 'preview' | 'code';
4
4
  /** A file the artifact can preview + show source for. */
5
5
  export type ArtifactFile = FileTreeFile;
6
+ /** Imperative handle exposed via `controllerRef` — surfaces the artifact's latent
7
+ * toolbar capabilities (history back/forward/reload/home, programmatic navigate,
8
+ * file selection, open-in-new-tab, maximize/restore) so the `<kai-artifact>`
9
+ * facade can forward them as instance methods. Each delegates to the SAME internal
10
+ * handler the toolbar buttons use, so every existing event still fires. */
11
+ export interface ArtifactController {
12
+ /** Go back in the artifact's own history stack (no-op when there's no prior entry). */
13
+ back(): void;
14
+ /** Go forward in the history stack (no-op when there's no forward entry). */
15
+ forward(): void;
16
+ /** Force-reload the current preview url (also re-renders an inline PDF). */
17
+ reload(): void;
18
+ /** Navigate to the `src` home url (no-op when there's no `src`). */
19
+ home(): void;
20
+ /** Push + load a url in the preview (the path-field submit path). */
21
+ navigate(url: string): void;
22
+ /** Select a file by path: highlights the tree, shows its source, navigates the preview. */
23
+ selectFile(path: string): void;
24
+ /** Open the current url in a new browser tab (no-op when there's no concrete url). */
25
+ openExternal(): void;
26
+ /** Enter the maximized view-state (fires onMaximizeChange/kai-maximize-change). */
27
+ maximize(): void;
28
+ /** Exit the maximized view-state. */
29
+ restore(): void;
30
+ }
6
31
  export interface ArtifactProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
7
32
  /** URL the preview iframe frames. */
8
33
  src?: string;
9
34
  /** Files for the Code tab's tree (+ each file's preview `url`). */
10
35
  files?: ArtifactFile[];
11
- /** Active tab. Default `preview`. */
36
+ /** Controlled active tab when set, the artifact follows it (re-asserted on
37
+ * every change). When undefined the tab is uncontrolled (see `defaultTab`). */
12
38
  tab?: ArtifactTab;
39
+ /** Uncontrolled INITIAL tab (used only when `tab` is undefined). The user can
40
+ * then freely switch tabs; defaults to `preview`. */
41
+ defaultTab?: ArtifactTab;
13
42
  /** Selected file path (syncs tree highlight + Code source + preview). */
14
43
  activeFile?: string;
15
44
  /** iframe `sandbox` override. Default `allow-scripts allow-forms`. */
@@ -44,6 +73,15 @@ export interface ArtifactProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>,
44
73
  standalone?: boolean;
45
74
  /** Make the path field read-only (visible, nav-tracking, non-editable). */
46
75
  readonlyPath?: boolean;
76
+ /** Friendly address shown in the path field INSTEAD of the real current url
77
+ * (read-only, non-navigable). Use when the framed url is not consumer-facing
78
+ * (e.g. a `data:` blob) so a clean address is shown instead of leaking it.
79
+ * Unset = show the real url (editable per `readonlyPath`). */
80
+ displayUrl?: string;
81
+ /** Receive the imperative controller once mounted. The `<kai-artifact>` facade
82
+ * forwards these as element methods (back/forward/reload/home/navigate/
83
+ * selectFile/openExternal/maximize/restore). */
84
+ controllerRef?: (controller: ArtifactController) => void;
47
85
  }
48
86
  /** True when `url` should render as a PDF: a matching `files` entry is typed
49
87
  * `'pdf'`, or the URL path (query/hash stripped) ends in `.pdf`. */
@@ -0,0 +1,12 @@
1
+ /** A message attachment descriptor. Pure type — kept JSX-free for the
2
+ * framework-neutral consumers (state core, React hook typecheck). */
3
+ export interface AttachmentData {
4
+ id: string;
5
+ type: 'file' | 'source-document';
6
+ filename?: string;
7
+ mediaType?: string;
8
+ url?: string;
9
+ title?: string;
10
+ }
11
+ export type AttachmentMediaCategory = 'image' | 'video' | 'audio' | 'document' | 'source' | 'unknown';
12
+ export type AttachmentVariant = 'grid' | 'inline' | 'list';
@@ -1,14 +1,6 @@
1
1
  import { JSX } from 'solid-js';
2
- export interface AttachmentData {
3
- id: string;
4
- type: 'file' | 'source-document';
5
- filename?: string;
6
- mediaType?: string;
7
- url?: string;
8
- title?: string;
9
- }
10
- export type AttachmentMediaCategory = 'image' | 'video' | 'audio' | 'document' | 'source' | 'unknown';
11
- export type AttachmentVariant = 'grid' | 'inline' | 'list';
2
+ import { AttachmentData, AttachmentMediaCategory, AttachmentVariant } from './attachment-types';
3
+ export type { AttachmentData, AttachmentMediaCategory, AttachmentVariant } from './attachment-types';
12
4
  export declare const getMediaCategory: (data: AttachmentData) => AttachmentMediaCategory;
13
5
  export declare const getAttachmentLabel: (data: AttachmentData) => string;
14
6
  interface AttachmentsContextValue {
@@ -16,6 +16,25 @@ export interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> {
16
16
  /** Stable id for the heading (so composing cards can `aria-labelledby` it).
17
17
  * Auto-generated when omitted. */
18
18
  headingId?: string;
19
+ /** Render a dismiss (×) button that hides the card and calls `onDismiss`.
20
+ * Opt-in, OFF by default — the contract cards never set it, so they are
21
+ * unaffected. */
22
+ dismissible?: boolean;
23
+ /** Called after the card is dismissed via its ×. */
24
+ onDismiss?: () => void;
25
+ /** Render the whole card as a link (`<a>`). Wins over `clickable`. */
26
+ href?: string;
27
+ /** `target` for the `href` anchor. */
28
+ target?: string;
29
+ /** `rel` for the `href` anchor (default `noopener noreferrer` when `target="_blank"`). */
30
+ rel?: string;
31
+ /** Make the whole card behave like a button: `role="button"`, a tabindex, and
32
+ * Enter/Space activation, firing `onCardClick`. Ignored when `href` is set.
33
+ * A clickable/href card must NOT also contain footer action buttons — that
34
+ * nests interactive elements. Use `actions` OR clickable, never both. */
35
+ clickable?: boolean;
36
+ /** Called when a `clickable` (or `href`) card is activated (click, or Enter/Space). */
37
+ onCardClick?: (event: MouseEvent | KeyboardEvent) => void;
19
38
  }
20
39
  /**
21
40
  * `Card` — the shared presentational chrome every native card composes from:
@@ -24,5 +43,13 @@ export interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> {
24
43
  * "never a broken/partial card" rule). It is intentionally chrome-only: it reads
25
44
  * no `CardContext` and emits no `CardEvent` — the cards that compose it (e.g.
26
45
  * `kai-form`) own the contract interaction.
46
+ *
47
+ * The optional `dismissible` / `href` / `clickable` behaviors are all OFF by
48
+ * default, so the contract cards (which set none of them) keep their original
49
+ * presentational behavior unchanged.
50
+ *
51
+ * a11y: a `clickable` or `href` card MUST NOT also contain footer action buttons
52
+ * — that nests interactive controls inside a button/link. Use `actions` OR
53
+ * make the card clickable, never both.
27
54
  */
28
55
  export declare function Card(props: CardProps): JSX.Element;
@@ -1,4 +1,4 @@
1
- import { JSX } from 'solid-js';
1
+ import { JSX, Accessor } from 'solid-js';
2
2
  export interface ChainOfThoughtItemProps extends JSX.HTMLAttributes<HTMLDivElement> {
3
3
  children: JSX.Element;
4
4
  }
@@ -24,6 +24,82 @@ export interface ChainOfThoughtStepProps {
24
24
  children: JSX.Element;
25
25
  class?: string;
26
26
  isLast?: boolean;
27
+ /** Controlled open state. When provided, the step's Collapsible is driven by
28
+ * this value (the parent owns it — used by the Accordion model below). When
29
+ * OMITTED the step stays uncontrolled, preserving the original behaviour
30
+ * (every step independently toggleable, starting closed). */
31
+ open?: boolean;
32
+ /** Called with the desired next open state when the user clicks the trigger.
33
+ * Only meaningful when `open` is also provided (controlled mode); the parent
34
+ * Accordion routes this through its open-set handler. */
35
+ onOpenChange?: (open: boolean) => void;
27
36
  }
28
37
  declare function ChainOfThoughtStep(props: ChainOfThoughtStepProps): JSX.Element;
29
- export { ChainOfThought, ChainOfThoughtStep, ChainOfThoughtTrigger, ChainOfThoughtContent, ChainOfThoughtItem, };
38
+ /** Open-mode: `multiple` (any number of steps open at once — the historical
39
+ * default) or `single` (at most one open; opening a step closes the others). */
40
+ export type ChainOfThoughtType = 'single' | 'multiple';
41
+ /**
42
+ * A reasoning step descriptor. `id` is an OPTIONAL stable key — the Accordion's
43
+ * open-set keys use `step.id` when present, else `String(index)`. So a consumer
44
+ * who wants to drive `value`/`defaultValue` (or read `kai-value-change`) by a
45
+ * meaningful key should set `id`; otherwise the step's position is its key.
46
+ */
47
+ export interface ChainOfThoughtStepData {
48
+ /** The step's heading (the always-visible trigger). */
49
+ label: string;
50
+ /** Optional expandable detail. */
51
+ content?: string;
52
+ /** Optional stable key for the open-set/value model (defaults to the index). */
53
+ id?: string;
54
+ }
55
+ /**
56
+ * Imperative handle exposed via `controllerRef` so the `<kai-chain-of-thought>`
57
+ * facade can drive/observe the Accordion's open set. Index-based to match the
58
+ * `expand(index?)`/`collapse(index?)`/`toggle(index?)` method signatures; the
59
+ * controller resolves the index → step key internally. All setters flow through
60
+ * the same open-set mutate path as user clicks, so they all emit
61
+ * `kai-value-change` via `onValueChange`.
62
+ */
63
+ export interface ChainOfThoughtController {
64
+ /** Current open keys, normalised per `type` (string in single, string[] in multiple). */
65
+ value: Accessor<string | string[]>;
66
+ /** Open one step by index, or ALL steps when `index` is omitted. */
67
+ expand: (index?: number) => void;
68
+ /** Close one step by index, or ALL steps when `index` is omitted. */
69
+ collapse: (index?: number) => void;
70
+ /** Flip one step's open state by index. */
71
+ toggle: (index?: number) => void;
72
+ }
73
+ export interface ChainOfThoughtAccordionProps {
74
+ /** The reasoning steps to render. */
75
+ steps: ChainOfThoughtStepData[];
76
+ /** Open mode. Default `multiple` (the historical behaviour). */
77
+ type?: ChainOfThoughtType;
78
+ /** Controlled open step key(s). When provided it WINS over internal state. */
79
+ value?: string | string[];
80
+ /** Uncontrolled initial open step key(s). Seeds the internal open-set. */
81
+ defaultValue?: string | string[];
82
+ /** Fired whenever the open set changes (user click OR a controller method).
83
+ * The single emit point — the facade turns this into `kai-value-change`. The
84
+ * payload is a string in `single` mode, a string[] in `multiple` mode. */
85
+ onValueChange?: (value: string | string[]) => void;
86
+ /** Receive the imperative controller once set up (Pattern C). */
87
+ controllerRef?: (api: ChainOfThoughtController) => void;
88
+ class?: string;
89
+ }
90
+ /**
91
+ * The full Accordion-model root used by `<kai-chain-of-thought>`. Lifts each
92
+ * step's open state into a controlled/uncontrolled open-set:
93
+ * - seeded from `defaultValue` (normalised string|string[] → Set);
94
+ * - when `value` is provided it WINS (controlled);
95
+ * - a trigger click updates the set respecting `single` vs `multiple` and emits
96
+ * via `onValueChange` — in single mode opening a step closes the others;
97
+ * - each step's Collapsible is driven (controlled) by its membership in the set.
98
+ *
99
+ * With NO new props (type defaults to `multiple`, no value/defaultValue), every
100
+ * step starts closed and is independently toggleable — identical to the old
101
+ * behaviour, just with the open state lifted here so methods/events can observe
102
+ * and drive it.
103
+ */
104
+ declare function ChainOfThoughtAccordion(props: ChainOfThoughtAccordionProps): JSX.Element;
105
+ export { ChainOfThought, ChainOfThoughtStep, ChainOfThoughtTrigger, ChainOfThoughtContent, ChainOfThoughtItem, ChainOfThoughtAccordion, };
@@ -1,3 +1,4 @@
1
+ import { DropdownController } from '../ui/dropdown';
1
2
  import { SearchFilters } from '../types';
2
3
  export interface ChatScopePickerProps {
3
4
  currentLabel: string;
@@ -5,5 +6,11 @@ export interface ChatScopePickerProps {
5
6
  availableAuthors?: string[];
6
7
  availableTags?: string[];
7
8
  class?: string;
9
+ /** Initial open state of the dropdown (uncontrolled seed). */
10
+ defaultOpen?: boolean;
11
+ /** Disable the trigger — click/keyboard no longer open the dropdown. */
12
+ disabled?: boolean;
13
+ /** Receive the dropdown's open controller (forwarded from the inner Dropdown). */
14
+ controllerRef?: (api: DropdownController) => void;
8
15
  }
9
16
  export declare function ChatScopePicker(props: ChatScopePickerProps): import("solid-js").JSX.Element;
@@ -1,5 +1,7 @@
1
+ import { ComposerDoc } from '../primitives/composer-model';
1
2
  import { AttachmentData } from './attachments';
2
- import { SlashCommandItem } from './slash-command';
3
+ import { MessageActionDetail } from '../primitives/message-feedback';
4
+ import { TriggerDef } from './composer';
3
5
  import { ChatMessage } from '../elements/chat-types';
4
6
  import { ProseSize } from '../primitives/chat-config';
5
7
  import { ModelOption } from '../types';
@@ -17,9 +19,10 @@ export interface ChatThreadProps {
17
19
  * content, and optional reasoning/tools/attachments/actions. Set as a JS
18
20
  * property (`el.messages = [...]`). */
19
21
  messages: ChatMessage[];
20
- /** Controlled value of the input. When set, the host owns the input text and
21
- * must update it on `kai-value-change`; leave unset for uncontrolled behavior. */
22
- value?: string;
22
+ /** Value of the input. A **string** is controlled (the host owns the text and
23
+ * updates it on `kai-value-change`). A **ComposerDoc** is a one-time seed that
24
+ * pre-populates pills; the user then edits freely. Leave unset for uncontrolled. */
25
+ value?: string | ComposerDoc;
23
26
  /** Placeholder text shown in the empty input. */
24
27
  placeholder?: string;
25
28
  /** When true, shows the loading/streaming state and disables submit (use while
@@ -61,17 +64,29 @@ export interface ChatThreadProps {
61
64
  headerStart?: boolean;
62
65
  /** Whether the host has `slot="header-end"` content (right of the controls). */
63
66
  headerEnd?: boolean;
67
+ /** REPLACE — full custom header in place of the built-in title/model/context bar. */
68
+ headerFull?: boolean;
69
+ /** INJECT — left sidebar column (e.g. a conversation list / your own nav). */
70
+ sidebar?: boolean;
71
+ /** REPLACE — custom zero-state rendered in the message area while the thread is empty (replaces the empty message list only; the composer and its suggestions still render). */
72
+ empty?: boolean;
73
+ /** REPLACE — full custom composer in place of the built-in prompt input. The
74
+ * projected content wires its own submit (the data-flow boundary). */
75
+ composer?: boolean;
76
+ /** INJECT — accessory row just above the composer (e.g. extra actions). */
77
+ composerActions?: boolean;
78
+ /** INJECT — footer row below the composer (disclaimers, token meter, …). */
79
+ footer?: boolean;
64
80
  /** Show a Search (Globe) button in the input toolbar; fires a `search` event. */
65
81
  search?: boolean;
66
82
  /** Show a Voice (Mic) button in the input toolbar; fires a `voice` event. */
67
83
  voice?: boolean;
68
- /** Slash commandswhen set, typing `/` in the input opens the command
69
- * palette and fires `kai-slash-select`. Set as a JS property. */
70
- slashCommands?: SlashCommandItem[];
71
- /** Command ids to highlight as active in the palette. */
72
- slashActiveIds?: string[];
73
- /** Single-line palette rows. */
74
- slashCompact?: boolean;
84
+ /** Rich entity triggers each `{ char, kind, items }` opens a caret-anchored
85
+ * menu that inserts an atomic pill (`/` skills, `@` agents/plugins). Set as a
86
+ * JS property; forwarded to the input. */
87
+ triggers?: TriggerDef[];
88
+ /** Default icon per entity kind (kind → image src) for pills/menu items. */
89
+ kindIcons?: Record<string, string>;
75
90
  /** Whether each message's action bar is always visible (`'always'`, default)
76
91
  * or only revealed on hover of that message row (`'hover'`). */
77
92
  actionsReveal?: 'always' | 'hover';
@@ -80,14 +95,22 @@ export interface ChatThreadProps {
80
95
  value: string;
81
96
  attachments: AttachmentData[];
82
97
  }) => void;
98
+ onAttachmentsChange?: (attachments: AttachmentData[]) => void;
83
99
  onSuggestionClick?: (value: string) => void;
84
100
  onModelChange?: (modelId: string) => void;
85
- onMessageAction?: (detail: {
86
- messageId: string;
87
- action: string;
88
- }) => void;
101
+ onMessageAction?: (detail: MessageActionDetail) => void;
89
102
  onSearch?: () => void;
90
103
  onVoice?: () => void;
91
- onSlashSelect?: (command: SlashCommandItem) => void;
104
+ /** Receive the imperative controller once mounted. The kai-chat facade forwards
105
+ * these as element methods (focus/clear/send/scrollToBottom). */
106
+ controllerRef?: (controller: ChatThreadController) => void;
107
+ }
108
+ /** Imperative handle exposed via `controllerRef` — the input half of the chat's
109
+ * interaction surface, forwarded onto `<kai-chat>` as instance methods. */
110
+ export interface ChatThreadController {
111
+ focus(options?: FocusOptions): void;
112
+ clear(): void;
113
+ send(): void;
114
+ scrollToBottom(behavior?: ScrollBehavior): void;
92
115
  }
93
116
  export declare function ChatThread(props: ChatThreadProps): import("solid-js").JSX.Element;
@@ -24,6 +24,7 @@ export interface ChoiceCardData {
24
24
  options: ChoiceOption[];
25
25
  allowOther?: ChoiceAllowOther;
26
26
  submitLabel?: string;
27
+ dismissible?: boolean;
27
28
  }
28
29
  export type ChoiceCardEnvelope = CardEnvelope<'choice', ChoiceCardData>;
29
30
  export declare const CHOICE_CARD_TYPE: "choice";
@@ -46,6 +47,21 @@ export declare function resolveOtherConfig(allowOther: ChoiceAllowOther | undefi
46
47
  export declare function nextEnabledIndex(options: ChoiceOption[], from: number, dir: 1 | -1): number;
47
48
  /** The first non-disabled option index (the initial roving tab stop), or -1. */
48
49
  export declare function firstEnabledIndex(options: ChoiceOption[]): number;
50
+ /** Imperative handle exposed via `controllerRef` — surfaces the choice card's
51
+ * latent selection/submit/dismiss capabilities so the `<kai-choice>` facade can
52
+ * forward them as instance methods (focus/select/send/dismiss/reopen). */
53
+ export interface ChoiceController {
54
+ /** Focus the radiogroup roving tab stop (or the Other input when selected). */
55
+ focus(options?: FocusOptions): void;
56
+ /** Select an option by id locally (no emit) — same as a row click. */
57
+ select(optionId: string): void;
58
+ /** Submit the current selection — emits the `action` verb + resolves single-shot. */
59
+ send(): void;
60
+ /** Dismiss the card — emits `dismiss` + optimistically collapses to the stub. */
61
+ dismiss(): void;
62
+ /** Re-open a dismissed card from its stub — emits `reopen`. */
63
+ reopen(): void;
64
+ }
49
65
  export interface ChoiceCardProps {
50
66
  /** The choice definition (CardEnvelope.data). */
51
67
  data?: ChoiceCardData;
@@ -61,6 +77,17 @@ export interface ChoiceCardProps {
61
77
  class?: string;
62
78
  /** When set, render the chromed read-only view instead of the interactive radiogroup. */
63
79
  resolution?: CardResolution;
80
+ /** Controlled selection (option id). When set, the consumer owns the current pick. */
81
+ value?: string;
82
+ /** Option id to pre-select on mount (uncontrolled seed). */
83
+ defaultValue?: string;
84
+ /** Disable the whole radiogroup + Submit (e.g. while the agent is busy). */
85
+ disabled?: boolean;
86
+ /** Fires when the selection changes BEFORE submit (row click or select()). */
87
+ onValueChange?: (value: string) => void;
88
+ /** Receive the imperative controller once mounted. The `<kai-choice>` facade
89
+ * forwards these as element methods (focus/select/send/dismiss/reopen). */
90
+ controllerRef?: (controller: ChoiceController) => void;
64
91
  }
65
92
  /**
66
93
  * `ChoiceCard` — a single-select "pick one of N rich options" card (plans, products,
@@ -0,0 +1,49 @@
1
+ import { Accessor, JSX } from 'solid-js';
2
+ import { Placement } from '@floating-ui/dom';
3
+ /** Imperative open controller, handed to the kai-coachmark facade via
4
+ * `controllerRef` so it can drive/observe open state with `wireDisclosure`. */
5
+ export interface CoachmarkController {
6
+ open: Accessor<boolean>;
7
+ setOpen: (v: boolean) => void;
8
+ }
9
+ export interface CoachmarkProps {
10
+ /** The anchor/trigger (the default slot). The bubble is positioned against it. */
11
+ children?: JSX.Element;
12
+ /** The bubble body text (the `content` slot). */
13
+ content?: JSX.Element;
14
+ /** The bold title. NOT `title` — that is a reserved IDL attr (see define.tsx). */
15
+ headline?: JSX.Element;
16
+ /** A small badge pill (e.g. "New"). */
17
+ badge?: JSX.Element;
18
+ /** Floating placement relative to the anchor. Defaults to `'bottom'`. */
19
+ placement?: Placement;
20
+ /** Color tone: `primary` (default, theme accent), `info` (blue), `success`
21
+ * (green), `warning` (amber), or `error` (red) — reusing the kit's tool hues. */
22
+ tone?: 'primary' | 'info' | 'success' | 'warning' | 'error';
23
+ /** Controlled open state. When set, the component never changes it itself;
24
+ * drive it from `onOpenChange`. Omit for uncontrolled (internal) state. */
25
+ open?: boolean;
26
+ /** Initial open state when uncontrolled. */
27
+ defaultOpen?: boolean;
28
+ /** Fires whenever open wants to change (the × button / a method). */
29
+ onOpenChange?: (open: boolean) => void;
30
+ /** Dismiss intent: the × button. */
31
+ onDismiss?: () => void;
32
+ /** Render the arrow that points at the anchor. Defaults to `true`; set `false`
33
+ * for a plain bubble with no pointer. */
34
+ arrow?: boolean;
35
+ /** Receive the open controller once mounted. */
36
+ controllerRef?: (api: CoachmarkController) => void;
37
+ }
38
+ /**
39
+ * Coachmark is the presentational onboarding hint: a tinted bubble with an arrow,
40
+ * anchored to a trigger. It wraps the anchor (the default slot) and positions the
41
+ * bubble against it with `usePosition` (the shared Floating UI primitive) so the
42
+ * arrow tracks the anchor on scroll/resize AND when a sibling reflows it,
43
+ * flipping/shifting to stay on screen. The developer owns when it shows
44
+ * (`open`/`default-open`); the ×, Escape, OR clicking the trigger fires
45
+ * `onDismiss`. Color comes from `--kai-coachmark-bg` / `--kai-coachmark-fg` (each
46
+ * defaulting to the `tone` palette), so a consumer can recolor purely in CSS; the
47
+ * arrow reads the same bg var so it always continues the bubble.
48
+ */
49
+ export declare function Coachmark(props: CoachmarkProps): JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { EntityRef, ComposerDoc } from '../primitives/composer-model';
2
+ export declare const ZWSP = "\u200B";
3
+ export declare const ENTITY_ATTR = "data-kai-entity";
4
+ export declare const entityStore: WeakMap<HTMLElement, EntityRef>;
5
+ export declare function isEntityEl(node: Node | null): node is HTMLElement;
6
+ /**
7
+ * A TreeWalker over the editable's text nodes that SKIPS text inside entity
8
+ * pills. Pills are atomic and contribute nothing to the text model — their inner
9
+ * label text must not pollute caret offsets, trigger detection, or highlight
10
+ * ranges. (Without this, the text seen at a caret right after a pill is the
11
+ * pill's label, so `/` reads as glued to the label instead of starting a token.)
12
+ */
13
+ export declare function createTextWalker(root: HTMLElement): TreeWalker;
14
+ /**
15
+ * The leading sigil shown on a "light" pill, by kind: skills `/`, agents `@`.
16
+ * Skills and agents render as decorated inline text led by their sigil; this is
17
+ * what makes them read like `/my-skill` / `@my-agent` rather than a chip.
18
+ * Returns '' for kinds rendered as a richer CHIP (plugins, and any other/unknown
19
+ * kind) — those carry an icon instead of a sigil. The sigil is visual only: it
20
+ * never enters the text model (the entity is read from `entityStore`, and the
21
+ * text walker skips pill-internal nodes).
22
+ */
23
+ export declare function kindSigil(kind: string): string;
24
+ /**
25
+ * Default monochrome (currentColor) glyph per entity kind, for the richer CHIP
26
+ * kinds shown in the trigger menu / on plugin pills: plugin = plug. (Skills and
27
+ * agents are light sigil-text pills — see `kindSigil` — so they take no glyph on
28
+ * the pill, though the menu may still show one.) Returns inline SVG markup
29
+ * (trusted — no user input), or '' for kinds without a default. An item's own
30
+ * `icon` always takes precedence over this.
31
+ */
32
+ export declare function kindGlyph(kind: string): string;
33
+ export declare function createEntityEl(doc: Document, entity: EntityRef, kindIcons?: Record<string, string>): HTMLElement;
34
+ export declare function parseDom(root: HTMLElement): ComposerDoc;
35
+ export declare function renderDoc(root: HTMLElement, doc: ComposerDoc, ownerDoc?: Document, kindIcons?: Record<string, string>): void;