@blocklet/pages-kit 0.2.433 → 0.2.435

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 (319) hide show
  1. package/lib/cjs/builtin/async/ai-runtime.js +17 -0
  2. package/lib/cjs/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +3 -3
  3. package/lib/cjs/builtin/{components.js → components/index.js} +1 -1
  4. package/lib/cjs/components/CustomComponentRenderer/context.js +13 -0
  5. package/lib/cjs/components/CustomComponentRenderer/index.js +5 -1
  6. package/lib/cjs/components/CustomComponentRenderer/state.js +20 -6
  7. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  8. package/lib/esm/builtin/async/ai-runtime.js +1 -0
  9. package/lib/esm/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +2 -2
  10. package/lib/esm/builtin/components/index.js +1 -0
  11. package/lib/esm/components/CustomComponentRenderer/context.js +9 -0
  12. package/lib/esm/components/CustomComponentRenderer/index.js +5 -1
  13. package/lib/esm/components/CustomComponentRenderer/state.js +21 -7
  14. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  15. package/lib/types/builtin/async/ai-runtime.d.ts +1 -0
  16. package/lib/types/builtin/components/index.d.ts +1 -0
  17. package/lib/types/components/CustomComponentRenderer/context.d.ts +14 -0
  18. package/lib/types/components/CustomComponentRenderer/index.d.ts +1 -0
  19. package/lib/types/components/CustomComponentRenderer/state.d.ts +5 -1
  20. package/lib/types/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +12 -5
  22. package/tsconfig.json +1 -1
  23. package/lib/cjs/builtin/async/ai-runtime/api/agent.js +0 -24
  24. package/lib/cjs/builtin/async/ai-runtime/api/asset.js +0 -25
  25. package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +0 -134
  26. package/lib/cjs/builtin/async/ai-runtime/api/message.js +0 -46
  27. package/lib/cjs/builtin/async/ai-runtime/api/request.js +0 -74
  28. package/lib/cjs/builtin/async/ai-runtime/api/secret.js +0 -24
  29. package/lib/cjs/builtin/async/ai-runtime/api/session.js +0 -137
  30. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +0 -62
  31. package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -34
  32. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -21
  33. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -21
  34. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -39
  35. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -24
  36. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -35
  37. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -44
  38. package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -80
  39. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -27
  40. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -39
  41. package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -49
  42. package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -21
  43. package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +0 -40
  44. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -146
  45. package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +0 -55
  46. package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -22
  47. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -49
  48. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -68
  49. package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -25
  50. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +0 -92
  51. package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -6
  52. package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +0 -255
  53. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +0 -108
  54. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -191
  55. package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +0 -55
  56. package/lib/cjs/builtin/async/ai-runtime/constants.js +0 -43
  57. package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -27
  58. package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -31
  59. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -34
  60. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -18
  61. package/lib/cjs/builtin/async/ai-runtime/contexts/Identity.js +0 -36
  62. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +0 -52
  63. package/lib/cjs/builtin/async/ai-runtime/error.js +0 -10
  64. package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -13
  65. package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +0 -109
  66. package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -50
  67. package/lib/cjs/builtin/async/ai-runtime/index.js +0 -83
  68. package/lib/cjs/builtin/async/ai-runtime/locales/index.js +0 -237
  69. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -116
  70. package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -48
  71. package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -138
  72. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -19
  73. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -186
  74. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -24
  75. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -34
  76. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -11
  77. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -24
  78. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -85
  79. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -64
  80. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -30
  81. package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -13
  82. package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -46
  83. package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -2
  84. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -65
  85. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -150
  86. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -26
  87. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -16
  88. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -38
  89. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -42
  90. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -94
  91. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -79
  92. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -34
  93. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -45
  94. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -28
  95. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -82
  96. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -69
  97. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -55
  98. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -54
  99. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -189
  100. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -252
  101. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -300
  102. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -158
  103. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -60
  104. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -153
  105. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -80
  106. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -25
  107. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -68
  108. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -56
  109. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -12
  110. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -13
  111. package/lib/cjs/builtin/async/ai-runtime/state/agent.js +0 -58
  112. package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +0 -48
  113. package/lib/cjs/builtin/async/ai-runtime/state/session.js +0 -415
  114. package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +0 -14
  115. package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +0 -40
  116. package/lib/cjs/builtin/async/ai-runtime/utils/fonts.js +0 -35
  117. package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +0 -10
  118. package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -7
  119. package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +0 -9
  120. package/lib/esm/builtin/async/ai-runtime/api/agent.js +0 -21
  121. package/lib/esm/builtin/async/ai-runtime/api/asset.js +0 -22
  122. package/lib/esm/builtin/async/ai-runtime/api/dataset.js +0 -121
  123. package/lib/esm/builtin/async/ai-runtime/api/message.js +0 -42
  124. package/lib/esm/builtin/async/ai-runtime/api/request.js +0 -68
  125. package/lib/esm/builtin/async/ai-runtime/api/secret.js +0 -21
  126. package/lib/esm/builtin/async/ai-runtime/api/session.js +0 -128
  127. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +0 -56
  128. package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -30
  129. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -19
  130. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -19
  131. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -37
  132. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -22
  133. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -33
  134. package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -38
  135. package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -76
  136. package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -22
  137. package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -36
  138. package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -23
  139. package/lib/esm/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -18
  140. package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +0 -38
  141. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -118
  142. package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +0 -52
  143. package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -19
  144. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -46
  145. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -42
  146. package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -18
  147. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +0 -63
  148. package/lib/esm/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -4
  149. package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +0 -226
  150. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +0 -100
  151. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -185
  152. package/lib/esm/builtin/async/ai-runtime/components/UserInfo.js +0 -47
  153. package/lib/esm/builtin/async/ai-runtime/constants.js +0 -39
  154. package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -23
  155. package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -24
  156. package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -30
  157. package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -14
  158. package/lib/esm/builtin/async/ai-runtime/contexts/Identity.js +0 -28
  159. package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +0 -22
  160. package/lib/esm/builtin/async/ai-runtime/error.js +0 -6
  161. package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -10
  162. package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +0 -103
  163. package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -44
  164. package/lib/esm/builtin/async/ai-runtime/index.js +0 -37
  165. package/lib/esm/builtin/async/ai-runtime/locales/index.js +0 -234
  166. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -87
  167. package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -19
  168. package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -132
  169. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -13
  170. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -157
  171. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -18
  172. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -30
  173. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -8
  174. package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -18
  175. package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -56
  176. package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -58
  177. package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -24
  178. package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -7
  179. package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -40
  180. package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -1
  181. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -59
  182. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -144
  183. package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -20
  184. package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -10
  185. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -35
  186. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -39
  187. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -65
  188. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -50
  189. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -28
  190. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -40
  191. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -22
  192. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -53
  193. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -40
  194. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -49
  195. package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -48
  196. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -183
  197. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -246
  198. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -294
  199. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -149
  200. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -55
  201. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -146
  202. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -75
  203. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -23
  204. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -42
  205. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -52
  206. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -3
  207. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -9
  208. package/lib/esm/builtin/async/ai-runtime/state/agent.js +0 -55
  209. package/lib/esm/builtin/async/ai-runtime/state/runtime.js +0 -45
  210. package/lib/esm/builtin/async/ai-runtime/state/session.js +0 -408
  211. package/lib/esm/builtin/async/ai-runtime/utils/agent-inputs.js +0 -10
  212. package/lib/esm/builtin/async/ai-runtime/utils/download-image.js +0 -36
  213. package/lib/esm/builtin/async/ai-runtime/utils/fonts.js +0 -32
  214. package/lib/esm/builtin/async/ai-runtime/utils/map-right.js +0 -7
  215. package/lib/esm/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -4
  216. package/lib/esm/builtin/async/ai-runtime/utils/zustand.js +0 -6
  217. package/lib/esm/builtin/components.js +0 -1
  218. package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +0 -51
  219. package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +0 -16
  220. package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +0 -39
  221. package/lib/types/builtin/async/ai-runtime/api/message.d.ts +0 -35
  222. package/lib/types/builtin/async/ai-runtime/api/request.d.ts +0 -12
  223. package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +0 -12
  224. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +0 -61
  225. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +0 -14
  226. package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +0 -7
  227. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/BooleanField.d.ts +0 -8
  228. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +0 -8
  229. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +0 -8
  230. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +0 -8
  231. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +0 -8
  232. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/index.d.ts +0 -7
  233. package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +0 -10
  234. package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/index.d.ts +0 -3
  235. package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/state.d.ts +0 -10
  236. package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +0 -5
  237. package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +0 -2
  238. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -3
  239. package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer/index.d.ts +0 -2
  240. package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +0 -10
  241. package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +0 -5
  242. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +0 -5
  243. package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +0 -6
  244. package/lib/types/builtin/async/ai-runtime/components/RuntimeCommonProvider.d.ts +0 -7
  245. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +0 -10
  246. package/lib/types/builtin/async/ai-runtime/components/ShareActions/Community.d.ts +0 -4
  247. package/lib/types/builtin/async/ai-runtime/components/ShareActions/index.d.ts +0 -2
  248. package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +0 -20
  249. package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +0 -4
  250. package/lib/types/builtin/async/ai-runtime/components/UserInfo.d.ts +0 -18
  251. package/lib/types/builtin/async/ai-runtime/constants.d.ts +0 -21
  252. package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +0 -9
  253. package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +0 -11
  254. package/lib/types/builtin/async/ai-runtime/contexts/CurrentAgent.d.ts +0 -16
  255. package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +0 -15
  256. package/lib/types/builtin/async/ai-runtime/contexts/Identity.d.ts +0 -16
  257. package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +0 -4
  258. package/lib/types/builtin/async/ai-runtime/error.d.ts +0 -4
  259. package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +0 -2
  260. package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +0 -78
  261. package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +0 -1
  262. package/lib/types/builtin/async/ai-runtime/index.d.ts +0 -36
  263. package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +0 -210
  264. package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +0 -5
  265. package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +0 -5
  266. package/lib/types/builtin/async/ai-runtime/runtime-components/AutoForm/index.d.ts +0 -7
  267. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +0 -4
  268. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.d.ts +0 -12
  269. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.d.ts +0 -4
  270. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.d.ts +0 -7
  271. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.d.ts +0 -4
  272. package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/index.d.ts +0 -4
  273. package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +0 -4
  274. package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +0 -2
  275. package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +0 -2
  276. package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +0 -5
  277. package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +0 -2
  278. package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +0 -5
  279. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +0 -3
  280. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +0 -1
  281. package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +0 -2
  282. package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +0 -2
  283. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +0 -1
  284. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.d.ts +0 -4
  285. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +0 -2
  286. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -9
  287. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +0 -2
  288. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -4
  289. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +0 -1
  290. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +0 -16
  291. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +0 -1
  292. package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +0 -6
  293. package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +0 -4
  294. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +0 -7
  295. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Output.d.ts +0 -1
  296. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +0 -1
  297. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -20
  298. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -5
  299. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +0 -3
  300. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -5
  301. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.d.ts +0 -3
  302. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +0 -3
  303. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +0 -17
  304. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/index.d.ts +0 -3
  305. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +0 -7
  306. package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +0 -12
  307. package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -14
  308. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +0 -60
  309. package/lib/types/builtin/async/ai-runtime/utils/agent-inputs.d.ts +0 -5
  310. package/lib/types/builtin/async/ai-runtime/utils/download-image.d.ts +0 -4
  311. package/lib/types/builtin/async/ai-runtime/utils/fonts.d.ts +0 -5
  312. package/lib/types/builtin/async/ai-runtime/utils/map-right.d.ts +0 -1
  313. package/lib/types/builtin/async/ai-runtime/utils/runtime-output-schema.d.ts +0 -3
  314. package/lib/types/builtin/async/ai-runtime/utils/zustand.d.ts +0 -2
  315. package/lib/types/builtin/components.d.ts +0 -1
  316. /package/lib/cjs/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
  317. /package/lib/esm/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
  318. /package/lib/types/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.d.ts → components/LanguageField/index.d.ts} +0 -0
  319. /package/lib/types/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit",
3
- "version": "0.2.433",
3
+ "version": "0.2.435",
4
4
  "description": "Pages Kit components and utils",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -92,14 +92,16 @@
92
92
  "url": "git+https://github.com/blocklet/pages-kit.git"
93
93
  },
94
94
  "dependencies": {
95
- "@arcblock/did-connect": "^2.10.46",
96
- "@blocklet/ai-kit": "^0.1.58",
97
- "@blocklet/ai-runtime": "^0.4.77",
95
+ "@arcblock/did-connect": "^2.10.47",
96
+ "@blocklet/ai-kit": "^0.1.59",
98
97
  "@blocklet/js-sdk": "^1.16.32",
99
98
  "@blocklet/sdk": "^1.16.32",
99
+ "@faker-js/faker": "^9.0.3",
100
+ "@iconify-icons/tabler": "^1.2.95",
100
101
  "@iconify/react": "^5.0.2",
101
102
  "@lottiefiles/lottie-player": "^2.0.4",
102
103
  "@types/file-saver": "^2.0.7",
104
+ "ajv": "^8.17.1",
103
105
  "axios": "^1.7.4",
104
106
  "dayjs": "^1.11.13",
105
107
  "eventsource-parser": "^2.0.1",
@@ -109,6 +111,8 @@
109
111
  "isomorphic-dompurify": "^2.14.0",
110
112
  "joi": "^17.13.3",
111
113
  "js-base64": "^3.7.7",
114
+ "json-schema-faker": "^0.5.6",
115
+ "jsonata": "^2.0.5",
112
116
  "lodash": "^4.17.21",
113
117
  "material-ui-popup-state": "^5.1.2",
114
118
  "nanoid": "^3.3.7",
@@ -119,6 +123,7 @@
119
123
  "react-helmet": "^6.1.0",
120
124
  "react-hook-form": "^7.52.2",
121
125
  "react-markdown": "^9.0.1",
126
+ "react-promise-suspense": "^0.3.4",
122
127
  "react-scroll-to-bottom": "^4.2.0",
123
128
  "react-share": "^5.1.0",
124
129
  "react-syntax-highlighter": "^15.5.0",
@@ -131,6 +136,7 @@
131
136
  },
132
137
  "peerDependencies": {
133
138
  "@arcblock/ux": "^2.8.17",
139
+ "@blocklet/ai-runtime": "^0.4.80",
134
140
  "@emotion/cache": "^11.11.0",
135
141
  "@emotion/css": "^11.11.2",
136
142
  "@emotion/react": "^11.11.1",
@@ -143,7 +149,8 @@
143
149
  "react-router-dom": "^6.16.0"
144
150
  },
145
151
  "devDependencies": {
146
- "@arcblock/ux": "^2.10.46",
152
+ "@arcblock/ux": "^2.10.47",
153
+ "@blocklet/ai-runtime": "^0.4.80",
147
154
  "@emotion/cache": "^11.13.1",
148
155
  "@emotion/css": "^11.13.0",
149
156
  "@emotion/react": "^11.13.0",
package/tsconfig.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "lib": ["DOM", "ESNext"],
7
7
  "paths": {
8
8
  // FIXME: Just for local dev, comment next line before publish
9
- // "@blocklet/ai-runtime/*": ["../../../ai-studio/packages/ai-runtime/src/*"],
9
+ // "@blocklet/ai-runtime/*": ["../../../ai-studio/packages/ai-runtime/src/*"]
10
10
  // "@blocklet/ai-kit/*": ["../../../ai-kit/packages/ai-kit/src/*"]
11
11
  }
12
12
  }
@@ -1,24 +0,0 @@
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
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAgent = getAgent;
13
- const ufo_1 = require("ufo");
14
- const constants_1 = require("../constants");
15
- const request_1 = require("./request");
16
- function getAgent(_a) {
17
- return __awaiter(this, arguments, void 0, function* ({ aid, blockletDid, working, }) {
18
- return (0, request_1.request)({
19
- blocklet: constants_1.AI_RUNTIME_DID,
20
- url: (0, ufo_1.joinURL)('/api/agents', aid),
21
- query: { working, blockletDid },
22
- });
23
- });
24
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAssetUrl = getAssetUrl;
4
- const ufo_1 = require("ufo");
5
- const request_1 = require("./request");
6
- const presets = {
7
- avatar: { w: 80 },
8
- default: { w: 1200 },
9
- };
10
- function getAssetUrl({ blockletDid, aid, filename, w, preset, }) {
11
- var _a, _b;
12
- const url = filename && aid && !(filename === null || filename === void 0 ? void 0 : filename.startsWith('http'))
13
- ? (0, ufo_1.withQuery)((0, ufo_1.joinURL)((0, request_1.getAIRuntimeApiPrefix)(), '/api/agents', aid, 'assets', filename), {
14
- blockletDid,
15
- })
16
- : filename;
17
- if (!url)
18
- return url;
19
- const width = (_b = w !== null && w !== void 0 ? w : (_a = presets[preset]) === null || _a === void 0 ? void 0 : _a.w) !== null && _b !== void 0 ? _b : presets.default.w;
20
- return (0, ufo_1.withQuery)(url, {
21
- imageFilter: width ? 'resize' : undefined,
22
- f: 'webp',
23
- w: width,
24
- });
25
- }
@@ -1,134 +0,0 @@
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
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getDataset = getDataset;
13
- exports.getDatasets = getDatasets;
14
- exports.createDataset = createDataset;
15
- exports.updateDataset = updateDataset;
16
- exports.deleteDataset = deleteDataset;
17
- exports.deleteDocument = deleteDocument;
18
- exports.getDocuments = getDocuments;
19
- exports.getDocument = getDocument;
20
- exports.createDocument = createDocument;
21
- exports.createDocumentFile = createDocumentFile;
22
- exports.updateDocument = updateDocument;
23
- const ufo_1 = require("ufo");
24
- const constants_1 = require("../constants");
25
- const request_1 = require("./request");
26
- function getDataset(_a) {
27
- return __awaiter(this, arguments, void 0, function* ({ datasetId }) {
28
- const url = (0, ufo_1.joinURL)('/api/datasets/', datasetId);
29
- const result = yield (0, request_1.request)({ blocklet: constants_1.AI_STUDIO_DID, url });
30
- if (!result)
31
- throw new Error('Collection not found!');
32
- return result;
33
- });
34
- }
35
- function getDatasets(_a) {
36
- return __awaiter(this, arguments, void 0, function* ({ appId }) {
37
- const url = (0, ufo_1.withQuery)('/api/datasets', { appId });
38
- return (0, request_1.request)({ blocklet: constants_1.AI_STUDIO_DID, url });
39
- });
40
- }
41
- function createDataset(_a) {
42
- return __awaiter(this, arguments, void 0, function* ({ appId, name, description, }) {
43
- return (0, request_1.request)({
44
- blocklet: constants_1.AI_STUDIO_DID,
45
- method: 'POST',
46
- url: '/api/datasets',
47
- body: {
48
- appId,
49
- name,
50
- description,
51
- },
52
- });
53
- });
54
- }
55
- function updateDataset(datasetId, input) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- return (0, request_1.request)({
58
- blocklet: constants_1.AI_STUDIO_DID,
59
- method: 'PUT',
60
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId),
61
- body: input,
62
- });
63
- });
64
- }
65
- function deleteDataset(datasetId) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const url = (0, ufo_1.joinURL)('/api/datasets', datasetId);
68
- return (0, request_1.request)({ blocklet: constants_1.AI_STUDIO_DID, method: 'DELETE', url });
69
- });
70
- }
71
- function deleteDocument(datasetId, documentId) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- return (0, request_1.request)({
74
- blocklet: constants_1.AI_STUDIO_DID,
75
- method: 'DELETE',
76
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents', documentId),
77
- });
78
- });
79
- }
80
- function getDocuments(datasetId) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- return (0, request_1.request)({
83
- blocklet: constants_1.AI_STUDIO_DID,
84
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents'),
85
- });
86
- });
87
- }
88
- function getDocument(datasetId, documentId) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- const result = yield (0, request_1.request)({
91
- blocklet: constants_1.AI_STUDIO_DID,
92
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents', documentId),
93
- });
94
- if (!(result === null || result === void 0 ? void 0 : result.document))
95
- throw new Error('Document not found!');
96
- return result;
97
- });
98
- }
99
- function createDocument(datasetId, type, input) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- if (type === 'file')
102
- return createDocumentFile(datasetId, input);
103
- return (0, request_1.request)({
104
- blocklet: constants_1.AI_STUDIO_DID,
105
- method: 'POST',
106
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents', type),
107
- body: input,
108
- });
109
- });
110
- }
111
- function createDocumentFile(datasetId, file) {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const form = new FormData();
114
- form.append('data', file);
115
- form.append('type', 'file');
116
- form.append('filename', file.name);
117
- return (0, request_1.request)({
118
- blocklet: constants_1.AI_STUDIO_DID,
119
- method: 'POST',
120
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents/file'),
121
- body: form,
122
- });
123
- });
124
- }
125
- function updateDocument(datasetId, documentId, type, input) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- return (0, request_1.request)({
128
- blocklet: constants_1.AI_STUDIO_DID,
129
- method: 'PUT',
130
- url: (0, ufo_1.joinURL)('/api/datasets', datasetId, 'documents', documentId, type),
131
- body: input,
132
- });
133
- });
134
- }
@@ -1,46 +0,0 @@
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
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.getMessages = getMessages;
24
- exports.deleteMessages = deleteMessages;
25
- const ufo_1 = require("ufo");
26
- const constants_1 = require("../constants");
27
- const request_1 = require("./request");
28
- function getMessages(_a) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- var { sessionId } = _a, query = __rest(_a, ["sessionId"]);
31
- return (0, request_1.request)({
32
- blocklet: constants_1.AI_RUNTIME_DID,
33
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId, 'messages'),
34
- query,
35
- });
36
- });
37
- }
38
- function deleteMessages(_a) {
39
- return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
40
- yield (0, request_1.request)({
41
- blocklet: constants_1.AI_RUNTIME_DID,
42
- method: 'DELETE',
43
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId, 'messages'),
44
- });
45
- });
46
- }
@@ -1,74 +0,0 @@
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
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.fetch = exports.getAIRuntimeApiPrefix = void 0;
24
- exports.request = request;
25
- const js_sdk_1 = require("@blocklet/js-sdk");
26
- const ufo_1 = require("ufo");
27
- const utils_1 = require("../../../utils");
28
- const constants_1 = require("../constants");
29
- const error_1 = require("../error");
30
- let isDEV = false;
31
- try {
32
- // @ts-ignore
33
- isDEV = import.meta.env.DEV;
34
- }
35
- catch (_a) {
36
- // ignore
37
- }
38
- const getAIRuntimeApiPrefix = () => window.AI_RUNTIME_API_PREFIX || (0, utils_1.getComponentMountPoint)(constants_1.AI_RUNTIME_DID);
39
- exports.getAIRuntimeApiPrefix = getAIRuntimeApiPrefix;
40
- const fetchMap = {};
41
- const getFetch = (blocklet) => {
42
- if (!fetchMap[blocklet]) {
43
- fetchMap[blocklet] = (0, js_sdk_1.createFetch)({}, { lazy: isDEV, lazyTime: 1000, componentDid: blocklet });
44
- }
45
- return fetchMap[blocklet];
46
- };
47
- const fetch = (input, _a) => {
48
- var { blocklet } = _a, init = __rest(_a, ["blocklet"]);
49
- const f = getFetch(blocklet);
50
- return f(input, init);
51
- };
52
- exports.fetch = fetch;
53
- function request(_a) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- var _b, _c, _d;
56
- var { blocklet, url, query, body } = _a, init = __rest(_a, ["blocklet", "url", "query", "body"]);
57
- const fetch = getFetch(blocklet);
58
- const result = yield fetch((0, ufo_1.withQuery)(url, query !== null && query !== void 0 ? query : {}), Object.assign(Object.assign({}, init), { headers: {
59
- 'Content-Type': 'application/json',
60
- }, body: typeof body === 'object' ? JSON.stringify(body) : body }));
61
- if (!(result.status >= 200 && result.status < 300)) {
62
- let json;
63
- try {
64
- json = yield result.json();
65
- }
66
- catch (error) {
67
- console.error('parse response error', error);
68
- }
69
- const message = (_d = (_c = (_b = json === null || json === void 0 ? void 0 : json.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : json === null || json === void 0 ? void 0 : json.message) !== null && _d !== void 0 ? _d : json === null || json === void 0 ? void 0 : json.error;
70
- throw new error_1.CustomError(result.status, typeof message === 'string' ? message : `request error ${result.status}`);
71
- }
72
- return result.json();
73
- });
74
- }
@@ -1,24 +0,0 @@
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
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createSecrets = createSecrets;
13
- const constants_1 = require("../constants");
14
- const request_1 = require("./request");
15
- function createSecrets(_a) {
16
- return __awaiter(this, arguments, void 0, function* ({ input }) {
17
- return (0, request_1.request)({
18
- blocklet: constants_1.AI_RUNTIME_DID,
19
- method: 'POST',
20
- url: '/api/secrets',
21
- body: input,
22
- });
23
- });
24
- }
@@ -1,137 +0,0 @@
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
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.getSessions = getSessions;
24
- exports.getSession = getSession;
25
- exports.createSession = createSession;
26
- exports.clearSession = clearSession;
27
- exports.updateSession = updateSession;
28
- exports.deleteSession = deleteSession;
29
- exports.runAgent = runAgent;
30
- const ufo_1 = require("ufo");
31
- const stream_1 = require("../../../stream");
32
- const constants_1 = require("../constants");
33
- const request_1 = require("./request");
34
- function getSessions(_a) {
35
- return __awaiter(this, arguments, void 0, function* ({ aid }) {
36
- return (0, request_1.request)({
37
- blocklet: constants_1.AI_RUNTIME_DID,
38
- url: '/api/sessions',
39
- query: { aid },
40
- });
41
- });
42
- }
43
- function getSession(_a) {
44
- return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
45
- return (0, request_1.request)({
46
- blocklet: constants_1.AI_RUNTIME_DID,
47
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId),
48
- });
49
- });
50
- }
51
- function createSession(_a) {
52
- return __awaiter(this, arguments, void 0, function* ({ aid, name, }) {
53
- return (0, request_1.request)({
54
- blocklet: constants_1.AI_RUNTIME_DID,
55
- method: 'POST',
56
- url: '/api/sessions',
57
- body: {
58
- aid,
59
- name,
60
- },
61
- });
62
- });
63
- }
64
- function clearSession(_a) {
65
- return __awaiter(this, arguments, void 0, function* ({ sessionId }) {
66
- return (0, request_1.request)({
67
- blocklet: constants_1.AI_RUNTIME_DID,
68
- method: 'POST',
69
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId, '/clear'),
70
- });
71
- });
72
- }
73
- function updateSession(_a) {
74
- return __awaiter(this, arguments, void 0, function* ({ sessionId, name, }) {
75
- return (0, request_1.request)({
76
- blocklet: constants_1.AI_RUNTIME_DID,
77
- method: 'PATCH',
78
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId),
79
- body: { name },
80
- });
81
- });
82
- }
83
- function deleteSession(_a) {
84
- return __awaiter(this, arguments, void 0, function* ({ sessionId, }) {
85
- return (0, request_1.request)({
86
- blocklet: constants_1.AI_RUNTIME_DID,
87
- method: 'DELETE',
88
- url: (0, ufo_1.joinURL)('/api/sessions', sessionId),
89
- });
90
- });
91
- }
92
- function runAgent(_a) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- var _b;
95
- var { responseType } = _a, input = __rest(_a, ["responseType"]);
96
- if (responseType === 'stream') {
97
- const res = yield (0, request_1.fetch)('/api/ai/call', {
98
- blocklet: constants_1.AI_RUNTIME_DID,
99
- method: 'POST',
100
- headers: {
101
- 'Content-Type': 'application/json',
102
- Accept: 'text/event-stream',
103
- },
104
- body: JSON.stringify({
105
- blockletDid: input.blockletDid,
106
- sessionId: input.sessionId,
107
- inputs: Object.assign(Object.assign({}, input.inputs), { $clientTime: new Date().toISOString() }),
108
- aid: input.aid,
109
- working: input.working,
110
- }),
111
- });
112
- if (!(res.status >= 200 && res.status < 300)) {
113
- let json;
114
- try {
115
- json = yield res.json();
116
- }
117
- catch (error) {
118
- // ignore
119
- }
120
- const message = (_b = json === null || json === void 0 ? void 0 : json.error) === null || _b === void 0 ? void 0 : _b.message;
121
- if (typeof message === 'string') {
122
- throw new Error(message);
123
- }
124
- throw new Error(`Unknown Error: ${res.status}`);
125
- }
126
- return res
127
- .body.pipeThrough(new TextDecoderStream())
128
- .pipeThrough(new stream_1.EventSourceParserStream());
129
- }
130
- return (0, request_1.request)({
131
- blocklet: constants_1.AI_RUNTIME_DID,
132
- method: 'POST',
133
- url: (0, ufo_1.joinURL)('/api/ai/call'),
134
- body: input,
135
- });
136
- });
137
- }
@@ -1,62 +0,0 @@
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
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.default = ActionButton;
27
- const jsx_runtime_1 = require("react/jsx-runtime");
28
- const react_1 = require("@iconify/react");
29
- const material_1 = require("@mui/material");
30
- const react_2 = require("react");
31
- const LoadingButton_1 = __importDefault(require("./LoadingButton"));
32
- function ActionButton(_a) {
33
- var { tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement = 'top' } = _a, props = __rest(_a, ["tip", "tipSucceed", "title", "titleSucceed", "icon", "iconSucceed", "autoReset", "placement"]);
34
- const [active, setActive] = (0, react_2.useState)(false);
35
- const [error, setError] = (0, react_2.useState)();
36
- const timer = (0, react_2.useRef)();
37
- const onClose = () => {
38
- setError(undefined);
39
- if (autoReset) {
40
- timer.current = window.setTimeout(() => {
41
- setActive(false);
42
- }, 3000);
43
- }
44
- };
45
- const onOpen = () => {
46
- clearTimeout(timer.current);
47
- };
48
- const realIcon = active ? iconSucceed : icon;
49
- const toolTipTitleText = error ? (0, jsx_runtime_1.jsx)(material_1.Box, { color: "error", children: error.message }) : (active && tipSucceed) || tip;
50
- const buttonText = active ? titleSucceed : title;
51
- return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: toolTipTitleText, disableInteractive: true, placement: placement, onClose: onClose, onOpen: onOpen, children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)(LoadingButton_1.default, Object.assign({ startIcon: realIcon && (typeof realIcon === 'string' ? (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: realIcon }) : realIcon), loadingPosition: realIcon ? 'start' : undefined }, props, { onClick: (e) => __awaiter(this, void 0, void 0, function* () {
52
- if (!props.onClick)
53
- return;
54
- try {
55
- yield props.onClick(e);
56
- setActive(true);
57
- }
58
- catch (error) {
59
- setError(error);
60
- }
61
- }), children: buttonText })) }) }));
62
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = AgentErrorBoundary;
4
- exports.AgentErrorView = AgentErrorView;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const api_1 = require("@blocklet/ai-kit/api");
7
- const components_1 = require("@blocklet/ai-kit/components");
8
- const material_1 = require("@mui/material");
9
- const react_error_boundary_1 = require("react-error-boundary");
10
- const locale_1 = require("../../../locale");
11
- const use_agent_admin_1 = require("../hooks/use-agent-admin");
12
- const runtime_1 = require("../state/runtime");
13
- const AgentSettingsDialog_1 = require("./AgentSettings/AgentSettingsDialog");
14
- function AgentErrorBoundary({ children }) {
15
- return (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: AgentErrorView, children: children });
16
- }
17
- function AgentErrorView({ error }) {
18
- if (error.type === 'MissingSecretError') {
19
- return (0, jsx_runtime_1.jsx)(MissingSecretErrorView, {});
20
- }
21
- if (error.type === api_1.SubscriptionErrorType.UNSUBSCRIBED) {
22
- return (0, jsx_runtime_1.jsx)(components_1.SubscribeErrorAlert, { error: error });
23
- }
24
- return (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "error", children: String(error === null || error === void 0 ? void 0 : error.message) });
25
- }
26
- function MissingSecretErrorView() {
27
- const { t } = (0, locale_1.useLocaleContext)();
28
- const { agent } = (0, runtime_1.useRuntimeState)();
29
- const isAdmin = (0, use_agent_admin_1.useIsAgentAdmin)(agent);
30
- const allSecretsHasValue = agent.config.secrets.every((i) => i.hasValue);
31
- return ((0, jsx_runtime_1.jsx)(material_1.Alert, { severity: allSecretsHasValue ? 'info' : 'error', sx: { [`.${material_1.alertClasses.message}`]: { flex: 1 } }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { width: "100%", children: [allSecretsHasValue
32
- ? 'Configuration successful, you can continue to use it now!'
33
- : 'The required configuration is missing. Please complete the setup before proceeding!', isAdmin && ((0, jsx_runtime_1.jsx)(material_1.Stack, { alignItems: "flex-end", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "outlined", onClick: () => AgentSettingsDialog_1.settingsDialogState.getState().open(), children: t('setup') }) }))] }) }));
34
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const jsx_runtime_1 = require("react/jsx-runtime");
15
- const material_1 = require("@mui/material");
16
- const react_1 = require("react");
17
- const BooleanField = (0, react_1.forwardRef)((_a, ref) => {
18
- var { readOnly, parameter, onChange } = _a, props = __rest(_a, ["readOnly", "parameter", "onChange"]);
19
- return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { sx: { alignItems: 'flex-start' }, children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { ref: ref, required: parameter === null || parameter === void 0 ? void 0 : parameter.required, label: props.label || (parameter === null || parameter === void 0 ? void 0 : parameter.label), labelPlacement: "start", control: (0, jsx_runtime_1.jsx)(material_1.Switch, { readOnly: readOnly, checked: !!props.value, onChange: (_, checked) => onChange(checked) }) }), (parameter === null || parameter === void 0 ? void 0 : parameter.helper) && (0, jsx_runtime_1.jsx)(material_1.FormHelperText, { children: parameter === null || parameter === void 0 ? void 0 : parameter.helper })] }));
20
- });
21
- exports.default = BooleanField;