@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
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Stack } from '@mui/material';
3
- import { MessageMetadataRenderer } from '../../../common';
4
- import MarkdownRenderer from '../../../MarkdownRenderer';
3
+ import MarkdownRenderer from '../../components/MarkdownRenderer';
5
4
  import { useCurrentMessage } from '../../contexts/CurrentMessage';
5
+ import MessageErrorView from '../ChatOutput/MessageErrorView';
6
+ import MessageMetadataRenderer from '../ChatOutput/MessageMetadataRenderer';
6
7
  export default function SimpleOutput() {
7
8
  var _a, _b;
8
9
  const { message } = useCurrentMessage();
9
10
  const objects = (_a = message.result) === null || _a === void 0 ? void 0 : _a.objects;
10
- return (_jsxs(Stack, { gap: 2, boxShadow: 1, borderRadius: 1, p: 2, children: [_jsx(MarkdownRenderer, { children: (_b = message.result) === null || _b === void 0 ? void 0 : _b.content }), objects === null || objects === void 0 ? void 0 : objects.map((item) => _jsx(MessageMetadataRenderer, { object: item.data }))] }));
11
+ const { error } = message;
12
+ return (_jsxs(Stack, { gap: 2, boxShadow: 1, borderRadius: 1, p: 2, children: [_jsx(MarkdownRenderer, { children: (_b = message.result) === null || _b === void 0 ? void 0 : _b.content }), error && _jsx(MessageErrorView, { error: error }), objects === null || objects === void 0 ? void 0 : objects.map((item) => _jsx(MessageMetadataRenderer, { object: item.data }))] }));
11
13
  }
@@ -0,0 +1,63 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { Stack, ThemeProvider, Typography, createTheme, useTheme } from '@mui/material';
14
+ import { Suspense, useMemo } from 'react';
15
+ import Balancer from 'react-wrap-balancer';
16
+ import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
17
+ import SimpleHeader from '../../components/Header/SimpleHeader';
18
+ import SimpleLayout from '../../components/Layout/SimpleLayout';
19
+ import CurrentAgentProvider, { useCurrentAgent } from '../../contexts/CurrentAgent';
20
+ import CurrentMessageProvider from '../../contexts/CurrentMessage';
21
+ import { useRuntimeState } from '../../state/runtime';
22
+ export default function SimplePage({ resultTitle, primaryColor }) {
23
+ const { childAgentId } = useRuntimeState();
24
+ const inheritedTheme = useTheme();
25
+ const theme = useMemo(() => {
26
+ let { primary } = inheritedTheme.palette;
27
+ try {
28
+ if (primaryColor) {
29
+ primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
30
+ }
31
+ }
32
+ catch (error) {
33
+ console.error('augment primary color error', { error });
34
+ }
35
+ return createTheme(inheritedTheme, {
36
+ palette: { primary },
37
+ shape: {
38
+ borderRadius: 8,
39
+ },
40
+ });
41
+ }, [inheritedTheme, primaryColor]);
42
+ return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(SimpleLayout, { children: [_jsx(SimpleHeader, {}), _jsx(CurrentAgentProvider, { agentId: childAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), _jsx(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }) }));
43
+ }
44
+ function AgentInputRender(_a) {
45
+ var props = __rest(_a, []);
46
+ const { appearanceInput } = useCurrentAgent();
47
+ if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
48
+ return null;
49
+ return (_jsx(Stack, Object.assign({}, props, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProps }) })));
50
+ }
51
+ function OutputView(_a) {
52
+ var _b;
53
+ var { resultTitle } = _a, props = __rest(_a, ["resultTitle"]);
54
+ const { sessionState } = useRuntimeState();
55
+ const lastMessage = (_b = sessionState.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0];
56
+ return (_jsx(Stack, Object.assign({ gap: 2, mt: 4 }, props, { children: lastMessage && (_jsxs(_Fragment, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h5", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), _jsx(Stack, { children: _jsx(CurrentAgentProvider, { agentId: lastMessage.assistantId, children: _jsx(CurrentMessageProvider, { message: lastMessage, children: _jsx(Suspense, { children: _jsx(OutputItemView, {}) }) }) }) })] })) })));
57
+ }
58
+ function OutputItemView() {
59
+ const { appearanceOutput } = useCurrentAgent();
60
+ if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
61
+ return null;
62
+ return (_jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProps }));
63
+ }
@@ -9,21 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { create } from 'zustand';
11
11
  import { immer } from 'zustand/middleware/immer';
12
- import { getAssistant } from '../../../api/assistant';
12
+ import { getAgent } from '../api/agent';
13
13
  const STATES = {};
14
- export const createAssistantState = ({ aid, working, assistant, }) => {
14
+ export const createAgentState = ({ aid, working, agent }) => {
15
15
  var _a;
16
16
  const key = working ? `${aid}-working` : aid;
17
17
  (_a = STATES[key]) !== null && _a !== void 0 ? _a : (STATES[key] = create()(immer((set) => ({
18
- assistant,
18
+ agent,
19
19
  load: () => __awaiter(void 0, void 0, void 0, function* () {
20
20
  set((state) => {
21
21
  state.loading = true;
22
22
  });
23
23
  try {
24
- const assistant = yield getAssistant({ assistantId: aid, working });
24
+ const agent = yield getAgent({ aid, working });
25
25
  set((state) => {
26
- state.assistant = assistant;
26
+ state.agent = agent;
27
27
  });
28
28
  }
29
29
  catch (error) {
@@ -42,15 +42,15 @@ export const createAssistantState = ({ aid, working, assistant, }) => {
42
42
  return STATES[key];
43
43
  };
44
44
  const LOADING_TASKS = {};
45
- export function useAssistantState({ aid, working }) {
45
+ export function useAgentState({ aid, working }) {
46
46
  var _a;
47
- const state = createAssistantState({ aid, working })();
48
- if (!state.assistant) {
47
+ const state = createAgentState({ aid, working })();
48
+ if (!state.agent) {
49
49
  if (state.error)
50
50
  throw state.error;
51
51
  const key = working ? `${aid}-working` : aid;
52
52
  (_a = LOADING_TASKS[key]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[key] = state.load());
53
53
  throw LOADING_TASKS[key];
54
54
  }
55
- return [state.assistant, state];
55
+ return [state.agent, state];
56
56
  }
@@ -9,19 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
11
11
  import { useCallback, useEffect, useMemo } from 'react';
12
- import { useSearchParams } from 'react-router-dom';
13
- import { useSessionContext } from '../../../../../session';
14
- import { CustomError } from '../../../error';
15
- import { useAssistantState } from './assistant';
12
+ import { useSessionContext } from '../../../session';
13
+ import { useRuntimeContext } from '../contexts/Runtime';
14
+ import { useAgentState } from './agent';
16
15
  import { createSessionState } from './session';
17
16
  export function useRuntimeState() {
18
17
  var _a;
19
- const [query] = useSearchParams();
20
- const aid = query.get('aid');
21
- if (!aid)
22
- throw new CustomError(404, 'Missing required query parameters `aid`');
23
- const working = query.get('working') === 'true';
24
- const [agent] = useAssistantState({ aid, working });
18
+ const { aid, working } = useRuntimeContext();
19
+ const [agent] = useAgentState({ aid, working });
25
20
  const sessionState = createSessionState({ aid })();
26
21
  const { session: authSession } = useSessionContext();
27
22
  // reset state after logged out
@@ -14,36 +14,46 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
14
14
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
15
15
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
16
  };
17
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
18
- import pick from 'lodash/pick';
17
+ import { parseIdentity } from '@blocklet/ai-runtime/common/aid';
19
18
  import { create } from 'zustand';
20
19
  import { immer } from 'zustand/middleware/immer';
21
20
  import { getMessages } from '../api/message';
22
- import { getSession, runAssistant, updateSession } from '../api/session';
23
- import { deepMerge, parseIdentity } from '../utils';
21
+ import { createSession, getSessions, runAgent } from '../api/session';
24
22
  const STATES = {};
25
- export const createSessionState = ({ sessionId, session }) => {
23
+ const GET_MESSAGES_LIMIT = 100;
24
+ const GET_MESSAGES_ORDER_DIRECTION = 'desc';
25
+ export const createSessionState = ({ aid }) => {
26
26
  var _a;
27
- (_a = STATES[sessionId]) !== null && _a !== void 0 ? _a : (STATES[sessionId] = create()(immer((set, get) => ({
28
- session,
29
- updateSession: (_b) => __awaiter(void 0, [_b], void 0, function* ({ parameters }) {
30
- const { updated } = yield updateSession({ sessionId, parameters });
27
+ (_a = STATES[aid]) !== null && _a !== void 0 ? _a : (STATES[aid] = create()(immer((set, get) => ({
28
+ reset: () => {
31
29
  set((state) => {
32
- state.session = updated;
30
+ state.loading = undefined;
31
+ state.loaded = undefined;
32
+ state.running = undefined;
33
+ state.session = undefined;
34
+ state.messages = undefined;
35
+ state.noMoreMessage = undefined;
36
+ state.messageLoading = undefined;
37
+ state.error = undefined;
33
38
  });
34
- }),
39
+ },
35
40
  load: () => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _b;
36
42
  set((state) => {
37
43
  state.loading = true;
38
44
  });
39
45
  try {
40
- const [{ session }, { messages }] = yield Promise.all([
41
- getSession({ sessionId }),
42
- getMessages({ sessionId }),
43
- ]);
46
+ const { sessions } = yield getSessions({ aid });
47
+ const session = (_b = sessions[0]) !== null && _b !== void 0 ? _b : (yield createSession({ aid })).created;
48
+ const { messages } = yield getMessages({
49
+ sessionId: session.id,
50
+ orderDirection: GET_MESSAGES_ORDER_DIRECTION,
51
+ limit: GET_MESSAGES_LIMIT,
52
+ });
44
53
  set((state) => {
45
54
  state.session = session;
46
- state.messages = messages;
55
+ state.messages = messages.toReversed();
56
+ state.noMoreMessage = messages.length < GET_MESSAGES_LIMIT;
47
57
  });
48
58
  }
49
59
  catch (error) {
@@ -54,37 +64,67 @@ export const createSessionState = ({ sessionId, session }) => {
54
64
  }
55
65
  finally {
56
66
  set((state) => {
67
+ state.loaded = true;
57
68
  state.loading = false;
58
69
  });
59
70
  }
60
71
  }),
61
- execute: (_c) => __awaiter(void 0, [_c], void 0, function* ({ assistantId, parameters, onResponseStart, includeSessionParameters, }) {
62
- var _d, e_1, _e, _f;
63
- var _g, _h, _j, _k, _l;
64
- const identity = parseIdentity(assistantId, { rejectWhenError: true });
72
+ loadMoreMessages: () => __awaiter(void 0, void 0, void 0, function* () {
73
+ var _c;
74
+ set((state) => {
75
+ state.messageLoading = true;
76
+ });
77
+ const { session, messages } = get();
78
+ if (!session)
79
+ return;
80
+ try {
81
+ const result = yield getMessages({
82
+ sessionId: session.id,
83
+ before: (_c = messages === null || messages === void 0 ? void 0 : messages.slice(-1)[0]) === null || _c === void 0 ? void 0 : _c.id,
84
+ orderDirection: GET_MESSAGES_ORDER_DIRECTION,
85
+ limit: GET_MESSAGES_LIMIT,
86
+ });
87
+ set((state) => {
88
+ var _a;
89
+ state.messages = ((_a = state.messages) !== null && _a !== void 0 ? _a : []).concat(result.messages.toReversed());
90
+ state.noMoreMessage = result.messages.length < GET_MESSAGES_LIMIT;
91
+ });
92
+ }
93
+ finally {
94
+ set((state) => {
95
+ state.messageLoading = false;
96
+ });
97
+ }
98
+ }),
99
+ execute: (_d) => __awaiter(void 0, [_d], void 0, function* ({ aid, working, parameters, onResponseStart, }) {
100
+ var _e, e_1, _f, _g;
101
+ let { session } = get();
102
+ if (!session) {
103
+ yield get().load();
104
+ session = get().session;
105
+ }
106
+ if (!session)
107
+ throw new Error('This session is not initialized');
108
+ const { id: sessionId } = session;
109
+ const identity = parseIdentity(aid, { rejectWhenError: true });
65
110
  let message;
66
- const childMessages = [];
67
- const childMessagesMap = {};
68
111
  set((state) => {
69
112
  state.running = true;
70
113
  state.error = undefined;
71
114
  });
72
- let realParameters = Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() });
73
- if (includeSessionParameters) {
74
- realParameters = Object.assign(Object.assign({}, (_g = get().session) === null || _g === void 0 ? void 0 : _g.parameters), parameters);
75
- }
76
115
  try {
77
- const stream = runAssistant({
116
+ const stream = runAgent({
117
+ aid,
78
118
  sessionId,
79
- identity,
80
- parameters: realParameters,
119
+ working,
120
+ parameters: Object.assign(Object.assign({}, parameters), { $clientTime: new Date().toISOString() }),
81
121
  });
82
122
  let responseStarted = false;
83
123
  try {
84
- for (var _m = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _d = stream_1_1.done, !_d; _m = true) {
85
- _f = stream_1_1.value;
86
- _m = false;
87
- const value = _f;
124
+ for (var _h = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _e = stream_1_1.done, !_e; _h = true) {
125
+ _g = stream_1_1.value;
126
+ _h = false;
127
+ const value = _g;
88
128
  if (!responseStarted) {
89
129
  responseStarted = true;
90
130
  onResponseStart === null || onResponseStart === void 0 ? void 0 : onResponseStart();
@@ -93,8 +133,8 @@ export const createSessionState = ({ sessionId, session }) => {
93
133
  if (!message) {
94
134
  message = {
95
135
  taskId: value.taskId,
96
- sessionId,
97
136
  assistantId: identity.assistantId,
137
+ sessionId,
98
138
  parameters,
99
139
  createdAt: new Date().toISOString(),
100
140
  updatedAt: new Date().toISOString(),
@@ -107,49 +147,23 @@ export const createSessionState = ({ sessionId, session }) => {
107
147
  });
108
148
  }
109
149
  if (message.taskId === value.taskId) {
110
- set((state) => {
111
- var _a, _b, _c, _d, _e, _f, _g;
112
- var _h;
113
- const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
114
- if (!msg)
115
- return;
116
- (_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
117
- msg.result.content = (msg.result.content || '') + (value.delta.content || '');
118
- if ((_d = (_c = value.delta) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) {
119
- msg.result.images = ((_e = msg.result.images) !== null && _e !== void 0 ? _e : []).concat(value.delta.images);
120
- }
121
- if (value.delta.object) {
122
- (_f = (_h = msg.result).objects) !== null && _f !== void 0 ? _f : (_h.objects = []);
123
- msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
150
+ requestAnimationFrame(() => {
151
+ set((state) => {
152
+ var _a, _b, _c, _d, _e, _f;
153
+ var _g;
154
+ const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
155
+ if (!msg)
156
+ return;
157
+ (_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
158
+ msg.result.content = (msg.result.content || '') + (value.delta.content || '');
159
+ if ((_d = (_c = value.delta) === null || _c === void 0 ? void 0 : _c.images) === null || _d === void 0 ? void 0 : _d.length) {
160
+ msg.result.images = ((_e = msg.result.images) !== null && _e !== void 0 ? _e : []).concat(value.delta.images);
161
+ }
124
162
  if (value.delta.object) {
125
- (_g = state.metadata) !== null && _g !== void 0 ? _g : (state.metadata = {});
126
- deepMerge(state.metadata, pick(value.delta.object, Object.values(RuntimeOutputVariable)));
163
+ (_f = (_g = msg.result).objects) !== null && _f !== void 0 ? _f : (_g.objects = []);
164
+ msg.result.objects.push({ taskId: value.taskId, data: value.delta.object });
127
165
  }
128
- }
129
- });
130
- }
131
- else if (value.respondAs && value.respondAs !== 'none') {
132
- let childMessage = childMessagesMap[value.taskId];
133
- if (!childMessage) {
134
- childMessage = {
135
- taskId: value.taskId,
136
- respondAs: value.respondAs,
137
- };
138
- childMessagesMap[value.taskId] = childMessage;
139
- childMessages.push(childMessage);
140
- }
141
- (_h = childMessage.result) !== null && _h !== void 0 ? _h : (childMessage.result = {});
142
- childMessage.result.content = (childMessage.result.content || '') + (value.delta.content || '');
143
- if ((_k = (_j = value.delta) === null || _j === void 0 ? void 0 : _j.images) === null || _k === void 0 ? void 0 : _k.length) {
144
- childMessage.result.images = ((_l = childMessage.result.images) !== null && _l !== void 0 ? _l : []).concat(value.delta.images);
145
- }
146
- set((state) => {
147
- var _a, _b;
148
- const msg = (_a = state.messages) === null || _a === void 0 ? void 0 : _a.findLast((i) => i.taskId === message.taskId);
149
- if (!msg)
150
- return;
151
- (_b = msg.result) !== null && _b !== void 0 ? _b : (msg.result = {});
152
- msg.result.messages = JSON.parse(JSON.stringify(childMessages));
166
+ });
153
167
  });
154
168
  }
155
169
  }
@@ -168,7 +182,7 @@ export const createSessionState = ({ sessionId, session }) => {
168
182
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
169
183
  finally {
170
184
  try {
171
- if (!_m && !_d && (_e = stream_1.return)) yield _e.call(stream_1);
185
+ if (!_h && !_e && (_f = stream_1.return)) yield _f.call(stream_1);
172
186
  }
173
187
  finally { if (e_1) throw e_1.error; }
174
188
  }
@@ -191,16 +205,5 @@ export const createSessionState = ({ sessionId, session }) => {
191
205
  }
192
206
  }),
193
207
  }))));
194
- return STATES[sessionId];
208
+ return STATES[aid];
195
209
  };
196
- const LOADING_TASKS = {};
197
- export function useSessionState({ sessionId, required }) {
198
- var _a;
199
- const state = createSessionState({ sessionId })();
200
- if (!state.session) {
201
- (_a = LOADING_TASKS[sessionId]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[sessionId] = state.load());
202
- if (required)
203
- throw LOADING_TASKS[sessionId];
204
- }
205
- return [state.session, state];
206
- }
@@ -1,5 +1,5 @@
1
1
  import { AssistantBase, OutputVariable, Parameter } from '@blocklet/ai-runtime/types';
2
- export interface Assistant {
2
+ export interface Agent {
3
3
  id: string;
4
4
  name?: string;
5
5
  description?: string;
@@ -15,7 +15,7 @@ export interface Assistant {
15
15
  release?: AssistantBase['release'];
16
16
  createdBy?: string;
17
17
  }
18
- export declare function getAssistant({ assistantId: id, working, }: {
19
- assistantId: string;
18
+ export declare function getAgent({ aid, working }: {
19
+ aid: string;
20
20
  working?: boolean;
21
- }): Promise<Assistant>;
21
+ }): Promise<Agent>;
@@ -1,5 +1,4 @@
1
1
  import { RunAssistantResponse } from '@blocklet/ai-runtime/types';
2
- import { Identity } from '../utils';
3
2
  export interface Session {
4
3
  id: string;
5
4
  userId: string;
@@ -12,10 +11,8 @@ export interface Session {
12
11
  title?: string;
13
12
  };
14
13
  }
15
- export declare function getSessions({ projectId, projectRef, assistantId, }: {
16
- projectId: string;
17
- projectRef: string;
18
- assistantId: string;
14
+ export declare function getSessions({ aid }: {
15
+ aid: string;
19
16
  }): Promise<{
20
17
  sessions: Session[];
21
18
  }>;
@@ -24,19 +21,16 @@ export declare function getSession({ sessionId }: {
24
21
  }): Promise<{
25
22
  session: Session;
26
23
  }>;
27
- export declare function createSession({ assistantId, name, parameters, entry, }: {
28
- assistantId: string;
24
+ export declare function createSession({ aid, name, }: {
25
+ aid: string;
29
26
  name?: string;
30
- parameters?: any;
31
- entry?: any;
32
27
  }): Promise<{
33
28
  created: Session;
34
29
  sessions: Session[];
35
30
  }>;
36
- export declare function updateSession({ sessionId, name, parameters, }: {
31
+ export declare function updateSession({ sessionId, name, }: {
37
32
  sessionId: string;
38
33
  name?: string;
39
- parameters?: any;
40
34
  }): Promise<{
41
35
  updated: Session;
42
36
  sessions: Session[];
@@ -47,9 +41,9 @@ export declare function deleteSession({ sessionId, }: {
47
41
  deleted: Session;
48
42
  sessions: Session[];
49
43
  }>;
50
- export declare function runAssistant({ sessionId, identity, working, parameters, }: {
44
+ export declare function runAgent({ aid, sessionId, working, parameters, }: {
45
+ aid: string;
51
46
  sessionId: string;
52
- identity: Identity;
53
47
  working?: boolean;
54
48
  parameters: any;
55
49
  }): AsyncGenerator<RunAssistantResponse, void, unknown>;
@@ -1,6 +1,6 @@
1
1
  import { LoadingButtonProps } from '@mui/lab';
2
2
  import { ReactNode } from 'react';
3
- export declare function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement, ...props }: {
3
+ export default function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement, ...props }: {
4
4
  tip?: ReactNode;
5
5
  tipSucceed?: ReactNode;
6
6
  title?: ReactNode;
@@ -1,6 +1,6 @@
1
1
  import { Parameter } from '@blocklet/ai-runtime/types';
2
2
  import { TextFieldProps } from '@mui/material';
3
- export default function ParameterField({ parameter, ...props }: {
3
+ export default function AgentInputField({ parameter, ...props }: {
4
4
  readOnly?: boolean;
5
5
  parameter: Parameter;
6
6
  onChange: (value: string | number | undefined) => void;
@@ -1,2 +1,3 @@
1
1
  import { LinearProgressProps } from '@mui/material';
2
+ export { globalLoadingState } from './state';
2
3
  export default function GlobalLoading({ ...props }: LinearProgressProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ import { StackProps, TypographyProps } from '@mui/material';
2
+ export default function SimpleHeader({ TitleProps, DescriptionProps, ...props }: {
3
+ TitleProps?: TypographyProps;
4
+ DescriptionProps?: TypographyProps;
5
+ } & StackProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { StackProps } from '@mui/material';
2
+ export default function SimpleLayout({ ...props }: StackProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
- declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
2
+ import { LoadingButtonProps } from '@mui/lab';
3
+ declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<Partial<LoadingButtonProps>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
3
4
  export default LoadingButton;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export default function RuntimeProvider({ children }: {
2
+ export default function RuntimeCommonProvider({ children }: {
3
3
  children?: ReactNode;
4
4
  }): import("react/jsx-runtime").JSX.Element;
5
5
  export declare function RuntimeLocaleProvider({ children }: {
@@ -1,61 +1,10 @@
1
1
  import { BoxProps } from '@mui/material';
2
2
  import { ComponentProps } from 'react';
3
- export declare function useScrollToBottomModule(): {
4
- Composer: typeof import("react-scroll-to-bottom").default;
5
- useInternalContext: any;
6
- default(props: import("react").PropsWithChildren<{
7
- checkInterval?: number | undefined;
8
- className?: string | undefined;
9
- debounce?: number | undefined;
10
- debug?: boolean | undefined;
11
- followButtonClassName?: string | undefined;
12
- initialScrollBehavior?: "auto" | "smooth" | undefined;
13
- mode?: "bottom" | "top" | undefined;
14
- nonce?: string | undefined;
15
- scroller?: ((values: {
16
- maxValue: number;
17
- minValue: number;
18
- offsetHeight: number;
19
- scrollHeight: number;
20
- scrollTop: number;
21
- }) => number) | undefined;
22
- scrollViewClassName?: string | undefined;
23
- }>): null;
24
- useScrollTo(): (scrollTop: number | "100%") => void;
25
- useScrollToBottom(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
26
- useScrollToEnd(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
27
- useScrollToStart(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
28
- useScrollToTop(): (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
29
- useObserveScrollPosition(observer: false | (({ scrollTop }: {
30
- scrollTop: number;
31
- }) => void)): void;
32
- useAnimating(): [boolean];
33
- useAnimatingToEnd(): [boolean];
34
- useAtBottom(): [boolean];
35
- useAtEnd(): [boolean];
36
- useAtStart(): [boolean];
37
- useAtTop(): [boolean];
38
- useMode(): ["bottom" | "top"];
39
- useSticky(): [boolean];
40
- FunctionContext: import("react").Context<{
41
- scrollTo: (scrollTop: number | "100%") => void;
42
- scrollToBottom: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
43
- scrollToEnd: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
44
- scrollToStart: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
45
- scrollToTop: (option?: import("react-scroll-to-bottom").ScrollOption | undefined) => void;
46
- }>;
47
- StateContext: import("react").Context<{
48
- animating: boolean;
49
- animatingToEnd: boolean;
50
- atBottom: boolean;
51
- atEnd: boolean;
52
- atStart: boolean;
53
- atTop: boolean;
54
- mode: string;
55
- sticky: boolean;
56
- }>;
57
- };
58
- export default function ScrollView({ children, initialScrollBehavior, ...props }: BoxProps & {
59
- scroller?: 'window';
60
- initialScrollBehavior?: ComponentProps<(typeof import('react-scroll-to-bottom'))['default']>['initialScrollBehavior'];
61
- }): import("react/jsx-runtime").JSX.Element;
3
+ import * as scrollToBottom from 'react-scroll-to-bottom';
4
+ declare const Composer: typeof scrollToBottom.default;
5
+ export default function ScrollView({ disabled, children, scroll, component, initialScrollBehavior, ...props }: BoxProps & {
6
+ disabled?: boolean;
7
+ scroll?: 'window';
8
+ initialScrollBehavior?: ComponentProps<typeof Composer>['initialScrollBehavior'];
9
+ }): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
10
+ export {};
@@ -1,2 +1,5 @@
1
1
  export declare const AI_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
2
2
  export declare const PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
3
+ export declare const DEFAULT_PAGE_COMPONENT_ID = "ctnxha29uu8cx4xv";
4
+ export declare const DEFAULT_INPUT_COMPONENT_ID = "1wwtemqcdio6nqf0";
5
+ export declare const DEFAULT_OUTPUT_COMPONENT_ID = "q0ckknkxph4hfwas";
@@ -8,7 +8,7 @@ export default function CurrentAgentProvider({ agentId, children }: {
8
8
  children?: ReactNode;
9
9
  }): import("react/jsx-runtime").JSX.Element;
10
10
  export declare function useCurrentAgent(): {
11
- agent: import("../../../api/assistant").Assistant;
11
+ agent: import("../api/agent").Agent;
12
12
  appearanceInput: RuntimeOutputAppearance;
13
13
  appearanceOutput: RuntimeOutputAppearance;
14
14
  aid: string;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ export interface RuntimeContext {
3
+ aid: string;
4
+ working?: boolean;
5
+ }
6
+ export declare function useRuntimeContext(): RuntimeContext;
7
+ export default function RuntimeProvider({ aid, working, children, }: {
8
+ aid: string;
9
+ working?: boolean;
10
+ children?: ReactNode;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ export declare function RuntimeProviderFromUrl({ children }: {
13
+ children?: ReactNode;
14
+ }): import("react/jsx-runtime").JSX.Element;