@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
@@ -4,6 +4,6 @@
4
4
  */
5
5
 
6
6
  // Source: src/task/PROMPT.ts.txt
7
- const TEXT_MODULE_CONTENT = "# Task Plugin\n\nYou can use the `task` plugin to manage task definitions, execution, scheduling, and status control.\n\n## Task Model\n\nEach task is defined in `./.downcity/task/<title>/task.md` and contains:\n- frontmatter for structured fields\n- body for the task instructions\n\nCore frontmatter fields:\n- `title`: unique task identifier\n- `description`: task description\n- `when`: trigger condition, supporting `@manual`, cron, or `time:<ISO8601-with-timezone>`\n- `session_id`: task execution session\n- `status`: `enabled|paused|disabled`\n- `kind`: `agent|script`, defaulting to `agent`\n\nEach execution creates a run directory:\n- `./.downcity/task/<title>/<timestamp>/`\n\nCommon artifacts:\n- `input.md`\n- `output.md`: final output body for this run\n- `result.md`: execution summary\n- `run.json`\n- `run-progress.json`\n- `dialogue.md` / `dialogue.json`: multi-turn agent dialogue\n- `error.md`: failure details\n\n## Execution Kinds\n\n1. `kind=agent`\n- Sends the task body to an agent for execution.\n- Completes in a single turn by default. Simulated multi-turn review is enabled only when frontmatter explicitly sets `review: true`.\n- Suitable for research, analysis, and report generation.\n\n2. `kind=script`\n- Treats the body as a shell script.\n- The body must be non-empty and executable as a script.\n\n## Available Actions\n\n- `list`\n- `create`\n- `run`\n- `delete`\n- `update`\n- `status`\n- `enable`\n- `disable`\n\n## Action Examples\n\n- `plugin_call({ plugin: \"task\", action: \"list\", payload: { status } })`\n- `plugin_call({ plugin: \"task\", action: \"create\", payload: { title, description, session_id, when, kind, status } })`\n- `plugin_call({ plugin: \"task\", action: \"run\", payload: { title, reason } })`\n- `plugin_call({ plugin: \"task\", action: \"update\", payload: { title, description, when, status, session_id } })`\n- `plugin_call({ plugin: \"task\", action: \"delete\", payload: { title } })`\n\n## Key Constraints\n\n- `title` is unique. `create` deduplicates only by exact `title`.\n- After `when=time:...` triggers, the task is automatically set to `paused` and falls back to `when=@manual`.\n- `run` is accepted asynchronously. It returns `accepted=true`, `message`, and `executionId` immediately. Treat this as \"the task has entered background execution; the result will be sent automatically through the chat plugin runtime, and the current flow does not need to block.\"\n- If `run` returns `accepted=true`:\n - Do not manually forward task output to the user again.\n - Do not actively poll the run directory, `run-progress.json`, or `output.md`.\n - Inspect the run directory only when the user explicitly asks to debug, view artifacts, or confirm execution details.\n- Agent tasks only need to produce valid output by default. They should send to an external channel only when the task body explicitly requires it.\n\n## Designing The Task Body\n\n### Recommended Agent Task Structure\n\nThe body should include at least these headings:\n\n```md\n# Task Goal\n\n- What final result this task must deliver.\n\n# Background And Input\n\n- Data sources, scope, constraints, and reference materials.\n\n# Execution Steps\n\n1. What to do first.\n2. What to do next.\n3. Where key intermediate artifacts should be written.\n\n# Output Requirements\n\n- What format the final result must use.\n- Whether a table, JSON, or Markdown is required.\n- What content must not be included.\n\n# Trigger And Status Recommendation\n\n- Why this task is suitable for `@manual`, cron, or `time:...`.\n- Whether it should currently be `paused` or `enabled`.\n\n# Notes\n\n- Risks, boundaries, and things not to do.\n```\n\n### Agent Task Body Writing Constraints\n\n- The task body must read like a delivery contract, so another executor can run it directly without relying on the current chat context.\n- `# Task Goal` must clearly state the final deliverable. Do not write vague goals such as \"take a look\", \"research this\", or \"handle this\".\n- `# Background And Input` must specify sources, scope, objects, time range, and constraints. Do not assume the executor can see the original chat context.\n- `# Execution Steps` should describe the task workflow, not task-management actions. Do not write \"first check whether a task with the same name exists\", \"then create a task\", or \"then trigger the task\".\n- `# Output Requirements` must clearly specify the final artifact's format, structure, tone, length, and excluded content.\n- Explicitly state that the final assistant message will be written directly to `output.md` and sent to the user. Therefore, the final answer must be exactly the deliverable content.\n- Content-generation tasks such as daily reports, reminders, morning briefings, summaries, and reports must explicitly require \"the final output is the deliverable body itself\". Do not let the executor output process notes.\n- If the task result should be sent to the user, the body should require \"output send-ready message content\" instead of asking the executor to explain what it has sent.\n- Unless truly needed, do not ask the executor to repeat the task title, session_id, execution time, status, or other metadata in the body.\n- Constraints in the body must be executable and checkable. Avoid weak phrases such as \"appropriately\", \"as much as possible\", or \"depending on the situation\".\n- Do not put task creation, task update, task status lookup, or same-title existence checks into the body. Those belong to the task plugin, not to the task deliverable.\n\n### Forbidden Agent Task Body Patterns\n\n- Do not write the body in chat-reply style, for example:\n - \"I will help you...\"\n - \"First, let me...\"\n - \"I will check first...\"\n - \"I see there is already a task with the same name...\"\n- Do not write the body as task-management instructions, for example:\n - \"If the task exists, update it; otherwise create it.\"\n - \"First list, then run.\"\n - \"Tell the user that the task has started when done.\"\n- Do not write the body as a status-report template, for example:\n - \"Task status summary\"\n - \"Sent / completed / updated\"\n - \"Current task configuration\"\n- Do not describe only actions without describing the deliverable, for example:\n - \"Go collect some materials.\"\n - \"Generate some content and see.\"\n - \"Report back after finishing.\"\n- Do not use references that depend on the current context, for example:\n - \"Do what was said above.\"\n - \"Continue the previous one.\"\n - \"Send this out.\"\n\n### How To Judge Whether The Body Is Good\n\n- If you can copy the task body alone to another agent and it can still understand the goal, input, steps, and deliverable, the body is valid.\n- If deleting the output section leaves only \"go do something\" style instructions, the body is invalid.\n- If the body looks more like instructions for creating or updating a task than instructions for executing the task, the layering is wrong and the body must be rewritten.\n- If the body naturally encourages the executor to output process notes instead of the final artifact, the `# Output Requirements` section is not strong enough and must add explicit prohibitions.\n\n### Recommended Script Task Structure\n\n- The body must be a pure shell script. Do not mix in explanatory natural language.\n- Start with comments that describe the script's purpose, input dependencies, and failure conditions when possible.\n- Keep output stable so it can be sent directly as the final result.\n- If files need to be generated, write them to the run directory or to an explicit project path.\n\n### Output Design Principles\n\n- When a task completes, the system automatically sends the final result body back to the chat bound to `session_id` through the chat plugin runtime's `send`.\n- The current implementation uses the simplest rule: the final assistant message is treated directly as the final result body and written to `output.md`.\n- Therefore, the \"Output Requirements\" section must be written for the final user, not only for developers.\n- For user-facing agent tasks, the body should require \"the final assistant message directly outputs the deliverable itself\". Do not let the executor explain how it created, checked, updated, triggered, or sent the task.\n- For content-generation tasks such as daily reports, reminders, morning briefings, and summaries, the final output should be exactly that content. It should not include process language such as \"I will handle this\", \"task sent\", or \"task status summary\".\n- By default, do not ask the executor to call chat plugin send actions again. The system handles final-result delivery.\n- Explicitly require chat plugin actions only for cross-conversation sending, additional CCs, multi-channel notifications, or similar cases.\n\n### Choosing `when` And `status`\n\n- A task is created as `status=enabled` by default. Set `paused` explicitly only when it is still a draft, likely to fail, or needs human confirmation.\n- For verified stable tasks that need automatic execution, use cron with `status=enabled`.\n- For a clear one-time execution, use `time:<ISO time with timezone>`. After execution, the system automatically falls back to `@manual` and `paused`.\n- If the user only wants to save it for later, do not enable scheduling directly.\n\n## Body Templates\n\n### Agent Template\n\n```md\n# Task Goal\n\n- Produce a final result that can be sent directly to the user.\n\n# Background And Input\n\n- Add context, files, links, scope, and assumptions here.\n\n# Execution Steps\n\n1. Understand the task goal and completion criteria.\n2. Collect necessary information and execute the task.\n3. Write key intermediate artifacts to the run directory.\n4. Output the final result body.\n\n# Output Requirements\n\n- The final assistant message is the final result. Do not include long logs.\n- The final assistant message must output the deliverable itself. Do not output task-management process, sending process, or status reports.\n- Do not use meta language such as \"I will help you...\", \"First, let me...\", or \"sent\".\n- By default, do not call the chat plugin send action again.\n\n# Trigger And Status Recommendation\n\n- Enable by default after creation. If this is only a draft or waiting for human confirmation, set it to `paused`.\n\n# Notes\n\n- Call chat plugin send actions only when cross-conversation or additional notifications are explicitly needed.\n```\n\n### Script Template\n\n```bash\n# Task goal: state in one sentence what the script should do\n# Input dependencies: list environment variables, files, and command dependencies\n# Failure conditions: list cases that should exit 1\n\nset -euo pipefail\n\n# 1. Prepare input\n\n# 2. Execute main logic\n\n# 3. Output final result. This output will be sent directly to the user.\n```\n\n## Recommendations\n\n- Run `list` before `create` or `update`.\n- Keep simple content-generation tasks single-turn by default. Set `review: true` only when you truly need \"draft, review, revise\".\n- Keep script task bodies as pure scripts, without redundant natural-language explanation.\n- If the user only wants to save something for later, create it as `paused`; otherwise keep the default enabled state.\n- The task body must describe what the final result should look like, not only say \"go do this and see\".\n- For content-generation tasks, explicitly require \"the final assistant message can only be the finished content body\" so the executor does not mistake process notes for the final result.\n";
7
+ const TEXT_MODULE_CONTENT = "# Task Plugin\n\nYou can use the `task` plugin to manage task definitions, execution, scheduling, and status control.\n\n## Task Model\n\nEach task is defined in the current Agent private runtime directory private `task/<title>/task.md` and contains:\n- frontmatter for structured fields\n- body for the task instructions\n\nCore frontmatter fields:\n- `title`: unique task identifier\n- `description`: task description\n- `when`: trigger condition, supporting `@manual`, cron, or `time:<ISO8601-with-timezone>`\n- `session_id`: task execution session\n- `status`: `enabled|paused|disabled`\n- `kind`: `agent|script`, defaulting to `agent`\n\nEach execution creates a private run record managed by Downcity under the current Agent private runtime directory.\n\nCommon artifacts:\n- `input.md`\n- `output.md`: final output body for this run\n- `result.md`: execution summary\n- `run.json`\n- `run-progress.json`\n- `dialogue.md` / `dialogue.json`: multi-turn agent dialogue\n- `error.md`: failure details\n\n## Execution Kinds\n\n1. `kind=agent`\n- Sends the task body to an agent for execution.\n- Completes in a single turn by default. Simulated multi-turn review is enabled only when frontmatter explicitly sets `review: true`.\n- Suitable for research, analysis, and report generation.\n\n2. `kind=script`\n- Treats the body as a shell script.\n- The body must be non-empty and executable as a script.\n\n## Available Actions\n\n- `list`\n- `create`\n- `run`\n- `delete`\n- `update`\n- `status`\n- `enable`\n- `disable`\n\n## Action Examples\n\n- `plugin_call({ plugin: \"task\", action: \"list\", payload: { status } })`\n- `plugin_call({ plugin: \"task\", action: \"create\", payload: { title, description, session_id, when, kind, status } })`\n- `plugin_call({ plugin: \"task\", action: \"run\", payload: { title, reason } })`\n- `plugin_call({ plugin: \"task\", action: \"update\", payload: { title, description, when, status, session_id } })`\n- `plugin_call({ plugin: \"task\", action: \"delete\", payload: { title } })`\n\n## Key Constraints\n\n- `title` is unique. `create` deduplicates only by exact `title`.\n- After `when=time:...` triggers, the task is automatically set to `paused` and falls back to `when=@manual`.\n- `run` is accepted asynchronously. It returns `accepted=true`, `message`, and `executionId` immediately. Treat this as \"the task has entered background execution; the result will be sent automatically through the chat plugin runtime, and the current flow does not need to block.\"\n- If `run` returns `accepted=true`:\n - Do not manually forward task output to the user again.\n - Do not actively poll the run directory, `run-progress.json`, or `output.md`.\n - Inspect run details through the task/control API only when the user explicitly asks to debug, view artifacts, or confirm execution details.\n- Agent tasks only need to produce valid output by default. They should send to an external channel only when the task body explicitly requires it.\n\n## Designing The Task Body\n\n### Recommended Agent Task Structure\n\nThe body should include at least these headings:\n\n```md\n# Task Goal\n\n- What final result this task must deliver.\n\n# Background And Input\n\n- Data sources, scope, constraints, and reference materials.\n\n# Execution Steps\n\n1. What to do first.\n2. What to do next.\n3. Where key intermediate artifacts should be written.\n\n# Output Requirements\n\n- What format the final result must use.\n- Whether a table, JSON, or Markdown is required.\n- What content must not be included.\n\n# Trigger And Status Recommendation\n\n- Why this task is suitable for `@manual`, cron, or `time:...`.\n- Whether it should currently be `paused` or `enabled`.\n\n# Notes\n\n- Risks, boundaries, and things not to do.\n```\n\n### Agent Task Body Writing Constraints\n\n- The task body must read like a delivery contract, so another executor can run it directly without relying on the current chat context.\n- `# Task Goal` must clearly state the final deliverable. Do not write vague goals such as \"take a look\", \"research this\", or \"handle this\".\n- `# Background And Input` must specify sources, scope, objects, time range, and constraints. Do not assume the executor can see the original chat context.\n- `# Execution Steps` should describe the task workflow, not task-management actions. Do not write \"first check whether a task with the same name exists\", \"then create a task\", or \"then trigger the task\".\n- `# Output Requirements` must clearly specify the final artifact's format, structure, tone, length, and excluded content.\n- Explicitly state that the final assistant message will be written directly to `output.md` and sent to the user. Therefore, the final answer must be exactly the deliverable content.\n- Content-generation tasks such as daily reports, reminders, morning briefings, summaries, and reports must explicitly require \"the final output is the deliverable body itself\". Do not let the executor output process notes.\n- If the task result should be sent to the user, the body should require \"output send-ready message content\" instead of asking the executor to explain what it has sent.\n- Unless truly needed, do not ask the executor to repeat the task title, session_id, execution time, status, or other metadata in the body.\n- Constraints in the body must be executable and checkable. Avoid weak phrases such as \"appropriately\", \"as much as possible\", or \"depending on the situation\".\n- Do not put task creation, task update, task status lookup, or same-title existence checks into the body. Those belong to the task plugin, not to the task deliverable.\n\n### Forbidden Agent Task Body Patterns\n\n- Do not write the body in chat-reply style, for example:\n - \"I will help you...\"\n - \"First, let me...\"\n - \"I will check first...\"\n - \"I see there is already a task with the same name...\"\n- Do not write the body as task-management instructions, for example:\n - \"If the task exists, update it; otherwise create it.\"\n - \"First list, then run.\"\n - \"Tell the user that the task has started when done.\"\n- Do not write the body as a status-report template, for example:\n - \"Task status summary\"\n - \"Sent / completed / updated\"\n - \"Current task configuration\"\n- Do not describe only actions without describing the deliverable, for example:\n - \"Go collect some materials.\"\n - \"Generate some content and see.\"\n - \"Report back after finishing.\"\n- Do not use references that depend on the current context, for example:\n - \"Do what was said above.\"\n - \"Continue the previous one.\"\n - \"Send this out.\"\n\n### How To Judge Whether The Body Is Good\n\n- If you can copy the task body alone to another agent and it can still understand the goal, input, steps, and deliverable, the body is valid.\n- If deleting the output section leaves only \"go do something\" style instructions, the body is invalid.\n- If the body looks more like instructions for creating or updating a task than instructions for executing the task, the layering is wrong and the body must be rewritten.\n- If the body naturally encourages the executor to output process notes instead of the final artifact, the `# Output Requirements` section is not strong enough and must add explicit prohibitions.\n\n### Recommended Script Task Structure\n\n- The body must be a pure shell script. Do not mix in explanatory natural language.\n- Start with comments that describe the script's purpose, input dependencies, and failure conditions when possible.\n- Keep output stable so it can be sent directly as the final result.\n- If files need to be delivered to the user, write them to an explicit project path.\n\n### Output Design Principles\n\n- When a task completes, the system automatically sends the final result body back to the chat bound to `session_id` through the chat plugin runtime's `send`.\n- The current implementation uses the simplest rule: the final assistant message is treated directly as the final result body and written to `output.md`.\n- Therefore, the \"Output Requirements\" section must be written for the final user, not only for developers.\n- For user-facing agent tasks, the body should require \"the final assistant message directly outputs the deliverable itself\". Do not let the executor explain how it created, checked, updated, triggered, or sent the task.\n- For content-generation tasks such as daily reports, reminders, morning briefings, and summaries, the final output should be exactly that content. It should not include process language such as \"I will handle this\", \"task sent\", or \"task status summary\".\n- By default, do not ask the executor to call chat plugin send actions again. The system handles final-result delivery.\n- Explicitly require chat plugin actions only for cross-conversation sending, additional CCs, multi-channel notifications, or similar cases.\n\n### Choosing `when` And `status`\n\n- A task is created as `status=enabled` by default. Set `paused` explicitly only when it is still a draft, likely to fail, or needs human confirmation.\n- For verified stable tasks that need automatic execution, use cron with `status=enabled`.\n- For a clear one-time execution, use `time:<ISO time with timezone>`. After execution, the system automatically falls back to `@manual` and `paused`.\n- If the user only wants to save it for later, do not enable scheduling directly.\n\n## Body Templates\n\n### Agent Template\n\n```md\n# Task Goal\n\n- Produce a final result that can be sent directly to the user.\n\n# Background And Input\n\n- Add context, files, links, scope, and assumptions here.\n\n# Execution Steps\n\n1. Understand the task goal and completion criteria.\n2. Collect necessary information and execute the task.\n3. Write user-visible artifacts to an explicit project path when needed.\n4. Output the final result body.\n\n# Output Requirements\n\n- The final assistant message is the final result. Do not include long logs.\n- The final assistant message must output the deliverable itself. Do not output task-management process, sending process, or status reports.\n- Do not use meta language such as \"I will help you...\", \"First, let me...\", or \"sent\".\n- By default, do not call the chat plugin send action again.\n\n# Trigger And Status Recommendation\n\n- Enable by default after creation. If this is only a draft or waiting for human confirmation, set it to `paused`.\n\n# Notes\n\n- Call chat plugin send actions only when cross-conversation or additional notifications are explicitly needed.\n```\n\n### Script Template\n\n```bash\n# Task goal: state in one sentence what the script should do\n# Input dependencies: list environment variables, files, and command dependencies\n# Failure conditions: list cases that should exit 1\n\nset -euo pipefail\n\n# 1. Prepare input\n\n# 2. Execute main logic\n\n# 3. Output final result. This output will be sent directly to the user.\n```\n\n## Recommendations\n\n- Run `list` before `create` or `update`.\n- Keep simple content-generation tasks single-turn by default. Set `review: true` only when you truly need \"draft, review, revise\".\n- Keep script task bodies as pure scripts, without redundant natural-language explanation.\n- If the user only wants to save something for later, create it as `paused`; otherwise keep the default enabled state.\n- The task body must describe what the final result should look like, not only say \"go do this and see\".\n- For content-generation tasks, explicitly require \"the final assistant message can only be the finished content body\" so the executor does not mistake process notes for the final result.\n";
8
8
 
9
9
  export default TEXT_MODULE_CONTENT;
@@ -4,7 +4,7 @@ You can use the `task` plugin to manage task definitions, execution, scheduling,
4
4
 
5
5
  ## Task Model
6
6
 
7
- Each task is defined in `./.downcity/task/<title>/task.md` and contains:
7
+ Each task is defined in the current Agent private runtime directory private `task/<title>/task.md` and contains:
8
8
  - frontmatter for structured fields
9
9
  - body for the task instructions
10
10
 
@@ -16,8 +16,7 @@ Core frontmatter fields:
16
16
  - `status`: `enabled|paused|disabled`
17
17
  - `kind`: `agent|script`, defaulting to `agent`
18
18
 
19
- Each execution creates a run directory:
20
- - `./.downcity/task/<title>/<timestamp>/`
19
+ Each execution creates a private run record managed by Downcity under the current Agent private runtime directory.
21
20
 
22
21
  Common artifacts:
23
22
  - `input.md`
@@ -66,7 +65,7 @@ Common artifacts:
66
65
  - If `run` returns `accepted=true`:
67
66
  - Do not manually forward task output to the user again.
68
67
  - Do not actively poll the run directory, `run-progress.json`, or `output.md`.
69
- - Inspect the run directory only when the user explicitly asks to debug, view artifacts, or confirm execution details.
68
+ - Inspect run details through the task/control API only when the user explicitly asks to debug, view artifacts, or confirm execution details.
70
69
  - Agent tasks only need to produce valid output by default. They should send to an external channel only when the task body explicitly requires it.
71
70
 
72
71
  ## Designing The Task Body
@@ -156,7 +155,7 @@ The body should include at least these headings:
156
155
  - The body must be a pure shell script. Do not mix in explanatory natural language.
157
156
  - Start with comments that describe the script's purpose, input dependencies, and failure conditions when possible.
158
157
  - Keep output stable so it can be sent directly as the final result.
159
- - If files need to be generated, write them to the run directory or to an explicit project path.
158
+ - If files need to be delivered to the user, write them to an explicit project path.
160
159
 
161
160
  ### Output Design Principles
162
161
 
@@ -192,7 +191,7 @@ The body should include at least these headings:
192
191
 
193
192
  1. Understand the task goal and completion criteria.
194
193
  2. Collect necessary information and execute the task.
195
- 3. Write key intermediate artifacts to the run directory.
194
+ 3. Write user-visible artifacts to an explicit project path when needed.
196
195
  4. Output the final result body.
197
196
 
198
197
  # Output Requirements
@@ -36,7 +36,7 @@ export async function registerTaskCronJobs(params: {
36
36
  }): Promise<{ tasksFound: number; jobsScheduled: number }> {
37
37
  const context = params.context;
38
38
  const logger = context.logger;
39
- const tasks = await listTasks(context.workspace_path);
39
+ const tasks = await listTasks(context.data_path);
40
40
  const runtimeTimezone = params.timezone;
41
41
 
42
42
  let jobsScheduled = 0;
@@ -49,7 +49,7 @@ export async function registerTaskCronJobs(params: {
49
49
  try {
50
50
  const task = await readTask({
51
51
  taskId: item.taskId,
52
- project_root: context.workspace_path,
52
+ data_path: context.data_path,
53
53
  });
54
54
  latestWhen = task.frontmatter.when;
55
55
  } catch {}
@@ -78,7 +78,7 @@ export async function registerTaskCronJobs(params: {
78
78
  // 关键点(中文):触发瞬间复查最新 task.md,避免 status/when 变更后仍沿用旧注册状态。
79
79
  const latest = await readTask({
80
80
  taskId,
81
- project_root: context.workspace_path,
81
+ data_path: context.data_path,
82
82
  });
83
83
  if (String(latest.frontmatter.status).toLowerCase() !== "enabled") {
84
84
  return;
@@ -91,7 +91,7 @@ export async function registerTaskCronJobs(params: {
91
91
  const result = await runTaskNow({
92
92
  context,
93
93
  taskId,
94
- project_root: context.workspace_path,
94
+ data_path: context.data_path,
95
95
  trigger: { type: "cron" },
96
96
  });
97
97
 
@@ -166,7 +166,7 @@ export async function registerTaskCronJobs(params: {
166
166
  try {
167
167
  const latest = await readTask({
168
168
  taskId,
169
- project_root: context.workspace_path,
169
+ data_path: context.data_path,
170
170
  });
171
171
  if (String(latest.frontmatter.status).toLowerCase() !== "enabled") return;
172
172
  const latestPlannedMs = resolveTaskWhenOneShotMs(latest.frontmatter.when);
@@ -177,7 +177,7 @@ export async function registerTaskCronJobs(params: {
177
177
  const result = await runTaskNow({
178
178
  context,
179
179
  taskId,
180
- project_root: context.workspace_path,
180
+ data_path: context.data_path,
181
181
  trigger: { type: "time" },
182
182
  });
183
183
 
@@ -206,10 +206,10 @@ export async function registerTaskCronJobs(params: {
206
206
  try {
207
207
  const latest = await readTask({
208
208
  taskId,
209
- project_root: context.workspace_path,
209
+ data_path: context.data_path,
210
210
  });
211
211
  await writeTask({
212
- project_root: context.workspace_path,
212
+ data_path: context.data_path,
213
213
  taskId,
214
214
  overwrite: true,
215
215
  frontmatter: {
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import { BasePlugin, create_action } from "@downcity/agent";
11
+ import type { AgentPluginContext } from "@downcity/agent";
11
12
  import type { PluginActions } from "@downcity/agent";
12
13
  import type { PluginContext } from "@downcity/agent";
13
14
  import type {
@@ -25,6 +26,7 @@ import {
25
26
  } from "@/task/runtime/TaskActionExecution.js";
26
27
  import { TASK_PLUGIN_PROMPT } from "@/task/runtime/TaskPluginSystem.js";
27
28
  import { resolve_runtime_timezone } from "@downcity/agent";
29
+ import type { TaskWorkspaceRuntime } from "@/task/types/TaskWorkspaceRuntime.js";
28
30
 
29
31
  const TASK_LOG_PREFIX = "[TASK]";
30
32
 
@@ -44,7 +46,10 @@ export class TaskPlugin extends BasePlugin {
44
46
  /**
45
47
  * task plugin 的 system 文本提供器。
46
48
  */
47
- readonly system = (): string => TASK_PLUGIN_PROMPT;
49
+ readonly system = async (context: PluginContext): Promise<string> => {
50
+ await this.start_cron_runtime(context);
51
+ return TASK_PLUGIN_PROMPT;
52
+ };
48
53
 
49
54
  /**
50
55
  * task plugin 的 action 定义表。
@@ -63,16 +68,10 @@ export class TaskPlugin extends BasePlugin {
63
68
  * - 这是 per-plugin-instance 的长期运行态。
64
69
  * - 不再复用 module-global 单例。
65
70
  */
66
- public cronEngine: TaskCronTriggerEngine | null = null;
71
+ private readonly runtimes_by_workspace = new Map<string, TaskWorkspaceRuntime>();
67
72
 
68
- /**
69
- * 当前实例持有的运行中 task 锁。
70
- *
71
- * 关键点(中文)
72
- * - scheduler reload 会替换 cron engine。
73
- * - 锁必须挂在 plugin 实例上,避免 reload 后同一 task 被新旧调度器并发触发。
74
- */
75
- private readonly runningTaskIds = new Set<string>();
73
+ /** 各 Workspace 当前唯一的 cron 启动流程。 */
74
+ private readonly starts_by_workspace = new Map<string, Promise<TaskCronRegisterResult | null>>();
76
75
 
77
76
  constructor(options?: TaskPluginOptions) {
78
77
  super();
@@ -86,7 +85,7 @@ export class TaskPlugin extends BasePlugin {
86
85
  reload: create_action({
87
86
  description: "Reload the task scheduler from persisted tasks.",
88
87
  execute: async ({ context }) => {
89
- const result = await this.restartCronRuntime(context);
88
+ const result = await this.restart_cron_runtime(context);
90
89
  context.logger.info(
91
90
  formatTaskLogMessage(
92
91
  `Task cron trigger reloaded (tasks=${result.tasksFound}, jobs=${result.jobsScheduled})`,
@@ -105,19 +104,13 @@ export class TaskPlugin extends BasePlugin {
105
104
  };
106
105
 
107
106
  this.lifecycle = {
108
- start: async (context) => {
109
- const result = await this.startCronRuntime(context);
110
- if (!result) return;
111
- context.logger.info(
112
- formatTaskLogMessage(
113
- `Task cron trigger started (tasks=${result.tasksFound}, jobs=${result.jobsScheduled})`,
114
- ),
115
- );
116
- },
117
- stop: async (context) => {
118
- const stopped = await this.stopCronRuntime();
119
- if (!stopped) return;
120
- context.logger.info(formatTaskLogMessage("Task cron trigger stopped"));
107
+ start: async (_context: AgentPluginContext) => {},
108
+ stop: async (_context: AgentPluginContext) => {
109
+ await Promise.allSettled([...this.starts_by_workspace.values()]);
110
+ await Promise.all([...this.runtimes_by_workspace.keys()].map(async (workspace_id) => {
111
+ await this.stop_cron_runtime(workspace_id);
112
+ }));
113
+ this.starts_by_workspace.clear();
121
114
  },
122
115
  };
123
116
  }
@@ -125,42 +118,58 @@ export class TaskPlugin extends BasePlugin {
125
118
  /**
126
119
  * 启动当前实例的 cron runtime。
127
120
  */
128
- async startCronRuntime(
121
+ async start_cron_runtime(
129
122
  context: PluginContext,
130
123
  ): Promise<TaskCronRegisterResult | null> {
131
- if (this.cronEngine) return null;
132
-
133
- const engine = new TaskCronTriggerEngine();
134
- const registerResult = await registerTaskCronJobs({
135
- context,
136
- engine,
137
- timezone: this.resolveTimezone(),
138
- runningTaskIds: this.runningTaskIds,
139
- });
140
- await engine.start();
141
- this.cronEngine = engine;
142
- return registerResult;
124
+ if (this.runtimes_by_workspace.has(context.workspace_id)) return null;
125
+ const started = this.starts_by_workspace.get(context.workspace_id);
126
+ if (started) return await started;
127
+
128
+ const start_promise = (async () => {
129
+ const engine = new TaskCronTriggerEngine();
130
+ const running_task_ids = new Set<string>();
131
+ const register_result = await registerTaskCronJobs({
132
+ context,
133
+ engine,
134
+ timezone: this.resolveTimezone(),
135
+ runningTaskIds: running_task_ids,
136
+ });
137
+ await engine.start();
138
+ this.runtimes_by_workspace.set(context.workspace_id, {
139
+ cron_engine: engine,
140
+ running_task_ids,
141
+ });
142
+ return register_result;
143
+ })();
144
+ this.starts_by_workspace.set(context.workspace_id, start_promise);
145
+ try {
146
+ return await start_promise;
147
+ } finally {
148
+ if (this.starts_by_workspace.get(context.workspace_id) === start_promise) {
149
+ this.starts_by_workspace.delete(context.workspace_id);
150
+ }
151
+ }
143
152
  }
144
153
 
145
154
  /**
146
155
  * 停止当前实例的 cron runtime。
147
156
  */
148
- async stopCronRuntime(): Promise<boolean> {
149
- if (!this.cronEngine) return false;
150
- const previous = this.cronEngine;
151
- this.cronEngine = null;
152
- await previous.stop();
157
+ async stop_cron_runtime(workspace_id: string): Promise<boolean> {
158
+ const runtime = this.runtimes_by_workspace.get(workspace_id);
159
+ if (!runtime) return false;
160
+ this.runtimes_by_workspace.delete(workspace_id);
161
+ await runtime.cron_engine.stop();
153
162
  return true;
154
163
  }
155
164
 
156
165
  /**
157
166
  * 重启当前实例的 cron runtime。
158
167
  */
159
- async restartCronRuntime(
168
+ async restart_cron_runtime(
160
169
  context: PluginContext,
161
170
  ): Promise<TaskCronRegisterResult> {
162
- await this.stopCronRuntime();
163
- const started = await this.startCronRuntime(context);
171
+ await this.stop_cron_runtime(context.workspace_id);
172
+ const started = await this.start_cron_runtime(context);
164
173
  return (
165
174
  started || {
166
175
  tasksFound: 0,
@@ -181,7 +190,7 @@ export class TaskPlugin extends BasePlugin {
181
190
  context: params.context,
182
191
  action: params.action,
183
192
  title: params.title,
184
- reloadScheduler: async (context) => this.restartCronRuntime(context),
193
+ reloadScheduler: async (context) => this.restart_cron_runtime(context),
185
194
  });
186
195
  }
187
196
 
@@ -142,16 +142,6 @@ export function normalizeTaskWhen(
142
142
  return { ok: true, value: canonical };
143
143
  }
144
144
 
145
- /**
146
- * 兼容旧调用名:返回 cron 表达式或 `@manual`。
147
- */
148
- export function normalizeTaskCronExpression(raw: string): string | null {
149
- const when = normalizeTaskWhen(raw);
150
- if (!when.ok) return null;
151
- if (isTaskWhenOneShot(when.value)) return null;
152
- return normalizeCronExpression(when.value);
153
- }
154
-
155
145
  export function isTaskWhenManual(input: string): boolean {
156
146
  const when = String(input || "").trim().toLowerCase();
157
147
  return when === "@manual";
@@ -213,9 +203,9 @@ export function parseTaskMarkdown(params: {
213
203
  taskId: string;
214
204
  markdown: string;
215
205
  taskMdPath: string;
216
- project_root: string;
206
+ data_path: string;
217
207
  }): { ok: true; task: ShipTaskDefinitionV1 } | { ok: false; error: string } {
218
- const { taskId, markdown, taskMdPath, project_root } = params;
208
+ const { taskId, markdown, taskMdPath, data_path } = params;
219
209
  const text = String(markdown ?? "");
220
210
  const { frontMatterYaml, body } = parseFrontMatter(text);
221
211
 
@@ -293,7 +283,7 @@ export function parseTaskMarkdown(params: {
293
283
  };
294
284
 
295
285
  const relTaskMdPath = path
296
- .relative(project_root, taskMdPath)
286
+ .relative(data_path, taskMdPath)
297
287
  .split(path.sep)
298
288
  .join("/");
299
289
 
@@ -2,9 +2,9 @@
2
2
  * Task System paths and identifiers.
3
3
  *
4
4
  * 约定(中文)
5
- * - task root: `./.downcity/task/`
6
- * - definition: `./.downcity/task/<taskId>/task.md`
7
- * - run dir: `./.downcity/task/<taskId>/<timestamp>/`
5
+ * - task root: `<Agent data>/task/`
6
+ * - definition: `<Agent data>/task/<taskId>/task.md`
7
+ * - run dir: `<Agent data>/task/<taskId>/<timestamp>/`
8
8
  *
9
9
  * 同时定义“task run session_id”格式,用于把 Agent 的 session 映射到 run 目录:
10
10
  * - `task-run:<taskId>:<timestamp>`
@@ -59,16 +59,16 @@ export function normalizeTaskId(input: string): string {
59
59
  return id;
60
60
  }
61
61
 
62
- export function getTaskRootDir(project_root: string): string {
63
- return path.join(String(project_root || "").trim(), ".downcity", "task");
62
+ export function getTaskRootDir(data_path: string): string {
63
+ return path.join(String(data_path || "").trim(), "task");
64
64
  }
65
65
 
66
- export function getTaskDir(project_root: string, taskId: string): string {
67
- return path.join(getTaskRootDir(project_root), normalizeTaskId(taskId));
66
+ export function getTaskDir(data_path: string, taskId: string): string {
67
+ return path.join(getTaskRootDir(data_path), normalizeTaskId(taskId));
68
68
  }
69
69
 
70
- export function getTaskMdPath(project_root: string, taskId: string): string {
71
- return path.join(getTaskDir(project_root, taskId), "task.md");
70
+ export function getTaskMdPath(data_path: string, taskId: string): string {
71
+ return path.join(getTaskDir(data_path, taskId), "task.md");
72
72
  }
73
73
 
74
74
  export function formatTaskRunTimestamp(date: Date = new Date()): string {
@@ -85,13 +85,13 @@ export function formatTaskRunTimestamp(date: Date = new Date()): string {
85
85
  }
86
86
 
87
87
  export function getTaskRunDir(
88
- project_root: string,
88
+ data_path: string,
89
89
  taskId: string,
90
90
  timestamp: string,
91
91
  ): string {
92
92
  const ts = String(timestamp || "").trim();
93
93
  if (!ts) throw new Error("timestamp is required");
94
- return path.join(getTaskDir(project_root, taskId), ts);
94
+ return path.join(getTaskDir(data_path, taskId), ts);
95
95
  }
96
96
 
97
97
  export function createTaskRunSessionId(taskId: string, timestamp: string): string {
@@ -79,7 +79,7 @@ export async function runTaskNow(params: {
79
79
  taskId: string;
80
80
  trigger: ShipTaskRunTriggerV1;
81
81
  executionId?: string;
82
- project_root?: string;
82
+ data_path?: string;
83
83
  /** 发起该任务的 Session step 已提交生效的 env 快照。 */
84
84
  workspace_env?: Readonly<Record<string, string>>;
85
85
  /** 发起该任务的 Session step 已提交生效的 instruction 快照。 */
@@ -102,19 +102,19 @@ export async function runTaskNow(params: {
102
102
  runDirRel: string;
103
103
  }> {
104
104
  const context = params.context;
105
- const root = String(params.project_root || context.workspace_path || "").trim();
106
- if (!root) throw new Error("project_root is required");
105
+ const root = String(params.data_path || context.data_path || "").trim();
106
+ if (!root) throw new Error("data_path is required");
107
107
 
108
108
  const startedAt = Date.now();
109
109
  const timestamp = formatTaskRunTimestamp(new Date(startedAt));
110
110
  const executionId = String(params.executionId || `${params.taskId}:${timestamp}`).trim();
111
111
 
112
- const task = await readTask({ taskId: params.taskId, project_root: root });
112
+ const task = await readTask({ taskId: params.taskId, data_path: root });
113
113
  const runDirAbs = getTaskRunDir(root, task.taskId, timestamp);
114
114
  const { runDirRel } = await ensureRunDir({
115
115
  taskId: task.taskId,
116
116
  timestamp,
117
- project_root: root,
117
+ data_path: root,
118
118
  });
119
119
  const filePaths = createTaskRunFilePaths(runDirAbs);
120
120
 
@@ -170,7 +170,6 @@ export async function runTaskNow(params: {
170
170
  if (taskKind === "script") {
171
171
  const scriptResult = await runScriptTaskBranch({
172
172
  context,
173
- runDirAbs,
174
173
  session_id: task.frontmatter.session_id,
175
174
  scriptBody: task.body,
176
175
  runProgress,
@@ -2,9 +2,9 @@
2
2
  * Task storage (disk-backed).
3
3
  *
4
4
  * 关键点(中文)
5
- * - Task 的“唯一来源”是 `./.downcity/task/<taskId>/task.md`
5
+ * - Task 的“唯一来源”是 Agent 私有目录中的 `task/<taskId>/task.md`
6
6
  * - list/read/write 都只围绕 markdown 文件与目录结构,不引入数据库
7
- * - 运行产物目录:`./.downcity/task/<taskId>/<timestamp>/...`
7
+ * - 运行产物目录:Agent 私有目录中的 `task/<taskId>/<timestamp>/...`
8
8
  */
9
9
 
10
10
  import fs from "fs-extra";
@@ -52,11 +52,11 @@ function isDirectoryNameTimestamp(name: string): boolean {
52
52
  * 列出全部任务。
53
53
  *
54
54
  * 算法(中文)
55
- * - 遍历 `.downcity/task/*` 目录并解析每个 `task.md`。
55
+ * - 遍历 Agent 的 `task/*` 目录并解析每个 `task.md`。
56
56
  * - 通过子目录时间戳推断 `lastRunTimestamp`。
57
57
  */
58
- export async function listTasks(project_root: string): Promise<TaskListItem[]> {
59
- const root = String(project_root || "").trim();
58
+ export async function listTasks(data_path: string): Promise<TaskListItem[]> {
59
+ const root = String(data_path || "").trim();
60
60
  if (!root) return [];
61
61
 
62
62
  const dir = getTaskRootDir(root);
@@ -88,7 +88,7 @@ export async function listTasks(project_root: string): Promise<TaskListItem[]> {
88
88
  taskId,
89
89
  markdown: raw,
90
90
  taskMdPath,
91
- project_root: root,
91
+ data_path: root,
92
92
  });
93
93
  if (!parsed.ok) continue;
94
94
 
@@ -136,11 +136,11 @@ export async function listTasks(project_root: string): Promise<TaskListItem[]> {
136
136
  * - 若磁盘中存在同 title 多定义,会拒绝并提示冲突。
137
137
  */
138
138
  export async function resolveTaskIdByTitle(params: {
139
- project_root: string;
139
+ data_path: string;
140
140
  title: string;
141
141
  }): Promise<string> {
142
- const root = String(params.project_root || "").trim();
143
- if (!root) throw new Error("project_root is required");
142
+ const root = String(params.data_path || "").trim();
143
+ if (!root) throw new Error("data_path is required");
144
144
  const title = String(params.title || "").trim();
145
145
  if (!title) throw new Error("title is required");
146
146
 
@@ -156,9 +156,9 @@ export async function resolveTaskIdByTitle(params: {
156
156
  /**
157
157
  * 读取单个任务定义。
158
158
  */
159
- export async function readTask(params: { taskId: string; project_root: string }): Promise<ShipTaskDefinitionV1> {
160
- const root = String(params.project_root || "").trim();
161
- if (!root) throw new Error("project_root is required");
159
+ export async function readTask(params: { taskId: string; data_path: string }): Promise<ShipTaskDefinitionV1> {
160
+ const root = String(params.data_path || "").trim();
161
+ if (!root) throw new Error("data_path is required");
162
162
  const taskId = normalizeTaskId(params.taskId);
163
163
 
164
164
  const taskMdPath = getTaskMdPath(root, taskId);
@@ -167,7 +167,7 @@ export async function readTask(params: { taskId: string; project_root: string })
167
167
  taskId,
168
168
  markdown: raw,
169
169
  taskMdPath,
170
- project_root: root,
170
+ data_path: root,
171
171
  });
172
172
  if (!parsed.ok) throw new Error(parsed.error);
173
173
  return parsed.task;
@@ -178,10 +178,10 @@ export async function readTask(params: { taskId: string; project_root: string })
178
178
  */
179
179
  export async function deleteTask(params: {
180
180
  taskId: string;
181
- project_root: string;
181
+ data_path: string;
182
182
  }): Promise<{ taskId: string; taskDirPath: string }> {
183
- const root = String(params.project_root || "").trim();
184
- if (!root) throw new Error("project_root is required");
183
+ const root = String(params.data_path || "").trim();
184
+ if (!root) throw new Error("data_path is required");
185
185
  const taskId = normalizeTaskId(params.taskId);
186
186
 
187
187
  const taskMdPath = getTaskMdPath(root, taskId);
@@ -208,11 +208,11 @@ export async function writeTask(params: {
208
208
  taskId: string;
209
209
  frontmatter: ShipTaskFrontmatterV1;
210
210
  body: string;
211
- project_root: string;
211
+ data_path: string;
212
212
  overwrite?: boolean;
213
213
  }): Promise<{ taskId: string; taskMdPath: string }> {
214
- const root = String(params.project_root || "").trim();
215
- if (!root) throw new Error("project_root is required");
214
+ const root = String(params.data_path || "").trim();
215
+ if (!root) throw new Error("data_path is required");
216
216
  const taskId = normalizeTaskId(params.taskId);
217
217
 
218
218
  const dir = getTaskDir(root, taskId);
@@ -239,10 +239,10 @@ export async function writeTask(params: {
239
239
  export async function ensureRunDir(params: {
240
240
  taskId: string;
241
241
  timestamp: string;
242
- project_root: string;
242
+ data_path: string;
243
243
  }): Promise<{ runDir: string; runDirRel: string }> {
244
- const root = String(params.project_root || "").trim();
245
- if (!root) throw new Error("project_root is required");
244
+ const root = String(params.data_path || "").trim();
245
+ if (!root) throw new Error("data_path is required");
246
246
  const taskId = normalizeTaskId(params.taskId);
247
247
  const runDir = getTaskRunDir(root, taskId, params.timestamp);
248
248
  await fs.ensureDir(runDir);
@@ -114,7 +114,7 @@ export async function executeTaskListAction(params: {
114
114
  return {
115
115
  success: true,
116
116
  data: await listTaskDefinitions({
117
- project_root: params.context.workspace_path,
117
+ data_path: params.context.data_path,
118
118
  ...(params.payload.status ? { status: params.payload.status } : {}),
119
119
  }),
120
120
  };
@@ -130,7 +130,7 @@ export async function executeTaskCreateAction(params: {
130
130
  }) {
131
131
  const payload = params.payload;
132
132
  const result = await createTaskDefinition({
133
- project_root: params.context.workspace_path,
133
+ data_path: params.context.data_path,
134
134
  request: payload,
135
135
  });
136
136
  if (!result.success) {
@@ -163,7 +163,7 @@ export async function executeTaskRunAction(params: {
163
163
  }) {
164
164
  const result = await runTaskDefinition({
165
165
  context: params.context,
166
- project_root: params.context.workspace_path,
166
+ data_path: params.context.data_path,
167
167
  request: params.payload,
168
168
  execution_context: params.execution_context,
169
169
  });
@@ -189,7 +189,7 @@ export async function executeTaskDeleteAction(params: {
189
189
  }) {
190
190
  const payload = params.payload;
191
191
  const result = await deleteTaskDefinition({
192
- project_root: params.context.workspace_path,
192
+ data_path: params.context.data_path,
193
193
  request: payload,
194
194
  });
195
195
  if (!result.success) {
@@ -222,7 +222,7 @@ export async function executeTaskUpdateAction(params: {
222
222
  }) {
223
223
  const payload = params.payload;
224
224
  const result = await updateTaskDefinition({
225
- project_root: params.context.workspace_path,
225
+ data_path: params.context.data_path,
226
226
  request: payload,
227
227
  });
228
228
  if (!result.success) {
@@ -255,7 +255,7 @@ export async function executeTaskStatusAction(params: {
255
255
  }) {
256
256
  const payload = params.payload;
257
257
  const result = await setTaskStatus({
258
- project_root: params.context.workspace_path,
258
+ data_path: params.context.data_path,
259
259
  request: payload,
260
260
  });
261
261
  if (!result.success) {
@@ -222,7 +222,7 @@ export function createTaskPluginActions(params: {
222
222
  return executeTaskRunAction({
223
223
  context: actionParams.context,
224
224
  payload: actionParams.input as TaskRunRequest,
225
- execution_context: actionParams.execution_context,
225
+ execution_context: actionParams.execution.snapshot,
226
226
  });
227
227
  },
228
228
  }),