@kitn.ai/ui 0.17.0 → 0.18.1

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 (494) hide show
  1. package/README.md +28 -5
  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 +37 -12
  9. package/dist/components/choice-card.d.ts +26 -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/file-tree.d.ts +15 -0
  19. package/dist/components/form.d.ts +34 -0
  20. package/dist/components/markdown.d.ts +3 -0
  21. package/dist/components/message.d.ts +12 -0
  22. package/dist/components/model-switcher.d.ts +7 -0
  23. package/dist/components/prompt-input.d.ts +13 -4
  24. package/dist/components/prompt-suggestion.d.ts +9 -1
  25. package/dist/components/reasoning.d.ts +14 -1
  26. package/dist/components/response-compare.d.ts +14 -0
  27. package/dist/components/screen.d.ts +46 -0
  28. package/dist/components/tasks-card.d.ts +49 -1
  29. package/dist/components/toast.d.ts +12 -2
  30. package/dist/components/tool-types.d.ts +10 -0
  31. package/dist/components/tool.d.ts +8 -8
  32. package/dist/components/voice-input.d.ts +27 -0
  33. package/dist/components/voice-output.d.ts +33 -0
  34. package/dist/core-C8fzo39E.js +12 -0
  35. package/dist/custom-elements.json +8392 -1860
  36. package/dist/elements/agent-card.d.ts +1 -0
  37. package/dist/elements/agent-card.js +1 -0
  38. package/dist/elements/artifact.js +1 -1
  39. package/dist/elements/attachments.js +1 -1
  40. package/dist/elements/autoloader.js +1 -1
  41. package/dist/elements/avatar.d.ts +1 -0
  42. package/dist/elements/avatar.js +1 -0
  43. package/dist/elements/badge.d.ts +1 -0
  44. package/dist/elements/badge.js +1 -0
  45. package/dist/elements/button.d.ts +1 -0
  46. package/dist/elements/button.js +1 -0
  47. package/dist/elements/card.js +1 -1
  48. package/dist/elements/cards.js +1 -1
  49. package/dist/elements/chain-of-thought.js +1 -1
  50. package/dist/elements/chat-scope-picker.js +1 -1
  51. package/dist/elements/chat-types.d.ts +47 -0
  52. package/dist/elements/chat-workspace.js +1 -1
  53. package/dist/elements/chat.js +1 -1
  54. package/dist/elements/checkpoint.js +1 -1
  55. package/dist/elements/choice.js +1 -1
  56. package/dist/elements/chunks/Icon-C2LTALdM.js +1 -0
  57. package/dist/elements/chunks/action-icons-Dtl8Ox5D.js +1 -0
  58. package/dist/elements/chunks/arrow-left-GbBceGBE.js +1 -0
  59. package/dist/elements/chunks/attachments-DLJcWCDV.js +1 -0
  60. package/dist/elements/chunks/badge-BTNZTODL.js +1 -0
  61. package/dist/elements/chunks/button-DBDZebGr.js +1 -0
  62. package/dist/elements/chunks/card-YfCyI4fH.js +1 -0
  63. package/dist/elements/chunks/chat-thread-Dz2qbzvI.js +1 -0
  64. package/dist/elements/chunks/check-fhmRksq_.js +1 -0
  65. package/dist/elements/chunks/chevron-down-DcRg1aRU.js +1 -0
  66. package/dist/elements/chunks/chevron-right-ChzBcNJ-.js +1 -0
  67. package/dist/elements/chunks/circle-B4fTe9v6.js +1 -0
  68. package/dist/elements/chunks/circle-check-CJV-3Rem.js +1 -0
  69. package/dist/elements/chunks/circle-x-pDtzlghQ.js +1 -0
  70. package/dist/elements/chunks/cn-CU7UAWzk.js +1 -0
  71. package/dist/elements/chunks/code-block-DZ6mz6vs.js +1 -0
  72. package/dist/elements/chunks/collapsible-CWUAShMC.js +1 -0
  73. package/dist/elements/chunks/composer-BZyPU6gD.js +65 -0
  74. package/dist/elements/chunks/context-Cx6eQA_G.js +1 -0
  75. package/dist/elements/chunks/conversation-list-C4xTQSpT.js +1 -0
  76. package/dist/elements/chunks/default-input-BZcwyKcP.js +1 -0
  77. package/dist/elements/chunks/define-CNSKFZCd.js +1 -0
  78. package/dist/elements/chunks/disclosure-BcBs--Jf.js +1 -0
  79. package/dist/elements/chunks/download-BDQwcFav.js +1 -0
  80. package/dist/elements/chunks/dropdown-wgs8xCJZ.js +1 -0
  81. package/dist/elements/chunks/ellipsis-CUiEJ6R1.js +1 -0
  82. package/dist/elements/chunks/external-link-DJUmC7g2.js +1 -0
  83. package/dist/elements/chunks/file-text-DOYfYvrh.js +1 -0
  84. package/dist/elements/chunks/file-tree-DQzNQrbr.js +1 -0
  85. package/dist/elements/chunks/folder-DBDUBANz.js +1 -0
  86. package/dist/elements/chunks/hover-card-BQGdGAQ3.js +1 -0
  87. package/dist/elements/chunks/icon-CAyRqVrg.js +1 -0
  88. package/dist/elements/chunks/{index-CTBEJeo6.js → index-BCRhi84a.js} +1 -1
  89. package/dist/elements/chunks/info-DBQl-m6e.js +1 -0
  90. package/dist/elements/chunks/input-DZD67EvW.js +1 -0
  91. package/dist/elements/chunks/kbd-DbyVrlnU.js +1 -0
  92. package/dist/elements/chunks/link-vko7AttA.js +1 -0
  93. package/dist/elements/chunks/loader-Cg6rO8tQ.js +1 -0
  94. package/dist/elements/chunks/{markdown-CMTGx9r8.js → markdown-n3Xbj3PR.js} +9 -9
  95. package/dist/elements/chunks/message-CgKytiSB.js +1 -0
  96. package/dist/elements/chunks/message-feedback-Ds3-US0e.js +1 -0
  97. package/dist/elements/chunks/message-square-MmRkvc-M.js +1 -0
  98. package/dist/elements/chunks/minimize-2-3kCdE0q3.js +1 -0
  99. package/dist/elements/chunks/model-switcher-BMtXGwLU.js +1 -0
  100. package/dist/elements/chunks/overlay-B1-MBI6h.js +1 -0
  101. package/dist/elements/chunks/paperclip-DDEfmkHc.js +1 -0
  102. package/dist/elements/chunks/progress-bar-Dwbiyv3s.js +1 -0
  103. package/dist/elements/chunks/prompt-suggestion-9lvgFcEa.js +1 -0
  104. package/dist/elements/chunks/reasoning-DzHWsdAJ.js +1 -0
  105. package/dist/elements/chunks/resizable-Bq_eHxUm.js +1 -0
  106. package/dist/elements/chunks/rotate-cw-jpisOdOV.js +1 -0
  107. package/dist/elements/chunks/scroll-area-g5Ze3K6f.js +1 -0
  108. package/dist/elements/chunks/separator-Bmjc5XyX.js +1 -0
  109. package/dist/elements/chunks/settings-Cz1bMJP9.js +1 -0
  110. package/dist/elements/chunks/settings-group-9imY3kRA.js +1 -0
  111. package/dist/elements/chunks/share-BdenF0wQ.js +1 -0
  112. package/dist/elements/chunks/skeleton-Pjc5jiaY.js +1 -0
  113. package/dist/elements/chunks/slots-DkZ-Cmha.js +1 -0
  114. package/dist/elements/chunks/star-DY6z1UUH.js +1 -0
  115. package/dist/elements/chunks/store-th4VyJXM.js +1 -0
  116. package/dist/elements/chunks/text-shimmer-CEi-tlXr.js +1 -0
  117. package/dist/elements/chunks/textarea-CboigarR.js +1 -0
  118. package/dist/elements/chunks/thumbs-up-BR33KLfA.js +1 -0
  119. package/dist/elements/chunks/toast-store-BEMda0fv.js +1 -0
  120. package/dist/elements/chunks/tool-TMued3WO.js +1 -0
  121. package/dist/elements/chunks/tooltip-Cft_Rxiw.js +1 -0
  122. package/dist/elements/chunks/triangle-alert-B07fX3Q8.js +1 -0
  123. package/dist/elements/chunks/use-card-resolution-M36zVciB.js +1 -0
  124. package/dist/elements/chunks/video-MKp3LmNT.js +1 -0
  125. package/dist/elements/chunks/x-Ckwicf6g.js +1 -0
  126. package/dist/elements/coachmark.d.ts +1 -0
  127. package/dist/elements/coachmark.js +1 -0
  128. package/dist/elements/code-block.js +1 -1
  129. package/dist/elements/command.d.ts +1 -0
  130. package/dist/elements/command.js +1 -0
  131. package/dist/elements/compare.js +1 -1
  132. package/dist/elements/composer.d.ts +1 -0
  133. package/dist/elements/composer.js +1 -0
  134. package/dist/elements/confirm-card.js +1 -1
  135. package/dist/elements/context-meter.js +1 -1
  136. package/dist/elements/conversation-list.js +1 -1
  137. package/dist/elements/css.d.ts +1 -0
  138. package/dist/elements/default-input.d.ts +51 -0
  139. package/dist/elements/define.d.ts +53 -0
  140. package/dist/elements/dialog.d.ts +1 -0
  141. package/dist/elements/dialog.js +1 -0
  142. package/dist/elements/disclosure.d.ts +37 -0
  143. package/dist/elements/editable-label.d.ts +1 -0
  144. package/dist/elements/editable-label.js +1 -0
  145. package/dist/elements/embed.js +1 -1
  146. package/dist/elements/empty.js +1 -1
  147. package/dist/elements/feedback-bar.js +1 -1
  148. package/dist/elements/file-tree.js +1 -1
  149. package/dist/elements/file-upload.js +1 -1
  150. package/dist/elements/form.js +1 -1
  151. package/dist/elements/hover-card.d.ts +1 -0
  152. package/dist/elements/hover-card.js +1 -0
  153. package/dist/elements/icon.d.ts +1 -0
  154. package/dist/elements/icon.js +1 -0
  155. package/dist/elements/image.js +1 -1
  156. package/dist/elements/input.d.ts +1 -0
  157. package/dist/elements/input.js +1 -0
  158. package/dist/elements/kbd.d.ts +1 -0
  159. package/dist/elements/kbd.js +1 -0
  160. package/dist/elements/link-preview.js +1 -1
  161. package/dist/elements/loader.js +1 -1
  162. package/dist/elements/markdown.js +1 -1
  163. package/dist/elements/menu.d.ts +1 -0
  164. package/dist/elements/menu.js +1 -0
  165. package/dist/elements/message-skills.js +1 -1
  166. package/dist/elements/message.js +1 -1
  167. package/dist/elements/model-switcher.js +1 -1
  168. package/dist/elements/nav.d.ts +1 -0
  169. package/dist/elements/nav.js +1 -0
  170. package/dist/elements/notice.d.ts +1 -0
  171. package/dist/elements/notice.js +1 -0
  172. package/dist/elements/pane-group.d.ts +1 -0
  173. package/dist/elements/pane-group.js +1 -0
  174. package/dist/elements/pane.d.ts +1 -0
  175. package/dist/elements/pane.js +1 -0
  176. package/dist/elements/popover.js +1 -1
  177. package/dist/elements/progress-bar.d.ts +1 -0
  178. package/dist/elements/progress-bar.js +1 -0
  179. package/dist/elements/prompt-dock.d.ts +1 -0
  180. package/dist/elements/prompt-dock.js +1 -0
  181. package/dist/elements/prompt-input.js +1 -1
  182. package/dist/elements/prompt-suggestions.js +1 -1
  183. package/dist/elements/reasoning.js +1 -1
  184. package/dist/elements/register-impl.d.ts +0 -0
  185. package/dist/elements/register.d.ts +13 -0
  186. package/dist/elements/remote.d.ts +1 -0
  187. package/dist/elements/remote.js +1 -0
  188. package/dist/elements/resizable.js +1 -1
  189. package/dist/elements/response-stream.js +2 -2
  190. package/dist/elements/screen.d.ts +1 -0
  191. package/dist/elements/screen.js +1 -0
  192. package/dist/elements/scroll-area.d.ts +1 -0
  193. package/dist/elements/scroll-area.js +1 -0
  194. package/dist/elements/scroll-button.js +1 -1
  195. package/dist/elements/search.d.ts +1 -0
  196. package/dist/elements/search.js +1 -0
  197. package/dist/elements/segmented.d.ts +1 -0
  198. package/dist/elements/segmented.js +1 -0
  199. package/dist/elements/separator.d.ts +1 -0
  200. package/dist/elements/separator.js +1 -0
  201. package/dist/elements/setting-item.d.ts +1 -0
  202. package/dist/elements/setting-item.js +1 -0
  203. package/dist/elements/settings-group.d.ts +1 -0
  204. package/dist/elements/settings-group.js +1 -0
  205. package/dist/elements/skeleton.d.ts +1 -0
  206. package/dist/elements/skeleton.js +1 -0
  207. package/dist/elements/slots.d.ts +176 -0
  208. package/dist/elements/source.js +1 -1
  209. package/dist/elements/status.d.ts +1 -0
  210. package/dist/elements/status.js +1 -0
  211. package/dist/elements/switch.js +1 -1
  212. package/dist/elements/tabs.d.ts +1 -0
  213. package/dist/elements/tabs.js +1 -0
  214. package/dist/elements/tasks.js +1 -1
  215. package/dist/elements/text-shimmer.js +1 -1
  216. package/dist/elements/thinking-bar.js +1 -1
  217. package/dist/elements/toast.js +1 -1
  218. package/dist/elements/tool.js +1 -1
  219. package/dist/elements/tooltip.d.ts +1 -0
  220. package/dist/elements/tooltip.js +1 -0
  221. package/dist/elements/voice-input.js +1 -1
  222. package/dist/elements/voice-output.d.ts +1 -0
  223. package/dist/elements/voice-output.js +1 -0
  224. package/dist/elements.d.ts +733 -58
  225. package/dist/engine-javascript-C1x7zo1_.js +141 -0
  226. package/dist/index.d.ts +3 -2
  227. package/dist/index.js +8255 -5703
  228. package/dist/kai.es.js +1 -0
  229. package/dist/llms/llms-full.txt +1146 -64
  230. package/dist/llms/llms.txt +4 -4
  231. package/dist/mcp.es.js +62 -7
  232. package/dist/primitives/composer-model.d.ts +22 -0
  233. package/dist/primitives/composer-triggers.d.ts +19 -0
  234. package/dist/primitives/create-kai-chat.d.ts +38 -0
  235. package/dist/primitives/toast-store.d.ts +32 -2
  236. package/dist/primitives/use-speech-recognition.d.ts +26 -0
  237. package/dist/react/index.d.ts +1085 -97
  238. package/dist/react/runtime.d.ts +9 -2
  239. package/dist/react/use-kai-chat.d.ts +41 -0
  240. package/dist/react.js +572 -193
  241. package/dist/register-impl-cKscku5m.js +141 -0
  242. package/dist/schemas/tasks.schema.json +2 -2
  243. package/dist/state/index.d.ts +4 -0
  244. package/dist/state/messages.d.ts +11 -0
  245. package/dist/state/stream.d.ts +22 -0
  246. package/dist/state/suggestions.d.ts +4 -0
  247. package/dist/state.js +117 -0
  248. package/dist/theme.tokens.css +87 -0
  249. package/dist/types.d.ts +4 -0
  250. package/dist/ui/agent-card.d.ts +61 -0
  251. package/dist/ui/button.d.ts +5 -2
  252. package/dist/ui/card.d.ts +61 -0
  253. package/dist/ui/collapsible.d.ts +15 -1
  254. package/dist/ui/command.d.ts +33 -0
  255. package/dist/ui/dialog.d.ts +42 -0
  256. package/dist/ui/dropdown.d.ts +95 -1
  257. package/dist/ui/editable-label.d.ts +26 -0
  258. package/dist/ui/hover-card.d.ts +13 -1
  259. package/dist/ui/icon.d.ts +18 -0
  260. package/dist/ui/input.d.ts +33 -0
  261. package/dist/ui/kbd.d.ts +21 -0
  262. package/dist/ui/nav.d.ts +62 -0
  263. package/dist/ui/notice.d.ts +31 -0
  264. package/dist/ui/overlay.d.ts +12 -0
  265. package/dist/ui/pane-grid.d.ts +58 -0
  266. package/dist/ui/pane-group.d.ts +77 -0
  267. package/dist/ui/pane.d.ts +78 -0
  268. package/dist/ui/popover.d.ts +11 -1
  269. package/dist/ui/progress-bar.d.ts +23 -0
  270. package/dist/ui/prompt-dock.d.ts +96 -0
  271. package/dist/ui/resizable.d.ts +12 -0
  272. package/dist/ui/scroll-area.d.ts +4 -0
  273. package/dist/ui/segmented.d.ts +28 -0
  274. package/dist/ui/settings-group.d.ts +32 -0
  275. package/dist/ui/skeleton.d.ts +12 -0
  276. package/dist/ui/stat.d.ts +16 -0
  277. package/dist/ui/status.d.ts +13 -0
  278. package/dist/ui/switch.d.ts +8 -1
  279. package/dist/ui/tabs.d.ts +35 -0
  280. package/dist/ui/tooltip.d.ts +19 -1
  281. package/frameworks/react/index.tsx +1042 -157
  282. package/frameworks/react/runtime.tsx +30 -1
  283. package/frameworks/react/use-kai-chat.tsx +87 -0
  284. package/llms-full.txt +1146 -64
  285. package/llms.txt +4 -4
  286. package/package.json +31 -10
  287. package/src/agent-tooling/mcp/manifest.ts +14 -0
  288. package/src/agent-tooling/mcp/tools/debug.ts +11 -7
  289. package/src/agent-tooling/mcp/tools/reference.ts +32 -0
  290. package/src/agent-tooling/mcp/tools/scaffold.ts +30 -1
  291. package/src/components/artifact.tsx +98 -13
  292. package/src/components/attachment-types.ts +13 -0
  293. package/src/components/attachments.tsx +4 -14
  294. package/src/components/card.tsx +109 -15
  295. package/src/components/chain-of-thought.tsx +210 -1
  296. package/src/components/chat-scope-picker.tsx +13 -3
  297. package/src/components/chat-thread.tsx +225 -116
  298. package/src/components/choice-card.tsx +103 -11
  299. package/src/components/coachmark.tsx +249 -0
  300. package/src/components/component-meta.json +699 -110
  301. package/src/components/composer-dom.ts +159 -0
  302. package/src/components/composer-highlight.ts +242 -0
  303. package/src/components/composer-history.ts +82 -0
  304. package/src/components/composer.tsx +979 -0
  305. package/src/components/confirm-card.tsx +54 -1
  306. package/src/components/conversation-item.tsx +69 -7
  307. package/src/components/conversation-list.tsx +134 -37
  308. package/src/components/file-tree.tsx +197 -47
  309. package/src/components/form-widgets.tsx +9 -7
  310. package/src/components/form.tsx +140 -17
  311. package/src/components/image.tsx +3 -5
  312. package/src/components/link-preview.tsx +5 -4
  313. package/src/components/markdown.tsx +5 -2
  314. package/src/components/message.tsx +23 -4
  315. package/src/components/model-switcher.tsx +19 -4
  316. package/src/components/prompt-input.tsx +46 -75
  317. package/src/components/prompt-suggestion.tsx +48 -16
  318. package/src/components/reasoning.tsx +29 -6
  319. package/src/components/response-compare.tsx +31 -2
  320. package/src/components/screen.tsx +176 -0
  321. package/src/components/tasks-card.tsx +341 -21
  322. package/src/components/toast.tsx +119 -31
  323. package/src/components/tool-types.ts +10 -0
  324. package/src/components/tool.tsx +22 -16
  325. package/src/components/voice-input.tsx +102 -19
  326. package/src/components/voice-output.tsx +202 -0
  327. package/src/elements/agent-card.tsx +67 -0
  328. package/src/elements/artifact.tsx +53 -4
  329. package/src/elements/attachments.tsx +1 -0
  330. package/src/elements/avatar.tsx +33 -0
  331. package/src/elements/badge.tsx +32 -0
  332. package/src/elements/button.tsx +126 -0
  333. package/src/elements/card-media.jpg +0 -0
  334. package/src/elements/card.tsx +124 -31
  335. package/src/elements/cards.tsx +81 -7
  336. package/src/elements/chain-of-thought.tsx +77 -32
  337. package/src/elements/chat-scope-picker.tsx +35 -8
  338. package/src/elements/chat-types.ts +2 -2
  339. package/src/elements/chat-workspace.tsx +153 -41
  340. package/src/elements/chat.tsx +45 -23
  341. package/src/elements/choice.tsx +71 -19
  342. package/src/elements/coachmark.tsx +90 -0
  343. package/src/elements/command.tsx +209 -0
  344. package/src/elements/compare.tsx +24 -2
  345. package/src/elements/compiled.css +2 -2
  346. package/src/elements/composer.tsx +151 -0
  347. package/src/elements/confirm-card.tsx +36 -11
  348. package/src/elements/conversation-list.tsx +80 -11
  349. package/src/elements/default-input.tsx +75 -53
  350. package/src/elements/define.tsx +87 -7
  351. package/src/elements/dialog.tsx +98 -0
  352. package/src/elements/disclosure.ts +73 -0
  353. package/src/elements/editable-label.tsx +125 -0
  354. package/src/elements/element-manifest.json +129 -1
  355. package/src/elements/element-meta.json +5562 -1336
  356. package/src/elements/element-types.d.ts +732 -57
  357. package/src/elements/file-tree.tsx +12 -2
  358. package/src/elements/file-upload.tsx +1 -1
  359. package/src/elements/form.tsx +54 -11
  360. package/src/elements/hover-card.tsx +80 -0
  361. package/src/elements/icon-names.json +48 -0
  362. package/src/elements/icon.tsx +41 -0
  363. package/src/elements/input.tsx +203 -0
  364. package/src/elements/kbd.tsx +45 -0
  365. package/src/elements/menu.tsx +217 -0
  366. package/src/elements/message.tsx +58 -11
  367. package/src/elements/model-switcher.tsx +27 -1
  368. package/src/elements/nav.tsx +87 -0
  369. package/src/elements/notice.tsx +53 -0
  370. package/src/elements/pane-group.tsx +119 -0
  371. package/src/elements/pane.tsx +129 -0
  372. package/src/elements/popover.tsx +39 -17
  373. package/src/elements/progress-bar.tsx +39 -0
  374. package/src/elements/prompt-dock.tsx +81 -0
  375. package/src/elements/prompt-input.tsx +112 -63
  376. package/src/elements/prompt-suggestions.tsx +25 -9
  377. package/src/elements/reasoning.tsx +30 -9
  378. package/src/elements/register-impl.ts +38 -3
  379. package/src/elements/register.ts +11 -3
  380. package/src/elements/resizable.tsx +48 -11
  381. package/src/elements/screen.tsx +90 -0
  382. package/src/elements/scroll-area.tsx +33 -0
  383. package/src/elements/search.tsx +180 -0
  384. package/src/elements/segmented.tsx +135 -0
  385. package/src/elements/separator.tsx +36 -0
  386. package/src/elements/setting-item.tsx +50 -0
  387. package/src/elements/settings-group.tsx +37 -0
  388. package/src/elements/skeleton.tsx +45 -0
  389. package/src/elements/slots.ts +607 -0
  390. package/src/elements/source.tsx +13 -6
  391. package/src/elements/status.tsx +42 -0
  392. package/src/elements/switch.tsx +89 -14
  393. package/src/elements/tabs.tsx +95 -0
  394. package/src/elements/tasks.tsx +70 -14
  395. package/src/elements/toast.tsx +17 -2
  396. package/src/elements/tool.tsx +43 -9
  397. package/src/elements/tooltip.tsx +85 -0
  398. package/src/elements/video-poster.jpg +0 -0
  399. package/src/elements/voice-input.tsx +66 -16
  400. package/src/elements/voice-output.tsx +69 -0
  401. package/src/index.ts +5 -2
  402. package/src/primitives/card-schemas/tasks.schema.json +2 -2
  403. package/src/primitives/composer-model.ts +49 -0
  404. package/src/primitives/composer-triggers.ts +35 -0
  405. package/src/primitives/create-kai-chat.ts +66 -0
  406. package/src/primitives/toast-store.ts +43 -2
  407. package/src/primitives/use-speech-recognition.ts +135 -0
  408. package/src/state/index.ts +6 -0
  409. package/src/state/messages.ts +36 -0
  410. package/src/state/stream.ts +92 -0
  411. package/src/state/suggestions.ts +9 -0
  412. package/src/types.ts +4 -0
  413. package/src/ui/agent-card.tsx +218 -0
  414. package/src/ui/button.tsx +16 -5
  415. package/src/ui/card.tsx +245 -0
  416. package/src/ui/collapsible.tsx +30 -4
  417. package/src/ui/command.tsx +99 -0
  418. package/src/ui/dialog.tsx +217 -0
  419. package/src/ui/dropdown.tsx +375 -13
  420. package/src/ui/editable-label.tsx +112 -0
  421. package/src/ui/hover-card.tsx +28 -5
  422. package/src/ui/icon.tsx +110 -0
  423. package/src/ui/input.tsx +132 -0
  424. package/src/ui/kbd.tsx +118 -0
  425. package/src/ui/nav.tsx +282 -0
  426. package/src/ui/notice.tsx +84 -0
  427. package/src/ui/overlay.tsx +108 -2
  428. package/src/ui/pane-grid.tsx +117 -0
  429. package/src/ui/pane-group.tsx +291 -0
  430. package/src/ui/pane.tsx +193 -0
  431. package/src/ui/popover.tsx +16 -2
  432. package/src/ui/progress-bar.tsx +83 -0
  433. package/src/ui/prompt-dock.tsx +145 -0
  434. package/src/ui/resizable.tsx +69 -1
  435. package/src/ui/scroll-area.tsx +14 -3
  436. package/src/ui/segmented.tsx +109 -0
  437. package/src/ui/settings-group.tsx +67 -0
  438. package/src/ui/skeleton.tsx +62 -5
  439. package/src/ui/stat.tsx +41 -0
  440. package/src/ui/status.tsx +48 -0
  441. package/src/ui/switch.tsx +49 -23
  442. package/src/ui/tabs.tsx +168 -0
  443. package/src/ui/tooltip.tsx +52 -8
  444. package/theme.css +113 -0
  445. package/dist/components/slash-command.d.ts +0 -15
  446. package/dist/elements/chunks/Icon-D_Zmwmwh.js +0 -1
  447. package/dist/elements/chunks/action-icons-PVfIvcuG.js +0 -1
  448. package/dist/elements/chunks/attachments-Dp6vqtrc.js +0 -1
  449. package/dist/elements/chunks/button-CKyYD9G4.js +0 -1
  450. package/dist/elements/chunks/card-Cjho-PYk.js +0 -1
  451. package/dist/elements/chunks/chat-thread-RT808iPf.js +0 -1
  452. package/dist/elements/chunks/check-CDYaMYrM.js +0 -1
  453. package/dist/elements/chunks/chevron-down-3SBiq8HF.js +0 -1
  454. package/dist/elements/chunks/chevron-right-k2UFlIVK.js +0 -1
  455. package/dist/elements/chunks/cn-Dogu6PbV.js +0 -1
  456. package/dist/elements/chunks/code-block-BYUmfFSd.js +0 -1
  457. package/dist/elements/chunks/collapsible-BiNwdOn6.js +0 -1
  458. package/dist/elements/chunks/context-18g6oi4J.js +0 -1
  459. package/dist/elements/chunks/conversation-list-D9Y0NVdo.js +0 -1
  460. package/dist/elements/chunks/default-input-CSAoYYMd.js +0 -1
  461. package/dist/elements/chunks/download-D8K0Je8r.js +0 -1
  462. package/dist/elements/chunks/dropdown-bUs2iTia.js +0 -1
  463. package/dist/elements/chunks/external-link-6mA0wxab.js +0 -1
  464. package/dist/elements/chunks/file-text-DnaYk3Dm.js +0 -1
  465. package/dist/elements/chunks/file-tree-CgtRLlxK.js +0 -1
  466. package/dist/elements/chunks/hover-card-CIGw62gP.js +0 -1
  467. package/dist/elements/chunks/link-BlGSeoPy.js +0 -1
  468. package/dist/elements/chunks/loader-DvhR4qa0.js +0 -1
  469. package/dist/elements/chunks/message-CDZwXjhL.js +0 -1
  470. package/dist/elements/chunks/message-feedback-CYx81QiA.js +0 -1
  471. package/dist/elements/chunks/model-switcher-O_tUhoOT.js +0 -1
  472. package/dist/elements/chunks/overlay-DydXYMQW.js +0 -1
  473. package/dist/elements/chunks/prompt-suggestion-ldlWV5kd.js +0 -1
  474. package/dist/elements/chunks/reasoning-2PUnHlmr.js +0 -1
  475. package/dist/elements/chunks/resizable-B5WNbSeb.js +0 -1
  476. package/dist/elements/chunks/star-t9tI-P0q.js +0 -1
  477. package/dist/elements/chunks/store-C6rIooZz.js +0 -1
  478. package/dist/elements/chunks/text-shimmer-uh9V_KUh.js +0 -1
  479. package/dist/elements/chunks/textarea-3nm6Ia9U.js +0 -1
  480. package/dist/elements/chunks/thumbs-up-BBtguGld.js +0 -1
  481. package/dist/elements/chunks/toast-store-D8cL3fWl.js +0 -1
  482. package/dist/elements/chunks/tool-GJ3vwp1U.js +0 -1
  483. package/dist/elements/chunks/tooltip-DwKAz4XR.js +0 -1
  484. package/dist/elements/chunks/triangle-alert-Ct1zt2JL.js +0 -1
  485. package/dist/elements/chunks/use-card-resolution-D-_0Alzy.js +0 -1
  486. package/dist/elements/chunks/video-mVYiM99-.js +0 -1
  487. package/dist/elements/chunks/x-CzxL27Ch.js +0 -1
  488. package/dist/kitn-chat.es.js +0 -1
  489. package/dist/register-JyTglR6m.js +0 -1
  490. package/dist/register-impl-C6wlSsts.js +0 -77
  491. package/src/components/slash-command.tsx +0 -232
  492. package/src/elements/framework-usage.json +0 -588
  493. /package/dist/{kitn-chat-provider.d.ts → kai-provider.d.ts} +0 -0
  494. /package/dist/{kitn-chat-provider.es.js → kai-provider.es.js} +0 -0
package/README.md CHANGED
@@ -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
@@ -70,14 +70,14 @@ The element bundle is a self-contained ES module — load it directly from [jsDe
70
70
 
71
71
  ```html
72
72
  <script type="module">
73
- import 'https://cdn.jsdelivr.net/npm/@kitn.ai/ui/dist/kitn-chat.es.js';
74
- // …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';
75
75
  </script>
76
76
 
77
77
  <kai-chat></kai-chat>
78
78
  ```
79
79
 
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/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`:
81
81
 
82
82
  ```html
83
83
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@kitn.ai/ui/theme.css">
@@ -266,6 +266,29 @@ You can trigger either option from the streaming completion (auto-read replies)
266
266
 
267
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`).
268
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
+
269
292
  ## Code highlighting (optional, on-demand)
270
293
 
271
294
  Syntax highlighting uses [Shiki](https://shiki.style) and is wired to be as light as possible:
@@ -358,7 +381,7 @@ A set of runnable examples and a hosted component playground are included in the
358
381
  The composable showcase demonstrates every individual element in one page. Build the package first, then serve from the repo root:
359
382
 
360
383
  ```bash
361
- npm run build # produces dist/kitn-chat.es.js
384
+ npm run build # produces dist/kai.es.js
362
385
  npm run examples # static server at http://localhost:8000
363
386
  ```
364
387
 
@@ -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,6 +1,7 @@
1
+ import { ComposerDoc } from '../primitives/composer-model';
1
2
  import { AttachmentData } from './attachments';
2
3
  import { MessageActionDetail } from '../primitives/message-feedback';
3
- import { SlashCommandItem } from './slash-command';
4
+ import { TriggerDef } from './composer';
4
5
  import { ChatMessage } from '../elements/chat-types';
5
6
  import { ProseSize } from '../primitives/chat-config';
6
7
  import { ModelOption } from '../types';
@@ -18,9 +19,10 @@ export interface ChatThreadProps {
18
19
  * content, and optional reasoning/tools/attachments/actions. Set as a JS
19
20
  * property (`el.messages = [...]`). */
20
21
  messages: ChatMessage[];
21
- /** Controlled value of the input. When set, the host owns the input text and
22
- * must update it on `kai-value-change`; leave unset for uncontrolled behavior. */
23
- 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;
24
26
  /** Placeholder text shown in the empty input. */
25
27
  placeholder?: string;
26
28
  /** When true, shows the loading/streaming state and disables submit (use while
@@ -62,17 +64,29 @@ export interface ChatThreadProps {
62
64
  headerStart?: boolean;
63
65
  /** Whether the host has `slot="header-end"` content (right of the controls). */
64
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;
65
80
  /** Show a Search (Globe) button in the input toolbar; fires a `search` event. */
66
81
  search?: boolean;
67
82
  /** Show a Voice (Mic) button in the input toolbar; fires a `voice` event. */
68
83
  voice?: boolean;
69
- /** Slash commandswhen set, typing `/` in the input opens the command
70
- * palette and fires `kai-slash-select`. Set as a JS property. */
71
- slashCommands?: SlashCommandItem[];
72
- /** Command ids to highlight as active in the palette. */
73
- slashActiveIds?: string[];
74
- /** Single-line palette rows. */
75
- 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>;
76
90
  /** Whether each message's action bar is always visible (`'always'`, default)
77
91
  * or only revealed on hover of that message row (`'hover'`). */
78
92
  actionsReveal?: 'always' | 'hover';
@@ -81,11 +95,22 @@ export interface ChatThreadProps {
81
95
  value: string;
82
96
  attachments: AttachmentData[];
83
97
  }) => void;
98
+ onAttachmentsChange?: (attachments: AttachmentData[]) => void;
84
99
  onSuggestionClick?: (value: string) => void;
85
100
  onModelChange?: (modelId: string) => void;
86
101
  onMessageAction?: (detail: MessageActionDetail) => void;
87
102
  onSearch?: () => void;
88
103
  onVoice?: () => void;
89
- 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;
90
115
  }
91
116
  export declare function ChatThread(props: ChatThreadProps): import("solid-js").JSX.Element;
@@ -47,6 +47,21 @@ export declare function resolveOtherConfig(allowOther: ChoiceAllowOther | undefi
47
47
  export declare function nextEnabledIndex(options: ChoiceOption[], from: number, dir: 1 | -1): number;
48
48
  /** The first non-disabled option index (the initial roving tab stop), or -1. */
49
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
+ }
50
65
  export interface ChoiceCardProps {
51
66
  /** The choice definition (CardEnvelope.data). */
52
67
  data?: ChoiceCardData;
@@ -62,6 +77,17 @@ export interface ChoiceCardProps {
62
77
  class?: string;
63
78
  /** When set, render the chromed read-only view instead of the interactive radiogroup. */
64
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;
65
91
  }
66
92
  /**
67
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;
@@ -0,0 +1,48 @@
1
+ import { HighlightRule } from './composer';
2
+ export interface HighlightMatch {
3
+ start: number;
4
+ end: number;
5
+ class: string | undefined;
6
+ }
7
+ /**
8
+ * Find all non-overlapping highlight ranges in `text` for the given rules.
9
+ *
10
+ * - A string rule is matched as a case-insensitive literal (regex metachars are escaped).
11
+ * - An object rule uses `new RegExp(pattern, flags ?? 'gi')`.
12
+ * - Overlapping ranges are resolved in earliest-start order; later ranges that
13
+ * overlap an already-claimed span are dropped.
14
+ * - Zero-width matches are skipped to avoid infinite loops.
15
+ * - Returns `[]` when nothing matches.
16
+ */
17
+ export declare function findHighlightMatches(text: string, rules: HighlightRule[]): HighlightMatch[];
18
+ declare global {
19
+ interface CSSNamespace {
20
+ highlights?: HighlightRegistry;
21
+ }
22
+ interface HighlightRegistry {
23
+ set(name: string, highlight: CSSHighlight): void;
24
+ delete(name: string): boolean;
25
+ has(name: string): boolean;
26
+ }
27
+ class CSSHighlight {
28
+ constructor(...ranges: Range[]);
29
+ }
30
+ }
31
+ /**
32
+ * Feature-detect whether the CSS Custom Highlight API is available in the
33
+ * current environment. Returns false in jsdom (decoration no-op).
34
+ */
35
+ export declare function supportsHighlightAPI(): boolean;
36
+ /**
37
+ * Apply highlight matches to a contenteditable element using the CSS Custom
38
+ * Highlight API. Maps text offsets (ZWSP-stripped concatenated text) to DOM
39
+ * Ranges spanning across text nodes, builds a `Highlight`, and registers it.
40
+ *
41
+ * If the API is unavailable (jsdom, older browsers), this is a strict no-op.
42
+ *
43
+ * @param root The contenteditable element.
44
+ * @param matches Pre-computed non-overlapping `{start, end}` ranges.
45
+ * @param zwsp The ZWSP character used in the editable (passed to avoid
46
+ * a circular import; callers pass ZWSP from composer-dom).
47
+ */
48
+ export declare function applyHighlights(root: HTMLElement, matches: HighlightMatch[], zwsp: string, name?: string): void;
@@ -0,0 +1,34 @@
1
+ import { ComposerDoc } from '../primitives/composer-model';
2
+ /**
3
+ * Undo/redo history for the composer.
4
+ *
5
+ * The browser's native contenteditable undo stack can't track our programmatic
6
+ * pill insertion/deletion — it leaves pills stuck and replays text edits against
7
+ * a DOM we changed underneath it, corrupting the content. So we own the history:
8
+ * a stack of document-model snapshots. Restoring a snapshot re-renders the doc
9
+ * (pills included, since each snapshot holds full EntityRefs) and the caret.
10
+ *
11
+ * Pure module — no DOM. The caller computes `coalesce` (true to merge a run of
12
+ * consecutive typing into one undo step; false for a structural edit like a pill
13
+ * insert/delete, which gets its own step).
14
+ */
15
+ export interface Snapshot {
16
+ doc: ComposerDoc;
17
+ caret: number;
18
+ }
19
+ export interface ComposerHistory {
20
+ /** Record a new state. `coalesce` merges it into the current entry instead of
21
+ * pushing a new one (used for consecutive typing). */
22
+ record(snap: Snapshot, coalesce: boolean): void;
23
+ /** Step back; returns the snapshot to restore, or null if nothing to undo. */
24
+ undo(): Snapshot | null;
25
+ /** Step forward; returns the snapshot to restore, or null if nothing to redo. */
26
+ redo(): Snapshot | null;
27
+ /** Replace all history with a single baseline entry (e.g. external value set). */
28
+ reset(snap: Snapshot): void;
29
+ canUndo(): boolean;
30
+ canRedo(): boolean;
31
+ /** Current entry count (for tests/debugging). */
32
+ size(): number;
33
+ }
34
+ export declare function createHistory(initial: Snapshot, limit?: number): ComposerHistory;