@downcity/plugins 1.0.254 → 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 (448) 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/MemoryPlugin.d.ts +1 -1
  225. package/bin/memory/MemoryPlugin.d.ts.map +1 -1
  226. package/bin/memory/MemoryPlugin.js +17 -7
  227. package/bin/memory/MemoryPlugin.js.map +1 -1
  228. package/bin/memory/types/Memory.d.ts +10 -4
  229. package/bin/memory/types/Memory.d.ts.map +1 -1
  230. package/bin/memory.d.ts +1 -1
  231. package/bin/memory.d.ts.map +1 -1
  232. package/bin/renderers.d.ts +5 -0
  233. package/bin/renderers.d.ts.map +1 -0
  234. package/bin/renderers.js +12 -0
  235. package/bin/renderers.js.map +1 -0
  236. package/bin/sound/Plugin.d.ts +2 -5
  237. package/bin/sound/Plugin.d.ts.map +1 -1
  238. package/bin/sound/Plugin.js +27 -31
  239. package/bin/sound/Plugin.js.map +1 -1
  240. package/bin/sound/types/SoundPlugin.d.ts +22 -15
  241. package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
  242. package/bin/sound/types/SoundPlugin.js +2 -2
  243. package/bin/sound.d.ts +1 -1
  244. package/bin/sound.d.ts.map +1 -1
  245. package/bin/task/Action.d.ts +6 -6
  246. package/bin/task/Action.d.ts.map +1 -1
  247. package/bin/task/Action.js +21 -21
  248. package/bin/task/Action.js.map +1 -1
  249. package/bin/task/PROMPT.d.ts +1 -1
  250. package/bin/task/PROMPT.d.ts.map +1 -1
  251. package/bin/task/PROMPT.js +1 -1
  252. package/bin/task/PROMPT.js.map +1 -1
  253. package/bin/task/Scheduler.js +8 -8
  254. package/bin/task/Scheduler.js.map +1 -1
  255. package/bin/task/TaskPlugin.d.ts +7 -14
  256. package/bin/task/TaskPlugin.d.ts.map +1 -1
  257. package/bin/task/TaskPlugin.js +54 -43
  258. package/bin/task/TaskPlugin.js.map +1 -1
  259. package/bin/task/runtime/Model.d.ts +1 -5
  260. package/bin/task/runtime/Model.d.ts.map +1 -1
  261. package/bin/task/runtime/Model.js +2 -13
  262. package/bin/task/runtime/Model.js.map +1 -1
  263. package/bin/task/runtime/Paths.d.ts +7 -7
  264. package/bin/task/runtime/Paths.d.ts.map +1 -1
  265. package/bin/task/runtime/Paths.js +11 -11
  266. package/bin/task/runtime/Paths.js.map +1 -1
  267. package/bin/task/runtime/Runner.d.ts +1 -1
  268. package/bin/task/runtime/Runner.d.ts.map +1 -1
  269. package/bin/task/runtime/Runner.js +4 -5
  270. package/bin/task/runtime/Runner.js.map +1 -1
  271. package/bin/task/runtime/Store.d.ts +9 -9
  272. package/bin/task/runtime/Store.d.ts.map +1 -1
  273. package/bin/task/runtime/Store.js +17 -17
  274. package/bin/task/runtime/Store.js.map +1 -1
  275. package/bin/task/runtime/TaskActionExecution.js +6 -6
  276. package/bin/task/runtime/TaskActionExecution.js.map +1 -1
  277. package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
  278. package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
  279. package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
  280. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  281. package/bin/task/runtime/TaskRunnerRound.js +8 -3
  282. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  283. package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
  284. package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
  285. package/bin/task/runtime/TaskRunnerScript.js +0 -1
  286. package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
  287. package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
  288. package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  289. package/bin/task/runtime/TaskRunnerSession.js +2 -4
  290. package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
  291. package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
  292. package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
  293. package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
  294. package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
  295. package/bin/web/Plugin.d.ts +2 -6
  296. package/bin/web/Plugin.d.ts.map +1 -1
  297. package/bin/web/Plugin.js +21 -17
  298. package/bin/web/Plugin.js.map +1 -1
  299. package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
  300. package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
  301. package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
  302. package/bin/web/types/WebPlugin.d.ts +15 -9
  303. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  304. package/bin/web.d.ts +1 -1
  305. package/bin/web.d.ts.map +1 -1
  306. package/bin/workboard/runtime/Collector.js +1 -1
  307. package/bin/workboard/runtime/Collector.js.map +1 -1
  308. package/package.json +29 -20
  309. package/scripts/chat-access.test.mjs +3 -2
  310. package/scripts/chat-channel-config.test.mjs +3 -3
  311. package/scripts/chat-storage.test.mjs +10 -14
  312. package/scripts/memory-plugin.test.mjs +9 -32
  313. package/scripts/playwright-browser-provider.test.mjs +260 -0
  314. package/scripts/plugin-main.test.mjs +101 -0
  315. package/scripts/plugin-subpaths.test.mjs +28 -0
  316. package/scripts/sound-plugin.test.mjs +21 -9
  317. package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
  318. package/scripts/web-plugin.test.mjs +43 -186
  319. package/src/builtin/BuiltinPluginReadmes.ts +58 -0
  320. package/src/builtin/BuiltinPluginTypes.ts +260 -0
  321. package/src/builtin/PluginSettingsDefinitions.ts +45 -0
  322. package/src/builtin/main/PluginSettingsMain.ts +75 -0
  323. package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
  324. package/src/builtin/types/PluginSettings.ts +46 -0
  325. package/src/chat/ChatPlugin.ts +99 -51
  326. package/src/chat/access/ChatAccessRuntime.ts +1 -1
  327. package/src/chat/access/ChatAccessSchema.ts +5 -5
  328. package/src/chat/access/ChatAccessService.ts +4 -4
  329. package/src/chat/access/ChatAccessStore.ts +17 -9
  330. package/src/chat/channels/BaseChatChannel.ts +2 -0
  331. package/src/chat/channels/RuntimeChannel.ts +9 -9
  332. package/src/chat/channels/feishu/Feishu.ts +1 -1
  333. package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
  334. package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
  335. package/src/chat/channels/qq/QQ.ts +3 -2
  336. package/src/chat/channels/qq/QQEventCapture.ts +3 -3
  337. package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
  338. package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
  339. package/src/chat/channels/qq/QQSupport.ts +5 -0
  340. package/src/chat/channels/qq/VoiceInput.ts +5 -1
  341. package/src/chat/channels/telegram/ApiClient.ts +10 -3
  342. package/src/chat/channels/telegram/StateStore.ts +2 -2
  343. package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
  344. package/src/chat/main/ChatPluginMain.ts +163 -0
  345. package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
  346. package/src/chat/runtime/ChannelContextStore.ts +20 -20
  347. package/src/chat/runtime/ChatActionExecution.ts +6 -6
  348. package/src/chat/runtime/ChatChannelConfig.ts +7 -14
  349. package/src/chat/runtime/ChatChannelCore.ts +9 -9
  350. package/src/chat/runtime/ChatHistoryStore.ts +7 -7
  351. package/src/chat/runtime/ChatMetaStore.ts +1 -1
  352. package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
  353. package/src/chat/runtime/ChatQueue.ts +2 -69
  354. package/src/chat/runtime/ChatQueueStore.ts +10 -26
  355. package/src/chat/runtime/ChatQueueWorker.ts +2 -5
  356. package/src/chat/runtime/ChatSessionDelete.ts +4 -4
  357. package/src/chat/runtime/ChatStorage.ts +24 -24
  358. package/src/chat/types/ChatAccess.ts +2 -2
  359. package/src/chat/types/ChatCommand.ts +1 -1
  360. package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
  361. package/src/chat/types/ChatPluginConfig.ts +21 -0
  362. package/src/chat/types/ChatPluginOptions.ts +4 -4
  363. package/src/chat/types/ChatPluginProfile.ts +52 -0
  364. package/src/chat/types/ChatPluginRenderer.ts +25 -0
  365. package/src/chat/types/ChatRuntime.ts +14 -0
  366. package/src/chat/types/ChatRuntimeAccount.ts +3 -3
  367. package/src/chat/types/ChatStorage.ts +2 -2
  368. package/src/chat.ts +6 -14
  369. package/src/contact/Action.ts +5 -5
  370. package/src/contact/ContactPlugin.ts +15 -15
  371. package/src/contact/runtime/ChatRuntime.ts +3 -3
  372. package/src/contact/runtime/ContactStore.ts +20 -20
  373. package/src/contact/runtime/EndpointNotice.ts +2 -2
  374. package/src/contact/runtime/InboxStore.ts +16 -16
  375. package/src/contact/runtime/LinkApproval.ts +16 -16
  376. package/src/contact/runtime/LinkStore.ts +5 -5
  377. package/src/contact/runtime/Paths.ts +29 -29
  378. package/src/contact/runtime/ShareBundle.ts +5 -5
  379. package/src/contact/types/ContactApproval.ts +2 -2
  380. package/src/image/ImagePlugin.ts +30 -33
  381. package/src/image/runtime/ImageResultStorage.ts +36 -62
  382. package/src/image/types/ImagePlugin.ts +25 -19
  383. package/src/image.ts +2 -0
  384. package/src/index.ts +8 -0
  385. package/src/memory/MemoryPlugin.ts +17 -5
  386. package/src/memory/types/Memory.ts +11 -4
  387. package/src/memory.ts +1 -0
  388. package/src/renderers.ts +18 -0
  389. package/src/sound/Plugin.ts +34 -33
  390. package/src/sound/types/SoundPlugin.ts +24 -19
  391. package/src/sound.ts +2 -0
  392. package/src/task/Action.ts +27 -27
  393. package/src/task/PROMPT.ts +1 -1
  394. package/src/task/PROMPT.ts.txt +5 -6
  395. package/src/task/Scheduler.ts +8 -8
  396. package/src/task/TaskPlugin.ts +55 -46
  397. package/src/task/runtime/Model.ts +3 -13
  398. package/src/task/runtime/Paths.ts +11 -11
  399. package/src/task/runtime/Runner.ts +5 -6
  400. package/src/task/runtime/Store.ts +22 -22
  401. package/src/task/runtime/TaskActionExecution.ts +6 -6
  402. package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
  403. package/src/task/runtime/TaskRunnerRound.ts +13 -4
  404. package/src/task/runtime/TaskRunnerScript.ts +0 -5
  405. package/src/task/runtime/TaskRunnerSession.ts +10 -8
  406. package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
  407. package/src/web/Plugin.ts +23 -22
  408. package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
  409. package/src/web/types/WebPlugin.ts +16 -13
  410. package/src/web.ts +1 -0
  411. package/src/workboard/runtime/Collector.ts +1 -1
  412. package/tsconfig.json +4 -1
  413. package/LICENSE +0 -183
  414. package/bin/chat/Index.d.ts +0 -15
  415. package/bin/chat/Index.d.ts.map +0 -1
  416. package/bin/chat/Index.js +0 -11
  417. package/bin/chat/Index.js.map +0 -1
  418. package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
  419. package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
  420. package/bin/chat/config/ChatPluginConfig.js +0 -237
  421. package/bin/chat/config/ChatPluginConfig.js.map +0 -1
  422. package/bin/chat/types/ChatPluginResource.d.ts +0 -68
  423. package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
  424. package/bin/chat/types/ChatPluginResource.js +0 -10
  425. package/bin/chat/types/ChatPluginResource.js.map +0 -1
  426. package/bin/contact/Index.d.ts +0 -8
  427. package/bin/contact/Index.d.ts.map +0 -1
  428. package/bin/contact/Index.js +0 -8
  429. package/bin/contact/Index.js.map +0 -1
  430. package/bin/memory/Index.d.ts +0 -11
  431. package/bin/memory/Index.d.ts.map +0 -1
  432. package/bin/memory/Index.js +0 -11
  433. package/bin/memory/Index.js.map +0 -1
  434. package/bin/skill/Command.d.ts +0 -29
  435. package/bin/skill/Command.d.ts.map +0 -1
  436. package/bin/skill/Command.js +0 -35
  437. package/bin/skill/Command.js.map +0 -1
  438. package/bin/task/Index.d.ts +0 -9
  439. package/bin/task/Index.d.ts.map +0 -1
  440. package/bin/task/Index.js +0 -9
  441. package/bin/task/Index.js.map +0 -1
  442. package/src/chat/Index.ts +0 -36
  443. package/src/chat/config/ChatPluginConfig.ts +0 -266
  444. package/src/chat/types/ChatPluginResource.ts +0 -95
  445. package/src/contact/Index.ts +0 -8
  446. package/src/memory/Index.ts +0 -14
  447. package/src/skill/Command.ts +0 -58
  448. package/src/task/Index.ts +0 -8
@@ -15,6 +15,18 @@ import path from "node:path";
15
15
 
16
16
  import { SoundPlugin } from "../bin/index.js";
17
17
 
18
+ function create_sound_plugin(options = {}) {
19
+ const { list_models, asr, tts, ...profile } = options;
20
+ return new SoundPlugin({
21
+ ...profile,
22
+ sound_ai: {
23
+ catalog: async () => ({ all: () => (list_models ? list_models() : []) }),
24
+ asr,
25
+ tts,
26
+ },
27
+ });
28
+ }
29
+
18
30
  function create_context(root_path) {
19
31
  return {
20
32
  workspace_path: root_path,
@@ -37,7 +49,7 @@ function create_tts_message(url = "/workspace/speech.mp3") {
37
49
  parts: [
38
50
  {
39
51
  type: "file",
40
- mediaType: "audio/mpeg",
52
+ media_type: "audio/mpeg",
41
53
  filename: "speech.mp3",
42
54
  url,
43
55
  },
@@ -46,7 +58,7 @@ function create_tts_message(url = "/workspace/speech.mp3") {
46
58
  }
47
59
 
48
60
  test("sound.models 只返回 FED 中支持 ASR 或 TTS 的模型", async () => {
49
- const plugin = new SoundPlugin({
61
+ const plugin = create_sound_plugin({
50
62
  list_models: () => [
51
63
  { id: "asr", name: "ASR", modalities: ["asr"] },
52
64
  { id: "tts", name: "TTS", modalities: ["tts"] },
@@ -76,7 +88,7 @@ test("sound.asr 把本地音频转为 data URL 后直接调用 FED", async () =>
76
88
  const audio_path = path.join(root_path, "voice.wav");
77
89
  await fs.writeFile(audio_path, Buffer.from("audio-test"));
78
90
  let received_input;
79
- const plugin = new SoundPlugin({
91
+ const plugin = create_sound_plugin({
80
92
  default_asr_model: "fed-asr",
81
93
  asr: async (input) => {
82
94
  received_input = input;
@@ -117,7 +129,7 @@ test("sound.asr 把本地音频转为 data URL 后直接调用 FED", async () =>
117
129
  test("sound.tts 使用默认参数并返回 AI SDK UIMessage", async () => {
118
130
  let received_input;
119
131
  const message = create_tts_message();
120
- const plugin = new SoundPlugin({
132
+ const plugin = create_sound_plugin({
121
133
  default_tts_model: "fed-tts",
122
134
  language: "zh",
123
135
  voice: "alloy",
@@ -151,7 +163,7 @@ test("sound.tts 使用默认参数并返回 AI SDK UIMessage", async () => {
151
163
  });
152
164
 
153
165
  test("sound action 不会隐式选择模型或接受非 UIMessage TTS 结果", async () => {
154
- const plugin = new SoundPlugin({
166
+ const plugin = create_sound_plugin({
155
167
  asr: async () => ({ text: "ok" }),
156
168
  tts: async () => ({ url: "https://example.com/speech.mp3" }),
157
169
  });
@@ -172,7 +184,7 @@ test("sound action 不会隐式选择模型或接受非 UIMessage TTS 结果", a
172
184
  });
173
185
 
174
186
  test("sound.asr 只接受一种音频来源", async () => {
175
- const plugin = new SoundPlugin({
187
+ const plugin = create_sound_plugin({
176
188
  asr: async () => ({ text: "ok" }),
177
189
  tts: async () => create_tts_message(),
178
190
  });
@@ -186,7 +198,7 @@ test("sound.asr 只接受一种音频来源", async () => {
186
198
  });
187
199
 
188
200
  test("sound.tts 要求 UIMessage 包含音频 file part", async () => {
189
- const plugin = new SoundPlugin({
201
+ const plugin = create_sound_plugin({
190
202
  asr: async () => ({ text: "ok" }),
191
203
  tts: async () => ({
192
204
  id: "sound:text-only",
@@ -204,7 +216,7 @@ test("sound.tts 要求 UIMessage 包含音频 file part", async () => {
204
216
 
205
217
  test("auto_asr 必须配置默认 ASR 模型", () => {
206
218
  assert.throws(
207
- () => new SoundPlugin({
219
+ () => create_sound_plugin({
208
220
  auto_asr: true,
209
221
  asr: async () => ({ text: "ok" }),
210
222
  tts: async () => create_tts_message(),
@@ -217,7 +229,7 @@ test("auto_asr 把 chat 语音附件转写追加到正文", async () => {
217
229
  const root_path = await fs.mkdtemp(path.join(os.tmpdir(), "downcity-sound-auto-"));
218
230
  const audio_path = path.join(root_path, "message.ogg");
219
231
  await fs.writeFile(audio_path, Buffer.from("voice"));
220
- const plugin = new SoundPlugin({
232
+ const plugin = create_sound_plugin({
221
233
  auto_asr: true,
222
234
  default_asr_model: "fed-asr",
223
235
  asr: async () => ({ text: "hello <world>" }),
@@ -22,7 +22,7 @@ import {
22
22
  setShellApprovalModeView,
23
23
  startShellSession,
24
24
  writeShellSession,
25
- } from "@downcity/shell/session/ShellActionRuntime.js";
25
+ } from "@downcity/workspace/shell/session/ShellActionRuntime.js";
26
26
 
27
27
  async function create_fixture() {
28
28
  const root_path = await fs.mkdtemp(path.join(os.tmpdir(), "downcity-unrestricted-"));
@@ -1,76 +1,11 @@
1
- /**
2
- * WebPlugin provider-neutral action 回归测试。
3
- *
4
- * 关键点(中文)
5
- * - Plugin 必须显式注入 provider,不能只注册一段方法论。
6
- * - 浏览器 action 保持结构化输入输出,并在 lifecycle.stop 时释放 provider。
7
- * - 缺少某项 provider 时只让对应 action 返回明确失败。
8
- */
1
+ /** WebPlugin 配置与运行时上下文能力回归测试。 */
9
2
 
10
3
  import assert from "node:assert/strict";
11
4
  import test from "node:test";
12
- import {
13
- ComputerUseBrowserProviderAdapter,
14
- SemanticBrowserProviderAdapter,
15
- WebPlugin,
16
- } from "../bin/index.js";
5
+ import { WebPlugin } from "../bin/index.js";
17
6
 
18
- function create_browser_provider() {
19
- const sessions = new Map();
20
- let disposed = false;
21
- return {
22
- name: "mock-browser",
23
- get disposed() { return disposed; },
24
- async create_session(input) {
25
- const session_id = "browser-session-1";
26
- const state = {
27
- provider: this.name,
28
- session_id,
29
- url: input.url || "about:blank",
30
- title: "Mock page",
31
- text: "Initial page",
32
- };
33
- sessions.set(session_id, state);
34
- return state;
35
- },
36
- async observe(input) {
37
- const state = sessions.get(input.session_id);
38
- if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
39
- return state;
40
- },
41
- async act(input) {
42
- const state = sessions.get(input.session_id);
43
- if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
44
- const next = { ...state, text: `acted:${input.action.type}` };
45
- sessions.set(input.session_id, next);
46
- return next;
47
- },
48
- async extract(input) {
49
- const state = sessions.get(input.session_id);
50
- if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
51
- return {
52
- provider: this.name,
53
- session_id: input.session_id,
54
- url: state.url,
55
- content: state.text,
56
- };
57
- },
58
- async close_session(input) {
59
- sessions.delete(input.session_id);
60
- },
61
- async dispose() {
62
- sessions.clear();
63
- disposed = true;
64
- },
65
- };
66
- }
67
-
68
- test("WebPlugin 拒绝没有真实能力的空配置", () => {
69
- assert.throws(() => new WebPlugin({}), /requires at least one provider/);
70
- });
71
-
72
- test("WebPlugin 暴露结构化联网与浏览器 actions", () => {
73
- const plugin = new WebPlugin({ browser: create_browser_provider() });
7
+ test("WebPlugin 允许空配置并暴露稳定 actions", () => {
8
+ const plugin = new WebPlugin();
74
9
  assert.deepEqual(Object.keys(plugin.actions), [
75
10
  "search",
76
11
  "open",
@@ -82,142 +17,64 @@ test("WebPlugin 暴露结构化联网与浏览器 actions", () => {
82
17
  "browser_semantic_extract",
83
18
  "browser_close_session",
84
19
  ]);
85
- assert.equal(plugin.actions.install, undefined);
86
- assert.match(plugin.system(), /deterministic CSS-selector operations/);
20
+ assert.match(plugin.system(), /direct search or document reading/u);
87
21
  });
88
22
 
89
- test("search 与 open 委托给独立 provider", async () => {
90
- const plugin = new WebPlugin({
91
- search: async (input) => ({
92
- provider: "mock-search",
93
- items: [{ url: "https://example.com", title: input.query }],
94
- }),
95
- open: async (input) => ({
96
- provider: "mock-reader",
97
- url: input.url,
98
- title: "Example",
99
- content: "Example content",
100
- }),
101
- });
102
-
23
+ test("search 与 open PluginContext 读取宿主 Web 能力", async () => {
24
+ const plugin = new WebPlugin();
25
+ const context = {
26
+ web: {
27
+ async search(input) {
28
+ return {
29
+ provider: "mock-search",
30
+ items: [{ url: "https://example.com", title: input.query }],
31
+ };
32
+ },
33
+ async open(input) {
34
+ return {
35
+ provider: "mock-reader",
36
+ url: input.url,
37
+ title: "Example",
38
+ content: "Example content",
39
+ };
40
+ },
41
+ },
42
+ };
103
43
  const search_result = await plugin.actions.search.execute({
104
- context: {},
44
+ context,
105
45
  input: { query: "official docs" },
106
46
  });
107
47
  const open_result = await plugin.actions.open.execute({
108
- context: {},
48
+ context,
109
49
  input: { url: "https://example.com" },
110
50
  });
111
-
112
51
  assert.equal(search_result.success, true);
113
52
  assert.equal(search_result.data.provider, "mock-search");
114
53
  assert.equal(open_result.success, true);
115
54
  assert.equal(open_result.data.content, "Example content");
116
55
  });
117
56
 
118
- test("浏览器 session 完整执行 create、act、extract 与 close", async () => {
119
- const browser = create_browser_provider();
120
- const plugin = new WebPlugin({ browser });
121
- const created = await plugin.actions.browser_create_session.execute({
122
- context: {},
123
- input: { url: "https://example.com" },
124
- });
125
- const session_id = created.data.session_id;
126
-
127
- const acted = await plugin.actions.browser_act.execute({
128
- context: {},
129
- input: { session_id, action: { type: "click", selector: "a" } },
130
- });
131
- const extracted = await plugin.actions.browser_extract.execute({
132
- context: {},
133
- input: { session_id },
134
- });
135
- const closed = await plugin.actions.browser_close_session.execute({
136
- context: {},
137
- input: { session_id },
138
- });
139
-
140
- assert.equal(created.success, true);
141
- assert.equal(acted.data.text, "acted:click");
142
- assert.equal(extracted.data.content, "acted:click");
143
- assert.deepEqual(closed.data, { session_id, closed: true });
144
- });
145
-
146
- test("语义 adapter 复用基础 session 并暴露语义 actions", async () => {
147
- const base_browser = create_browser_provider();
148
- const browser = new SemanticBrowserProviderAdapter({
149
- name: "mock-semantic",
150
- browser: base_browser,
151
- semantic_act: async (input) => ({
152
- ...(await base_browser.observe({ session_id: input.session_id })),
153
- text: `semantic:${input.instruction}`,
154
- }),
155
- semantic_extract: async (input) => ({
156
- provider: "mock-semantic",
157
- session_id: input.session_id,
158
- url: "https://example.com",
159
- content: `semantic-extract:${input.instruction}`,
160
- }),
161
- });
162
- const plugin = new WebPlugin({ browser });
163
- const created = await plugin.actions.browser_create_session.execute({
164
- context: {},
165
- input: { url: "https://example.com" },
166
- });
167
- const session_id = created.data.session_id;
168
- const acted = await plugin.actions.browser_semantic_act.execute({
169
- context: {},
170
- input: { session_id, instruction: "click the login button" },
171
- });
172
- const extracted = await plugin.actions.browser_semantic_extract.execute({
57
+ test("缺少运行时能力或 CDP 配置时只让对应 action 失败", async () => {
58
+ const plugin = new WebPlugin();
59
+ const search_result = await plugin.actions.search.execute({
173
60
  context: {},
174
- input: { session_id, instruction: "extract the account name" },
175
- });
176
-
177
- assert.equal(acted.success, true);
178
- assert.equal(acted.data.text, "semantic:click the login button");
179
- assert.equal(extracted.data.content, "semantic-extract:extract the account name");
180
- });
181
-
182
- test("Computer Use adapter 先获取截图观察再委托模型循环", async () => {
183
- const base_browser = create_browser_provider();
184
- const browser = new ComputerUseBrowserProviderAdapter({
185
- name: "mock-computer-use",
186
- browser: base_browser,
187
- run: async ({ instruction, observation }) => ({
188
- ...observation,
189
- text: `computer-use:${instruction}`,
190
- screenshot_data_url: observation.screenshot_data_url ?? "data:image/png;base64,mock",
191
- }),
61
+ input: { query: "test" },
192
62
  });
193
- const plugin = new WebPlugin({ browser });
194
- const created = await plugin.actions.browser_create_session.execute({
63
+ const browser_result = await plugin.actions.browser_create_session.execute({
195
64
  context: {},
196
65
  input: { url: "https://example.com" },
197
66
  });
198
- const result = await plugin.actions.browser_semantic_act.execute({
199
- context: {},
200
- input: {
201
- session_id: created.data.session_id,
202
- instruction: "drag the map",
203
- },
204
- });
205
-
206
- assert.equal(result.success, true);
207
- assert.equal(result.data.text, "computer-use:drag the map");
208
- assert.match(result.data.screenshot_data_url, /^data:image\/png;base64/);
209
- });
210
-
211
- test("未配置的 action 返回明确失败,lifecycle.stop 释放浏览器", async () => {
212
- const browser = create_browser_provider();
213
- const plugin = new WebPlugin({ browser });
214
- const search_result = await plugin.actions.search.execute({
215
- context: {},
216
- input: { query: "test" },
217
- });
218
67
  assert.equal(search_result.success, false);
219
- assert.match(search_result.error, /not configured/);
68
+ assert.match(search_result.error, /not configured/u);
69
+ assert.equal(browser_result.success, false);
70
+ assert.match(browser_result.error, /not configured/u);
71
+ await plugin.lifecycle.stop();
72
+ });
220
73
 
221
- await plugin.lifecycle.stop({});
222
- assert.equal(browser.disposed, true);
74
+ test("WebPlugin 只接受公开的浏览器 provider 枚举", () => {
75
+ assert.doesNotThrow(() => new WebPlugin({ browser: "playwright" }));
76
+ assert.throws(
77
+ () => new WebPlugin({ browser: "unknown" }),
78
+ /Unsupported Web browser provider/u,
79
+ );
223
80
  });
@@ -0,0 +1,58 @@
1
+ /** Downcity 官方 Plugin 的用户说明内容。 */
2
+
3
+ /** 官方 Plugin 在宿主 Overview 中展示的 Markdown 说明。 */
4
+ export const BUILTIN_PLUGIN_READMES = {
5
+ skill: `# Skill Catalog And Loader
6
+
7
+ Discovers skills available to the Agent, reads their instructions, and adds guidance for selecting the right skill during a task.
8
+
9
+ ## What it provides
10
+
11
+ - Lists and inspects installed skills.
12
+ - Loads skill instructions only when they are relevant.
13
+ - Keeps skill discovery separate from the Agent definition.`,
14
+ workboard: `# Workboard Snapshot
15
+
16
+ Collects structured snapshots of Agent runtime activity so work can be inspected and presented consistently.
17
+
18
+ The Plugin owns snapshot collection and normalization; it does not change how an Agent executes a task.`,
19
+ contact: `# Contact
20
+
21
+ Manages trusted relationships with remote Agents and provides the actions required to exchange messages and shared information.
22
+
23
+ Contact state is stored in the current Agent's private Plugin data directory.`,
24
+ task: `# Task
25
+
26
+ Creates and manages reusable Agent tasks, trigger definitions, and execution records.
27
+
28
+ Tasks remain Agent-owned runtime resources and can be scheduled or invoked through the Plugin's actions.`,
29
+ chat: `# Chat
30
+
31
+ Connects an Agent to external conversations through Telegram, Feishu / Lark, and QQ.
32
+
33
+ ## Profiles and Channels
34
+
35
+ - Each Profile contains one complete Chat configuration.
36
+ - A Channel type can appear once in the same Profile.
37
+ - Credentials stay in Plugin configuration and are not copied into \`agent.json\`.`,
38
+ memory: `# Memory
39
+
40
+ Provides provider-neutral long-term memory with recall, revision, and deletion capabilities.
41
+
42
+ Memory data belongs to the current Agent and is stored in that Agent's private Plugin runtime directory.`,
43
+ web: `# Web
44
+
45
+ Provides web search, document reading, and optional browser sessions to an Agent.
46
+
47
+ Use Profiles to isolate provider endpoints, credentials, and browser settings for different environments.`,
48
+ image: `# Image
49
+
50
+ Discovers available image models, generates images, and returns structured result metadata.
51
+
52
+ Use Profiles to keep image service endpoints and credentials separate between environments.`,
53
+ sound: `# Sound
54
+
55
+ Discovers speech models and provides automatic speech recognition and text-to-speech actions.
56
+
57
+ Use Profiles to isolate speech service endpoints, models, and credentials.`,
58
+ } as const;
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Downcity 官方 Plugin 注册集合。
3
+ *
4
+ * 本模块负责把官方 Plugin 按应用配置装配成 Agent 独享实例。应用提供
5
+ * Embassy 服务,Plugin 自身只持有明确的服务接口。
6
+ */
7
+
8
+ import type { Plugin } from "@downcity/agent";
9
+ import type { PluginHostContext } from "@downcity/agent";
10
+ import type { PluginMainModule } from "@downcity/plugin";
11
+ import { CHAT_PLUGIN_MAIN } from "@/chat/main/ChatPluginMain.js";
12
+ import {
13
+ IMAGE_PLUGIN_SETTINGS,
14
+ SOUND_PLUGIN_SETTINGS,
15
+ WEB_PLUGIN_SETTINGS,
16
+ } from "@/builtin/PluginSettingsDefinitions.js";
17
+ import { create_plugin_settings_main } from "@/builtin/main/PluginSettingsMain.js";
18
+ import { BUILTIN_PLUGIN_READMES } from "@/builtin/BuiltinPluginReadmes.js";
19
+ import {
20
+ ChatPlugin,
21
+ type ChatPluginConfig,
22
+ type ChatPluginChannelConfig,
23
+ } from "@/chat.js";
24
+ import { FeishuChannel, QqChannel, TelegramChannel } from "@/chat.js";
25
+ import { ContactPlugin } from "@/contact.js";
26
+ import { ImagePlugin } from "@/image.js";
27
+ import {
28
+ MemoryPlugin,
29
+ } from "@/memory.js";
30
+ import { SkillPlugin } from "@/skill.js";
31
+ import { SoundPlugin } from "@/sound.js";
32
+ import { TaskPlugin } from "@/task.js";
33
+ import {
34
+ WebPlugin,
35
+ type WebPluginOptions,
36
+ } from "@/web.js";
37
+ import { WorkboardPlugin } from "@/workboard.js";
38
+
39
+ /** 官方 Plugin definition 的最小结构协议。 */
40
+ export interface BuiltinPluginDefinition {
41
+ /** Plugin 的稳定 ID。 */
42
+ id: string;
43
+
44
+ /** Plugin 的用户可见标题。 */
45
+ title: string;
46
+
47
+ /** Plugin 的用途说明。 */
48
+ description: string;
49
+
50
+ /** 宿主 Overview 展示的完整 Markdown 用户说明。 */
51
+ readme: string;
52
+
53
+ /** 官方 Plugin 是否提供 Agent 能力。 */
54
+ has_agent: boolean;
55
+
56
+ /** 官方 Plugin 是否提供宿主 main。 */
57
+ has_main: boolean;
58
+
59
+ /** 官方 Plugin 是否提供唯一 Mainview。 */
60
+ has_renderer: boolean;
61
+ }
62
+
63
+ /** 官方 Plugin 注册协议。 */
64
+ export interface BuiltinPluginRegistration {
65
+ /** Plugin 的唯一静态定义。 */
66
+ readonly definition: BuiltinPluginDefinition;
67
+ /** 使用 City 读取的 Profile 创建一个 Agent 独享的 Plugin 实例。 */
68
+ create_agent(context: PluginHostContext): Plugin | Promise<Plugin>;
69
+
70
+ /** 可选的宿主 main 生命周期对象。 */
71
+ main?: PluginMainModule;
72
+
73
+ }
74
+
75
+ /** 创建官方 Plugin 注册集合所需的宿主能力。 */
76
+ export interface BuiltinPluginRegistrationsOptions {
77
+ /** Contact Plugin 对外报告的 HTTP 地址。 */
78
+ contact_http?: {
79
+ /** HTTP 监听地址。 */
80
+ host?: string;
81
+ /** HTTP 监听端口。 */
82
+ port?: number;
83
+ };
84
+
85
+ }
86
+
87
+ /** 创建 Downcity 官方 Plugin 注册集合。 */
88
+ export function create_builtin_plugin_registrations(
89
+ options: BuiltinPluginRegistrationsOptions,
90
+ ): BuiltinPluginRegistration[] {
91
+ return [
92
+ simple_registration(
93
+ "skill",
94
+ "Skill Catalog And Loader",
95
+ "Lists and reads local skills, and injects discovery guidance.",
96
+ BUILTIN_PLUGIN_READMES.skill,
97
+ () => new SkillPlugin(),
98
+ ),
99
+ simple_registration(
100
+ "workboard",
101
+ "Workboard Snapshot",
102
+ "Collects structured Agent runtime activity snapshots.",
103
+ BUILTIN_PLUGIN_READMES.workboard,
104
+ () => new WorkboardPlugin(),
105
+ ),
106
+ simple_registration(
107
+ "contact",
108
+ "Contact",
109
+ "Manages trusted relationships and exchanges with remote Agents.",
110
+ BUILTIN_PLUGIN_READMES.contact,
111
+ () => new ContactPlugin({
112
+ host: options.contact_http?.host,
113
+ port: options.contact_http?.port,
114
+ }),
115
+ ),
116
+ simple_registration(
117
+ "task",
118
+ "Task",
119
+ "Manages reusable tasks and their trigger runtime.",
120
+ BUILTIN_PLUGIN_READMES.task,
121
+ () => new TaskPlugin(),
122
+ ),
123
+ {
124
+ definition: {
125
+ id: "chat",
126
+ title: "Chat",
127
+ description: "Connects Agents to Telegram, Feishu, and QQ channels.",
128
+ readme: BUILTIN_PLUGIN_READMES.chat,
129
+ has_agent: true,
130
+ has_main: true,
131
+ has_renderer: true,
132
+ },
133
+ main: CHAT_PLUGIN_MAIN,
134
+ create_agent(context) {
135
+ const config = context.profile as unknown as ChatPluginConfig;
136
+ return new ChatPlugin({
137
+ queue: config.queue,
138
+ channels: create_chat_channels(config.channels ?? []),
139
+ });
140
+ },
141
+ },
142
+ {
143
+ definition: {
144
+ id: "memory",
145
+ title: "Memory",
146
+ description: "Provides provider-neutral long-term memory, recall, revision, and deletion.",
147
+ readme: BUILTIN_PLUGIN_READMES.memory,
148
+ has_agent: true,
149
+ has_main: false,
150
+ has_renderer: false,
151
+ },
152
+ create_agent(context) {
153
+ return new MemoryPlugin({ root_path: context.data_path });
154
+ },
155
+ },
156
+ {
157
+ definition: {
158
+ id: "web",
159
+ title: "Web",
160
+ description: "Provides web search, document reading, and optional browser sessions.",
161
+ readme: BUILTIN_PLUGIN_READMES.web,
162
+ has_agent: true,
163
+ has_main: true,
164
+ has_renderer: true,
165
+ },
166
+ main: create_plugin_settings_main(WEB_PLUGIN_SETTINGS),
167
+ create_agent(context) {
168
+ const config = context.profile as unknown as WebPluginOptions;
169
+ return new WebPlugin(config);
170
+ },
171
+ },
172
+ {
173
+ definition: {
174
+ id: "image",
175
+ title: "Image",
176
+ description: "Discovers image models, generates images, and reads results.",
177
+ readme: BUILTIN_PLUGIN_READMES.image,
178
+ has_agent: true,
179
+ has_main: true,
180
+ has_renderer: true,
181
+ },
182
+ main: create_plugin_settings_main(IMAGE_PLUGIN_SETTINGS),
183
+ create_agent: (context) => new ImagePlugin({
184
+ ...context.profile,
185
+ }),
186
+ },
187
+ {
188
+ definition: {
189
+ id: "sound",
190
+ title: "Sound",
191
+ description: "Discovers speech models and provides ASR and TTS.",
192
+ readme: BUILTIN_PLUGIN_READMES.sound,
193
+ has_agent: true,
194
+ has_main: true,
195
+ has_renderer: true,
196
+ },
197
+ main: create_plugin_settings_main(SOUND_PLUGIN_SETTINGS),
198
+ create_agent: (context) => new SoundPlugin({
199
+ ...context.profile,
200
+ }),
201
+ },
202
+ ];
203
+ }
204
+
205
+ /** 获取并适配官方 ImagePlugin 所需的 Embassy 图片服务。 */
206
+ /** 创建没有配置协议的简单注册。 */
207
+ function simple_registration(
208
+ id: string,
209
+ title: string,
210
+ description: string,
211
+ readme: string,
212
+ create_agent: () => Plugin,
213
+ ): BuiltinPluginRegistration {
214
+ return {
215
+ definition: {
216
+ id,
217
+ title,
218
+ description,
219
+ readme,
220
+ has_agent: true,
221
+ has_main: false,
222
+ has_renderer: false,
223
+ },
224
+ create_agent,
225
+ };
226
+ }
227
+
228
+ /** 创建 Chat Resource 对应的运行渠道。 */
229
+ function create_chat_channels(configs: ChatPluginChannelConfig[]) {
230
+ const channel_types = new Set<string>();
231
+ return configs.map((config) => {
232
+ if (channel_types.has(config.type)) {
233
+ throw new Error(`Chat Plugin channel type is duplicated: ${config.type}`);
234
+ }
235
+ channel_types.add(config.type);
236
+ if (config.type === "telegram") {
237
+ return new TelegramChannel({
238
+ id: config.id,
239
+ name: config.name,
240
+ bot_token: config.bot_token,
241
+ });
242
+ }
243
+ if (config.type === "feishu") {
244
+ return new FeishuChannel({
245
+ id: config.id,
246
+ name: config.name,
247
+ app_id: config.app_id,
248
+ app_secret: config.app_secret,
249
+ domain: config.domain,
250
+ });
251
+ }
252
+ return new QqChannel({
253
+ id: config.id,
254
+ name: config.name,
255
+ app_id: config.app_id,
256
+ app_secret: config.app_secret,
257
+ sandbox: config.sandbox,
258
+ });
259
+ });
260
+ }