@blocklet/pages-kit 0.2.299 → 0.2.301

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 (253) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/api/{assistant.js → agent.js} +5 -7
  2. package/lib/cjs/builtin/async/ai-runtime/api/session.js +20 -18
  3. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -2
  4. package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +2 -2
  5. package/lib/cjs/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +5 -2
  6. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormHeader.js → Header/SimpleHeader.js} +9 -16
  7. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +6 -8
  8. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +2 -2
  9. package/lib/cjs/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +2 -2
  10. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +40 -57
  11. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  12. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  13. package/lib/cjs/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  14. package/lib/cjs/builtin/async/ai-runtime/constants.js +4 -1
  15. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +4 -4
  16. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +32 -0
  17. package/lib/cjs/builtin/async/ai-runtime/index.js +16 -63
  18. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +72 -0
  19. package/lib/cjs/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +11 -7
  20. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  21. package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +7 -4
  22. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  23. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +6 -6
  24. package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  25. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +102 -0
  26. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  27. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  28. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  29. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.js +25 -12
  30. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +12 -12
  31. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  32. package/lib/cjs/builtin/async/ai-runtime/state/session.js +91 -92
  33. package/lib/esm/builtin/async/ai-runtime/api/{assistant.js → agent.js} +3 -5
  34. package/lib/esm/builtin/async/ai-runtime/api/session.js +19 -17
  35. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +1 -1
  36. package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +1 -1
  37. package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +2 -1
  38. package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +23 -0
  39. package/lib/esm/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +5 -4
  40. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +1 -1
  41. package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +1 -1
  42. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +19 -57
  43. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  44. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  45. package/lib/esm/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  46. package/lib/esm/builtin/async/ai-runtime/constants.js +3 -0
  47. package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +3 -3
  48. package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +26 -0
  49. package/lib/esm/builtin/async/ai-runtime/index.js +13 -58
  50. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +66 -0
  51. package/lib/esm/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +9 -5
  52. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  53. package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +2 -2
  54. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  55. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +5 -5
  56. package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  57. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +73 -0
  58. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  59. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  60. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  61. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +63 -0
  62. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +9 -9
  63. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  64. package/lib/esm/builtin/async/ai-runtime/state/session.js +91 -88
  65. package/lib/types/builtin/async/ai-runtime/api/{assistant.d.ts → agent.d.ts} +4 -4
  66. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +7 -13
  67. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +1 -1
  68. package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts +1 -1
  69. package/lib/types/builtin/async/ai-runtime/components/{GlobalLoading.d.ts → GlobalLoading/index.d.ts} +1 -0
  70. package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +5 -0
  71. package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +2 -0
  72. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +2 -1
  73. package/lib/types/builtin/async/ai-runtime/components/{RuntimeProvider.d.ts → RuntimeCommonProvider.d.ts} +1 -1
  74. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +8 -59
  75. package/lib/types/builtin/async/ai-runtime/constants.d.ts +3 -0
  76. package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.d.ts +1 -1
  77. package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +14 -0
  78. package/lib/types/builtin/async/ai-runtime/index.d.ts +13 -24
  79. package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +5 -0
  80. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +4 -0
  81. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -0
  82. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +6 -0
  83. package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +17 -0
  84. package/lib/types/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.d.ts +2 -2
  85. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +10 -18
  86. package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +2 -2
  87. package/package.json +7 -7
  88. package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -49
  89. package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +0 -22
  90. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  91. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  92. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  93. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  94. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  95. package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +0 -104
  96. package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +0 -12
  97. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -89
  98. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -66
  99. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -61
  100. package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +0 -44
  101. package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +0 -88
  102. package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +0 -34
  103. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -35
  104. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -177
  105. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +0 -48
  106. package/lib/cjs/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -121
  107. package/lib/cjs/builtin/async/ai-runtime/components/runtime/constants.js +0 -6
  108. package/lib/cjs/builtin/async/ai-runtime/components/runtime/state/session.js +0 -213
  109. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -133
  110. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -60
  111. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -59
  112. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -28
  113. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -138
  114. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -31
  115. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +0 -54
  116. package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +0 -74
  117. package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  118. package/lib/cjs/builtin/async/ai-runtime/hooks/auth.js +0 -31
  119. package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +0 -69
  120. package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +0 -38
  121. package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +0 -37
  122. package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +0 -32
  123. package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +0 -59
  124. package/lib/cjs/builtin/async/ai-runtime/state/index.js +0 -423
  125. package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +0 -52
  126. package/lib/cjs/builtin/async/ai-runtime/utils.js +0 -49
  127. package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -46
  128. package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +0 -19
  129. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  130. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  131. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  132. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  133. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  134. package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +0 -98
  135. package/lib/esm/builtin/async/ai-runtime/components/common/index.js +0 -3
  136. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -60
  137. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -59
  138. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -54
  139. package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +0 -38
  140. package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +0 -82
  141. package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +0 -8
  142. package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -29
  143. package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -146
  144. package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +0 -42
  145. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -92
  146. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/SimplePage/index.js +0 -50
  147. package/lib/esm/builtin/async/ai-runtime/components/runtime/constants.js +0 -3
  148. package/lib/esm/builtin/async/ai-runtime/components/runtime/state/session.js +0 -209
  149. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -102
  150. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -34
  151. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -53
  152. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -22
  153. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -132
  154. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +0 -30
  155. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -25
  156. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +0 -48
  157. package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +0 -68
  158. package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  159. package/lib/esm/builtin/async/ai-runtime/hooks/auth.js +0 -27
  160. package/lib/esm/builtin/async/ai-runtime/hooks/header.js +0 -62
  161. package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +0 -32
  162. package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +0 -33
  163. package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +0 -29
  164. package/lib/esm/builtin/async/ai-runtime/state/assistant.js +0 -54
  165. package/lib/esm/builtin/async/ai-runtime/state/index.js +0 -423
  166. package/lib/esm/builtin/async/ai-runtime/state/subscription.js +0 -47
  167. package/lib/esm/builtin/async/ai-runtime/utils.js +0 -42
  168. package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +0 -5
  169. package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +0 -4
  170. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
  171. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
  172. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
  173. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
  174. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
  175. package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +0 -13
  176. package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +0 -3
  177. package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +0 -13
  178. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +0 -28
  179. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +0 -11
  180. package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +0 -14
  181. package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +0 -9
  182. package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +0 -4
  183. package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +0 -5
  184. package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +0 -15
  185. package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +0 -7
  186. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.d.ts +0 -5
  187. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGalleryItem/index.d.ts +0 -1
  188. package/lib/types/builtin/async/ai-runtime/components/runtime/components/SimpleChat/index.d.ts +0 -3
  189. package/lib/types/builtin/async/ai-runtime/components/runtime/constants.d.ts +0 -3
  190. package/lib/types/builtin/async/ai-runtime/components/runtime/state/assistant.d.ts +0 -17
  191. package/lib/types/builtin/async/ai-runtime/components/runtime/state/session.d.ts +0 -29
  192. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +0 -10
  193. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +0 -5
  194. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +0 -6
  195. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +0 -5
  196. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +0 -5
  197. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +0 -5
  198. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +0 -5
  199. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +0 -5
  200. package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +0 -4
  201. package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +0 -8
  202. package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
  203. package/lib/types/builtin/async/ai-runtime/hooks/auth.d.ts +0 -4
  204. package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +0 -5
  205. package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +0 -25
  206. package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +0 -7
  207. package/lib/types/builtin/async/ai-runtime/hooks/useAsync.d.ts +0 -1
  208. package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +0 -15
  209. package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
  210. package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +0 -15
  211. package/lib/types/builtin/async/ai-runtime/utils.d.ts +0 -20
  212. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  213. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  214. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  215. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  216. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  217. /package/lib/cjs/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  218. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  219. /package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  220. /package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  221. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  222. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  223. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  224. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  225. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  226. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  227. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  228. /package/lib/esm/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  229. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  230. /package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  231. /package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  232. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  233. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  234. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.d.ts +0 -0
  235. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.d.ts +0 -0
  236. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.d.ts +0 -0
  237. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.d.ts +0 -0
  238. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.d.ts +0 -0
  239. /package/lib/types/builtin/async/ai-runtime/{state/loading.d.ts → components/GlobalLoading/state.d.ts} +0 -0
  240. /package/lib/types/builtin/async/ai-runtime/components/{common/UserInfo.d.ts → UserInfo.d.ts} +0 -0
  241. /package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.d.ts +0 -0
  242. /package/lib/types/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.d.ts +0 -0
  243. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.d.ts +0 -0
  244. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.d.ts +0 -0
  245. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.d.ts +0 -0
  246. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.d.ts +0 -0
  247. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.d.ts +0 -0
  248. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.d.ts +0 -0
  249. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.d.ts +0 -0
  250. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.d.ts +0 -0
  251. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.d.ts +0 -0
  252. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.d.ts +0 -0
  253. /package/lib/types/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.d.ts +0 -0
@@ -9,19 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAssistant = void 0;
12
+ exports.getAgent = void 0;
13
13
  const ufo_1 = require("ufo");
14
14
  const utils_1 = require("../../../utils");
15
15
  const constants_1 = require("../constants");
16
- const utils_2 = require("../utils");
17
16
  const request_1 = require("./request");
18
- function getAssistant(_a) {
19
- return __awaiter(this, arguments, void 0, function* ({ assistantId: id, working, }) {
20
- const { projectId, projectRef, assistantId } = (0, utils_2.parseIdentity)(id, { rejectWhenError: true });
17
+ function getAgent(_a) {
18
+ return __awaiter(this, arguments, void 0, function* ({ aid, working }) {
21
19
  return (0, request_1.request)({
22
- url: (0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/projects', projectId, 'refs', projectRef, 'assistants', assistantId),
20
+ url: (0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/agents', aid),
23
21
  query: { working },
24
22
  });
25
23
  });
26
24
  }
27
- exports.getAssistant = getAssistant;
25
+ exports.getAgent = getAgent;
@@ -22,21 +22,17 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
22
22
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.runAssistant = exports.deleteSession = exports.updateSession = exports.createSession = exports.getSession = exports.getSessions = void 0;
25
+ exports.runAgent = exports.deleteSession = exports.updateSession = exports.createSession = exports.getSession = exports.getSessions = void 0;
26
26
  const ufo_1 = require("ufo");
27
27
  const stream_1 = require("../../../stream");
28
28
  const utils_1 = require("../../../utils");
29
29
  const constants_1 = require("../constants");
30
- const utils_2 = require("../utils");
31
30
  const request_1 = require("./request");
32
31
  function getSessions(_a) {
33
- return __awaiter(this, arguments, void 0, function* ({ projectId, projectRef, assistantId, }) {
32
+ return __awaiter(this, arguments, void 0, function* ({ aid }) {
34
33
  return (0, request_1.request)({
35
- url: (0, ufo_1.withQuery)((0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/sessions'), {
36
- projectId,
37
- projectRef,
38
- assistantId,
39
- }),
34
+ url: (0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/sessions'),
35
+ query: { aid },
40
36
  });
41
37
  });
42
38
  }
@@ -50,23 +46,24 @@ function getSession(_a) {
50
46
  }
51
47
  exports.getSession = getSession;
52
48
  function createSession(_a) {
53
- return __awaiter(this, arguments, void 0, function* ({ assistantId, name, parameters, entry, }) {
49
+ return __awaiter(this, arguments, void 0, function* ({ aid, name, }) {
54
50
  return (0, request_1.request)({
55
51
  method: 'POST',
56
52
  url: (0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/sessions'),
57
- body: Object.assign(Object.assign({}, (0, utils_2.parseIdentity)(assistantId)), { name,
58
- parameters,
59
- entry }),
53
+ body: {
54
+ aid,
55
+ name,
56
+ },
60
57
  });
61
58
  });
62
59
  }
63
60
  exports.createSession = createSession;
64
61
  function updateSession(_a) {
65
- return __awaiter(this, arguments, void 0, function* ({ sessionId, name, parameters, }) {
62
+ return __awaiter(this, arguments, void 0, function* ({ sessionId, name, }) {
66
63
  return (0, request_1.request)({
67
64
  method: 'PATCH',
68
65
  url: (0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/sessions', sessionId),
69
- body: { name, parameters },
66
+ body: { name },
70
67
  });
71
68
  });
72
69
  }
@@ -80,8 +77,8 @@ function deleteSession(_a) {
80
77
  });
81
78
  }
82
79
  exports.deleteSession = deleteSession;
83
- function runAssistant(_a) {
84
- return __asyncGenerator(this, arguments, function* runAssistant_1({ sessionId, identity, working, parameters, }) {
80
+ function runAgent(_a) {
81
+ return __asyncGenerator(this, arguments, function* runAgent_1({ aid, sessionId, working, parameters, }) {
85
82
  var _b;
86
83
  const res = yield __await((0, request_1.fetch)((0, ufo_1.joinURL)((0, utils_1.getComponentMountPoint)(constants_1.AI_STUDIO_DID), '/api/ai/call'), {
87
84
  method: 'POST',
@@ -89,7 +86,12 @@ function runAssistant(_a) {
89
86
  'Content-Type': 'application/json',
90
87
  Accept: 'text/event-stream',
91
88
  },
92
- body: JSON.stringify(Object.assign(Object.assign({ sessionId, parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }) }, identity), { ref: identity.projectRef, working })),
89
+ body: JSON.stringify({
90
+ sessionId,
91
+ parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
92
+ aid,
93
+ working,
94
+ }),
93
95
  }));
94
96
  if (!(res.status >= 200 && res.status < 300)) {
95
97
  let json;
@@ -118,4 +120,4 @@ function runAssistant(_a) {
118
120
  }
119
121
  });
120
122
  }
121
- exports.runAssistant = runAssistant;
123
+ exports.runAgent = runAgent;
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ActionButton = void 0;
27
26
  const jsx_runtime_1 = require("react/jsx-runtime");
28
27
  const react_1 = require("@iconify/react");
29
28
  const material_1 = require("@mui/material");
@@ -60,4 +59,4 @@ function ActionButton(_a) {
60
59
  }
61
60
  }), children: buttonText })) }) }));
62
61
  }
63
- exports.ActionButton = ActionButton;
62
+ exports.default = ActionButton;
@@ -20,7 +20,7 @@ const NumberField_1 = __importDefault(require("./NumberField"));
20
20
  const RadioField_1 = __importDefault(require("./RadioField"));
21
21
  const SelectField_1 = __importDefault(require("./SelectField"));
22
22
  const StringField_1 = __importDefault(require("./StringField"));
23
- function ParameterField(_a) {
23
+ function AgentInputField(_a) {
24
24
  var _b;
25
25
  var { parameter } = _a, props = __rest(_a, ["parameter"]);
26
26
  if (parameter.type === 'source')
@@ -38,4 +38,4 @@ function ParameterField(_a) {
38
38
  }[parameter.type || 'string'] || StringField_1.default;
39
39
  return ((0, jsx_runtime_1.jsx)(Field, Object.assign({ label: parameter === null || parameter === void 0 ? void 0 : parameter.label, helperText: parameter === null || parameter === void 0 ? void 0 : parameter.helper, placeholder: parameter === null || parameter === void 0 ? void 0 : parameter.placeholder }, { parameter }, { size: "small" }, props)));
40
40
  }
41
- exports.default = ParameterField;
41
+ exports.default = AgentInputField;
@@ -11,12 +11,15 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.globalLoadingState = void 0;
14
15
  const jsx_runtime_1 = require("react/jsx-runtime");
15
16
  const material_1 = require("@mui/material");
16
- const loading_1 = require("../state/loading");
17
+ const state_1 = require("./state");
18
+ var state_2 = require("./state");
19
+ Object.defineProperty(exports, "globalLoadingState", { enumerable: true, get: function () { return state_2.globalLoadingState; } });
17
20
  function GlobalLoading(_a) {
18
21
  var props = __rest(_a, []);
19
- const state = (0, loading_1.globalLoadingState)();
22
+ const state = (0, state_1.globalLoadingState)();
20
23
  if (!state.loading)
21
24
  return null;
22
25
  return (0, jsx_runtime_1.jsx)(material_1.LinearProgress, Object.assign({}, props));
@@ -35,22 +35,15 @@ var __rest = (this && this.__rest) || function (s, e) {
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const css_1 = require("@emotion/css");
38
39
  const material_1 = require("@mui/material");
39
40
  const react_wrap_balancer_1 = __importStar(require("react-wrap-balancer"));
40
- const ux_1 = require("../../../../arcblock/ux");
41
- function RuntimeFormHeader(_a) {
42
- var _b, _c, _d;
43
- var { agent } = _a, props = __rest(_a, ["agent"]);
44
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: {
45
- md: 'row',
46
- xs: 'column',
47
- }, justifyContent: "space-between", alignItems: "center", gap: 2 }, props, { children: [(0, jsx_runtime_1.jsx)(material_1.Stack, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.Avatar, size: 120, src: (_b = agent.release) === null || _b === void 0 ? void 0 : _b.logo, did: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appId, borderRadius: 1 }) }), (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.Provider, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 1, sx: {
48
- flex: 1,
49
- lineHeight: '28px',
50
- textAlign: {
51
- md: 'left',
52
- xs: 'center',
53
- },
54
- }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h5", sx: { fontSize: 18, fontWeight: 600 }, children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: ((_c = agent.release) === null || _c === void 0 ? void 0 : _c.title) || agent.name }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: 16, color: 'rgba(75, 85, 99, 1)' }, children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: ((_d = agent.release) === null || _d === void 0 ? void 0 : _d.description) || agent.description }) })] }) })] })));
41
+ const runtime_1 = require("../../state/runtime");
42
+ function SimpleHeader(_a) {
43
+ var { TitleProps, DescriptionProps } = _a, props = __rest(_a, ["TitleProps", "DescriptionProps"]);
44
+ const { agent, appearancePage } = (0, runtime_1.useRuntimeState)();
45
+ const title = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.name) || agent.name;
46
+ const description = (appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.description) || agent.description;
47
+ return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ gap: 2, mt: 8, mb: 4 }, props, { className: (0, css_1.cx)('aigne-header aigne-simple-header', props.className), children: (0, jsx_runtime_1.jsxs)(react_wrap_balancer_1.Provider, { children: [title && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ width: "100%", component: "h5", fontSize: 30, fontWeight: 700, textAlign: "center" }, TitleProps, { children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: title }) }))), description && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ width: "100%", textAlign: "center" }, DescriptionProps, { children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: description }) })))] }) })));
55
48
  }
56
- exports.default = RuntimeFormHeader;
49
+ exports.default = SimpleHeader;
@@ -10,14 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
13
  Object.defineProperty(exports, "__esModule", { value: true });
17
14
  const jsx_runtime_1 = require("react/jsx-runtime");
18
- const LoadingButton_1 = __importDefault(require("../LoadingButton"));
19
- function RuntimeFormSubmit(_a) {
20
- var { page } = _a, props = __rest(_a, ["page"]);
21
- return (0, jsx_runtime_1.jsx)(LoadingButton_1.default, Object.assign({}, props));
15
+ const css_1 = require("@emotion/css");
16
+ const material_1 = require("@mui/material");
17
+ function SimpleLayout(_a) {
18
+ var props = __rest(_a, []);
19
+ return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ flexGrow: 1, maxWidth: "md", width: "100%", mx: "auto", px: { xs: 2, sm: 3 } }, props, { className: (0, css_1.cx)('aigne-layout aigne-layout-simple', props.className) })));
22
20
  }
23
- exports.default = RuntimeFormSubmit;
21
+ exports.default = SimpleLayout;
@@ -44,7 +44,7 @@ const react_2 = __importDefault(require("react"));
44
44
  const locale_1 = require("../../../locale");
45
45
  const react_markdown_1 = __importDefault(require("../../react-markdown"));
46
46
  const react_syntax_highlighter_1 = __importDefault(require("../../react-syntax-highlighter"));
47
- const ActionButton_1 = require("./ActionButton");
47
+ const ActionButton_1 = __importDefault(require("./ActionButton"));
48
48
  const ReactSyntaxHighlighter = react_2.default.lazy(() => (0, react_syntax_highlighter_1.default)().then((m) => ({ default: m.Prism })));
49
49
  const Markdown = react_2.default.lazy(() => Promise.all([
50
50
  (0, react_markdown_1.default)(),
@@ -150,7 +150,7 @@ function MarkdownPre({ children }) {
150
150
  borderRadius: 1,
151
151
  bgcolor: 'rgb(245, 242, 240)',
152
152
  '> pre': { mt: '0 !important' },
153
- }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", p: 0.5, pl: 1.5, borderBottom: 1, borderColor: "grey.200", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: language }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { autoReset: true, tip: t('copyToClipboard'), tipSucceed: t('copied'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy" }), titleSucceed: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy-check" }), sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 }, onClick: () => {
153
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", p: 0.5, pl: 1.5, borderBottom: 1, borderColor: "grey.200", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { children: language }), (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1 }), (0, jsx_runtime_1.jsx)(ActionButton_1.default, { autoReset: true, tip: t('copyToClipboard'), tipSucceed: t('copied'), title: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy" }), titleSucceed: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:copy-check" }), sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 }, onClick: () => {
154
154
  window.navigator.clipboard.writeText(childrenProps.children);
155
155
  } })] }), children] }));
156
156
  }
@@ -13,10 +13,10 @@ const locale_1 = require("../../../locale");
13
13
  const locales_1 = require("../locales");
14
14
  const GlobalLoading_1 = __importDefault(require("./GlobalLoading"));
15
15
  const ThemeProvider_1 = __importDefault(require("./ThemeProvider"));
16
- function RuntimeProvider({ children }) {
16
+ function RuntimeCommonProvider({ children }) {
17
17
  return ((0, jsx_runtime_1.jsx)(RuntimeLocaleProvider, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { children: (0, jsx_runtime_1.jsxs)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorRender, children: [(0, jsx_runtime_1.jsx)(GlobalLoading_1.default, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), (0, jsx_runtime_1.jsx)(react_1.default.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 24 }) }), children: children })] }) }) }));
18
18
  }
19
- exports.default = RuntimeProvider;
19
+ exports.default = RuntimeCommonProvider;
20
20
  function ErrorRender({ error }) {
21
21
  return ((0, jsx_runtime_1.jsx)(ux_1.Result, { status: error.status || 'error', description: error.message, sx: { bgcolor: 'transparent', mt: '20%' } }));
22
22
  }
@@ -1,12 +1,26 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
10
24
  };
11
25
  var __rest = (this && this.__rest) || function (s, e) {
12
26
  var t = {};
@@ -23,68 +37,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
38
  };
25
39
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.useScrollToBottomModule = void 0;
27
40
  const jsx_runtime_1 = require("react/jsx-runtime");
28
41
  const material_1 = require("@mui/material");
29
42
  const react_1 = require("react");
30
- const react_scroll_to_bottom_1 = __importDefault(require("../../react-scroll-to-bottom"));
31
- const scrollToBottomModuleLoader = {};
32
- function loadScrollToBottomModule() {
33
- var _a;
34
- (_a = scrollToBottomModuleLoader.promise) !== null && _a !== void 0 ? _a : (scrollToBottomModuleLoader.promise = (0, react_scroll_to_bottom_1.default)()
35
- .then((mod) => {
36
- scrollToBottomModuleLoader.mod = mod;
37
- return mod;
38
- })
39
- .catch((error) => {
40
- scrollToBottomModuleLoader.error = error;
41
- throw error;
42
- }));
43
- return scrollToBottomModuleLoader;
44
- }
45
- function useScrollToBottomModule() {
46
- const loader = loadScrollToBottomModule();
47
- const [mod, setMod] = (0, react_1.useState)(loader.mod);
48
- const [error, setError] = (0, react_1.useState)(loader.error);
49
- (0, react_1.useEffect)(() => {
50
- (() => __awaiter(this, void 0, void 0, function* () {
51
- try {
52
- yield loader.promise;
53
- if (loader.mod)
54
- setMod(loader.mod);
55
- else if (loader.error)
56
- setError(loader.error);
57
- }
58
- catch (error) {
59
- setError(error);
60
- }
61
- }))();
62
- }, []);
63
- if (mod)
64
- return mod;
65
- if (error)
66
- throw error;
67
- throw loader.promise;
68
- }
69
- exports.useScrollToBottomModule = useScrollToBottomModule;
43
+ const scrollToBottom = __importStar(require("react-scroll-to-bottom"));
44
+ // @ts-ignore
45
+ const useInternalContext_1 = __importDefault(require("react-scroll-to-bottom/lib/esm/hooks/internal/useInternalContext"));
46
+ // @ts-ignore
47
+ const Composer = scrollToBottom.Composer;
70
48
  function ScrollView(_a) {
71
- var { children, initialScrollBehavior } = _a, props = __rest(_a, ["children", "initialScrollBehavior"]);
72
- const { Composer } = useScrollToBottomModule();
73
- return ((0, jsx_runtime_1.jsx)(Composer, { initialScrollBehavior: initialScrollBehavior, children: (0, jsx_runtime_1.jsx)(ScrollViewWithinWindow, Object.assign({}, props, { children: children })) }));
49
+ var { disabled, children, scroll, component, initialScrollBehavior } = _a, props = __rest(_a, ["disabled", "children", "scroll", "component", "initialScrollBehavior"]);
50
+ if (disabled) {
51
+ if (component) {
52
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: component }, props, { children: children })));
53
+ }
54
+ return children;
55
+ }
56
+ return ((0, jsx_runtime_1.jsx)(Composer, { initialScrollBehavior: initialScrollBehavior, children: (0, jsx_runtime_1.jsx)(ScrollViewWithinWindow, Object.assign({ scroll: scroll, component: component }, props, { children: children })) }));
74
57
  }
75
58
  exports.default = ScrollView;
76
59
  function ScrollViewWithinWindow(_a) {
77
- var { children, scroller, component } = _a, props = __rest(_a, ["children", "scroller", "component"]);
78
- const { setTarget } = useScrollToBottomModule().useInternalContext();
60
+ var { children, scroll, component } = _a, props = __rest(_a, ["children", "scroll", "component"]);
61
+ const { setTarget } = (0, useInternalContext_1.default)();
79
62
  const ele = useFakeScrollElementOfWindow();
80
63
  (0, react_1.useEffect)(() => {
81
- if (scroller === 'window') {
64
+ if (scroll === 'window') {
82
65
  setTarget(ele);
83
66
  }
84
- }, [scroller]);
67
+ }, [scroll]);
85
68
  if (!component)
86
69
  return children;
87
- return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: component }, props, { ref: !scroller ? setTarget : undefined, children: children })));
70
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: component }, props, { ref: !scroll ? setTarget : undefined, children: children })));
88
71
  }
89
72
  function useFakeScrollElementOfWindow() {
90
73
  return (0, react_1.useMemo)(() => {
@@ -22,7 +22,6 @@ const react_2 = require("react");
22
22
  const react_share_1 = require("react-share");
23
23
  const locale_1 = require("../../../locale");
24
24
  const locales_1 = require("../locales");
25
- const utils_1 = require("../utils");
26
25
  const MenuButton_1 = __importDefault(require("./MenuButton"));
27
26
  const getFormattedUrl = (url) => {
28
27
  // remove page & sessionId query params
@@ -88,8 +87,14 @@ function SocialShareMenu(_a) {
88
87
  exports.SocialShareMenu = SocialShareMenu;
89
88
  function SocialShareButtons(_a) {
90
89
  var { url = getFormattedUrl(window.location.href), content, sx, itemSx, onClick, bgFill, iconFill } = _a, rest = __rest(_a, ["url", "content", "sx", "itemSx", "onClick", "bgFill", "iconFill"]);
91
- const mergedSx = (0, utils_1.mergeSx)({ display: 'flex', alignItems: 'center', gap: 0.5, lineHeight: 1 }, sx);
92
- const mergedItemSx = (0, utils_1.mergeSx)({ width: { xs: 24, sm: 28 }, height: { xs: 24, sm: 28 }, borderRadius: 1 }, itemSx);
90
+ const mergedSx = [
91
+ { display: 'flex', alignItems: 'center', gap: 0.5, lineHeight: 1 },
92
+ ...(Array.isArray(sx) ? sx : [sx]),
93
+ ];
94
+ const mergedItemSx = [
95
+ { width: { xs: 24, sm: 28 }, height: { xs: 24, sm: 28 }, borderRadius: 1 },
96
+ ...(Array.isArray(itemSx) ? itemSx : [itemSx]),
97
+ ];
93
98
  const iconProps = {
94
99
  bgStyle: { fill: bgFill || '#bbb' },
95
100
  iconFillColor: iconFill || '#fff',
@@ -98,27 +98,6 @@ function ThemeProvider({ children, template, transparentHeaderBg, }) {
98
98
  },
99
99
  ],
100
100
  },
101
- MuiDialog: {
102
- variants: [
103
- {
104
- props: {},
105
- style: ({ theme }) => theme.unstable_sx({
106
- '.MuiDialogTitle-root': {
107
- px: 2.5,
108
- py: 2,
109
- },
110
- '.MuiDialogContent-root': {
111
- px: 2.5,
112
- py: 2,
113
- },
114
- '.MuiDialogActions-root': {
115
- px: 2.5,
116
- py: 2,
117
- },
118
- }),
119
- },
120
- ],
121
- },
122
101
  },
123
102
  };
124
103
  const paletteTheme = (0, material_1.createTheme)({
@@ -20,7 +20,7 @@ const DID_1 = __importDefault(require("@arcblock/ux/lib/DID"));
20
20
  const material_1 = require("@mui/material");
21
21
  const dayjs_1 = __importDefault(require("dayjs"));
22
22
  const react_1 = require("react");
23
- const ux_1 = require("../../../../arcblock/ux");
23
+ const ux_1 = require("../../../arcblock/ux");
24
24
  function UserInfo(_a) {
25
25
  var { avatar, showDID, did, name, time, children, reverse } = _a, restProps = __rest(_a, ["avatar", "showDID", "did", "name", "time", "children", "reverse"]);
26
26
  return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ className: "user-info", alignItems: "center", direction: reverse ? 'row-reverse' : 'row', gap: 1.5 }, restProps, { children: [(avatar || did) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PAYMENT_KIT_DID = exports.AI_STUDIO_DID = void 0;
3
+ exports.DEFAULT_OUTPUT_COMPONENT_ID = exports.DEFAULT_INPUT_COMPONENT_ID = exports.DEFAULT_PAGE_COMPONENT_ID = exports.PAYMENT_KIT_DID = exports.AI_STUDIO_DID = void 0;
4
4
  exports.AI_STUDIO_DID = 'z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB';
5
5
  exports.PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
6
+ exports.DEFAULT_PAGE_COMPONENT_ID = 'ctnxha29uu8cx4xv';
7
+ exports.DEFAULT_INPUT_COMPONENT_ID = '1wwtemqcdio6nqf0';
8
+ exports.DEFAULT_OUTPUT_COMPONENT_ID = 'q0ckknkxph4hfwas';
@@ -2,17 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useCurrentAgent = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const aid_1 = require("@blocklet/ai-runtime/common/aid");
5
6
  const types_1 = require("@blocklet/ai-runtime/types");
6
7
  const react_1 = require("react");
7
- const utils_1 = require("../../../utils");
8
8
  const constants_1 = require("../constants");
9
- const assistant_1 = require("../state/assistant");
9
+ const agent_1 = require("../state/agent");
10
10
  const runtime_1 = require("../state/runtime");
11
11
  const context = (0, react_1.createContext)(undefined);
12
12
  function CurrentAgentProvider({ agentId, children }) {
13
13
  const { aid } = (0, runtime_1.useRuntimeState)();
14
14
  const state = (0, react_1.useMemo)(() => ({
15
- aid: (0, utils_1.stringifyIdentity)(Object.assign(Object.assign({}, (0, utils_1.parseIdentity)(aid, { rejectWhenError: true })), { assistantId: agentId })),
15
+ aid: (0, aid_1.stringifyIdentity)(Object.assign(Object.assign({}, (0, aid_1.parseIdentity)(aid, { rejectWhenError: true })), { assistantId: agentId })),
16
16
  }), [aid, agentId]);
17
17
  return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
18
18
  }
@@ -23,7 +23,7 @@ function useCurrentAgent() {
23
23
  if (!current) {
24
24
  throw new Error('No such current agent state. You should use `useCurrentAgent` within the `CurrentAgentProvider`');
25
25
  }
26
- const [agent] = (0, assistant_1.useAssistantState)({ aid: current.aid, working });
26
+ const [agent] = (0, agent_1.useAgentState)({ aid: current.aid, working });
27
27
  const appearanceInput = (0, react_1.useMemo)(() => {
28
28
  var _a, _b, _c;
29
29
  return (_c = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === types_1.RuntimeOutputVariable.appearanceInput)) === null || _b === void 0 ? void 0 : _b.initialValue) !== null && _c !== void 0 ? _c : { componentId: constants_1.DEFAULT_INPUT_COMPONENT_ID };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RuntimeProviderFromUrl = exports.useRuntimeContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_router_dom_1 = require("react-router-dom");
7
+ const error_1 = require("../error");
8
+ const runtimeContext = (0, react_1.createContext)(undefined);
9
+ function useRuntimeContext() {
10
+ const context = (0, react_1.useContext)(runtimeContext);
11
+ if (!context) {
12
+ throw new Error('No such runtime context. You should use `useRuntimeContext` within the `RuntimeProvider`');
13
+ }
14
+ return context;
15
+ }
16
+ exports.useRuntimeContext = useRuntimeContext;
17
+ function RuntimeProvider({ aid, working, children, }) {
18
+ if (!aid)
19
+ throw new Error('Missing required props `aid`');
20
+ const value = (0, react_1.useMemo)(() => ({ aid, working }), [aid, working]);
21
+ return (0, jsx_runtime_1.jsx)(runtimeContext.Provider, { value: value, children: children });
22
+ }
23
+ exports.default = RuntimeProvider;
24
+ function RuntimeProviderFromUrl({ children }) {
25
+ const [query] = (0, react_router_dom_1.useSearchParams)();
26
+ const aid = query.get('aid');
27
+ const working = query.get('working') === 'true';
28
+ if (!aid)
29
+ throw new error_1.CustomError(404, 'Missing required query parameters `aid`');
30
+ return ((0, jsx_runtime_1.jsx)(RuntimeProvider, { aid: aid, working: working, children: children }));
31
+ }
32
+ exports.RuntimeProviderFromUrl = RuntimeProviderFromUrl;
@@ -17,73 +17,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.ChatBot = exports.AIRuntime = exports.PhotoGalleryItem = exports.ChatOutput = exports.SimpleOutput = exports.AutoForm = exports.PhotoGallery = exports.SimpleChat = exports.SimplePage = exports.Runtime = void 0;
21
- const jsx_runtime_1 = require("react/jsx-runtime");
22
- const material_1 = require("@mui/material");
23
- const react_1 = require("react");
24
- const react_error_boundary_1 = require("react-error-boundary");
25
- const ux_1 = require("../../arcblock/ux");
26
- const common_1 = require("./components/common");
27
- const runtime_chat_1 = __importDefault(require("./components/runtime-chat"));
28
- const runtime_form_1 = __importDefault(require("./components/runtime-form"));
29
- const RuntimeProvider_1 = __importDefault(require("./components/RuntimeProvider"));
30
- const ScrollView_1 = __importDefault(require("./components/ScrollView"));
31
- const CheckSession_1 = __importDefault(require("./components/session/CheckSession"));
32
- const header_1 = require("./hooks/header");
33
- const navigate_1 = require("./hooks/navigate");
34
- const assistant_1 = require("./state/assistant");
35
- __exportStar(require("./components/runtime/contexts/CurrentAgent"), exports);
36
- __exportStar(require("./components/runtime/contexts/CurrentMessage"), exports);
37
- __exportStar(require("./components/runtime/state/runtime"), exports);
38
- __exportStar(require("./components/runtime/state/session"), exports);
39
- var runtime_1 = require("./components/runtime");
40
- Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return __importDefault(runtime_1).default; } });
41
- var SimplePage_1 = require("./components/runtime/components/SimplePage");
20
+ exports.PhotoGalleryItem = exports.ChatOutput = exports.SimpleOutput = exports.AutoForm = exports.PhotoGallery = exports.SimpleChat = exports.SimplePage = exports.ChatBotButton = exports.Runtime = void 0;
21
+ __exportStar(require("./contexts/CurrentAgent"), exports);
22
+ __exportStar(require("./contexts/CurrentMessage"), exports);
23
+ __exportStar(require("./state/runtime"), exports);
24
+ __exportStar(require("./state/session"), exports);
25
+ var Runtime_1 = require("./runtime/Runtime");
26
+ Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return __importDefault(Runtime_1).default; } });
27
+ var ChatBotButton_1 = require("./runtime/ChatBotButton");
28
+ Object.defineProperty(exports, "ChatBotButton", { enumerable: true, get: function () { return __importDefault(ChatBotButton_1).default; } });
29
+ var SimplePage_1 = require("./runtime-components/SimplePage");
42
30
  Object.defineProperty(exports, "SimplePage", { enumerable: true, get: function () { return __importDefault(SimplePage_1).default; } });
43
- var SimpleChat_1 = require("./components/runtime/components/SimpleChat");
31
+ var SimpleChat_1 = require("./runtime-components/SimpleChat");
44
32
  Object.defineProperty(exports, "SimpleChat", { enumerable: true, get: function () { return __importDefault(SimpleChat_1).default; } });
45
- var PhotoGallery_1 = require("./components/runtime/components/PhotoGallery");
33
+ var PhotoGallery_1 = require("./runtime-components/PhotoGallery");
46
34
  Object.defineProperty(exports, "PhotoGallery", { enumerable: true, get: function () { return __importDefault(PhotoGallery_1).default; } });
47
- var AutoForm_1 = require("./components/runtime/components/AutoForm");
35
+ var AutoForm_1 = require("./runtime-components/AutoForm");
48
36
  Object.defineProperty(exports, "AutoForm", { enumerable: true, get: function () { return __importDefault(AutoForm_1).default; } });
49
- var SimpleOutput_1 = require("./components/runtime/components/SimpleOutput");
37
+ var SimpleOutput_1 = require("./runtime-components/SimpleOutput");
50
38
  Object.defineProperty(exports, "SimpleOutput", { enumerable: true, get: function () { return __importDefault(SimpleOutput_1).default; } });
51
- var ChatOutput_1 = require("./components/runtime/components/ChatOutput");
39
+ var ChatOutput_1 = require("./runtime-components/ChatOutput");
52
40
  Object.defineProperty(exports, "ChatOutput", { enumerable: true, get: function () { return __importDefault(ChatOutput_1).default; } });
53
- var PhotoGalleryItem_1 = require("./components/runtime/components/PhotoGalleryItem");
41
+ var PhotoGalleryItem_1 = require("./runtime-components/PhotoGalleryItem");
54
42
  Object.defineProperty(exports, "PhotoGalleryItem", { enumerable: true, get: function () { return __importDefault(PhotoGalleryItem_1).default; } });
55
- function App(props) {
56
- const cacheId = (0, react_1.useId)();
57
- return ((0, jsx_runtime_1.jsx)(RuntimeProvider_1.default, { children: (0, jsx_runtime_1.jsx)(AIRuntime, Object.assign({}, props, { cacheId: cacheId })) }));
58
- }
59
- exports.default = App;
60
- function AIRuntime({ cacheId }) {
61
- var _a;
62
- const page = (0, navigate_1.useCurrentPage)();
63
- const { assistantId } = page;
64
- const [assistant] = (0, assistant_1.useAssistantState)({ assistantId });
65
- (0, header_1.useSetHeader)({ assistant, assistantId });
66
- return ((0, jsx_runtime_1.jsx)(CheckSession_1.default, { cacheId: cacheId, page: page, children: (0, jsx_runtime_1.jsx)(ScrollView_1.default, { scroller: "window", initialScrollBehavior: "auto", children: (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, height: "100%", className: "ai-runtime-root", children: ((_a = assistant.release) === null || _a === void 0 ? void 0 : _a.template) === 'form' ? (0, jsx_runtime_1.jsx)(runtime_form_1.default, { page: page }) : (0, jsx_runtime_1.jsx)(runtime_chat_1.default, { page: page }) }) }) }));
67
- }
68
- exports.AIRuntime = AIRuntime;
69
- function ChatBot(props) {
70
- if (!props.assistantId)
71
- throw new Error('Missing required parameter assistantId');
72
- const navigate = (0, react_1.useCallback)((page) => {
73
- setPage((state) => (Object.assign(Object.assign({}, state), page)));
74
- }, []);
75
- const [page, setPage] = (0, react_1.useState)({
76
- page: 'assistant',
77
- assistantId: props.assistantId,
78
- navigate,
79
- });
80
- const cacheId = (0, react_1.useId)();
81
- return ((0, jsx_runtime_1.jsx)(RuntimeProvider_1.default, { children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ChatBotErrorView, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(common_1.ChatBot, Object.assign({}, props, { children: (0, jsx_runtime_1.jsx)(CheckSession_1.default, { cacheId: cacheId, autoCreateSession: true, page: page, children: (0, jsx_runtime_1.jsx)(runtime_chat_1.default, { page: page }) }) })) }) }) }));
82
- }
83
- exports.ChatBot = ChatBot;
84
- function ChatBotErrorView({ error }) {
85
- (0, react_1.useEffect)(() => {
86
- ux_1.Toast.error(error.message);
87
- }, [error]);
88
- return null;
89
- }