@downcity/plugins 1.0.253 → 1.0.280

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (496) hide show
  1. package/bin/builtin/BuiltinPluginReadmes.d.ts +14 -0
  2. package/bin/builtin/BuiltinPluginReadmes.d.ts.map +1 -0
  3. package/bin/builtin/BuiltinPluginReadmes.js +58 -0
  4. package/bin/builtin/BuiltinPluginReadmes.js.map +1 -0
  5. package/bin/builtin/BuiltinPluginTypes.d.ts +48 -0
  6. package/bin/builtin/BuiltinPluginTypes.d.ts.map +1 -0
  7. package/bin/builtin/BuiltinPluginTypes.js +161 -0
  8. package/bin/builtin/BuiltinPluginTypes.js.map +1 -0
  9. package/bin/builtin/PluginSettingsDefinitions.d.ts +9 -0
  10. package/bin/builtin/PluginSettingsDefinitions.d.ts.map +1 -0
  11. package/bin/builtin/PluginSettingsDefinitions.js +41 -0
  12. package/bin/builtin/PluginSettingsDefinitions.js.map +1 -0
  13. package/bin/builtin/main/PluginSettingsMain.d.ts +6 -0
  14. package/bin/builtin/main/PluginSettingsMain.d.ts.map +1 -0
  15. package/bin/builtin/main/PluginSettingsMain.js +65 -0
  16. package/bin/builtin/main/PluginSettingsMain.js.map +1 -0
  17. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts +6 -0
  18. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts.map +1 -0
  19. package/bin/builtin/renderer/PluginSettingsRenderer.js +76 -0
  20. package/bin/builtin/renderer/PluginSettingsRenderer.js.map +1 -0
  21. package/bin/builtin/types/PluginSettings.d.ts +35 -0
  22. package/bin/builtin/types/PluginSettings.d.ts.map +1 -0
  23. package/bin/builtin/types/PluginSettings.js +3 -0
  24. package/bin/builtin/types/PluginSettings.js.map +1 -0
  25. package/bin/chat/ChatPlugin.d.ts +12 -28
  26. package/bin/chat/ChatPlugin.d.ts.map +1 -1
  27. package/bin/chat/ChatPlugin.js +97 -49
  28. package/bin/chat/ChatPlugin.js.map +1 -1
  29. package/bin/chat/access/ChatAccessRuntime.js +1 -1
  30. package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
  31. package/bin/chat/access/ChatAccessSchema.d.ts +2 -2
  32. package/bin/chat/access/ChatAccessSchema.d.ts.map +1 -1
  33. package/bin/chat/access/ChatAccessSchema.js +3 -3
  34. package/bin/chat/access/ChatAccessSchema.js.map +1 -1
  35. package/bin/chat/access/ChatAccessService.d.ts +2 -2
  36. package/bin/chat/access/ChatAccessService.d.ts.map +1 -1
  37. package/bin/chat/access/ChatAccessService.js +4 -4
  38. package/bin/chat/access/ChatAccessService.js.map +1 -1
  39. package/bin/chat/access/ChatAccessStore.d.ts +3 -3
  40. package/bin/chat/access/ChatAccessStore.d.ts.map +1 -1
  41. package/bin/chat/access/ChatAccessStore.js +17 -8
  42. package/bin/chat/access/ChatAccessStore.js.map +1 -1
  43. package/bin/chat/channels/BaseChatChannel.d.ts +1 -0
  44. package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
  45. package/bin/chat/channels/BaseChatChannel.js +2 -0
  46. package/bin/chat/channels/BaseChatChannel.js.map +1 -1
  47. package/bin/chat/channels/RuntimeChannel.d.ts +4 -4
  48. package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
  49. package/bin/chat/channels/RuntimeChannel.js +8 -8
  50. package/bin/chat/channels/RuntimeChannel.js.map +1 -1
  51. package/bin/chat/channels/feishu/Feishu.js +1 -1
  52. package/bin/chat/channels/feishu/Feishu.js.map +1 -1
  53. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -0
  54. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
  55. package/bin/chat/channels/feishu/FeishuPlatformClient.js +3 -0
  56. package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
  57. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +2 -0
  58. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
  59. package/bin/chat/channels/feishu/FeishuPlatformLookup.js +1 -1
  60. package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
  61. package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
  62. package/bin/chat/channels/qq/QQ.js +3 -2
  63. package/bin/chat/channels/qq/QQ.js.map +1 -1
  64. package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
  65. package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
  66. package/bin/chat/channels/qq/QQEventCapture.js +3 -3
  67. package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
  68. package/bin/chat/channels/qq/QQInboundDedupe.d.ts +1 -1
  69. package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
  70. package/bin/chat/channels/qq/QQInboundDedupe.js +1 -1
  71. package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
  72. package/bin/chat/channels/qq/QQMessageHandler.d.ts +4 -0
  73. package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
  74. package/bin/chat/channels/qq/QQMessageHandler.js +2 -0
  75. package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
  76. package/bin/chat/channels/qq/QQSupport.d.ts +4 -0
  77. package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
  78. package/bin/chat/channels/qq/QQSupport.js +1 -0
  79. package/bin/chat/channels/qq/QQSupport.js.map +1 -1
  80. package/bin/chat/channels/qq/VoiceInput.d.ts +3 -0
  81. package/bin/chat/channels/qq/VoiceInput.d.ts.map +1 -1
  82. package/bin/chat/channels/qq/VoiceInput.js +1 -1
  83. package/bin/chat/channels/qq/VoiceInput.js.map +1 -1
  84. package/bin/chat/channels/telegram/ApiClient.d.ts +3 -1
  85. package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
  86. package/bin/chat/channels/telegram/ApiClient.js +4 -2
  87. package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
  88. package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
  89. package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
  90. package/bin/chat/channels/telegram/StateStore.js +2 -2
  91. package/bin/chat/channels/telegram/StateStore.js.map +1 -1
  92. package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  93. package/bin/chat/channels/telegram/TelegramPlatformClient.js +2 -1
  94. package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
  95. package/bin/chat/main/ChatPluginMain.d.ts +4 -0
  96. package/bin/chat/main/ChatPluginMain.d.ts.map +1 -0
  97. package/bin/chat/main/ChatPluginMain.js +137 -0
  98. package/bin/chat/main/ChatPluginMain.js.map +1 -0
  99. package/bin/chat/renderer/ChatPluginRenderer.d.ts +4 -0
  100. package/bin/chat/renderer/ChatPluginRenderer.d.ts.map +1 -0
  101. package/bin/chat/renderer/ChatPluginRenderer.js +105 -0
  102. package/bin/chat/renderer/ChatPluginRenderer.js.map +1 -0
  103. package/bin/chat/runtime/ChannelContextStore.d.ts +2 -2
  104. package/bin/chat/runtime/ChannelContextStore.js +20 -20
  105. package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
  106. package/bin/chat/runtime/ChatActionExecution.js +6 -6
  107. package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
  108. package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  109. package/bin/chat/runtime/ChatChannelConfig.js +7 -12
  110. package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
  111. package/bin/chat/runtime/ChatChannelCore.d.ts +3 -3
  112. package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  113. package/bin/chat/runtime/ChatChannelCore.js +5 -5
  114. package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
  115. package/bin/chat/runtime/ChatHistoryStore.d.ts +1 -1
  116. package/bin/chat/runtime/ChatHistoryStore.js +7 -7
  117. package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
  118. package/bin/chat/runtime/ChatMetaStore.d.ts +1 -1
  119. package/bin/chat/runtime/ChatMetaStore.js +1 -1
  120. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts +1 -1
  121. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
  122. package/bin/chat/runtime/ChatPluginActionRegistry.js +9 -9
  123. package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
  124. package/bin/chat/runtime/ChatQueue.d.ts +3 -38
  125. package/bin/chat/runtime/ChatQueue.d.ts.map +1 -1
  126. package/bin/chat/runtime/ChatQueue.js +3 -51
  127. package/bin/chat/runtime/ChatQueue.js.map +1 -1
  128. package/bin/chat/runtime/ChatQueueStore.d.ts +5 -16
  129. package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
  130. package/bin/chat/runtime/ChatQueueStore.js +8 -22
  131. package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
  132. package/bin/chat/runtime/ChatQueueWorker.d.ts +1 -1
  133. package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  134. package/bin/chat/runtime/ChatQueueWorker.js +1 -2
  135. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  136. package/bin/chat/runtime/ChatSessionDelete.d.ts +3 -3
  137. package/bin/chat/runtime/ChatSessionDelete.js +4 -4
  138. package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
  139. package/bin/chat/runtime/ChatStorage.d.ts +7 -7
  140. package/bin/chat/runtime/ChatStorage.js +24 -24
  141. package/bin/chat/runtime/ChatStorage.js.map +1 -1
  142. package/bin/chat/types/ChatAccess.d.ts +2 -2
  143. package/bin/chat/types/ChatAccess.d.ts.map +1 -1
  144. package/bin/chat/types/ChatCommand.d.ts +1 -1
  145. package/bin/chat/types/ChatPluginChannelConfig.d.ts +57 -0
  146. package/bin/chat/types/ChatPluginChannelConfig.d.ts.map +1 -0
  147. package/bin/chat/types/ChatPluginChannelConfig.js +3 -0
  148. package/bin/chat/types/ChatPluginChannelConfig.js.map +1 -0
  149. package/bin/chat/types/ChatPluginConfig.d.ts +19 -0
  150. package/bin/chat/types/ChatPluginConfig.d.ts.map +1 -0
  151. package/bin/chat/types/ChatPluginConfig.js +3 -0
  152. package/bin/chat/types/ChatPluginConfig.js.map +1 -0
  153. package/bin/chat/types/ChatPluginOptions.d.ts +4 -4
  154. package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
  155. package/bin/chat/types/ChatPluginOptions.js +1 -1
  156. package/bin/chat/types/ChatPluginProfile.d.ts +39 -0
  157. package/bin/chat/types/ChatPluginProfile.d.ts.map +1 -0
  158. package/bin/chat/types/ChatPluginProfile.js +3 -0
  159. package/bin/chat/types/ChatPluginProfile.js.map +1 -0
  160. package/bin/chat/types/ChatPluginRenderer.d.ts +17 -0
  161. package/bin/chat/types/ChatPluginRenderer.d.ts.map +1 -0
  162. package/bin/chat/types/ChatPluginRenderer.js +3 -0
  163. package/bin/chat/types/ChatPluginRenderer.js.map +1 -0
  164. package/bin/chat/types/ChatRuntime.d.ts +11 -0
  165. package/bin/chat/types/ChatRuntime.d.ts.map +1 -1
  166. package/bin/chat/types/ChatRuntimeAccount.d.ts +3 -3
  167. package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -1
  168. package/bin/chat/types/ChatRuntimeAccount.js +2 -2
  169. package/bin/chat/types/ChatStorage.d.ts +2 -2
  170. package/bin/chat/types/ChatStorage.d.ts.map +1 -1
  171. package/bin/chat.d.ts +3 -4
  172. package/bin/chat.d.ts.map +1 -1
  173. package/bin/chat.js +1 -2
  174. package/bin/chat.js.map +1 -1
  175. package/bin/contact/Action.js +5 -5
  176. package/bin/contact/Action.js.map +1 -1
  177. package/bin/contact/ContactPlugin.js +15 -15
  178. package/bin/contact/ContactPlugin.js.map +1 -1
  179. package/bin/contact/runtime/ChatRuntime.js +3 -3
  180. package/bin/contact/runtime/ChatRuntime.js.map +1 -1
  181. package/bin/contact/runtime/ContactStore.d.ts +8 -8
  182. package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
  183. package/bin/contact/runtime/ContactStore.js +20 -20
  184. package/bin/contact/runtime/ContactStore.js.map +1 -1
  185. package/bin/contact/runtime/EndpointNotice.js +2 -2
  186. package/bin/contact/runtime/EndpointNotice.js.map +1 -1
  187. package/bin/contact/runtime/InboxStore.d.ts +6 -6
  188. package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
  189. package/bin/contact/runtime/InboxStore.js +16 -16
  190. package/bin/contact/runtime/InboxStore.js.map +1 -1
  191. package/bin/contact/runtime/LinkApproval.js +14 -14
  192. package/bin/contact/runtime/LinkApproval.js.map +1 -1
  193. package/bin/contact/runtime/LinkStore.d.ts +2 -2
  194. package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
  195. package/bin/contact/runtime/LinkStore.js +5 -5
  196. package/bin/contact/runtime/LinkStore.js.map +1 -1
  197. package/bin/contact/runtime/Paths.d.ts +15 -15
  198. package/bin/contact/runtime/Paths.d.ts.map +1 -1
  199. package/bin/contact/runtime/Paths.js +29 -29
  200. package/bin/contact/runtime/Paths.js.map +1 -1
  201. package/bin/contact/runtime/ShareBundle.d.ts +1 -1
  202. package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
  203. package/bin/contact/runtime/ShareBundle.js +4 -4
  204. package/bin/contact/runtime/ShareBundle.js.map +1 -1
  205. package/bin/contact/types/ContactApproval.d.ts +2 -2
  206. package/bin/contact/types/ContactApproval.d.ts.map +1 -1
  207. package/bin/image/ImagePlugin.d.ts +1 -4
  208. package/bin/image/ImagePlugin.d.ts.map +1 -1
  209. package/bin/image/ImagePlugin.js +26 -34
  210. package/bin/image/ImagePlugin.js.map +1 -1
  211. package/bin/image/runtime/ImageResultStorage.d.ts +2 -2
  212. package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -1
  213. package/bin/image/runtime/ImageResultStorage.js +15 -38
  214. package/bin/image/runtime/ImageResultStorage.js.map +1 -1
  215. package/bin/image/types/ImagePlugin.d.ts +23 -16
  216. package/bin/image/types/ImagePlugin.d.ts.map +1 -1
  217. package/bin/image/types/ImagePlugin.js +1 -1
  218. package/bin/image.d.ts +1 -1
  219. package/bin/image.d.ts.map +1 -1
  220. package/bin/index.d.ts +2 -0
  221. package/bin/index.d.ts.map +1 -1
  222. package/bin/index.js +1 -0
  223. package/bin/index.js.map +1 -1
  224. package/bin/memory/Action.d.ts +27 -36
  225. package/bin/memory/Action.d.ts.map +1 -1
  226. package/bin/memory/Action.js +71 -311
  227. package/bin/memory/Action.js.map +1 -1
  228. package/bin/memory/MemoryPlugin.d.ts +20 -37
  229. package/bin/memory/MemoryPlugin.d.ts.map +1 -1
  230. package/bin/memory/MemoryPlugin.js +241 -233
  231. package/bin/memory/MemoryPlugin.js.map +1 -1
  232. package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts +43 -0
  233. package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts.map +1 -0
  234. package/bin/memory/adapters/FileMemoryStorageAdapter.js +163 -0
  235. package/bin/memory/adapters/FileMemoryStorageAdapter.js.map +1 -0
  236. package/bin/memory/providers/BuiltinMemoryProvider.d.ts +63 -0
  237. package/bin/memory/providers/BuiltinMemoryProvider.d.ts.map +1 -0
  238. package/bin/memory/providers/BuiltinMemoryProvider.js +772 -0
  239. package/bin/memory/providers/BuiltinMemoryProvider.js.map +1 -0
  240. package/bin/memory/runtime/SystemProvider.d.ts +7 -12
  241. package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
  242. package/bin/memory/runtime/SystemProvider.js +30 -89
  243. package/bin/memory/runtime/SystemProvider.js.map +1 -1
  244. package/bin/memory/types/BuiltinMemoryProvider.d.ts +88 -0
  245. package/bin/memory/types/BuiltinMemoryProvider.d.ts.map +1 -0
  246. package/bin/memory/types/BuiltinMemoryProvider.js +9 -0
  247. package/bin/memory/types/BuiltinMemoryProvider.js.map +1 -0
  248. package/bin/memory/types/Memory.d.ts +255 -408
  249. package/bin/memory/types/Memory.d.ts.map +1 -1
  250. package/bin/memory/types/Memory.js +4 -4
  251. package/bin/memory/types/MemoryStorage.d.ts +35 -0
  252. package/bin/memory/types/MemoryStorage.d.ts.map +1 -0
  253. package/bin/memory/types/MemoryStorage.js +10 -0
  254. package/bin/memory/types/MemoryStorage.js.map +1 -0
  255. package/bin/memory.d.ts +6 -2
  256. package/bin/memory.d.ts.map +1 -1
  257. package/bin/memory.js +3 -1
  258. package/bin/memory.js.map +1 -1
  259. package/bin/renderers.d.ts +5 -0
  260. package/bin/renderers.d.ts.map +1 -0
  261. package/bin/renderers.js +12 -0
  262. package/bin/renderers.js.map +1 -0
  263. package/bin/sound/Plugin.d.ts +2 -5
  264. package/bin/sound/Plugin.d.ts.map +1 -1
  265. package/bin/sound/Plugin.js +27 -31
  266. package/bin/sound/Plugin.js.map +1 -1
  267. package/bin/sound/types/SoundPlugin.d.ts +22 -15
  268. package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
  269. package/bin/sound/types/SoundPlugin.js +2 -2
  270. package/bin/sound.d.ts +1 -1
  271. package/bin/sound.d.ts.map +1 -1
  272. package/bin/task/Action.d.ts +6 -6
  273. package/bin/task/Action.d.ts.map +1 -1
  274. package/bin/task/Action.js +21 -21
  275. package/bin/task/Action.js.map +1 -1
  276. package/bin/task/PROMPT.d.ts +1 -1
  277. package/bin/task/PROMPT.d.ts.map +1 -1
  278. package/bin/task/PROMPT.js +1 -1
  279. package/bin/task/PROMPT.js.map +1 -1
  280. package/bin/task/Scheduler.js +8 -8
  281. package/bin/task/Scheduler.js.map +1 -1
  282. package/bin/task/TaskPlugin.d.ts +7 -14
  283. package/bin/task/TaskPlugin.d.ts.map +1 -1
  284. package/bin/task/TaskPlugin.js +54 -43
  285. package/bin/task/TaskPlugin.js.map +1 -1
  286. package/bin/task/runtime/Model.d.ts +1 -5
  287. package/bin/task/runtime/Model.d.ts.map +1 -1
  288. package/bin/task/runtime/Model.js +2 -13
  289. package/bin/task/runtime/Model.js.map +1 -1
  290. package/bin/task/runtime/Paths.d.ts +7 -7
  291. package/bin/task/runtime/Paths.d.ts.map +1 -1
  292. package/bin/task/runtime/Paths.js +11 -11
  293. package/bin/task/runtime/Paths.js.map +1 -1
  294. package/bin/task/runtime/Runner.d.ts +1 -1
  295. package/bin/task/runtime/Runner.d.ts.map +1 -1
  296. package/bin/task/runtime/Runner.js +4 -5
  297. package/bin/task/runtime/Runner.js.map +1 -1
  298. package/bin/task/runtime/Store.d.ts +9 -9
  299. package/bin/task/runtime/Store.d.ts.map +1 -1
  300. package/bin/task/runtime/Store.js +17 -17
  301. package/bin/task/runtime/Store.js.map +1 -1
  302. package/bin/task/runtime/TaskActionExecution.js +6 -6
  303. package/bin/task/runtime/TaskActionExecution.js.map +1 -1
  304. package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
  305. package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
  306. package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
  307. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  308. package/bin/task/runtime/TaskRunnerRound.js +8 -3
  309. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  310. package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
  311. package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
  312. package/bin/task/runtime/TaskRunnerScript.js +0 -1
  313. package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
  314. package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
  315. package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  316. package/bin/task/runtime/TaskRunnerSession.js +2 -4
  317. package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
  318. package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
  319. package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
  320. package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
  321. package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
  322. package/bin/web/Plugin.d.ts +2 -6
  323. package/bin/web/Plugin.d.ts.map +1 -1
  324. package/bin/web/Plugin.js +21 -17
  325. package/bin/web/Plugin.js.map +1 -1
  326. package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
  327. package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
  328. package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
  329. package/bin/web/types/WebPlugin.d.ts +15 -9
  330. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  331. package/bin/web.d.ts +1 -1
  332. package/bin/web.d.ts.map +1 -1
  333. package/bin/workboard/runtime/Collector.js +1 -1
  334. package/bin/workboard/runtime/Collector.js.map +1 -1
  335. package/package.json +29 -19
  336. package/scripts/chat-access.test.mjs +3 -2
  337. package/scripts/chat-channel-config.test.mjs +3 -3
  338. package/scripts/chat-storage.test.mjs +10 -14
  339. package/scripts/memory-plugin.test.mjs +204 -0
  340. package/scripts/playwright-browser-provider.test.mjs +260 -0
  341. package/scripts/plugin-main.test.mjs +101 -0
  342. package/scripts/plugin-subpaths.test.mjs +36 -0
  343. package/scripts/sound-plugin.test.mjs +21 -9
  344. package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
  345. package/scripts/web-plugin.test.mjs +43 -186
  346. package/src/builtin/BuiltinPluginReadmes.ts +58 -0
  347. package/src/builtin/BuiltinPluginTypes.ts +260 -0
  348. package/src/builtin/PluginSettingsDefinitions.ts +45 -0
  349. package/src/builtin/main/PluginSettingsMain.ts +75 -0
  350. package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
  351. package/src/builtin/types/PluginSettings.ts +46 -0
  352. package/src/chat/ChatPlugin.ts +99 -51
  353. package/src/chat/access/ChatAccessRuntime.ts +1 -1
  354. package/src/chat/access/ChatAccessSchema.ts +5 -5
  355. package/src/chat/access/ChatAccessService.ts +4 -4
  356. package/src/chat/access/ChatAccessStore.ts +17 -9
  357. package/src/chat/channels/BaseChatChannel.ts +2 -0
  358. package/src/chat/channels/RuntimeChannel.ts +9 -9
  359. package/src/chat/channels/feishu/Feishu.ts +1 -1
  360. package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
  361. package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
  362. package/src/chat/channels/qq/QQ.ts +3 -2
  363. package/src/chat/channels/qq/QQEventCapture.ts +3 -3
  364. package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
  365. package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
  366. package/src/chat/channels/qq/QQSupport.ts +5 -0
  367. package/src/chat/channels/qq/VoiceInput.ts +5 -1
  368. package/src/chat/channels/telegram/ApiClient.ts +10 -3
  369. package/src/chat/channels/telegram/StateStore.ts +2 -2
  370. package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
  371. package/src/chat/main/ChatPluginMain.ts +163 -0
  372. package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
  373. package/src/chat/runtime/ChannelContextStore.ts +20 -20
  374. package/src/chat/runtime/ChatActionExecution.ts +6 -6
  375. package/src/chat/runtime/ChatChannelConfig.ts +7 -14
  376. package/src/chat/runtime/ChatChannelCore.ts +9 -9
  377. package/src/chat/runtime/ChatHistoryStore.ts +7 -7
  378. package/src/chat/runtime/ChatMetaStore.ts +1 -1
  379. package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
  380. package/src/chat/runtime/ChatQueue.ts +2 -69
  381. package/src/chat/runtime/ChatQueueStore.ts +10 -26
  382. package/src/chat/runtime/ChatQueueWorker.ts +2 -5
  383. package/src/chat/runtime/ChatSessionDelete.ts +4 -4
  384. package/src/chat/runtime/ChatStorage.ts +24 -24
  385. package/src/chat/types/ChatAccess.ts +2 -2
  386. package/src/chat/types/ChatCommand.ts +1 -1
  387. package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
  388. package/src/chat/types/ChatPluginConfig.ts +21 -0
  389. package/src/chat/types/ChatPluginOptions.ts +4 -4
  390. package/src/chat/types/ChatPluginProfile.ts +52 -0
  391. package/src/chat/types/ChatPluginRenderer.ts +25 -0
  392. package/src/chat/types/ChatRuntime.ts +14 -0
  393. package/src/chat/types/ChatRuntimeAccount.ts +3 -3
  394. package/src/chat/types/ChatStorage.ts +2 -2
  395. package/src/chat.ts +6 -14
  396. package/src/contact/Action.ts +5 -5
  397. package/src/contact/ContactPlugin.ts +15 -15
  398. package/src/contact/runtime/ChatRuntime.ts +3 -3
  399. package/src/contact/runtime/ContactStore.ts +20 -20
  400. package/src/contact/runtime/EndpointNotice.ts +2 -2
  401. package/src/contact/runtime/InboxStore.ts +16 -16
  402. package/src/contact/runtime/LinkApproval.ts +16 -16
  403. package/src/contact/runtime/LinkStore.ts +5 -5
  404. package/src/contact/runtime/Paths.ts +29 -29
  405. package/src/contact/runtime/ShareBundle.ts +5 -5
  406. package/src/contact/types/ContactApproval.ts +2 -2
  407. package/src/image/ImagePlugin.ts +30 -33
  408. package/src/image/runtime/ImageResultStorage.ts +36 -62
  409. package/src/image/types/ImagePlugin.ts +25 -19
  410. package/src/image.ts +2 -0
  411. package/src/index.ts +8 -0
  412. package/src/memory/Action.ts +106 -377
  413. package/src/memory/MemoryPlugin.ts +266 -246
  414. package/src/memory/adapters/FileMemoryStorageAdapter.ts +197 -0
  415. package/src/memory/providers/BuiltinMemoryProvider.ts +905 -0
  416. package/src/memory/runtime/SystemProvider.ts +32 -95
  417. package/src/memory/types/BuiltinMemoryProvider.ts +121 -0
  418. package/src/memory/types/Memory.ts +329 -456
  419. package/src/memory/types/MemoryStorage.ts +44 -0
  420. package/src/memory.ts +49 -24
  421. package/src/renderers.ts +18 -0
  422. package/src/sound/Plugin.ts +34 -33
  423. package/src/sound/types/SoundPlugin.ts +24 -19
  424. package/src/sound.ts +2 -0
  425. package/src/task/Action.ts +27 -27
  426. package/src/task/PROMPT.ts +1 -1
  427. package/src/task/PROMPT.ts.txt +5 -6
  428. package/src/task/Scheduler.ts +8 -8
  429. package/src/task/TaskPlugin.ts +55 -46
  430. package/src/task/runtime/Model.ts +3 -13
  431. package/src/task/runtime/Paths.ts +11 -11
  432. package/src/task/runtime/Runner.ts +5 -6
  433. package/src/task/runtime/Store.ts +22 -22
  434. package/src/task/runtime/TaskActionExecution.ts +6 -6
  435. package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
  436. package/src/task/runtime/TaskRunnerRound.ts +13 -4
  437. package/src/task/runtime/TaskRunnerScript.ts +0 -5
  438. package/src/task/runtime/TaskRunnerSession.ts +10 -8
  439. package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
  440. package/src/web/Plugin.ts +23 -22
  441. package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
  442. package/src/web/types/WebPlugin.ts +16 -13
  443. package/src/web.ts +1 -0
  444. package/src/workboard/runtime/Collector.ts +1 -1
  445. package/tsconfig.json +4 -1
  446. package/LICENSE +0 -183
  447. package/bin/chat/Index.d.ts +0 -15
  448. package/bin/chat/Index.d.ts.map +0 -1
  449. package/bin/chat/Index.js +0 -11
  450. package/bin/chat/Index.js.map +0 -1
  451. package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
  452. package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
  453. package/bin/chat/config/ChatPluginConfig.js +0 -237
  454. package/bin/chat/config/ChatPluginConfig.js.map +0 -1
  455. package/bin/chat/types/ChatPluginResource.d.ts +0 -68
  456. package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
  457. package/bin/chat/types/ChatPluginResource.js +0 -10
  458. package/bin/chat/types/ChatPluginResource.js.map +0 -1
  459. package/bin/contact/Index.d.ts +0 -8
  460. package/bin/contact/Index.d.ts.map +0 -1
  461. package/bin/contact/Index.js +0 -8
  462. package/bin/contact/Index.js.map +0 -1
  463. package/bin/memory/Index.d.ts +0 -9
  464. package/bin/memory/Index.d.ts.map +0 -1
  465. package/bin/memory/Index.js +0 -9
  466. package/bin/memory/Index.js.map +0 -1
  467. package/bin/memory/runtime/Search.d.ts +0 -19
  468. package/bin/memory/runtime/Search.d.ts.map +0 -1
  469. package/bin/memory/runtime/Search.js +0 -262
  470. package/bin/memory/runtime/Search.js.map +0 -1
  471. package/bin/memory/runtime/Store.d.ts +0 -42
  472. package/bin/memory/runtime/Store.d.ts.map +0 -1
  473. package/bin/memory/runtime/Store.js +0 -94
  474. package/bin/memory/runtime/Store.js.map +0 -1
  475. package/bin/memory/runtime/Writer.d.ts +0 -61
  476. package/bin/memory/runtime/Writer.d.ts.map +0 -1
  477. package/bin/memory/runtime/Writer.js +0 -274
  478. package/bin/memory/runtime/Writer.js.map +0 -1
  479. package/bin/skill/Command.d.ts +0 -29
  480. package/bin/skill/Command.d.ts.map +0 -1
  481. package/bin/skill/Command.js +0 -35
  482. package/bin/skill/Command.js.map +0 -1
  483. package/bin/task/Index.d.ts +0 -9
  484. package/bin/task/Index.d.ts.map +0 -1
  485. package/bin/task/Index.js +0 -9
  486. package/bin/task/Index.js.map +0 -1
  487. package/src/chat/Index.ts +0 -36
  488. package/src/chat/config/ChatPluginConfig.ts +0 -266
  489. package/src/chat/types/ChatPluginResource.ts +0 -95
  490. package/src/contact/Index.ts +0 -8
  491. package/src/memory/Index.ts +0 -9
  492. package/src/memory/runtime/Search.ts +0 -327
  493. package/src/memory/runtime/Store.ts +0 -158
  494. package/src/memory/runtime/Writer.ts +0 -351
  495. package/src/skill/Command.ts +0 -58
  496. package/src/task/Index.ts +0 -8
@@ -2,7 +2,7 @@
2
2
  * ChannelContextStore:渠道目标与 session_id 映射存储。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 映射文件位于 `.downcity/channel/meta.json`。
5
+ * - 映射文件位于当前 Agent private runtime directory 数据目录的 `channel/meta.json`。
6
6
  * - session_id 由服务端随机生成并持久化,不依赖字符串拼接规则。
7
7
  * - 统一提供“按目标找 session_id / 按 session_id 找目标”能力。
8
8
  */
@@ -169,11 +169,11 @@ export async function readChannelSessionRouteBySessionId(params: {
169
169
  context: PluginContext;
170
170
  session_id: string;
171
171
  }): Promise<ChannelContextRouteV1 | null> {
172
- const rootPath = String(params.context.workspace_path || "").trim();
172
+ const rootPath = String(params.context.data_path || "").trim();
173
173
  const session_id = toOptionalTrimmedString(params.session_id);
174
174
  if (!rootPath || !session_id) return null;
175
175
  const file = await readMetaFile({
176
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
176
+ filePath: get_chat_channel_meta_path(params.context.data_path),
177
177
  });
178
178
  return normalizeRoute(file.routesBySessionId[session_id]);
179
179
  }
@@ -182,7 +182,7 @@ export async function readChannelSessionRouteBySessionId(params: {
182
182
  * 列出当前 agent 已记录的所有渠道路由条目。
183
183
  *
184
184
  * 关键点(中文)
185
- * - 数据源为 `.downcity/channel/meta.json` 的 `routesBySessionId`。
185
+ * - 数据源为当前 Agent private runtime directory 数据目录下 `channel/meta.json` 的 `routesBySessionId`。
186
186
  * - 默认按 `updated_at` 倒序返回,便于展示“最近活跃”会话。
187
187
  */
188
188
  export async function listChannelSessionRoutes(params: {
@@ -191,7 +191,7 @@ export async function listChannelSessionRoutes(params: {
191
191
  updated_at: number;
192
192
  routes: ChannelContextRouteV1[];
193
193
  }> {
194
- const rootPath = String(params.context.workspace_path || "").trim();
194
+ const rootPath = String(params.context.data_path || "").trim();
195
195
  if (!rootPath) {
196
196
  return {
197
197
  updated_at: Date.now(),
@@ -199,7 +199,7 @@ export async function listChannelSessionRoutes(params: {
199
199
  };
200
200
  }
201
201
  const file = await readMetaFile({
202
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
202
+ filePath: get_chat_channel_meta_path(params.context.data_path),
203
203
  });
204
204
  const routes = Object.values(file.routesBySessionId)
205
205
  .map((route) => normalizeRoute(route))
@@ -218,12 +218,12 @@ export async function resolveChannelSessionIdByTarget(params: {
218
218
  context: PluginContext;
219
219
  target: ChannelContextTarget;
220
220
  }): Promise<string | null> {
221
- const rootPath = String(params.context.workspace_path || "").trim();
221
+ const rootPath = String(params.context.data_path || "").trim();
222
222
  if (!rootPath) return null;
223
223
  const targetKey = buildChannelTargetKey(params.target);
224
224
  if (!targetKey) return null;
225
225
  const file = await readMetaFile({
226
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
226
+ filePath: get_chat_channel_meta_path(params.context.data_path),
227
227
  });
228
228
  const session_id = toOptionalTrimmedString(file.sessionIdByTargetKey[targetKey]);
229
229
  if (!session_id) return null;
@@ -237,7 +237,7 @@ export async function resolveOrCreateChannelSessionIdByTarget(params: {
237
237
  context: PluginContext;
238
238
  target: ChannelContextTarget;
239
239
  }): Promise<string | null> {
240
- const rootPath = String(params.context.workspace_path || "").trim();
240
+ const rootPath = String(params.context.data_path || "").trim();
241
241
  if (!rootPath) return null;
242
242
  const normalizedTarget = normalizeTarget(params.target);
243
243
  if (!normalizedTarget) return null;
@@ -245,7 +245,7 @@ export async function resolveOrCreateChannelSessionIdByTarget(params: {
245
245
  if (!targetKey) return null;
246
246
 
247
247
  const file = await readMetaFile({
248
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
248
+ filePath: get_chat_channel_meta_path(params.context.data_path),
249
249
  });
250
250
  const existingSessionId = toOptionalTrimmedString(file.sessionIdByTargetKey[targetKey]);
251
251
  if (
@@ -271,8 +271,8 @@ export async function resolveOrCreateChannelSessionIdByTarget(params: {
271
271
  };
272
272
  file.updated_at = Date.now();
273
273
  await writeMetaFile({
274
- dirPath: get_chat_channel_dir_path(params.context.workspace_path),
275
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
274
+ dirPath: get_chat_channel_dir_path(params.context.data_path),
275
+ filePath: get_chat_channel_meta_path(params.context.data_path),
276
276
  file,
277
277
  });
278
278
  return nextSessionId;
@@ -290,7 +290,7 @@ export async function upsertChannelSessionRouteBySessionId(params: {
290
290
  actorName?: string;
291
291
  chatTitle?: string;
292
292
  }): Promise<void> {
293
- const rootPath = String(params.context.workspace_path || "").trim();
293
+ const rootPath = String(params.context.data_path || "").trim();
294
294
  const session_id = toOptionalTrimmedString(params.session_id);
295
295
  const normalizedTarget = normalizeTarget(params.target);
296
296
  if (!rootPath || !session_id || !normalizedTarget) return;
@@ -298,7 +298,7 @@ export async function upsertChannelSessionRouteBySessionId(params: {
298
298
  if (!targetKey) return;
299
299
 
300
300
  const file = await readMetaFile({
301
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
301
+ filePath: get_chat_channel_meta_path(params.context.data_path),
302
302
  });
303
303
  const prev = normalizeRoute(file.routesBySessionId[session_id]);
304
304
  const nextRoute: ChannelContextRouteV1 = {
@@ -337,8 +337,8 @@ export async function upsertChannelSessionRouteBySessionId(params: {
337
337
  file.sessionIdByTargetKey[targetKey] = session_id;
338
338
  file.updated_at = Date.now();
339
339
  await writeMetaFile({
340
- dirPath: get_chat_channel_dir_path(params.context.workspace_path),
341
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
340
+ dirPath: get_chat_channel_dir_path(params.context.data_path),
341
+ filePath: get_chat_channel_meta_path(params.context.data_path),
342
342
  file,
343
343
  });
344
344
  }
@@ -357,7 +357,7 @@ export async function removeChannelSessionRouteBySessionId(params: {
357
357
  removed: boolean;
358
358
  route: ChannelContextRouteV1 | null;
359
359
  }> {
360
- const rootPath = String(params.context.workspace_path || "").trim();
360
+ const rootPath = String(params.context.data_path || "").trim();
361
361
  const session_id = toOptionalTrimmedString(params.session_id);
362
362
  if (!rootPath || !session_id) {
363
363
  return {
@@ -367,7 +367,7 @@ export async function removeChannelSessionRouteBySessionId(params: {
367
367
  }
368
368
 
369
369
  const file = await readMetaFile({
370
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
370
+ filePath: get_chat_channel_meta_path(params.context.data_path),
371
371
  });
372
372
  const route = normalizeRoute(file.routesBySessionId[session_id]);
373
373
  if (!route) {
@@ -388,8 +388,8 @@ export async function removeChannelSessionRouteBySessionId(params: {
388
388
 
389
389
  file.updated_at = Date.now();
390
390
  await writeMetaFile({
391
- dirPath: get_chat_channel_dir_path(params.context.workspace_path),
392
- filePath: get_chat_channel_meta_path(params.context.workspace_path),
391
+ dirPath: get_chat_channel_dir_path(params.context.data_path),
392
+ filePath: get_chat_channel_meta_path(params.context.data_path),
393
393
  file,
394
394
  });
395
395
  return {
@@ -55,7 +55,7 @@ export async function execute_chat_history_clear_action(params: {
55
55
  error: "Missing session_id",
56
56
  };
57
57
  }
58
- const cleared = await clear_chat_history(params.context.workspace_path, session_id);
58
+ const cleared = await clear_chat_history(params.context.data_path, session_id);
59
59
  return {
60
60
  success: true,
61
61
  data: {
@@ -193,16 +193,16 @@ export async function executeChatInfoAction(params: {
193
193
  });
194
194
 
195
195
  const toPosixRelativePath = (absPath: string): string =>
196
- path.relative(params.context.workspace_path, absPath).split(path.sep).join("/");
196
+ path.relative(params.context.data_path, absPath).split(path.sep).join("/");
197
197
 
198
198
  const channelMetaPath = toPosixRelativePath(
199
- get_chat_channel_meta_path(params.context.workspace_path),
199
+ get_chat_channel_meta_path(params.context.data_path),
200
200
  );
201
201
  const chatDirPath = toPosixRelativePath(
202
- get_chat_session_dir_path(params.context.workspace_path, session_id),
202
+ get_chat_session_dir_path(params.context.data_path, session_id),
203
203
  );
204
204
  const historyPath = toPosixRelativePath(
205
- get_chat_history_path(params.context.workspace_path, session_id),
205
+ get_chat_history_path(params.context.data_path, session_id),
206
206
  );
207
207
 
208
208
  return {
@@ -259,7 +259,7 @@ export async function executeChatHistoryAction(params: {
259
259
  afterTs: payload.afterTs,
260
260
  });
261
261
  const historyPath = historyResult.historyPath
262
- .replace(`${params.context.workspace_path}/`, "")
262
+ .replace(`${params.context.data_path}/`, "")
263
263
  .split("\\")
264
264
  .join("/");
265
265
 
@@ -6,7 +6,6 @@
6
6
  * - Plugin 只读取宿主构造时传入的 channel 配置,不负责修改或持久化。
7
7
  */
8
8
 
9
- import type { JsonObject } from "@downcity/agent";
10
9
  import type { PluginContext } from "@downcity/agent";
11
10
  import type { ChatRuntimeAccount } from "@/chat/types/ChatRuntimeAccount.js";
12
11
  import type {
@@ -14,7 +13,6 @@ import type {
14
13
  ChatChannelStateSnapshot,
15
14
  } from "@/chat/types/ChannelStatus.js";
16
15
  import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
17
- import { get_chat_plugin_resource_json_schema } from "@/chat/config/ChatPluginConfig.js";
18
16
  import {
19
17
  getChatChannelBot,
20
18
  isChatChannelEnabled,
@@ -23,10 +21,6 @@ import {
23
21
  resolveChannelAccountId,
24
22
  } from "./ChatChannelCore.js";
25
23
 
26
- function toJsonObject(input: unknown): JsonObject {
27
- return JSON.parse(JSON.stringify(input)) as JsonObject;
28
- }
29
-
30
24
  /**
31
25
  * 生成可安全暴露给 UI 的渠道配置摘要。
32
26
  *
@@ -40,26 +34,26 @@ export function buildChatChannelConfigSummary(
40
34
  accountInput?: ChatRuntimeAccount | null,
41
35
  ): Record<string, string | number | boolean | null> {
42
36
  const account = accountInput ?? resolveChannelAccount(context, channel);
43
- const resource_id = resolveChannelAccountId(context, channel);
37
+ const channel_id = resolveChannelAccountId(context, channel);
44
38
  const configured = isChannelAccountConfigured(channel, account);
45
39
  if (channel === "telegram") {
46
40
  return {
47
41
  enabled: isChatChannelEnabled(context, channel),
48
- resource_id: resource_id || null,
49
- resource_configured: configured,
42
+ channel_id: channel_id || null,
43
+ channel_configured: configured,
50
44
  };
51
45
  }
52
46
  if (channel === "feishu") {
53
47
  return {
54
48
  enabled: isChatChannelEnabled(context, channel),
55
- resource_id: resource_id || null,
56
- resource_configured: configured,
49
+ channel_id: channel_id || null,
50
+ channel_configured: configured,
57
51
  };
58
52
  }
59
53
  return {
60
54
  enabled: isChatChannelEnabled(context, channel),
61
- resource_id: resource_id || null,
62
- resource_configured: configured,
55
+ channel_id: channel_id || null,
56
+ channel_configured: configured,
63
57
  };
64
58
  }
65
59
 
@@ -97,7 +91,6 @@ export function getChatChannelStatus(
97
91
  detail: {
98
92
  ...(runtime?.detail || {}),
99
93
  config: buildChatChannelConfigSummary(context, channel, channelAccount),
100
- resource_schema: toJsonObject(get_chat_plugin_resource_json_schema(channel)),
101
94
  },
102
95
  };
103
96
  }
@@ -14,8 +14,8 @@ import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
14
14
 
15
15
  const CHAT_CHANNEL_NAMES: ChatChannelName[] = ["telegram", "feishu", "qq"];
16
16
 
17
- export type ChatRuntimeBindings = {
18
- getResourceId?(context: PluginContext, channel: ChatChannelName): string;
17
+ export type ChatPluginRuntimeApi = {
18
+ get_channel_id?(context: PluginContext, channel: ChatChannelName): string;
19
19
  resolveChannelAccount?(
20
20
  context: PluginContext,
21
21
  channel: ChatChannelName,
@@ -23,11 +23,11 @@ export type ChatRuntimeBindings = {
23
23
  isChannelEnabled?(context: PluginContext, channel: ChatChannelName): boolean;
24
24
  };
25
25
 
26
- export function resolveChatPluginBindings(
26
+ export function resolveChatPluginRuntimeApi(
27
27
  context: PluginContext,
28
- ): ChatRuntimeBindings | null {
28
+ ): ChatPluginRuntimeApi | null {
29
29
  const candidate = context.plugins.get("chat") as
30
- | ChatRuntimeBindings
30
+ | ChatPluginRuntimeApi
31
31
  | undefined;
32
32
  return candidate || null;
33
33
  }
@@ -74,8 +74,8 @@ export function resolveChannelAccountId(
74
74
  context: PluginContext,
75
75
  channel: ChatChannelName,
76
76
  ): string {
77
- const plugin = resolveChatPluginBindings(context);
78
- const explicit = String(plugin?.getResourceId?.(context, channel) || "").trim();
77
+ const plugin = resolveChatPluginRuntimeApi(context);
78
+ const explicit = String(plugin?.get_channel_id?.(context, channel) || "").trim();
79
79
  if (explicit) return explicit;
80
80
  return "";
81
81
  }
@@ -91,7 +91,7 @@ export function resolveChannelAccount(
91
91
  context: PluginContext,
92
92
  channel: ChatChannelName,
93
93
  ): ChatRuntimeAccount | null {
94
- const plugin = resolveChatPluginBindings(context);
94
+ const plugin = resolveChatPluginRuntimeApi(context);
95
95
  const explicit = plugin?.resolveChannelAccount?.(context, channel);
96
96
  return explicit?.channel === channel ? explicit : null;
97
97
  }
@@ -117,7 +117,7 @@ export function isChatChannelEnabled(
117
117
  context: PluginContext,
118
118
  channel: ChatChannelName,
119
119
  ): boolean {
120
- const plugin = resolveChatPluginBindings(context);
120
+ const plugin = resolveChatPluginRuntimeApi(context);
121
121
  if (typeof plugin?.isChannelEnabled === "function") {
122
122
  return plugin.isChannelEnabled(context, channel);
123
123
  }
@@ -2,7 +2,7 @@
2
2
  * ChatHistoryStore:聊天事件流持久化。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 写入 `.downcity/chat/<session_id>/history.jsonl`(append-only)。
5
+ * - 写入 Agent private runtime directory 数据目录的 `chat/<session_id>/history.jsonl`(append-only)。
6
6
  * - 记录 inbound(audit/exec)与 outbound 事件。
7
7
  * - 与 session message history 分离,避免审计噪声进入模型上下文。
8
8
  */
@@ -145,7 +145,7 @@ export async function appendInboundChatHistory(params: {
145
145
  actorName?: string;
146
146
  extra?: JsonObject;
147
147
  }): Promise<void> {
148
- const rootPath = normalizeTrimmedString(params.context.workspace_path);
148
+ const rootPath = normalizeTrimmedString(params.context.data_path);
149
149
  const session_id = normalizeTrimmedString(params.session_id);
150
150
  const chatId = normalizeTrimmedString(params.chatId);
151
151
  if (!rootPath || !session_id || !chatId) return;
@@ -164,7 +164,7 @@ export async function appendInboundChatHistory(params: {
164
164
  extra: toOptionalObject(params.extra),
165
165
  });
166
166
 
167
- const file = get_chat_history_path(params.context.workspace_path, session_id);
167
+ const file = get_chat_history_path(params.context.data_path, session_id);
168
168
  await fs.ensureDir(path.dirname(file));
169
169
  await fs.appendFile(file, JSON.stringify(event) + "\n", "utf8");
170
170
  }
@@ -189,7 +189,7 @@ export async function appendOutboundChatHistory(params: {
189
189
  actorName?: string;
190
190
  extra?: JsonObject;
191
191
  }): Promise<void> {
192
- const rootPath = normalizeTrimmedString(params.context.workspace_path);
192
+ const rootPath = normalizeTrimmedString(params.context.data_path);
193
193
  const session_id = normalizeTrimmedString(params.session_id);
194
194
  const chatId = normalizeTrimmedString(params.chatId);
195
195
  if (!rootPath || !session_id || !chatId) return;
@@ -207,7 +207,7 @@ export async function appendOutboundChatHistory(params: {
207
207
  extra: toOptionalObject(params.extra),
208
208
  });
209
209
 
210
- const file = get_chat_history_path(params.context.workspace_path, session_id);
210
+ const file = get_chat_history_path(params.context.data_path, session_id);
211
211
  await fs.ensureDir(path.dirname(file));
212
212
  await fs.appendFile(file, JSON.stringify(event) + "\n", "utf8");
213
213
  }
@@ -227,9 +227,9 @@ export async function readChatHistory(params: {
227
227
  beforeTs?: number;
228
228
  afterTs?: number;
229
229
  }): Promise<{ historyPath: string; events: ChatHistoryEventV1[] }> {
230
- const rootPath = normalizeTrimmedString(params.context.workspace_path);
230
+ const rootPath = normalizeTrimmedString(params.context.data_path);
231
231
  const session_id = normalizeTrimmedString(params.session_id);
232
- const historyPath = get_chat_history_path(params.context.workspace_path, session_id);
232
+ const historyPath = get_chat_history_path(params.context.data_path, session_id);
233
233
  if (!rootPath || !session_id) {
234
234
  return {
235
235
  historyPath,
@@ -4,7 +4,7 @@
4
4
  * 关键点(中文)
5
5
  * - 入站消息到达时由 chat plugin runtime 写入
6
6
  * - 出站按 session_id/chat_key 发送时由 chat plugin runtime 读取
7
- * - 底层数据落在 `.downcity/channel/meta.json`,由 ChannelContextStore 统一维护
7
+ * - 底层数据落在 Agent private runtime directory 数据目录的 `channel/meta.json`,由 ChannelContextStore 统一维护
8
8
  */
9
9
 
10
10
  import type { PluginContext } from "@downcity/agent";
@@ -87,7 +87,7 @@ function attachCommandHelpText(command: Command, text: string): void {
87
87
  * 创建 chat plugin runtime 的 action 定义表。
88
88
  */
89
89
  export function createChatPluginActions(params: {
90
- channelState: ChatChannelState;
90
+ resolve_channel_state: (context: import("@downcity/agent").PluginContext) => ChatChannelState;
91
91
  }): PluginActions {
92
92
  return {
93
93
  status: create_action({
@@ -105,7 +105,7 @@ export function createChatPluginActions(params: {
105
105
  },
106
106
  execute: async (actionParams) => {
107
107
  return executeChatStatusAction({
108
- state: params.channelState,
108
+ state: params.resolve_channel_state(actionParams.context),
109
109
  context: actionParams.context,
110
110
  payload: actionParams.input as ChatStatusActionPayload,
111
111
  });
@@ -126,7 +126,7 @@ export function createChatPluginActions(params: {
126
126
  },
127
127
  execute: async (actionParams) => {
128
128
  return executeChatTestAction({
129
- state: params.channelState,
129
+ state: params.resolve_channel_state(actionParams.context),
130
130
  context: actionParams.context,
131
131
  payload: actionParams.input as ChatTestActionPayload,
132
132
  });
@@ -147,7 +147,7 @@ export function createChatPluginActions(params: {
147
147
  },
148
148
  execute: async (actionParams) => {
149
149
  return executeChatReconnectAction({
150
- state: params.channelState,
150
+ state: params.resolve_channel_state(actionParams.context),
151
151
  context: actionParams.context,
152
152
  payload: actionParams.input as ChatReconnectActionPayload,
153
153
  });
@@ -195,7 +195,7 @@ export function createChatPluginActions(params: {
195
195
  return executeChatInfoAction({
196
196
  context: actionParams.context,
197
197
  payload: actionParams.input as ChatInfoActionPayload,
198
- execution_context: actionParams.execution_context,
198
+ execution_context: actionParams.execution.snapshot,
199
199
  });
200
200
  },
201
201
  }),
@@ -226,7 +226,7 @@ export function createChatPluginActions(params: {
226
226
  return executeChatSendAction({
227
227
  context: actionParams.context,
228
228
  payload: actionParams.input as ChatSendActionPayload,
229
- execution_context: actionParams.execution_context,
229
+ execution_context: actionParams.execution.snapshot,
230
230
  });
231
231
  },
232
232
  }),
@@ -255,7 +255,7 @@ export function createChatPluginActions(params: {
255
255
  return executeChatReactAction({
256
256
  context: actionParams.context,
257
257
  payload: actionParams.input as ChatReactActionPayload,
258
- execution_context: actionParams.execution_context,
258
+ execution_context: actionParams.execution.snapshot,
259
259
  });
260
260
  },
261
261
  }),
@@ -282,7 +282,7 @@ export function createChatPluginActions(params: {
282
282
  return executeChatContextAction({
283
283
  context: actionParams.context,
284
284
  payload: actionParams.input as ChatSessionActionPayload,
285
- execution_context: actionParams.execution_context,
285
+ execution_context: actionParams.execution.snapshot,
286
286
  });
287
287
  },
288
288
  }),
@@ -305,7 +305,7 @@ export function createChatPluginActions(params: {
305
305
  return executeChatDeleteAction({
306
306
  context: actionParams.context,
307
307
  payload: actionParams.input as ChatDeleteActionPayload,
308
- execution_context: actionParams.execution_context,
308
+ execution_context: actionParams.execution.snapshot,
309
309
  });
310
310
  },
311
311
  }),
@@ -335,7 +335,7 @@ export function createChatPluginActions(params: {
335
335
  return executeChatHistoryAction({
336
336
  context: actionParams.context,
337
337
  payload: actionParams.input as ChatHistoryActionPayload,
338
- execution_context: actionParams.execution_context,
338
+ execution_context: actionParams.execution.snapshot,
339
339
  });
340
340
  },
341
341
  }),
@@ -1,77 +1,10 @@
1
- /**
2
- * ChatQueue 共享门面。
3
- *
4
- * 关键点(中文)
5
- * - 迁移阶段保留旧函数式 API,内部委托给共享 `ChatQueueStore`。
6
- * - 新代码应优先通过 `ChatQueueStore` 实例或 `resolveChatQueueStore(runtime)` 使用队列。
7
- */
8
-
9
- import type {
10
- ChatQueueEnqueueParams,
11
- ChatQueueEnqueueResult,
12
- ChatQueueItem,
13
- } from "@/chat/types/ChatQueue.js";
1
+ /** Chat Queue 对外类型与显式运行时解析入口。 */
14
2
  import {
15
3
  ChatQueueStore,
16
- getSharedChatQueueStore,
17
4
  resolveChatQueueStore,
18
5
  type ChatQueueEnqueueListener,
19
6
  type ChatQueueStorePort,
20
7
  } from "./ChatQueueStore.js";
21
8
 
22
- export { ChatQueueStore, getSharedChatQueueStore, resolveChatQueueStore };
9
+ export { ChatQueueStore, resolveChatQueueStore };
23
10
  export type { ChatQueueEnqueueListener, ChatQueueStorePort };
24
-
25
- /**
26
- * 订阅共享 queue 的入队事件。
27
- */
28
- export function onChatQueueEnqueue(listener: ChatQueueEnqueueListener): () => void {
29
- return getSharedChatQueueStore().onEnqueue(listener);
30
- }
31
-
32
- /**
33
- * 向共享 queue 入队。
34
- */
35
- export function enqueueChatQueue(
36
- params: ChatQueueEnqueueParams,
37
- ): ChatQueueEnqueueResult {
38
- return getSharedChatQueueStore().enqueue(params);
39
- }
40
-
41
- /**
42
- * 从共享 queue 弹出一条消息。
43
- */
44
- export function shiftChatQueueItem(laneKey: string): ChatQueueItem | null {
45
- return getSharedChatQueueStore().shift(laneKey);
46
- }
47
-
48
- /**
49
- * 从共享 queue drain 某个 lane。
50
- */
51
- export function drainChatQueueLane(
52
- laneKey: string,
53
- maxItems?: number,
54
- ): ChatQueueItem[] {
55
- return getSharedChatQueueStore().drain(laneKey, maxItems);
56
- }
57
-
58
- /**
59
- * 列出共享 queue 当前积压的 lane keys。
60
- */
61
- export function listChatQueueLanes(): string[] {
62
- return getSharedChatQueueStore().listLanes();
63
- }
64
-
65
- /**
66
- * 查询共享 queue 某个 lane 的长度。
67
- */
68
- export function getChatQueueLaneSize(laneKey: string): number {
69
- return getSharedChatQueueStore().getLaneSize(laneKey);
70
- }
71
-
72
- /**
73
- * 清空共享 queue 某个 lane。
74
- */
75
- export function clearChatQueueLane(laneKey: string): void {
76
- getSharedChatQueueStore().clear(laneKey);
77
- }
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - 这是 chat queue 的实例级状态容器。
6
- * - 允许 `ChatPlugin` 持有自己的 queue store,而不是完全依赖模块级全局状态。
7
- * - 旧的 `ChatQueue.ts` 会保留共享门面,逐步迁移到显式实例注入。
6
+ * - `ChatPlugin` 为每个 Workspace Context 持有独立 queue store
7
+ * - 队列必须通过显式 Context 解析,不允许模块级共享状态。
8
8
  */
9
9
 
10
10
  import type { PluginContext } from "@downcity/agent";
@@ -53,13 +53,6 @@ export interface ChatQueueStorePort {
53
53
  clear(laneKey: string): void;
54
54
  }
55
55
 
56
- /**
57
- * 共享 queue store。
58
- *
59
- * 关键点(中文)
60
- * - 迁移阶段仍保留一份共享实例,避免一次性改动所有旧入口。
61
- * - 新代码应优先通过 `PluginContext.agent` 解析显式 queue store。
62
- */
63
56
  /**
64
57
  * Chat queue 实例级存储。
65
58
  */
@@ -158,28 +151,19 @@ export class ChatQueueStore implements ChatQueueStorePort {
158
151
  }
159
152
  }
160
153
 
161
- const sharedChatQueueStore = new ChatQueueStore();
162
-
163
- /**
164
- * 读取共享 chat queue store。
165
- */
166
- export function getSharedChatQueueStore(): ChatQueueStore {
167
- return sharedChatQueueStore;
168
- }
169
-
170
154
  /**
171
155
  * 从运行时解析 chat queue store。
172
156
  *
173
157
  * 关键点(中文)
174
- * - 新路径优先读取当前 Agent 注册的 ChatPlugin 实例。
175
- * - 迁移阶段若拿不到,则回退到共享 queue store,保证旧入口可继续工作。
158
+ * - 只读取当前 Agent 注册的 ChatPlugin 实例。
159
+ * - 缺少 Context 或对应 Workspace runtime 时立即失败,避免跨 Agent/Workspace 串队列。
176
160
  */
177
- export function resolveChatQueueStore(context?: PluginContext): ChatQueueStorePort {
178
- const chatService = context?.plugins.get("chat") as
179
- | { queueStore?: ChatQueueStorePort }
161
+ export function resolveChatQueueStore(context: PluginContext): ChatQueueStorePort {
162
+ const chatService = context.plugins.get("chat") as
163
+ | { queue_store?: (context: PluginContext) => ChatQueueStorePort }
180
164
  | undefined;
181
- if (chatService?.queueStore) {
182
- return chatService.queueStore;
165
+ if (!chatService?.queue_store) {
166
+ throw new Error("Chat queue requires an active ChatPlugin for the current Workspace");
183
167
  }
184
- return sharedChatQueueStore;
168
+ return chatService.queue_store(context);
185
169
  }
@@ -13,9 +13,6 @@ import type { ChatQueueWorkerConfig } from "@/chat/types/ChatQueueWorker.js";
13
13
  import type { ChatQueueItem } from "@/chat/types/ChatQueue.js";
14
14
  import type { SessionMutation } from "@downcity/agent";
15
15
  import type { AgentSessionTurnResult } from "@downcity/agent";
16
- import {
17
- getSharedChatQueueStore,
18
- } from "./ChatQueue.js";
19
16
  import { getChatSender } from "./ChatSendRegistry.js";
20
17
  import {
21
18
  buildChannelErrorText,
@@ -61,13 +58,13 @@ export class ChatQueueWorker {
61
58
  constructor(params: {
62
59
  logger: Logger;
63
60
  context: PluginContext;
64
- queueStore?: ChatQueueStorePort;
61
+ queueStore: ChatQueueStorePort;
65
62
  config?: Partial<ChatQueueWorkerConfig>;
66
63
  }) {
67
64
  this.logger = params.logger;
68
65
  this.context = params.context;
69
66
  this.config = normalizeChatQueueWorkerConfig(params.config);
70
- this.queueStore = params.queueStore || getSharedChatQueueStore();
67
+ this.queueStore = params.queueStore;
71
68
  }
72
69
 
73
70
  /**
@@ -2,9 +2,9 @@
2
2
  * ChatSessionDelete:按 session_id 彻底删除 chat 会话数据。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 删除路由映射(`.downcity/channel/meta.json`)
6
- * - 删除 chat 审计目录(`.downcity/chat/<session_id>/`)
7
- * - 删除 core session 目录(`.downcity/agents/<agent_id>/sessions/<session_id>/`)
5
+ * - 删除路由映射(Agent private runtime directory 数据目录的 `channel/meta.json`)
6
+ * - 删除 chat 审计目录(Agent private runtime directory 数据目录的 `chat/<session_id>/`)
7
+ * - 删除 core session 目录(Agent private runtime directory 数据目录的 `sessions/<session_id>/`)
8
8
  * - 清理运行中 agent 与队列,避免残留任务继续执行
9
9
  */
10
10
 
@@ -52,7 +52,7 @@ export async function deleteChatSessionById(params: {
52
52
  resolveChatQueueStore(params.context).clear(session_id);
53
53
 
54
54
  const chat_result = await clean_chat_storage({
55
- root_path: params.context.workspace_path,
55
+ data_path: params.context.data_path,
56
56
  session_id: session_id,
57
57
  });
58
58
  const removed_session_dir = await params.context.sessions.remove(session_id);