@kivacore/ui-pro-ai-assistant 0.0.0-stage → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/README.md +853 -2
  2. package/dist/chunk-CGXM4YJQ.js +165 -0
  3. package/dist/chunk-CGXM4YJQ.js.map +1 -0
  4. package/dist/chunk-TMVZZNHD.js +7493 -0
  5. package/dist/chunk-TMVZZNHD.js.map +1 -0
  6. package/dist/components/adaptive-card-tool.d.ts +12 -0
  7. package/dist/components/agent-consent-dialog.d.ts +23 -0
  8. package/dist/components/agent-tabs.d.ts +40 -0
  9. package/dist/components/agent-trigger-widget/agent-carousel.d.ts +8 -0
  10. package/dist/components/agent-trigger-widget/agent-trigger-prompt.d.ts +19 -0
  11. package/dist/components/agent-trigger-widget/index.d.ts +8 -0
  12. package/dist/components/ai-assistant-trigger-widget/index.d.ts +58 -0
  13. package/dist/components/assistant-animations.d.ts +9 -0
  14. package/dist/components/assistant-dialogs.d.ts +30 -0
  15. package/dist/components/citation-link.d.ts +17 -0
  16. package/dist/components/code-view.d.ts +30 -0
  17. package/dist/components/context-usage-notice.d.ts +14 -0
  18. package/dist/components/create-agent-task.d.ts +9 -0
  19. package/dist/components/create-new-work-version.d.ts +7 -0
  20. package/dist/components/credit-usage-report.d.ts +34 -0
  21. package/dist/components/extract-web.d.ts +9 -0
  22. package/dist/components/field-form-layout.d.ts +17 -0
  23. package/dist/components/field-value-layout.d.ts +9 -0
  24. package/dist/components/forward-to-agent.d.ts +8 -0
  25. package/dist/components/generate-chart.d.ts +11 -0
  26. package/dist/components/generative-action-button.d.ts +11 -0
  27. package/dist/components/generative-tool.d.ts +72 -0
  28. package/dist/components/generative-ui-object.d.ts +26 -0
  29. package/dist/components/infographic.d.ts +9 -0
  30. package/dist/components/input-area.d.ts +87 -0
  31. package/dist/components/json-schema-layout.d.ts +6 -0
  32. package/dist/components/knowledge-base/index.d.ts +5 -0
  33. package/dist/components/knowledge-base/knowledge-base-panel.d.ts +17 -0
  34. package/dist/components/knowledge-base/knowledge-file-list.d.ts +21 -0
  35. package/dist/components/knowledge-base/knowledge-files.d.ts +209 -0
  36. package/dist/components/knowledge-base/use-google-file-picker.d.ts +38 -0
  37. package/dist/components/knowledge-base/use-microsoft-file-picker.d.ts +33 -0
  38. package/dist/components/list-item-card.d.ts +17 -0
  39. package/dist/components/mermaid-diagram.d.ts +8 -0
  40. package/dist/components/message-avatar.d.ts +11 -0
  41. package/dist/components/no-access-dialog.d.ts +23 -0
  42. package/dist/components/out-of-credits-dialog.d.ts +21 -0
  43. package/dist/components/preview-image.d.ts +16 -0
  44. package/dist/components/prompt-template-form.d.ts +16 -0
  45. package/dist/components/prompt-template-selector.d.ts +39 -0
  46. package/dist/components/request-approval.d.ts +9 -0
  47. package/dist/components/request-user-input.d.ts +31 -0
  48. package/dist/components/search-web.d.ts +8 -0
  49. package/dist/components/sharing-editor.d.ts +8 -0
  50. package/dist/components/sheet-command.d.ts +11 -0
  51. package/dist/components/shell-canvas.d.ts +16 -0
  52. package/dist/components/show-advanced-data-table.d.ts +40 -0
  53. package/dist/components/show-generated-content-options.d.ts +16 -0
  54. package/dist/components/show-people-cards.d.ts +8 -0
  55. package/dist/components/subagent-tool.d.ts +23 -0
  56. package/dist/components/template-output.d.ts +11 -0
  57. package/dist/components/text-editor-tool.d.ts +23 -0
  58. package/dist/components/thread-debug-panel.d.ts +29 -0
  59. package/dist/components/work-canvas.d.ts +13 -0
  60. package/dist/components/work-card.d.ts +9 -0
  61. package/dist/hooks/index.d.ts +10 -0
  62. package/dist/hooks/use-agents-data.d.ts +20 -0
  63. package/dist/hooks/use-assistant-api.d.ts +73 -0
  64. package/dist/hooks/use-deployment-data.d.ts +38 -0
  65. package/dist/hooks/use-project-state.d.ts +64 -0
  66. package/dist/hooks/use-resolved-record-fields.d.ts +39 -0
  67. package/dist/hooks/use-session-state.d.ts +32 -0
  68. package/dist/hooks/use-sharing.d.ts +21 -0
  69. package/dist/hooks/use-speech-recognition.d.ts +22 -0
  70. package/dist/hooks/use-ui-state.d.ts +29 -0
  71. package/dist/hooks/use-works-state.d.ts +22 -0
  72. package/dist/i18n/context.d.ts +11 -0
  73. package/dist/i18n/index.d.ts +13 -0
  74. package/dist/i18n/types.d.ts +18 -0
  75. package/dist/i18n/use-translation.d.ts +2 -0
  76. package/dist/index.d.ts +18 -0
  77. package/dist/index.js +26760 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/internal/plate-editor/editor/auth-context.d.ts +6 -0
  80. package/dist/internal/plate-editor/editor/editor-base-kit.d.ts +1 -0
  81. package/dist/internal/plate-editor/editor/editor-kit.d.ts +5 -0
  82. package/dist/internal/plate-editor/editor/plate-editor.d.ts +20 -0
  83. package/dist/internal/plate-editor/editor/plate-types.d.ts +70 -0
  84. package/dist/internal/plate-editor/editor/plugins/ai-kit.d.ts +3 -0
  85. package/dist/internal/plate-editor/editor/plugins/autoformat-kit.d.ts +1 -0
  86. package/dist/internal/plate-editor/editor/plugins/basic-blocks-base-kit.d.ts +5 -0
  87. package/dist/internal/plate-editor/editor/plugins/basic-blocks-kit.d.ts +5 -0
  88. package/dist/internal/plate-editor/editor/plugins/basic-marks-base-kit.d.ts +17 -0
  89. package/dist/internal/plate-editor/editor/plugins/basic-marks-kit.d.ts +17 -0
  90. package/dist/internal/plate-editor/editor/plugins/basic-nodes-kit.d.ts +21 -0
  91. package/dist/internal/plate-editor/editor/plugins/block-menu-kit.d.ts +165 -0
  92. package/dist/internal/plate-editor/editor/plugins/block-placeholder-kit.d.ts +14 -0
  93. package/dist/internal/plate-editor/editor/plugins/block-selection-kit.d.ts +137 -0
  94. package/dist/internal/plate-editor/editor/plugins/callout-base-kit.d.ts +20 -0
  95. package/dist/internal/plate-editor/editor/plugins/callout-kit.d.ts +20 -0
  96. package/dist/internal/plate-editor/editor/plugins/code-block-base-kit.d.ts +7 -0
  97. package/dist/internal/plate-editor/editor/plugins/code-block-kit.d.ts +7 -0
  98. package/dist/internal/plate-editor/editor/plugins/column-base-kit.d.ts +1 -0
  99. package/dist/internal/plate-editor/editor/plugins/column-kit.d.ts +1 -0
  100. package/dist/internal/plate-editor/editor/plugins/comment-base-kit.d.ts +47 -0
  101. package/dist/internal/plate-editor/editor/plugins/comment-kit.d.ts +71 -0
  102. package/dist/internal/plate-editor/editor/plugins/copilot-kit.d.ts +1 -0
  103. package/dist/internal/plate-editor/editor/plugins/cursor-overlay-kit.d.ts +11 -0
  104. package/dist/internal/plate-editor/editor/plugins/date-base-kit.d.ts +19 -0
  105. package/dist/internal/plate-editor/editor/plugins/date-kit.d.ts +19 -0
  106. package/dist/internal/plate-editor/editor/plugins/discussion-kit.d.ts +55 -0
  107. package/dist/internal/plate-editor/editor/plugins/dnd-kit.d.ts +20 -0
  108. package/dist/internal/plate-editor/editor/plugins/docx-export-kit.d.ts +16 -0
  109. package/dist/internal/plate-editor/editor/plugins/docx-kit.d.ts +1 -0
  110. package/dist/internal/plate-editor/editor/plugins/emoji-kit.d.ts +2 -0
  111. package/dist/internal/plate-editor/editor/plugins/exit-break-kit.d.ts +4 -0
  112. package/dist/internal/plate-editor/editor/plugins/floating-toolbar-kit.d.ts +1 -0
  113. package/dist/internal/plate-editor/editor/plugins/font-base-kit.d.ts +13 -0
  114. package/dist/internal/plate-editor/editor/plugins/font-kit.d.ts +13 -0
  115. package/dist/internal/plate-editor/editor/plugins/indent-base-kit.d.ts +1 -0
  116. package/dist/internal/plate-editor/editor/plugins/indent-kit.d.ts +5 -0
  117. package/dist/internal/plate-editor/editor/plugins/link-base-kit.d.ts +1 -0
  118. package/dist/internal/plate-editor/editor/plugins/link-kit.d.ts +68 -0
  119. package/dist/internal/plate-editor/editor/plugins/list-base-kit.d.ts +1 -0
  120. package/dist/internal/plate-editor/editor/plugins/list-kit.d.ts +8 -0
  121. package/dist/internal/plate-editor/editor/plugins/markdown-kit.d.ts +1 -0
  122. package/dist/internal/plate-editor/editor/plugins/math-base-kit.d.ts +9 -0
  123. package/dist/internal/plate-editor/editor/plugins/math-kit.d.ts +9 -0
  124. package/dist/internal/plate-editor/editor/plugins/media-base-kit.d.ts +25 -0
  125. package/dist/internal/plate-editor/editor/plugins/media-kit.d.ts +38 -0
  126. package/dist/internal/plate-editor/editor/plugins/mention-base-kit.d.ts +2 -0
  127. package/dist/internal/plate-editor/editor/plugins/mention-kit.d.ts +2 -0
  128. package/dist/internal/plate-editor/editor/plugins/slash-kit.d.ts +2 -0
  129. package/dist/internal/plate-editor/editor/plugins/suggestion-base-kit.d.ts +32 -0
  130. package/dist/internal/plate-editor/editor/plugins/suggestion-kit.d.ts +53 -0
  131. package/dist/internal/plate-editor/editor/plugins/table-base-kit.d.ts +94 -0
  132. package/dist/internal/plate-editor/editor/plugins/table-kit.d.ts +162 -0
  133. package/dist/internal/plate-editor/editor/plugins/toc-base-kit.d.ts +1 -0
  134. package/dist/internal/plate-editor/editor/plugins/toc-kit.d.ts +5 -0
  135. package/dist/internal/plate-editor/editor/plugins/toggle-base-kit.d.ts +12 -0
  136. package/dist/internal/plate-editor/editor/plugins/toggle-kit.d.ts +16 -0
  137. package/dist/internal/plate-editor/editor/transforms.d.ts +8 -0
  138. package/dist/internal/plate-editor/editor/use-chat.d.ts +26 -0
  139. package/dist/internal/plate-editor/hooks/index.d.ts +3 -0
  140. package/dist/internal/plate-editor/hooks/use-copy-to-clipboard.d.ts +6 -0
  141. package/dist/internal/plate-editor/hooks/use-is-touch-device.d.ts +1 -0
  142. package/dist/internal/plate-editor/hooks/use-lock-scroll.d.ts +1 -0
  143. package/dist/internal/plate-editor/hooks/use-media-query.d.ts +2 -0
  144. package/dist/internal/plate-editor/hooks/use-mounted.d.ts +6 -0
  145. package/dist/internal/plate-editor/hooks/use-on-click-outside.d.ts +18 -0
  146. package/dist/internal/plate-editor/hooks/use-upload-file.d.ts +21 -0
  147. package/dist/internal/plate-editor/i18n/context.d.ts +12 -0
  148. package/dist/internal/plate-editor/i18n/index.d.ts +3 -0
  149. package/dist/internal/plate-editor/i18n/types.d.ts +58 -0
  150. package/dist/internal/plate-editor/i18n/use-translation.d.ts +4 -0
  151. package/dist/internal/plate-editor/index.d.ts +9 -0
  152. package/dist/internal/plate-editor/lib/ai-output-converter.d.ts +57 -0
  153. package/dist/internal/plate-editor/lib/download-file.d.ts +1 -0
  154. package/dist/internal/plate-editor/plate-ui/ai-chat-editor.d.ts +3 -0
  155. package/dist/internal/plate-editor/plate-ui/ai-menu.d.ts +1 -0
  156. package/dist/internal/plate-editor/plate-ui/ai-node.d.ts +3 -0
  157. package/dist/internal/plate-editor/plate-ui/ai-toolbar-button.d.ts +3 -0
  158. package/dist/internal/plate-editor/plate-ui/alert-dialog.d.ts +50 -0
  159. package/dist/internal/plate-editor/plate-ui/align-toolbar-button.d.ts +2 -0
  160. package/dist/internal/plate-editor/plate-ui/avatar.d.ts +1 -0
  161. package/dist/internal/plate-editor/plate-ui/block-context-menu.d.ts +8 -0
  162. package/dist/internal/plate-editor/plate-ui/block-discussion.d.ts +3 -0
  163. package/dist/internal/plate-editor/plate-ui/block-draggable.d.ts +2 -0
  164. package/dist/internal/plate-editor/plate-ui/block-list-static.d.ts +2 -0
  165. package/dist/internal/plate-editor/plate-ui/block-list.d.ts +2 -0
  166. package/dist/internal/plate-editor/plate-ui/block-menu.d.ts +167 -0
  167. package/dist/internal/plate-editor/plate-ui/block-selection.d.ts +5 -0
  168. package/dist/internal/plate-editor/plate-ui/block-suggestion.d.ts +16 -0
  169. package/dist/internal/plate-editor/plate-ui/blockquote-node-static.d.ts +2 -0
  170. package/dist/internal/plate-editor/plate-ui/blockquote-node.d.ts +2 -0
  171. package/dist/internal/plate-editor/plate-ui/button.d.ts +40 -0
  172. package/dist/internal/plate-editor/plate-ui/calendar.d.ts +1 -0
  173. package/dist/internal/plate-editor/plate-ui/callout-node-static.d.ts +6 -0
  174. package/dist/internal/plate-editor/plate-ui/callout-node.d.ts +2 -0
  175. package/dist/internal/plate-editor/plate-ui/caption.d.ts +10 -0
  176. package/dist/internal/plate-editor/plate-ui/checkbox.d.ts +1 -0
  177. package/dist/internal/plate-editor/plate-ui/code-block-node-static.d.ts +12 -0
  178. package/dist/internal/plate-editor/plate-ui/code-block-node.d.ts +4 -0
  179. package/dist/internal/plate-editor/plate-ui/code-node-static.d.ts +2 -0
  180. package/dist/internal/plate-editor/plate-ui/code-node.d.ts +2 -0
  181. package/dist/internal/plate-editor/plate-ui/column-node-static.d.ts +12 -0
  182. package/dist/internal/plate-editor/plate-ui/column-node.d.ts +4 -0
  183. package/dist/internal/plate-editor/plate-ui/command.d.ts +25 -0
  184. package/dist/internal/plate-editor/plate-ui/comment-node-static.d.ts +3 -0
  185. package/dist/internal/plate-editor/plate-ui/comment-node.d.ts +3 -0
  186. package/dist/internal/plate-editor/plate-ui/comment-toolbar-button.d.ts +1 -0
  187. package/dist/internal/plate-editor/plate-ui/comment.d.ts +45 -0
  188. package/dist/internal/plate-editor/plate-ui/cursor-overlay.d.ts +4 -0
  189. package/dist/internal/plate-editor/plate-ui/date-node-static.d.ts +2 -0
  190. package/dist/internal/plate-editor/plate-ui/date-node.d.ts +2 -0
  191. package/dist/internal/plate-editor/plate-ui/dialog.d.ts +52 -0
  192. package/dist/internal/plate-editor/plate-ui/dropdown-menu.d.ts +36 -0
  193. package/dist/internal/plate-editor/plate-ui/editor-static.d.ts +6 -0
  194. package/dist/internal/plate-editor/plate-ui/editor.d.ts +15 -0
  195. package/dist/internal/plate-editor/plate-ui/emoji-node.d.ts +7 -0
  196. package/dist/internal/plate-editor/plate-ui/emoji-toolbar-button.d.ts +20 -0
  197. package/dist/internal/plate-editor/plate-ui/equation-node-static.d.ts +14 -0
  198. package/dist/internal/plate-editor/plate-ui/equation-node.d.ts +4 -0
  199. package/dist/internal/plate-editor/plate-ui/equation-toolbar-button.d.ts +3 -0
  200. package/dist/internal/plate-editor/plate-ui/export-toolbar-button.d.ts +2 -0
  201. package/dist/internal/plate-editor/plate-ui/fixed-toolbar-buttons.d.ts +1 -0
  202. package/dist/internal/plate-editor/plate-ui/fixed-toolbar.d.ts +3 -0
  203. package/dist/internal/plate-editor/plate-ui/floating-discussion.d.ts +1 -0
  204. package/dist/internal/plate-editor/plate-ui/floating-toolbar-buttons.d.ts +1 -0
  205. package/dist/internal/plate-editor/plate-ui/floating-toolbar.d.ts +6 -0
  206. package/dist/internal/plate-editor/plate-ui/font-color-toolbar-button.d.ts +15 -0
  207. package/dist/internal/plate-editor/plate-ui/font-size-toolbar-button.d.ts +1 -0
  208. package/dist/internal/plate-editor/plate-ui/ghost-text.d.ts +2 -0
  209. package/dist/internal/plate-editor/plate-ui/heading-node-static.d.ts +7 -0
  210. package/dist/internal/plate-editor/plate-ui/heading-node.d.ts +11 -0
  211. package/dist/internal/plate-editor/plate-ui/highlight-node-static.d.ts +2 -0
  212. package/dist/internal/plate-editor/plate-ui/highlight-node.d.ts +2 -0
  213. package/dist/internal/plate-editor/plate-ui/history-toolbar-button.d.ts +4 -0
  214. package/dist/internal/plate-editor/plate-ui/hover-card.d.ts +1 -0
  215. package/dist/internal/plate-editor/plate-ui/hr-node-static.d.ts +2 -0
  216. package/dist/internal/plate-editor/plate-ui/hr-node.d.ts +2 -0
  217. package/dist/internal/plate-editor/plate-ui/import-toolbar-button.d.ts +2 -0
  218. package/dist/internal/plate-editor/plate-ui/indent-toolbar-button.d.ts +4 -0
  219. package/dist/internal/plate-editor/plate-ui/inline-combobox.d.ts +37 -0
  220. package/dist/internal/plate-editor/plate-ui/input.d.ts +7 -0
  221. package/dist/internal/plate-editor/plate-ui/insert-toolbar-button.d.ts +2 -0
  222. package/dist/internal/plate-editor/plate-ui/label.d.ts +1 -0
  223. package/dist/internal/plate-editor/plate-ui/line-height-toolbar-button.d.ts +2 -0
  224. package/dist/internal/plate-editor/plate-ui/link-node-static.d.ts +3 -0
  225. package/dist/internal/plate-editor/plate-ui/link-node.d.ts +7 -0
  226. package/dist/internal/plate-editor/plate-ui/link-toolbar-button.d.ts +3 -0
  227. package/dist/internal/plate-editor/plate-ui/link-toolbar.d.ts +1 -0
  228. package/dist/internal/plate-editor/plate-ui/list-toolbar-button.d.ts +5 -0
  229. package/dist/internal/plate-editor/plate-ui/mark-toolbar-button.d.ts +6 -0
  230. package/dist/internal/plate-editor/plate-ui/media-audio-node-static.d.ts +3 -0
  231. package/dist/internal/plate-editor/plate-ui/media-audio-node.d.ts +2 -0
  232. package/dist/internal/plate-editor/plate-ui/media-embed-node.d.ts +2 -0
  233. package/dist/internal/plate-editor/plate-ui/media-file-node-static.d.ts +3 -0
  234. package/dist/internal/plate-editor/plate-ui/media-file-node.d.ts +2 -0
  235. package/dist/internal/plate-editor/plate-ui/media-image-node-static.d.ts +3 -0
  236. package/dist/internal/plate-editor/plate-ui/media-image-node.d.ts +3 -0
  237. package/dist/internal/plate-editor/plate-ui/media-placeholder-node.d.ts +2 -0
  238. package/dist/internal/plate-editor/plate-ui/media-preview-dialog.d.ts +1 -0
  239. package/dist/internal/plate-editor/plate-ui/media-toolbar-button.d.ts +4 -0
  240. package/dist/internal/plate-editor/plate-ui/media-toolbar.d.ts +3 -0
  241. package/dist/internal/plate-editor/plate-ui/media-upload-toast.d.ts +1 -0
  242. package/dist/internal/plate-editor/plate-ui/media-video-node-static.d.ts +3 -0
  243. package/dist/internal/plate-editor/plate-ui/media-video-node.d.ts +2 -0
  244. package/dist/internal/plate-editor/plate-ui/mention-node-static.d.ts +5 -0
  245. package/dist/internal/plate-editor/plate-ui/mention-node.d.ts +11 -0
  246. package/dist/internal/plate-editor/plate-ui/menu.d.ts +103 -0
  247. package/dist/internal/plate-editor/plate-ui/mode-toolbar-button.d.ts +2 -0
  248. package/dist/internal/plate-editor/plate-ui/more-toolbar-button.d.ts +1 -0
  249. package/dist/internal/plate-editor/plate-ui/paragraph-node-static.d.ts +2 -0
  250. package/dist/internal/plate-editor/plate-ui/paragraph-node.d.ts +2 -0
  251. package/dist/internal/plate-editor/plate-ui/popover.d.ts +11 -0
  252. package/dist/internal/plate-editor/plate-ui/progress.d.ts +1 -0
  253. package/dist/internal/plate-editor/plate-ui/remote-cursor-overlay.d.ts +1 -0
  254. package/dist/internal/plate-editor/plate-ui/resize-handle.d.ts +17 -0
  255. package/dist/internal/plate-editor/plate-ui/separator.d.ts +8 -0
  256. package/dist/internal/plate-editor/plate-ui/slash-node.d.ts +2 -0
  257. package/dist/internal/plate-editor/plate-ui/spinner.d.ts +1 -0
  258. package/dist/internal/plate-editor/plate-ui/suggestion-node-static.d.ts +3 -0
  259. package/dist/internal/plate-editor/plate-ui/suggestion-node.d.ts +5 -0
  260. package/dist/internal/plate-editor/plate-ui/suggestion-toolbar-button.d.ts +1 -0
  261. package/dist/internal/plate-editor/plate-ui/table-node-static.d.ts +8 -0
  262. package/dist/internal/plate-editor/plate-ui/table-node.d.ts +9 -0
  263. package/dist/internal/plate-editor/plate-ui/table-toolbar-button.d.ts +2 -0
  264. package/dist/internal/plate-editor/plate-ui/tabs.d.ts +1 -0
  265. package/dist/internal/plate-editor/plate-ui/textarea.d.ts +10 -0
  266. package/dist/internal/plate-editor/plate-ui/toc-node-static.d.ts +7 -0
  267. package/dist/internal/plate-editor/plate-ui/toc-node.d.ts +2 -0
  268. package/dist/internal/plate-editor/plate-ui/toc-sidebar.d.ts +1 -0
  269. package/dist/internal/plate-editor/plate-ui/toggle-node-static.d.ts +2 -0
  270. package/dist/internal/plate-editor/plate-ui/toggle-node.d.ts +2 -0
  271. package/dist/internal/plate-editor/plate-ui/toggle-toolbar-button.d.ts +3 -0
  272. package/dist/internal/plate-editor/plate-ui/toggle.d.ts +1 -0
  273. package/dist/internal/plate-editor/plate-ui/toolbar.d.ts +39 -0
  274. package/dist/internal/plate-editor/plate-ui/tooltip.d.ts +19 -0
  275. package/dist/internal/plate-editor/plate-ui/turn-into-toolbar-button.d.ts +63 -0
  276. package/dist/internal/plate-editor/types/index.d.ts +1 -0
  277. package/dist/internal/plate-editor/vite.d.ts +4 -0
  278. package/dist/internal/sheets/components/kiva-sheets.d.ts +51 -0
  279. package/dist/internal/sheets/i18n/context.d.ts +11 -0
  280. package/dist/internal/sheets/i18n/index.d.ts +13 -0
  281. package/dist/internal/sheets/i18n/types.d.ts +18 -0
  282. package/dist/internal/sheets/i18n/use-translation.d.ts +2 -0
  283. package/dist/internal/sheets/index.d.ts +5 -0
  284. package/dist/internal/sheets/types/index.d.ts +259 -0
  285. package/dist/internal/sheets/xlsx.d.ts +40 -0
  286. package/dist/kiva-assistant.d.ts +5 -0
  287. package/dist/lib/api-client.d.ts +30 -0
  288. package/dist/lib/api-errors.d.ts +29 -0
  289. package/dist/lib/assistant-api-actions.d.ts +87 -0
  290. package/dist/lib/assistant-config.d.ts +108 -0
  291. package/dist/lib/citations.d.ts +61 -0
  292. package/dist/lib/class-utils.d.ts +22 -0
  293. package/dist/lib/client-tools.d.ts +47 -0
  294. package/dist/lib/context-usage.d.ts +73 -0
  295. package/dist/lib/external-file-providers.d.ts +62 -0
  296. package/dist/lib/google-file-picker-auth.d.ts +50 -0
  297. package/dist/lib/index.d.ts +7 -0
  298. package/dist/lib/message-utils.d.ts +47 -0
  299. package/dist/lib/microsoft-file-picker-auth.d.ts +39 -0
  300. package/dist/stub.d.ts +12 -0
  301. package/dist/stub.js +15 -0
  302. package/dist/stub.js.map +1 -0
  303. package/dist/styles.css +143 -0
  304. package/dist/tools/create-record.d.ts +12 -0
  305. package/dist/tools/delete-record.d.ts +12 -0
  306. package/dist/tools/update-record.d.ts +13 -0
  307. package/dist/tools/view-record.d.ts +11 -0
  308. package/dist/trigger-widget.d.ts +6 -0
  309. package/dist/trigger-widget.js +3 -0
  310. package/dist/trigger-widget.js.map +1 -0
  311. package/dist/types/index.d.ts +480 -0
  312. package/dist/views/assistant-view.d.ts +147 -0
  313. package/dist/views/canvas-app.d.ts +5 -0
  314. package/dist/views/canvas-code.d.ts +9 -0
  315. package/dist/views/canvas-deep-research.d.ts +8 -0
  316. package/dist/views/canvas-document.d.ts +26 -0
  317. package/dist/views/canvas-image.d.ts +13 -0
  318. package/dist/views/canvas-record-view.d.ts +10 -0
  319. package/dist/views/canvas-spreadsheet.d.ts +13 -0
  320. package/dist/views/canvas-text.d.ts +8 -0
  321. package/dist/views/canvas.d.ts +12 -0
  322. package/dist/views/chat-panel.d.ts +127 -0
  323. package/dist/views/index.d.ts +14 -0
  324. package/dist/views/memories-panel.d.ts +7 -0
  325. package/dist/views/message-list.d.ts +45 -0
  326. package/dist/views/project-detail.d.ts +33 -0
  327. package/dist/views/projects-panel.d.ts +16 -0
  328. package/dist/views/sessions-list.d.ts +16 -0
  329. package/dist/views/sidebar-content.d.ts +27 -0
  330. package/dist/views/work-detail.d.ts +9 -0
  331. package/dist/vite.d.ts +2 -0
  332. package/dist/vite.js +55 -0
  333. package/dist/vite.js.map +1 -0
  334. package/dist/worker.d.ts +2 -0
  335. package/dist/worker.js +3 -0
  336. package/dist/worker.js.map +1 -0
  337. package/package.json +151 -3
package/README.md CHANGED
@@ -1,3 +1,854 @@
1
- # Temporary Holding Version
1
+ # @kivacore/ui-pro-ai-assistant
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A full-featured, drop-in AI assistant chat UI for React. Ships with multi-turn conversations, a work canvas, project management, multi-model and multi-agent support, voice input, file uploads, deep research, and built-in i18n for 9 languages.
4
+
5
+ ## Highlights
6
+
7
+ - **Plug-and-play chat interface** — Modal or inline rendering with a single component.
8
+ - **Work canvas** — AI-generated outputs (text, code, spreadsheets, images, charts, documents) are rendered in type-specific viewers side-by-side with the conversation.
9
+ - **Projects & sessions** — Organize conversations into projects, manage threads, and persist context. Session list shows creation date and author on hover.
10
+ - **Multi-model & multi-agent** — Let users switch between AI models and agent deployments on the fly. Agent avatars display in the header and message list.
11
+ - **Deep research** — Extended research mode with live progress streaming.
12
+ - **AI memories** — Persistent memory management across sessions.
13
+ - **Knowledge base** — Upload, write, import, OCR and delete the documents attached to an agent deployment or a project. Usable on its own via `<KnowledgeBasePanel>`.
14
+ - **Microsoft file picking** — Attach a document straight from OneDrive, in the knowledge base and in the chat composer, using the Microsoft session the host already has.
15
+ - **Agent consent gate** — Agents requiring consent show a non-closable terms dialog and block the prompt input until a `super_admin` approves.
16
+ - **Credit and permission gates** — A turn the backend refuses for spent AI credits (HTTP 402) or for a role with no grant on the assistant's `thread` data source (HTTP 403) is reported in a dialog rather than an empty panel. A permission denial on reading threads is latched, so the rejected request is not replayed; one on sending returns the typed text to the composer.
17
+ - **Edit & resend prompts** — Hover any user message to edit it; subsequent assistant replies are archived server-side and the conversation regenerates from that point.
18
+ - **Prompt templates** — A searchable picker in the chat input lists the agent's prompt templates; selecting one prefills the prompt or, when the template defines a form schema, opens a form (built-in, or host-rendered via `renderPromptTemplateForm`) whose values fill the template's `{{placeholders}}`.
19
+ - **Voice input** — Records the microphone and transcribes it through the Kiva `/ai/transcribe` endpoint.
20
+ - **File uploads** — Attach files to messages with configurable format restrictions, from the browser or from OneDrive.
21
+ - **Citations** — When an answer cites an attached document, the citation renders as a numbered badge; clicking it opens the document in the canvas, scrolled to the cited lines. Documents opened this way stay on a tab bar, so following citations into several files keeps the earlier ones within reach.
22
+ - **Agent trigger widget** — Standalone agent carousel with prompt input, per-agent capabilities, model/reasoning selection, and suggestion chips. Decoupled from the chat UI — wire it to any destination.
23
+ - **Assistant trigger widget** — A dashboard-sized welcome surface: agent tabs, avatar, welcome message, composer and recent sessions, and no conversation. Its composer keeps only "attach" in view and folds the rest into a settings menu. It hands the composed turn — with every setting — to a full `<KivaAssistant>` elsewhere, which sends it as-is.
24
+ - **Chromeless mode** — Optionally hide the header and/or border for seamless embedding.
25
+ - **i18n** — English, German, Spanish, French, Italian, Portuguese, Greek, Slovenian, Turkish.
26
+ - **Vite plugin** — Optional dev-server middleware for Plate editor AI commands.
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install @kivacore/ui-pro-ai-assistant
32
+ ```
33
+
34
+ ### Peer dependencies
35
+
36
+ ```bash
37
+ npm install @kivacore/api-client @kivacore/ui-pro-shared react react-dom
38
+ ```
39
+
40
+ | Peer | Version |
41
+ |------|---------|
42
+ | `@kivacore/api-client` | `>= 0.1.0` |
43
+ | `@kivacore/ui-pro-shared` | `>= 0.0.1` |
44
+ | `react` | `^19` |
45
+ | `react-dom` | `^19` |
46
+ | `tailwindcss` | `^4.0.0` |
47
+ | `vite` | `>= 5.0.0` *(optional)* |
48
+
49
+ ## Setup
50
+
51
+ This package ships React component sources that use Tailwind v4 utility classes —
52
+ **it does not bundle a CSS utilities file**. Your app's Tailwind build generates the
53
+ utilities, which keeps the consumer in full control of theme tokens and avoids
54
+ class-name collisions.
55
+
56
+ ### 1. Import the component CSS once at app root
57
+
58
+ ```css
59
+ /* your app's globals.css */
60
+ @import "tailwindcss";
61
+ @import "@kivacore/ui-pro-ai-assistant/styles.css";
62
+ ```
63
+
64
+ This brings in component-specific custom CSS (container queries, has-selectors,
65
+ markdown styling) — roughly 100 lines.
66
+
67
+ ### 2. Tell Tailwind to scan the package sources
68
+
69
+ Tailwind needs to see the class strings used inside the package's compiled JS
70
+ (and inside its `@kivacore/ui-pro-shared` peer) to generate the utilities they
71
+ reference. Add these `@source` directives next to your other source patterns:
72
+
73
+ ```css
74
+ /* your app's globals.css */
75
+ @source "../path/to/node_modules/@kivacore/ui-pro-ai-assistant/dist/**/*.js";
76
+ @source "../path/to/node_modules/@kivacore/ui-pro-shared/src/**/*.{ts,tsx}";
77
+ ```
78
+
79
+ > The relative path depends on where your `globals.css` lives. In a Vite app the
80
+ > CSS file is usually under `src/styles/`, so the `@source` paths point up to the
81
+ > nearest `node_modules`. Tailwind resolves the path relative to the CSS file.
82
+
83
+ ### 3. Provide shadcn-style theme tokens
84
+
85
+ The package's utilities resolve `--color-background`, `--color-foreground`,
86
+ `--color-primary`, etc. against your app's tokens. If you follow the standard
87
+ shadcn convention (`--background`, `--foreground` on `:root`) plus a `@theme inline`
88
+ mapping (`--color-background: var(--background)`), you're already set. See the
89
+ [shadcn theming docs](https://ui.shadcn.com/docs/theming) for the full block.
90
+
91
+ ## Quick start
92
+
93
+ ```tsx
94
+ import { useCallback, useMemo } from "react";
95
+ import { useKivaAuth } from "@kivacore/signin";
96
+ import { AssistantProvider, KivaAssistant } from "@kivacore/ui-pro-ai-assistant";
97
+
98
+ function App() {
99
+ const { client, status } = useKivaAuth();
100
+
101
+ const getAuthToken = useCallback(async () => {
102
+ const token = await client?.getAccessToken();
103
+ if (!token) throw new Error("No access token available");
104
+ return token;
105
+ }, [client]);
106
+
107
+ const config = useMemo(() => ({
108
+ apiBaseUrl: "https://api.kiva.app/v1",
109
+ getAuthToken,
110
+ user: {
111
+ id: "current-user-id",
112
+ firstname: "Ada",
113
+ lastname: "Lovelace",
114
+ email: "ada@example.com",
115
+ photo: "https://example.com/avatar.png",
116
+ },
117
+ }), [getAuthToken]);
118
+
119
+ if (status !== "authenticated" || !client) {
120
+ return <p>Authenticating...</p>;
121
+ }
122
+
123
+ return (
124
+ <AssistantProvider config={config}>
125
+ <KivaAssistant
126
+ tenantAiAgentId="your-agent-id"
127
+ renderMode="inline"
128
+ enableSidebar
129
+ className="h-full w-full"
130
+ />
131
+ </AssistantProvider>
132
+ );
133
+ }
134
+ ```
135
+
136
+ ### Modal mode
137
+
138
+ ```tsx
139
+ function ModalExample() {
140
+ const [open, setOpen] = useState(false);
141
+
142
+ return (
143
+ <>
144
+ <button onClick={() => setOpen(true)}>Open Assistant</button>
145
+ <AssistantProvider config={config}>
146
+ <KivaAssistant
147
+ tenantAiAgentId="your-agent-id"
148
+ renderMode="modal"
149
+ isOpen={open}
150
+ onClose={() => setOpen(false)}
151
+ />
152
+ </AssistantProvider>
153
+ </>
154
+ );
155
+ }
156
+ ```
157
+
158
+ ## Exports
159
+
160
+ | Entry point | Import path | Description |
161
+ |-------------|-------------|-------------|
162
+ | Main | `@kivacore/ui-pro-ai-assistant` | Components, provider, hooks, and types |
163
+ | Vite plugin | `@kivacore/ui-pro-ai-assistant/vite` | Dev-server middleware for Plate AI |
164
+ | Web worker | `@kivacore/ui-pro-ai-assistant/worker` | Worker entry for AI command handlers |
165
+ | Stylesheet | `@kivacore/ui-pro-ai-assistant/styles.css` | Component-specific custom CSS — import once at app root. Tailwind utilities are generated by your app's Tailwind build (see [Setup](#setup)) |
166
+
167
+ ### Exported symbols
168
+
169
+ ```ts
170
+ // Components
171
+ import {
172
+ KivaAssistant,
173
+ AgentTriggerWidget,
174
+ AiAssistantTriggerWidget,
175
+ KnowledgeBasePanel,
176
+ } from "@kivacore/ui-pro-ai-assistant";
177
+
178
+ // Knowledge base helpers
179
+ import { knowledgeFilesPath } from "@kivacore/ui-pro-ai-assistant";
180
+
181
+ // Microsoft file picking
182
+ import {
183
+ MicrosoftFilePickerAuthProvider,
184
+ useMicrosoftFilePickerAuth,
185
+ } from "@kivacore/ui-pro-ai-assistant";
186
+
187
+ // Provider & config
188
+ import {
189
+ AssistantProvider,
190
+ useAssistantConfig,
191
+ } from "@kivacore/ui-pro-ai-assistant";
192
+
193
+ // i18n
194
+ import {
195
+ AssistantI18nProvider,
196
+ useAssistantTranslation,
197
+ } from "@kivacore/ui-pro-ai-assistant";
198
+
199
+ // Types
200
+ import type {
201
+ AssistantConfig,
202
+ AssistantUser,
203
+ AgentTriggerWidgetProps,
204
+ AiAssistantTriggerSubmission,
205
+ AiAssistantTriggerTarget,
206
+ AiAssistantTriggerWidgetProps,
207
+ AssistantPromptOptions,
208
+ AssistantSession,
209
+ InitialFeatureFlags,
210
+ KnowledgeBasePanelProps,
211
+ KnowledgeFile,
212
+ KnowledgeFileFilter,
213
+ KnowledgeIndexStatus,
214
+ KnowledgeScope,
215
+ MicrosoftFilePickerAuth,
216
+ PromptFeatureFlags,
217
+ Project,
218
+ SelectedAssistantMessage,
219
+ Work,
220
+ WorkTypes,
221
+ } from "@kivacore/ui-pro-ai-assistant";
222
+
223
+ // Vite plugin (separate entry)
224
+ import { plateEditorPlugin } from "@kivacore/ui-pro-ai-assistant/vite";
225
+ ```
226
+
227
+ ## API reference
228
+
229
+ ### `<AssistantProvider>`
230
+
231
+ Wraps your component tree to provide API configuration context. Must be an ancestor of `<KivaAssistant>`.
232
+
233
+ ```tsx
234
+ <AssistantProvider config={config}>
235
+ {children}
236
+ </AssistantProvider>
237
+ ```
238
+
239
+ #### `AssistantConfig`
240
+
241
+ | Property | Type | Required | Description |
242
+ |----------|------|----------|-------------|
243
+ | `apiBaseUrl` | `string` | Yes | Base API URL, e.g. `"https://api.kiva.app/v1"` |
244
+ | `getAuthToken` | `() => Promise<string>` | Yes | Async callback returning a valid Bearer token |
245
+ | `user` | `AssistantUser` | **Yes** | Current authenticated user. Used to filter sessions/projects to the active user and to display name and avatar in the chat |
246
+ | `getDataSourceSchema` | `(id: string) => Promise<DataSourceSchema \| null>` | No | Resolver for data source schemas |
247
+ | `promptTemplatesEndpoint` | `string \| ((agentId: string) => string)` | No | Endpoint (relative to `apiBaseUrl`) the chat calls to list an agent's prompt templates. A string may contain a `:agentId` placeholder; the function form lets a host route different agents to different endpoints. Defaults to the end-user route `/ai/agents/:agentId/prompt-templates` (not the admin-only `/dev/...` studio route) |
248
+ | `renderPromptTemplateForm` | `(args: { template: PromptTemplateInfo; onSubmit: (prompt: string) => void; onCancel: () => void }) => ReactNode` | No | Render slot for a selected prompt template's form. When set, the chat input delegates form rendering to the host (e.g. rendered with the host's own dynamic-form engine); on submit the host hands back the built prompt string. Falls back to the built-in form renderer when omitted |
249
+
250
+ `PromptTemplateInfo` is `{ id: string; title: string; content?: string \| null; promptFormSchema?: unknown }`.
251
+
252
+ #### `AssistantUser`
253
+
254
+ ```ts
255
+ interface AssistantUser {
256
+ id: string; // required — used for server-side filtering
257
+ email?: string; // optional — shown as fallback display name
258
+ firstname?: string;
259
+ lastname?: string;
260
+ photo?: string; // optional — avatar in chat messages
261
+ roles?: string[]; // optional — tenant roles; `'super_admin'` may approve an agent's consent terms
262
+ }
263
+ ```
264
+
265
+ > **Note:** `user.id` must be the authenticated user's UUID as stored in Kiva. Without it, the session list will not be filtered and all tenant users' threads will be visible.
266
+
267
+ > **Agent consent:** When an agent requires consent (`agent.consent` is `false`/`null`), the assistant shows a non-closable "Terms & Agreement" gate and hides the prompt input until the terms are accepted. Only users whose `roles` include `'super_admin'` can approve; everyone else sees the terms with the Approve button disabled.
268
+
269
+ ---
270
+
271
+ ### `<KivaAssistant>`
272
+
273
+ The main chat interface component.
274
+
275
+ #### Core
276
+
277
+ | Prop | Type | Default | Description |
278
+ |------|------|---------|-------------|
279
+ | `tenantAiAgentId` | `string` | — | **Required.** ID of the tenant AI agent |
280
+ | `initialDeploymentId` | `string` | — | Opens the assistant directly on a deployed agent: seeds the pinned tab with this deployment so its name, welcome message, model and tools come from the deployment (`/ai/agent-deployments/:id`) instead of the base agent |
281
+ | `renderMode` | `"modal" \| "inline"` | `"modal"` | Render as overlay dialog or embedded inline |
282
+ | `isOpen` | `boolean` | — | Modal visibility (modal mode only) |
283
+ | `onClose` | `() => void` | — | Called when the modal closes |
284
+ | `className` | `string` | — | CSS class on the root element |
285
+
286
+ #### Appearance
287
+
288
+ | Prop | Type | Default | Description |
289
+ |------|------|---------|-------------|
290
+ | `title` | `string` | — | Header title |
291
+ | `description` | `string` | — | Subtitle below the title |
292
+ | `placeholder` | `string` | — | Chat input placeholder |
293
+ | `logo` | `string` | — | Logo image URL |
294
+ | `footerText` | `string` | — | Footer text |
295
+ | `theme` | `"auto" \| "light" \| "dark"` | `"auto"` | Color theme |
296
+ | `variant` | `"default" \| "docked" \| "expanded"` | `"default"` | Layout variant |
297
+ | `size` | `"default" \| "large"` | `"default"` | Component size |
298
+
299
+ #### Layout
300
+
301
+ | Prop | Type | Default | Description |
302
+ |------|------|---------|-------------|
303
+ | `enableSidebar` | `boolean` | `true` | Show the session list sidebar |
304
+ | `enableWelcomePage` | `boolean` | `true` | Show a welcome landing page on first open with agent greeting, inline prompt input, and recent sessions. The header (with agent tabs) stays visible so users can switch agents from the welcome screen; the sidebar is hidden. Dismissed on interaction (new chat, session click, or message send) |
305
+ | `defaultFullscreen` | `boolean` | `false` | Initial uncontrolled fullscreen state |
306
+ | `isFullscreen` | `boolean` | — | Controlled fullscreen state. When provided, the package no longer manages its own fullscreen state — pair with `onFullscreenChange` to fully drive the expand button from the host |
307
+ | `hideExpand` | `boolean` | `false` | Hide the fullscreen toggle |
308
+ | `hideCloseButton` | `boolean` | `false` | Hide the close (X) button in the header |
309
+ | `hideBorder` | `boolean` | `false` | Hide the outer border and shadow of the assistant container |
310
+ | `showHeader` | `boolean` | `true` | Show the header bar with the agent tabs |
311
+ | `maxMessages` | `number` | — | Max messages to keep in context |
312
+
313
+ #### Features
314
+
315
+ | Prop | Type | Default | Description |
316
+ |------|------|---------|-------------|
317
+ | `supportWebSearch` | `boolean` | `true` | Web search |
318
+ | `supportThinking` | `boolean` | `true` | Thinking / reasoning mode |
319
+ | `supportFiles` | `boolean` | `true` | File uploads |
320
+ | `supportDocumentSearch` | `boolean` | `true` | Document search |
321
+ | `supportDeepResearch` | `boolean` | `true` | Deep research mode |
322
+ | `supportMultiModels` | `boolean` | `true` | Model selector (also read from agent config `supportMultipleModels`) |
323
+ | `supportWorkCanvas` | `boolean` | `true` | Work canvas panel |
324
+ | `supportedFileFormats` | `string[]` | — | Allowed upload MIME types / extensions |
325
+ | `enableVoice` | `boolean` | `false` | Voice input mode |
326
+ | `enableMicrophone` | `boolean` | `true` | Microphone button |
327
+ | `enableSharing` | `boolean` | `false` | Show share button on thread headers |
328
+ | `enableMessageSelection` | `boolean` | `false` | When true, each assistant (agent) message renders a selection checkbox and a Send/Cancel footer appears below the thread. Lets the host pick agent replies and forward them elsewhere (e.g. a Microsoft Teams chat) via `onSendSelectedMessages` |
329
+
330
+ > **Note:** Feature props serve as defaults. When the agent deployment is loaded, the API response capabilities (`supportWebSearch`, `documentSearch`, `supportDeepResearch`, `supportThinking`, `featureWorks`, `supportFiles`, `supportMultipleModels`, `promptOptimizationChoice`) take precedence over prop values.
331
+
332
+ #### Agent tabs
333
+
334
+ The header renders a tab strip. The first tab is pinned to `tenantAiAgentId` and cannot be closed. The `+` button next to it opens a dropdown listing the available deployed agents (from `agentSelectorUrl`); selecting one opens a new closable tab with its own isolated thread and message history. Open tabs are persisted to `localStorage`.
335
+
336
+ Switching agents (either selecting an existing tab or adding a new one) resets navigation to the chat home — the previous agent's projects/works pane is dismissed and any selected project / project context is cleared, so the user lands in the new agent's chat view rather than a stale pane.
337
+
338
+ Set `enableAgentTabs={false}` to hide the tab strip entirely (e.g. a single-agent "try this agent" surface) while keeping the rest of the header. The header's own controls (`showHeader`) are unaffected.
339
+
340
+ | Prop | Type | Default | Description |
341
+ |------|------|---------|-------------|
342
+ | `enableAgentTabs` | `boolean` | `true` | Show the header agent-tabs strip (pinned tab + "add agent"). Set `false` to hide it |
343
+ | `agentSelectorUrl` | `string` | `"/ai/agent-deployments"` | Endpoint listing deployed agents shown in the "+" dropdown |
344
+ | `onAgentChange` | `(agentId: string, agentType: "base" \| "deployment") => void` | — | Fires when the user opens a new agent tab |
345
+
346
+ #### API
347
+
348
+ | Prop | Type | Default | Description |
349
+ |------|------|---------|-------------|
350
+ | `apiEndpoint` | `string` | `"/ai/agents/:agentId/chat"` | Chat endpoint template (`:agentId` is replaced at runtime) |
351
+ | `hostEnvironment` | `string` | — | Host environment identifier sent to the chat endpoint as `hostEnvironment`. The backend uses this to filter the tool list bound to the agent so only tools available in the current environment are exposed. Common values: `"web"`, `"desktop"`, `"chrome"`, `"word"`, `"excel"`, `"powerpoint"`, `"outlook"` |
352
+ | `appId` | `string` | — | ID of the host app currently open in the page. Forwarded to the chat endpoint as `appId` so the agent can scope its behavior/tools to it. Renders a dismissable "Talking about <app>" chip above the input; once the user clears it, the id stops being sent |
353
+ | `appName` | `string` | — | Display name for the current host app, shown in the context chip |
354
+ | `appIcon` | `string` | — | Kiva icon identifier (e.g. `"fas inbox"`) for the current host app. Rendered via `<KivaIcon>` in the context chip |
355
+
356
+ #### Callbacks
357
+
358
+ | Prop | Type | Description |
359
+ |------|------|-------------|
360
+ | `onMessageSend` | `(message: string) => void` | Fires when a message is sent |
361
+ | `onVoiceStart` | `() => void` | Fires when voice recording starts |
362
+ | `onVoiceEnd` | `() => void` | Fires when voice recording ends |
363
+ | `onFullscreenChange` | `(isFullscreen: boolean) => void` | Intercepts the expand button. When provided, replaces the package's built-in fullscreen toggle — the host receives the intended next state and decides what to do (toggle, redirect, etc.). When omitted, the package self-toggles its fullscreen state. Pair with `isFullscreen` for a fully controlled expand/collapse. |
364
+ | `onShare` | `(info: { dataSourceId: string; recordId: string }) => void` | Custom share handler. When provided, the thread header share button calls this instead of the built-in sharing editor |
365
+ | `onSendSelectedMessages` | `(messages: SelectedAssistantMessage[]) => void \| Promise<void>` | Called with the picked assistant messages when the user presses **Send** in the selection footer (requires `enableMessageSelection`). The selection is cleared afterward |
366
+ | `onCancelSelection` | `() => void` | Called when the user presses **Cancel** in the selection footer (requires `enableMessageSelection`) |
367
+
368
+ #### Initial prompt
369
+
370
+ | Prop | Type | Default | Description |
371
+ |------|------|---------|-------------|
372
+ | `initialPrompt` | `string` | — | Staged into the composer for the user to review and send. Re-staged whenever the value changes, so no remount is needed to hand over a new prompt. Set `autoSubmitInitialPrompt` to have it sent instead |
373
+ | `initialModelId` | `string` | — | Model pre-selected in the composer alongside the staged prompt |
374
+ | `initialFeatures` | `InitialFeatureFlags` | — | Feature flags pre-enabled in the composer alongside the staged prompt |
375
+ | `initialFiles` | `File[]` | — | Files staged as composer attachments alongside the staged prompt |
376
+
377
+ #### Handover
378
+
379
+ For hosts that compose a turn outside the panel — `<AiAssistantTriggerWidget>` does exactly this — and want it run rather than staged.
380
+
381
+ | Prop | Type | Default | Description |
382
+ |------|------|---------|-------------|
383
+ | `autoSubmitInitialPrompt` | `boolean` | `false` | Send `initialPrompt` on open instead of staging it |
384
+ | `initialSubmitOptions` | `AssistantPromptOptions` | — | Settings the sent turn carries: model, reasoning level, capability toggles, uploaded files, MCP servers, integration actions. Only read when `autoSubmitInitialPrompt` is set |
385
+ | `initialThreadId` | `string` | — | Thread opened on mount instead of the welcome screen |
386
+ | `initialAgent` | `{ agentId, deploymentId?, name?, avatar? }` | — | Agent the handover is addressed to, when it is not the one on screen. Its tab is opened (or selected, if already there) **before** the prompt is sent or the thread loaded |
387
+ | `initialRequestId` | `string` | — | Identifies one handover. Each is acted on once, so hand over the same prompt or thread twice by giving the second a fresh id |
388
+
389
+ ---
390
+
391
+ ### `<AgentTriggerWidget>`
392
+
393
+ A standalone agent discovery and prompt input component. Displays agents in a carousel with per-agent capabilities, model selection, reasoning levels, and suggestion chips. Fully decoupled from `KivaAssistant` — the consumer decides what happens on submit.
394
+
395
+ ```tsx
396
+ import { AssistantProvider, AgentTriggerWidget } from "@kivacore/ui-pro-ai-assistant";
397
+
398
+ <AssistantProvider config={config}>
399
+ <AgentTriggerWidget
400
+ agentIds={["agent-id-1", "agent-id-2"]}
401
+ onSubmit={(agentId, prompt, features, modelId) => {
402
+ // Open KivaAssistant, navigate to a chat page, call an API, etc.
403
+ }}
404
+ />
405
+ </AssistantProvider>
406
+ ```
407
+
408
+ #### Props
409
+
410
+ | Prop | Type | Default | Description |
411
+ |------|------|---------|-------------|
412
+ | `agentIds` | `string[]` | — | **Required.** Agent IDs to display in the carousel |
413
+ | `className` | `string` | — | CSS class on the root element |
414
+ | `placeholder` | `string` | — | Prompt input placeholder text |
415
+ | `onSubmit` | `(agentId, prompt, features, modelId?) => void` | — | Fires when the user submits a prompt. Receives the selected agent ID, prompt text, feature flags, and optional model ID |
416
+
417
+ #### `PromptFeatureFlags`
418
+
419
+ The `features` object passed to `onSubmit`:
420
+
421
+ ```ts
422
+ interface PromptFeatureFlags {
423
+ webSearch: boolean;
424
+ thinking: boolean;
425
+ deepResearch: boolean;
426
+ documentSearch: boolean;
427
+ workCanvas: boolean;
428
+ }
429
+ ```
430
+
431
+ #### `InitialFeatureFlags`
432
+
433
+ Used by `KivaAssistant.initialFeatures` — all fields are optional since you only need to set the ones you want enabled:
434
+
435
+ ```ts
436
+ interface InitialFeatureFlags {
437
+ webSearch?: boolean;
438
+ thinking?: boolean;
439
+ deepResearch?: boolean;
440
+ documentSearch?: boolean;
441
+ workCanvas?: boolean;
442
+ }
443
+ ```
444
+
445
+ #### Combining with KivaAssistant
446
+
447
+ ```tsx
448
+ function MyPage() {
449
+ const [assistantOpen, setAssistantOpen] = useState(false);
450
+ const [agentId, setAgentId] = useState<string | null>(null);
451
+ const [initialPrompt, setInitialPrompt] = useState<string>();
452
+
453
+ return (
454
+ <AssistantProvider config={config}>
455
+ <AgentTriggerWidget
456
+ agentIds={agentIds}
457
+ onSubmit={(id, prompt) => {
458
+ setAgentId(id);
459
+ setInitialPrompt(prompt);
460
+ setAssistantOpen(true);
461
+ }}
462
+ />
463
+ {assistantOpen && agentId && (
464
+ <KivaAssistant
465
+ isOpen
466
+ onClose={() => setAssistantOpen(false)}
467
+ tenantAiAgentId={agentId}
468
+ initialPrompt={initialPrompt}
469
+ renderMode="modal"
470
+ />
471
+ )}
472
+ </AssistantProvider>
473
+ );
474
+ }
475
+ ```
476
+
477
+ The widget's prompt lands in the assistant's composer, pre-filled and ready — the user still presses send. To have it sent instead, add `autoSubmitInitialPrompt` (see [Handover](#handover)).
478
+
479
+ ---
480
+
481
+ ### `<AiAssistantTriggerWidget>`
482
+
483
+ A dashboard-sized welcome surface for one assistant: agent tabs, avatar, welcome message, prompt input and recent sessions — and nothing else. There is no thread view, sidebar or canvas, so the widget can sit on a dashboard card without becoming a place to hold a conversation.
484
+
485
+ Both ways out are events. The widget never calls the chat endpoint; it hands what the user composed to a full `<KivaAssistant>` elsewhere.
486
+
487
+ ```tsx
488
+ import {
489
+ AssistantProvider,
490
+ AiAssistantTriggerWidget,
491
+ KivaAssistant,
492
+ } from "@kivacore/ui-pro-ai-assistant";
493
+
494
+ function Dashboard() {
495
+ const [request, setRequest] = useState(null);
496
+ // A fresh id per handover, so the same prompt or thread can be handed over twice.
497
+ const open = (next) => setRequest({ ...next, id: crypto.randomUUID() });
498
+
499
+ return (
500
+ <AssistantProvider config={config}>
501
+ <AiAssistantTriggerWidget
502
+ tenantAiAgentId={KIVA_AGENT_ID}
503
+ onSubmit={({ prompt, options, tenantAiAgentId, deploymentId, name, avatar }) => {
504
+ open({ prompt, options, agent: { agentId: tenantAiAgentId, deploymentId, name, avatar } });
505
+ }}
506
+ onSessionSelect={(session, agent) => {
507
+ open({
508
+ threadId: session.id,
509
+ agent: { agentId: agent.tenantAiAgentId, deploymentId: agent.deploymentId },
510
+ });
511
+ }}
512
+ />
513
+
514
+ {request && (
515
+ <KivaAssistant
516
+ isOpen
517
+ tenantAiAgentId={KIVA_AGENT_ID}
518
+ renderMode="modal"
519
+ onClose={() => setRequest(null)}
520
+ initialRequestId={request.id}
521
+ initialAgent={request.agent}
522
+ initialPrompt={request.prompt}
523
+ initialSubmitOptions={request.options}
524
+ autoSubmitInitialPrompt={Boolean(request.prompt)}
525
+ initialThreadId={request.threadId}
526
+ />
527
+ )}
528
+ </AssistantProvider>
529
+ );
530
+ }
531
+ ```
532
+
533
+ #### Props
534
+
535
+ | Prop | Type | Default | Description |
536
+ |------|------|---------|-------------|
537
+ | `tenantAiAgentId` | `string` | — | **Required.** Base agent the pinned first tab represents |
538
+ | `deploymentId` | `string` | — | Resolve the pinned tab through a deployment instead of the base agent |
539
+ | `logo` | `string` | — | Fallback avatar, used until the agent metadata resolves |
540
+ | `title` | `string` | — | Fallback name, used until the agent metadata resolves |
541
+ | `placeholder` | `string` | — | Prompt input placeholder |
542
+ | `className` | `string` | — | CSS class on the root element |
543
+ | `recentSessionsLimit` | `number` | `5` | How many recent threads to list |
544
+ | `hideRecentSessions` | `boolean` | `false` | Hide the Recent Sessions block entirely |
545
+ | `enableAgentTabs` | `boolean` | `true` | Show the agent tab bar, which lets the user aim the turn at another agent or deployment |
546
+ | `agentSelectorUrl` | `string` | `"/ai/agent-deployments"` | URL listing the deployed agents offered in the tab bar's **+** dropdown |
547
+ | `onSubmit` | `(submission: AiAssistantTriggerSubmission) => void` | — | Fires when the user submits the composer. Nothing is sent by the widget |
548
+ | `onSessionSelect` | `(session: AssistantSession, target: AiAssistantTriggerTarget) => void` | — | Fires when the user picks a thread from Recent Sessions |
549
+
550
+ #### Agent tabs
551
+
552
+ The tab bar is the same one the assistant's header uses. The first tab is pinned to `tenantAiAgentId` and cannot be closed; **+** lists the tenant's deployed agents. Both the open tabs and which one is active are persisted to `localStorage`, so a user who picked a deployment finds it still picked on the next visit.
553
+
554
+ Switching tabs rebuilds the whole surface for that agent — avatar, welcome message, recent sessions, and the composer's model list, reasoning levels, capability toggles and connector actions.
555
+
556
+ #### Composer
557
+
558
+ A dashboard card has no room for a row of tool icons, so the widget's composer keeps only **attach** beside the input and folds everything else into a single settings menu: the capability toggles, prompt templates, reasoning level, MCP servers, connector actions and the model. What the turn carries is unaffected — `onSubmit` still reports every one of them.
559
+
560
+ #### `AiAssistantTriggerSubmission`
561
+
562
+ Everything needed to reproduce the turn elsewhere: the text, every setting the composer resolved, and the agent it was aimed at.
563
+
564
+ ```ts
565
+ interface AiAssistantTriggerTarget {
566
+ tenantAiAgentId: string;
567
+ /** Set when the active tab is a deployment rather than a base agent. */
568
+ deploymentId?: string;
569
+ name?: string;
570
+ avatar?: string;
571
+ }
572
+
573
+ interface AiAssistantTriggerSubmission extends AiAssistantTriggerTarget {
574
+ prompt: string;
575
+ options: AssistantPromptOptions;
576
+ }
577
+ ```
578
+
579
+ #### `AssistantPromptOptions`
580
+
581
+ What the prompt input resolved for the turn beyond its text. Pass it straight to `KivaAssistant.initialSubmitOptions`.
582
+
583
+ ```ts
584
+ interface AssistantPromptOptions {
585
+ modelId?: string;
586
+ supportMultipleModels?: boolean;
587
+ supportFiles?: boolean;
588
+ supportWebSearch?: boolean;
589
+ supportDeepResearch?: boolean;
590
+ supportDocumentSearch?: boolean;
591
+ supportThinking?: boolean;
592
+ supportWorkCanvas?: boolean;
593
+ reasoningEffort?: string;
594
+ files?: { url: string; mediaType: string; filename: string }[];
595
+ mcpServerIds?: string[];
596
+ /** `tenant_ai_agent_tool` ids of the integration actions left enabled. */
597
+ integrationActionIds?: string[];
598
+ }
599
+ ```
600
+
601
+ #### How the handover behaves
602
+
603
+ The panel opens on its own pinned agent and puts the addressed one **next to it** as a tab, rather than replacing it. Because switching tabs clears the messages, the work is queued and drained once the target tab is active: first the tab, then the prompt is sent or the thread loaded.
604
+
605
+ #### Choosing between the two trigger widgets
606
+
607
+ | | `AgentTriggerWidget` | `AiAssistantTriggerWidget` |
608
+ |---|---|---|
609
+ | Picks between | Agents in a carousel, from an explicit `agentIds` list | Agents in a tab bar, added from the tenant's deployments |
610
+ | Shows | Agent name, welcome message, suggestion chips | Avatar, welcome message, recent sessions |
611
+ | Recent sessions | No | Yes — clicking one hands the thread over |
612
+ | `onSubmit` gives you | `(agentId, prompt, features, modelId?, files?)` | The full `AssistantPromptOptions`, plus the agent |
613
+ | Remembers the choice | No | Yes, in `localStorage` |
614
+
615
+ ---
616
+
617
+ ### `<KnowledgeBasePanel>`
618
+
619
+ The documents an agent answers from. Renders the list, and the actions that manage it: upload a file, write one as markdown, import a web page, read a scanned document with OCR, and delete.
620
+
621
+ It is already built into the project detail view; render it directly to put the same panel anywhere else — a deployment's settings screen, a standalone documents page.
622
+
623
+ #### Props
624
+
625
+ | Prop | Type | Default | Description |
626
+ |------|------|---------|-------------|
627
+ | `scope` | `KnowledgeScope` | — | Which record the documents hang off: `{ kind: 'deployment' \| 'project', id }` |
628
+ | `microsoftAuth` | `MicrosoftFilePickerAuth \| null` | context | The Microsoft session to pick files with. Falls back to `<MicrosoftFilePickerAuthProvider>`; without either, the OneDrive entry is not offered |
629
+ | `className` | `string` | — | Applied to the panel root |
630
+
631
+ ```tsx
632
+ import { KnowledgeBasePanel } from "@kivacore/ui-pro-ai-assistant";
633
+
634
+ <KnowledgeBasePanel scope={{ kind: "project", id: projectId }} />
635
+ ```
636
+
637
+ **Storing a document is not the same as the agent being able to read it.** Uploading starts indexing on its own — for a deployment and for a project alike — but it can fail on the way. So each file carries `ai_index_status` (`wait` | `processing` | `success` | `fail`, or `null` when nothing has tried) and `last_ai_index_date`, and the panel shows anything that is not `success` as a badge beside the name.
638
+
639
+ The row menu's **Rebuild index** runs the indexing and waits for it — tens of seconds for a large PDF — then refreshes the list so the badge reflects where the document landed. It is the manual retry for a document whose indexing never made it through.
640
+
641
+ `knowledgeFilesPath(scope)` returns the API path the panel uses, for callers that need to fetch the same list themselves.
642
+
643
+ ---
644
+
645
+ ### `<MicrosoftFilePickerAuthProvider>`
646
+
647
+ Hands the package the Microsoft session it should pick files with. Wrap it around anything that renders `<KivaAssistant>` or `<KnowledgeBasePanel>`.
648
+
649
+ The package deliberately owns no MSAL instance. The host has already signed the user in — through Connected Apps, or however else it manages Microsoft — and a second instance would mean a second sign-in and a second token cache keyed to the same client id. So the session is passed in, and the package only ever asks it for tokens.
650
+
651
+ ```tsx
652
+ import { MicrosoftFilePickerAuthProvider } from "@kivacore/ui-pro-ai-assistant";
653
+
654
+ <MicrosoftFilePickerAuthProvider value={filePickerAuth}>
655
+ <KivaAssistant tenantAiAgentId={agentId} />
656
+ </MicrosoftFilePickerAuthProvider>
657
+ ```
658
+
659
+ Pass `null` and nothing Microsoft is offered — the composer keeps its plain upload button and the knowledge base its plain menu. That is the intended state for a host with no Microsoft configured, so there is no need to branch on it.
660
+
661
+ #### `MicrosoftFilePickerAuth`
662
+
663
+ | Member | Type | Description |
664
+ |--------|------|-------------|
665
+ | `isConnected` | `boolean` | Whether **this browser origin** holds a Microsoft session |
666
+ | `connect` | `() => Promise<void>` | Starts a sign-in. Navigates away, so it does not return on success |
667
+ | `getAccessToken` | `(request: { scopes: string[] }) => Promise<string>` | A token for the given scopes |
668
+ | `getSharePointUrl` | `() => Promise<string>` | The tenant's SharePoint root, which serves the picker page |
669
+
670
+ A sign-in is per origin: a user connected on your app shell has no session on your builder, since the token cache lives in that origin's `localStorage`. This is why the interface carries `isConnected` and `connect` rather than assuming a session made elsewhere — the entry stays offered on every origin, and the first click signs the user in.
671
+
672
+ #### Where it is used
673
+
674
+ **Knowledge base** — the panel's add menu gains **Add from OneDrive**. The picked file is not copied: a record points at it where it lives, and it is indexed on the spot through the document service with the user's own token.
675
+
676
+ **Chat composer** — the attach button becomes a menu, and a document picked from OneDrive is converted to markdown and stored as it is picked, while that token is still valid. From then on it behaves like any uploaded document: the agent reads it, and a citation opens it, with no Microsoft credential involved. Attaching needs a thread, exactly as uploading does.
677
+
678
+ `getAccessToken` is called for `Files.ReadWrite.All` when a picked file is read, for `Sites.Read.All` when the picker's host is resolved, and — by the picker page itself — for `{sharePointHost}/.default`, which asks for whatever that resource is already consented to. Your app registration must carry those permissions, and every origin you serve from must be registered as a redirect URI: `connect()` redirects, and Entra checks the origin against that list.
679
+
680
+ ---
681
+
682
+ ### `useAssistantConfig()`
683
+
684
+ Returns the `AssistantConfig` from the nearest `AssistantProvider`. Throws if used outside the provider.
685
+
686
+ ```tsx
687
+ const { apiBaseUrl, getAuthToken } = useAssistantConfig();
688
+ ```
689
+
690
+ ---
691
+
692
+ ### `useAssistantTranslation()`
693
+
694
+ Returns the `t` function for translating assistant UI strings.
695
+
696
+ ```tsx
697
+ const { t } = useAssistantTranslation();
698
+ // t("common.untitled") → "Untitled"
699
+ ```
700
+
701
+ ---
702
+
703
+ ### `plateEditorPlugin()`
704
+
705
+ Vite plugin that adds dev-server middleware for Plate editor AI commands (`/api/ai/command` and `/api/ai/copilot`). Only needed if you use the Plate rich-text editor AI features.
706
+
707
+ ```ts
708
+ // vite.config.ts
709
+ import { defineConfig } from "vite";
710
+ import { plateEditorPlugin } from "@kivacore/ui-pro-ai-assistant/vite";
711
+
712
+ export default defineConfig({
713
+ plugins: [plateEditorPlugin()],
714
+ });
715
+ ```
716
+
717
+ ## Work canvas types
718
+
719
+ AI-generated outputs open in a side canvas with type-specific viewers:
720
+
721
+ | `WorkTypes` value | Viewer | Description |
722
+ |-------------------|--------|-------------|
723
+ | `Text` | Plate.js rich editor | Editable rich text |
724
+ | `Code` | Sandpack | Live code preview |
725
+ | `Data` / `Xlsx` | `@kivacore/ui-pro-sheets` spreadsheet | Full spreadsheet with formulas, charts, pivots and comments |
726
+ | `Image` | Image viewer | Generated images |
727
+ | `Chart` | VChart | Interactive charts |
728
+ | `Html` / `HtmlTemplate` | HTML iframe | Rendered HTML |
729
+ | `Docyment` / `Docx` / `Pptx` | Document viewer | Office document preview |
730
+ | `App` | App renderer | Custom applications |
731
+ | `Record` | Record view | Structured data display |
732
+ | `DataSource` | Data explorer | Data source output |
733
+ | `CustomQuerySql` / `CustomQueryJson` | Query result | Query output display |
734
+
735
+ A cited document opens in the same panel, but as its markdown source with line numbers and the cited range highlighted — a citation addresses a line of that text, and rendering it would move the line the reader is sent to.
736
+
737
+ Cited documents share the panel as tabs: each citation into a new file adds one, a tab returns to the lines it was last pointed at, and closing the last tab closes the canvas. Opening a work of any other kind clears them.
738
+
739
+ ## Internationalization
740
+
741
+ 9 built-in locales: `en`, `de`, `es`, `fr`, `it`, `pt`, `el`, `sl`, `tr`.
742
+
743
+ The language is auto-detected. To override, wrap with `AssistantI18nProvider`:
744
+
745
+ ```tsx
746
+ import { AssistantI18nProvider } from "@kivacore/ui-pro-ai-assistant";
747
+
748
+ <AssistantI18nProvider locale="de">
749
+ <KivaAssistant ... />
750
+ </AssistantI18nProvider>
751
+ ```
752
+
753
+ ## Types
754
+
755
+ ### `SelectedAssistantMessage`
756
+
757
+ An assistant (agent) reply the user picked while `enableMessageSelection` is on. Passed to `onSendSelectedMessages`.
758
+
759
+ ```ts
760
+ interface SelectedAssistantMessage {
761
+ id: string;
762
+ text: string; // concatenated text parts (empty for tool-only turns)
763
+ parts: unknown[]; // raw AI SDK message parts (text, reasoning, tool calls, …),
764
+ // passed through untouched so hosts can extract tool outputs
765
+ }
766
+ ```
767
+
768
+ ### `Project`
769
+
770
+ ```ts
771
+ interface Project {
772
+ id: string;
773
+ name: string;
774
+ tenant_ai_agent_id: string;
775
+ description?: string;
776
+ instructions?: string;
777
+ tenant_ai_agent_deployment_id?: string;
778
+ color?: string;
779
+ icon?: string;
780
+ shared_to?: string[];
781
+ created_by?: string;
782
+ }
783
+ ```
784
+
785
+ ### `Work`
786
+
787
+ ```ts
788
+ interface Work {
789
+ id: string;
790
+ title: string;
791
+ type?: WorkTypes;
792
+ content_json?: unknown;
793
+ content_text?: string;
794
+ description?: string;
795
+ image_url?: string;
796
+ core_ai_model_id?: string | null;
797
+ base_message_id?: string;
798
+ base_thread_id?: string;
799
+ tenant_ai_agent_id?: string;
800
+ tenant_ai_agent_deployment_id?: string;
801
+ tenant_data_source_id?: string;
802
+ tenant_ai_project_id?: string;
803
+ shared_to?: string[];
804
+ created_by?: string;
805
+ created_on?: Date;
806
+ last_modified_on?: Date;
807
+ }
808
+ ```
809
+
810
+ ### `WorkTypes`
811
+
812
+ ```ts
813
+ const WorkTypes = {
814
+ Record: "record",
815
+ Data: "data",
816
+ Text: "text",
817
+ Code: "code",
818
+ Image: "image",
819
+ Xlsx: "xlsx",
820
+ Docx: "docx",
821
+ Pptx: "pptx",
822
+ Html: "html",
823
+ Docyment: "docyment",
824
+ Chart: "chart",
825
+ DataSource: "data_source",
826
+ HtmlTemplate: "html_template",
827
+ CustomQuerySql: "custom_query_sql",
828
+ CustomQueryJson: "custom_query_json",
829
+ App: "app",
830
+ } as const;
831
+ ```
832
+
833
+ ## Environment variables
834
+
835
+ When using with Vite, set these in your `.env`:
836
+
837
+ ```env
838
+ VITE_KIVA_API_URL=https://api.kiva.app
839
+ VITE_KIVA_CLIENT_ID=your-client-id
840
+ VITE_KIVA_AGENT_ID=your-agent-id
841
+
842
+ # Optional — for Plate editor AI plugin
843
+ VITE_KIVA_EDITOR_AGENT_ID=your-editor-agent-id
844
+ ```
845
+
846
+ ## Requirements
847
+
848
+ - React 19+
849
+ - ESM only (`"type": "module"`)
850
+ - **Tailwind CSS v4** — the package's components use Tailwind utility classes; your app's Tailwind build generates them via the `@source` directives shown in [Setup](#setup). The package itself ships no compiled utilities.
851
+
852
+ ## License
853
+
854
+ MIT