@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
@@ -1,395 +1,403 @@
1
1
  /**
2
- * MemoryPlugin:agent 的长期记忆 plugin
2
+ * MemoryPlugin:Agent 长期记忆的 provider-neutral facade
3
3
  *
4
- * 关键点(中文)
5
- * - 对外仍然是 MemoryPlugin,内部使用 LLM Wiki 方式组织知识。
6
- * - constructor 注入 digest/revise 能力,plugin 不绑定具体 LLM 服务。
7
- * - action 面向 agent 语义,而不是暴露底层文件写入细节。
4
+ * 职责说明(中文)
5
+ * - Agent 暴露稳定的 Memory actions 与 system 使用约束。
6
+ * - Agent/Session 上下文映射为结构化 Memory scope。
7
+ * - 将记忆形成、存储、召回、修订和删除委托给唯一 MemoryProvider。
8
+ *
9
+ * 边界说明(中文)
10
+ * - 不读取或拼接任何物理存储路径。
11
+ * - 不依赖 Workspace FileSystem,也不规定 Markdown、SQLite 或远程服务。
12
+ * - Provider 生命周期跟随当前 Plugin 实例,由 Agent 统一启动和释放。
8
13
  */
9
- import { BasePlugin } from "@downcity/agent";
10
- import { create_action } from "@downcity/agent";
14
+ import os from "node:os";
15
+ import path from "node:path";
16
+ import { BasePlugin, create_action } from "@downcity/agent";
11
17
  import { z } from "zod";
12
- import { digestMemoryAction, readMemoryAction, rememberMemoryAction, reviseMemoryAction, searchMemoryAction, statusMemoryAction, } from "./Action.js";
13
- import { createMemoryRuntimeState, } from "./runtime/Store.js";
14
- import { buildMemoryPluginSystemText } from "./runtime/SystemProvider.js";
15
- import { ensureMemoryDirectories } from "./runtime/Writer.js";
16
- function parsePositiveInteger(value) {
18
+ import { digest_memory_action, forget_memory_action, read_memory_action, remember_memory_action, revise_memory_action, search_memory_action, status_memory_action, } from "../memory/Action.js";
19
+ import { build_memory_plugin_system_text } from "../memory/runtime/SystemProvider.js";
20
+ import { BuiltinMemoryProvider } from "../memory/providers/BuiltinMemoryProvider.js";
21
+ import { FileMemoryStorageAdapter, get_default_file_memory_root_path } from "../memory/adapters/FileMemoryStorageAdapter.js";
22
+ const memory_type_schema = z.enum([
23
+ "fact",
24
+ "preference",
25
+ "decision",
26
+ "episode",
27
+ "procedure",
28
+ "document",
29
+ ]);
30
+ /** 解析正整数 CLI 参数。 */
31
+ function parse_positive_integer(value) {
17
32
  const text = String(value || "").trim();
18
- if (!/^\d+$/.test(text)) {
33
+ if (!/^\d+$/u.test(text))
19
34
  throw new Error(`Invalid positive integer: ${value}`);
20
- }
21
- const num = Number(text);
22
- if (!Number.isFinite(num) || num < 1) {
35
+ const number_value = Number(text);
36
+ if (!Number.isFinite(number_value) || number_value < 1) {
23
37
  throw new Error(`Invalid positive integer: ${value}`);
24
38
  }
25
- return num;
39
+ return number_value;
26
40
  }
27
- function parseNumber(value) {
28
- const text = String(value || "").trim();
29
- if (!text) {
30
- throw new Error("number is required");
31
- }
32
- const num = Number(text);
33
- if (!Number.isFinite(num)) {
41
+ /** 解析任意有限数值 CLI 参数。 */
42
+ function parse_number(value) {
43
+ const number_value = Number(String(value || "").trim());
44
+ if (!Number.isFinite(number_value))
34
45
  throw new Error(`Invalid number: ${value}`);
35
- }
36
- return num;
46
+ return number_value;
37
47
  }
38
- function readBodyObject(rawBody) {
39
- if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) {
40
- return {};
41
- }
42
- return rawBody;
48
+ /** Action JSON 输入归一化为普通对象。 */
49
+ function read_body_object(raw_body) {
50
+ return raw_body && typeof raw_body === "object" && !Array.isArray(raw_body)
51
+ ? raw_body
52
+ : {};
43
53
  }
44
- function readString(body, key) {
45
- const value = body[key];
46
- return typeof value === "string" ? value : "";
54
+ /** 读取必填或可选字符串字段。 */
55
+ function read_string(body, key) {
56
+ return typeof body[key] === "string" ? String(body[key]) : "";
47
57
  }
48
- function readOptionalString(body, key) {
49
- const value = body[key];
50
- return typeof value === "string" ? value : undefined;
58
+ /** 读取可选字符串字段。 */
59
+ function read_optional_string(body, key) {
60
+ const value = read_string(body, key).trim();
61
+ return value || undefined;
51
62
  }
52
- function readOptionalNumber(body, key) {
53
- const value = body[key];
54
- return typeof value === "number" ? value : undefined;
63
+ /** 读取可选数值字段。 */
64
+ function read_optional_number(body, key) {
65
+ return typeof body[key] === "number" ? Number(body[key]) : undefined;
55
66
  }
56
- function readOptionalBoolean(body, key) {
57
- const value = body[key];
58
- return typeof value === "boolean" ? value : undefined;
67
+ /** 读取可选布尔字段。 */
68
+ function read_optional_boolean(body, key) {
69
+ return typeof body[key] === "boolean" ? Boolean(body[key]) : undefined;
59
70
  }
60
- /**
61
- * Memory plugin 类实现。
62
- */
71
+ /** 读取可选 MemoryType 字段。 */
72
+ function read_optional_memory_type(body) {
73
+ const result = memory_type_schema.safeParse(body.memory_type);
74
+ return result.success ? result.data : undefined;
75
+ }
76
+ /** Agent 长期记忆 Plugin。 */
63
77
  export class MemoryPlugin extends BasePlugin {
64
- options;
65
- /**
66
- * plugin 名称。
67
- */
78
+ /** Plugin 稳定名称。 */
68
79
  name = "memory";
69
- /**
70
- * 当前实例持有的 memory plugin state。
71
- */
72
- runtimeState = null;
73
- /**
74
- * 创建 MemoryPlugin。
75
- */
76
- constructor(options = {}) {
80
+ /** 当前 Plugin 唯一绑定的 Memory Provider。 */
81
+ provider;
82
+ constructor(profile = {}) {
77
83
  super();
78
- this.options = options;
84
+ const root_path = profile.root_path?.trim();
85
+ if (root_path && !path.isAbsolute(root_path)) {
86
+ throw new Error("MemoryPlugin root_path must be absolute");
87
+ }
88
+ this.provider = new BuiltinMemoryProvider({
89
+ create_storage: ({ agent_id }) => new FileMemoryStorageAdapter({
90
+ root_path: root_path || get_default_file_memory_root_path({
91
+ platform_root_path: process.env.DC_PLATFORM_ROOT || path.join(os.homedir(), ".downcity"),
92
+ agent_id,
93
+ }),
94
+ }),
95
+ });
79
96
  }
80
- /**
81
- * 当前 plugin 的 system 文本提供器。
82
- */
97
+ /** 构建 provider-neutral Memory system 内容。 */
83
98
  async system(context) {
84
- return await buildMemoryPluginSystemText(context);
99
+ return await build_memory_plugin_system_text(context, this.provider);
85
100
  }
86
- /**
87
- * 当前 plugin 生命周期。
88
- */
101
+ /** Provider 生命周期与当前 Agent Plugin 实例保持一致。 */
89
102
  lifecycle = {
90
103
  start: async (context) => {
91
- await ensureMemoryDirectories(context.workspace_path);
92
- this.getOrCreateRuntimeState(context);
104
+ await this.provider.initialize({
105
+ agent_id: context.agent_id,
106
+ });
93
107
  },
94
108
  stop: async () => {
95
- this.runtimeState = null;
109
+ await this.provider.dispose();
96
110
  },
97
111
  };
98
- /**
99
- * 当前 plugin action 定义表。
100
- */
112
+ /** Memory 对 Agent 暴露的稳定 Action 集合。 */
101
113
  actions = {
102
114
  status: create_action({
103
- description: "View memory wiki status (wiki/source/working).",
115
+ description: "Inspect the active Memory Provider and its capabilities.",
104
116
  input_schema: {
105
117
  zod: z.object({}).passthrough(),
106
- json_schema: { type: "object", properties: {} },
118
+ json_schema: { type: "object", additionalProperties: false, properties: {} },
107
119
  },
108
- examples: [{ title: "View status", payload: {} }],
120
+ examples: [{ title: "View Memory Provider status", payload: {} }],
109
121
  command: {
110
- description: "View memory wiki status (wiki/source/working).",
111
- map_input() {
112
- return {};
113
- },
114
- },
115
- execute: async (params) => {
116
- const state = this.getOrCreateRuntimeState(params.context);
117
- return await statusMemoryAction(params.context, state);
122
+ description: "Inspect the active Memory Provider.",
123
+ map_input: () => ({}),
118
124
  },
125
+ execute: async () => await status_memory_action(this.provider),
119
126
  }),
120
127
  search: create_action({
121
- description: "Search memory wiki, optionally extending into the source layer.",
128
+ description: "Recall scoped long-term memories for a focused query.",
122
129
  input_schema: {
123
130
  zod: z.object({
124
131
  query: z.string(),
125
- maxResults: z.number().optional(),
126
- minScore: z.number().optional(),
127
- includeSources: z.boolean().optional(),
132
+ max_results: z.number().optional(),
133
+ min_score: z.number().optional(),
134
+ include_evidence: z.boolean().optional(),
128
135
  }),
129
136
  json_schema: {
130
137
  type: "object",
138
+ additionalProperties: false,
131
139
  required: ["query"],
132
140
  properties: {
133
- query: { type: "string", description: "Search query." },
134
- maxResults: { type: "number", description: "Maximum number of results." },
135
- minScore: { type: "number", description: "Minimum relevance score." },
136
- includeSources: { type: "boolean", description: "Whether to include the source layer." },
141
+ query: { type: "string", description: "Focused recall query." },
142
+ max_results: { type: "number", description: "Maximum result count." },
143
+ min_score: { type: "number", minimum: 0, maximum: 1 },
144
+ include_evidence: { type: "boolean", description: "Include raw evidence records." },
137
145
  },
138
146
  },
139
147
  },
140
- examples: [
141
- { title: "Search memory", payload: { query: "user preferences" } },
142
- ],
148
+ examples: [{ title: "Recall preferences", payload: { query: "user preferences" } }],
143
149
  command: {
144
- description: "Search memory wiki.",
150
+ description: "Recall scoped long-term memories.",
145
151
  configure(command) {
146
152
  command
147
153
  .argument("<query>")
148
- .option("--max-results <number>", "Maximum number of results.", parsePositiveInteger)
149
- .option("--min-score <number>", "Minimum relevance score.", parseNumber)
150
- .option("--include-sources", "Also search the raw source layer.");
154
+ .option("--max-results <number>", "Maximum result count.", parse_positive_integer)
155
+ .option("--min-score <number>", "Minimum relevance score.", parse_number)
156
+ .option("--include-evidence", "Include raw evidence records.");
151
157
  },
152
158
  map_input({ args, opts }) {
153
- const payload = {
159
+ return {
154
160
  query: String(args[0] || ""),
161
+ ...(typeof opts.maxResults === "number" ? { max_results: opts.maxResults } : {}),
162
+ ...(typeof opts.minScore === "number" ? { min_score: opts.minScore } : {}),
163
+ ...(opts.includeEvidence === true ? { include_evidence: true } : {}),
155
164
  };
156
- if (typeof opts.maxResults === "number") {
157
- payload.maxResults = opts.maxResults;
158
- }
159
- if (typeof opts.minScore === "number") {
160
- payload.minScore = opts.minScore;
161
- }
162
- if (opts.includeSources === true) {
163
- payload.includeSources = true;
164
- }
165
- return payload;
166
165
  },
167
166
  },
168
- execute: async (params) => {
169
- const body = readBodyObject(params.input);
170
- const state = this.getOrCreateRuntimeState(params.context);
171
- return await searchMemoryAction(params.context, state, {
172
- query: readString(body, "query"),
173
- maxResults: readOptionalNumber(body, "maxResults"),
174
- minScore: readOptionalNumber(body, "minScore"),
175
- includeSources: readOptionalBoolean(body, "includeSources"),
167
+ execute: async ({ context, input }) => {
168
+ const body = read_body_object(input);
169
+ return await search_memory_action(context, this.provider, {
170
+ query: read_string(body, "query"),
171
+ max_results: read_optional_number(body, "max_results"),
172
+ min_score: read_optional_number(body, "min_score"),
173
+ include_evidence: read_optional_boolean(body, "include_evidence"),
176
174
  });
177
175
  },
178
176
  }),
179
177
  read: create_action({
180
- description: "Read a memory wiki/source file excerpt.",
178
+ description: "Read one exact memory by memory_id.",
181
179
  input_schema: {
182
180
  zod: z.object({
183
- path: z.string(),
184
- from: z.number().optional(),
185
- lines: z.number().optional(),
181
+ memory_id: z.string(),
182
+ from_line: z.number().optional(),
183
+ line_count: z.number().optional(),
186
184
  }),
187
185
  json_schema: {
188
186
  type: "object",
189
- required: ["path"],
187
+ additionalProperties: false,
188
+ required: ["memory_id"],
190
189
  properties: {
191
- path: { type: "string", description: "Memory file path relative to the project root." },
192
- from: { type: "number", description: "Starting line, 1-based." },
193
- lines: { type: "number", description: "Number of lines to read." },
190
+ memory_id: { type: "string", description: "Stable logical memory identifier." },
191
+ from_line: { type: "number", minimum: 1 },
192
+ line_count: { type: "number", minimum: 1 },
194
193
  },
195
194
  },
196
195
  },
197
- examples: [
198
- { title: "Read full page", payload: { path: ".downcity/memory/wiki/index.md" } },
199
- ],
196
+ examples: [{ title: "Read a memory", payload: { memory_id: "wiki/user-preferences" } }],
200
197
  command: {
201
- description: "Read a memory wiki/source file excerpt.",
198
+ description: "Read one exact memory.",
202
199
  configure(command) {
203
200
  command
204
- .argument("<memoryPath>", "Memory file path relative to the project root.")
205
- .option("--from <number>", "Starting line, 1-based.", parsePositiveInteger)
206
- .option("--lines <number>", "Number of lines to read.", parsePositiveInteger);
201
+ .argument("<memory_id>")
202
+ .option("--from-line <number>", "Starting line, 1-based.", parse_positive_integer)
203
+ .option("--line-count <number>", "Maximum line count.", parse_positive_integer);
207
204
  },
208
205
  map_input({ args, opts }) {
209
- const payload = {
210
- path: String(args[0] || ""),
206
+ return {
207
+ memory_id: String(args[0] || ""),
208
+ ...(typeof opts.fromLine === "number" ? { from_line: opts.fromLine } : {}),
209
+ ...(typeof opts.lineCount === "number" ? { line_count: opts.lineCount } : {}),
211
210
  };
212
- if (typeof opts.from === "number") {
213
- payload.from = opts.from;
214
- }
215
- if (typeof opts.lines === "number") {
216
- payload.lines = opts.lines;
217
- }
218
- return payload;
219
211
  },
220
212
  },
221
- execute: async (params) => {
222
- const body = readBodyObject(params.input);
223
- return await readMemoryAction(params.context, {
224
- path: readString(body, "path"),
225
- from: readOptionalNumber(body, "from"),
226
- lines: readOptionalNumber(body, "lines"),
213
+ execute: async ({ context, input }) => {
214
+ const body = read_body_object(input);
215
+ return await read_memory_action(context, this.provider, {
216
+ memory_id: read_string(body, "memory_id"),
217
+ from_line: read_optional_number(body, "from_line"),
218
+ line_count: read_optional_number(body, "line_count"),
227
219
  });
228
220
  },
229
221
  }),
230
222
  remember: create_action({
231
- description: "Record facts, preferences, or decisions into memory wiki.",
223
+ description: "Store a durable fact, preference, decision, episode, procedure, or document.",
232
224
  input_schema: {
233
225
  zod: z.object({
234
226
  content: z.string(),
235
227
  topic: z.string().optional(),
236
- path: z.string().optional(),
228
+ memory_type: memory_type_schema.optional(),
237
229
  source: z.string().optional(),
238
230
  }),
239
231
  json_schema: {
240
232
  type: "object",
233
+ additionalProperties: false,
241
234
  required: ["content"],
242
235
  properties: {
243
236
  content: { type: "string", description: "Content to remember." },
244
- topic: { type: "string", description: "Memory topic." },
245
- path: { type: "string", description: "Target wiki page path." },
246
- source: { type: "string", description: "Source note." },
237
+ topic: { type: "string", description: "Optional organization hint." },
238
+ memory_type: {
239
+ type: "string",
240
+ enum: ["fact", "preference", "decision", "episode", "procedure", "document"],
241
+ },
242
+ source: { type: "string", description: "Optional evidence label." },
247
243
  },
248
244
  },
249
245
  },
250
- examples: [
251
- { title: "Remember preference", payload: { content: "User prefers concise answers", topic: "user-prefs" } },
252
- ],
246
+ examples: [{
247
+ title: "Remember a preference",
248
+ payload: {
249
+ content: "User prefers concise answers.",
250
+ topic: "user-preferences",
251
+ memory_type: "preference",
252
+ },
253
+ }],
253
254
  command: {
254
- description: "Record facts, preferences, or decisions into memory wiki.",
255
+ description: "Store a durable memory.",
255
256
  configure(command) {
256
257
  command
257
258
  .requiredOption("--content <text>", "Content to remember.")
258
- .option("--topic <topic>", "Memory topic.")
259
- .option("--wiki-path <path>", "Target wiki page path.")
260
- .option("--source <source>", "Source note.");
259
+ .option("--topic <topic>", "Optional organization hint.")
260
+ .option("--memory-type <type>", "Memory type.")
261
+ .option("--source <source>", "Optional evidence label.");
261
262
  },
262
263
  map_input({ opts }) {
263
- const payload = {
264
+ return {
264
265
  content: String(opts.content || ""),
266
+ ...(typeof opts.topic === "string" ? { topic: opts.topic } : {}),
267
+ ...(typeof opts.memoryType === "string" ? { memory_type: opts.memoryType } : {}),
268
+ ...(typeof opts.source === "string" ? { source: opts.source } : {}),
265
269
  };
266
- if (typeof opts.topic === "string") {
267
- payload.topic = String(opts.topic).trim();
268
- }
269
- if (typeof opts.wikiPath === "string") {
270
- payload.path = String(opts.wikiPath).trim();
271
- }
272
- if (typeof opts.source === "string") {
273
- payload.source = String(opts.source).trim();
274
- }
275
- return payload;
276
270
  },
277
271
  },
278
- execute: async (params) => {
279
- const body = readBodyObject(params.input);
280
- return await rememberMemoryAction(params.context, this.options, {
281
- content: readString(body, "content"),
282
- topic: readOptionalString(body, "topic"),
283
- path: readOptionalString(body, "path"),
284
- source: readOptionalString(body, "source"),
272
+ execute: async ({ context, input }) => {
273
+ const body = read_body_object(input);
274
+ return await remember_memory_action(context, this.provider, {
275
+ content: read_string(body, "content"),
276
+ topic: read_optional_string(body, "topic"),
277
+ memory_type: read_optional_memory_type(body),
278
+ source: read_optional_string(body, "source"),
285
279
  });
286
280
  },
287
281
  }),
288
282
  digest: create_action({
289
- description: "Digest a session into memory wiki.",
283
+ description: "Digest a canonical Session transcript into long-term memory.",
290
284
  input_schema: {
291
285
  zod: z.object({
292
286
  session_id: z.string(),
293
- maxMessages: z.number().optional(),
287
+ max_messages: z.number().optional(),
294
288
  }),
295
289
  json_schema: {
296
290
  type: "object",
291
+ additionalProperties: false,
297
292
  required: ["session_id"],
298
293
  properties: {
299
- session_id: { type: "string", description: "Session ID." },
300
- maxMessages: { type: "number", description: "Message extraction window." },
294
+ session_id: { type: "string" },
295
+ max_messages: { type: "number", minimum: 1 },
301
296
  },
302
297
  },
303
298
  },
304
- examples: [
305
- { title: "Digest session", payload: { session_id: "sess-1" } },
306
- ],
299
+ examples: [{ title: "Digest a Session", payload: { session_id: "sess-1" } }],
307
300
  command: {
308
- description: "Digest a session into memory wiki.",
301
+ description: "Digest a canonical Session transcript.",
309
302
  configure(command) {
310
303
  command
311
- .requiredOption("--session-id <session_id>", "Session ID.")
312
- .option("--max-messages <number>", "Message extraction window.", parsePositiveInteger);
304
+ .requiredOption("--session-id <session_id>", "Session identifier.")
305
+ .option("--max-messages <number>", "Maximum message count.", parse_positive_integer);
313
306
  },
314
307
  map_input({ opts }) {
315
- const payload = {
316
- session_id: String(opts.session_id || ""),
308
+ return {
309
+ session_id: String(opts.sessionId || ""),
310
+ ...(typeof opts.maxMessages === "number" ? { max_messages: opts.maxMessages } : {}),
317
311
  };
318
- if (typeof opts.maxMessages === "number") {
319
- payload.maxMessages = opts.maxMessages;
320
- }
321
- return payload;
322
312
  },
323
313
  },
324
- execute: async (params) => {
325
- const body = readBodyObject(params.input);
326
- return await digestMemoryAction(params.context, this.options, {
327
- session_id: readString(body, "session_id"),
328
- maxMessages: readOptionalNumber(body, "maxMessages"),
314
+ execute: async ({ context, input }) => {
315
+ const body = read_body_object(input);
316
+ return await digest_memory_action(context, this.provider, {
317
+ session_id: read_string(body, "session_id"),
318
+ max_messages: read_optional_number(body, "max_messages"),
329
319
  });
330
320
  },
331
321
  }),
332
322
  revise: create_action({
333
- description: "Revise a memory wiki page based on new evidence.",
323
+ description: "Revise one memory using new evidence.",
334
324
  input_schema: {
335
325
  zod: z.object({
336
- path: z.string(),
326
+ memory_id: z.string(),
337
327
  instruction: z.string(),
338
328
  evidence: z.string().optional(),
339
329
  }),
340
330
  json_schema: {
341
331
  type: "object",
342
- required: ["path", "instruction"],
332
+ additionalProperties: false,
333
+ required: ["memory_id", "instruction"],
343
334
  properties: {
344
- path: { type: "string", description: "Target wiki page path." },
345
- instruction: { type: "string", description: "Revision instruction." },
346
- evidence: { type: "string", description: "New evidence." },
335
+ memory_id: { type: "string" },
336
+ instruction: { type: "string" },
337
+ evidence: { type: "string" },
347
338
  },
348
339
  },
349
340
  },
350
- examples: [
351
- {
352
- title: "Revise entry",
353
- payload: { path: "wiki/preferences.md", instruction: "Replace with latest preference." },
354
- },
355
- ],
341
+ examples: [{
342
+ title: "Revise a preference",
343
+ payload: {
344
+ memory_id: "wiki/user-preferences",
345
+ instruction: "Replace the old preference with the latest one.",
346
+ },
347
+ }],
356
348
  command: {
357
- description: "Revise a memory wiki page based on new evidence.",
349
+ description: "Revise one memory using new evidence.",
358
350
  configure(command) {
359
351
  command
360
- .argument("<memoryPath>", "Target wiki page path.")
352
+ .argument("<memory_id>")
361
353
  .requiredOption("--instruction <text>", "Revision instruction.")
362
354
  .option("--evidence <text>", "New evidence.");
363
355
  },
364
356
  map_input({ args, opts }) {
365
- const payload = {
366
- path: String(args[0] || ""),
357
+ return {
358
+ memory_id: String(args[0] || ""),
367
359
  instruction: String(opts.instruction || ""),
360
+ ...(typeof opts.evidence === "string" ? { evidence: opts.evidence } : {}),
368
361
  };
369
- if (typeof opts.evidence === "string") {
370
- payload.evidence = String(opts.evidence).trim();
371
- }
372
- return payload;
373
362
  },
374
363
  },
375
- execute: async (params) => {
376
- const body = readBodyObject(params.input);
377
- return await reviseMemoryAction(params.context, this.options, {
378
- path: readString(body, "path"),
379
- instruction: readString(body, "instruction"),
380
- evidence: readOptionalString(body, "evidence"),
364
+ execute: async ({ context, input }) => {
365
+ const body = read_body_object(input);
366
+ return await revise_memory_action(context, this.provider, {
367
+ memory_id: read_string(body, "memory_id"),
368
+ instruction: read_string(body, "instruction"),
369
+ evidence: read_optional_string(body, "evidence"),
370
+ });
371
+ },
372
+ }),
373
+ forget: create_action({
374
+ description: "Delete or invalidate one memory by memory_id.",
375
+ input_schema: {
376
+ zod: z.object({ memory_id: z.string() }),
377
+ json_schema: {
378
+ type: "object",
379
+ additionalProperties: false,
380
+ required: ["memory_id"],
381
+ properties: { memory_id: { type: "string" } },
382
+ },
383
+ },
384
+ examples: [{ title: "Forget a memory", payload: { memory_id: "wiki/obsolete" } }],
385
+ command: {
386
+ description: "Delete or invalidate one memory.",
387
+ configure(command) {
388
+ command.argument("<memory_id>");
389
+ },
390
+ map_input({ args }) {
391
+ return { memory_id: String(args[0] || "") };
392
+ },
393
+ },
394
+ execute: async ({ context, input }) => {
395
+ const body = read_body_object(input);
396
+ return await forget_memory_action(context, this.provider, {
397
+ memory_id: read_string(body, "memory_id"),
381
398
  });
382
399
  },
383
400
  }),
384
401
  };
385
- /**
386
- * 获取或创建当前实例绑定的 memory plugin state。
387
- */
388
- getOrCreateRuntimeState(context) {
389
- if (!this.runtimeState) {
390
- this.runtimeState = createMemoryRuntimeState(context);
391
- }
392
- return this.runtimeState;
393
- }
394
402
  }
395
403
  //# sourceMappingURL=MemoryPlugin.js.map