@agentscope-ai/chat 1.1.20 → 1.1.22

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 (335) hide show
  1. package/bin/client.js +1 -1
  2. package/components/AGUI/components/HelpModal/icons.tsx +68 -0
  3. package/components/AGUI/components/HelpModal/index.tsx +1 -0
  4. package/components/AGUI/components/HelpModal/modal.tsx +101 -0
  5. package/components/AGUI/components/chat/Button.tsx +18 -0
  6. package/components/AGUI/components/chat/Chat.tsx +780 -0
  7. package/components/AGUI/components/chat/ChatContext.tsx +248 -0
  8. package/components/AGUI/components/chat/CodeBlock.tsx +406 -0
  9. package/components/AGUI/components/chat/Header.tsx +22 -0
  10. package/components/AGUI/components/chat/Icons.tsx +237 -0
  11. package/components/AGUI/components/chat/ImageUploadQueue.tsx +77 -0
  12. package/components/AGUI/components/chat/Input.tsx +24 -0
  13. package/components/AGUI/components/chat/Markdown.tsx +134 -0
  14. package/components/AGUI/components/chat/Messages.tsx +259 -0
  15. package/components/AGUI/components/chat/Modal.tsx +133 -0
  16. package/components/AGUI/components/chat/Popup.tsx +57 -0
  17. package/components/AGUI/components/chat/PoweredByTag.tsx +29 -0
  18. package/components/AGUI/components/chat/Sidebar.tsx +74 -0
  19. package/components/AGUI/components/chat/Suggestion.tsx +132 -0
  20. package/components/AGUI/components/chat/Suggestions.tsx +20 -0
  21. package/components/AGUI/components/chat/Textarea.tsx +61 -0
  22. package/components/AGUI/components/chat/Window.tsx +152 -0
  23. package/components/AGUI/components/chat/index.tsx +11 -0
  24. package/components/AGUI/components/chat/messages/AssistantMessage.tsx +69 -0
  25. package/components/AGUI/components/chat/messages/RenderActionExecutionMessage.tsx +129 -0
  26. package/components/AGUI/components/chat/messages/RenderAgentStateMessage.tsx +116 -0
  27. package/components/AGUI/components/chat/messages/RenderImageMessage.tsx +64 -0
  28. package/components/AGUI/components/chat/messages/RenderResultMessage.tsx +26 -0
  29. package/components/AGUI/components/chat/messages/RenderTextMessage.tsx +51 -0
  30. package/components/AGUI/components/chat/messages/UserMessage.tsx +10 -0
  31. package/components/AGUI/components/chat/props.ts +186 -0
  32. package/components/AGUI/components/index.ts +1 -0
  33. package/components/AGUI/context/index.ts +1 -0
  34. package/components/AGUI/hooks/index.ts +1 -0
  35. package/components/AGUI/hooks/use-copilot-chat-suggestions.tsx +122 -0
  36. package/components/AGUI/hooks/use-copy-to-clipboard.tsx +29 -0
  37. package/components/AGUI/hooks/use-dark-mode.ts +10 -0
  38. package/components/AGUI/hooks/use-push-to-talk.tsx +166 -0
  39. package/components/AGUI/index.tsx +4 -0
  40. package/components/AGUI/lib/utils.test.ts +7 -0
  41. package/components/AGUI/lib/utils.ts +27 -0
  42. package/components/AGUI/styles.css +0 -0
  43. package/components/AGUI/types/css.ts +0 -0
  44. package/components/AGUI/types/index.ts +1 -0
  45. package/components/AGUI/types/suggestions.ts +6 -0
  46. package/components/Accordion/Accordion.tsx +203 -0
  47. package/components/Accordion/BodyContent.tsx +28 -0
  48. package/components/Accordion/DeepThinking.tsx +91 -0
  49. package/components/Accordion/SoftLightTitle.tsx +13 -0
  50. package/components/Accordion/demo/search.tsx +39 -0
  51. package/components/Accordion/demo/steps.tsx +135 -0
  52. package/components/Accordion/demo/thinking.tsx +62 -0
  53. package/components/Accordion/index.en-US.md +34 -0
  54. package/components/Accordion/index.tsx +3 -0
  55. package/components/Accordion/index.zh-CN.md +34 -0
  56. package/components/Accordion/style.ts +208 -0
  57. package/components/AgentScopeRuntimeWebUI/demo/index.tsx +4 -0
  58. package/components/AgentScopeRuntimeWebUI/index.tsx +3 -0
  59. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Builder.tsx +82 -0
  60. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Request/Card.tsx +52 -0
  61. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Actions.tsx +39 -0
  62. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Builder.tsx +205 -0
  63. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Card.tsx +44 -0
  64. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Error.tsx +7 -0
  65. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Message.tsx +23 -0
  66. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Reasoning.tsx +16 -0
  67. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/Response/Tool.tsx +19 -0
  68. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/index.tsx +0 -0
  69. package/components/AgentScopeRuntimeWebUI/lib/AgentScopeRuntime/types.tsx +100 -0
  70. package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/index.tsx +77 -0
  71. package/components/AgentScopeRuntimeWebUI/lib/Chat/Input/useAttachments.tsx +53 -0
  72. package/components/AgentScopeRuntimeWebUI/lib/Chat/MessageList/index.tsx +30 -0
  73. package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/index.tsx +66 -0
  74. package/components/AgentScopeRuntimeWebUI/lib/Chat/Welcome/styles.ts +51 -0
  75. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/index.tsx +5 -0
  76. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatController.tsx +130 -0
  77. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatMessageHandler.tsx +87 -0
  78. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatRequest.tsx +114 -0
  79. package/components/AgentScopeRuntimeWebUI/lib/Chat/hooks/useChatSessionHandler.tsx +50 -0
  80. package/components/AgentScopeRuntimeWebUI/lib/Chat/index.tsx +18 -0
  81. package/components/AgentScopeRuntimeWebUI/lib/Chat/styles.tsx +59 -0
  82. package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/ComposedProvider.tsx +27 -0
  83. package/components/AgentScopeRuntimeWebUI/lib/ChatAnywhere/index.tsx +29 -0
  84. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereControl.tsx +0 -0
  85. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereInputContext.tsx +27 -0
  86. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereLayoutContext.tsx +27 -0
  87. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereMessagesContext.tsx +82 -0
  88. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereOptionsContext.tsx +76 -0
  89. package/components/AgentScopeRuntimeWebUI/lib/Context/ChatAnywhereSessionsContext.tsx +111 -0
  90. package/components/AgentScopeRuntimeWebUI/lib/Context/useChatAnywhereEventEmitter.tsx +30 -0
  91. package/components/AgentScopeRuntimeWebUI/lib/Header/index.tsx +45 -0
  92. package/components/AgentScopeRuntimeWebUI/lib/Header/styles.ts +23 -0
  93. package/components/AgentScopeRuntimeWebUI/lib/Layout/index.tsx +45 -0
  94. package/components/AgentScopeRuntimeWebUI/lib/Layout/styles.tsx +104 -0
  95. package/components/AgentScopeRuntimeWebUI/lib/Sessions/index.tsx +114 -0
  96. package/components/AgentScopeRuntimeWebUI/lib/Sessions/styles.tsx +0 -0
  97. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/FormItem.tsx +37 -0
  98. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/OptionsEditor.tsx +163 -0
  99. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/defaultConfig.ts +43 -0
  100. package/components/AgentScopeRuntimeWebUI/lib/demo/OptionsPanel/index.tsx +27 -0
  101. package/components/AgentScopeRuntimeWebUI/lib/demo/index.tsx +57 -0
  102. package/components/AgentScopeRuntimeWebUI/lib/demo/sessionApi/index.ts +51 -0
  103. package/components/AgentScopeRuntimeWebUI/lib/types/IChatAnywhere.ts +358 -0
  104. package/components/AgentScopeRuntimeWebUI/lib/types/IMessages.tsx +52 -0
  105. package/components/AgentScopeRuntimeWebUI/lib/types/ISessions.tsx +29 -0
  106. package/components/AgentScopeRuntimeWebUI/lib/types/index.tsx +3 -0
  107. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.tsx +37 -0
  108. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.tsx +163 -0
  109. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.ts +43 -0
  110. package/components/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.tsx +27 -0
  111. package/components/AgentScopeRuntimeWebUI/starter/index.tsx +57 -0
  112. package/components/AgentScopeRuntimeWebUI/starter/sessionApi/index.ts +51 -0
  113. package/components/Attachments/DropArea.tsx +97 -0
  114. package/components/Attachments/FileList/AudioIcon.tsx +20 -0
  115. package/components/Attachments/FileList/FileListCard.tsx +270 -0
  116. package/components/Attachments/FileList/Progress.tsx +30 -0
  117. package/components/Attachments/FileList/VideoIcon.tsx +20 -0
  118. package/components/Attachments/FileList/index.tsx +201 -0
  119. package/components/Attachments/PlaceholderUploader.tsx +124 -0
  120. package/components/Attachments/SilentUploader.tsx +39 -0
  121. package/components/Attachments/context.tsx +11 -0
  122. package/components/Attachments/demo/basic.tsx +71 -0
  123. package/components/Attachments/index.en-US.md.bk +10 -0
  124. package/components/Attachments/index.tsx +274 -0
  125. package/components/Attachments/index.zh-CN.md.bk +10 -0
  126. package/components/Attachments/style/fileCard.ts +163 -0
  127. package/components/Attachments/style/index.ts +232 -0
  128. package/components/Attachments/util.ts +56 -0
  129. package/components/Bubble/Avatar.tsx +39 -0
  130. package/components/Bubble/Bubble.tsx +131 -0
  131. package/components/Bubble/BubbleList.tsx +105 -0
  132. package/components/Bubble/Cards.tsx +61 -0
  133. package/components/Bubble/Footer.tsx +55 -0
  134. package/components/Bubble/Interrupted.tsx +82 -0
  135. package/components/Bubble/ScrollToBottom.tsx +42 -0
  136. package/components/Bubble/Spin.tsx +13 -0
  137. package/components/Bubble/demo/assistantWithCode.tsx +60 -0
  138. package/components/Bubble/demo/assistantWithErrorStatus.tsx +102 -0
  139. package/components/Bubble/demo/assistantWithImage.tsx +46 -0
  140. package/components/Bubble/demo/assistantWithProcess.tsx +103 -0
  141. package/components/Bubble/demo/assistantWithSearch.tsx +69 -0
  142. package/components/Bubble/demo/assistantWithThinking.tsx +54 -0
  143. package/components/Bubble/demo/basic.tsx +55 -0
  144. package/components/Bubble/demo/userWithFile.tsx +27 -0
  145. package/components/Bubble/demo/userWithImage.tsx +26 -0
  146. package/components/Bubble/hooks/useDisplayData.ts +0 -0
  147. package/components/Bubble/hooks/useListData.ts +0 -0
  148. package/components/Bubble/index.en-US.md +33 -0
  149. package/components/Bubble/index.tsx +21 -0
  150. package/components/Bubble/index.zh-CN.md +33 -0
  151. package/components/Bubble/interface.ts +71 -0
  152. package/components/Bubble/loading.tsx +15 -0
  153. package/components/Bubble/style/avatar.ts +43 -0
  154. package/components/Bubble/style/footer.ts +45 -0
  155. package/components/Bubble/style/index.ts +192 -0
  156. package/components/Bubble/style/list.ts +51 -0
  157. package/components/ChatAnywhere/Chat/Ref.tsx +20 -0
  158. package/components/ChatAnywhere/Chat/index.tsx +56 -0
  159. package/components/ChatAnywhere/Chat/style.ts +59 -0
  160. package/components/ChatAnywhere/Header/index.tsx +37 -0
  161. package/components/ChatAnywhere/Header/style.ts +27 -0
  162. package/components/ChatAnywhere/Input/index.tsx +158 -0
  163. package/components/ChatAnywhere/Input/style.ts +14 -0
  164. package/components/ChatAnywhere/Layout/index.tsx +70 -0
  165. package/components/ChatAnywhere/Layout/style.ts +51 -0
  166. package/components/ChatAnywhere/SessionList/index.tsx +122 -0
  167. package/components/ChatAnywhere/SessionList/style.ts +53 -0
  168. package/components/ChatAnywhere/hooks/ChatAnywhereProvider.tsx +219 -0
  169. package/components/ChatAnywhere/hooks/types.ts +333 -0
  170. package/components/ChatAnywhere/hooks/useInput.tsx +22 -0
  171. package/components/ChatAnywhere/hooks/useMessages.tsx +63 -0
  172. package/components/ChatAnywhere/hooks/useSessionList.tsx +123 -0
  173. package/components/ChatAnywhere/index.tsx +49 -0
  174. package/components/Conversations/GroupTitle.tsx +28 -0
  175. package/components/Conversations/Item.tsx +189 -0
  176. package/components/Conversations/demo/basic.tsx +107 -0
  177. package/components/Conversations/demo/timeline.tsx +111 -0
  178. package/components/Conversations/demo/timestamp.tsx +110 -0
  179. package/components/Conversations/hooks/useGroupable.ts +81 -0
  180. package/components/Conversations/index.en-US.md +32 -0
  181. package/components/Conversations/index.tsx +176 -0
  182. package/components/Conversations/index.zh-CN.md +31 -0
  183. package/components/Conversations/interface.ts +69 -0
  184. package/components/Conversations/style.ts +153 -0
  185. package/components/DefaultCards/DeepThinking/index.tsx +33 -0
  186. package/components/DefaultCards/Files/index.tsx +69 -0
  187. package/components/DefaultCards/Footer/index.tsx +16 -0
  188. package/components/DefaultCards/Images/index.tsx +53 -0
  189. package/components/DefaultCards/Interrupted/index.tsx +13 -0
  190. package/components/DefaultCards/Text/index.tsx +13 -0
  191. package/components/DefaultCards/index.tsx +6 -0
  192. package/components/DeviceAction/actionMap.tsx +100 -0
  193. package/components/DeviceAction/demo/index.tsx +132 -0
  194. package/components/DeviceAction/index.en-US.md +19 -0
  195. package/components/DeviceAction/index.tsx +75 -0
  196. package/components/DeviceAction/index.zh-CN.md +19 -0
  197. package/components/Disclaimer/demo/index.tsx +4 -0
  198. package/components/Disclaimer/demo/withLink.tsx +4 -0
  199. package/components/Disclaimer/index.en-US.md +23 -0
  200. package/components/Disclaimer/index.tsx +42 -0
  201. package/components/Disclaimer/index.zh-CN.md +24 -0
  202. package/components/Disclaimer/style.ts +17 -0
  203. package/components/ImageGenerator/demo/basic.tsx +23 -0
  204. package/components/ImageGenerator/demo/custom.tsx +56 -0
  205. package/components/ImageGenerator/demo/size.tsx +15 -0
  206. package/components/ImageGenerator/index.en-US.md +23 -0
  207. package/components/ImageGenerator/index.tsx +124 -0
  208. package/components/ImageGenerator/index.zh-CN.md +23 -0
  209. package/components/ImageGenerator/style.ts +99 -0
  210. package/components/Markdown/Markdown/AnimationNode.tsx +89 -0
  211. package/components/Markdown/Markdown/Markdown.tsx +61 -0
  212. package/components/Markdown/Markdown/core/Parser.ts +52 -0
  213. package/components/Markdown/Markdown/core/Renderer.ts +121 -0
  214. package/components/Markdown/Markdown/core/index.ts +4 -0
  215. package/components/Markdown/Markdown/defaultComponents/CodeBlock.tsx +113 -0
  216. package/components/Markdown/Markdown/defaultComponents/DisabledImage.tsx +3 -0
  217. package/components/Markdown/Markdown/defaultComponents/Media.tsx +71 -0
  218. package/components/Markdown/Markdown/hooks/index.ts +4 -0
  219. package/components/Markdown/Markdown/hooks/useAnimation.tsx +27 -0
  220. package/components/Markdown/Markdown/hooks/useCitationsData.tsx +36 -0
  221. package/components/Markdown/Markdown/hooks/useStreaming.ts +503 -0
  222. package/components/Markdown/Markdown/hooks/useTyping.ts +22 -0
  223. package/components/Markdown/Markdown/index.tsx +198 -0
  224. package/components/Markdown/Markdown/interface.ts +217 -0
  225. package/components/Markdown/Markdown/style.ts +152 -0
  226. package/components/Markdown/demo/basic.tsx +107 -0
  227. package/components/Markdown/demo/citations.tsx +47 -0
  228. package/components/Markdown/demo/cursor.tsx +9 -0
  229. package/components/Markdown/demo/latex.tsx +77 -0
  230. package/components/Markdown/demo/typing.tsx +82 -0
  231. package/components/Markdown/index.en-US.md +27 -0
  232. package/components/Markdown/index.ts +1 -0
  233. package/components/Markdown/index.zh-CN.md +28 -0
  234. package/components/Markdown/plugins/citations/CitationComponent.tsx +72 -0
  235. package/components/Markdown/plugins/citations/index.tsx +37 -0
  236. package/components/Markdown/plugins/cursor/Dot.tsx +106 -0
  237. package/components/Markdown/plugins/cursor/Underline.tsx +38 -0
  238. package/components/Markdown/plugins/cursor/index.tsx +59 -0
  239. package/components/Markdown/plugins/latex/index.ts +109 -0
  240. package/components/Markdown/plugins/type.ts +71 -0
  241. package/components/Mermaid/demo/basic.tsx +12 -0
  242. package/components/Mermaid/demo/class.tsx +31 -0
  243. package/components/Mermaid/demo/flowchart.tsx +13 -0
  244. package/components/Mermaid/demo/sequence.tsx +18 -0
  245. package/components/Mermaid/demo/state.tsx +16 -0
  246. package/components/Mermaid/demo/timeline.tsx +15 -0
  247. package/components/Mermaid/index.en-US.md +27 -0
  248. package/components/Mermaid/index.tsx +118 -0
  249. package/components/Mermaid/index.zh-CN.md +27 -0
  250. package/components/OperateCard/OperateCard.tsx +93 -0
  251. package/components/OperateCard/demo/index.tsx +35 -0
  252. package/components/OperateCard/demo/rag.tsx +19 -0
  253. package/components/OperateCard/demo/thinking.tsx +17 -0
  254. package/components/OperateCard/demo/todo.tsx +28 -0
  255. package/components/OperateCard/demo/toolCall.tsx +14 -0
  256. package/components/OperateCard/demo/webSearch.tsx +12 -0
  257. package/components/OperateCard/index.en-US.md +51 -0
  258. package/components/OperateCard/index.tsx +1 -0
  259. package/components/OperateCard/index.zh-CN.md +51 -0
  260. package/components/OperateCard/preset/Rag.tsx +90 -0
  261. package/components/OperateCard/preset/Thinking.tsx +45 -0
  262. package/components/OperateCard/preset/TodoList.tsx +73 -0
  263. package/components/OperateCard/preset/ToolCall.tsx +67 -0
  264. package/components/OperateCard/preset/WebSearch.tsx +65 -0
  265. package/components/OperateCard/preset/index.tsx +5 -0
  266. package/components/OperateCard/style.ts +268 -0
  267. package/components/Provider/CustomCardsProvider.tsx +17 -0
  268. package/components/Provider/GlobalProvider.tsx +17 -0
  269. package/components/Provider/index.tsx +33 -0
  270. package/components/Provider/types.ts +23 -0
  271. package/components/ResponsesAPI/index.tsx +0 -0
  272. package/components/Sender/ModeSelect/index.tsx +160 -0
  273. package/components/Sender/ModeSelect/styles.ts +0 -0
  274. package/components/Sender/SenderHeader.tsx +164 -0
  275. package/components/Sender/StopLoading.tsx +48 -0
  276. package/components/Sender/components/ActionButton.tsx +106 -0
  277. package/components/Sender/components/ClearButton.tsx +10 -0
  278. package/components/Sender/components/LoadingButton.tsx +26 -0
  279. package/components/Sender/components/SendButton.tsx +22 -0
  280. package/components/Sender/components/SpeechButton/RecordingIcon.tsx +68 -0
  281. package/components/Sender/components/SpeechButton/index.tsx +30 -0
  282. package/components/Sender/demo/asr.tsx +7 -0
  283. package/components/Sender/demo/basic.tsx +7 -0
  284. package/components/Sender/demo/loading.tsx +5 -0
  285. package/components/Sender/demo/moreMode.tsx +45 -0
  286. package/components/Sender/demo/morePrefixAction.tsx +40 -0
  287. package/components/Sender/demo/withFile.tsx +54 -0
  288. package/components/Sender/demo/withImage.tsx +52 -0
  289. package/components/Sender/index.en-US.md +29 -0
  290. package/components/Sender/index.tsx +491 -0
  291. package/components/Sender/index.zh-CN.md +30 -0
  292. package/components/Sender/style/index.ts +150 -0
  293. package/components/Sender/useSpeech.ts +133 -0
  294. package/components/StatusCard/demo/index.tsx +32 -0
  295. package/components/StatusCard/index.en-US.md +30 -0
  296. package/components/StatusCard/index.tsx +162 -0
  297. package/components/StatusCard/index.zh-CN.md +27 -0
  298. package/components/StatusCard/style.ts +119 -0
  299. package/components/Stream/index.ts +203 -0
  300. package/components/Util/hooks/use-proxy-imperative-handle.ts +25 -0
  301. package/components/Util/sleep.ts +3 -0
  302. package/components/Util/type.ts +1 -0
  303. package/components/Util/warning.ts +118 -0
  304. package/components/Version/index.ts +3 -0
  305. package/components/Voice/Recorder.tsx +3 -0
  306. package/components/Voice/demo/index.tsx +0 -0
  307. package/components/Voice/index.en-US.md +8 -0
  308. package/components/Voice/index.tsx +0 -0
  309. package/components/Voice/index.zh-CN.md +9 -0
  310. package/components/Welcome/demo/EyeFollower.tsx +161 -0
  311. package/components/Welcome/demo/demo0.tsx +14 -0
  312. package/components/Welcome/demo/demo1.tsx +16 -0
  313. package/components/Welcome/demo/demo2.tsx +30 -0
  314. package/components/Welcome/demo/demo3.tsx +16 -0
  315. package/components/Welcome/index.en-US.md +28 -0
  316. package/components/Welcome/index.tsx +72 -0
  317. package/components/Welcome/index.zh-CN.md +28 -0
  318. package/components/index.ts +88 -0
  319. package/components/overview.en-US.md +10 -0
  320. package/components/overview.zh-CN.md +10 -0
  321. package/lib/AgentScopeRuntimeWebUI/index.d.ts +1 -0
  322. package/lib/AgentScopeRuntimeWebUI/index.js +1 -0
  323. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.d.ts +9 -0
  324. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/FormItem.js +33 -0
  325. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.d.ts +7 -0
  326. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/OptionsEditor.js +188 -0
  327. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.d.ts +29 -0
  328. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/defaultConfig.js +35 -0
  329. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.d.ts +6 -0
  330. package/lib/AgentScopeRuntimeWebUI/starter/OptionsPanel/index.js +49 -0
  331. package/lib/AgentScopeRuntimeWebUI/starter/index.d.ts +1 -0
  332. package/lib/AgentScopeRuntimeWebUI/starter/index.js +70 -0
  333. package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.d.ts +14 -0
  334. package/lib/AgentScopeRuntimeWebUI/starter/sessionApi/index.js +143 -0
  335. package/package.json +3 -2
@@ -0,0 +1,248 @@
1
+ import React, { useMemo, useState } from "react";
2
+ import * as DefaultIcons from "./Icons";
3
+ import { ThumbsDownIcon, ThumbsUpIcon } from "./Icons";
4
+
5
+ /**
6
+ * Icons for CopilotChat component.
7
+ */
8
+ export interface CopilotChatIcons {
9
+ /**
10
+ * The icon to use for the open chat button.
11
+ * @default <OpenIcon />
12
+ */
13
+ openIcon?: React.ReactNode;
14
+
15
+ /**
16
+ * The icon to use for the close chat button.
17
+ * @default <CloseIcon />
18
+ */
19
+ closeIcon?: React.ReactNode;
20
+
21
+ /**
22
+ * The icon to use for the close chat button in the header.
23
+ * @default <HeaderCloseIcon />
24
+ */
25
+ headerCloseIcon?: React.ReactNode;
26
+
27
+ /**
28
+ * The icon to use for the send button.
29
+ * @default <SendIcon />
30
+ */
31
+ sendIcon?: React.ReactNode;
32
+
33
+ /**
34
+ * The icon to use for the activity indicator.
35
+ * @default <ActivityIcon />
36
+ */
37
+ activityIcon?: React.ReactNode;
38
+
39
+ /**
40
+ * The icon to use for the spinner.
41
+ * @default <SpinnerIcon />
42
+ */
43
+ spinnerIcon?: React.ReactNode;
44
+
45
+ /**
46
+ * The icon to use for the stop button.
47
+ * @default <StopIcon />
48
+ */
49
+ stopIcon?: React.ReactNode;
50
+
51
+ /**
52
+ * The icon to use for the regenerate button.
53
+ * @default <RegenerateIcon />
54
+ */
55
+ regenerateIcon?: React.ReactNode;
56
+
57
+ /**
58
+ * The icons to use for push to talk.
59
+ * @default <PushToTalkIcon />
60
+ */
61
+
62
+ pushToTalkIcon?: React.ReactNode;
63
+
64
+ /**
65
+ * The icons to use for copy assistant response
66
+ * @default <CopyIcon />
67
+ */
68
+
69
+ copyIcon?: React.ReactNode;
70
+
71
+ /**
72
+ * The icon to use for thumbs up/response approval.
73
+ * @default <ThumbsUpIcon />
74
+ */
75
+
76
+ thumbsUpIcon?: React.ReactNode;
77
+
78
+ /**
79
+ * The icon to use for thumbs down/response rejection.
80
+ * @default <ThumbsDownIcon />
81
+ */
82
+
83
+ thumbsDownIcon?: React.ReactNode;
84
+
85
+ /**
86
+ * The icon to use for the upload button.
87
+ * @default <UploadIcon />
88
+ */
89
+ uploadIcon?: React.ReactNode;
90
+ }
91
+
92
+ /**
93
+ * Labels for CopilotChat component.
94
+ */
95
+ export interface CopilotChatLabels {
96
+ /**
97
+ * The initial message(s) to display in the chat window.
98
+ */
99
+ initial?: string | string[];
100
+
101
+ /**
102
+ * The title to display in the header.
103
+ * @default "CopilotKit"
104
+ */
105
+ title?: string;
106
+
107
+ /**
108
+ * The placeholder to display in the input.
109
+ * @default "Type a message..."
110
+ */
111
+ placeholder?: string;
112
+
113
+ /**
114
+ * The message to display when an error occurs.
115
+ * @default "❌ An error occurred. Please try again."
116
+ */
117
+ error?: string;
118
+
119
+ /**
120
+ * The label to display on the stop button.
121
+ * @default "Stop generating"
122
+ */
123
+ stopGenerating?: string;
124
+
125
+ /**
126
+ * The label to display on the regenerate button.
127
+ * @default "Regenerate response"
128
+ */
129
+ regenerateResponse?: string;
130
+
131
+ /**
132
+ * The label for the copy button.
133
+ * @default "Copy to clipboard"
134
+ */
135
+ copyToClipboard?: string;
136
+
137
+ /**
138
+ * The label for the thumbs up button.
139
+ * @default "Thumbs up"
140
+ */
141
+ thumbsUp?: string;
142
+
143
+ /**
144
+ * The label for the thumbs down button.
145
+ * @default "Thumbs down"
146
+ */
147
+ thumbsDown?: string;
148
+
149
+ /**
150
+ * The text to display when content is copied.
151
+ * @default "Copied!"
152
+ */
153
+ copied?: string;
154
+ }
155
+
156
+ interface ChatContext {
157
+ labels: Required<CopilotChatLabels>;
158
+ icons: Required<CopilotChatIcons>;
159
+ open: boolean;
160
+ setOpen: (open: boolean) => void;
161
+ }
162
+
163
+ export const ChatContext = React.createContext<ChatContext | undefined>(undefined);
164
+
165
+ export function useChatContext(): ChatContext {
166
+ const context = React.useContext(ChatContext);
167
+ if (context === undefined) {
168
+ throw new Error(
169
+ "Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?",
170
+ );
171
+ }
172
+ return context;
173
+ }
174
+
175
+ interface ChatContextProps {
176
+ // temperature?: number;
177
+ // instructions?: string;
178
+ // maxFeedback?: number;
179
+ labels?: CopilotChatLabels;
180
+ icons?: CopilotChatIcons;
181
+ children?: React.ReactNode;
182
+ open: boolean;
183
+ setOpen: (open: boolean) => void;
184
+ }
185
+
186
+ export const ChatContextProvider = ({
187
+ // temperature,
188
+ // instructions,
189
+ // maxFeedback,
190
+ labels,
191
+ icons,
192
+ children,
193
+ open,
194
+ setOpen,
195
+ }: ChatContextProps) => {
196
+ const memoizedLabels = useMemo(
197
+ () => ({
198
+ ...{
199
+ initial: "",
200
+ title: "CopilotKit",
201
+ placeholder: "Type a message...",
202
+ error: "❌ An error occurred. Please try again.",
203
+ stopGenerating: "Stop generating",
204
+ regenerateResponse: "Regenerate response",
205
+ copyToClipboard: "Copy to clipboard",
206
+ thumbsUp: "Thumbs up",
207
+ thumbsDown: "Thumbs down",
208
+ copied: "Copied!",
209
+ },
210
+ ...labels,
211
+ }),
212
+ [labels],
213
+ );
214
+
215
+ const memoizedIcons = useMemo(
216
+ () => ({
217
+ ...{
218
+ openIcon: DefaultIcons.OpenIcon,
219
+ closeIcon: DefaultIcons.CloseIcon,
220
+ headerCloseIcon: DefaultIcons.HeaderCloseIcon,
221
+ sendIcon: DefaultIcons.SendIcon,
222
+ activityIcon: DefaultIcons.ActivityIcon,
223
+ spinnerIcon: DefaultIcons.SpinnerIcon,
224
+ stopIcon: DefaultIcons.StopIcon,
225
+ regenerateIcon: DefaultIcons.RegenerateIcon,
226
+ pushToTalkIcon: DefaultIcons.MicrophoneIcon,
227
+ copyIcon: DefaultIcons.CopyIcon,
228
+ thumbsUpIcon: DefaultIcons.ThumbsUpIcon,
229
+ thumbsDownIcon: DefaultIcons.ThumbsDownIcon,
230
+ uploadIcon: DefaultIcons.UploadIcon,
231
+ },
232
+ ...icons,
233
+ }),
234
+ [icons],
235
+ );
236
+
237
+ const context = useMemo(
238
+ () => ({
239
+ labels: memoizedLabels,
240
+ icons: memoizedIcons,
241
+ open,
242
+ setOpen,
243
+ }),
244
+ [memoizedLabels, memoizedIcons, open, setOpen],
245
+ );
246
+
247
+ return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;
248
+ };
@@ -0,0 +1,406 @@
1
+ import { FC, memo } from "react";
2
+ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
3
+ import { useCopyToClipboard } from "../../hooks/use-copy-to-clipboard";
4
+ import { CheckIcon, CopyIcon, DownloadIcon } from "./Icons";
5
+
6
+ interface CodeActionButtonProps {
7
+ onClick: () => void;
8
+ children: React.ReactNode;
9
+ }
10
+
11
+ interface Props {
12
+ language: string;
13
+ value: string;
14
+ }
15
+
16
+ interface languageMap {
17
+ [key: string]: string | undefined;
18
+ }
19
+
20
+ export const programmingLanguages: languageMap = {
21
+ javascript: ".js",
22
+ python: ".py",
23
+ java: ".java",
24
+ c: ".c",
25
+ cpp: ".cpp",
26
+ "c++": ".cpp",
27
+ "c#": ".cs",
28
+ ruby: ".rb",
29
+ php: ".php",
30
+ swift: ".swift",
31
+ "objective-c": ".m",
32
+ kotlin: ".kt",
33
+ typescript: ".ts",
34
+ go: ".go",
35
+ perl: ".pl",
36
+ rust: ".rs",
37
+ scala: ".scala",
38
+ haskell: ".hs",
39
+ lua: ".lua",
40
+ shell: ".sh",
41
+ sql: ".sql",
42
+ html: ".html",
43
+ css: ".css",
44
+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component
45
+ };
46
+
47
+ export const generateRandomString = (length: number, lowercase = false) => {
48
+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789"; // excluding similar looking characters like Z, 2, I, 1, O, 0
49
+ let result = "";
50
+ for (let i = 0; i < length; i++) {
51
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
52
+ }
53
+ return lowercase ? result.toLowerCase() : result;
54
+ };
55
+
56
+ const CodeBlock: FC<Props> = memo(({ language, value }) => {
57
+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
58
+
59
+ const downloadAsFile = () => {
60
+ if (typeof window === "undefined") {
61
+ return;
62
+ }
63
+ const fileExtension = programmingLanguages[language] || ".file";
64
+ const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
65
+ const fileName = window.prompt("Enter file name" || "", suggestedFileName);
66
+
67
+ if (!fileName) {
68
+ // User pressed cancel on prompt.
69
+ return;
70
+ }
71
+
72
+ const blob = new Blob([value], { type: "text/plain" });
73
+ const url = URL.createObjectURL(blob);
74
+ const link = document.createElement("a");
75
+ link.download = fileName;
76
+ link.href = url;
77
+ link.style.display = "none";
78
+ document.body.appendChild(link);
79
+ link.click();
80
+ document.body.removeChild(link);
81
+ URL.revokeObjectURL(url);
82
+ };
83
+
84
+ const onCopy = () => {
85
+ if (isCopied) return;
86
+ copyToClipboard(value);
87
+ };
88
+
89
+ return (
90
+ <div className="copilotKitCodeBlock">
91
+ <div className="copilotKitCodeBlockToolbar">
92
+ <span className="copilotKitCodeBlockToolbarLanguage">{language}</span>
93
+ <div className="copilotKitCodeBlockToolbarButtons">
94
+ <button className="copilotKitCodeBlockToolbarButton" onClick={downloadAsFile}>
95
+ {DownloadIcon}
96
+ </button>
97
+ <button className="copilotKitCodeBlockToolbarButton" onClick={onCopy}>
98
+ {isCopied ? CheckIcon : CopyIcon}
99
+ </button>
100
+ </div>
101
+ </div>
102
+ <SyntaxHighlighter
103
+ language={language}
104
+ style={highlightStyle}
105
+ PreTag="div"
106
+ customStyle={{
107
+ margin: 0,
108
+ borderBottomLeftRadius: "0.375rem",
109
+ borderBottomRightRadius: "0.375rem",
110
+ }}
111
+ >
112
+ {value}
113
+ </SyntaxHighlighter>
114
+ </div>
115
+ );
116
+ });
117
+ CodeBlock.displayName = "CodeBlock";
118
+
119
+ export { CodeBlock };
120
+
121
+ // import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism";
122
+ // As a workaround, we inline the vscDarkPlus from react-syntax-highlighter.
123
+ // Importing it as recommended in the documentation leads to build errors in the non app router
124
+ // (Next.js classic) setup.
125
+ const highlightStyle: any = {
126
+ 'pre[class*="language-"]': {
127
+ color: "#d4d4d4",
128
+ fontSize: "13px",
129
+ textShadow: "none",
130
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
131
+ direction: "ltr",
132
+ textAlign: "left",
133
+ whiteSpace: "pre",
134
+ wordSpacing: "normal",
135
+ wordBreak: "normal",
136
+ lineHeight: "1.5",
137
+ MozTabSize: "4",
138
+ OTabSize: "4",
139
+ tabSize: "4",
140
+ WebkitHyphens: "none",
141
+ MozHyphens: "none",
142
+ msHyphens: "none",
143
+ hyphens: "none",
144
+ padding: "1em",
145
+ margin: ".5em 0",
146
+ overflow: "auto",
147
+ background: "#1e1e1e",
148
+ },
149
+ 'code[class*="language-"]': {
150
+ color: "#d4d4d4",
151
+ fontSize: "13px",
152
+ textShadow: "none",
153
+ fontFamily: 'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace',
154
+ direction: "ltr",
155
+ textAlign: "left",
156
+ whiteSpace: "pre",
157
+ wordSpacing: "normal",
158
+ wordBreak: "normal",
159
+ lineHeight: "1.5",
160
+ MozTabSize: "4",
161
+ OTabSize: "4",
162
+ tabSize: "4",
163
+ WebkitHyphens: "none",
164
+ MozHyphens: "none",
165
+ msHyphens: "none",
166
+ hyphens: "none",
167
+ },
168
+ 'pre[class*="language-"]::selection': {
169
+ textShadow: "none",
170
+ background: "#264F78",
171
+ },
172
+ 'code[class*="language-"]::selection': {
173
+ textShadow: "none",
174
+ background: "#264F78",
175
+ },
176
+ 'pre[class*="language-"] *::selection': {
177
+ textShadow: "none",
178
+ background: "#264F78",
179
+ },
180
+ 'code[class*="language-"] *::selection': {
181
+ textShadow: "none",
182
+ background: "#264F78",
183
+ },
184
+ ':not(pre) > code[class*="language-"]': {
185
+ padding: ".1em .3em",
186
+ borderRadius: ".3em",
187
+ color: "#db4c69",
188
+ background: "#1e1e1e",
189
+ },
190
+ ".namespace": {
191
+ Opacity: ".7",
192
+ },
193
+ "doctype.doctype-tag": {
194
+ color: "#569CD6",
195
+ },
196
+ "doctype.name": {
197
+ color: "#9cdcfe",
198
+ },
199
+ comment: {
200
+ color: "#6a9955",
201
+ },
202
+ prolog: {
203
+ color: "#6a9955",
204
+ },
205
+ punctuation: {
206
+ color: "#d4d4d4",
207
+ },
208
+ ".language-html .language-css .token.punctuation": {
209
+ color: "#d4d4d4",
210
+ },
211
+ ".language-html .language-javascript .token.punctuation": {
212
+ color: "#d4d4d4",
213
+ },
214
+ property: {
215
+ color: "#9cdcfe",
216
+ },
217
+ tag: {
218
+ color: "#569cd6",
219
+ },
220
+ boolean: {
221
+ color: "#569cd6",
222
+ },
223
+ number: {
224
+ color: "#b5cea8",
225
+ },
226
+ constant: {
227
+ color: "#9cdcfe",
228
+ },
229
+ symbol: {
230
+ color: "#b5cea8",
231
+ },
232
+ inserted: {
233
+ color: "#b5cea8",
234
+ },
235
+ unit: {
236
+ color: "#b5cea8",
237
+ },
238
+ selector: {
239
+ color: "#d7ba7d",
240
+ },
241
+ "attr-name": {
242
+ color: "#9cdcfe",
243
+ },
244
+ string: {
245
+ color: "#ce9178",
246
+ },
247
+ char: {
248
+ color: "#ce9178",
249
+ },
250
+ builtin: {
251
+ color: "#ce9178",
252
+ },
253
+ deleted: {
254
+ color: "#ce9178",
255
+ },
256
+ ".language-css .token.string.url": {
257
+ textDecoration: "underline",
258
+ },
259
+ operator: {
260
+ color: "#d4d4d4",
261
+ },
262
+ entity: {
263
+ color: "#569cd6",
264
+ },
265
+ "operator.arrow": {
266
+ color: "#569CD6",
267
+ },
268
+ atrule: {
269
+ color: "#ce9178",
270
+ },
271
+ "atrule.rule": {
272
+ color: "#c586c0",
273
+ },
274
+ "atrule.url": {
275
+ color: "#9cdcfe",
276
+ },
277
+ "atrule.url.function": {
278
+ color: "#dcdcaa",
279
+ },
280
+ "atrule.url.punctuation": {
281
+ color: "#d4d4d4",
282
+ },
283
+ keyword: {
284
+ color: "#569CD6",
285
+ },
286
+ "keyword.module": {
287
+ color: "#c586c0",
288
+ },
289
+ "keyword.control-flow": {
290
+ color: "#c586c0",
291
+ },
292
+ function: {
293
+ color: "#dcdcaa",
294
+ },
295
+ "function.maybe-class-name": {
296
+ color: "#dcdcaa",
297
+ },
298
+ regex: {
299
+ color: "#d16969",
300
+ },
301
+ important: {
302
+ color: "#569cd6",
303
+ },
304
+ italic: {
305
+ fontStyle: "italic",
306
+ },
307
+ "class-name": {
308
+ color: "#4ec9b0",
309
+ },
310
+ "maybe-class-name": {
311
+ color: "#4ec9b0",
312
+ },
313
+ console: {
314
+ color: "#9cdcfe",
315
+ },
316
+ parameter: {
317
+ color: "#9cdcfe",
318
+ },
319
+ interpolation: {
320
+ color: "#9cdcfe",
321
+ },
322
+ "punctuation.interpolation-punctuation": {
323
+ color: "#569cd6",
324
+ },
325
+ variable: {
326
+ color: "#9cdcfe",
327
+ },
328
+ "imports.maybe-class-name": {
329
+ color: "#9cdcfe",
330
+ },
331
+ "exports.maybe-class-name": {
332
+ color: "#9cdcfe",
333
+ },
334
+ escape: {
335
+ color: "#d7ba7d",
336
+ },
337
+ "tag.punctuation": {
338
+ color: "#808080",
339
+ },
340
+ cdata: {
341
+ color: "#808080",
342
+ },
343
+ "attr-value": {
344
+ color: "#ce9178",
345
+ },
346
+ "attr-value.punctuation": {
347
+ color: "#ce9178",
348
+ },
349
+ "attr-value.punctuation.attr-equals": {
350
+ color: "#d4d4d4",
351
+ },
352
+ namespace: {
353
+ color: "#4ec9b0",
354
+ },
355
+ 'pre[class*="language-javascript"]': {
356
+ color: "#9cdcfe",
357
+ },
358
+ 'code[class*="language-javascript"]': {
359
+ color: "#9cdcfe",
360
+ },
361
+ 'pre[class*="language-jsx"]': {
362
+ color: "#9cdcfe",
363
+ },
364
+ 'code[class*="language-jsx"]': {
365
+ color: "#9cdcfe",
366
+ },
367
+ 'pre[class*="language-typescript"]': {
368
+ color: "#9cdcfe",
369
+ },
370
+ 'code[class*="language-typescript"]': {
371
+ color: "#9cdcfe",
372
+ },
373
+ 'pre[class*="language-tsx"]': {
374
+ color: "#9cdcfe",
375
+ },
376
+ 'code[class*="language-tsx"]': {
377
+ color: "#9cdcfe",
378
+ },
379
+ 'pre[class*="language-css"]': {
380
+ color: "#ce9178",
381
+ },
382
+ 'code[class*="language-css"]': {
383
+ color: "#ce9178",
384
+ },
385
+ 'pre[class*="language-html"]': {
386
+ color: "#d4d4d4",
387
+ },
388
+ 'code[class*="language-html"]': {
389
+ color: "#d4d4d4",
390
+ },
391
+ ".language-regex .token.anchor": {
392
+ color: "#dcdcaa",
393
+ },
394
+ ".language-html .token.punctuation": {
395
+ color: "#808080",
396
+ },
397
+ 'pre[class*="language-"] > code[class*="language-"]': {
398
+ position: "relative",
399
+ zIndex: "1",
400
+ },
401
+ ".line-highlight.line-highlight": {
402
+ background: "#f7ebc6",
403
+ boxShadow: "inset 5px 0 0 #f7d87c",
404
+ zIndex: "0",
405
+ },
406
+ };
@@ -0,0 +1,22 @@
1
+ import { HeaderProps } from "./props";
2
+ import { useChatContext } from "./ChatContext";
3
+ import React from "react";
4
+
5
+ export const Header = ({}: HeaderProps) => {
6
+ const { setOpen, icons, labels } = useChatContext();
7
+
8
+ return (
9
+ <div className="copilotKitHeader">
10
+ <div>{labels.title}</div>
11
+ <div className="copilotKitHeaderControls">
12
+ <button
13
+ onClick={() => setOpen(false)}
14
+ aria-label="Close"
15
+ className="copilotKitHeaderCloseButton"
16
+ >
17
+ {icons.headerCloseIcon}
18
+ </button>
19
+ </div>
20
+ </div>
21
+ );
22
+ };