@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
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - Chat Plugin 是 channel meta、chat history 与渠道缓存路径的唯一所有者。
6
- * - PluginContext 只提供项目根目录,不暴露任何 Chat 领域路径。
6
+ * - PluginContext 提供 Agent 数据根,Chat 不再写入项目目录。
7
7
  * - CLI 离线维护通过本模块操作 Chat 存储,不复制内部 JSON 结构。
8
8
  */
9
9
 
@@ -28,27 +28,27 @@ function normalize_thread_id(input: unknown): number | undefined {
28
28
  return Math.trunc(value);
29
29
  }
30
30
 
31
- function get_downcity_path(root_path: string): string {
32
- return path.join(root_path, ".downcity");
31
+ function get_chat_data_path(data_path: string): string {
32
+ return path.resolve(data_path);
33
33
  }
34
34
 
35
35
  /** 返回 Chat 渠道路由目录。 */
36
- export function get_chat_channel_dir_path(root_path: string): string {
37
- return path.join(get_downcity_path(root_path), "channel");
36
+ export function get_chat_channel_dir_path(data_path: string): string {
37
+ return path.join(get_chat_data_path(data_path), "channel");
38
38
  }
39
39
 
40
40
  /** 返回 Chat 渠道路由文件。 */
41
- export function get_chat_channel_meta_path(root_path: string): string {
42
- return path.join(get_chat_channel_dir_path(root_path), "meta.json");
41
+ export function get_chat_channel_meta_path(data_path: string): string {
42
+ return path.join(get_chat_channel_dir_path(data_path), "meta.json");
43
43
  }
44
44
 
45
45
  /** 返回单个 Chat 会话的事件目录。 */
46
46
  export function get_chat_session_dir_path(
47
- root_path: string,
47
+ data_path: string,
48
48
  session_id: string,
49
49
  ): string {
50
50
  return path.join(
51
- get_downcity_path(root_path),
51
+ get_chat_data_path(data_path),
52
52
  "chat",
53
53
  encodeURIComponent(normalize_text(session_id)),
54
54
  );
@@ -56,21 +56,21 @@ export function get_chat_session_dir_path(
56
56
 
57
57
  /** 返回单个 Chat 会话的事件流文件。 */
58
58
  export function get_chat_history_path(
59
- root_path: string,
59
+ data_path: string,
60
60
  session_id: string,
61
61
  ): string {
62
- return path.join(get_chat_session_dir_path(root_path, session_id), "history.jsonl");
62
+ return path.join(get_chat_session_dir_path(data_path, session_id), "history.jsonl");
63
63
  }
64
64
 
65
65
  /** 返回飞书渠道的消息去重目录。 */
66
- export function get_feishu_dedupe_dir_path(root_path: string): string {
67
- return path.join(get_downcity_path(root_path), ".cache", "feishu", "dedupe");
66
+ export function get_feishu_dedupe_dir_path(data_path: string): string {
67
+ return path.join(get_chat_data_path(data_path), ".cache", "feishu", "dedupe");
68
68
  }
69
69
 
70
70
  async function read_channel_meta(
71
- root_path: string,
71
+ data_path: string,
72
72
  ): Promise<Partial<ChannelContextMetaFileV1>> {
73
- const raw = await fs.readJson(get_chat_channel_meta_path(root_path)).catch(() => null);
73
+ const raw = await fs.readJson(get_chat_channel_meta_path(data_path)).catch(() => null);
74
74
  return raw && typeof raw === "object"
75
75
  ? raw as Partial<ChannelContextMetaFileV1>
76
76
  : {};
@@ -124,7 +124,7 @@ function resolve_session_id(
124
124
  }
125
125
 
126
126
  async function remove_route(
127
- root_path: string,
127
+ data_path: string,
128
128
  meta: Partial<ChannelContextMetaFileV1>,
129
129
  session_id: string,
130
130
  ): Promise<boolean> {
@@ -143,9 +143,9 @@ async function remove_route(
143
143
  removed = true;
144
144
  }
145
145
  if (!removed) return false;
146
- await fs.ensureDir(get_chat_channel_dir_path(root_path));
146
+ await fs.ensureDir(get_chat_channel_dir_path(data_path));
147
147
  await fs.writeJson(
148
- get_chat_channel_meta_path(root_path),
148
+ get_chat_channel_meta_path(data_path),
149
149
  {
150
150
  ...meta,
151
151
  v: 1,
@@ -162,10 +162,10 @@ async function remove_route(
162
162
  * 清空单个 Chat 会话的事件历史。
163
163
  */
164
164
  export async function clear_chat_history(
165
- root_path: string,
165
+ data_path: string,
166
166
  session_id: string,
167
167
  ): Promise<boolean> {
168
- const history_path = get_chat_history_path(root_path, session_id);
168
+ const history_path = get_chat_history_path(data_path, session_id);
169
169
  const existed = await fs.pathExists(history_path);
170
170
  if (existed) await fs.remove(history_path);
171
171
  return existed;
@@ -181,8 +181,8 @@ export async function clear_chat_history(
181
181
  export async function clean_chat_storage(
182
182
  input: ChatStorageCleanInput,
183
183
  ): Promise<ChatStorageCleanResult> {
184
- const root_path = path.resolve(normalize_text(input.root_path) || ".");
185
- const meta = await read_channel_meta(root_path);
184
+ const data_path = path.resolve(normalize_text(input.data_path) || ".");
185
+ const meta = await read_channel_meta(data_path);
186
186
  const session_id = resolve_session_id(meta, input);
187
187
  if (!session_id) {
188
188
  return {
@@ -191,10 +191,10 @@ export async function clean_chat_storage(
191
191
  removed_route: false,
192
192
  };
193
193
  }
194
- const chat_dir_path = get_chat_session_dir_path(root_path, session_id);
194
+ const chat_dir_path = get_chat_session_dir_path(data_path, session_id);
195
195
  const removed_chat_dir = await fs.pathExists(chat_dir_path);
196
196
  if (removed_chat_dir) await fs.remove(chat_dir_path);
197
- const removed_route = await remove_route(root_path, meta, session_id);
197
+ const removed_route = await remove_route(data_path, meta, session_id);
198
198
  return {
199
199
  session_id,
200
200
  removed_chat_dir,
@@ -208,8 +208,8 @@ export interface RevokeChatAccessGrantInput {
208
208
 
209
209
  /** ChatAccessService 构造参数。 */
210
210
  export interface ChatAccessServiceOptions {
211
- /** 当前 Agent 项目根目录。 */
212
- project_root: string;
211
+ /** 当前 Agent private runtime directory 私有数据根目录。 */
212
+ data_path: string;
213
213
  }
214
214
 
215
215
  /** 直接设置 Principal Grant 的输入。 */
@@ -76,7 +76,7 @@ export type ChatHistoryRequest = {
76
76
  * Chat 会话列表请求。
77
77
  *
78
78
  * 关键点(中文)
79
- * - 仅列出当前 agent 本地已记录的 chat context(来自 `.downcity/channel/meta.json`)。
79
+ * - 仅列出当前 Agent private runtime directory 已记录的 chat context(来自其数据目录的 `channel/meta.json`)。
80
80
  * - 不会向外部平台拉取“全部会话”,因为平台侧通常需要额外权限且成本高。
81
81
  */
82
82
  export type ChatListRequest = {
@@ -0,0 +1,63 @@
1
+ /** Chat Plugin profile 中的渠道配置类型。 */
2
+
3
+ /** Telegram Bot 渠道配置。 */
4
+ export interface TelegramPluginChannelConfig {
5
+ /** profile 内稳定渠道 ID。 */
6
+ id: string;
7
+ /** 渠道判别字段。 */
8
+ type: "telegram";
9
+ /** 用户可见渠道名称。 */
10
+ name: string;
11
+ /** Telegram Bot API Token。 */
12
+ bot_token: string;
13
+ /** 可选 Telegram username。 */
14
+ username?: string;
15
+ /** 可选 Telegram Bot 用户 ID。 */
16
+ bot_user_id?: string;
17
+ }
18
+
19
+ /** Feishu / Lark Bot 渠道配置。 */
20
+ export interface FeishuPluginChannelConfig {
21
+ /** profile 内稳定渠道 ID。 */
22
+ id: string;
23
+ /** 渠道判别字段。 */
24
+ type: "feishu";
25
+ /** 用户可见渠道名称。 */
26
+ name: string;
27
+ /** Feishu / Lark App ID。 */
28
+ app_id: string;
29
+ /** Feishu / Lark App Secret。 */
30
+ app_secret: string;
31
+ /** 可选 Open API Domain。 */
32
+ domain?: string;
33
+ /** 可选 Bot 身份。 */
34
+ identity?: string;
35
+ /** 可选 Bot 用户 ID。 */
36
+ bot_user_id?: string;
37
+ }
38
+
39
+ /** QQ Bot 渠道配置。 */
40
+ export interface QqPluginChannelConfig {
41
+ /** profile 内稳定渠道 ID。 */
42
+ id: string;
43
+ /** 渠道判别字段。 */
44
+ type: "qq";
45
+ /** 用户可见渠道名称。 */
46
+ name: string;
47
+ /** QQ Bot App ID。 */
48
+ app_id: string;
49
+ /** QQ Bot App Secret。 */
50
+ app_secret: string;
51
+ /** 是否使用 QQ 沙箱环境。 */
52
+ sandbox?: boolean;
53
+ /** 可选 Bot 身份。 */
54
+ identity?: string;
55
+ /** 可选 Bot 用户 ID。 */
56
+ bot_user_id?: string;
57
+ }
58
+
59
+ /** Chat Plugin profile 支持的完整渠道配置。 */
60
+ export type ChatPluginChannelConfig =
61
+ | TelegramPluginChannelConfig
62
+ | FeishuPluginChannelConfig
63
+ | QqPluginChannelConfig;
@@ -0,0 +1,21 @@
1
+ /** Chat Plugin 的完整 profile 类型。 */
2
+
3
+ import type { ChatPluginChannelConfig } from "@/chat/types/ChatPluginChannelConfig.js";
4
+
5
+ /** Chat 消息队列与合并策略。 */
6
+ export interface ChatPluginQueueConfig {
7
+ /** 同时执行的最大 Chat lane 数。 */
8
+ max_concurrency?: number;
9
+ /** 合并连续入站消息的防抖窗口,单位为毫秒。 */
10
+ merge_debounce_ms?: number;
11
+ /** 入站消息等待合并的最长时间,单位为毫秒。 */
12
+ merge_max_wait_ms?: number;
13
+ }
14
+
15
+ /** Chat Plugin 的完整结构化 profile。 */
16
+ export interface ChatPluginConfig {
17
+ /** 可选的消息队列与合并策略。 */
18
+ queue?: ChatPluginQueueConfig;
19
+ /** 当前 profile 拥有的消息渠道。 */
20
+ channels?: ChatPluginChannelConfig[];
21
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - ChatPlugin 只接收 queue 行为与 channels 列表。
6
- * - 每个 channel 对象自己负责 env / 凭据 / 账号池绑定解析。
6
+ * - 每个 channel 对象自己负责 env、凭据与运行账号解析。
7
7
  * - 这样 ChatPlugin 不再理解 Telegram、Feishu、QQ 的具体配置字段。
8
8
  */
9
9
 
@@ -25,9 +25,9 @@ export interface ChatChannel {
25
25
  */
26
26
  isEnabled(context: PluginContext): boolean;
27
27
  /**
28
- * 当前 channel 来源 Resource 的稳定 ID。
28
+ * 当前 channel 的稳定 ID。
29
29
  */
30
- getResourceId(context: PluginContext): string;
30
+ get_channel_id(context: PluginContext): string;
31
31
  /**
32
32
  * 解析当前 channel 的运行态账号。
33
33
  */
@@ -50,7 +50,7 @@ export interface ChatPluginOptions {
50
50
  * 当前 agent 持有的 chat channels。
51
51
  *
52
52
  * 说明(中文)
53
- * - 每个 channel 对象自己负责 env、凭据与账号池绑定解析。
53
+ * - 每个 channel 对象自己负责 env、凭据与运行账号解析。
54
54
  * - 未传入时不启用任何 chat channel。
55
55
  */
56
56
  channels?: ChatChannel[];
@@ -0,0 +1,52 @@
1
+ /** Chat Plugin Mainview 使用的 Profile 公开配置类型。 */
2
+
3
+ /** Mainview 可见的 Chat 队列配置。 */
4
+ export interface ChatPluginPublicQueueConfig {
5
+ /** 同时处理的最大 Chat 任务数量。 */
6
+ max_concurrency?: number;
7
+
8
+ /** 合并连续入站消息前等待的毫秒数。 */
9
+ merge_debounce_ms?: number;
10
+
11
+ /** 一组入站消息允许等待合并的最大毫秒数。 */
12
+ merge_max_wait_ms?: number;
13
+ }
14
+
15
+ /** Mainview 可见的单个 Chat Channel。 */
16
+ export interface ChatPluginPublicChannelConfig {
17
+ /** Channel 在当前 Profile 内的稳定 ID。 */
18
+ id: string;
19
+
20
+ /** Channel 类型。 */
21
+ type: "telegram" | "feishu" | "qq";
22
+
23
+ /** 用户可见名称。 */
24
+ name: string;
25
+
26
+ /** Telegram Bot Token;读取时不返回已有值。 */
27
+ bot_token?: string;
28
+
29
+ /** 飞书或 QQ App ID。 */
30
+ app_id?: string;
31
+
32
+ /** 飞书或 QQ App Secret;读取时不返回已有值。 */
33
+ app_secret?: string;
34
+
35
+ /** 飞书 API Domain。 */
36
+ domain?: string;
37
+
38
+ /** QQ 是否使用沙箱环境。 */
39
+ sandbox?: boolean;
40
+
41
+ /** 当前 Channel 是否已经保存凭据。 */
42
+ secret_configured: boolean;
43
+ }
44
+
45
+ /** Mainview 可见的完整 Chat Profile。 */
46
+ export interface ChatPluginPublicProfile {
47
+ /** Chat 队列行为。 */
48
+ queue: ChatPluginPublicQueueConfig;
49
+
50
+ /** 当前 Profile 拥有的全部 Channel。 */
51
+ channels: ChatPluginPublicChannelConfig[];
52
+ }
@@ -0,0 +1,25 @@
1
+ /** Chat Plugin React Mainview 的内部组件属性类型。 */
2
+
3
+ import type { PluginRendererUiComponents } from "@downcity/plugin/react";
4
+ import type { ChatPluginPublicChannelConfig } from "./ChatPluginProfile.js";
5
+
6
+ /** 单个 Chat Channel 编辑分组的属性。 */
7
+ export interface ChatPluginChannelEditorProps {
8
+ /** 当前 Channel 草稿。 */
9
+ readonly channel: ChatPluginPublicChannelConfig;
10
+
11
+ /** 当前 Profile 中已经被其他 Channel 使用的类型。 */
12
+ readonly used_types: ReadonlySet<ChatPluginPublicChannelConfig["type"]>;
13
+
14
+ /** 当前 Mainview 使用的宿主 UI Components。 */
15
+ readonly components: Pick<
16
+ PluginRendererUiComponents,
17
+ "Button" | "Group" | "Input" | "Row" | "Select" | "Switch"
18
+ >;
19
+
20
+ /** 替换当前 Channel 草稿。 */
21
+ update(channel: ChatPluginPublicChannelConfig): void;
22
+
23
+ /** 删除当前 Channel 草稿。 */
24
+ remove(): void;
25
+ }
@@ -9,6 +9,8 @@
9
9
  import type { FeishuBot } from "@/chat/channels/feishu/Feishu.js";
10
10
  import type { QQBot } from "@/chat/channels/qq/QQ.js";
11
11
  import type { TelegramBot } from "@/chat/channels/telegram/Bot.js";
12
+ import type { ChatQueueWorker } from "@/chat/runtime/ChatQueueWorker.js";
13
+ import type { ChatQueueStore } from "@/chat/runtime/ChatQueueStore.js";
12
14
 
13
15
  /**
14
16
  * `ChatPlugin` 实例持有的渠道状态。
@@ -31,3 +33,15 @@ export type ChatChannelState = {
31
33
  */
32
34
  qq: QQBot | null;
33
35
  };
36
+
37
+ /** ChatPlugin 在单个 Workspace 中持有的全部长期运行态。 */
38
+ export interface ChatWorkspaceRuntime {
39
+ /** 当前 Workspace 的渠道连接状态。 */
40
+ readonly channel_state: ChatChannelState;
41
+
42
+ /** 当前 Workspace 的消息队列存储。 */
43
+ readonly queue_store: ChatQueueStore;
44
+
45
+ /** 当前 Workspace 的消息队列消费 worker。 */
46
+ readonly queue_worker: ChatQueueWorker;
47
+ }
@@ -3,15 +3,15 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - 该类型只用于 Channel Adapter 消费宿主已解析的构造参数。
6
- * - 它不表达存储、账号池或 Resource 查询能力。
7
- * - 生命周期字段用于现有状态与访问控制逻辑,不是 Plugin Resource 的持久化协议。
6
+ * - 它不表达存储、账号池或独立配置查询能力。
7
+ * - 生命周期字段仅用于现有状态与访问控制逻辑,不表达独立持久化领域。
8
8
  */
9
9
 
10
10
  import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
11
11
 
12
12
  /** 一个 Channel 启动所需的完整运行时账号快照。 */
13
13
  export interface ChatRuntimeAccount {
14
- /** 来源 Resource 或 SDK 调用方提供的稳定 ID。 */
14
+ /** Plugin profile 或 SDK 调用方提供的稳定 Channel ID。 */
15
15
  id: string;
16
16
 
17
17
  /** 账号对应的 Chat Channel 类型。 */
@@ -10,8 +10,8 @@
10
10
  * 清理单个 Chat 会话存储的输入。
11
11
  */
12
12
  export interface ChatStorageCleanInput {
13
- /** 当前 Agent 项目根目录。 */
14
- root_path: string;
13
+ /** 当前 Agent private runtime directory 内部数据根目录。 */
14
+ data_path: string;
15
15
  /** 已知的 Session 标识;提供时优先使用。 */
16
16
  session_id?: string;
17
17
  /** Chat 渠道名称;未提供 Session 标识时用于解析目标会话。 */
package/src/chat.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * `@downcity/plugins/chat` 独立公开入口。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 汇总 ChatPlugin、Resource Schema、运行渠道与 Chat Access 公开能力。
5
+ * - 汇总 ChatPlugin、运行渠道与 Chat Access 公开能力。
6
6
  * - 不加载其他内建 plugin 的入口模块。
7
7
  */
8
8
 
@@ -21,17 +21,6 @@ export {
21
21
  export { get_chat_access_db_path } from "./chat/access/ChatAccessStore.js";
22
22
  export { CHAT_ACCESS_ACTIONS } from "./chat/types/ChatAccess.js";
23
23
  export { clean_chat_storage } from "./chat/runtime/ChatStorage.js";
24
- export {
25
- CHAT_PLUGIN_CONFIG_JSON_SCHEMA,
26
- CHAT_PLUGIN_RESOURCE_JSON_SCHEMA,
27
- chat_plugin_config_schema,
28
- chat_plugin_resource_schema,
29
- get_chat_plugin_resource_json_schema,
30
- parse_chat_plugin_config,
31
- parse_chat_plugin_resource,
32
- resolve_chat_plugin_resource,
33
- } from "./chat/config/ChatPluginConfig.js";
34
-
35
24
  export type {
36
25
  ChatStorageCleanInput,
37
26
  ChatStorageCleanResult,
@@ -47,8 +36,11 @@ export type {
47
36
  ChatChannel,
48
37
  ChatPluginOptions,
49
38
  } from "./chat/types/ChatPluginOptions.js";
50
- export type { ChatPluginConfig } from "./chat/config/ChatPluginConfig.js";
51
- export type { ChatPluginResource } from "./chat/types/ChatPluginResource.js";
39
+ export type {
40
+ ChatPluginConfig,
41
+ ChatPluginQueueConfig,
42
+ } from "./chat/types/ChatPluginConfig.js";
43
+ export type { ChatPluginChannelConfig } from "./chat/types/ChatPluginChannelConfig.js";
52
44
  export type {
53
45
  ApproveChatAccessRequestInput,
54
46
  ChatAccessDecision,
@@ -130,7 +130,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
130
130
  data: await handlers.link(
131
131
  params.context,
132
132
  params.input as ContactLinkCommandPayload,
133
- params.execution_context,
133
+ params.execution.snapshot,
134
134
  ),
135
135
  }),
136
136
  }),
@@ -173,7 +173,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
173
173
  data: await handlers.approve(
174
174
  params.context,
175
175
  params.input as unknown as ContactApproveCommandPayload,
176
- params.execution_context,
176
+ params.execution.snapshot,
177
177
  ),
178
178
  }),
179
179
  }),
@@ -193,7 +193,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
193
193
  execute: async (params) => ({
194
194
  success: true,
195
195
  data: {
196
- contacts: await listContacts(params.context.workspace_path),
196
+ contacts: await listContacts(params.context.data_path),
197
197
  } as unknown as JsonValue,
198
198
  }),
199
199
  }),
@@ -354,7 +354,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
354
354
  execute: async (params) => ({
355
355
  success: true,
356
356
  data: {
357
- shares: await listContactInboxShares(params.context.workspace_path),
357
+ shares: await listContactInboxShares(params.context.data_path),
358
358
  } as unknown as JsonValue,
359
359
  }),
360
360
  }),
@@ -385,7 +385,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
385
385
  execute: async (params) => ({
386
386
  success: true,
387
387
  data: (await receiveShare({
388
- project_root: params.context.workspace_path,
388
+ data_path: params.context.data_path,
389
389
  shareId: (params.input as unknown as ContactReceiveCommandPayload).shareId,
390
390
  })) as unknown as JsonValue,
391
391
  }),
@@ -209,7 +209,7 @@ export class ContactPlugin extends BasePlugin {
209
209
  );
210
210
  const agentName = getAgentName(context);
211
211
 
212
- await saveContactLinkRecord(context.workspace_path, {
212
+ await saveContactLinkRecord(context.data_path, {
213
213
  id: linkId,
214
214
  agentName,
215
215
  endpoint,
@@ -293,7 +293,7 @@ export class ContactPlugin extends BasePlugin {
293
293
  if (!response.success) throw new Error(response.error || "Contact approve failed");
294
294
 
295
295
  const name = String(payload.name || response.agentName || parsed.agentName).trim();
296
- const contact = await saveContact(context.workspace_path, {
296
+ const contact = await saveContact(context.data_path, {
297
297
  id: createStableContactId(name),
298
298
  name,
299
299
  endpoint: response.endpoint || parsed.endpoint,
@@ -326,7 +326,7 @@ export class ContactPlugin extends BasePlugin {
326
326
  }
327
327
  }
328
328
  const finalContact = confirmed
329
- ? await saveContact(context.workspace_path, {
329
+ ? await saveContact(context.data_path, {
330
330
  ...contact,
331
331
  reachability: "bidirectional",
332
332
  inboundTokenHash: tokenForRequester ? hashContactToken(tokenForRequester) : null,
@@ -356,7 +356,7 @@ export class ContactPlugin extends BasePlugin {
356
356
  const endpointInput = String(payload.endpoint || "").trim();
357
357
  const contact = endpointInput
358
358
  ? null
359
- : await findContact(context.workspace_path, String(payload.target || "").trim());
359
+ : await findContact(context.data_path, String(payload.target || "").trim());
360
360
  const endpoint = endpointInput || contact?.endpoint || "";
361
361
  if (!endpoint) throw new Error("contact target or --to endpoint is required");
362
362
  if (contact && !contact.outboundToken) {
@@ -369,7 +369,7 @@ export class ContactPlugin extends BasePlugin {
369
369
  token: contact?.outboundToken || undefined,
370
370
  });
371
371
  if (contact && pong.success) {
372
- await touchContactSeen(context.workspace_path, contact.id);
372
+ await touchContactSeen(context.data_path, contact.id);
373
373
  }
374
374
  return {
375
375
  target: contact?.name || endpoint,
@@ -392,17 +392,17 @@ export class ContactPlugin extends BasePlugin {
392
392
  }
393
393
 
394
394
  private async chat(context: PluginContext, payload: ContactChatCommandPayload) {
395
- const contact = await findContact(context.workspace_path, payload.to);
395
+ const contact = await findContact(context.data_path, payload.to);
396
396
  if (!contact) throw new Error(`Contact not found: ${payload.to}`);
397
397
  const message = String(payload.message || "").trim();
398
398
  if (!message) {
399
399
  return {
400
400
  contact,
401
- messages: await readContactMessages(context.workspace_path, contact.id),
401
+ messages: await readContactMessages(context.data_path, contact.id),
402
402
  };
403
403
  }
404
404
 
405
- await appendContactMessage(context.workspace_path, contact.id, {
405
+ await appendContactMessage(context.data_path, contact.id, {
406
406
  role: "local",
407
407
  text: message,
408
408
  created_at: Date.now(),
@@ -418,7 +418,7 @@ export class ContactPlugin extends BasePlugin {
418
418
  } as unknown as JsonValue,
419
419
  });
420
420
  if (!response.success) throw new Error(response.error || "Contact chat failed");
421
- await appendContactMessage(context.workspace_path, contact.id, {
421
+ await appendContactMessage(context.data_path, contact.id, {
422
422
  role: "remote",
423
423
  text: response.reply,
424
424
  created_at: Date.now(),
@@ -427,7 +427,7 @@ export class ContactPlugin extends BasePlugin {
427
427
  }
428
428
 
429
429
  private async share(context: PluginContext, payload: ContactShareCommandPayload) {
430
- const contact = await findContact(context.workspace_path, payload.to);
430
+ const contact = await findContact(context.data_path, payload.to);
431
431
  if (!contact) throw new Error(`Contact not found: ${payload.to}`);
432
432
  const outbound = requireOutboundContact(contact);
433
433
  const share = await createShareInput({
@@ -466,7 +466,7 @@ export class ContactPlugin extends BasePlugin {
466
466
  plugin: "contact",
467
467
  };
468
468
  }
469
- const contact = await findContactByInboundToken(context.workspace_path, token);
469
+ const contact = await findContactByInboundToken(context.data_path, token);
470
470
  return {
471
471
  success: true,
472
472
  agentName: getAgentName(context),
@@ -480,7 +480,7 @@ export class ContactPlugin extends BasePlugin {
480
480
  request: ContactApproveLinkRequest,
481
481
  ): Promise<ContactApproveLinkResponse> {
482
482
  return await approveContactLinkRequest({
483
- project_root: context.workspace_path,
483
+ data_path: context.data_path,
484
484
  ownerAgentName: getAgentName(context),
485
485
  ownerEndpoint: await resolveSelfEndpoint(context, this.options),
486
486
  request,
@@ -492,7 +492,7 @@ export class ContactPlugin extends BasePlugin {
492
492
  request: ContactConfirmRequest,
493
493
  ): Promise<ContactConfirmResponse> {
494
494
  return await confirmContactLinkRequest({
495
- project_root: context.workspace_path,
495
+ data_path: context.data_path,
496
496
  ownerAgentName: getAgentName(context),
497
497
  request,
498
498
  verifyCallback: async ({ endpoint, token }) => {
@@ -509,7 +509,7 @@ export class ContactPlugin extends BasePlugin {
509
509
  const payload = readContactObject(rawPayload);
510
510
  const token = readContactString(payload, "token");
511
511
  const body = readContactObject(payload.body);
512
- const contact = await findContactByInboundToken(context.workspace_path, token);
512
+ const contact = await findContactByInboundToken(context.data_path, token);
513
513
  if (!contact || contact.status !== "trusted") {
514
514
  throw new Error("Invalid contact token");
515
515
  }
@@ -521,7 +521,7 @@ export class ContactPlugin extends BasePlugin {
521
521
  receivedAt: Date.now(),
522
522
  status: "pending" as const,
523
523
  };
524
- await saveContactInboxShare(context.workspace_path, {
524
+ await saveContactInboxShare(context.data_path, {
525
525
  meta,
526
526
  payload: share.payload,
527
527
  files: Array.isArray(share.files) ? share.files : [],
@@ -30,7 +30,7 @@ export async function receiveContactChatMessage(params: {
30
30
  */
31
31
  message: string;
32
32
  }): Promise<ContactChatResponse> {
33
- const contact = await findContactByInboundToken(params.context.workspace_path, params.token);
33
+ const contact = await findContactByInboundToken(params.context.data_path, params.token);
34
34
  if (!contact || contact.status !== "trusted") {
35
35
  return {
36
36
  success: false,
@@ -41,7 +41,7 @@ export async function receiveContactChatMessage(params: {
41
41
  }
42
42
 
43
43
  const now = Date.now();
44
- await appendContactMessage(params.context.workspace_path, contact.id, {
44
+ await appendContactMessage(params.context.data_path, contact.id, {
45
45
  role: "remote",
46
46
  text: params.message,
47
47
  created_at: now,
@@ -53,7 +53,7 @@ export async function receiveContactChatMessage(params: {
53
53
  });
54
54
  const result = await turn.finished;
55
55
  const reply = result.text.trim();
56
- await appendContactMessage(params.context.workspace_path, contact.id, {
56
+ await appendContactMessage(params.context.data_path, contact.id, {
57
57
  role: "local",
58
58
  text: reply,
59
59
  created_at: Date.now(),