@downcity/plugins 1.0.253 → 1.0.280

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 (496) hide show
  1. package/bin/builtin/BuiltinPluginReadmes.d.ts +14 -0
  2. package/bin/builtin/BuiltinPluginReadmes.d.ts.map +1 -0
  3. package/bin/builtin/BuiltinPluginReadmes.js +58 -0
  4. package/bin/builtin/BuiltinPluginReadmes.js.map +1 -0
  5. package/bin/builtin/BuiltinPluginTypes.d.ts +48 -0
  6. package/bin/builtin/BuiltinPluginTypes.d.ts.map +1 -0
  7. package/bin/builtin/BuiltinPluginTypes.js +161 -0
  8. package/bin/builtin/BuiltinPluginTypes.js.map +1 -0
  9. package/bin/builtin/PluginSettingsDefinitions.d.ts +9 -0
  10. package/bin/builtin/PluginSettingsDefinitions.d.ts.map +1 -0
  11. package/bin/builtin/PluginSettingsDefinitions.js +41 -0
  12. package/bin/builtin/PluginSettingsDefinitions.js.map +1 -0
  13. package/bin/builtin/main/PluginSettingsMain.d.ts +6 -0
  14. package/bin/builtin/main/PluginSettingsMain.d.ts.map +1 -0
  15. package/bin/builtin/main/PluginSettingsMain.js +65 -0
  16. package/bin/builtin/main/PluginSettingsMain.js.map +1 -0
  17. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts +6 -0
  18. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts.map +1 -0
  19. package/bin/builtin/renderer/PluginSettingsRenderer.js +76 -0
  20. package/bin/builtin/renderer/PluginSettingsRenderer.js.map +1 -0
  21. package/bin/builtin/types/PluginSettings.d.ts +35 -0
  22. package/bin/builtin/types/PluginSettings.d.ts.map +1 -0
  23. package/bin/builtin/types/PluginSettings.js +3 -0
  24. package/bin/builtin/types/PluginSettings.js.map +1 -0
  25. package/bin/chat/ChatPlugin.d.ts +12 -28
  26. package/bin/chat/ChatPlugin.d.ts.map +1 -1
  27. package/bin/chat/ChatPlugin.js +97 -49
  28. package/bin/chat/ChatPlugin.js.map +1 -1
  29. package/bin/chat/access/ChatAccessRuntime.js +1 -1
  30. package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
  31. package/bin/chat/access/ChatAccessSchema.d.ts +2 -2
  32. package/bin/chat/access/ChatAccessSchema.d.ts.map +1 -1
  33. package/bin/chat/access/ChatAccessSchema.js +3 -3
  34. package/bin/chat/access/ChatAccessSchema.js.map +1 -1
  35. package/bin/chat/access/ChatAccessService.d.ts +2 -2
  36. package/bin/chat/access/ChatAccessService.d.ts.map +1 -1
  37. package/bin/chat/access/ChatAccessService.js +4 -4
  38. package/bin/chat/access/ChatAccessService.js.map +1 -1
  39. package/bin/chat/access/ChatAccessStore.d.ts +3 -3
  40. package/bin/chat/access/ChatAccessStore.d.ts.map +1 -1
  41. package/bin/chat/access/ChatAccessStore.js +17 -8
  42. package/bin/chat/access/ChatAccessStore.js.map +1 -1
  43. package/bin/chat/channels/BaseChatChannel.d.ts +1 -0
  44. package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
  45. package/bin/chat/channels/BaseChatChannel.js +2 -0
  46. package/bin/chat/channels/BaseChatChannel.js.map +1 -1
  47. package/bin/chat/channels/RuntimeChannel.d.ts +4 -4
  48. package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
  49. package/bin/chat/channels/RuntimeChannel.js +8 -8
  50. package/bin/chat/channels/RuntimeChannel.js.map +1 -1
  51. package/bin/chat/channels/feishu/Feishu.js +1 -1
  52. package/bin/chat/channels/feishu/Feishu.js.map +1 -1
  53. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -0
  54. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
  55. package/bin/chat/channels/feishu/FeishuPlatformClient.js +3 -0
  56. package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
  57. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +2 -0
  58. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
  59. package/bin/chat/channels/feishu/FeishuPlatformLookup.js +1 -1
  60. package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
  61. package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
  62. package/bin/chat/channels/qq/QQ.js +3 -2
  63. package/bin/chat/channels/qq/QQ.js.map +1 -1
  64. package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
  65. package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
  66. package/bin/chat/channels/qq/QQEventCapture.js +3 -3
  67. package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
  68. package/bin/chat/channels/qq/QQInboundDedupe.d.ts +1 -1
  69. package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
  70. package/bin/chat/channels/qq/QQInboundDedupe.js +1 -1
  71. package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
  72. package/bin/chat/channels/qq/QQMessageHandler.d.ts +4 -0
  73. package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
  74. package/bin/chat/channels/qq/QQMessageHandler.js +2 -0
  75. package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
  76. package/bin/chat/channels/qq/QQSupport.d.ts +4 -0
  77. package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
  78. package/bin/chat/channels/qq/QQSupport.js +1 -0
  79. package/bin/chat/channels/qq/QQSupport.js.map +1 -1
  80. package/bin/chat/channels/qq/VoiceInput.d.ts +3 -0
  81. package/bin/chat/channels/qq/VoiceInput.d.ts.map +1 -1
  82. package/bin/chat/channels/qq/VoiceInput.js +1 -1
  83. package/bin/chat/channels/qq/VoiceInput.js.map +1 -1
  84. package/bin/chat/channels/telegram/ApiClient.d.ts +3 -1
  85. package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
  86. package/bin/chat/channels/telegram/ApiClient.js +4 -2
  87. package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
  88. package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
  89. package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
  90. package/bin/chat/channels/telegram/StateStore.js +2 -2
  91. package/bin/chat/channels/telegram/StateStore.js.map +1 -1
  92. package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  93. package/bin/chat/channels/telegram/TelegramPlatformClient.js +2 -1
  94. package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
  95. package/bin/chat/main/ChatPluginMain.d.ts +4 -0
  96. package/bin/chat/main/ChatPluginMain.d.ts.map +1 -0
  97. package/bin/chat/main/ChatPluginMain.js +137 -0
  98. package/bin/chat/main/ChatPluginMain.js.map +1 -0
  99. package/bin/chat/renderer/ChatPluginRenderer.d.ts +4 -0
  100. package/bin/chat/renderer/ChatPluginRenderer.d.ts.map +1 -0
  101. package/bin/chat/renderer/ChatPluginRenderer.js +105 -0
  102. package/bin/chat/renderer/ChatPluginRenderer.js.map +1 -0
  103. package/bin/chat/runtime/ChannelContextStore.d.ts +2 -2
  104. package/bin/chat/runtime/ChannelContextStore.js +20 -20
  105. package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
  106. package/bin/chat/runtime/ChatActionExecution.js +6 -6
  107. package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
  108. package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  109. package/bin/chat/runtime/ChatChannelConfig.js +7 -12
  110. package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
  111. package/bin/chat/runtime/ChatChannelCore.d.ts +3 -3
  112. package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  113. package/bin/chat/runtime/ChatChannelCore.js +5 -5
  114. package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
  115. package/bin/chat/runtime/ChatHistoryStore.d.ts +1 -1
  116. package/bin/chat/runtime/ChatHistoryStore.js +7 -7
  117. package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
  118. package/bin/chat/runtime/ChatMetaStore.d.ts +1 -1
  119. package/bin/chat/runtime/ChatMetaStore.js +1 -1
  120. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts +1 -1
  121. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
  122. package/bin/chat/runtime/ChatPluginActionRegistry.js +9 -9
  123. package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
  124. package/bin/chat/runtime/ChatQueue.d.ts +3 -38
  125. package/bin/chat/runtime/ChatQueue.d.ts.map +1 -1
  126. package/bin/chat/runtime/ChatQueue.js +3 -51
  127. package/bin/chat/runtime/ChatQueue.js.map +1 -1
  128. package/bin/chat/runtime/ChatQueueStore.d.ts +5 -16
  129. package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
  130. package/bin/chat/runtime/ChatQueueStore.js +8 -22
  131. package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
  132. package/bin/chat/runtime/ChatQueueWorker.d.ts +1 -1
  133. package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  134. package/bin/chat/runtime/ChatQueueWorker.js +1 -2
  135. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  136. package/bin/chat/runtime/ChatSessionDelete.d.ts +3 -3
  137. package/bin/chat/runtime/ChatSessionDelete.js +4 -4
  138. package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
  139. package/bin/chat/runtime/ChatStorage.d.ts +7 -7
  140. package/bin/chat/runtime/ChatStorage.js +24 -24
  141. package/bin/chat/runtime/ChatStorage.js.map +1 -1
  142. package/bin/chat/types/ChatAccess.d.ts +2 -2
  143. package/bin/chat/types/ChatAccess.d.ts.map +1 -1
  144. package/bin/chat/types/ChatCommand.d.ts +1 -1
  145. package/bin/chat/types/ChatPluginChannelConfig.d.ts +57 -0
  146. package/bin/chat/types/ChatPluginChannelConfig.d.ts.map +1 -0
  147. package/bin/chat/types/ChatPluginChannelConfig.js +3 -0
  148. package/bin/chat/types/ChatPluginChannelConfig.js.map +1 -0
  149. package/bin/chat/types/ChatPluginConfig.d.ts +19 -0
  150. package/bin/chat/types/ChatPluginConfig.d.ts.map +1 -0
  151. package/bin/chat/types/ChatPluginConfig.js +3 -0
  152. package/bin/chat/types/ChatPluginConfig.js.map +1 -0
  153. package/bin/chat/types/ChatPluginOptions.d.ts +4 -4
  154. package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
  155. package/bin/chat/types/ChatPluginOptions.js +1 -1
  156. package/bin/chat/types/ChatPluginProfile.d.ts +39 -0
  157. package/bin/chat/types/ChatPluginProfile.d.ts.map +1 -0
  158. package/bin/chat/types/ChatPluginProfile.js +3 -0
  159. package/bin/chat/types/ChatPluginProfile.js.map +1 -0
  160. package/bin/chat/types/ChatPluginRenderer.d.ts +17 -0
  161. package/bin/chat/types/ChatPluginRenderer.d.ts.map +1 -0
  162. package/bin/chat/types/ChatPluginRenderer.js +3 -0
  163. package/bin/chat/types/ChatPluginRenderer.js.map +1 -0
  164. package/bin/chat/types/ChatRuntime.d.ts +11 -0
  165. package/bin/chat/types/ChatRuntime.d.ts.map +1 -1
  166. package/bin/chat/types/ChatRuntimeAccount.d.ts +3 -3
  167. package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -1
  168. package/bin/chat/types/ChatRuntimeAccount.js +2 -2
  169. package/bin/chat/types/ChatStorage.d.ts +2 -2
  170. package/bin/chat/types/ChatStorage.d.ts.map +1 -1
  171. package/bin/chat.d.ts +3 -4
  172. package/bin/chat.d.ts.map +1 -1
  173. package/bin/chat.js +1 -2
  174. package/bin/chat.js.map +1 -1
  175. package/bin/contact/Action.js +5 -5
  176. package/bin/contact/Action.js.map +1 -1
  177. package/bin/contact/ContactPlugin.js +15 -15
  178. package/bin/contact/ContactPlugin.js.map +1 -1
  179. package/bin/contact/runtime/ChatRuntime.js +3 -3
  180. package/bin/contact/runtime/ChatRuntime.js.map +1 -1
  181. package/bin/contact/runtime/ContactStore.d.ts +8 -8
  182. package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
  183. package/bin/contact/runtime/ContactStore.js +20 -20
  184. package/bin/contact/runtime/ContactStore.js.map +1 -1
  185. package/bin/contact/runtime/EndpointNotice.js +2 -2
  186. package/bin/contact/runtime/EndpointNotice.js.map +1 -1
  187. package/bin/contact/runtime/InboxStore.d.ts +6 -6
  188. package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
  189. package/bin/contact/runtime/InboxStore.js +16 -16
  190. package/bin/contact/runtime/InboxStore.js.map +1 -1
  191. package/bin/contact/runtime/LinkApproval.js +14 -14
  192. package/bin/contact/runtime/LinkApproval.js.map +1 -1
  193. package/bin/contact/runtime/LinkStore.d.ts +2 -2
  194. package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
  195. package/bin/contact/runtime/LinkStore.js +5 -5
  196. package/bin/contact/runtime/LinkStore.js.map +1 -1
  197. package/bin/contact/runtime/Paths.d.ts +15 -15
  198. package/bin/contact/runtime/Paths.d.ts.map +1 -1
  199. package/bin/contact/runtime/Paths.js +29 -29
  200. package/bin/contact/runtime/Paths.js.map +1 -1
  201. package/bin/contact/runtime/ShareBundle.d.ts +1 -1
  202. package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
  203. package/bin/contact/runtime/ShareBundle.js +4 -4
  204. package/bin/contact/runtime/ShareBundle.js.map +1 -1
  205. package/bin/contact/types/ContactApproval.d.ts +2 -2
  206. package/bin/contact/types/ContactApproval.d.ts.map +1 -1
  207. package/bin/image/ImagePlugin.d.ts +1 -4
  208. package/bin/image/ImagePlugin.d.ts.map +1 -1
  209. package/bin/image/ImagePlugin.js +26 -34
  210. package/bin/image/ImagePlugin.js.map +1 -1
  211. package/bin/image/runtime/ImageResultStorage.d.ts +2 -2
  212. package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -1
  213. package/bin/image/runtime/ImageResultStorage.js +15 -38
  214. package/bin/image/runtime/ImageResultStorage.js.map +1 -1
  215. package/bin/image/types/ImagePlugin.d.ts +23 -16
  216. package/bin/image/types/ImagePlugin.d.ts.map +1 -1
  217. package/bin/image/types/ImagePlugin.js +1 -1
  218. package/bin/image.d.ts +1 -1
  219. package/bin/image.d.ts.map +1 -1
  220. package/bin/index.d.ts +2 -0
  221. package/bin/index.d.ts.map +1 -1
  222. package/bin/index.js +1 -0
  223. package/bin/index.js.map +1 -1
  224. package/bin/memory/Action.d.ts +27 -36
  225. package/bin/memory/Action.d.ts.map +1 -1
  226. package/bin/memory/Action.js +71 -311
  227. package/bin/memory/Action.js.map +1 -1
  228. package/bin/memory/MemoryPlugin.d.ts +20 -37
  229. package/bin/memory/MemoryPlugin.d.ts.map +1 -1
  230. package/bin/memory/MemoryPlugin.js +241 -233
  231. package/bin/memory/MemoryPlugin.js.map +1 -1
  232. package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts +43 -0
  233. package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts.map +1 -0
  234. package/bin/memory/adapters/FileMemoryStorageAdapter.js +163 -0
  235. package/bin/memory/adapters/FileMemoryStorageAdapter.js.map +1 -0
  236. package/bin/memory/providers/BuiltinMemoryProvider.d.ts +63 -0
  237. package/bin/memory/providers/BuiltinMemoryProvider.d.ts.map +1 -0
  238. package/bin/memory/providers/BuiltinMemoryProvider.js +772 -0
  239. package/bin/memory/providers/BuiltinMemoryProvider.js.map +1 -0
  240. package/bin/memory/runtime/SystemProvider.d.ts +7 -12
  241. package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
  242. package/bin/memory/runtime/SystemProvider.js +30 -89
  243. package/bin/memory/runtime/SystemProvider.js.map +1 -1
  244. package/bin/memory/types/BuiltinMemoryProvider.d.ts +88 -0
  245. package/bin/memory/types/BuiltinMemoryProvider.d.ts.map +1 -0
  246. package/bin/memory/types/BuiltinMemoryProvider.js +9 -0
  247. package/bin/memory/types/BuiltinMemoryProvider.js.map +1 -0
  248. package/bin/memory/types/Memory.d.ts +255 -408
  249. package/bin/memory/types/Memory.d.ts.map +1 -1
  250. package/bin/memory/types/Memory.js +4 -4
  251. package/bin/memory/types/MemoryStorage.d.ts +35 -0
  252. package/bin/memory/types/MemoryStorage.d.ts.map +1 -0
  253. package/bin/memory/types/MemoryStorage.js +10 -0
  254. package/bin/memory/types/MemoryStorage.js.map +1 -0
  255. package/bin/memory.d.ts +6 -2
  256. package/bin/memory.d.ts.map +1 -1
  257. package/bin/memory.js +3 -1
  258. package/bin/memory.js.map +1 -1
  259. package/bin/renderers.d.ts +5 -0
  260. package/bin/renderers.d.ts.map +1 -0
  261. package/bin/renderers.js +12 -0
  262. package/bin/renderers.js.map +1 -0
  263. package/bin/sound/Plugin.d.ts +2 -5
  264. package/bin/sound/Plugin.d.ts.map +1 -1
  265. package/bin/sound/Plugin.js +27 -31
  266. package/bin/sound/Plugin.js.map +1 -1
  267. package/bin/sound/types/SoundPlugin.d.ts +22 -15
  268. package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
  269. package/bin/sound/types/SoundPlugin.js +2 -2
  270. package/bin/sound.d.ts +1 -1
  271. package/bin/sound.d.ts.map +1 -1
  272. package/bin/task/Action.d.ts +6 -6
  273. package/bin/task/Action.d.ts.map +1 -1
  274. package/bin/task/Action.js +21 -21
  275. package/bin/task/Action.js.map +1 -1
  276. package/bin/task/PROMPT.d.ts +1 -1
  277. package/bin/task/PROMPT.d.ts.map +1 -1
  278. package/bin/task/PROMPT.js +1 -1
  279. package/bin/task/PROMPT.js.map +1 -1
  280. package/bin/task/Scheduler.js +8 -8
  281. package/bin/task/Scheduler.js.map +1 -1
  282. package/bin/task/TaskPlugin.d.ts +7 -14
  283. package/bin/task/TaskPlugin.d.ts.map +1 -1
  284. package/bin/task/TaskPlugin.js +54 -43
  285. package/bin/task/TaskPlugin.js.map +1 -1
  286. package/bin/task/runtime/Model.d.ts +1 -5
  287. package/bin/task/runtime/Model.d.ts.map +1 -1
  288. package/bin/task/runtime/Model.js +2 -13
  289. package/bin/task/runtime/Model.js.map +1 -1
  290. package/bin/task/runtime/Paths.d.ts +7 -7
  291. package/bin/task/runtime/Paths.d.ts.map +1 -1
  292. package/bin/task/runtime/Paths.js +11 -11
  293. package/bin/task/runtime/Paths.js.map +1 -1
  294. package/bin/task/runtime/Runner.d.ts +1 -1
  295. package/bin/task/runtime/Runner.d.ts.map +1 -1
  296. package/bin/task/runtime/Runner.js +4 -5
  297. package/bin/task/runtime/Runner.js.map +1 -1
  298. package/bin/task/runtime/Store.d.ts +9 -9
  299. package/bin/task/runtime/Store.d.ts.map +1 -1
  300. package/bin/task/runtime/Store.js +17 -17
  301. package/bin/task/runtime/Store.js.map +1 -1
  302. package/bin/task/runtime/TaskActionExecution.js +6 -6
  303. package/bin/task/runtime/TaskActionExecution.js.map +1 -1
  304. package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
  305. package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
  306. package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
  307. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  308. package/bin/task/runtime/TaskRunnerRound.js +8 -3
  309. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  310. package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
  311. package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
  312. package/bin/task/runtime/TaskRunnerScript.js +0 -1
  313. package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
  314. package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
  315. package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  316. package/bin/task/runtime/TaskRunnerSession.js +2 -4
  317. package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
  318. package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
  319. package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
  320. package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
  321. package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
  322. package/bin/web/Plugin.d.ts +2 -6
  323. package/bin/web/Plugin.d.ts.map +1 -1
  324. package/bin/web/Plugin.js +21 -17
  325. package/bin/web/Plugin.js.map +1 -1
  326. package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
  327. package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
  328. package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
  329. package/bin/web/types/WebPlugin.d.ts +15 -9
  330. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  331. package/bin/web.d.ts +1 -1
  332. package/bin/web.d.ts.map +1 -1
  333. package/bin/workboard/runtime/Collector.js +1 -1
  334. package/bin/workboard/runtime/Collector.js.map +1 -1
  335. package/package.json +29 -19
  336. package/scripts/chat-access.test.mjs +3 -2
  337. package/scripts/chat-channel-config.test.mjs +3 -3
  338. package/scripts/chat-storage.test.mjs +10 -14
  339. package/scripts/memory-plugin.test.mjs +204 -0
  340. package/scripts/playwright-browser-provider.test.mjs +260 -0
  341. package/scripts/plugin-main.test.mjs +101 -0
  342. package/scripts/plugin-subpaths.test.mjs +36 -0
  343. package/scripts/sound-plugin.test.mjs +21 -9
  344. package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
  345. package/scripts/web-plugin.test.mjs +43 -186
  346. package/src/builtin/BuiltinPluginReadmes.ts +58 -0
  347. package/src/builtin/BuiltinPluginTypes.ts +260 -0
  348. package/src/builtin/PluginSettingsDefinitions.ts +45 -0
  349. package/src/builtin/main/PluginSettingsMain.ts +75 -0
  350. package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
  351. package/src/builtin/types/PluginSettings.ts +46 -0
  352. package/src/chat/ChatPlugin.ts +99 -51
  353. package/src/chat/access/ChatAccessRuntime.ts +1 -1
  354. package/src/chat/access/ChatAccessSchema.ts +5 -5
  355. package/src/chat/access/ChatAccessService.ts +4 -4
  356. package/src/chat/access/ChatAccessStore.ts +17 -9
  357. package/src/chat/channels/BaseChatChannel.ts +2 -0
  358. package/src/chat/channels/RuntimeChannel.ts +9 -9
  359. package/src/chat/channels/feishu/Feishu.ts +1 -1
  360. package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
  361. package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
  362. package/src/chat/channels/qq/QQ.ts +3 -2
  363. package/src/chat/channels/qq/QQEventCapture.ts +3 -3
  364. package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
  365. package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
  366. package/src/chat/channels/qq/QQSupport.ts +5 -0
  367. package/src/chat/channels/qq/VoiceInput.ts +5 -1
  368. package/src/chat/channels/telegram/ApiClient.ts +10 -3
  369. package/src/chat/channels/telegram/StateStore.ts +2 -2
  370. package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
  371. package/src/chat/main/ChatPluginMain.ts +163 -0
  372. package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
  373. package/src/chat/runtime/ChannelContextStore.ts +20 -20
  374. package/src/chat/runtime/ChatActionExecution.ts +6 -6
  375. package/src/chat/runtime/ChatChannelConfig.ts +7 -14
  376. package/src/chat/runtime/ChatChannelCore.ts +9 -9
  377. package/src/chat/runtime/ChatHistoryStore.ts +7 -7
  378. package/src/chat/runtime/ChatMetaStore.ts +1 -1
  379. package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
  380. package/src/chat/runtime/ChatQueue.ts +2 -69
  381. package/src/chat/runtime/ChatQueueStore.ts +10 -26
  382. package/src/chat/runtime/ChatQueueWorker.ts +2 -5
  383. package/src/chat/runtime/ChatSessionDelete.ts +4 -4
  384. package/src/chat/runtime/ChatStorage.ts +24 -24
  385. package/src/chat/types/ChatAccess.ts +2 -2
  386. package/src/chat/types/ChatCommand.ts +1 -1
  387. package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
  388. package/src/chat/types/ChatPluginConfig.ts +21 -0
  389. package/src/chat/types/ChatPluginOptions.ts +4 -4
  390. package/src/chat/types/ChatPluginProfile.ts +52 -0
  391. package/src/chat/types/ChatPluginRenderer.ts +25 -0
  392. package/src/chat/types/ChatRuntime.ts +14 -0
  393. package/src/chat/types/ChatRuntimeAccount.ts +3 -3
  394. package/src/chat/types/ChatStorage.ts +2 -2
  395. package/src/chat.ts +6 -14
  396. package/src/contact/Action.ts +5 -5
  397. package/src/contact/ContactPlugin.ts +15 -15
  398. package/src/contact/runtime/ChatRuntime.ts +3 -3
  399. package/src/contact/runtime/ContactStore.ts +20 -20
  400. package/src/contact/runtime/EndpointNotice.ts +2 -2
  401. package/src/contact/runtime/InboxStore.ts +16 -16
  402. package/src/contact/runtime/LinkApproval.ts +16 -16
  403. package/src/contact/runtime/LinkStore.ts +5 -5
  404. package/src/contact/runtime/Paths.ts +29 -29
  405. package/src/contact/runtime/ShareBundle.ts +5 -5
  406. package/src/contact/types/ContactApproval.ts +2 -2
  407. package/src/image/ImagePlugin.ts +30 -33
  408. package/src/image/runtime/ImageResultStorage.ts +36 -62
  409. package/src/image/types/ImagePlugin.ts +25 -19
  410. package/src/image.ts +2 -0
  411. package/src/index.ts +8 -0
  412. package/src/memory/Action.ts +106 -377
  413. package/src/memory/MemoryPlugin.ts +266 -246
  414. package/src/memory/adapters/FileMemoryStorageAdapter.ts +197 -0
  415. package/src/memory/providers/BuiltinMemoryProvider.ts +905 -0
  416. package/src/memory/runtime/SystemProvider.ts +32 -95
  417. package/src/memory/types/BuiltinMemoryProvider.ts +121 -0
  418. package/src/memory/types/Memory.ts +329 -456
  419. package/src/memory/types/MemoryStorage.ts +44 -0
  420. package/src/memory.ts +49 -24
  421. package/src/renderers.ts +18 -0
  422. package/src/sound/Plugin.ts +34 -33
  423. package/src/sound/types/SoundPlugin.ts +24 -19
  424. package/src/sound.ts +2 -0
  425. package/src/task/Action.ts +27 -27
  426. package/src/task/PROMPT.ts +1 -1
  427. package/src/task/PROMPT.ts.txt +5 -6
  428. package/src/task/Scheduler.ts +8 -8
  429. package/src/task/TaskPlugin.ts +55 -46
  430. package/src/task/runtime/Model.ts +3 -13
  431. package/src/task/runtime/Paths.ts +11 -11
  432. package/src/task/runtime/Runner.ts +5 -6
  433. package/src/task/runtime/Store.ts +22 -22
  434. package/src/task/runtime/TaskActionExecution.ts +6 -6
  435. package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
  436. package/src/task/runtime/TaskRunnerRound.ts +13 -4
  437. package/src/task/runtime/TaskRunnerScript.ts +0 -5
  438. package/src/task/runtime/TaskRunnerSession.ts +10 -8
  439. package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
  440. package/src/web/Plugin.ts +23 -22
  441. package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
  442. package/src/web/types/WebPlugin.ts +16 -13
  443. package/src/web.ts +1 -0
  444. package/src/workboard/runtime/Collector.ts +1 -1
  445. package/tsconfig.json +4 -1
  446. package/LICENSE +0 -183
  447. package/bin/chat/Index.d.ts +0 -15
  448. package/bin/chat/Index.d.ts.map +0 -1
  449. package/bin/chat/Index.js +0 -11
  450. package/bin/chat/Index.js.map +0 -1
  451. package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
  452. package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
  453. package/bin/chat/config/ChatPluginConfig.js +0 -237
  454. package/bin/chat/config/ChatPluginConfig.js.map +0 -1
  455. package/bin/chat/types/ChatPluginResource.d.ts +0 -68
  456. package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
  457. package/bin/chat/types/ChatPluginResource.js +0 -10
  458. package/bin/chat/types/ChatPluginResource.js.map +0 -1
  459. package/bin/contact/Index.d.ts +0 -8
  460. package/bin/contact/Index.d.ts.map +0 -1
  461. package/bin/contact/Index.js +0 -8
  462. package/bin/contact/Index.js.map +0 -1
  463. package/bin/memory/Index.d.ts +0 -9
  464. package/bin/memory/Index.d.ts.map +0 -1
  465. package/bin/memory/Index.js +0 -9
  466. package/bin/memory/Index.js.map +0 -1
  467. package/bin/memory/runtime/Search.d.ts +0 -19
  468. package/bin/memory/runtime/Search.d.ts.map +0 -1
  469. package/bin/memory/runtime/Search.js +0 -262
  470. package/bin/memory/runtime/Search.js.map +0 -1
  471. package/bin/memory/runtime/Store.d.ts +0 -42
  472. package/bin/memory/runtime/Store.d.ts.map +0 -1
  473. package/bin/memory/runtime/Store.js +0 -94
  474. package/bin/memory/runtime/Store.js.map +0 -1
  475. package/bin/memory/runtime/Writer.d.ts +0 -61
  476. package/bin/memory/runtime/Writer.d.ts.map +0 -1
  477. package/bin/memory/runtime/Writer.js +0 -274
  478. package/bin/memory/runtime/Writer.js.map +0 -1
  479. package/bin/skill/Command.d.ts +0 -29
  480. package/bin/skill/Command.d.ts.map +0 -1
  481. package/bin/skill/Command.js +0 -35
  482. package/bin/skill/Command.js.map +0 -1
  483. package/bin/task/Index.d.ts +0 -9
  484. package/bin/task/Index.d.ts.map +0 -1
  485. package/bin/task/Index.js +0 -9
  486. package/bin/task/Index.js.map +0 -1
  487. package/src/chat/Index.ts +0 -36
  488. package/src/chat/config/ChatPluginConfig.ts +0 -266
  489. package/src/chat/types/ChatPluginResource.ts +0 -95
  490. package/src/contact/Index.ts +0 -8
  491. package/src/memory/Index.ts +0 -9
  492. package/src/memory/runtime/Search.ts +0 -327
  493. package/src/memory/runtime/Store.ts +0 -158
  494. package/src/memory/runtime/Writer.ts +0 -351
  495. package/src/skill/Command.ts +0 -58
  496. package/src/task/Index.ts +0 -8
@@ -273,14 +273,23 @@ export async function runAgentRound(params: {
273
273
  */
274
274
  export async function runScriptTask(params: {
275
275
  context: PluginContext;
276
- runDirAbs: string;
277
276
  session_id: string;
278
277
  scriptBody: string;
279
278
  }): Promise<ScriptExecutionResult> {
280
279
  const body = String(params.scriptBody || "");
281
280
  if (!body.trim()) throw new Error("script task body cannot be empty");
282
281
 
283
- const scriptAbs = path.join(params.runDirAbs, "task-script.sh");
282
+ const session_segment = String(params.session_id || "task")
283
+ .replace(/[^a-zA-Z0-9._-]+/g, "-")
284
+ .replace(/^-+|-+$/g, "") || "task";
285
+ const execution_dir = path.join(
286
+ params.context.data_path,
287
+ "sandbox",
288
+ "task-scripts",
289
+ session_segment,
290
+ );
291
+ await fs.ensureDir(execution_dir);
292
+ const scriptAbs = path.join(execution_dir, "task-script.sh");
284
293
  await fs.writeFile(scriptAbs, body.endsWith("\n") ? body : `${body}\n`, "utf-8");
285
294
 
286
295
  const childEnv: NodeJS.ProcessEnv = {
@@ -294,9 +303,9 @@ export async function runScriptTask(params: {
294
303
  }
295
304
  const execResult = await shell.run_safe_command({
296
305
  execution_id: `task-script:${params.session_id}`,
297
- execution_dir: params.runDirAbs,
306
+ execution_dir,
298
307
  cmd: `sh "${scriptAbs.replace(/(["\\$`])/g, "\\$1")}"`,
299
- cwd: params.runDirAbs,
308
+ cwd: params.context.workspace_path,
300
309
  shell_path: "/bin/sh",
301
310
  login: false,
302
311
  base_env: childEnv,
@@ -24,10 +24,6 @@ export interface RunScriptTaskBranchParams {
24
24
  * 当前 Agent 执行上下文。
25
25
  */
26
26
  context: PluginContext;
27
- /**
28
- * 当前 run 目录绝对路径。
29
- */
30
- runDirAbs: string;
31
27
  /**
32
28
  * script 任务绑定的 session_id。
33
29
  */
@@ -110,7 +106,6 @@ export async function runScriptTaskBranch(
110
106
  try {
111
107
  const scriptResult = await runScriptTask({
112
108
  context: params.context,
113
- runDirAbs: params.runDirAbs,
114
109
  session_id: params.session_id,
115
110
  scriptBody: params.scriptBody,
116
111
  });
@@ -9,8 +9,12 @@
9
9
  */
10
10
 
11
11
  import path from "node:path";
12
- import type { LanguageModel, Tool } from "ai";
13
- import type { PluginContext, SessionAttachmentStore } from "@downcity/agent";
12
+ import type {
13
+ AgentModel,
14
+ AgentOptions,
15
+ PluginContext,
16
+ SessionAttachmentStore,
17
+ } from "@downcity/agent";
14
18
  import { Executor } from "@downcity/agent";
15
19
  import type { SessionTurnExecutionResult } from "@downcity/agent";
16
20
  import type { TaskSessionRuntimePort } from "@/task/runtime/TaskRunnerTypes.js";
@@ -62,7 +66,7 @@ export async function appendTaskRoundUserMessage(params: {
62
66
  */
63
67
  export function createTaskSessionRuntimePort(params: {
64
68
  context: PluginContext;
65
- model: LanguageModel;
69
+ model: AgentModel;
66
70
  runDirAbs: string;
67
71
  runSessionId: string;
68
72
  userSimulatorSessionId: string;
@@ -97,7 +101,7 @@ export function createTaskSessionRuntimePort(params: {
97
101
  if (!shell) {
98
102
  throw new Error("Task agent execution requires Agent to be configured with a Shell.");
99
103
  }
100
- const shell_tools = shell.tools as unknown as Record<string, Tool>;
104
+ const shell_tools = shell.tools as NonNullable<AgentOptions["tools"]>;
101
105
  /**
102
106
  * Task runtime 当前只接收已经规范化的文本消息,不支持通过 Prompt 传入 Data URL 附件。
103
107
  * 显式提供适配器,避免把 Task 的临时 run 目录错误地当成普通 Session 附件目录。
@@ -127,7 +131,7 @@ export function createTaskSessionRuntimePort(params: {
127
131
  const created = new SessionMessages({
128
132
  session_id: key,
129
133
  store: create_session_message_store({
130
- files: context.files,
134
+ files: context.data_files,
131
135
  session_id: key,
132
136
  file_path: path.join(messages_dir_path, "active.jsonl"),
133
137
  assistant_message_file_path: path.join(
@@ -242,7 +246,5 @@ export async function appendTaskDeferredMessages(params: {
242
246
  const { taskSessionRuntime, session_id, rawResult } = params;
243
247
  const messages = taskSessionRuntime.get_messages(session_id);
244
248
  const deferredUserMessages = rawResult.deferred_persisted_user_messages || [];
245
- for (const deferred of deferredUserMessages) {
246
- await messages.append_record(deferred);
247
- }
249
+ await messages.append_deferred_user_messages(deferredUserMessages);
248
250
  }
@@ -0,0 +1,12 @@
1
+ /** TaskPlugin 在单个 Workspace 中持有的运行态类型。 */
2
+
3
+ import type { TaskCronTriggerEngine } from "@/task/runtime/CronTrigger.js";
4
+
5
+ /** 单个 Workspace 独立拥有的 Task 调度资源。 */
6
+ export interface TaskWorkspaceRuntime {
7
+ /** 当前 Workspace 的 cron 触发引擎。 */
8
+ readonly cron_engine: TaskCronTriggerEngine;
9
+
10
+ /** 当前 Workspace 正在执行的任务 ID,用于阻止同一任务并发触发。 */
11
+ readonly running_task_ids: Set<string>;
12
+ }
package/src/web/Plugin.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * WebPlugin:provider-neutral 的联网与浏览器能力边界。
3
3
  *
4
4
  * 关键点(中文)
5
- * - Plugin 只编排已显式注入的 provider,不选择云厂商或模型。
5
+ * - Plugin 只接收 profile,并根据有限 provider 枚举在内部创建浏览器 provider。
6
6
  * - 搜索、文档读取与浏览器 session 是三个独立能力。
7
7
  * - 浏览器长期资源由 provider 拥有,并在 Plugin lifecycle.stop 时统一释放。
8
8
  */
@@ -16,13 +16,13 @@ import type {
16
16
  BrowserCreateSessionInput,
17
17
  BrowserExtractInput,
18
18
  BrowserObserveInput,
19
+ BrowserProvider,
19
20
  BrowserSemanticActInput,
20
21
  BrowserSemanticExtractInput,
21
- WebOpenInput,
22
22
  WebPluginOptions,
23
- WebSearchInput,
24
23
  } from "@/web/types/WebPlugin.js";
25
24
  import { WEB_PLUGIN_ACTIONS } from "@/web/types/WebPlugin.js";
25
+ import { PlaywrightBrowserProvider } from "@/web/providers/PlaywrightBrowserProvider.js";
26
26
 
27
27
  const URL_SCHEMA = z.string().url();
28
28
  const SESSION_ID_SCHEMA = z.string().trim().min(1);
@@ -70,23 +70,24 @@ export class WebPlugin extends BasePlugin {
70
70
  readonly description =
71
71
  "Provides structured web search, document reading, and browser sessions through configured providers.";
72
72
 
73
- /** 搜索 provider。 */
74
- private readonly search_provider?: WebPluginOptions["search"];
75
-
76
- /** 文档读取 provider。 */
77
- private readonly open_provider?: WebPluginOptions["open"];
78
-
79
73
  /** 浏览器 provider。 */
80
- private readonly browser_provider?: WebPluginOptions["browser"];
74
+ private readonly browser_provider?: BrowserProvider;
81
75
 
82
- constructor(options: WebPluginOptions) {
76
+ constructor(options: WebPluginOptions = {}) {
83
77
  super();
84
- if (!options.search && !options.open && !options.browser) {
85
- throw new TypeError("WebPlugin requires at least one provider");
78
+ if (options.browser && options.browser !== "playwright") {
79
+ throw new TypeError(`Unsupported Web browser provider: ${options.browser}`);
86
80
  }
87
- this.search_provider = options.search;
88
- this.open_provider = options.open;
89
- this.browser_provider = options.browser;
81
+ this.browser_provider = options.cdp_url
82
+ ? new PlaywrightBrowserProvider({
83
+ cdp_url: options.cdp_url,
84
+ ...(options.default_url ? { default_url: options.default_url } : {}),
85
+ ...(options.timeout_ms !== undefined ? { timeout_ms: options.timeout_ms } : {}),
86
+ ...(options.max_observation_chars !== undefined
87
+ ? { max_observation_chars: options.max_observation_chars }
88
+ : {}),
89
+ })
90
+ : undefined;
90
91
  }
91
92
 
92
93
  /** Agent 释放或卸载 plugin 时关闭全部浏览器资源。 */
@@ -119,12 +120,12 @@ export class WebPlugin extends BasePlugin {
119
120
  domains: z.array(z.string().trim().min(1)).max(50).optional(),
120
121
  }),
121
122
  examples: [{ title: "Search official sources", payload: { query: "Playwright CDP documentation", limit: 5 } }],
122
- execute: async ({ input }) => {
123
- if (!this.search_provider) {
123
+ execute: async ({ context, input }) => {
124
+ if (!context.web) {
124
125
  return failure_result("WebPlugin search provider is not configured");
125
126
  }
126
127
  try {
127
- const result = await this.search_provider(input as WebSearchInput);
128
+ const result = await context.web.search(input as JsonObject);
128
129
  return { success: true, data: result, message: "web search completed" };
129
130
  } catch (error) {
130
131
  return failure_result(error);
@@ -136,12 +137,12 @@ export class WebPlugin extends BasePlugin {
136
137
  description: "Read a known URL with the configured document provider.",
137
138
  input_schema: z.object({ url: URL_SCHEMA, max_chars: MAX_CHARS_SCHEMA }),
138
139
  examples: [{ title: "Read official documentation", payload: { url: "https://playwright.dev/docs/api/class-playwright" } }],
139
- execute: async ({ input }) => {
140
- if (!this.open_provider) {
140
+ execute: async ({ context, input }) => {
141
+ if (!context.web) {
141
142
  return failure_result("WebPlugin document provider is not configured");
142
143
  }
143
144
  try {
144
- const result = await this.open_provider(input as WebOpenInput);
145
+ const result = await context.web.open(input as JsonObject);
145
146
  return { success: true, data: result, message: "web document opened" };
146
147
  } catch (error) {
147
148
  return failure_result(error);
@@ -9,7 +9,7 @@
9
9
 
10
10
  import { randomUUID } from "node:crypto";
11
11
  import { chromium } from "playwright-core";
12
- import type { Browser, BrowserContext, Page } from "playwright-core";
12
+ import type { Browser, Page } from "playwright-core";
13
13
  import type {
14
14
  BrowserActInput,
15
15
  BrowserCloseSessionInput,
@@ -31,8 +31,6 @@ const MAX_WAIT_MS = 60_000;
31
31
  interface PlaywrightBrowserSession {
32
32
  /** session 唯一标识。 */
33
33
  session_id: string;
34
- /** session 所在的浏览器上下文。 */
35
- context: BrowserContext;
36
34
  /** session 唯一拥有的页面。 */
37
35
  page: Page;
38
36
  }
@@ -54,6 +52,41 @@ function describe_error(error: unknown): string {
54
52
  return error instanceof Error ? error.message : String(error);
55
53
  }
56
54
 
55
+ /** 仅保留 CDP endpoint 的协议、主机与端口。 */
56
+ function sanitize_cdp_endpoint(cdp_url: string): string {
57
+ try {
58
+ const endpoint = new URL(cdp_url);
59
+ const port = endpoint.port ? `:${endpoint.port}` : "";
60
+ return `${endpoint.protocol}//${endpoint.hostname}${port}`;
61
+ } catch {
62
+ return "[redacted-cdp-endpoint]";
63
+ }
64
+ }
65
+
66
+ /** 删除错误文本中 URL 携带的认证信息、路径和查询参数。 */
67
+ function sanitize_error_message(error: unknown): string {
68
+ return describe_error(error).replace(
69
+ /(?:https?|wss?):\/\/[^\s"'<>]+/giu,
70
+ (value) => sanitize_cdp_endpoint(value.replace(/[),.;]+$/u, "")),
71
+ );
72
+ }
73
+
74
+ /** 创建包含稳定阶段标识和脱敏 endpoint 的 session 错误。 */
75
+ function create_session_error(
76
+ stage: "connect" | "resolve-context" | "create-page" | "initialize-page",
77
+ cdp_url: string,
78
+ detail: string,
79
+ cause?: unknown,
80
+ ): Error {
81
+ const endpoint = sanitize_cdp_endpoint(cdp_url);
82
+ const cause_detail = cause === undefined
83
+ ? ""
84
+ : ` ${sanitize_error_message(cause)}`;
85
+ return new Error(
86
+ `Unable to create browser session during ${stage} for ${endpoint}: ${detail}${cause_detail}`,
87
+ );
88
+ }
89
+
57
90
  /** 基于 Playwright/CDP 的浏览器 provider。 */
58
91
  export class PlaywrightBrowserProvider implements BrowserProvider {
59
92
  /** provider 稳定名称。 */
@@ -91,24 +124,64 @@ export class PlaywrightBrowserProvider implements BrowserProvider {
91
124
  async create_session(
92
125
  input: BrowserCreateSessionInput,
93
126
  ): Promise<BrowserObservation> {
94
- const browser = await this.get_browser();
95
- const context = browser.contexts()[0] ?? await browser.newContext();
96
- const page = await context.newPage();
97
- page.setDefaultTimeout(this.options.timeout_ms);
98
- page.setDefaultNavigationTimeout(this.options.timeout_ms);
99
- const session_id = randomUUID();
100
- const session = { session_id, context, page };
101
- this.sessions.set(session_id, session);
127
+ let browser: Browser;
128
+ try {
129
+ browser = await this.get_browser();
130
+ } catch (error) {
131
+ throw create_session_error(
132
+ "connect",
133
+ this.options.cdp_url,
134
+ "the CDP connection could not be established.",
135
+ error,
136
+ );
137
+ }
138
+
139
+ const context = browser.contexts()[0];
140
+ if (!context) {
141
+ throw create_session_error(
142
+ "resolve-context",
143
+ this.options.cdp_url,
144
+ "Playwright did not expose the browser's default context. Use a compatible Chromium CDP endpoint.",
145
+ );
146
+ }
147
+
148
+ let page: Page;
149
+ try {
150
+ page = await context.newPage();
151
+ } catch (error) {
152
+ throw create_session_error(
153
+ "create-page",
154
+ this.options.cdp_url,
155
+ "the CDP endpoint does not support creating a page in its default context.",
156
+ error,
157
+ );
158
+ }
102
159
 
103
160
  try {
161
+ page.setDefaultTimeout(this.options.timeout_ms);
162
+ page.setDefaultNavigationTimeout(this.options.timeout_ms);
104
163
  const url = String(input.url || this.options.default_url).trim();
105
164
  if (url && url !== DEFAULT_URL) {
106
165
  await page.goto(url, { waitUntil: "domcontentloaded" });
107
166
  }
108
- return await this.read_observation(session, input.include_screenshot);
167
+ const session = {
168
+ session_id: randomUUID(),
169
+ page,
170
+ };
171
+ const observation = await this.read_observation(
172
+ session,
173
+ input.include_screenshot,
174
+ );
175
+ this.sessions.set(session.session_id, session);
176
+ return observation;
109
177
  } catch (error) {
110
- await this.close_session({ session_id }).catch(() => undefined);
111
- throw new Error(`Browser session creation failed: ${describe_error(error)}`);
178
+ await page.close().catch(() => undefined);
179
+ throw create_session_error(
180
+ "initialize-page",
181
+ this.options.cdp_url,
182
+ "the new page could not be initialized.",
183
+ error,
184
+ );
112
185
  }
113
186
  }
114
187
 
@@ -198,14 +271,17 @@ export class PlaywrightBrowserProvider implements BrowserProvider {
198
271
  throw new Error("PlaywrightBrowserProvider is disposed");
199
272
  }
200
273
  if (this.browser?.isConnected()) return this.browser;
201
- this.browser = await chromium.connectOverCDP(this.options.cdp_url, {
274
+ const browser = await chromium.connectOverCDP(this.options.cdp_url, {
202
275
  timeout: this.options.timeout_ms,
276
+ noDefaults: true,
203
277
  });
204
- this.browser.on("disconnected", () => {
278
+ this.browser = browser;
279
+ browser.on("disconnected", () => {
280
+ if (this.browser !== browser) return;
205
281
  this.browser = null;
206
282
  this.sessions.clear();
207
283
  });
208
- return this.browser;
284
+ return browser;
209
285
  }
210
286
 
211
287
  /** 读取 session,不存在时抛出稳定错误。 */
@@ -236,16 +236,19 @@ export interface BrowserProvider {
236
236
  dispose(): Promise<void>;
237
237
  }
238
238
 
239
- /** WebPlugin 构造参数。 */
240
- export interface WebPluginOptions {
241
- /** 搜索 provider;未配置时 search action 返回能力不可用。 */
242
- search?: (
243
- input: WebSearchInput,
244
- ) => Promise<WebSearchResult> | WebSearchResult;
245
- /** 已知 URL 文档 provider;未配置时 open action 返回能力不可用。 */
246
- open?: (
247
- input: WebOpenInput,
248
- ) => Promise<WebOpenResult> | WebOpenResult;
249
- /** 浏览器 provider;未配置时 browser actions 返回能力不可用。 */
250
- browser?: BrowserProvider;
251
- }
239
+ /** WebPlugin profile。 */
240
+ export interface WebPluginProfile {
241
+ /** 浏览器实现类型。 */
242
+ browser?: "playwright";
243
+ /** 浏览器 CDP 地址。 */
244
+ cdp_url?: string;
245
+ /** 新建 Session 时使用的默认地址。 */
246
+ default_url?: string;
247
+ /** 浏览器操作超时时间。 */
248
+ timeout_ms?: number;
249
+ /** 页面观察的最大字符数。 */
250
+ max_observation_chars?: number;
251
+ }
252
+
253
+ /** WebPlugin profile 的兼容名称别名。 */
254
+ export type WebPluginOptions = WebPluginProfile;
package/src/web.ts CHANGED
@@ -25,6 +25,7 @@ export type {
25
25
  WebOpenResult,
26
26
  WebPluginActionName,
27
27
  WebPluginOptions,
28
+ WebPluginProfile,
28
29
  WebSearchInput,
29
30
  WebSearchItem,
30
31
  WebSearchResult,
@@ -36,7 +36,7 @@ export async function collectWorkboardSnapshot(
36
36
  executingSessionIds,
37
37
  });
38
38
  const runtimePlugins = list_plugin_states({ context });
39
- const taskResult = await listTaskDefinitions({ project_root: context.workspace_path });
39
+ const taskResult = await listTaskDefinitions({ data_path: context.data_path });
40
40
  const degradedCount = runtimePlugins.filter(
41
41
  (item) => item.status !== "ready",
42
42
  ).length;
package/tsconfig.json CHANGED
@@ -3,10 +3,13 @@
3
3
  "target": "ES2022",
4
4
  "module": "NodeNext",
5
5
  "moduleResolution": "NodeNext",
6
- "lib": ["ES2022"],
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
7
8
  "types": ["node"],
8
9
  "outDir": "./bin",
9
10
  "rootDir": "src",
11
+ "baseUrl": ".",
12
+ "ignoreDeprecations": "6.0",
10
13
  "paths": {
11
14
  "@/*": ["./src/*"],
12
15
  "@downcity/agent": ["../agent/bin/index.d.ts"],
package/LICENSE DELETED
@@ -1,183 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- https://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction, and
10
- distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
- owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all other entities
16
- that control, are controlled by, or are under common control with that entity.
17
- For the purposes of this definition, "control" means (i) the power, direct or
18
- indirect, to cause the direction or management of such entity, whether by
19
- contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
- outstanding shares, or (iii) beneficial ownership of such entity.
21
-
22
- "You" (or "Your") shall mean an individual or Legal Entity exercising
23
- permissions granted by this License.
24
-
25
- "Source" form shall mean the preferred form for making modifications, including
26
- but not limited to software source code, documentation source, and configuration
27
- files.
28
-
29
- "Object" form shall mean any form resulting from mechanical transformation or
30
- translation of a Source form, including but not limited to compiled object code,
31
- generated documentation, and conversions to other media types.
32
-
33
- "Work" shall mean the work of authorship, whether in Source or Object form,
34
- made available under the License, as indicated by a copyright notice that is
35
- included in or attached to the work (an example is provided in the Appendix
36
- below).
37
-
38
- "Derivative Works" shall mean any work, whether in Source or Object form, that
39
- is based on (or derived from) the Work and for which the editorial revisions,
40
- annotations, elaborations, or other modifications represent, as a whole, an
41
- original work of authorship. For the purposes of this License, Derivative Works
42
- shall not include works that remain separable from, or merely link (or bind by
43
- name) to the interfaces of, the Work and Derivative Works thereof.
44
-
45
- "Contribution" shall mean any work of authorship, including the original version
46
- of the Work and any modifications or additions to that Work or Derivative Works
47
- thereof, that is intentionally submitted to Licensor for inclusion in the Work
48
- by the copyright owner or by an individual or Legal Entity authorized to submit
49
- on behalf of the copyright owner. For the purposes of this definition,
50
- "submitted" means any form of electronic, verbal, or written communication sent
51
- to the Licensor or its representatives, including but not limited to
52
- communication on electronic mailing lists, source code control systems, and
53
- issue tracking systems that are managed by, or on behalf of, the Licensor for
54
- the purpose of discussing and improving the Work, but excluding communication
55
- that is conspicuously marked or otherwise designated in writing by the copyright
56
- owner as "Not a Contribution."
57
-
58
- "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59
- of whom a Contribution has been received by Licensor and subsequently
60
- incorporated within the Work.
61
-
62
- 2. Grant of Copyright License. Subject to the terms and conditions of this
63
- License, each Contributor hereby grants to You a perpetual, worldwide,
64
- non-exclusive, no-charge, royalty-free, irrevocable copyright license to
65
- reproduce, prepare Derivative Works of, publicly display, publicly perform,
66
- sublicense, and distribute the Work and such Derivative Works in Source or
67
- Object form.
68
-
69
- 3. Grant of Patent License. Subject to the terms and conditions of this License,
70
- each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
71
- no-charge, royalty-free, irrevocable (except as stated in this section) patent
72
- license to make, have made, use, offer to sell, sell, import, and otherwise
73
- transfer the Work, where such license applies only to those patent claims
74
- licensable by such Contributor that are necessarily infringed by their
75
- Contribution(s) alone or by combination of their Contribution(s) with the Work
76
- to which such Contribution(s) was submitted. If You institute patent litigation
77
- against any entity (including a cross-claim or counterclaim in a lawsuit)
78
- alleging that the Work or a Contribution incorporated within the Work
79
- constitutes direct or contributory patent infringement, then any patent licenses
80
- granted to You under this License for that Work shall terminate as of the date
81
- such litigation is filed.
82
-
83
- 4. Redistribution. You may reproduce and distribute copies of the Work or
84
- Derivative Works thereof in any medium, with or without modifications, and in
85
- Source or Object form, provided that You meet the following conditions:
86
-
87
- (a) You must give any other recipients of the Work or Derivative Works a copy of
88
- this License; and
89
-
90
- (b) You must cause any modified files to carry prominent notices stating that
91
- You changed the files; and
92
-
93
- (c) You must retain, in the Source form of any Derivative Works that You
94
- distribute, all copyright, patent, trademark, and attribution notices from the
95
- Source form of the Work, excluding those notices that do not pertain to any part
96
- of the Derivative Works; and
97
-
98
- (d) If the Work includes a "NOTICE" text file as part of its distribution, then
99
- any Derivative Works that You distribute must include a readable copy of the
100
- attribution notices contained within such NOTICE file, excluding those notices
101
- that do not pertain to any part of the Derivative Works, in at least one of the
102
- following places: within a NOTICE text file distributed as part of the
103
- Derivative Works; within the Source form or documentation, if provided along
104
- with the Derivative Works; or, within a display generated by the Derivative
105
- Works, if and wherever such third-party notices normally appear. The contents of
106
- the NOTICE file are for informational purposes only and do not modify the
107
- License. You may add Your own attribution notices within Derivative Works that
108
- You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
- provided that such additional attribution notices cannot be construed as
110
- modifying the License.
111
-
112
- You may add Your own copyright statement to Your modifications and may provide
113
- additional or different license terms and conditions for use, reproduction, or
114
- distribution of Your modifications, or for any such Derivative Works as a whole,
115
- provided Your use, reproduction, and distribution of the Work otherwise complies
116
- with the conditions stated in this License.
117
-
118
- 5. Submission of Contributions. Unless You explicitly state otherwise, any
119
- Contribution intentionally submitted for inclusion in the Work by You to the
120
- Licensor shall be under the terms and conditions of this License, without any
121
- additional terms or conditions. Notwithstanding the above, nothing herein shall
122
- supersede or modify the terms of any separate license agreement you may have
123
- executed with Licensor regarding such Contributions.
124
-
125
- 6. Trademarks. This License does not grant permission to use the trade names,
126
- trademarks, service marks, or product names of the Licensor, except as required
127
- for reasonable and customary use in describing the origin of the Work and
128
- reproducing the content of the NOTICE file.
129
-
130
- 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
131
- writing, Licensor provides the Work (and each Contributor provides its
132
- Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
133
- KIND, either express or implied, including, without limitation, any warranties or
134
- conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
135
- PARTICULAR PURPOSE. You are solely responsible for determining the
136
- appropriateness of using or redistributing the Work and assume any risks
137
- associated with Your exercise of permissions under this License.
138
-
139
- 8. Limitation of Liability. In no event and under no legal theory, whether in
140
- tort (including negligence), contract, or otherwise, unless required by
141
- applicable law (such as deliberate and grossly negligent acts) or agreed to in
142
- writing, shall any Contributor be liable to You for damages, including any
143
- direct, indirect, special, incidental, or consequential damages of any character
144
- arising as a result of this License or out of the use or inability to use the
145
- Work (including but not limited to damages for loss of goodwill, work stoppage,
146
- computer failure or malfunction, or any and all other commercial damages or
147
- losses), even if such Contributor has been advised of the possibility of such
148
- damages.
149
-
150
- 9. Accepting Warranty or Additional Liability. While redistributing the Work or
151
- Derivative Works thereof, You may choose to offer, and charge a fee for,
152
- acceptance of support, warranty, indemnity, or other liability obligations
153
- and/or rights consistent with this License. However, in accepting such
154
- obligations, You may act only on Your own behalf and on Your sole
155
- responsibility, not on behalf of any other Contributor, and only if You agree to
156
- indemnify, defend, and hold each Contributor harmless for any liability incurred
157
- by, or claims asserted against, such Contributor by reason of your accepting any
158
- such warranty or additional liability.
159
-
160
- END OF TERMS AND CONDITIONS
161
-
162
- APPENDIX: How to apply the Apache License to your work.
163
-
164
- To apply the Apache License to your work, attach the following boilerplate
165
- notice, with the fields enclosed by brackets "[]" replaced with your own
166
- identifying information. (Do not include the brackets!) The text should be
167
- enclosed in the appropriate comment syntax for the file format. We also
168
- recommend that a file or class name and description of purpose be included on
169
- the same "printed page" as the copyright notice for easier identification within
170
- third-party archives.
171
-
172
- Copyright [yyyy] [name of copyright owner]
173
-
174
- Licensed under the Apache License, Version 2.0 (the "License");
175
- you may not use this file except in compliance with the License.
176
- You may obtain a copy of the License at
177
-
178
- https://www.apache.org/licenses/LICENSE-2.0
179
-
180
- Unless required by applicable law or agreed to in writing, software distributed
181
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
182
- CONDITIONS OF ANY KIND, either express or implied. See the License for the
183
- specific language governing permissions and limitations under the License.
@@ -1,15 +0,0 @@
1
- /**
2
- * Chat Plugin 导出入口。
3
- *
4
- * 关键点(中文)
5
- * - Index 只负责导出类实现与 channel SDK 对象。
6
- * - 真正的类实现位于 `ChatPlugin.ts`。
7
- */
8
- export { ChatPlugin } from "./ChatPlugin.js";
9
- export { FeishuChannel, QqChannel, TelegramChannel, } from "./channels/RuntimeChannel.js";
10
- export { CHAT_PLUGIN_CONFIG_JSON_SCHEMA, CHAT_PLUGIN_RESOURCE_JSON_SCHEMA, chat_plugin_config_schema, chat_plugin_resource_schema, get_chat_plugin_resource_json_schema, parse_chat_plugin_config, parse_chat_plugin_resource, resolve_chat_plugin_resource, } from "./config/ChatPluginConfig.js";
11
- export type { BaseChatChannelOptions, ChatChannelEnv, FeishuChannelOptions, QqChannelOptions, TelegramChannelOptions, } from "./channels/RuntimeChannel.js";
12
- export type { ChatChannel, ChatPluginOptions, } from "./types/ChatPluginOptions.js";
13
- export type { ChatPluginConfig } from "./config/ChatPluginConfig.js";
14
- export type { ChatPluginResource } from "./types/ChatPluginResource.js";
15
- //# sourceMappingURL=Index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../../src/chat/Index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,SAAS,EACT,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,wBAAwB,EACxB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,WAAW,EACX,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
package/bin/chat/Index.js DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * Chat Plugin 导出入口。
3
- *
4
- * 关键点(中文)
5
- * - Index 只负责导出类实现与 channel SDK 对象。
6
- * - 真正的类实现位于 `ChatPlugin.ts`。
7
- */
8
- export { ChatPlugin } from "./ChatPlugin.js";
9
- export { FeishuChannel, QqChannel, TelegramChannel, } from "./channels/RuntimeChannel.js";
10
- export { CHAT_PLUGIN_CONFIG_JSON_SCHEMA, CHAT_PLUGIN_RESOURCE_JSON_SCHEMA, chat_plugin_config_schema, chat_plugin_resource_schema, get_chat_plugin_resource_json_schema, parse_chat_plugin_config, parse_chat_plugin_resource, resolve_chat_plugin_resource, } from "./config/ChatPluginConfig.js";
11
- //# sourceMappingURL=Index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Index.js","sourceRoot":"","sources":["../../src/chat/Index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,SAAS,EACT,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,2BAA2B,EAC3B,oCAAoC,EACpC,wBAAwB,EACxB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC"}