@kitn.ai/ui 0.14.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 (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +394 -0
  3. package/dist/bash-InADTalH.js +1 -0
  4. package/dist/core-AYMC6_lb.js +12 -0
  5. package/dist/css-M7EaDHN_.js +1 -0
  6. package/dist/custom-elements.json +4739 -0
  7. package/dist/engine-javascript-vq0WuIJl.js +141 -0
  8. package/dist/github-dark-dimmed-DUshB20C.js +1 -0
  9. package/dist/github-light-JYsPkUQd.js +1 -0
  10. package/dist/host-embed.d.ts +33 -0
  11. package/dist/html-CPZ3oZQ7.js +1 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/javascript-C25yR2R2.js +1 -0
  14. package/dist/json-DxJze_jm.js +1 -0
  15. package/dist/kitn-chat-provider.d.ts +2 -0
  16. package/dist/kitn-chat-provider.es.js +240 -0
  17. package/dist/kitn-chat.es.js +77 -0
  18. package/dist/llms/llms-full.txt +1018 -0
  19. package/dist/llms/llms.txt +104 -0
  20. package/dist/origin.d.ts +5 -0
  21. package/dist/provider-runtime.d.ts +27 -0
  22. package/dist/schemas/card-envelope.schema.json +14 -0
  23. package/dist/schemas/card-event.schema.json +12 -0
  24. package/dist/schemas/choice.schema.json +70 -0
  25. package/dist/schemas/confirm.schema.json +65 -0
  26. package/dist/schemas/embed.schema.json +65 -0
  27. package/dist/schemas/form.result.schema.json +7 -0
  28. package/dist/schemas/form.schema.json +33 -0
  29. package/dist/schemas/link.schema.json +56 -0
  30. package/dist/schemas/tasks.result.schema.json +16 -0
  31. package/dist/schemas/tasks.schema.json +78 -0
  32. package/dist/svelte--5p79yCD.js +1 -0
  33. package/dist/theme.tokens.css +176 -0
  34. package/dist/tsx-B8rCNbgL.js +1 -0
  35. package/dist/typescript-RycA9KXf.js +1 -0
  36. package/dist/validate.d.ts +4 -0
  37. package/dist/version.d.ts +4 -0
  38. package/dist/vue-BmIZj4XD.js +1 -0
  39. package/dist/wire.d.ts +53 -0
  40. package/frameworks/react/index.tsx +948 -0
  41. package/frameworks/react/runtime.tsx +94 -0
  42. package/llms-full.txt +1018 -0
  43. package/llms.txt +104 -0
  44. package/package.json +141 -0
  45. package/src/components/artifact.stories.tsx +138 -0
  46. package/src/components/artifact.tsx +743 -0
  47. package/src/components/attachments.stories.tsx +303 -0
  48. package/src/components/attachments.test.tsx +64 -0
  49. package/src/components/attachments.tsx +399 -0
  50. package/src/components/card-fallback.tsx +28 -0
  51. package/src/components/card-renderer.tsx +52 -0
  52. package/src/components/card.tsx +110 -0
  53. package/src/components/chain-of-thought.stories.tsx +211 -0
  54. package/src/components/chain-of-thought.tsx +139 -0
  55. package/src/components/chat-container.stories.tsx +187 -0
  56. package/src/components/chat-container.tsx +82 -0
  57. package/src/components/chat-scope-picker.tsx +47 -0
  58. package/src/components/chat-thread.test.tsx +58 -0
  59. package/src/components/chat-thread.tsx +249 -0
  60. package/src/components/checkpoint.stories.tsx +102 -0
  61. package/src/components/checkpoint.tsx +88 -0
  62. package/src/components/choice-card.tsx +569 -0
  63. package/src/components/code-block.stories.tsx +150 -0
  64. package/src/components/code-block.tsx +105 -0
  65. package/src/components/component-meta.json +3735 -0
  66. package/src/components/confirm-card.stories.tsx +74 -0
  67. package/src/components/confirm-card.tsx +315 -0
  68. package/src/components/context.stories.tsx +229 -0
  69. package/src/components/context.test.tsx +133 -0
  70. package/src/components/context.tsx +363 -0
  71. package/src/components/conversation-item.stories.tsx +125 -0
  72. package/src/components/conversation-item.tsx +16 -0
  73. package/src/components/conversation-list.stories.tsx +133 -0
  74. package/src/components/conversation-list.tsx +101 -0
  75. package/src/components/default-input.test.tsx +111 -0
  76. package/src/components/embed.tsx +196 -0
  77. package/src/components/empty.stories.tsx +434 -0
  78. package/src/components/empty.tsx +166 -0
  79. package/src/components/feedback-bar.stories.tsx +138 -0
  80. package/src/components/feedback-bar.test.tsx +103 -0
  81. package/src/components/feedback-bar.tsx +166 -0
  82. package/src/components/file-tree.stories.tsx +73 -0
  83. package/src/components/file-tree.tsx +383 -0
  84. package/src/components/file-upload.stories.tsx +156 -0
  85. package/src/components/file-upload.tsx +161 -0
  86. package/src/components/form-widgets.tsx +461 -0
  87. package/src/components/form.tsx +873 -0
  88. package/src/components/image.stories.tsx +89 -0
  89. package/src/components/image.tsx +67 -0
  90. package/src/components/link-preview.tsx +194 -0
  91. package/src/components/loader.stories.tsx +181 -0
  92. package/src/components/loader.tsx +333 -0
  93. package/src/components/markdown.stories.tsx +180 -0
  94. package/src/components/markdown.tsx +81 -0
  95. package/src/components/message-action-bar.test.tsx +128 -0
  96. package/src/components/message-narrow.stories.tsx +329 -0
  97. package/src/components/message-skills.stories.tsx +211 -0
  98. package/src/components/message-skills.tsx +36 -0
  99. package/src/components/message.stories.tsx +281 -0
  100. package/src/components/message.tsx +227 -0
  101. package/src/components/model-switcher.stories.tsx +123 -0
  102. package/src/components/model-switcher.test.tsx +65 -0
  103. package/src/components/model-switcher.tsx +87 -0
  104. package/src/components/prompt-input.stories.tsx +222 -0
  105. package/src/components/prompt-input.tsx +211 -0
  106. package/src/components/prompt-suggestion.stories.tsx +142 -0
  107. package/src/components/prompt-suggestion.tsx +115 -0
  108. package/src/components/reasoning.stories.tsx +140 -0
  109. package/src/components/reasoning.tsx +156 -0
  110. package/src/components/resizable.test.tsx +226 -0
  111. package/src/components/response-stream.tsx +103 -0
  112. package/src/components/scroll-button.stories.tsx +100 -0
  113. package/src/components/scroll-button.tsx +34 -0
  114. package/src/components/slash-command.stories.tsx +163 -0
  115. package/src/components/slash-command.tsx +232 -0
  116. package/src/components/source-list.test.tsx +152 -0
  117. package/src/components/source.stories.tsx +124 -0
  118. package/src/components/source.tsx +129 -0
  119. package/src/components/tasks-card.stories.tsx +78 -0
  120. package/src/components/tasks-card.tsx +432 -0
  121. package/src/components/text-shimmer.stories.tsx +87 -0
  122. package/src/components/text-shimmer.tsx +37 -0
  123. package/src/components/thinking-bar.stories.tsx +87 -0
  124. package/src/components/thinking-bar.tsx +50 -0
  125. package/src/components/tool.stories.tsx +153 -0
  126. package/src/components/tool.tsx +184 -0
  127. package/src/components/use-card-resolution.ts +28 -0
  128. package/src/components/voice-input.stories.tsx +83 -0
  129. package/src/components/voice-input.tsx +107 -0
  130. package/src/elements/artifact.stories.tsx +506 -0
  131. package/src/elements/artifact.tsx +137 -0
  132. package/src/elements/attachments.stories.tsx +190 -0
  133. package/src/elements/attachments.tsx +136 -0
  134. package/src/elements/card.stories.tsx +113 -0
  135. package/src/elements/card.tsx +40 -0
  136. package/src/elements/cards.stories.tsx +59 -0
  137. package/src/elements/cards.tsx +97 -0
  138. package/src/elements/catalog.stories.tsx +491 -0
  139. package/src/elements/chain-of-thought.declarative.test.tsx +153 -0
  140. package/src/elements/chain-of-thought.stories.tsx +113 -0
  141. package/src/elements/chain-of-thought.tsx +92 -0
  142. package/src/elements/chat-scope-picker.stories.tsx +73 -0
  143. package/src/elements/chat-scope-picker.tsx +36 -0
  144. package/src/elements/chat-types.ts +42 -0
  145. package/src/elements/chat-workspace.stories.tsx +288 -0
  146. package/src/elements/chat-workspace.tsx +161 -0
  147. package/src/elements/chat.stories.tsx +151 -0
  148. package/src/elements/chat.tsx +80 -0
  149. package/src/elements/checkpoint.stories.tsx +72 -0
  150. package/src/elements/checkpoint.tsx +47 -0
  151. package/src/elements/choice.stories.tsx +240 -0
  152. package/src/elements/choice.tsx +48 -0
  153. package/src/elements/code-block.stories.tsx +83 -0
  154. package/src/elements/code-block.tsx +42 -0
  155. package/src/elements/compiled.css +2 -0
  156. package/src/elements/composed-shell.stories.tsx +316 -0
  157. package/src/elements/confirm-card.stories.tsx +227 -0
  158. package/src/elements/confirm-card.tsx +51 -0
  159. package/src/elements/context-meter.stories.tsx +151 -0
  160. package/src/elements/context-meter.tsx +121 -0
  161. package/src/elements/conversation-list.declarative.test.tsx +137 -0
  162. package/src/elements/conversation-list.stories.tsx +243 -0
  163. package/src/elements/conversation-list.tsx +80 -0
  164. package/src/elements/css.ts +5 -0
  165. package/src/elements/default-input.tsx +247 -0
  166. package/src/elements/define.tsx +171 -0
  167. package/src/elements/element-meta.json +3314 -0
  168. package/src/elements/element-types.d.ts +710 -0
  169. package/src/elements/embed.stories.tsx +213 -0
  170. package/src/elements/embed.tsx +35 -0
  171. package/src/elements/empty.stories.tsx +111 -0
  172. package/src/elements/empty.tsx +29 -0
  173. package/src/elements/feedback-bar.stories.tsx +114 -0
  174. package/src/elements/feedback-bar.tsx +61 -0
  175. package/src/elements/file-tree.stories.tsx +134 -0
  176. package/src/elements/file-tree.tsx +52 -0
  177. package/src/elements/file-upload.stories.tsx +82 -0
  178. package/src/elements/file-upload.tsx +44 -0
  179. package/src/elements/form.stories.tsx +248 -0
  180. package/src/elements/form.tsx +43 -0
  181. package/src/elements/framework-usage.json +563 -0
  182. package/src/elements/image.stories.tsx +71 -0
  183. package/src/elements/image.tsx +32 -0
  184. package/src/elements/link-preview.stories.tsx +209 -0
  185. package/src/elements/link-preview.tsx +34 -0
  186. package/src/elements/loader.stories.tsx +88 -0
  187. package/src/elements/loader.tsx +25 -0
  188. package/src/elements/markdown.stories.tsx +76 -0
  189. package/src/elements/markdown.tsx +38 -0
  190. package/src/elements/message-skills.declarative.test.tsx +104 -0
  191. package/src/elements/message-skills.stories.tsx +114 -0
  192. package/src/elements/message-skills.tsx +85 -0
  193. package/src/elements/message.stories.tsx +218 -0
  194. package/src/elements/message.tsx +162 -0
  195. package/src/elements/model-switcher.declarative.test.tsx +130 -0
  196. package/src/elements/model-switcher.stories.tsx +198 -0
  197. package/src/elements/model-switcher.tsx +93 -0
  198. package/src/elements/popover.stories.tsx +80 -0
  199. package/src/elements/popover.tsx +59 -0
  200. package/src/elements/prompt-input-slash-command.test.tsx +128 -0
  201. package/src/elements/prompt-input-stoppable.test.tsx +88 -0
  202. package/src/elements/prompt-input-toolbar-actions.test.tsx +120 -0
  203. package/src/elements/prompt-input.stories.tsx +331 -0
  204. package/src/elements/prompt-input.tsx +185 -0
  205. package/src/elements/prompt-suggestions.declarative.test.tsx +164 -0
  206. package/src/elements/prompt-suggestions.stories.tsx +213 -0
  207. package/src/elements/prompt-suggestions.tsx +94 -0
  208. package/src/elements/reasoning.stories.tsx +77 -0
  209. package/src/elements/reasoning.tsx +50 -0
  210. package/src/elements/register.ts +56 -0
  211. package/src/elements/remote.stories.tsx +314 -0
  212. package/src/elements/remote.tsx +221 -0
  213. package/src/elements/resizable.d.ts +27 -0
  214. package/src/elements/resizable.stories.tsx +426 -0
  215. package/src/elements/resizable.tsx +553 -0
  216. package/src/elements/response-stream.stories.tsx +79 -0
  217. package/src/elements/response-stream.tsx +40 -0
  218. package/src/elements/scroll-button.stories.tsx +202 -0
  219. package/src/elements/scroll-button.test.tsx +148 -0
  220. package/src/elements/scroll-button.tsx +126 -0
  221. package/src/elements/source-list.stories.tsx +143 -0
  222. package/src/elements/source.stories.tsx +88 -0
  223. package/src/elements/source.tsx +120 -0
  224. package/src/elements/styles.css +199 -0
  225. package/src/elements/switch.stories.tsx +56 -0
  226. package/src/elements/switch.tsx +43 -0
  227. package/src/elements/tasks.stories.tsx +237 -0
  228. package/src/elements/tasks.tsx +46 -0
  229. package/src/elements/text-shimmer.stories.tsx +64 -0
  230. package/src/elements/text-shimmer.tsx +28 -0
  231. package/src/elements/thinking-bar.stories.tsx +72 -0
  232. package/src/elements/thinking-bar.tsx +34 -0
  233. package/src/elements/tool.stories.tsx +89 -0
  234. package/src/elements/tool.tsx +23 -0
  235. package/src/elements/voice-input.stories.tsx +88 -0
  236. package/src/elements/voice-input.tsx +41 -0
  237. package/src/index.ts +253 -0
  238. package/src/primitives/card-contract.ts +71 -0
  239. package/src/primitives/card-host.tsx +35 -0
  240. package/src/primitives/card-registry.tsx +67 -0
  241. package/src/primitives/card-resolution.ts +36 -0
  242. package/src/primitives/card-routing.ts +79 -0
  243. package/src/primitives/card-schemas/card-envelope.schema.json +14 -0
  244. package/src/primitives/card-schemas/card-event.schema.json +12 -0
  245. package/src/primitives/card-schemas/choice.schema.json +70 -0
  246. package/src/primitives/card-schemas/confirm.schema.json +65 -0
  247. package/src/primitives/card-schemas/embed.schema.json +65 -0
  248. package/src/primitives/card-schemas/form.result.schema.json +7 -0
  249. package/src/primitives/card-schemas/form.schema.json +33 -0
  250. package/src/primitives/card-schemas/link.schema.json +56 -0
  251. package/src/primitives/card-schemas/tasks.result.schema.json +16 -0
  252. package/src/primitives/card-schemas/tasks.schema.json +78 -0
  253. package/src/primitives/card-validate.ts +95 -0
  254. package/src/primitives/chat-config.tsx +76 -0
  255. package/src/primitives/controllable.test.ts +47 -0
  256. package/src/primitives/controllable.ts +21 -0
  257. package/src/primitives/embed-providers.ts +254 -0
  258. package/src/primitives/highlighter.ts +157 -0
  259. package/src/primitives/link-preview.ts +87 -0
  260. package/src/primitives/pdf-preview.ts +121 -0
  261. package/src/primitives/use-auto-resize.ts +31 -0
  262. package/src/primitives/use-resize-observer.ts +12 -0
  263. package/src/primitives/use-stick-to-bottom.ts +43 -0
  264. package/src/primitives/use-text-stream.ts +112 -0
  265. package/src/primitives/use-voice-recorder.ts +50 -0
  266. package/src/remote/host-embed.ts +345 -0
  267. package/src/remote/index.ts +2 -0
  268. package/src/remote/origin.ts +30 -0
  269. package/src/remote/provider-runtime.ts +259 -0
  270. package/src/remote/provider.ts +2 -0
  271. package/src/remote/validate.ts +22 -0
  272. package/src/remote/version.ts +12 -0
  273. package/src/remote/wire.ts +48 -0
  274. package/src/stories/chat-panel-layout.stories.tsx +145 -0
  275. package/src/stories/chat-scene.tsx +571 -0
  276. package/src/stories/checkpoint-restore.stories.tsx +256 -0
  277. package/src/stories/context-usage.stories.tsx +212 -0
  278. package/src/stories/conversation-with-reasoning.stories.tsx +182 -0
  279. package/src/stories/conversation-with-sources.stories.tsx +471 -0
  280. package/src/stories/docs/Accessibility.mdx +119 -0
  281. package/src/stories/docs/ChildElements.mdx +269 -0
  282. package/src/stories/docs/ForAIAgents.mdx +162 -0
  283. package/src/stories/docs/GettingStarted.mdx +65 -0
  284. package/src/stories/docs/Installation.mdx +83 -0
  285. package/src/stories/docs/Introduction.mdx +50 -0
  286. package/src/stories/docs/SolidJsAdvanced.mdx +17 -0
  287. package/src/stories/docs/Theming.mdx +85 -0
  288. package/src/stories/docs/element-controls.ts +121 -0
  289. package/src/stories/docs/frameworks/Angular.mdx +245 -0
  290. package/src/stories/docs/frameworks/Html.mdx +227 -0
  291. package/src/stories/docs/frameworks/Overview.mdx +47 -0
  292. package/src/stories/docs/frameworks/React.mdx +227 -0
  293. package/src/stories/docs/frameworks/Solid.mdx +173 -0
  294. package/src/stories/docs/frameworks/Svelte.mdx +194 -0
  295. package/src/stories/docs/frameworks/Vue.mdx +238 -0
  296. package/src/stories/docs/generative-ui-overview.mdx +186 -0
  297. package/src/stories/docs/recipes/SpeechToText.mdx +7 -0
  298. package/src/stories/docs/recipes/Streaming.mdx +68 -0
  299. package/src/stories/docs/recipes/TextToSpeech.mdx +35 -0
  300. package/src/stories/docs/theme-editor/canvas.tsx +32 -0
  301. package/src/stories/docs/theme-editor/inspector.tsx +66 -0
  302. package/src/stories/docs/theme-editor/presets.test.ts +32 -0
  303. package/src/stories/docs/theme-editor/presets.ts +64 -0
  304. package/src/stories/docs/theme-editor/theme-css.test.ts +19 -0
  305. package/src/stories/docs/theme-editor/theme-css.ts +15 -0
  306. package/src/stories/docs/theme-editor/theme-editor.tsx +146 -0
  307. package/src/stories/docs/theme-tokens.tsx +174 -0
  308. package/src/stories/examples/ChoosingComponents.mdx +106 -0
  309. package/src/stories/examples/sample-data.ts +79 -0
  310. package/src/stories/examples/usage/checkpoint-restore.ts +156 -0
  311. package/src/stories/examples/usage/context-usage.ts +591 -0
  312. package/src/stories/examples/usage/conversation-with-reasoning.ts +224 -0
  313. package/src/stories/examples/usage/conversation-with-sources.ts +589 -0
  314. package/src/stories/examples/usage/empty-state.ts +144 -0
  315. package/src/stories/examples/usage/full-chat-app.ts +277 -0
  316. package/src/stories/examples/usage/index.ts +63 -0
  317. package/src/stories/examples/usage/message-actions.ts +704 -0
  318. package/src/stories/examples/usage/pattern-centered-conversation.ts +446 -0
  319. package/src/stories/examples/usage/pattern-chat-panel-layout.ts +442 -0
  320. package/src/stories/examples/usage/pattern-docked-widget.ts +479 -0
  321. package/src/stories/examples/usage/prompt-input-variants.ts +1356 -0
  322. package/src/stories/examples/usage/streaming-response.ts +687 -0
  323. package/src/stories/examples/usage/types.ts +33 -0
  324. package/src/stories/full-chat.stories.tsx +18 -0
  325. package/src/stories/message-actions.stories.tsx +230 -0
  326. package/src/stories/pattern-centered-conversation.stories.tsx +93 -0
  327. package/src/stories/pattern-docked-widget.stories.tsx +93 -0
  328. package/src/stories/pattern-empty-state.stories.tsx +76 -0
  329. package/src/stories/prompt-input-variants.stories.tsx +456 -0
  330. package/src/stories/streaming-response.stories.tsx +438 -0
  331. package/src/stories/theme-editor.stories.tsx +16 -0
  332. package/src/stories/token-reference.stories.tsx +18 -0
  333. package/src/stories/typography.stories.tsx +78 -0
  334. package/src/types.ts +47 -0
  335. package/src/ui/action-icons.ts +52 -0
  336. package/src/ui/avatar.stories.tsx +103 -0
  337. package/src/ui/avatar.tsx +23 -0
  338. package/src/ui/badge.stories.tsx +86 -0
  339. package/src/ui/badge.tsx +21 -0
  340. package/src/ui/button.stories.tsx +145 -0
  341. package/src/ui/button.tsx +38 -0
  342. package/src/ui/collapsible.stories.tsx +69 -0
  343. package/src/ui/collapsible.tsx +125 -0
  344. package/src/ui/dropdown.stories.tsx +59 -0
  345. package/src/ui/dropdown.tsx +196 -0
  346. package/src/ui/hover-card.stories.tsx +77 -0
  347. package/src/ui/hover-card.test.tsx +30 -0
  348. package/src/ui/hover-card.tsx +172 -0
  349. package/src/ui/overlay.stories.tsx +115 -0
  350. package/src/ui/overlay.tsx +158 -0
  351. package/src/ui/popover.stories.tsx +81 -0
  352. package/src/ui/popover.test.tsx +99 -0
  353. package/src/ui/popover.tsx +92 -0
  354. package/src/ui/resizable.stories.tsx +236 -0
  355. package/src/ui/resizable.tsx +576 -0
  356. package/src/ui/scroll-area.stories.tsx +50 -0
  357. package/src/ui/scroll-area.tsx +15 -0
  358. package/src/ui/separator.stories.tsx +81 -0
  359. package/src/ui/separator.tsx +10 -0
  360. package/src/ui/skeleton.stories.tsx +337 -0
  361. package/src/ui/skeleton.tsx +16 -0
  362. package/src/ui/switch.stories.tsx +51 -0
  363. package/src/ui/switch.test.tsx +59 -0
  364. package/src/ui/switch.tsx +62 -0
  365. package/src/ui/textarea.stories.tsx +76 -0
  366. package/src/ui/textarea.tsx +21 -0
  367. package/src/ui/tooltip.stories.tsx +74 -0
  368. package/src/ui/tooltip.tsx +68 -0
  369. package/src/utils/cn.ts +24 -0
  370. package/theme.css +187 -0
@@ -0,0 +1,948 @@
1
+ // AUTO-GENERATED by scripts/gen-element-api.mjs — do not edit by hand.
2
+ // Typed React wrappers for every kitn custom element. Usage:
3
+ // import { Message } from '@kitn.ai/ui/react';
4
+ // <Message message={msg} onMessageAction={(e) => …} />
5
+ import { createWebComponent, type WebComponentProps } from './runtime';
6
+
7
+
8
+ export interface ArtifactProps extends WebComponentProps {
9
+ /** URL the preview iframe frames. Consumer-controlled. */
10
+ src?: string;
11
+ /** Files for the Code tab tree + each file's preview `url`. Set as a JS property (array). */
12
+ files: { path: string; url?: undefined | string; code?: undefined | string; language?: undefined | string; type?: undefined | "html" | "pdf" | "image" | "other" }[];
13
+ /** Active tab: `preview` (default) or `code`. */
14
+ tab?: "preview" | "code";
15
+ /** Selected file path — syncs the tree highlight, Code source, and preview. */
16
+ activeFile?: string;
17
+ /** iframe `sandbox` override. Secure default `allow-scripts allow-forms` (NOT `allow-same-origin`). */
18
+ sandbox?: string;
19
+ /** Accessible title for the preview iframe. */
20
+ iframeTitle?: string;
21
+ /** Reflects the artifact's own maximized view-state (usually driven by the protocol). */
22
+ maximized?: boolean;
23
+ /** Show the expand-to-fill button (OPT-IN). */
24
+ expandable?: boolean;
25
+ /** Show the open-in-new-tab button (OPT-IN). */
26
+ openInTab?: boolean;
27
+ /** Hide back/forward. */
28
+ noNav?: boolean;
29
+ /** Hide reload. */
30
+ noReload?: boolean;
31
+ /** Hide home. */
32
+ noHome?: boolean;
33
+ /** Hide the address field. */
34
+ noPathField?: boolean;
35
+ /** Hide the Preview|Code toggle. */
36
+ noTabs?: boolean;
37
+ /** Standalone chrome: rounded corners + border (else square, borderless in-panel). */
38
+ standalone?: boolean;
39
+ /** Show the address but make it read-only (visible, nav-tracking, non-editable). */
40
+ readonlyPath?: boolean;
41
+ /** Fired when a file is selected. `detail.path`. */
42
+ onFileSelect?: (event: CustomEvent<{ path: string }>) => void;
43
+ /** Artifact's own maximize button toggled (consumer-observable; non-bubbling). */
44
+ onMaximizeChange?: (event: CustomEvent<{ maximized: boolean }>) => void;
45
+ /** Fired when the preview navigates. `detail.url` = the new location. */
46
+ onNavigate?: (event: CustomEvent<{ url: string }>) => void;
47
+ /** Fired when the Preview|Code tab changes. `detail.tab`. */
48
+ onTabChange?: (event: CustomEvent<{ tab: "preview" | "code" }>) => void;
49
+ }
50
+
51
+ export const Artifact = createWebComponent<ArtifactProps>(
52
+ 'kai-artifact',
53
+ ["theme","src","files","tab","activeFile","sandbox","iframeTitle","maximized","expandable","openInTab","noNav","noReload","noHome","noPathField","noTabs","standalone","readonlyPath"],
54
+ { onFileSelect: 'kai-file-select', onMaximizeChange: 'kai-maximize-change', onNavigate: 'kai-navigate', onTabChange: 'kai-tab-change' },
55
+ );
56
+
57
+ export interface AttachmentsProps extends WebComponentProps {
58
+ /** The attachments to render. Set as a JS property (array). */
59
+ items: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[];
60
+ /** Layout: `grid` = visual tiles, `inline` = icon + label chips, `list` = rows. */
61
+ variant?: "grid" | "inline" | "list";
62
+ /** Wrap each item in a hover card that previews its details. */
63
+ hoverCard?: boolean;
64
+ /** Show a remove button per item; clicking it fires a `kai-remove` event. */
65
+ removable?: boolean;
66
+ /** Also show the media type beneath the filename (non-grid variants). */
67
+ showMediaType?: boolean;
68
+ /** Text shown when `items` is empty. */
69
+ emptyText?: string;
70
+ /** A remove button was clicked. */
71
+ onRemove?: (event: CustomEvent<{ id: string }>) => void;
72
+ }
73
+
74
+ export const Attachments = createWebComponent<AttachmentsProps>(
75
+ 'kai-attachments',
76
+ ["theme","items","variant","hoverCard","removable","showMediaType","emptyText"],
77
+ { onRemove: 'kai-remove' },
78
+ );
79
+
80
+ export interface CardProps extends WebComponentProps {
81
+ /** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
82
+ heading?: string;
83
+ /** Supporting text under the heading. Attribute: `description`. */
84
+ description?: string;
85
+ /** When set, the card renders its inline error state instead of the body. Attribute: `error-message`. */
86
+ errorMessage?: string;
87
+ /** Compact spacing for dense lists. Attribute: `dense`. */
88
+ dense?: boolean;
89
+ }
90
+
91
+ export const Card = createWebComponent<CardProps>(
92
+ 'kai-card',
93
+ ["theme","heading","description","errorMessage","dense"],
94
+ { },
95
+ );
96
+
97
+ export interface CardsProps extends WebComponentProps {
98
+ /** The stream of card envelopes to render. Set as a JS PROPERTY: `el.cards = [...]`. */
99
+ cards?: { type: string; id: string; data: unknown; title?: string; resolution?: { kind: "action"; action: string; payload?: unknown; at?: string } | { kind: "submit"; data: unknown; at?: string } }[];
100
+ /** Optional type→tag overrides/additions (merged over the built-ins). Property: `el.types`. Typed as a plain string map (not the `CardTagMap` alias) so the generated React wrapper inlines it instead of emitting an unresolved named type. */
101
+ types?: Record<string, string>;
102
+ /** Optional CardPolicy handling child events. Property: `el.policy`. */
103
+ policy?: { onSubmit?: (cardId: string, data: unknown) => void; onAction?: (cardId: string, action: string, payload?: unknown) => void; onSendPrompt?: (text: string, opts: { mode: "compose" | "send"; context?: unknown; }) => void; onOpen?: (url: string, target: "tab" | "artifact") => void; onState?: (cardId: string, patch: unknown) => void; onDismiss?: (cardId: string) => void; onError?: (cardId: string, message: string) => void; maxSendPromptMode?: "compose" | "send" };
104
+ }
105
+
106
+ export const Cards = createWebComponent<CardsProps>(
107
+ 'kai-cards',
108
+ ["theme","cards","types","policy"],
109
+ { },
110
+ );
111
+
112
+ export interface ChainOfThoughtProps extends WebComponentProps {
113
+ /** The reasoning steps. Set as a JS property. Compound sub-parts collapse to this one data model (Route 1). */
114
+ steps: { label: string; content?: undefined | string }[];
115
+ }
116
+
117
+ export const ChainOfThought = createWebComponent<ChainOfThoughtProps>(
118
+ 'kai-chain-of-thought',
119
+ ["theme","steps"],
120
+ { },
121
+ );
122
+
123
+ export interface ChatProps extends WebComponentProps {
124
+ /** The full message thread to render, newest last. Each entry carries its role, content, and optional reasoning/tools/attachments/actions. Set as a JS property (`el.messages = [...]`). */
125
+ messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: undefined | string; tooltip?: undefined | string })[]; avatar?: undefined | { src?: undefined | string; fallback?: undefined | string; alt?: undefined | string } }[];
126
+ /** Controlled value of the input. When set, the host owns the input text and must update it on `kai-value-change`; leave unset for uncontrolled behavior. */
127
+ value?: string;
128
+ /** Placeholder text shown in the empty input. */
129
+ placeholder?: string;
130
+ /** When true, shows the loading/streaming state and disables submit (use while awaiting the assistant's reply). */
131
+ loading?: boolean;
132
+ /** Starter prompts shown above the input when the thread is empty. Clicking one follows `suggestionMode`. Set as a JS property. */
133
+ suggestions?: string[];
134
+ /** What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. */
135
+ suggestionMode?: "submit" | "fill";
136
+ /** Keep suggestions visible after the conversation starts. By default suggestions are conversation starters and hide once `messages` is non-empty; set this to keep them always shown. Default false. */
137
+ persistSuggestions?: boolean;
138
+ /** Body/prose font scale for rendered markdown (`'xs' | 'sm' | 'base' | 'lg'`). Defaults to `'sm'`. */
139
+ proseSize?: "xs" | "sm" | "base" | "lg";
140
+ /** Shiki theme name for syntax-highlighted code blocks (e.g. `'github-dark-dimmed'`). */
141
+ codeTheme?: string;
142
+ /** Enable Shiki syntax highlighting in code blocks. Turn off to render plain `<pre>` blocks (lighter, no highlighter load). Default true. */
143
+ codeHighlight?: boolean;
144
+ /** Optional header title shown on the left of the header. */
145
+ chatTitle?: string;
146
+ /** Optional model list. When set (>1 model) a ModelSwitcher is shown in the header and a `kai-model-change` event fires on selection. */
147
+ models?: { id: string; name: string; provider?: string; description?: string; group?: string }[];
148
+ /** The currently selected model id (pairs with `models`). */
149
+ currentModel?: string;
150
+ /** Optional context-window token usage. When set, a Context token meter is shown in the header. */
151
+ context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
152
+ /** Show the scroll-to-bottom button inside the scroll area. Default true. */
153
+ scrollButton?: boolean;
154
+ /** Whether the host has `slot="header-start"` content (left of the title) — set by the `<kai-chat>` facade so a custom control forces the header open. */
155
+ headerStart?: boolean;
156
+ /** Whether the host has `slot="header-end"` content (right of the controls). */
157
+ headerEnd?: boolean;
158
+ /** Show a Search (Globe) button in the input toolbar; fires a `search` event. */
159
+ search?: boolean;
160
+ /** Show a Voice (Mic) button in the input toolbar; fires a `voice` event. */
161
+ voice?: boolean;
162
+ /** Slash commands — when set, typing `/` in the input opens the command palette and fires `kai-slash-select`. Set as a JS property. */
163
+ slashCommands?: { id: string; label: string; description?: string; category?: string }[];
164
+ /** Command ids to highlight as active in the palette. */
165
+ slashActiveIds?: string[];
166
+ /** Single-line palette rows. */
167
+ slashCompact?: boolean;
168
+ /** Whether each message's action bar is always visible (`'always'`, default) or only revealed on hover of that message row (`'hover'`). */
169
+ actionsReveal?: "always" | "hover";
170
+ /** An action button on a message was clicked. `action` is the built-in name or custom id. */
171
+ onMessageAction?: (event: CustomEvent<{ messageId: string; action: string }>) => void;
172
+ /** The header model switcher changed. */
173
+ onModelChange?: (event: CustomEvent<{ modelId: string }>) => void;
174
+ /** The Search button was clicked. */
175
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
176
+ /** A slash command was chosen from the palette. */
177
+ onSlashSelect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
178
+ /** User submitted a message. */
179
+ onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
180
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
181
+ onSuggestionClick?: (event: CustomEvent<{ value: string }>) => void;
182
+ /** Fired on every input change. */
183
+ onValueChange?: (event: CustomEvent<{ value: string }>) => void;
184
+ /** The Mic / voice button was clicked. */
185
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
186
+ }
187
+
188
+ export const Chat = createWebComponent<ChatProps>(
189
+ 'kai-chat',
190
+ ["theme","messages","value","placeholder","loading","suggestions","suggestionMode","persistSuggestions","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","headerStart","headerEnd","search","voice","slashCommands","slashActiveIds","slashCompact","actionsReveal"],
191
+ { onMessageAction: 'kai-message-action', onModelChange: 'kai-model-change', onSearch: 'kai-search', onSlashSelect: 'kai-slash-select', onSubmit: 'kai-submit', onSuggestionClick: 'kai-suggestion-click', onValueChange: 'kai-value-change', onVoice: 'kai-voice' },
192
+ );
193
+
194
+ export interface CheckpointProps extends WebComponentProps {
195
+ /** Optional text beside the icon. */
196
+ label?: string;
197
+ /** Tooltip on hover. */
198
+ tooltip?: string;
199
+ /** Visual button style. */
200
+ variant?: "ghost" | "default" | "outline";
201
+ /** Button size (use an `icon*` size for an icon-only checkpoint). */
202
+ size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
203
+ /** The checkpoint was clicked. */
204
+ onSelect?: (event: CustomEvent) => void;
205
+ }
206
+
207
+ export const Checkpoint = createWebComponent<CheckpointProps>(
208
+ 'kai-checkpoint',
209
+ ["theme","label","tooltip","variant","size"],
210
+ { onSelect: 'kai-select' },
211
+ );
212
+
213
+ export interface ChoiceProps extends WebComponentProps {
214
+ /** The choice definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { prompt, options:[…], allowOther?, submitLabel? }`. Import `ChoiceCardData` from `@kitn.ai/ui` for the full shape. */
215
+ data?: Record<string, unknown>;
216
+ /** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
217
+ cardId?: string;
218
+ /** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
219
+ heading?: string;
220
+ /** Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'action', action:'…' }`. */
221
+ resolution?: Record<string, unknown>;
222
+ }
223
+
224
+ export const Choice = createWebComponent<ChoiceProps>(
225
+ 'kai-choice',
226
+ ["theme","data","cardId","heading","resolution"],
227
+ { },
228
+ );
229
+
230
+ export interface CodeBlockProps extends WebComponentProps {
231
+ /** The source code to render. */
232
+ code: string;
233
+ /** Language grammar (e.g. `js`, `python`). Defaults to `tsx`. */
234
+ language?: string;
235
+ /** Shiki theme name. */
236
+ codeTheme?: string;
237
+ /** Disable syntax highlighting (renders plain text, no Shiki). */
238
+ codeHighlight?: boolean;
239
+ /** Code text sizing. */
240
+ proseSize?: "xs" | "sm" | "base" | "lg";
241
+ }
242
+
243
+ export const CodeBlock = createWebComponent<CodeBlockProps>(
244
+ 'kai-code-block',
245
+ ["theme","code","language","codeTheme","codeHighlight","proseSize"],
246
+ { },
247
+ );
248
+
249
+ export interface ConfirmProps extends WebComponentProps {
250
+ /** The confirm definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { body, tone, actions:[…] }`. Import `ConfirmCardData` from `@kitn.ai/ui` for the full shape. */
251
+ data?: Record<string, unknown>;
252
+ /** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
253
+ cardId?: string;
254
+ /** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
255
+ heading?: string;
256
+ /** Focus the default action on mount (off by default — no focus-stealing). Attribute: `autofocus`. */
257
+ autofocus?: boolean;
258
+ /** Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'action', action:'…' }`. */
259
+ resolution?: Record<string, unknown>;
260
+ }
261
+
262
+ export const Confirm = createWebComponent<ConfirmProps>(
263
+ 'kai-confirm',
264
+ ["theme","data","cardId","heading","autofocus","resolution"],
265
+ { },
266
+ );
267
+
268
+ export interface ContextProps extends WebComponentProps {
269
+ /** Token-usage data. Set as a JS property. */
270
+ context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; reasoningTokens?: number; cacheTokens?: number; estimatedCost?: number };
271
+ /** Fraction (0–1) above which the meter turns yellow. Defaults to `0.7` (70%). */
272
+ warnThreshold?: number;
273
+ /** Fraction (0–1) above which the meter turns red. Defaults to `0.9` (90%). */
274
+ dangerThreshold?: number;
275
+ /** Fires when the computed severity level changes (ok → warn → danger or back). `detail.level` is `'ok'`, `'warn'`, or `'danger'`. */
276
+ onThresholdChange?: (event: CustomEvent<{ level: "ok" | "warn" | "danger" }>) => void;
277
+ }
278
+
279
+ export const Context = createWebComponent<ContextProps>(
280
+ 'kai-context',
281
+ ["theme","context","warnThreshold","dangerThreshold"],
282
+ { onThresholdChange: 'kai-threshold-change' },
283
+ );
284
+
285
+ export interface ConversationsProps extends WebComponentProps {
286
+ /** Pre-bucketed conversation groups (e.g. "Today", "Yesterday"), each with its own conversations. Use this when you want to control the grouping/headers yourself; otherwise pass a flat `conversations` array. Set as a JS property. */
287
+ groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
288
+ /** A flat list of conversation summaries; the component buckets them by recency for you. Ignored when `groups` is provided. Set as a JS property. */
289
+ conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
290
+ /** The id of the currently-open conversation, highlighted in the list. */
291
+ activeId?: string;
292
+ /** A conversation was selected. */
293
+ onConversationSelect?: (event: CustomEvent<{ id: string }>) => void;
294
+ /** The "New chat" button was clicked. */
295
+ onNewChat?: (event: CustomEvent<Record<string, never>>) => void;
296
+ /** The sidebar toggle was clicked. */
297
+ onToggleSidebar?: (event: CustomEvent<Record<string, never>>) => void;
298
+ }
299
+
300
+ export const Conversations = createWebComponent<ConversationsProps>(
301
+ 'kai-conversations',
302
+ ["theme","groups","conversations","activeId"],
303
+ { onConversationSelect: 'kai-conversation-select', onNewChat: 'kai-new-chat', onToggleSidebar: 'kai-toggle-sidebar' },
304
+ );
305
+
306
+ export interface EmbedProps extends WebComponentProps {
307
+ /** Stable card id correlating every emitted event. Set as an attribute or property. */
308
+ cardId?: string;
309
+ /** The embed payload (provider + id/url + options). Set as a JS **property** (object). */
310
+ data?: { provider: "youtube" | "vimeo" | "generic"; id?: string; url?: string; title?: string; poster?: string; start?: number; aspectRatio?: "16:9" | "4:3" | "1:1" | "9:16" };
311
+ }
312
+
313
+ export const Embed = createWebComponent<EmbedProps>(
314
+ 'kai-embed',
315
+ ["theme","cardId","data"],
316
+ { },
317
+ );
318
+
319
+ export interface EmptyProps extends WebComponentProps {
320
+ /** Title text. Attribute: `empty-title` (`title` is a global HTML attribute). */
321
+ emptyTitle?: string;
322
+ /** Description text. */
323
+ description?: string;
324
+ }
325
+
326
+ export const Empty = createWebComponent<EmptyProps>(
327
+ 'kai-empty',
328
+ ["theme","emptyTitle","description"],
329
+ { },
330
+ );
331
+
332
+ export interface FeedbackBarProps extends WebComponentProps {
333
+ /** The banner label (e.g. "Was this helpful?"). Attribute: `bar-title` (`title` is avoided — it's a global HTML attribute). */
334
+ barTitle?: string;
335
+ /** When set, a not-helpful vote opens an optional detail form before the thank-you confirmation. Attribute: `collect-detail`. */
336
+ collectDetail?: boolean;
337
+ /** Optional category chips for the detail form. Set as a JS property (array). */
338
+ categories?: string[];
339
+ /** Heading for the detail form. Attribute: `detail-title`. */
340
+ detailTitle?: string;
341
+ /** Placeholder for the detail comment box. Attribute: `detail-placeholder`. */
342
+ detailPlaceholder?: string;
343
+ /** Submit button label in the detail form. Attribute: `submit-label`. */
344
+ submitLabel?: string;
345
+ /** Confirmation copy shown after a vote/submit. Attribute: `thanks-message`. */
346
+ thanksMessage?: string;
347
+ /** The user dismissed the banner. */
348
+ onClose?: (event: CustomEvent) => void;
349
+ /** The user rated the response. `value` is `'helpful'` or `'not-helpful'`. */
350
+ onFeedback?: (event: CustomEvent<{ value: "helpful" | "not-helpful" }>) => void;
351
+ /** The user submitted the optional detail form (`collect-detail`). */
352
+ onFeedbackDetail?: (event: CustomEvent<{ value: "helpful" | "not-helpful"; category?: undefined | string; comment?: undefined | string }>) => void;
353
+ }
354
+
355
+ export const FeedbackBar = createWebComponent<FeedbackBarProps>(
356
+ 'kai-feedback-bar',
357
+ ["theme","barTitle","collectDetail","categories","detailTitle","detailPlaceholder","submitLabel","thanksMessage"],
358
+ { onClose: 'kai-close', onFeedback: 'kai-feedback', onFeedbackDetail: 'kai-feedback-detail' },
359
+ );
360
+
361
+ export interface FileTreeProps extends WebComponentProps {
362
+ /** The files to render. Set as a JS property (array of `{ path, url?, code?, language?, type? }`). */
363
+ files: { path: string; url?: undefined | string; code?: undefined | string; language?: undefined | string; type?: undefined | "html" | "pdf" | "image" | "other" }[];
364
+ /** Selected file path — highlighted in the tree. */
365
+ activeFile?: string;
366
+ /** Folder paths expanded initially. Omit to start with all folders open. */
367
+ defaultExpanded?: string[];
368
+ /** Fired when a file is selected. `detail.path` = the file's path. */
369
+ onSelect?: (event: CustomEvent<{ path: string }>) => void;
370
+ }
371
+
372
+ export const FileTree = createWebComponent<FileTreeProps>(
373
+ 'kai-file-tree',
374
+ ["theme","files","activeFile","defaultExpanded"],
375
+ { onSelect: 'kai-select' },
376
+ );
377
+
378
+ export interface FileUploadProps extends WebComponentProps {
379
+ /** Allow selecting multiple files (default true). */
380
+ multiple?: boolean;
381
+ /** `accept` attribute for the file picker (e.g. `image/*`). */
382
+ accept?: string;
383
+ /** Disable the dropzone — no clicking, no drag-and-drop. */
384
+ disabled?: boolean;
385
+ /** Default dropzone label (overridable via the default slot). */
386
+ label?: string;
387
+ /** Files were picked or dropped. */
388
+ onFilesAdded?: (event: CustomEvent<{ files: File[] }>) => void;
389
+ }
390
+
391
+ export const FileUpload = createWebComponent<FileUploadProps>(
392
+ 'kai-file-upload',
393
+ ["theme","multiple","accept","disabled","label"],
394
+ { onFilesAdded: 'kai-files-added' },
395
+ );
396
+
397
+ export interface FormProps extends WebComponentProps {
398
+ /** The form definition — a JSON Schema (`type:'object'`) + `x-kai-*` UI hints (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { type:'object', properties:{…} }`. Import the `FormDefinition` type from `@kitn.ai/ui` for the full shape (it is self-referential, so the element types it loosely). */
399
+ data?: Record<string, unknown>;
400
+ /** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
401
+ cardId?: string;
402
+ /** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
403
+ heading?: string;
404
+ /** Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'submit', data:{…} }`. */
405
+ resolution?: Record<string, unknown>;
406
+ }
407
+
408
+ export const Form = createWebComponent<FormProps>(
409
+ 'kai-form',
410
+ ["theme","data","cardId","heading","resolution"],
411
+ { },
412
+ );
413
+
414
+ export interface ImageProps extends WebComponentProps {
415
+ /** Base64-encoded image data (pair with `media-type`). */
416
+ base64?: string;
417
+ /** Raw image bytes (set as a JS property). */
418
+ bytes?: Uint8Array;
419
+ /** Alt text. */
420
+ alt?: string;
421
+ /** MIME type (default `image/png`). */
422
+ mediaType?: string;
423
+ }
424
+
425
+ export const Image = createWebComponent<ImageProps>(
426
+ 'kai-image',
427
+ ["theme","base64","bytes","alt","mediaType"],
428
+ { },
429
+ );
430
+
431
+ export interface LinkPreviewProps extends WebComponentProps {
432
+ /** Stable card id correlating every emitted event. Set as an attribute or property. */
433
+ cardId?: string;
434
+ /** The link payload (OG metadata). Set as a JS **property** (object). */
435
+ data?: { url: string; title?: string; description?: string; image?: string; imageAlt?: string; favicon?: string; domain?: string; siteName?: string };
436
+ }
437
+
438
+ export const LinkPreview = createWebComponent<LinkPreviewProps>(
439
+ 'kai-link-preview',
440
+ ["theme","cardId","data"],
441
+ { },
442
+ );
443
+
444
+ export interface LoaderProps extends WebComponentProps {
445
+ /** The animation style: `'circular' | 'classic' | 'pulse' | 'pulse-dot' | 'dots' | 'typing' | 'wave' | 'bars' | 'terminal' | 'text-blink' | 'text-shimmer' | 'loading-dots'`. Defaults to `'circular'`. */
446
+ variant?: "circular" | "classic" | "pulse" | "pulse-dot" | "dots" | "typing" | "wave" | "bars" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
447
+ /** Loader size: `'sm' | 'md' | 'lg'`. Defaults to `'md'`. */
448
+ size?: "sm" | "lg" | "md";
449
+ /** Label for the text-based variants. */
450
+ text?: string;
451
+ }
452
+
453
+ export const Loader = createWebComponent<LoaderProps>(
454
+ 'kai-loader',
455
+ ["theme","variant","size","text"],
456
+ { },
457
+ );
458
+
459
+ export interface MarkdownProps extends WebComponentProps {
460
+ /** The markdown source to render. */
461
+ content: string;
462
+ /** Text/markdown sizing. */
463
+ proseSize?: "xs" | "sm" | "base" | "lg";
464
+ /** Shiki theme for fenced code blocks. */
465
+ codeTheme?: string;
466
+ /** Disable syntax highlighting (no Shiki loads). */
467
+ codeHighlight?: boolean;
468
+ }
469
+
470
+ export const Markdown = createWebComponent<MarkdownProps>(
471
+ 'kai-markdown',
472
+ ["theme","content","proseSize","codeTheme","codeHighlight"],
473
+ { },
474
+ );
475
+
476
+ export interface MessageProps extends WebComponentProps {
477
+ /** The full message object. Set as a JS property. */
478
+ message?: { id: string; role: "user" | "assistant"; content: string; reasoning?: { text: string; label?: string }; tools?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string }[]; attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: string; tooltip?: string })[]; avatar?: { src?: string; fallback?: string; alt?: string } };
479
+ /** Convenience for simple cases when not passing a `message` object. */
480
+ role?: "user" | "assistant";
481
+ /** Convenience content (used when `message` is not set). */
482
+ content?: string;
483
+ /** Force markdown on/off. Defaults to on for assistant, off for user. */
484
+ markdown?: boolean;
485
+ /** Text/markdown sizing for the message body. */
486
+ proseSize?: "xs" | "sm" | "base" | "lg";
487
+ /** Shiki theme name used for fenced code blocks in the content. */
488
+ codeTheme?: string;
489
+ /** Disable syntax highlighting for code blocks (no Shiki loads). */
490
+ codeHighlight?: boolean;
491
+ /** Whether the action bar is always visible (`'always'`, default) or only revealed on hover of the message row (`'hover'`). */
492
+ actionsReveal?: "always" | "hover";
493
+ /** Convenience avatar image URL (used when `message.avatar` is not set). */
494
+ avatarSrc?: string;
495
+ /** Convenience avatar fallback text (used when `message.avatar` is not set). */
496
+ avatarFallback?: string;
497
+ /** An action button was clicked. `action` is the built-in name or custom id. */
498
+ onMessageAction?: (event: CustomEvent<{ messageId: string; action: string }>) => void;
499
+ }
500
+
501
+ export const Message = createWebComponent<MessageProps>(
502
+ 'kai-message',
503
+ ["theme","message","role","content","markdown","proseSize","codeTheme","codeHighlight","actionsReveal","avatarSrc","avatarFallback"],
504
+ { onMessageAction: 'kai-message-action' },
505
+ );
506
+
507
+ export interface ModelSwitcherProps extends WebComponentProps {
508
+ /** The selectable models. Set as a JS property (array). */
509
+ models: { id: string; name: string; provider?: undefined | string; description?: undefined | string; group?: undefined | string }[];
510
+ /** The currently-selected model id. Defaults to the first model. */
511
+ currentModel?: string;
512
+ /** A model was selected. */
513
+ onModelChange?: (event: CustomEvent<{ modelId: string }>) => void;
514
+ }
515
+
516
+ export const ModelSwitcher = createWebComponent<ModelSwitcherProps>(
517
+ 'kai-model-switcher',
518
+ ["theme","models","currentModel"],
519
+ { onModelChange: 'kai-model-change' },
520
+ );
521
+
522
+ export interface PopoverProps extends WebComponentProps {
523
+ /** Floating placement relative to the trigger (floating-ui placement). */
524
+ placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
525
+ /** Gap in px between the trigger and the panel. */
526
+ gutter?: number;
527
+ /** Controlled open state. Set as a JS property (`el.open = true`) to drive the popover from your app; omit for the default click-to-toggle behaviour. */
528
+ open?: boolean;
529
+ /** The popover wants to open or close (click, Escape, or outside-click). */
530
+ onOpenChange?: (event: CustomEvent<{ open: boolean }>) => void;
531
+ }
532
+
533
+ export const Popover = createWebComponent<PopoverProps>(
534
+ 'kai-popover',
535
+ ["theme","placement","gutter","open"],
536
+ { onOpenChange: 'kai-open-change' },
537
+ );
538
+
539
+ export interface PromptInputProps extends WebComponentProps {
540
+ /** Controlled value of the input. When set, the host owns the text and must update it on `kai-value-change`; leave unset for uncontrolled behavior. */
541
+ value?: string;
542
+ /** Placeholder text shown in the empty input. */
543
+ placeholder?: string;
544
+ /** Disable the input and submit button entirely (non-interactive). */
545
+ disabled?: boolean;
546
+ /** Show the loading/streaming state and block submit (use while awaiting a reply). */
547
+ loading?: boolean;
548
+ /** Starter prompts shown above the input. Clicking one follows `suggestionMode`. Set as a JS property. */
549
+ suggestions?: string[];
550
+ /** What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. */
551
+ suggestionMode?: "submit" | "fill";
552
+ /** Slash commands — when set, typing `/` opens the command palette. Set as a JS property. */
553
+ slashCommands?: { id: string; label: string; description?: string; category?: string }[];
554
+ /** Command ids to highlight as active. */
555
+ slashActiveIds?: string[];
556
+ /** Single-line palette rows. */
557
+ slashCompact?: boolean;
558
+ /** Show a Search (Globe) button in the left toolbar; clicking it fires a `search` event. */
559
+ search?: boolean;
560
+ /** Show a Voice (Mic) button in the left toolbar; clicking it fires a `voice` event. */
561
+ voice?: boolean;
562
+ /** When set and `loading` is true, the send button is replaced by a Stop button (square icon, "Stop" aria-label). Clicking it fires `kai-stop`. */
563
+ stoppable?: boolean;
564
+ /** Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). */
565
+ attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[];
566
+ /** The Search (Globe) toolbar button was clicked. */
567
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
568
+ /** A slash command was chosen from the palette. */
569
+ onSlashSelect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
570
+ /** The Stop button was clicked while `stoppable` and `loading` are both true. */
571
+ onStop?: (event: CustomEvent<Record<string, never>>) => void;
572
+ /** The user submitted the prompt (Enter or send button) with its attachments. */
573
+ onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
574
+ /** A suggestion was clicked while `suggestion-mode="fill"`. */
575
+ onSuggestionClick?: (event: CustomEvent<{ value: string }>) => void;
576
+ /** A custom `<kai-action>` toolbar button was clicked. `action` is the `id` of the `<kai-action>` element that was clicked. */
577
+ onToolbarAction?: (event: CustomEvent<{ action: string }>) => void;
578
+ /** The input text changed (fires on every keystroke). */
579
+ onValueChange?: (event: CustomEvent<{ value: string }>) => void;
580
+ /** The Voice (Mic) toolbar button was clicked. */
581
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
582
+ }
583
+
584
+ export const PromptInput = createWebComponent<PromptInputProps>(
585
+ 'kai-prompt-input',
586
+ ["theme","value","placeholder","disabled","loading","suggestions","suggestionMode","slashCommands","slashActiveIds","slashCompact","search","voice","stoppable","attachments"],
587
+ { onSearch: 'kai-search', onSlashSelect: 'kai-slash-select', onStop: 'kai-stop', onSubmit: 'kai-submit', onSuggestionClick: 'kai-suggestion-click', onToolbarAction: 'kai-toolbar-action', onValueChange: 'kai-value-change', onVoice: 'kai-voice' },
588
+ );
589
+
590
+ export interface ReasoningProps extends WebComponentProps {
591
+ /** The reasoning text to display. */
592
+ text: string;
593
+ /** Trigger label. */
594
+ label?: string;
595
+ /** Controlled open state — set as a property (`el.open = true`). Omit for uncontrolled (the trigger toggles it). */
596
+ open?: boolean;
597
+ /** While true, auto-expands (and re-collapses when it flips false). */
598
+ streaming?: boolean;
599
+ /** Render `text` as markdown. */
600
+ markdown?: boolean;
601
+ /** Open state changed (via the trigger or streaming auto-open). */
602
+ onOpenChange?: (event: CustomEvent<{ open: boolean }>) => void;
603
+ }
604
+
605
+ export const Reasoning = createWebComponent<ReasoningProps>(
606
+ 'kai-reasoning',
607
+ ["theme","text","label","open","streaming","markdown"],
608
+ { onOpenChange: 'kai-open-change' },
609
+ );
610
+
611
+ export interface RemoteProps extends WebComponentProps {
612
+ /** The remote card URL. Attribute: `src`. */
613
+ src?: string;
614
+ /** Exact provider origin (https: or http://localhost for dev). Attribute: `provider-origin`. */
615
+ providerOrigin?: string;
616
+ /** The card envelope to render. JS property only. */
617
+ envelope?: Record<string, unknown>;
618
+ /** Optional routing policy. JS property only. */
619
+ policy?: Record<string, unknown>;
620
+ }
621
+
622
+ export const Remote = createWebComponent<RemoteProps>(
623
+ 'kai-remote',
624
+ ["theme","src","providerOrigin","envelope","policy"],
625
+ { },
626
+ );
627
+
628
+ export interface ResizableProps extends WebComponentProps {
629
+ /** Layout axis: `horizontal` (row, default) or `vertical` (column). */
630
+ orientation?: "horizontal" | "vertical";
631
+ /** Which item index is maximized (null = none). Declarative source of truth. */
632
+ maximizedIndex?: null | number;
633
+ /** Fired on drag-end / keyboard resize / visibility change. `detail.sizes` = panel sizes in percent. */
634
+ onChange?: (event: CustomEvent<{ sizes: number[] }>) => void;
635
+ /** Observe layout maximize state. */
636
+ onMaximizeChange?: (event: CustomEvent<{ maximized: boolean; index: null | number }>) => void;
637
+ }
638
+
639
+ export const Resizable = createWebComponent<ResizableProps>(
640
+ 'kai-resizable',
641
+ ["theme","orientation","maximizedIndex"],
642
+ { onChange: 'kai-change', onMaximizeChange: 'kai-maximize-change' },
643
+ );
644
+
645
+ export interface ResizableItemProps extends WebComponentProps {
646
+ /** Initial main-axis size: `"280px"` (fixed) or `"25%"`/`25` (percent). Omitted → flexible. */
647
+ size?: string;
648
+ /** Minimum size during resize (px or %). */
649
+ min?: string;
650
+ /** Maximum size during resize (px or %). */
651
+ max?: string;
652
+ /** Fix this panel's size; adjacent dividers become non-draggable. */
653
+ locked?: boolean;
654
+ /** Hide this panel; its divider is dropped and the rest reflow. */
655
+ hidden?: boolean;
656
+ onChange?: (event: CustomEvent<unknown>) => void;
657
+ onMaximizeChange?: (event: CustomEvent<unknown>) => void;
658
+ }
659
+
660
+ export const ResizableItem = createWebComponent<ResizableItemProps>(
661
+ 'kai-resizable-item',
662
+ ["theme","size","min","max","locked","hidden"],
663
+ { onChange: 'kai-change', onMaximizeChange: 'kai-maximize-change' },
664
+ );
665
+
666
+ export interface ResponseStreamProps extends WebComponentProps {
667
+ /** Text to stream. A string, or an `AsyncIterable<string>` (set as a JS property — async iterables can't be HTML attributes). */
668
+ text?: string | AsyncIterable<string>;
669
+ /** Reveal animation. */
670
+ mode?: "typewriter" | "fade";
671
+ /** Characters/segments per tick. */
672
+ speed?: number;
673
+ /** Element tag to render as. */
674
+ as?: string;
675
+ /** Streaming finished. */
676
+ onComplete?: (event: CustomEvent) => void;
677
+ }
678
+
679
+ export const ResponseStream = createWebComponent<ResponseStreamProps>(
680
+ 'kai-response-stream',
681
+ ["theme","text","mode","speed","as"],
682
+ { onComplete: 'kai-complete' },
683
+ );
684
+
685
+ export interface ScopePickerProps extends WebComponentProps {
686
+ /** Authors to offer as scope filters. Set as a JS property. */
687
+ availableAuthors: string[];
688
+ /** Tags to offer as scope filters. Set as a JS property. */
689
+ availableTags: string[];
690
+ /** The label shown on the trigger for the active scope. */
691
+ currentLabel?: string;
692
+ /** A scope was chosen (`undefined` filters = "All Content"). */
693
+ onScopeChange?: (event: CustomEvent<{ filters: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }>) => void;
694
+ }
695
+
696
+ export const ScopePicker = createWebComponent<ScopePickerProps>(
697
+ 'kai-scope-picker',
698
+ ["theme","availableAuthors","availableTags","currentLabel"],
699
+ { onScopeChange: 'kai-scope-change' },
700
+ );
701
+
702
+ export interface ScrollButtonProps extends WebComponentProps {
703
+ /** CSS id of the scroll container to control. When omitted the element walks up the DOM (outside its own shadow root) to find the nearest scrollable ancestor. Mirrors the `for` convention of `<label for="...">`. */
704
+ for?: string;
705
+ /** Button visual variant: `'outline' | 'ghost' | 'default'`. Defaults to `'outline'`. */
706
+ variant?: "ghost" | "default" | "outline";
707
+ /** Button size token. Defaults to `'icon'` (square). */
708
+ size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
709
+ /** Emitted when the user clicks the button and `scrollToBottom()` is called. Carries no detail — consumers use it to know a manual scroll occurred. */
710
+ onScroll?: (event: CustomEvent) => void;
711
+ }
712
+
713
+ export const ScrollButton = createWebComponent<ScrollButtonProps>(
714
+ 'kai-scroll-button',
715
+ ["theme","for","variant","size"],
716
+ { onScroll: 'kai-scroll' },
717
+ );
718
+
719
+ export interface SkillsProps extends WebComponentProps {
720
+ /** The active skills to badge. Set as a JS property. */
721
+ skills: { id: string; name: string }[];
722
+ }
723
+
724
+ export const Skills = createWebComponent<SkillsProps>(
725
+ 'kai-skills',
726
+ ["theme","skills"],
727
+ { },
728
+ );
729
+
730
+ export interface SourceProps extends WebComponentProps {
731
+ /** The URL this citation links to (the domain also seeds the default label/favicon). */
732
+ href?: string;
733
+ /** Trigger label (defaults to the domain). */
734
+ label?: string;
735
+ /** Hover-card headline. Attribute: `headline` (`title` is avoided — it's a global HTML attribute that reflects in a CE constructor and breaks it). */
736
+ headline?: string;
737
+ /** Hover-card body text describing the source. */
738
+ description?: string;
739
+ /** Show the source's favicon next to the trigger label. */
740
+ showFavicon?: boolean;
741
+ }
742
+
743
+ export const Source = createWebComponent<SourceProps>(
744
+ 'kai-source',
745
+ ["theme","href","label","headline","description","showFavicon"],
746
+ { },
747
+ );
748
+
749
+ export interface SourcesProps extends WebComponentProps {
750
+ /** The sources to render. Set as a JS property. */
751
+ sources: { href: string; title?: undefined | string; description?: undefined | string; label?: undefined | string; showFavicon?: undefined | boolean }[];
752
+ /** Show favicons on all items (per-item `showFavicon` overrides). */
753
+ showFavicon?: boolean;
754
+ /** When true, each citation chip is labelled with its 1-based index in the merged (prop + declarative-children) list (`[1]`, `[2]`, …) instead of the per-item `label` or domain fallback. HTML attribute: `numbered` (boolean — bare attribute or `numbered="true"`). JS property: `el.numbered = true`. */
755
+ numbered?: boolean;
756
+ }
757
+
758
+ export const Sources = createWebComponent<SourcesProps>(
759
+ 'kai-sources',
760
+ ["theme","sources","showFavicon","numbered"],
761
+ { },
762
+ );
763
+
764
+ export interface SuggestionsProps extends WebComponentProps {
765
+ /** The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. */
766
+ suggestions: (string | { label: string; value?: undefined | string })[];
767
+ /** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
768
+ variant?: "ghost" | "default" | "outline";
769
+ /** Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). */
770
+ size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
771
+ /** Full-width left-aligned rows instead of pills. */
772
+ block?: boolean;
773
+ /** Substring to highlight within each suggestion. */
774
+ highlight?: string;
775
+ /** A suggestion was clicked. */
776
+ onSelect?: (event: CustomEvent<{ value: string }>) => void;
777
+ }
778
+
779
+ export const Suggestions = createWebComponent<SuggestionsProps>(
780
+ 'kai-suggestions',
781
+ ["theme","suggestions","variant","size","block","highlight"],
782
+ { onSelect: 'kai-select' },
783
+ );
784
+
785
+ export interface SwitchProps extends WebComponentProps {
786
+ /** Initial checked state. Bare attribute (`<kai-switch checked>`) turns it on. */
787
+ checked?: boolean;
788
+ /** Disable interaction. */
789
+ disabled?: boolean;
790
+ /** Accessible label. */
791
+ label?: string;
792
+ /** The toggle changed. */
793
+ onChange?: (event: CustomEvent<{ checked: boolean }>) => void;
794
+ }
795
+
796
+ export const Switch = createWebComponent<SwitchProps>(
797
+ 'kai-switch',
798
+ ["theme","checked","disabled","label"],
799
+ { onChange: 'kai-change' },
800
+ );
801
+
802
+ export interface TasksProps extends WebComponentProps {
803
+ /** The tasks definition (the CardEnvelope.data). Set as a JS PROPERTY: `el.data = { tasks:[…], selectAll, confirmLabel, … }`. Import `TasksCardData` from `@kitn.ai/ui` for the full shape. */
804
+ data?: Record<string, unknown>;
805
+ /** Stable card id correlating every emitted CardEvent. Attribute: `card-id`. */
806
+ cardId?: string;
807
+ /** Heading rendered in the card chrome (= CardEnvelope.title). Attribute: `heading`. */
808
+ heading?: string;
809
+ /** Set when the user resolved this card; renders the read-only view. Property: `el.resolution = { kind:'submit', data:{ selected:[…] } }`. */
810
+ resolution?: Record<string, unknown>;
811
+ }
812
+
813
+ export const Tasks = createWebComponent<TasksProps>(
814
+ 'kai-tasks',
815
+ ["theme","data","cardId","heading","resolution"],
816
+ { },
817
+ );
818
+
819
+ export interface TextShimmerProps extends WebComponentProps {
820
+ /** The text to shimmer. */
821
+ text?: string;
822
+ /** Element tag to render as (default `span`). */
823
+ as?: string;
824
+ /** Animation duration in seconds. */
825
+ duration?: number;
826
+ /** Gradient spread (5–45). */
827
+ spread?: number;
828
+ }
829
+
830
+ export const TextShimmer = createWebComponent<TextShimmerProps>(
831
+ 'kai-text-shimmer',
832
+ ["theme","text","as","duration","spread"],
833
+ { },
834
+ );
835
+
836
+ export interface ThinkingBarProps extends WebComponentProps {
837
+ /** The shimmering label, e.g. "Thinking…". */
838
+ text?: string;
839
+ /** When true, show a "stop" affordance that fires a `stop` event. */
840
+ stoppable?: boolean;
841
+ /** Label for the stop affordance. */
842
+ stopLabel?: string;
843
+ /** The "stop / answer now" affordance was clicked. */
844
+ onStop?: (event: CustomEvent) => void;
845
+ }
846
+
847
+ export const ThinkingBar = createWebComponent<ThinkingBarProps>(
848
+ 'kai-thinking-bar',
849
+ ["theme","text","stoppable","stopLabel"],
850
+ { onStop: 'kai-stop' },
851
+ );
852
+
853
+ export interface ToolProps extends WebComponentProps {
854
+ /** The tool-call to display. Set as a JS property. */
855
+ tool?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string };
856
+ /** Start expanded. */
857
+ open?: boolean;
858
+ }
859
+
860
+ export const Tool = createWebComponent<ToolProps>(
861
+ 'kai-tool',
862
+ ["theme","tool","open"],
863
+ { },
864
+ );
865
+
866
+ export interface VoiceInputProps extends WebComponentProps {
867
+ /** Transcriber the host supplies — records audio, returns the text. This is a **function-valued property** (`el.transcribe = async blob => '...'`) because a value-returning callback can't be modelled as a fire-and-forget event. */
868
+ transcribe?: (audio: Blob) => Promise<string>;
869
+ /** Disable the mic button (non-interactive). */
870
+ disabled?: boolean;
871
+ /** Raw audio captured (before transcription) — for hosts that prefer to handle transcription themselves instead of via the `transcribe` property. */
872
+ onAudioCaptured?: (event: CustomEvent<{ blob: Blob }>) => void;
873
+ /** Transcription completed (the `transcribe` property resolved). */
874
+ onTranscription?: (event: CustomEvent<{ text: string }>) => void;
875
+ }
876
+
877
+ export const VoiceInput = createWebComponent<VoiceInputProps>(
878
+ 'kai-voice-input',
879
+ ["theme","transcribe","disabled"],
880
+ { onAudioCaptured: 'kai-audio-captured', onTranscription: 'kai-transcription' },
881
+ );
882
+
883
+ export interface WorkspaceProps extends WebComponentProps {
884
+ /** Pre-bucketed conversation groups for the sidebar. Set as a JS property. */
885
+ groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
886
+ /** Flat conversation list (auto-bucketed if `groups` is empty). Set as a JS property. */
887
+ conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
888
+ /** Id of the open conversation, highlighted in the sidebar. */
889
+ activeId?: string;
890
+ /** The active conversation's message thread, newest last. Set as a JS property. */
891
+ messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit" | { id: string; label: string; icon?: undefined | string; tooltip?: undefined | string })[]; avatar?: undefined | { src?: undefined | string; fallback?: undefined | string; alt?: undefined | string } }[];
892
+ value?: string;
893
+ placeholder?: string;
894
+ loading?: boolean;
895
+ suggestions?: string[];
896
+ suggestionMode?: "submit" | "fill";
897
+ proseSize?: "xs" | "sm" | "base" | "lg";
898
+ codeTheme?: string;
899
+ codeHighlight?: boolean;
900
+ chatTitle?: string;
901
+ models?: { id: string; name: string; provider?: string; description?: string; group?: string }[];
902
+ currentModel?: string;
903
+ context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
904
+ scrollButton?: boolean;
905
+ search?: boolean;
906
+ voice?: boolean;
907
+ slashCommands?: { id: string; label: string; description?: string; category?: string }[];
908
+ slashActiveIds?: string[];
909
+ slashCompact?: boolean;
910
+ /** Sidebar default width as a percent of the workspace (default 22). */
911
+ sidebarWidth?: number;
912
+ /** Sidebar min width in px (default 200). */
913
+ sidebarMinWidth?: number;
914
+ /** Sidebar max width in px (default 420). */
915
+ sidebarMaxWidth?: number;
916
+ /** Controlled collapsed state. Set this as a JS property (`el.sidebarCollapsed = true`) to drive the sidebar from your app, updating it in response to the `kai-sidebar-toggle` event. Omit for uncontrolled (the element manages it). */
917
+ sidebarCollapsed?: boolean;
918
+ /** Initial collapsed state when uncontrolled (default false). Use the `default-sidebar-collapsed` attribute to start collapsed in plain HTML. */
919
+ defaultSidebarCollapsed?: boolean;
920
+ /** A conversation was selected in the sidebar. */
921
+ onConversationSelect?: (event: CustomEvent<{ id: string }>) => void;
922
+ /** An action button on a message was clicked. */
923
+ onMessageAction?: (event: CustomEvent<{ messageId: string; action: string }>) => void;
924
+ /** The header model switcher changed. */
925
+ onModelChange?: (event: CustomEvent<{ modelId: string }>) => void;
926
+ /** The "New chat" button was clicked. */
927
+ onNewChat?: (event: CustomEvent<Record<string, never>>) => void;
928
+ /** The Search button was clicked. */
929
+ onSearch?: (event: CustomEvent<Record<string, never>>) => void;
930
+ /** The sidebar was collapsed or expanded. */
931
+ onSidebarToggle?: (event: CustomEvent<{ collapsed: boolean }>) => void;
932
+ /** A slash command was chosen from the palette. */
933
+ onSlashSelect?: (event: CustomEvent<{ command: { id: string; label: string; description?: undefined | string; category?: undefined | string } }>) => void;
934
+ /** User submitted a message. */
935
+ onSubmit?: (event: CustomEvent<{ value: string; attachments: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[] }>) => void;
936
+ /** A suggestion chip was clicked (only in `suggestion-mode="fill"`). */
937
+ onSuggestionClick?: (event: CustomEvent<{ value: string }>) => void;
938
+ /** Fired on every input change. */
939
+ onValueChange?: (event: CustomEvent<{ value: string }>) => void;
940
+ /** The Mic / voice button was clicked. */
941
+ onVoice?: (event: CustomEvent<Record<string, never>>) => void;
942
+ }
943
+
944
+ export const Workspace = createWebComponent<WorkspaceProps>(
945
+ 'kai-workspace',
946
+ ["theme","groups","conversations","activeId","messages","value","placeholder","loading","suggestions","suggestionMode","proseSize","codeTheme","codeHighlight","chatTitle","models","currentModel","context","scrollButton","search","voice","slashCommands","slashActiveIds","slashCompact","sidebarWidth","sidebarMinWidth","sidebarMaxWidth","sidebarCollapsed","defaultSidebarCollapsed"],
947
+ { onConversationSelect: 'kai-conversation-select', onMessageAction: 'kai-message-action', onModelChange: 'kai-model-change', onNewChat: 'kai-new-chat', onSearch: 'kai-search', onSidebarToggle: 'kai-sidebar-toggle', onSlashSelect: 'kai-slash-select', onSubmit: 'kai-submit', onSuggestionClick: 'kai-suggestion-click', onValueChange: 'kai-value-change', onVoice: 'kai-voice' },
948
+ );