@stack-spot/ai-chat-widget 1.38.2-beta.2 → 2.0.0-beta.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 (378) hide show
  1. package/CHANGELOG.md +33 -32
  2. package/dist/StackspotAIWidget.d.ts +14 -2
  3. package/dist/StackspotAIWidget.d.ts.map +1 -1
  4. package/dist/StackspotAIWidget.js +7 -8
  5. package/dist/StackspotAIWidget.js.map +1 -1
  6. package/dist/app-metadata.json +13 -5
  7. package/dist/chat-interceptors/quick-commands.js +3 -3
  8. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  9. package/dist/components/AdaptiveTextArea.d.ts +1 -1
  10. package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
  11. package/dist/components/AdaptiveTextArea.js +1 -1
  12. package/dist/components/AdaptiveTextArea.js.map +1 -1
  13. package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
  14. package/dist/components/AgentCard/AgentCardCreate.js +4 -5
  15. package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
  16. package/dist/components/AgentCard/index.d.ts.map +1 -1
  17. package/dist/components/AgentCard/index.js +5 -6
  18. package/dist/components/AgentCard/index.js.map +1 -1
  19. package/dist/components/ButtonFavorite.d.ts +8 -7
  20. package/dist/components/ButtonFavorite.d.ts.map +1 -1
  21. package/dist/components/ButtonFavorite.js +5 -14
  22. package/dist/components/ButtonFavorite.js.map +1 -1
  23. package/dist/components/Code.d.ts.map +1 -1
  24. package/dist/components/Code.js +11 -9
  25. package/dist/components/Code.js.map +1 -1
  26. package/dist/components/ComponentNavigator.d.ts.map +1 -1
  27. package/dist/components/ComponentNavigator.js +2 -4
  28. package/dist/components/ComponentNavigator.js.map +1 -1
  29. package/dist/components/FadingOverflow.d.ts.map +1 -1
  30. package/dist/components/FadingOverflow.js +3 -4
  31. package/dist/components/FadingOverflow.js.map +1 -1
  32. package/dist/components/FileDescription.d.ts.map +1 -1
  33. package/dist/components/FileDescription.js +3 -4
  34. package/dist/components/FileDescription.js.map +1 -1
  35. package/dist/components/HistoryList.d.ts.map +1 -1
  36. package/dist/components/HistoryList.js +3 -1
  37. package/dist/components/HistoryList.js.map +1 -1
  38. package/dist/components/ListResource.js +3 -3
  39. package/dist/components/ListResource.js.map +1 -1
  40. package/dist/components/Markdown.js +1 -1
  41. package/dist/components/Markdown.js.map +1 -1
  42. package/dist/components/Modal.d.ts.map +1 -1
  43. package/dist/components/Modal.js +2 -4
  44. package/dist/components/Modal.js.map +1 -1
  45. package/dist/components/QuickStartButton.d.ts +2 -3
  46. package/dist/components/QuickStartButton.d.ts.map +1 -1
  47. package/dist/components/QuickStartButton.js +4 -3
  48. package/dist/components/QuickStartButton.js.map +1 -1
  49. package/dist/components/RightPanelForm.d.ts.map +1 -1
  50. package/dist/components/RightPanelForm.js +20 -13
  51. package/dist/components/RightPanelForm.js.map +1 -1
  52. package/dist/components/RightPanelTabs.d.ts +1 -4
  53. package/dist/components/RightPanelTabs.d.ts.map +1 -1
  54. package/dist/components/RightPanelTabs.js +4 -16
  55. package/dist/components/RightPanelTabs.js.map +1 -1
  56. package/dist/components/Selector/index.d.ts.map +1 -1
  57. package/dist/components/Selector/index.js +5 -8
  58. package/dist/components/Selector/index.js.map +1 -1
  59. package/dist/components/Selector/styled.d.ts.map +1 -1
  60. package/dist/components/Selector/styled.js +8 -5
  61. package/dist/components/Selector/styled.js.map +1 -1
  62. package/dist/components/StackedBadge.js +5 -5
  63. package/dist/components/StackedBadge.js.map +1 -1
  64. package/dist/components/TabManager.d.ts.map +1 -1
  65. package/dist/components/TabManager.js +9 -32
  66. package/dist/components/TabManager.js.map +1 -1
  67. package/dist/components/ToolBadge.d.ts +3 -8
  68. package/dist/components/ToolBadge.d.ts.map +1 -1
  69. package/dist/components/ToolBadge.js +23 -99
  70. package/dist/components/ToolBadge.js.map +1 -1
  71. package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
  72. package/dist/components/WorkspaceTabNavigator.js +7 -9
  73. package/dist/components/WorkspaceTabNavigator.js.map +1 -1
  74. package/dist/components/form/DescribedCheckboxGroup.d.ts +24 -2
  75. package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
  76. package/dist/components/form/DescribedCheckboxGroup.js +46 -29
  77. package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
  78. package/dist/components/form/DescribedRadioGroup.d.ts +24 -4
  79. package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
  80. package/dist/components/form/DescribedRadioGroup.js +39 -18
  81. package/dist/components/form/DescribedRadioGroup.js.map +1 -1
  82. package/dist/context/hooks.d.ts +6 -1
  83. package/dist/context/hooks.d.ts.map +1 -1
  84. package/dist/context/hooks.js +4 -1
  85. package/dist/context/hooks.js.map +1 -1
  86. package/dist/hooks/midnight-update-view.d.ts +5 -0
  87. package/dist/hooks/midnight-update-view.d.ts.map +1 -0
  88. package/dist/hooks/midnight-update-view.js +30 -0
  89. package/dist/hooks/midnight-update-view.js.map +1 -0
  90. package/dist/index.d.ts +4 -2
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +1 -1
  93. package/dist/index.js.map +1 -1
  94. package/dist/layout.css +0 -26
  95. package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
  96. package/dist/right-panel/DefaultPanel.js +2 -4
  97. package/dist/right-panel/DefaultPanel.js.map +1 -1
  98. package/dist/state/ChatEntry.d.ts +3 -4
  99. package/dist/state/ChatEntry.d.ts.map +1 -1
  100. package/dist/state/ChatEntry.js.map +1 -1
  101. package/dist/state/constants.d.ts.map +1 -1
  102. package/dist/state/constants.js +1 -0
  103. package/dist/state/constants.js.map +1 -1
  104. package/dist/types.d.ts +8 -3
  105. package/dist/types.d.ts.map +1 -1
  106. package/dist/utils/tools.d.ts +9 -3
  107. package/dist/utils/tools.d.ts.map +1 -1
  108. package/dist/utils/tools.js +1 -6
  109. package/dist/utils/tools.js.map +1 -1
  110. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  111. package/dist/views/Agents/AgentDescription.js +8 -13
  112. package/dist/views/Agents/AgentDescription.js.map +1 -1
  113. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  114. package/dist/views/Agents/AgentsPanel.js +7 -7
  115. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  116. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  117. package/dist/views/Agents/AgentsTab.js +30 -29
  118. package/dist/views/Agents/AgentsTab.js.map +1 -1
  119. package/dist/views/Agents/dictionary.d.ts +1 -1
  120. package/dist/views/Agents/useAgentFavorites.js +3 -3
  121. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  122. package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
  123. package/dist/views/Chat/AgentInfo.js +3 -5
  124. package/dist/views/Chat/AgentInfo.js.map +1 -1
  125. package/dist/views/Chat/ChatMessage.d.ts +24 -2
  126. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  127. package/dist/views/Chat/ChatMessage.js +36 -47
  128. package/dist/views/Chat/ChatMessage.js.map +1 -1
  129. package/dist/views/Chat/ChatMessages.d.ts +1 -1
  130. package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
  131. package/dist/views/Chat/ChatMessages.js +2 -2
  132. package/dist/views/Chat/ChatMessages.js.map +1 -1
  133. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  134. package/dist/views/Chat/StepsList.js +10 -10
  135. package/dist/views/Chat/StepsList.js.map +1 -1
  136. package/dist/views/Chat/index.d.ts +1 -1
  137. package/dist/views/Chat/index.d.ts.map +1 -1
  138. package/dist/views/Chat/index.js +2 -2
  139. package/dist/views/Chat/index.js.map +1 -1
  140. package/dist/views/Chat/styled.d.ts.map +1 -1
  141. package/dist/views/Chat/styled.js +11 -16
  142. package/dist/views/Chat/styled.js.map +1 -1
  143. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  144. package/dist/views/ChatHistory/HistoryItem.js +10 -48
  145. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  146. package/dist/views/ChatHistory/index.js +1 -1
  147. package/dist/views/ChatHistory/index.js.map +1 -1
  148. package/dist/views/ChatHistory/styled.d.ts.map +1 -1
  149. package/dist/views/ChatHistory/styled.js +3 -5
  150. package/dist/views/ChatHistory/styled.js.map +1 -1
  151. package/dist/views/ChatHistory/utils.d.ts +7 -0
  152. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  153. package/dist/views/ChatHistory/utils.js +40 -1
  154. package/dist/views/ChatHistory/utils.js.map +1 -1
  155. package/dist/views/ChatTabSelection.d.ts +6 -1
  156. package/dist/views/ChatTabSelection.d.ts.map +1 -1
  157. package/dist/views/ChatTabSelection.js +13 -8
  158. package/dist/views/ChatTabSelection.js.map +1 -1
  159. package/dist/views/Editor.d.ts.map +1 -1
  160. package/dist/views/Editor.js +6 -12
  161. package/dist/views/Editor.js.map +1 -1
  162. package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
  163. package/dist/views/Home/BuiltInAgent.js +2 -3
  164. package/dist/views/Home/BuiltInAgent.js.map +1 -1
  165. package/dist/views/Home/CustomAgent.js +3 -3
  166. package/dist/views/Home/CustomAgent.js.map +1 -1
  167. package/dist/views/Home/index.js +2 -2
  168. package/dist/views/Home/index.js.map +1 -1
  169. package/dist/views/Home/styled.d.ts.map +1 -1
  170. package/dist/views/Home/styled.js +21 -22
  171. package/dist/views/Home/styled.js.map +1 -1
  172. package/dist/views/KSDocument.d.ts.map +1 -1
  173. package/dist/views/KSDocument.js +3 -4
  174. package/dist/views/KSDocument.js.map +1 -1
  175. package/dist/views/KnowledgeSources.d.ts.map +1 -1
  176. package/dist/views/KnowledgeSources.js +14 -36
  177. package/dist/views/KnowledgeSources.js.map +1 -1
  178. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  179. package/dist/views/MessageInput/AgentSelector.js +7 -5
  180. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  181. package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
  182. package/dist/views/MessageInput/ButtonAgent.js +4 -5
  183. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  184. package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
  185. package/dist/views/MessageInput/ButtonBar.js +2 -4
  186. package/dist/views/MessageInput/ButtonBar.js.map +1 -1
  187. package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
  188. package/dist/views/MessageInput/ContextBar.js +3 -6
  189. package/dist/views/MessageInput/ContextBar.js.map +1 -1
  190. package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
  191. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  192. package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
  193. package/dist/views/MessageInput/SelectContent.js +30 -29
  194. package/dist/views/MessageInput/SelectContent.js.map +1 -1
  195. package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
  196. package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
  197. package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
  198. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  199. package/dist/views/MessageInput/index.d.ts +2 -1
  200. package/dist/views/MessageInput/index.d.ts.map +1 -1
  201. package/dist/views/MessageInput/index.js +5 -6
  202. package/dist/views/MessageInput/index.js.map +1 -1
  203. package/dist/views/MessageInput/styled.d.ts +1 -3
  204. package/dist/views/MessageInput/styled.d.ts.map +1 -1
  205. package/dist/views/MessageInput/styled.js +11 -15
  206. package/dist/views/MessageInput/styled.js.map +1 -1
  207. package/dist/views/MinimizedHeader.d.ts.map +1 -1
  208. package/dist/views/MinimizedHeader.js +3 -4
  209. package/dist/views/MinimizedHeader.js.map +1 -1
  210. package/dist/views/Resources.d.ts.map +1 -1
  211. package/dist/views/Resources.js +11 -8
  212. package/dist/views/Resources.js.map +1 -1
  213. package/dist/views/Stacks.d.ts.map +1 -1
  214. package/dist/views/Stacks.js +23 -28
  215. package/dist/views/Stacks.js.map +1 -1
  216. package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
  217. package/dist/views/Steps/FlowChart/NodeStep.js +3 -3
  218. package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
  219. package/dist/views/Steps/StepModal.d.ts.map +1 -1
  220. package/dist/views/Steps/StepModal.js +4 -6
  221. package/dist/views/Steps/StepModal.js.map +1 -1
  222. package/dist/views/Steps/dictionary.d.ts +1 -1
  223. package/dist/views/Steps/index.d.ts.map +1 -1
  224. package/dist/views/Steps/index.js +3 -4
  225. package/dist/views/Steps/index.js.map +1 -1
  226. package/dist/views/Steps/utils.d.ts +2 -1
  227. package/dist/views/Steps/utils.d.ts.map +1 -1
  228. package/dist/views/Steps/utils.js +8 -8
  229. package/dist/views/Steps/utils.js.map +1 -1
  230. package/dist/views/Tools.js +1 -1
  231. package/dist/views/Tools.js.map +1 -1
  232. package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
  233. package/dist/views/Workspaces/WorkspacesTab.js +7 -10
  234. package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
  235. package/dist/views/Workspaces/index.js +4 -2
  236. package/dist/views/Workspaces/index.js.map +1 -1
  237. package/package.json +5 -3
  238. package/src/StackspotAIWidget.tsx +51 -37
  239. package/src/app-metadata.json +13 -5
  240. package/src/chat-interceptors/quick-commands.ts +3 -3
  241. package/src/components/AdaptiveTextArea.tsx +1 -1
  242. package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
  243. package/src/components/AgentCard/index.tsx +7 -7
  244. package/src/components/ButtonFavorite.tsx +20 -47
  245. package/src/components/Code.tsx +31 -36
  246. package/src/components/ComponentNavigator.tsx +4 -8
  247. package/src/components/FadingOverflow.tsx +6 -7
  248. package/src/components/FileDescription.tsx +14 -10
  249. package/src/components/HistoryList.tsx +4 -1
  250. package/src/components/ListResource.tsx +5 -5
  251. package/src/components/Markdown.tsx +1 -1
  252. package/src/components/Modal.tsx +2 -4
  253. package/src/components/QuickStartButton.tsx +5 -4
  254. package/src/components/RightPanelForm.tsx +20 -13
  255. package/src/components/RightPanelTabs.tsx +4 -32
  256. package/src/components/Selector/index.tsx +17 -13
  257. package/src/components/Selector/styled.ts +8 -5
  258. package/src/components/StackedBadge.tsx +5 -5
  259. package/src/components/TabManager.tsx +31 -55
  260. package/src/components/ToolBadge.tsx +48 -129
  261. package/src/components/WorkspaceTabNavigator.tsx +22 -25
  262. package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
  263. package/src/components/form/DescribedRadioGroup.tsx +78 -46
  264. package/src/context/hooks.ts +4 -1
  265. package/src/hooks/midnight-update-view.ts +36 -0
  266. package/src/index.ts +4 -2
  267. package/src/layout.css +0 -26
  268. package/src/right-panel/DefaultPanel.tsx +3 -7
  269. package/src/state/ChatEntry.ts +3 -4
  270. package/src/state/constants.ts +2 -1
  271. package/src/types.ts +9 -3
  272. package/src/utils/tools.ts +3 -12
  273. package/src/views/Agents/AgentDescription.tsx +20 -36
  274. package/src/views/Agents/AgentsPanel.tsx +11 -12
  275. package/src/views/Agents/AgentsTab.tsx +38 -57
  276. package/src/views/Agents/useAgentFavorites.ts +3 -3
  277. package/src/views/Chat/AgentInfo.tsx +7 -6
  278. package/src/views/Chat/ChatMessage.tsx +163 -145
  279. package/src/views/Chat/ChatMessages.tsx +2 -1
  280. package/src/views/Chat/StepsList.tsx +10 -11
  281. package/src/views/Chat/index.tsx +9 -2
  282. package/src/views/Chat/styled.ts +11 -16
  283. package/src/views/ChatHistory/HistoryItem.tsx +15 -54
  284. package/src/views/ChatHistory/index.tsx +1 -1
  285. package/src/views/ChatHistory/styled.ts +3 -5
  286. package/src/views/ChatHistory/utils.ts +43 -2
  287. package/src/views/ChatTabSelection.tsx +18 -10
  288. package/src/views/Editor.tsx +9 -14
  289. package/src/views/Home/BuiltInAgent.tsx +7 -8
  290. package/src/views/Home/CustomAgent.tsx +3 -3
  291. package/src/views/Home/index.tsx +2 -2
  292. package/src/views/Home/styled.ts +21 -22
  293. package/src/views/KSDocument.tsx +7 -8
  294. package/src/views/KnowledgeSources.tsx +24 -66
  295. package/src/views/MessageInput/AgentSelector.tsx +10 -8
  296. package/src/views/MessageInput/ButtonAgent.tsx +24 -12
  297. package/src/views/MessageInput/ButtonBar.tsx +25 -21
  298. package/src/views/MessageInput/ContextBar.tsx +16 -14
  299. package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
  300. package/src/views/MessageInput/SelectContent.tsx +39 -62
  301. package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
  302. package/src/views/MessageInput/index.tsx +8 -9
  303. package/src/views/MessageInput/styled.ts +12 -16
  304. package/src/views/MinimizedHeader.tsx +5 -7
  305. package/src/views/Resources.tsx +31 -30
  306. package/src/views/Stacks.tsx +31 -54
  307. package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
  308. package/src/views/Steps/StepModal.tsx +14 -18
  309. package/src/views/Steps/index.tsx +4 -5
  310. package/src/views/Steps/utils.tsx +9 -9
  311. package/src/views/Tools.tsx +0 -1
  312. package/src/views/Workspaces/WorkspacesTab.tsx +17 -21
  313. package/src/views/Workspaces/index.tsx +4 -2
  314. package/dist/components/Accordion.d.ts +0 -20
  315. package/dist/components/Accordion.d.ts.map +0 -1
  316. package/dist/components/Accordion.js +0 -51
  317. package/dist/components/Accordion.js.map +0 -1
  318. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -33
  319. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
  320. package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -52
  321. package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
  322. package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
  323. package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
  324. package/dist/components/FallbackBoundary/Loading.js +0 -12
  325. package/dist/components/FallbackBoundary/Loading.js.map +0 -1
  326. package/dist/components/FallbackBoundary/index.d.ts +0 -17
  327. package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
  328. package/dist/components/FallbackBoundary/index.js +0 -9
  329. package/dist/components/FallbackBoundary/index.js.map +0 -1
  330. package/dist/components/IconInput.d.ts +0 -10
  331. package/dist/components/IconInput.d.ts.map +0 -1
  332. package/dist/components/IconInput.js +0 -61
  333. package/dist/components/IconInput.js.map +0 -1
  334. package/dist/components/OverlayMenu.d.ts +0 -21
  335. package/dist/components/OverlayMenu.d.ts.map +0 -1
  336. package/dist/components/OverlayMenu.js +0 -79
  337. package/dist/components/OverlayMenu.js.map +0 -1
  338. package/dist/components/ProgressBar.d.ts +0 -37
  339. package/dist/components/ProgressBar.d.ts.map +0 -1
  340. package/dist/components/ProgressBar.js +0 -131
  341. package/dist/components/ProgressBar.js.map +0 -1
  342. package/dist/components/Tooltip/Tooltip.d.ts +0 -37
  343. package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
  344. package/dist/components/Tooltip/Tooltip.js +0 -30
  345. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  346. package/dist/components/Tooltip/TooltipAPI.d.ts +0 -29
  347. package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
  348. package/dist/components/Tooltip/TooltipAPI.js +0 -107
  349. package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
  350. package/dist/components/Tooltip/context.d.ts +0 -5
  351. package/dist/components/Tooltip/context.d.ts.map +0 -1
  352. package/dist/components/Tooltip/context.js +0 -18
  353. package/dist/components/Tooltip/context.js.map +0 -1
  354. package/dist/components/Tooltip/index.d.ts +0 -3
  355. package/dist/components/Tooltip/index.d.ts.map +0 -1
  356. package/dist/components/Tooltip/index.js +0 -3
  357. package/dist/components/Tooltip/index.js.map +0 -1
  358. package/dist/components/Tooltip/style.d.ts +0 -4
  359. package/dist/components/Tooltip/style.d.ts.map +0 -1
  360. package/dist/components/Tooltip/style.js +0 -22
  361. package/dist/components/Tooltip/style.js.map +0 -1
  362. package/dist/components/Tooltip/types.d.ts +0 -27
  363. package/dist/components/Tooltip/types.d.ts.map +0 -1
  364. package/dist/components/Tooltip/types.js +0 -2
  365. package/dist/components/Tooltip/types.js.map +0 -1
  366. package/src/components/Accordion.tsx +0 -75
  367. package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -71
  368. package/src/components/FallbackBoundary/Loading.tsx +0 -14
  369. package/src/components/FallbackBoundary/index.tsx +0 -26
  370. package/src/components/IconInput.tsx +0 -73
  371. package/src/components/OverlayMenu.tsx +0 -133
  372. package/src/components/ProgressBar.tsx +0 -183
  373. package/src/components/Tooltip/Tooltip.tsx +0 -78
  374. package/src/components/Tooltip/TooltipAPI.ts +0 -101
  375. package/src/components/Tooltip/context.tsx +0 -24
  376. package/src/components/Tooltip/index.ts +0 -2
  377. package/src/components/Tooltip/style.tsx +0 -24
  378. package/src/components/Tooltip/types.ts +0 -28
@@ -1,52 +1,84 @@
1
- import { Radio, Text } from '@citric/core'
2
- import { listToClass } from '@stack-spot/portal-theme'
3
- import { useMemo } from 'react'
4
- import { Accordion } from '../Accordion'
5
- import { RadioCheckBox } from './styled'
6
- import { RadioProps } from './types'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { Accordion, FieldGroup, ImageBox, Input, RadioGroup, Row, Text, useRadioGroupControls } from '@stack-spot/citric-react'
3
+ import { useEffect, useState } from 'react'
4
+ import { ButtonFavorite, Favorite } from '../ButtonFavorite'
5
+
6
+ interface Props<T> {
7
+ initialValue?: T,
8
+ options: T[],
9
+ /**
10
+ * Must return the data needed by the component, given the option.
11
+ * @param option
12
+ * @returns
13
+ */
14
+ data: (option: T) => { name: string, description: React.ReactNode, image?: React.ReactElement } & Favorite<any>,
15
+ emptyResults: React.ReactNode,
16
+ emptyDataset: React.ReactNode,
17
+ onChange?: (value: T | undefined) => void,
18
+ }
7
19
 
8
20
  /**
9
- * Renders a radio button group where each option has a label and a description.
10
- * The description in placed under the label and radio button as an accordion.
21
+ * Renders a radio group where each option has a label and a description.
22
+ * The description in placed under the label and checkbox as an accordion.
23
+ *
24
+ * Also renders a search input.
11
25
  */
12
- export function DescribedRadioGroup<T>(
13
- {
14
- keygen,
15
- onChange,
16
- options,
17
- renderDescription,
18
- renderLabel,
19
- renderBeforeElement,
20
- renderAfterElement,
21
- optionClassName,
22
- optionStyle,
23
- value,
24
- className,
25
- style }: RadioProps<T>,
26
- ) {
27
- const items = useMemo(() => options.map((option) => {
28
- const label = renderLabel(option)
29
- const description = renderDescription(option)
26
+ export function DescribedRadioGroup<T>({ initialValue, options: opt, data, emptyDataset, emptyResults, onChange }: Props<T>) {
27
+ const [options, setOptions] = useState(opt)
28
+ const controls = useRadioGroupControls({
29
+ initialValue,
30
+ options,
31
+ applyFilter: (filter, o) => data(o).name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()),
32
+ renderKey: o => data(o).idOrSlug,
33
+ onChange,
34
+ })
30
35
 
31
- const header = (
32
- <label>
33
- <Radio checked={option === value} onChange={() => onChange(option)} />
34
- {typeof label === 'string' ? <Text>{label}</Text> : label}
35
- </label>
36
- )
37
- return (
38
- <li key={keygen(option)} className={listToClass(['radio-group-item', optionClassName?.(option)])} style={optionStyle?.(option)}>
39
- {renderBeforeElement?.(option)}
40
- <Accordion header={header}>
41
- {typeof description === 'string'
42
- ? <Text appearance="microtext1" colorScheme="light.700">{description}</Text>
43
- : description as any
44
- }
45
- </Accordion>
46
- {renderAfterElement?.(option)}
47
- </li>
48
- )
49
- }), [options, value])
36
+ useEffect(() => {
37
+ if (controls.value === undefined && initialValue !== undefined) controls.setValue(initialValue)
38
+ }, [initialValue])
50
39
 
51
- return <RadioCheckBox style={style} className={className}>{items}</RadioCheckBox>
40
+ return options.length ? <>
41
+ <FieldGroup fullWidth>
42
+ <Icon icon="Search" />
43
+ <Input type="search" value={controls.filter} onChange={controls.setFilter} />
44
+ </FieldGroup>
45
+ {controls.options.length ? <RadioGroup
46
+ options={controls.options}
47
+ value={controls.value}
48
+ onChange={controls.setValue}
49
+ renderKey={controls.renderKey}
50
+ className="option-list"
51
+ renderItem={(radio, o) => {
52
+ const { description, idOrSlug, name, image, listFavorites, onAddFavorite, onRemoveFavorite } = data(o)
53
+ return (
54
+ <Row className={controls.isUnfilteredButChecked(o) ? 'filtered-out' : ''}>
55
+ <Accordion
56
+ header={btn => <>
57
+ {radio}
58
+ {image && <ImageBox size="xs" style={{ fontSize: '16px' }}>{image}</ImageBox>}
59
+ <Text>{name}</Text>{btn}</>
60
+ }
61
+ appearance="card"
62
+ >
63
+ {typeof description === 'string' ? <Text appearance="microtext1" color="light.700">{description}</Text> : description}
64
+ </Accordion>
65
+ {onAddFavorite && <ButtonFavorite favorite={{
66
+ idOrSlug: idOrSlug,
67
+ listFavorites,
68
+ onAddFavorite: async (...args) => {
69
+ const res = await onAddFavorite(...args)
70
+ setOptions([...options]) // forces options re-rendering
71
+ return res
72
+ },
73
+ onRemoveFavorite: async (...args) => {
74
+ const res = await onRemoveFavorite?.(...args)
75
+ setOptions([...options]) // forces options re-rendering
76
+ return res ?? false
77
+ },
78
+ }} />}
79
+ </Row>
80
+ )
81
+ }}
82
+ /> : emptyResults}
83
+ </> : emptyDataset
52
84
  }
@@ -17,7 +17,10 @@ export function useWidget(): WidgetState {
17
17
  return globalWidgetState
18
18
  }
19
19
 
20
- function useObservableState<T, K extends keyof T>(state: ObservableState<T>, key: K): T[K] {
20
+ /**
21
+ * Watches an ObservableState.
22
+ */
23
+ export function useObservableState<T, K extends keyof T>(state: ObservableState<T>, key: K): T[K] {
21
24
  const [value, setValue] = useState(state.get(key))
22
25
  useEffect(() => {
23
26
  setValue(state.get(key))
@@ -0,0 +1,36 @@
1
+ import { useManualRender } from '@stack-spot/portal-components'
2
+ import { useEffect } from 'react'
3
+
4
+ /**
5
+ * Returns the number of milliseconds remaining until the next midnight.
6
+ */
7
+ function getTimeUntilMidnight() {
8
+ const now = new Date()
9
+ const midnight = new Date(now)
10
+ midnight.setHours(24, 0, 0, 0)
11
+ return midnight.getTime() - now.getTime()
12
+ }
13
+
14
+ /**
15
+ * Hook that triggers a component re-render at midnight every day.
16
+ */
17
+ export function useMidnightUpdateView() {
18
+ const { repaint } = useManualRender()
19
+
20
+ useEffect(() => {
21
+ let timer: ReturnType<typeof setTimeout> | undefined
22
+
23
+ const scheduleUpdate = () => {
24
+ const timeUntilMidnight = getTimeUntilMidnight()
25
+
26
+ timer = setTimeout(() => {
27
+ repaint()
28
+ scheduleUpdate()
29
+ }, timeUntilMidnight)
30
+ }
31
+
32
+ scheduleUpdate()
33
+
34
+ return () => { timer && clearTimeout(timer) }
35
+ }, [])
36
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
2
2
 
3
- export { ProgressBar } from './components/ProgressBar'
4
3
  export { QuickStartButton } from './components/QuickStartButton'
5
4
  export { AIWidgetProvider } from './context/AIWidgetProvider'
6
5
  export * from './context/hooks'
@@ -8,7 +7,7 @@ export { getFeaturesWithDefaults } from './features'
8
7
  export type { AIWidgetFeatures, ChatFeatures } from './features'
9
8
  export { StackspotAIWidget } from './StackspotAIWidget'
10
9
  export { ChatEntry } from './state/ChatEntry'
11
- export type { ChatAction } from './state/ChatEntry'
10
+ export type { ChatAction, TextChatEntry } from './state/ChatEntry'
12
11
  export { ChatState } from './state/ChatState'
13
12
  export type { MessageInterceptor } from './state/ChatState'
14
13
  export { ChatTabsController } from './state/ChatTabsController'
@@ -16,5 +15,8 @@ export { acceptedFileTypes } from './state/constants'
16
15
  export { ObservableState } from './state/ObservableState'
17
16
  export type { Labeled, LabeledAgent, LabeledWithImage } from './state/types'
18
17
  export { WidgetState } from './state/WidgetState'
18
+ export type { ButtonAction } from './types'
19
19
  export { defaultLanguage, languages } from './utils/programming-languages'
20
+ export type { CustomRenderResult } from './views/Chat/ChatMessage'
21
+ export { loadChat } from './views/ChatHistory/utils'
20
22
 
package/src/layout.css CHANGED
@@ -1,29 +1,3 @@
1
- @font-face {
2
- font-family: "San Francisco";
3
- font-weight: 400;
4
- src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff");
5
- }
6
-
7
- /* Scroll bars */
8
-
9
- ::-webkit-scrollbar-track {
10
- background-color: transparent;
11
- }
12
-
13
- ::-webkit-scrollbar {
14
- width: 0.25rem;
15
- height: 0.5rem;
16
- background-color: transparent;
17
- }
18
-
19
- ::-webkit-scrollbar-thumb {
20
- background-color: var(--light-600);
21
- }
22
-
23
- ::-webkit-scrollbar-corner {
24
- background-color: transparent;
25
- }
26
-
27
1
  /* Classes */
28
2
 
29
3
  .ai-chat-widget {
@@ -1,6 +1,4 @@
1
- import { Text } from '@citric/core'
2
- import { Times } from '@citric/icons'
3
- import { IconButton } from '@citric/ui'
1
+ import { IconButton, Text } from '@stack-spot/citric-react'
4
2
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
5
3
  import { styled } from 'styled-components'
6
4
  import { WithChildren } from '../types'
@@ -51,11 +49,9 @@ export const DefaultPanel = ({ description, onClose, title, children }: Props) =
51
49
  <header>
52
50
  <div className="title">
53
51
  {typeof title === 'string' ? <Text appearance="h5">{title}</Text> : title}
54
- {typeof description === 'string' ? <Text colorScheme="light.700">{description}</Text> : description}
52
+ {typeof description === 'string' ? <Text color="light.700">{description}</Text> : description}
55
53
  </div>
56
- <IconButton title={t.close} aria-label={t.close} onClick={onClose}>
57
- <Times />
58
- </IconButton>
54
+ <IconButton icon="Times" title={t.close} aria-label={t.close} onClick={onClose} />
59
55
  </header>
60
56
  <article>{children}</article>
61
57
  </PanelBox>
@@ -1,6 +1,5 @@
1
- import { OneOfColorSchemes } from '@citric/core'
2
1
  import { ChatStep } from '@stack-spot/portal-network'
3
- import { ColorPaletteName } from '@stack-spot/portal-theme'
2
+ import { ColorPaletteName, ColorSchemeName } from '@stack-spot/portal-theme'
4
3
  import { pull } from 'lodash'
5
4
  import { LabeledAgent } from './types'
6
5
 
@@ -32,7 +31,7 @@ export interface ChatAction extends SerializableAction {
32
31
  /**
33
32
  * @default inverse
34
33
  */
35
- colorScheme?: OneOfColorSchemes,
34
+ colorScheme?: ColorSchemeName,
36
35
  /**
37
36
  * @default false
38
37
  */
@@ -150,7 +149,7 @@ export interface TextChatEntry {
150
149
  /*
151
150
  * Options for radio, checkbox or button type.
152
151
  */
153
- options?: { color?: OneOfColorSchemes, label: string, value?: string, hasInput?: boolean}[],
152
+ options?: { color?: ColorSchemeName, label: string, value?: string, hasInput?: boolean}[],
154
153
  /**
155
154
  * Name to be used in input type fields.
156
155
  */
@@ -4,7 +4,8 @@ export const acceptedFileTypes = [
4
4
  'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls',*/ 'xlsx', 'csv', 'cbl', 'cpp', 'cxx', 'cc', 'c', 'hpp', 'hxx', 'hh', 'h',
5
5
  'cs', 'go', 'html', 'htm', 'kt', 'kts', 'md', 'php', 'proto', 'py', 'java', 'js', 'jsx', 'ts', 'tsx', 'rst', 'rb', 'rs', 'scala', 'swift',
6
6
  'sql', 'yaml', 'yml', 'tf', 'sh', 'ps1', 'psd1', 'psm1', 'bat', 'cmd', 'rego', 'f', 'for', 'r', 'pl', 'vb', 'dart', 'hs', 'lua',
7
- 'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png', 'docx', 'pptx',
7
+ 'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png', 'docx', 'pptx',
8
+ 'tiff', 'tif', 'bmp',
8
9
  ]
9
10
 
10
11
  export const maxFileSize: FileSize = { value: 10, unit: 'MB' }
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { WithIcon } from '@stack-spot/citric-icons'
2
+ import { BaseIconBoxProps } from '@stack-spot/citric-react'
1
3
  import { WithStyle } from '@stack-spot/portal-theme'
2
4
 
3
5
  export interface WithChildren<T = React.ReactNode> {
@@ -6,13 +8,17 @@ export interface WithChildren<T = React.ReactNode> {
6
8
 
7
9
  export type PropsOf<T extends React.FunctionComponent> = T extends React.FunctionComponent<infer P> ? P : never
8
10
 
9
- export interface ButtonAction extends WithStyle {
10
- icon?: React.ReactElement,
11
+ export type ButtonAction = {
11
12
  color?: string,
12
13
  label?: string,
13
14
  ariaLabel?: string,
15
+ title?: string,
14
16
  onClick: () => any,
15
- }
17
+ appearance?: BaseIconBoxProps<any, any>['appearance'],
18
+ size?: BaseIconBoxProps<any, any>['size'],
19
+ disabled?: boolean,
20
+ } & WithStyle & Partial<WithIcon>
21
+
16
22
 
17
23
  export interface MinimizedActions {
18
24
  /**
@@ -1,28 +1,19 @@
1
- import { BuiltinToolkitResponse, BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
2
- import { CustomToolkitDto } from '@stack-spot/portal-network/api/agent-tools'
1
+ import { BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
3
2
  import { keyBy } from 'lodash'
4
3
 
5
4
  export type ToolWithImage = BuiltinToolResponse & { id: string, image?: string }
6
5
 
7
- function isBuiltinToolkit(
8
- toolkit: BuiltinToolkitResponse | CustomToolkitDto,
9
- ): toolkit is BuiltinToolkitResponse {
10
- return 'image_url' in toolkit
11
- }
12
-
13
6
 
14
7
  export function toolById(
15
8
  id: string,
16
- toolkits: (BuiltinToolkitResponse | CustomToolkitDto)[] | undefined,
9
+ toolkits: { tools?: { id: string, name: string }[], image_url?: string | null, avatar?: string | null }[] | undefined,
17
10
  ): ToolWithImage | undefined {
18
11
  const tools = toolkits
19
12
  ?.map((toolkit) =>
20
13
  toolkit.tools?.map((tool) => ({
21
14
  ...tool,
22
15
  id: tool.id!,
23
- image: isBuiltinToolkit(toolkit)
24
- ? toolkit.image_url ?? undefined
25
- : (toolkit as CustomToolkitDto).avatar ?? undefined,
16
+ image: toolkit.image_url || toolkit.avatar || undefined,
26
17
  })),
27
18
  )
28
19
  .flat()
@@ -1,6 +1,5 @@
1
- import { Box, Flex, IconBox, Text } from '@citric/core'
2
- import { Agent, Cog } from '@citric/icons'
3
- import { Avatar, Badge, Skeleton } from '@citric/ui'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { Badge, Card, IconBox, ImageBox, ImageWithFallback, Skeleton, Text } from '@stack-spot/citric-react'
4
3
  import { agentToolsClient } from '@stack-spot/portal-network'
5
4
  import { useMemo } from 'react'
6
5
  import { toolById } from '../../utils/tools'
@@ -16,12 +15,10 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
16
15
  const knowledgeSources = useMemo(
17
16
  () => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
18
17
  <li key={index}>
19
- <Box className="card-agent-info">
20
- <Flex alignItems="center" justifyContent="space-between" pl={2}>
21
- <Text colorScheme="light.contrastText">{ks.name}</Text>
22
- <Badge palette="gray" appearance="square">{ks.type}</Badge>
23
- </Flex>
24
- </Box>
18
+ <Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500} justifyContent="space-between">
19
+ <Text color="light.contrastText">{ks.name}</Text>
20
+ <Badge colorScheme="inverse" appearance="square">{ks.type}</Badge>
21
+ </Card>
25
22
  </li>
26
23
  )),
27
24
  [agent],
@@ -29,11 +26,10 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
29
26
  const skeleton = useMemo(() => {
30
27
  const loadingKS: React.ReactElement[] = []
31
28
  for (let i = 0; i < numberOfKnowledgeSources; i++) {
32
- loadingKS.push(<li key={i}><Skeleton className="ks-skeleton" /></li>)
29
+ loadingKS.push(<li key={i}><Badge colorPalette="teal" appearance="square"><Skeleton className="ks-skeleton" /></Badge></li>)
33
30
  }
34
31
  return loadingKS
35
32
  }, [numberOfKnowledgeSources])
36
-
37
33
 
38
34
  const { tools, multiAgents } = useMemo(() => {
39
35
  const tools: React.ReactElement[] = []
@@ -46,28 +42,20 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
46
42
  const toolWithImage = toolById(tool.id, toolKits)
47
43
  tools.push(
48
44
  <li key={tool.id}>
49
- <Box className="card-agent-info">
50
- <Flex alignItems="center">
51
- {toolWithImage?.image ?
52
- <Avatar size="xxs" sx={{ mr: 3 }}> <img src={toolWithImage?.image} /></Avatar> :
53
- <IconBox colorIcon="light" sx={{ mr: 3 }}><Cog /></IconBox>}
54
- <Text colorScheme="light.contrastText">{toolWithImage?.name || toolWithImage?.id || 'unknown'}</Text>
55
- </Flex>
56
- </Box>
45
+ <Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
46
+ <ImageBox><ImageWithFallback src={toolWithImage?.image} fallback={<Icon icon="Cog" />} /></ImageBox>
47
+ <Text color="light.contrastText">{toolWithImage?.name || toolWithImage?.id || 'unknown'}</Text>
48
+ </Card>
57
49
  </li>,
58
50
  )
59
51
  }
60
52
  if (toolkit.id == 'MULTI_AGENTS'){
61
53
  multiAgents.push(
62
54
  <li key={tool.id}>
63
- <Box className="card-agent-info">
64
- <Flex alignItems="center">
65
- <IconBox colorIcon="light" sx={{ mr: 3 }}><Agent /></IconBox>
66
- <Text colorScheme="light.contrastText">
67
- {tool.name}
68
- </Text>
69
- </Flex>
70
- </Box>
55
+ <Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
56
+ <IconBox icon="Agent" />
57
+ <Text color="light.contrastText">{tool.name}</Text>
58
+ </Card>
71
59
  </li>,
72
60
  )
73
61
  }
@@ -77,14 +65,10 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
77
65
  for (const tool of toolkit.tools) {
78
66
  tools.push(
79
67
  <li key={tool.id}>
80
- <Box className="card-agent-info">
81
- <Flex alignItems="center">
82
- {toolkit.avatar ?
83
- <Avatar size="xxs" sx={{ mr: 3 }}><img src={toolkit.avatar} /></Avatar> :
84
- <IconBox colorIcon="light" sx={{ mr: 3 }}><Cog /></IconBox>}
85
- <Text colorScheme="light.contrastText">{tool.name}</Text>
86
- </Flex>
87
- </Box>
68
+ <Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
69
+ <ImageBox><ImageWithFallback src={toolkit.avatar ?? undefined} fallback={<Icon icon="Cog" />} /></ImageBox>
70
+ <Text color="light.contrastText">{tool.name}</Text>
71
+ </Card>
88
72
  </li>,
89
73
  )
90
74
  }
@@ -112,7 +96,7 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
112
96
  </section>}
113
97
  {agent?.model_name && <section>
114
98
  <Text appearance="microtext1" className="title">LLM</Text>
115
- <Badge palette="orange" appearance="square">{agent?.model_name}</Badge>
99
+ <Badge colorPalette="orange" appearance="square">{agent?.model_name}</Badge>
116
100
  </section>}
117
101
  </AgentDescriptionBox>
118
102
  )
@@ -1,5 +1,6 @@
1
+ import { Tab } from '@stack-spot/citric-react'
1
2
  import { agentToolsClient } from '@stack-spot/portal-network'
2
- import { ReactElement, useEffect, useRef } from 'react'
3
+ import { useEffect, useRef } from 'react'
3
4
  import { RightPanelContentList } from '../../components/RightPanelContentList'
4
5
  import { RightPanelTabs } from '../../components/RightPanelTabs'
5
6
  import { useCurrentChat, useWidgetState } from '../../context/hooks'
@@ -8,8 +9,6 @@ import { checkIsTrial } from '../../utils/check-is-trial'
8
9
  import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
9
10
  import { useAgentsDictionary } from './dictionary'
10
11
 
11
- type TabElement = { title: string, content: ReactElement }
12
-
13
12
  /**
14
13
  * Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
15
14
  */
@@ -29,13 +28,13 @@ export const AgentsPanel = () => {
29
28
  }
30
29
  }, [chat])
31
30
 
32
- const allTabsMap: Record<Scope, TabElement> = {
33
- favorite: { title: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
34
- builtin: { title: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
35
- personal: { title: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
36
- shared: { title: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
37
- workspace: { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
38
- account: { title: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
31
+ const allTabsMap: Record<Scope, Omit<Tab, 'key'>> = {
32
+ favorite: { label: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
33
+ builtin: { label: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
34
+ personal: { label: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
35
+ shared: { label: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
36
+ workspace: { label: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
37
+ account: { label: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
39
38
  }
40
39
 
41
40
  const defaultScopes: Scope[] = ['favorite', 'builtin', 'personal', 'shared', 'workspace', 'account']
@@ -47,8 +46,8 @@ export const AgentsPanel = () => {
47
46
  : rawScopes
48
47
 
49
48
  const tabs = scopesToRender
50
- .map(scope => allTabsMap[scope])
51
- .filter(Boolean) as TabElement[]
49
+ .map(scope => scope in allTabsMap ? ({ key: scope, ...allTabsMap[scope] }) : undefined)
50
+ .filter(Boolean) as Tab[]
52
51
 
53
52
  return (isGroupResourcesByScope ? (
54
53
  <RightPanelTabs key={chat.id} tabs={tabs} />
@@ -1,21 +1,17 @@
1
- import { Button, IconBox, Text } from '@citric/core'
2
- import { Agent, Search } from '@citric/icons'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { Button } from '@stack-spot/citric-react'
3
3
  import { Placeholder } from '@stack-spot/portal-components/Placeholder'
4
- import { MiniLogo } from '@stack-spot/portal-components/svg'
5
4
  import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
6
5
  import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
7
- import { useCallback, useMemo, useState } from 'react'
8
- import { ButtonFavorite } from '../../components/ButtonFavorite'
6
+ import { useMemo, useState } from 'react'
9
7
  import { NavigationComponent } from '../../components/ComponentNavigator'
10
8
  import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
11
- import { IconInput } from '../../components/IconInput'
12
9
  import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
13
10
  import { useCurrentChat } from '../../context/hooks'
14
11
  import { useRightPanel } from '../../right-panel/hooks'
15
12
  import { ChatProperties } from '../../state/ChatState'
16
13
  import { AgentDescription } from './AgentDescription'
17
14
  import { useAgentsDictionary } from './dictionary'
18
- import { AgentLabel } from './styled'
19
15
  import { useAgentFavorites } from './useAgentFavorites'
20
16
 
21
17
  export interface AgentTabProps {
@@ -29,73 +25,58 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
29
25
  const t = useAgentsDictionary()
30
26
  const { close } = useRightPanel()
31
27
  const chat = useCurrentChat()
32
- const [filter, setFilter] = useState('')
33
28
  const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
29
+ const [submitEnabled, setSubmitEnabled] = useState(false)
34
30
  const listFavorites = useFavorites()
35
31
  const agentDefault = agentToolsClient.agentDefault.useQuery()
36
32
  const agents = workspaceId
37
33
  ? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId }) as AgentResponseWithBuiltIn[]
38
- : agentToolsClient.agents.useQuery({ visibility })
34
+ : agentToolsClient.agents.useQuery({ request: { visibility } })
39
35
 
40
- const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
41
- agent.current
42
- ? agents.find(a => a.id === agent.current?.id)
43
- : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn,
44
- )
45
-
46
- const filtered = useMemo(
47
- // Recreate the list so that the favorites list is taken into account
48
- () => filter ? agents.filter(a => a === value || a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : [...agents],
49
- [agents, filter, value, listFavorites],
36
+ const initialValue = useMemo<AgentResponseWithBuiltIn | undefined>(
37
+ () => {
38
+ const initial = agent.current
39
+ ? agents.find(a => a.id === agent.current?.id)
40
+ : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn
41
+ if (initial) setSubmitEnabled(true)
42
+ return initial
43
+ },
44
+ [agents],
50
45
  )
51
46
 
52
47
  function submit() {
53
- if (value) {
54
- chat.set(
55
- 'agent',
56
- { id: value.id, label: value.name, image: value.avatar!, builtIn: value.visibility_level === 'built_in', slug: value.slug },
57
- )
58
- }
48
+ if (agent.current) chat.set('agent', agent.current)
59
49
  close()
60
50
  }
61
51
 
62
- const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
63
- setValue(newValue)
64
- agent.current = { ...newValue, label: newValue.name, builtIn: newValue.visibility_level === 'built_in' }
65
- }, [])
66
-
67
52
  return (
68
53
  <>
69
54
  <div className="content">
70
- <IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
71
- {!!filtered.length && <DescribedRadioGroup
72
- options={filtered}
73
- renderAfterElement={({ id }) => (
74
- <ButtonFavorite favorite={{
75
- idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite,
76
- }} />
77
- )}
78
- keygen={a => a.id}
79
- value={value}
80
- onChange={onChange}
81
- renderLabel={({ name, avatar, id }) => (
82
- <AgentLabel>
83
- {id ? (avatar ? <img src={avatar} /> : <IconBox size="xs"><Agent /></IconBox>) : <MiniLogo />}
84
- <Text>{name}</Text>
85
- </AgentLabel>
86
- )}
87
- renderDescription={a => <AgentDescription agentId={a.id} />}
88
- optionClassName={a => (a === value && filter && !a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
89
- ? 'filtered-out'
90
- : ''
55
+ <DescribedRadioGroup
56
+ options={agents}
57
+ initialValue={initialValue}
58
+ onChange={(ag) => {
59
+ agent.current = ag
60
+ ? { ...ag, label: ag.name, image: ag.avatar!, slug: ag.slug, builtIn: ag.visibility_level === 'built_in' }
61
+ : undefined
62
+ setSubmitEnabled(true)
63
+ }}
64
+ data={ag => ({
65
+ idOrSlug: ag.id,
66
+ image: ag.avatar ? <img src={ag.avatar} /> : <Icon icon="Agent" />,
67
+ description: <AgentDescription agentId={ag.id} />,
68
+ name: ag.name,
69
+ listFavorites,
70
+ onAddFavorite,
71
+ onRemoveFavorite,
72
+ })}
73
+ emptyResults={
74
+ <Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />
91
75
  }
92
- className="option-list"
93
- />}
94
- {!!agents.length && !filtered.length &&
95
- <Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
96
- {!agents.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
76
+ emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} />}
77
+ />
97
78
  </div>
98
- {!!filtered.length && showSubmitButton && <Button onClick={submit} disabled={!value}>{t.apply}</Button>}
79
+ {!!agents.length && showSubmitButton && <Button onClick={submit} disabled={!submitEnabled}>{t.apply}</Button>}
99
80
  </>
100
81
  )
101
82
  }