@blocklet/pages-kit 0.2.433 → 0.2.434

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
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { parseIdentity, stringifyIdentity } from '@blocklet/ai-runtime/common/aid';
3
- import { createContext, useContext, useMemo } from 'react';
4
- import { useAgentState } from '../state/agent';
5
- import { useRuntimeState } from '../state/runtime';
6
- function useCurrentAid({ agentId }) {
7
- const { aid } = useRuntimeState();
8
- return useMemo(() => ({
9
- aid: stringifyIdentity(Object.assign(Object.assign({}, parseIdentity(aid, { rejectWhenError: true })), { agentId })),
10
- }), [aid, agentId]);
11
- }
12
- const context = createContext(undefined);
13
- export default function CurrentAgentProvider({ agentId, children }) {
14
- const state = useCurrentAid({ agentId });
15
- return _jsx(context.Provider, { value: state, children: children });
16
- }
17
- export function useCurrentAgent(args = {}) {
18
- const { blockletDid, aid: runtimeAid, working } = useRuntimeState();
19
- const aidFromParam = useMemo(() => args.aid ||
20
- (args.agentId
21
- ? stringifyIdentity(Object.assign(Object.assign({}, parseIdentity(runtimeAid, { rejectWhenError: true })), { agentId: args.agentId }))
22
- : undefined), [args.agentId, args.aid, runtimeAid]);
23
- const current = useContext(context);
24
- const aid = aidFromParam !== null && aidFromParam !== void 0 ? aidFromParam : current === null || current === void 0 ? void 0 : current.aid;
25
- if (!aid) {
26
- throw new Error('No such current agent state. You should use `useCurrentAgent` within the `CurrentAgentProvider`');
27
- }
28
- const [agent] = useAgentState({ blockletDid, aid, working });
29
- return { aid, agent };
30
- }
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo } from 'react';
3
- const context = createContext(undefined);
4
- export default function CurrentMessageProvider({ message, children }) {
5
- const state = useMemo(() => ({ message }), [message]);
6
- return _jsx(context.Provider, { value: state, children: children });
7
- }
8
- export function useCurrentMessage({ optional } = {}) {
9
- const current = useContext(context);
10
- if (!optional && !current) {
11
- throw new Error('No such message state. You should use `useCurrentMessage` within the `CurrentMessageProvider`');
12
- }
13
- return current;
14
- }
@@ -1,28 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo } from 'react';
3
- import { useSearchParams } from 'react-router-dom';
4
- import RuntimeCommonProvider from '../components/RuntimeCommonProvider';
5
- import { CustomError } from '../error';
6
- const identityContext = createContext(undefined);
7
- export function useIdentityContext() {
8
- const context = useContext(identityContext);
9
- if (!context) {
10
- throw new Error('No such runtime context. You should use `useRuntimeContext` within the `RuntimeProvider`');
11
- }
12
- return context;
13
- }
14
- export default function IdentityProvider({ blockletDid, aid, working, children, }) {
15
- if (!aid)
16
- throw new Error('Missing required props `aid`');
17
- const value = useMemo(() => ({ blockletDid, aid, working }), [blockletDid, aid, working]);
18
- return (_jsx(RuntimeCommonProvider, { children: _jsx(identityContext.Provider, { value: value, children: children }) }));
19
- }
20
- export function IdentityProviderFromUrl({ children }) {
21
- const [query] = useSearchParams();
22
- const aid = query.get('aid');
23
- const blockletDid = query.get('blockletDid') || undefined;
24
- const working = query.get('working') === 'true';
25
- if (!aid)
26
- throw new CustomError(404, 'Missing required query parameters `aid`');
27
- return (_jsx(IdentityProvider, { blockletDid: blockletDid, aid: aid, working: working, children: children }));
28
- }
@@ -1,22 +0,0 @@
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 } from "react/jsx-runtime";
13
- import ThemeProvider from '../components/ThemeProvider';
14
- import IdentityProvider, { IdentityProviderFromUrl } from './Identity';
15
- export default function RuntimeProvider(_a) {
16
- var props = __rest(_a, []);
17
- return (_jsx(IdentityProvider, Object.assign({}, props, { children: _jsx(ThemeProvider, { children: props.children }) })));
18
- }
19
- export function RuntimeProviderFromUrl(_a) {
20
- var props = __rest(_a, []);
21
- return (_jsx(IdentityProviderFromUrl, Object.assign({}, props, { children: _jsx(ThemeProvider, { children: props.children }) })));
22
- }
@@ -1,6 +0,0 @@
1
- export class CustomError extends Error {
2
- constructor(status, message) {
3
- super(message);
4
- this.status = status;
5
- }
6
- }
@@ -1,10 +0,0 @@
1
- import { useSessionContext } from '../../../session';
2
- const ADMIN_ROLES = ['admin', 'owner'];
3
- export function useIsAgentAdmin(agent) {
4
- const { session } = useSessionContext();
5
- if (!session.user)
6
- return false;
7
- if (ADMIN_ROLES.includes(session.user.role))
8
- return true;
9
- return session.user.did === agent.createdBy || session.user.did === agent.project.createdBy;
10
- }
@@ -1,103 +0,0 @@
1
- import { RuntimeOutputVariable } from '@blocklet/ai-runtime/types';
2
- import { useMemo } from 'react';
3
- import { joinURL, withQuery } from 'ufo';
4
- import { getComponentMountPoint } from '../../../utils';
5
- import { AI_RUNTIME_DID, DEFAULT_INPUT_COMPONENT_ID, DEFAULT_OUTPUT_COMPONENT_ID, DEFAULT_PAGE_COMPONENT_ID, } from '../constants';
6
- import { useCurrentAgent } from '../contexts/CurrentAgent';
7
- import { useRuntimeState } from '../state/runtime';
8
- import { getOutputVariableInitialValue } from '../utils/runtime-output-schema';
9
- export default function useAppearances(args) {
10
- const { agent: runtimeAgent } = useRuntimeState();
11
- const { agent } = useCurrentAgent(args);
12
- const appearancePage = useMemo(() => {
13
- var _a, _b, _c, _d;
14
- const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.appearancePage)) === null || _b === void 0 ? void 0 : _b.appearance;
15
- if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
16
- return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
17
- const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === RuntimeOutputVariable.appearancePage)) === null || _d === void 0 ? void 0 : _d.appearance;
18
- if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
19
- return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
20
- return {
21
- componentId: DEFAULT_PAGE_COMPONENT_ID,
22
- };
23
- }, [agent]);
24
- const appearanceInput = useMemo(() => {
25
- var _a, _b, _c, _d;
26
- const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.appearanceInput)) === null || _b === void 0 ? void 0 : _b.appearance;
27
- if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
28
- return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
29
- const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === RuntimeOutputVariable.appearanceInput)) === null || _d === void 0 ? void 0 : _d.appearance;
30
- if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
31
- return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
32
- return {
33
- componentId: DEFAULT_INPUT_COMPONENT_ID,
34
- };
35
- }, [agent, runtimeAgent]);
36
- const appearanceOutput = useMemo(() => {
37
- var _a, _b, _c, _d;
38
- const appearance = (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === RuntimeOutputVariable.appearanceOutput)) === null || _b === void 0 ? void 0 : _b.appearance;
39
- if (appearance === null || appearance === void 0 ? void 0 : appearance.componentId)
40
- return Object.assign(Object.assign({}, appearance), { componentId: appearance.componentId });
41
- const runtimeAppearance = (_d = (_c = runtimeAgent.outputVariables) === null || _c === void 0 ? void 0 : _c.find((i) => i.name === RuntimeOutputVariable.appearanceOutput)) === null || _d === void 0 ? void 0 : _d.appearance;
42
- if (runtimeAppearance === null || runtimeAppearance === void 0 ? void 0 : runtimeAppearance.componentId)
43
- return Object.assign(Object.assign({}, runtimeAppearance), { componentId: runtimeAppearance.componentId });
44
- return {
45
- componentId: DEFAULT_OUTPUT_COMPONENT_ID,
46
- };
47
- }, [agent, runtimeAgent]);
48
- return { appearancePage, appearanceInput, appearanceOutput };
49
- }
50
- function getProjectIconUrl({ blockletDid, aid }) {
51
- return withQuery(joinURL(window.location.origin, getComponentMountPoint(AI_RUNTIME_DID), '/api/agents', aid, '/logo'), { blockletDid });
52
- }
53
- export function useProfile(args) {
54
- const { blockletDid, aid, agent: runtimeAgent } = useRuntimeState();
55
- const { agent } = useCurrentAgent(args);
56
- return useMemo(() => {
57
- const profile = getOutputVariableInitialValue(agent, RuntimeOutputVariable.profile);
58
- const runtimeProfile = getOutputVariableInitialValue(runtimeAgent, RuntimeOutputVariable.profile);
59
- return {
60
- avatar: (profile === null || profile === void 0 ? void 0 : profile.avatar) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.avatar) || getProjectIconUrl({ blockletDid, aid }),
61
- name: (profile === null || profile === void 0 ? void 0 : profile.name) || (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.name) || runtimeAgent.name || runtimeAgent.project.name,
62
- description: (profile === null || profile === void 0 ? void 0 : profile.description) ||
63
- (runtimeProfile === null || runtimeProfile === void 0 ? void 0 : runtimeProfile.description) ||
64
- runtimeAgent.description ||
65
- runtimeAgent.project.description,
66
- };
67
- }, [agent, runtimeAgent]);
68
- }
69
- export function useOpeningMessage(args) {
70
- const { aid: runtimeAid, agent: runtimeAgent } = useRuntimeState();
71
- const runtimeProfile = useProfile({ aid: runtimeAid });
72
- const { agent } = useCurrentAgent(args);
73
- const profile = useProfile(args);
74
- return useMemo(() => {
75
- const agentOpening = getOutputVariableInitialValue(agent, RuntimeOutputVariable.openingMessage);
76
- if (agentOpening === null || agentOpening === void 0 ? void 0 : agentOpening.message) {
77
- return {
78
- agent,
79
- message: agentOpening.message,
80
- profile,
81
- };
82
- }
83
- const runtimeOpening = getOutputVariableInitialValue(runtimeAgent, RuntimeOutputVariable.openingMessage);
84
- if (runtimeOpening === null || runtimeOpening === void 0 ? void 0 : runtimeOpening.message) {
85
- return {
86
- agent: runtimeAgent,
87
- message: runtimeOpening.message,
88
- profile: runtimeProfile,
89
- };
90
- }
91
- return undefined;
92
- }, [agent, profile, runtimeAgent, runtimeProfile]);
93
- }
94
- export function useOpeningQuestions(args) {
95
- const { agent } = useCurrentAgent(args);
96
- return useMemo(() => {
97
- var _a, _b;
98
- const questions = (_b = (_a = getOutputVariableInitialValue(agent, RuntimeOutputVariable.openingQuestions)) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.filter((i) => !!i.title);
99
- if (!(questions === null || questions === void 0 ? void 0 : questions.length))
100
- return undefined;
101
- return { questions };
102
- }, [agent]);
103
- }
@@ -1,44 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- import { Icon } from '@iconify/react';
12
- import { IconButton, ListItemIcon, MenuItem } from '@mui/material';
13
- import { useLocaleContext } from '../../../locale';
14
- import { useHeader } from '../../../page/header';
15
- import { settingsDialogState } from '../components/AgentSettings/AgentSettingsDialog';
16
- import PopperMenuButton from '../components/PopperMenuButton';
17
- import LoadingMenuItem from '../components/PopperMenuButton/LoadingMenuItem';
18
- import SocialShare from '../components/SocialShare';
19
- import { useComponentPreferences } from '../contexts/ComponentPreferences';
20
- import { useRuntimeState } from '../state/runtime';
21
- import { useSessionState } from '../state/session';
22
- import { useIsAgentAdmin } from './use-agent-admin';
23
- export function useHeaderMenu() {
24
- var _a, _b, _c;
25
- const { t, locale } = useLocaleContext();
26
- const { hideHeaderMenuButton } = (_a = useComponentPreferences()) !== null && _a !== void 0 ? _a : {};
27
- const clearSession = useSessionState((s) => s.clearSession);
28
- const { agent } = useRuntimeState();
29
- const isAdmin = useIsAgentAdmin(agent);
30
- const hasSettings = agent.config.secrets.length > 0;
31
- const shareContent = ((_b = agent.project) === null || _b === void 0 ? void 0 : _b.name) ? `${agent.project.name}\n\n${(_c = agent.project) === null || _c === void 0 ? void 0 : _c.description}` : '';
32
- useHeader(() => hideHeaderMenuButton
33
- ? {}
34
- : {
35
- addons: (exists) => [
36
- _jsx(PopperMenuButton, { "data-testid": "aigne-runtime-header-menu-button", component: IconButton, PopperProps: { placement: 'bottom-end', sx: { zIndex: 'appBar' } }, menus: [
37
- hasSettings && isAdmin && (_jsxs(MenuItem, { onClick: () => settingsDialogState.getState().open(), children: [_jsx(ListItemIcon, { children: _jsx(Icon, { icon: "tabler:settings" }) }), t('settings')] }, "settings")),
38
- _jsxs(LoadingMenuItem, { onClick: () => __awaiter(this, void 0, void 0, function* () { return clearSession(); }), children: [_jsx(ListItemIcon, { children: _jsx(Icon, { icon: "mingcute:broom-line" }) }), t('clearSession')] }, "clearSession"),
39
- ], children: _jsx(Icon, { icon: "tabler:dots" }) }),
40
- _jsx(SocialShare, { "data-testid": "aigen-runtime-header-share-button", content: shareContent }),
41
- ...exists,
42
- ],
43
- }, [locale, hideHeaderMenuButton]);
44
- }
@@ -1,37 +0,0 @@
1
- export { runAgent } from './api/session';
2
- export { default as AgentErrorBoundary } from './components/AgentErrorBoundary';
3
- export * from './components/AgentErrorBoundary';
4
- export * from './contexts/Runtime';
5
- export { default as RuntimeProvider } from './contexts/Runtime';
6
- export * from './contexts/ComponentPreferences';
7
- export { default as ComponentPreferencesProvider } from './contexts/ComponentPreferences';
8
- export * from './contexts/CurrentAgent';
9
- export { default as CurrentAgentProvider } from './contexts/CurrentAgent';
10
- export * from './contexts/CurrentMessage';
11
- export { default as CurrentMessageProvider } from './contexts/CurrentMessage';
12
- export * from './contexts/ActiveAgent';
13
- export { default as ActiveAgentProvider } from './contexts/ActiveAgent';
14
- export { default as useAppearances } from './hooks/use-appearances';
15
- export * from './hooks/use-appearances';
16
- export * from './state/runtime';
17
- export * from './state/session';
18
- export { default as Runtime } from './runtime/Runtime';
19
- export { default as ChatBotButton } from './runtime/ChatBotButton';
20
- export { default as SimplePage } from './runtime-components/SimplePage';
21
- export { default as SimpleChat } from './runtime-components/SimpleChat';
22
- export { default as PhotoGallery } from './runtime-components/PhotoGallery';
23
- export { default as AutoForm } from './runtime-components/AutoForm';
24
- export { default as SimpleOutput } from './runtime-components/SimpleOutput';
25
- export { default as ChatOutput } from './runtime-components/ChatOutput';
26
- export { default as PhotoGalleryItem } from './runtime-components/PhotoGalleryItem';
27
- export { default as SuggestedQuestionsView } from './runtime-components/SuggestedQuestionsView';
28
- export { default as ReferencedLinksView } from './runtime-components/ReferencedLinksView';
29
- export { default as ShareView } from './runtime-components/ShareView';
30
- export { default as OpeningQuestionsView } from './runtime-components/OpeningQuestionsView';
31
- export { default as ImagesView } from './runtime-components/ImagesView';
32
- export { default as GoogleSearchRelatedQuestionsView } from './runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView';
33
- export { default as GoogleSearchSourcesView } from './runtime-components/GoogleSearch/GoogleSearchSourcesView';
34
- export { default as MarkdownView } from './runtime-components/MarkdownView';
35
- export { default as NFTDisplay } from '@arcblock/ux/lib/NFTDisplay';
36
- // only use to debug, should be removed when PR
37
- export * from './runtime-components/V0';
@@ -1,234 +0,0 @@
1
- export const translations = {
2
- en: {
3
- by: 'By',
4
- socialShare: {
5
- title: 'Share',
6
- shareToX: 'Share to X',
7
- shareToTelegram: 'Share to Telegram',
8
- shareToReddit: 'Share to Reddit',
9
- shareToWeibo: 'Share to Weibo',
10
- shareToFacebook: 'Share to Facebook',
11
- shareToLinkedin: 'Share to Linkedin',
12
- copyLink: 'Copy Link',
13
- shareToCommunity: 'Share to ArcBlock Community',
14
- },
15
- photoWall: {
16
- dialog: {
17
- title: 'AI Art Image',
18
- prompt: 'Prompt',
19
- metadata: 'Metadata',
20
- author: 'Author',
21
- time: 'Creation Time',
22
- },
23
- },
24
- questionPlaceholder: 'Ask Anything...',
25
- parameters: 'Parameters',
26
- parametersTitle: 'Tell me what do you want?',
27
- parametersSetting: 'Setting',
28
- clearSession: 'Clear Session',
29
- generate: 'Generate',
30
- startChat: 'Start Chat',
31
- collections: 'Collections',
32
- collection: 'Collection',
33
- collectionName: 'Collection Name',
34
- document: 'Document',
35
- rename: 'Rename',
36
- delete: 'Delete',
37
- confirmDelete: 'Confirm Delete?',
38
- confirm: 'Confirm',
39
- noData: 'No {data} yet',
40
- createObject: 'Create {object}',
41
- title: 'Title',
42
- titlePlaceholder: 'Title',
43
- content: 'Content',
44
- contentPlaceholder: 'Write anything...',
45
- cancel: 'Cancel',
46
- save: 'Save',
47
- saved: 'Saved',
48
- edit: 'Edit',
49
- chat: 'Chat',
50
- subscribeNow: 'Subscribe Now',
51
- subscribe: 'Subscribe',
52
- subscribed: 'Subscribed',
53
- requireNewSubscription: `Thank you for using our service!
54
-
55
- To get more features and exclusive content, please subscribe to our service. After subscribing, you will enjoy the following privileges:
56
-
57
- - Unlock all features and tools
58
- - Support us to continue to provide quality services
59
-
60
- Pricing: {price} ABT/Message
61
-
62
- Subscribe now to unlock more possibilities!`,
63
- requireNewSubscriptionFooter: 'You need to subscribe to access this feature:',
64
- thanksForSubscription: 'Thanks for subscribing, now you can start enjoying it!',
65
- requireLogin: `Thank you for using our service!
66
-
67
- In order to use our service properly, please click below to log in now!
68
- `,
69
- thanksForLogin: 'Now you can start experiencing it to the fullest!',
70
- loginNow: 'Login Now',
71
- clickTheButton: 'Click The Button 👉',
72
- cleanSessionTip: 'Clean conversation messages',
73
- poweredBy: 'Powered by',
74
- selectPromptToStart: 'Select a prompt to get started',
75
- history: 'History',
76
- unnamed: 'Unnamed',
77
- newObject: 'New {object}',
78
- editObject: 'Edit {object}',
79
- name: 'Name',
80
- description: 'Description',
81
- create: 'Create',
82
- back: 'Back',
83
- unauthorized: 'Unauthorized',
84
- unauthorizedDescription: 'Please log in to visit this page',
85
- login: 'Login',
86
- copy: 'Copy',
87
- copied: 'Copied',
88
- copyToClipboard: 'Copy to clipboard',
89
- saveToNoteTip: 'Save to collection',
90
- saveToNote: 'Save',
91
- savedToNote: 'Saved as a new document',
92
- uploadFile: 'Upload File',
93
- submit: 'Submit',
94
- send: 'Send',
95
- session: 'Session',
96
- loadMore: 'Load More',
97
- v0: {
98
- title: 'Mock 0',
99
- description: 'Mock 0 is an AI-based code tool that can help you generate code quickly.',
100
- noData: 'No conversation information yet, click the button below to start generating!',
101
- deleteSessionTitle: 'Delete Conversation Information',
102
- deleteSessionTip: 'Are you sure you want to delete this Conversation Information?',
103
- propertiesSetting: 'Properties Setting',
104
- propertiesSettingTip: 'This function is used for debugging components and does not affect the final code',
105
- cannotSetPropertiesTip: 'Failed to parse PROPERTIES_SCHEMA, this code cannot be set properties',
106
- codePreview: 'Code Preview',
107
- codePreviewTip: 'Here is the code preview, you can view the generated code, and editing is not supported yet.',
108
- hideSlider: 'Hide Versions',
109
- showSlider: 'Show Versions',
110
- retryTip: 'Agent not enough power, please try again later...',
111
- retry: 'Try Again',
112
- errorCodeTip: 'Agent found some syntax errors in the code, and want to try again...',
113
- },
114
- settings: 'Settings',
115
- setup: 'Setup',
116
- docLink: 'Document Link',
117
- },
118
- zh: {
119
- by: '作者',
120
- socialShare: {
121
- title: '分享',
122
- shareToX: '分享到 X',
123
- shareToTelegram: '分享到 Telegram',
124
- shareToReddit: '分享到 Reddit',
125
- shareToWeibo: '分享到 微博',
126
- shareToFacebook: '分享到 Facebook',
127
- shareToLinkedin: '分享到 Linkedin',
128
- copyLink: '复制链接',
129
- shareToCommunity: '分享到 ArcBlock 社区',
130
- },
131
- photoWall: {
132
- dialog: {
133
- title: 'AI 艺术图片',
134
- prompt: '提示词',
135
- metadata: '元数据',
136
- author: '作者',
137
- time: '创作时间',
138
- },
139
- },
140
- questionPlaceholder: '问点什么...',
141
- parameters: '参数',
142
- parametersTitle: '告诉我你想要什么?',
143
- parametersSetting: '设置',
144
- clearSession: '清空会话',
145
- generate: '生成',
146
- startChat: '开始对话',
147
- collections: '知识库',
148
- collection: '知识库',
149
- collectionName: '知识库名称',
150
- document: '文档',
151
- rename: '重命名',
152
- delete: '删除',
153
- confirmDelete: '确定删除?',
154
- confirm: '确定',
155
- noData: '暂无{data}',
156
- createObject: '创建{object}',
157
- title: '标题',
158
- titlePlaceholder: '标题',
159
- content: '内容',
160
- contentPlaceholder: '写点什么吧...',
161
- cancel: '取消',
162
- save: '保存',
163
- saved: '已保存',
164
- edit: '编辑',
165
- chat: '对话',
166
- subscribeNow: '立即订阅',
167
- subscribe: '订阅',
168
- subscribed: '已订阅',
169
- requireNewSubscription: `感谢您使用我们的服务!
170
-
171
- 为了获得更多功能和专属内容,请订阅我们的服务。订阅后,您将享有以下特权:
172
-
173
- - 解锁全部功能和工具
174
- - 支持我们持续提供优质服务
175
-
176
- 价格: {price} ABT/次对话
177
-
178
- 立即订阅以解锁更多可能性!`,
179
- requireNewSubscriptionFooter: '您需要订阅才能访问此功能:',
180
- thanksForSubscription: '感谢您的订阅,现在,您可以开始尽情体验了!',
181
- requireLogin: `感谢您使用我们的服务!
182
-
183
- 为了能正常使用我们的服务,请点击下方立即登录!
184
- `,
185
- thanksForLogin: '现在,您可以开始尽情体验了!',
186
- loginNow: '立即登录',
187
- clickTheButton: '点我生成 👉',
188
- cleanSessionTip: '清除会话消息记录',
189
- poweredBy: '技术支持来自',
190
- selectPromptToStart: '选择一个提示词开始吧',
191
- history: '历史记录',
192
- unnamed: '未命名',
193
- newObject: '新建{object}',
194
- editObject: '编辑{object}',
195
- name: '名称',
196
- description: '描述',
197
- create: '创建',
198
- back: '返回',
199
- unauthorized: '未登录',
200
- unauthorizedDescription: '请登录后访问该页面',
201
- login: '登录',
202
- copy: '复制',
203
- copied: '已复制',
204
- copyToClipboard: '复制到剪贴板',
205
- saveToNoteTip: '保存到知识库',
206
- saveToNote: '保存',
207
- savedToNote: '已保存到知识库',
208
- uploadFile: '上传文件',
209
- submit: '提交',
210
- send: '发送',
211
- session: '会话',
212
- loadMore: '加载更多',
213
- v0: {
214
- title: 'Mock 0',
215
- description: 'Mock 0 是一个基于人工智能的代码工具,可以帮助您快速生成代码。',
216
- noData: '暂无生成记录,点击下方按钮开始生成吧!',
217
- deleteSessionTitle: '删除生成记录',
218
- deleteSessionTip: '确定要删除此生成记录吗?',
219
- propertiesSetting: '属性设置',
220
- propertiesSettingTip: '此功能用于调试组件,不影响最终代码',
221
- cannotSetPropertiesTip: '解析 PROPERTIES_SCHEMA 失败,此代码无法进行属性设置',
222
- codePreview: '代码预览',
223
- codePreviewTip: '以下是代码预览,您可以查看生成的代码,目前还不支持编辑。',
224
- hideSlider: '隐藏版本历史',
225
- showSlider: '显示版本历史',
226
- retryTip: 'Agent 算力不足,请稍后重试...',
227
- retry: '重试',
228
- errorCodeTip: 'Agent 发现代码存在一些语法问题,请求重试...',
229
- },
230
- settings: '设置',
231
- setup: '设置',
232
- docLink: '文档链接',
233
- },
234
- };
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- import { Icon } from '@iconify/react';
12
- import { ArrowBackIosNewRounded } from '@mui/icons-material';
13
- import { Box, Button, CircularProgress, ClickAwayListener, Dialog, DialogContent, DialogTitle, Fab, Grow, IconButton, ListItemIcon, Popper, Stack, Typography, useMediaQuery, useTheme, } from '@mui/material';
14
- import { Suspense, useRef, useState } from 'react';
15
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
16
- import { Avatar } from '../../../../arcblock/ux';
17
- import { useLocaleContext } from '../../../../locale';
18
- import PopperMenuButton from '../../components/PopperMenuButton';
19
- import LoadingMenuItem from '../../components/PopperMenuButton/LoadingMenuItem';
20
- import ScrollView from '../../components/ScrollView';
21
- import { DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
22
- import ActiveAgentProvider from '../../contexts/ActiveAgent';
23
- import RuntimeProvider from '../../contexts/Runtime';
24
- import useAppearances, { useProfile } from '../../hooks/use-appearances';
25
- import { useRuntimeState } from '../../state/runtime';
26
- import { useAutoLoadSessionState, useSessionState } from '../../state/session';
27
- export default function ChatBotButton({ aid, working }) {
28
- return (_jsx(RuntimeProvider, { aid: aid, working: working, children: _jsx(ActiveAgentProvider, { children: _jsx(ChatBotContent, {}) }) }));
29
- }
30
- function ChatBotContent() {
31
- var _a, _b;
32
- const anchorEl = useRef(null);
33
- useAutoLoadSessionState();
34
- const { aid } = useRuntimeState();
35
- const { appearancePage } = useAppearances({ aid });
36
- const profile = useProfile({ aid });
37
- const [open, setOpen] = useState(false);
38
- const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : DEFAULT_PAGE_COMPONENT_ID;
39
- return (_jsxs(Box, { sx: { position: 'fixed', bottom: 32, right: 16, zIndex: 'modal' }, children: [_jsx(Fab, { sx: { width: 44, height: 44, boxShadow: open ? 0 : undefined }, onClick: () => setOpen(true), children: _jsx(Avatar, { size: 44, did: (_b = globalThis.blocklet) === null || _b === void 0 ? void 0 : _b.appId, variant: "circle", shape: "circle",
40
- // @ts-ignore
41
- src: profile.avatar }) }), _jsx(Stack, { width: "100%", ref: anchorEl }), anchorEl.current && (_jsx(ResponsiveChatBotContainer, { anchorEl: anchorEl.current, open: open, onClose: () => setOpen(false), children: _jsx(ScrollView, { initialScrollBehavior: "auto", component: Stack, sx: {
42
- overscrollBehavior: 'contain',
43
- height: '100%',
44
- width: '100%',
45
- overflow: 'auto',
46
- '.aigne-layout': {
47
- px: 2,
48
- },
49
- }, children: _jsx(Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: _jsx(CustomComponentRenderer, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProperties, props: { scrollViewProps: { disabled: true }, hideHeaderMenuButton: true } }) }) }) }))] }));
50
- }
51
- function ResponsiveChatBotContainer({ open, anchorEl, children, onClose, }) {
52
- const theme = useTheme();
53
- const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
54
- const { aid } = useRuntimeState();
55
- const profile = useProfile({ aid });
56
- if (isMobile) {
57
- return (_jsx(ChatBotDialog, { title: profile.name, open: open, onClose: onClose, children: children }));
58
- }
59
- return (_jsx(ChatBotPopper, { anchorEl: anchorEl, title: profile.name, open: open, onClose: onClose, children: children }));
60
- }
61
- function ChatBotPopper({ title, anchorEl, open, children, onClose, }) {
62
- return (_jsx(Popper, { anchorEl: anchorEl, open: open, disablePortal: true, placement: "top-end", transition: true, sx: {
63
- zIndex: 'modal',
64
- maxWidth: 500,
65
- maxHeight: 'min(calc(100vh - 128px), 1000px)',
66
- width: 500,
67
- height: '90vh',
68
- }, children: ({ TransitionProps }) => (_jsx(ClickAwayListener, { onClickAway: (e) => {
69
- e.preventDefault();
70
- e.stopPropagation();
71
- onClose === null || onClose === void 0 ? void 0 : onClose();
72
- }, children: _jsx(Grow, Object.assign({}, TransitionProps, { style: { transformOrigin: 'right bottom' }, timeout: 350, children: _jsxs(Stack, { sx: {
73
- height: '100%',
74
- boxShadow: 1,
75
- position: 'relative',
76
- background: 'white',
77
- borderRadius: 1,
78
- }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", borderBottom: 1, borderColor: "divider", p: 2, gap: 2, children: [_jsx(Typography, { variant: "h6", noWrap: true, sx: { flex: 1, width: 1 }, children: title }), _jsx(ChatMenuButton, {}), _jsx(Button, { sx: { minWidth: 28, minHeight: 28, p: 0 }, onClick: onClose, children: _jsx(Icon, { icon: "tabler:x", fontSize: 24, color: "rgba(75, 85, 99, 1)" }) })] }), children] }) })) })) }));
79
- }
80
- function ChatBotDialog({ title, open, children, onClose, }) {
81
- return (_jsxs(Dialog, { open: open, onClose: onClose, fullScreen: true, children: [_jsx(DialogTitle, { sx: { px: 1 }, children: _jsxs(Stack, { direction: "row", alignItems: "center", gap: 2, children: [_jsx(IconButton, { size: "small", onClick: onClose, children: _jsx(ArrowBackIosNewRounded, { fontSize: "inherit" }) }), _jsx(Typography, { variant: "h6", noWrap: true, sx: { flex: 1, width: 1 }, children: title }), _jsx(ChatMenuButton, {})] }) }), _jsx(DialogContent, { sx: { p: 0 }, dividers: true, children: children })] }));
82
- }
83
- function ChatMenuButton() {
84
- const { t } = useLocaleContext();
85
- const clearSession = useSessionState((s) => s.clearSession);
86
- return (_jsx(PopperMenuButton, { component: IconButton, PopperProps: { placement: 'bottom-end', sx: { zIndex: 'snackbar' } }, menus: _jsxs(LoadingMenuItem, { onClick: () => __awaiter(this, void 0, void 0, function* () { return clearSession(); }), children: [_jsx(ListItemIcon, { children: _jsx(Icon, { icon: "mingcute:broom-line" }) }), t('clearSession')] }), children: _jsx(Icon, { icon: "tabler:dots" }) }));
87
- }
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Helmet } from 'react-helmet';
3
- import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
4
- import AgentSettingsDialog from '../../components/AgentSettings/AgentSettingsDialog';
5
- import ActiveAgentProvider from '../../contexts/ActiveAgent';
6
- import RuntimeProvider, { RuntimeProviderFromUrl } from '../../contexts/Runtime';
7
- import useAppearances from '../../hooks/use-appearances';
8
- import { useHeaderMenu } from '../../hooks/use-header-menu';
9
- import { useRuntimeState } from '../../state/runtime';
10
- export default function Runtime({ blockletDid, aid, working, }) {
11
- const children = (_jsx(ActiveAgentProvider, { children: _jsx(RuntimeView, {}) }));
12
- return aid ? (_jsx(RuntimeProvider, { blockletDid: blockletDid, aid: aid, working: working, children: children })) : (_jsx(RuntimeProviderFromUrl, { children: children }));
13
- }
14
- function RuntimeView() {
15
- const { aid, agent } = useRuntimeState();
16
- const { appearancePage } = useAppearances({ aid });
17
- useHeaderMenu();
18
- return (_jsxs(_Fragment, { children: [_jsxs(Helmet, { children: [agent.project.name && _jsx("title", { children: agent.project.name }), agent.project.description && _jsx("meta", { name: "description", content: agent.project.description })] }), _jsx(CustomComponentRenderer, { componentId: appearancePage.componentId, properties: appearancePage.componentProperties }), _jsx(AgentSettingsDialog, {})] }));
19
- }