@downcity/plugins 1.0.254 → 1.0.280

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/bin/builtin/BuiltinPluginReadmes.d.ts +14 -0
  2. package/bin/builtin/BuiltinPluginReadmes.d.ts.map +1 -0
  3. package/bin/builtin/BuiltinPluginReadmes.js +58 -0
  4. package/bin/builtin/BuiltinPluginReadmes.js.map +1 -0
  5. package/bin/builtin/BuiltinPluginTypes.d.ts +48 -0
  6. package/bin/builtin/BuiltinPluginTypes.d.ts.map +1 -0
  7. package/bin/builtin/BuiltinPluginTypes.js +161 -0
  8. package/bin/builtin/BuiltinPluginTypes.js.map +1 -0
  9. package/bin/builtin/PluginSettingsDefinitions.d.ts +9 -0
  10. package/bin/builtin/PluginSettingsDefinitions.d.ts.map +1 -0
  11. package/bin/builtin/PluginSettingsDefinitions.js +41 -0
  12. package/bin/builtin/PluginSettingsDefinitions.js.map +1 -0
  13. package/bin/builtin/main/PluginSettingsMain.d.ts +6 -0
  14. package/bin/builtin/main/PluginSettingsMain.d.ts.map +1 -0
  15. package/bin/builtin/main/PluginSettingsMain.js +65 -0
  16. package/bin/builtin/main/PluginSettingsMain.js.map +1 -0
  17. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts +6 -0
  18. package/bin/builtin/renderer/PluginSettingsRenderer.d.ts.map +1 -0
  19. package/bin/builtin/renderer/PluginSettingsRenderer.js +76 -0
  20. package/bin/builtin/renderer/PluginSettingsRenderer.js.map +1 -0
  21. package/bin/builtin/types/PluginSettings.d.ts +35 -0
  22. package/bin/builtin/types/PluginSettings.d.ts.map +1 -0
  23. package/bin/builtin/types/PluginSettings.js +3 -0
  24. package/bin/builtin/types/PluginSettings.js.map +1 -0
  25. package/bin/chat/ChatPlugin.d.ts +12 -28
  26. package/bin/chat/ChatPlugin.d.ts.map +1 -1
  27. package/bin/chat/ChatPlugin.js +97 -49
  28. package/bin/chat/ChatPlugin.js.map +1 -1
  29. package/bin/chat/access/ChatAccessRuntime.js +1 -1
  30. package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
  31. package/bin/chat/access/ChatAccessSchema.d.ts +2 -2
  32. package/bin/chat/access/ChatAccessSchema.d.ts.map +1 -1
  33. package/bin/chat/access/ChatAccessSchema.js +3 -3
  34. package/bin/chat/access/ChatAccessSchema.js.map +1 -1
  35. package/bin/chat/access/ChatAccessService.d.ts +2 -2
  36. package/bin/chat/access/ChatAccessService.d.ts.map +1 -1
  37. package/bin/chat/access/ChatAccessService.js +4 -4
  38. package/bin/chat/access/ChatAccessService.js.map +1 -1
  39. package/bin/chat/access/ChatAccessStore.d.ts +3 -3
  40. package/bin/chat/access/ChatAccessStore.d.ts.map +1 -1
  41. package/bin/chat/access/ChatAccessStore.js +17 -8
  42. package/bin/chat/access/ChatAccessStore.js.map +1 -1
  43. package/bin/chat/channels/BaseChatChannel.d.ts +1 -0
  44. package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
  45. package/bin/chat/channels/BaseChatChannel.js +2 -0
  46. package/bin/chat/channels/BaseChatChannel.js.map +1 -1
  47. package/bin/chat/channels/RuntimeChannel.d.ts +4 -4
  48. package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
  49. package/bin/chat/channels/RuntimeChannel.js +8 -8
  50. package/bin/chat/channels/RuntimeChannel.js.map +1 -1
  51. package/bin/chat/channels/feishu/Feishu.js +1 -1
  52. package/bin/chat/channels/feishu/Feishu.js.map +1 -1
  53. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -0
  54. package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
  55. package/bin/chat/channels/feishu/FeishuPlatformClient.js +3 -0
  56. package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
  57. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +2 -0
  58. package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
  59. package/bin/chat/channels/feishu/FeishuPlatformLookup.js +1 -1
  60. package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
  61. package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
  62. package/bin/chat/channels/qq/QQ.js +3 -2
  63. package/bin/chat/channels/qq/QQ.js.map +1 -1
  64. package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
  65. package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
  66. package/bin/chat/channels/qq/QQEventCapture.js +3 -3
  67. package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
  68. package/bin/chat/channels/qq/QQInboundDedupe.d.ts +1 -1
  69. package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
  70. package/bin/chat/channels/qq/QQInboundDedupe.js +1 -1
  71. package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
  72. package/bin/chat/channels/qq/QQMessageHandler.d.ts +4 -0
  73. package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
  74. package/bin/chat/channels/qq/QQMessageHandler.js +2 -0
  75. package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
  76. package/bin/chat/channels/qq/QQSupport.d.ts +4 -0
  77. package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
  78. package/bin/chat/channels/qq/QQSupport.js +1 -0
  79. package/bin/chat/channels/qq/QQSupport.js.map +1 -1
  80. package/bin/chat/channels/qq/VoiceInput.d.ts +3 -0
  81. package/bin/chat/channels/qq/VoiceInput.d.ts.map +1 -1
  82. package/bin/chat/channels/qq/VoiceInput.js +1 -1
  83. package/bin/chat/channels/qq/VoiceInput.js.map +1 -1
  84. package/bin/chat/channels/telegram/ApiClient.d.ts +3 -1
  85. package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
  86. package/bin/chat/channels/telegram/ApiClient.js +4 -2
  87. package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
  88. package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
  89. package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
  90. package/bin/chat/channels/telegram/StateStore.js +2 -2
  91. package/bin/chat/channels/telegram/StateStore.js.map +1 -1
  92. package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  93. package/bin/chat/channels/telegram/TelegramPlatformClient.js +2 -1
  94. package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
  95. package/bin/chat/main/ChatPluginMain.d.ts +4 -0
  96. package/bin/chat/main/ChatPluginMain.d.ts.map +1 -0
  97. package/bin/chat/main/ChatPluginMain.js +137 -0
  98. package/bin/chat/main/ChatPluginMain.js.map +1 -0
  99. package/bin/chat/renderer/ChatPluginRenderer.d.ts +4 -0
  100. package/bin/chat/renderer/ChatPluginRenderer.d.ts.map +1 -0
  101. package/bin/chat/renderer/ChatPluginRenderer.js +105 -0
  102. package/bin/chat/renderer/ChatPluginRenderer.js.map +1 -0
  103. package/bin/chat/runtime/ChannelContextStore.d.ts +2 -2
  104. package/bin/chat/runtime/ChannelContextStore.js +20 -20
  105. package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
  106. package/bin/chat/runtime/ChatActionExecution.js +6 -6
  107. package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
  108. package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  109. package/bin/chat/runtime/ChatChannelConfig.js +7 -12
  110. package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
  111. package/bin/chat/runtime/ChatChannelCore.d.ts +3 -3
  112. package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  113. package/bin/chat/runtime/ChatChannelCore.js +5 -5
  114. package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
  115. package/bin/chat/runtime/ChatHistoryStore.d.ts +1 -1
  116. package/bin/chat/runtime/ChatHistoryStore.js +7 -7
  117. package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
  118. package/bin/chat/runtime/ChatMetaStore.d.ts +1 -1
  119. package/bin/chat/runtime/ChatMetaStore.js +1 -1
  120. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts +1 -1
  121. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
  122. package/bin/chat/runtime/ChatPluginActionRegistry.js +9 -9
  123. package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
  124. package/bin/chat/runtime/ChatQueue.d.ts +3 -38
  125. package/bin/chat/runtime/ChatQueue.d.ts.map +1 -1
  126. package/bin/chat/runtime/ChatQueue.js +3 -51
  127. package/bin/chat/runtime/ChatQueue.js.map +1 -1
  128. package/bin/chat/runtime/ChatQueueStore.d.ts +5 -16
  129. package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
  130. package/bin/chat/runtime/ChatQueueStore.js +8 -22
  131. package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
  132. package/bin/chat/runtime/ChatQueueWorker.d.ts +1 -1
  133. package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
  134. package/bin/chat/runtime/ChatQueueWorker.js +1 -2
  135. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  136. package/bin/chat/runtime/ChatSessionDelete.d.ts +3 -3
  137. package/bin/chat/runtime/ChatSessionDelete.js +4 -4
  138. package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
  139. package/bin/chat/runtime/ChatStorage.d.ts +7 -7
  140. package/bin/chat/runtime/ChatStorage.js +24 -24
  141. package/bin/chat/runtime/ChatStorage.js.map +1 -1
  142. package/bin/chat/types/ChatAccess.d.ts +2 -2
  143. package/bin/chat/types/ChatAccess.d.ts.map +1 -1
  144. package/bin/chat/types/ChatCommand.d.ts +1 -1
  145. package/bin/chat/types/ChatPluginChannelConfig.d.ts +57 -0
  146. package/bin/chat/types/ChatPluginChannelConfig.d.ts.map +1 -0
  147. package/bin/chat/types/ChatPluginChannelConfig.js +3 -0
  148. package/bin/chat/types/ChatPluginChannelConfig.js.map +1 -0
  149. package/bin/chat/types/ChatPluginConfig.d.ts +19 -0
  150. package/bin/chat/types/ChatPluginConfig.d.ts.map +1 -0
  151. package/bin/chat/types/ChatPluginConfig.js +3 -0
  152. package/bin/chat/types/ChatPluginConfig.js.map +1 -0
  153. package/bin/chat/types/ChatPluginOptions.d.ts +4 -4
  154. package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
  155. package/bin/chat/types/ChatPluginOptions.js +1 -1
  156. package/bin/chat/types/ChatPluginProfile.d.ts +39 -0
  157. package/bin/chat/types/ChatPluginProfile.d.ts.map +1 -0
  158. package/bin/chat/types/ChatPluginProfile.js +3 -0
  159. package/bin/chat/types/ChatPluginProfile.js.map +1 -0
  160. package/bin/chat/types/ChatPluginRenderer.d.ts +17 -0
  161. package/bin/chat/types/ChatPluginRenderer.d.ts.map +1 -0
  162. package/bin/chat/types/ChatPluginRenderer.js +3 -0
  163. package/bin/chat/types/ChatPluginRenderer.js.map +1 -0
  164. package/bin/chat/types/ChatRuntime.d.ts +11 -0
  165. package/bin/chat/types/ChatRuntime.d.ts.map +1 -1
  166. package/bin/chat/types/ChatRuntimeAccount.d.ts +3 -3
  167. package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -1
  168. package/bin/chat/types/ChatRuntimeAccount.js +2 -2
  169. package/bin/chat/types/ChatStorage.d.ts +2 -2
  170. package/bin/chat/types/ChatStorage.d.ts.map +1 -1
  171. package/bin/chat.d.ts +3 -4
  172. package/bin/chat.d.ts.map +1 -1
  173. package/bin/chat.js +1 -2
  174. package/bin/chat.js.map +1 -1
  175. package/bin/contact/Action.js +5 -5
  176. package/bin/contact/Action.js.map +1 -1
  177. package/bin/contact/ContactPlugin.js +15 -15
  178. package/bin/contact/ContactPlugin.js.map +1 -1
  179. package/bin/contact/runtime/ChatRuntime.js +3 -3
  180. package/bin/contact/runtime/ChatRuntime.js.map +1 -1
  181. package/bin/contact/runtime/ContactStore.d.ts +8 -8
  182. package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
  183. package/bin/contact/runtime/ContactStore.js +20 -20
  184. package/bin/contact/runtime/ContactStore.js.map +1 -1
  185. package/bin/contact/runtime/EndpointNotice.js +2 -2
  186. package/bin/contact/runtime/EndpointNotice.js.map +1 -1
  187. package/bin/contact/runtime/InboxStore.d.ts +6 -6
  188. package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
  189. package/bin/contact/runtime/InboxStore.js +16 -16
  190. package/bin/contact/runtime/InboxStore.js.map +1 -1
  191. package/bin/contact/runtime/LinkApproval.js +14 -14
  192. package/bin/contact/runtime/LinkApproval.js.map +1 -1
  193. package/bin/contact/runtime/LinkStore.d.ts +2 -2
  194. package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
  195. package/bin/contact/runtime/LinkStore.js +5 -5
  196. package/bin/contact/runtime/LinkStore.js.map +1 -1
  197. package/bin/contact/runtime/Paths.d.ts +15 -15
  198. package/bin/contact/runtime/Paths.d.ts.map +1 -1
  199. package/bin/contact/runtime/Paths.js +29 -29
  200. package/bin/contact/runtime/Paths.js.map +1 -1
  201. package/bin/contact/runtime/ShareBundle.d.ts +1 -1
  202. package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
  203. package/bin/contact/runtime/ShareBundle.js +4 -4
  204. package/bin/contact/runtime/ShareBundle.js.map +1 -1
  205. package/bin/contact/types/ContactApproval.d.ts +2 -2
  206. package/bin/contact/types/ContactApproval.d.ts.map +1 -1
  207. package/bin/image/ImagePlugin.d.ts +1 -4
  208. package/bin/image/ImagePlugin.d.ts.map +1 -1
  209. package/bin/image/ImagePlugin.js +26 -34
  210. package/bin/image/ImagePlugin.js.map +1 -1
  211. package/bin/image/runtime/ImageResultStorage.d.ts +2 -2
  212. package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -1
  213. package/bin/image/runtime/ImageResultStorage.js +15 -38
  214. package/bin/image/runtime/ImageResultStorage.js.map +1 -1
  215. package/bin/image/types/ImagePlugin.d.ts +23 -16
  216. package/bin/image/types/ImagePlugin.d.ts.map +1 -1
  217. package/bin/image/types/ImagePlugin.js +1 -1
  218. package/bin/image.d.ts +1 -1
  219. package/bin/image.d.ts.map +1 -1
  220. package/bin/index.d.ts +2 -0
  221. package/bin/index.d.ts.map +1 -1
  222. package/bin/index.js +1 -0
  223. package/bin/index.js.map +1 -1
  224. package/bin/memory/MemoryPlugin.d.ts +1 -1
  225. package/bin/memory/MemoryPlugin.d.ts.map +1 -1
  226. package/bin/memory/MemoryPlugin.js +17 -7
  227. package/bin/memory/MemoryPlugin.js.map +1 -1
  228. package/bin/memory/types/Memory.d.ts +10 -4
  229. package/bin/memory/types/Memory.d.ts.map +1 -1
  230. package/bin/memory.d.ts +1 -1
  231. package/bin/memory.d.ts.map +1 -1
  232. package/bin/renderers.d.ts +5 -0
  233. package/bin/renderers.d.ts.map +1 -0
  234. package/bin/renderers.js +12 -0
  235. package/bin/renderers.js.map +1 -0
  236. package/bin/sound/Plugin.d.ts +2 -5
  237. package/bin/sound/Plugin.d.ts.map +1 -1
  238. package/bin/sound/Plugin.js +27 -31
  239. package/bin/sound/Plugin.js.map +1 -1
  240. package/bin/sound/types/SoundPlugin.d.ts +22 -15
  241. package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
  242. package/bin/sound/types/SoundPlugin.js +2 -2
  243. package/bin/sound.d.ts +1 -1
  244. package/bin/sound.d.ts.map +1 -1
  245. package/bin/task/Action.d.ts +6 -6
  246. package/bin/task/Action.d.ts.map +1 -1
  247. package/bin/task/Action.js +21 -21
  248. package/bin/task/Action.js.map +1 -1
  249. package/bin/task/PROMPT.d.ts +1 -1
  250. package/bin/task/PROMPT.d.ts.map +1 -1
  251. package/bin/task/PROMPT.js +1 -1
  252. package/bin/task/PROMPT.js.map +1 -1
  253. package/bin/task/Scheduler.js +8 -8
  254. package/bin/task/Scheduler.js.map +1 -1
  255. package/bin/task/TaskPlugin.d.ts +7 -14
  256. package/bin/task/TaskPlugin.d.ts.map +1 -1
  257. package/bin/task/TaskPlugin.js +54 -43
  258. package/bin/task/TaskPlugin.js.map +1 -1
  259. package/bin/task/runtime/Model.d.ts +1 -5
  260. package/bin/task/runtime/Model.d.ts.map +1 -1
  261. package/bin/task/runtime/Model.js +2 -13
  262. package/bin/task/runtime/Model.js.map +1 -1
  263. package/bin/task/runtime/Paths.d.ts +7 -7
  264. package/bin/task/runtime/Paths.d.ts.map +1 -1
  265. package/bin/task/runtime/Paths.js +11 -11
  266. package/bin/task/runtime/Paths.js.map +1 -1
  267. package/bin/task/runtime/Runner.d.ts +1 -1
  268. package/bin/task/runtime/Runner.d.ts.map +1 -1
  269. package/bin/task/runtime/Runner.js +4 -5
  270. package/bin/task/runtime/Runner.js.map +1 -1
  271. package/bin/task/runtime/Store.d.ts +9 -9
  272. package/bin/task/runtime/Store.d.ts.map +1 -1
  273. package/bin/task/runtime/Store.js +17 -17
  274. package/bin/task/runtime/Store.js.map +1 -1
  275. package/bin/task/runtime/TaskActionExecution.js +6 -6
  276. package/bin/task/runtime/TaskActionExecution.js.map +1 -1
  277. package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
  278. package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
  279. package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
  280. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  281. package/bin/task/runtime/TaskRunnerRound.js +8 -3
  282. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  283. package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
  284. package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
  285. package/bin/task/runtime/TaskRunnerScript.js +0 -1
  286. package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
  287. package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
  288. package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  289. package/bin/task/runtime/TaskRunnerSession.js +2 -4
  290. package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
  291. package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
  292. package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
  293. package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
  294. package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
  295. package/bin/web/Plugin.d.ts +2 -6
  296. package/bin/web/Plugin.d.ts.map +1 -1
  297. package/bin/web/Plugin.js +21 -17
  298. package/bin/web/Plugin.js.map +1 -1
  299. package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
  300. package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
  301. package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
  302. package/bin/web/types/WebPlugin.d.ts +15 -9
  303. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  304. package/bin/web.d.ts +1 -1
  305. package/bin/web.d.ts.map +1 -1
  306. package/bin/workboard/runtime/Collector.js +1 -1
  307. package/bin/workboard/runtime/Collector.js.map +1 -1
  308. package/package.json +29 -20
  309. package/scripts/chat-access.test.mjs +3 -2
  310. package/scripts/chat-channel-config.test.mjs +3 -3
  311. package/scripts/chat-storage.test.mjs +10 -14
  312. package/scripts/memory-plugin.test.mjs +9 -32
  313. package/scripts/playwright-browser-provider.test.mjs +260 -0
  314. package/scripts/plugin-main.test.mjs +101 -0
  315. package/scripts/plugin-subpaths.test.mjs +28 -0
  316. package/scripts/sound-plugin.test.mjs +21 -9
  317. package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
  318. package/scripts/web-plugin.test.mjs +43 -186
  319. package/src/builtin/BuiltinPluginReadmes.ts +58 -0
  320. package/src/builtin/BuiltinPluginTypes.ts +260 -0
  321. package/src/builtin/PluginSettingsDefinitions.ts +45 -0
  322. package/src/builtin/main/PluginSettingsMain.ts +75 -0
  323. package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
  324. package/src/builtin/types/PluginSettings.ts +46 -0
  325. package/src/chat/ChatPlugin.ts +99 -51
  326. package/src/chat/access/ChatAccessRuntime.ts +1 -1
  327. package/src/chat/access/ChatAccessSchema.ts +5 -5
  328. package/src/chat/access/ChatAccessService.ts +4 -4
  329. package/src/chat/access/ChatAccessStore.ts +17 -9
  330. package/src/chat/channels/BaseChatChannel.ts +2 -0
  331. package/src/chat/channels/RuntimeChannel.ts +9 -9
  332. package/src/chat/channels/feishu/Feishu.ts +1 -1
  333. package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
  334. package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
  335. package/src/chat/channels/qq/QQ.ts +3 -2
  336. package/src/chat/channels/qq/QQEventCapture.ts +3 -3
  337. package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
  338. package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
  339. package/src/chat/channels/qq/QQSupport.ts +5 -0
  340. package/src/chat/channels/qq/VoiceInput.ts +5 -1
  341. package/src/chat/channels/telegram/ApiClient.ts +10 -3
  342. package/src/chat/channels/telegram/StateStore.ts +2 -2
  343. package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
  344. package/src/chat/main/ChatPluginMain.ts +163 -0
  345. package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
  346. package/src/chat/runtime/ChannelContextStore.ts +20 -20
  347. package/src/chat/runtime/ChatActionExecution.ts +6 -6
  348. package/src/chat/runtime/ChatChannelConfig.ts +7 -14
  349. package/src/chat/runtime/ChatChannelCore.ts +9 -9
  350. package/src/chat/runtime/ChatHistoryStore.ts +7 -7
  351. package/src/chat/runtime/ChatMetaStore.ts +1 -1
  352. package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
  353. package/src/chat/runtime/ChatQueue.ts +2 -69
  354. package/src/chat/runtime/ChatQueueStore.ts +10 -26
  355. package/src/chat/runtime/ChatQueueWorker.ts +2 -5
  356. package/src/chat/runtime/ChatSessionDelete.ts +4 -4
  357. package/src/chat/runtime/ChatStorage.ts +24 -24
  358. package/src/chat/types/ChatAccess.ts +2 -2
  359. package/src/chat/types/ChatCommand.ts +1 -1
  360. package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
  361. package/src/chat/types/ChatPluginConfig.ts +21 -0
  362. package/src/chat/types/ChatPluginOptions.ts +4 -4
  363. package/src/chat/types/ChatPluginProfile.ts +52 -0
  364. package/src/chat/types/ChatPluginRenderer.ts +25 -0
  365. package/src/chat/types/ChatRuntime.ts +14 -0
  366. package/src/chat/types/ChatRuntimeAccount.ts +3 -3
  367. package/src/chat/types/ChatStorage.ts +2 -2
  368. package/src/chat.ts +6 -14
  369. package/src/contact/Action.ts +5 -5
  370. package/src/contact/ContactPlugin.ts +15 -15
  371. package/src/contact/runtime/ChatRuntime.ts +3 -3
  372. package/src/contact/runtime/ContactStore.ts +20 -20
  373. package/src/contact/runtime/EndpointNotice.ts +2 -2
  374. package/src/contact/runtime/InboxStore.ts +16 -16
  375. package/src/contact/runtime/LinkApproval.ts +16 -16
  376. package/src/contact/runtime/LinkStore.ts +5 -5
  377. package/src/contact/runtime/Paths.ts +29 -29
  378. package/src/contact/runtime/ShareBundle.ts +5 -5
  379. package/src/contact/types/ContactApproval.ts +2 -2
  380. package/src/image/ImagePlugin.ts +30 -33
  381. package/src/image/runtime/ImageResultStorage.ts +36 -62
  382. package/src/image/types/ImagePlugin.ts +25 -19
  383. package/src/image.ts +2 -0
  384. package/src/index.ts +8 -0
  385. package/src/memory/MemoryPlugin.ts +17 -5
  386. package/src/memory/types/Memory.ts +11 -4
  387. package/src/memory.ts +1 -0
  388. package/src/renderers.ts +18 -0
  389. package/src/sound/Plugin.ts +34 -33
  390. package/src/sound/types/SoundPlugin.ts +24 -19
  391. package/src/sound.ts +2 -0
  392. package/src/task/Action.ts +27 -27
  393. package/src/task/PROMPT.ts +1 -1
  394. package/src/task/PROMPT.ts.txt +5 -6
  395. package/src/task/Scheduler.ts +8 -8
  396. package/src/task/TaskPlugin.ts +55 -46
  397. package/src/task/runtime/Model.ts +3 -13
  398. package/src/task/runtime/Paths.ts +11 -11
  399. package/src/task/runtime/Runner.ts +5 -6
  400. package/src/task/runtime/Store.ts +22 -22
  401. package/src/task/runtime/TaskActionExecution.ts +6 -6
  402. package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
  403. package/src/task/runtime/TaskRunnerRound.ts +13 -4
  404. package/src/task/runtime/TaskRunnerScript.ts +0 -5
  405. package/src/task/runtime/TaskRunnerSession.ts +10 -8
  406. package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
  407. package/src/web/Plugin.ts +23 -22
  408. package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
  409. package/src/web/types/WebPlugin.ts +16 -13
  410. package/src/web.ts +1 -0
  411. package/src/workboard/runtime/Collector.ts +1 -1
  412. package/tsconfig.json +4 -1
  413. package/LICENSE +0 -183
  414. package/bin/chat/Index.d.ts +0 -15
  415. package/bin/chat/Index.d.ts.map +0 -1
  416. package/bin/chat/Index.js +0 -11
  417. package/bin/chat/Index.js.map +0 -1
  418. package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
  419. package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
  420. package/bin/chat/config/ChatPluginConfig.js +0 -237
  421. package/bin/chat/config/ChatPluginConfig.js.map +0 -1
  422. package/bin/chat/types/ChatPluginResource.d.ts +0 -68
  423. package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
  424. package/bin/chat/types/ChatPluginResource.js +0 -10
  425. package/bin/chat/types/ChatPluginResource.js.map +0 -1
  426. package/bin/contact/Index.d.ts +0 -8
  427. package/bin/contact/Index.d.ts.map +0 -1
  428. package/bin/contact/Index.js +0 -8
  429. package/bin/contact/Index.js.map +0 -1
  430. package/bin/memory/Index.d.ts +0 -11
  431. package/bin/memory/Index.d.ts.map +0 -1
  432. package/bin/memory/Index.js +0 -11
  433. package/bin/memory/Index.js.map +0 -1
  434. package/bin/skill/Command.d.ts +0 -29
  435. package/bin/skill/Command.d.ts.map +0 -1
  436. package/bin/skill/Command.js +0 -35
  437. package/bin/skill/Command.js.map +0 -1
  438. package/bin/task/Index.d.ts +0 -9
  439. package/bin/task/Index.d.ts.map +0 -1
  440. package/bin/task/Index.js +0 -9
  441. package/bin/task/Index.js.map +0 -1
  442. package/src/chat/Index.ts +0 -36
  443. package/src/chat/config/ChatPluginConfig.ts +0 -266
  444. package/src/chat/types/ChatPluginResource.ts +0 -95
  445. package/src/contact/Index.ts +0 -8
  446. package/src/memory/Index.ts +0 -14
  447. package/src/skill/Command.ts +0 -58
  448. package/src/task/Index.ts +0 -8
@@ -147,7 +147,7 @@ export function normalizeContactEndpoint(endpoint: string): string {
147
147
  * 保存 contact。
148
148
  */
149
149
  export async function saveContact(
150
- project_root: string,
150
+ data_path: string,
151
151
  contact: AgentContact,
152
152
  ): Promise<AgentContact> {
153
153
  const normalized: AgentContact = {
@@ -171,11 +171,11 @@ export async function saveContact(
171
171
  if (normalized.reachability !== "outbound" && !normalized.inboundTokenHash) {
172
172
  throw new Error("contact inbound token hash is required for inbound contacts");
173
173
  }
174
- await fs.ensureDir(getContactDirectoryPath(project_root, normalized.id));
175
- await fs.writeJson(getContactJsonPath(project_root, normalized.id), normalized, {
174
+ await fs.ensureDir(getContactDirectoryPath(data_path, normalized.id));
175
+ await fs.writeJson(getContactJsonPath(data_path, normalized.id), normalized, {
176
176
  spaces: 2,
177
177
  });
178
- await fs.ensureFile(getContactMessagesPath(project_root, normalized.id));
178
+ await fs.ensureFile(getContactMessagesPath(data_path, normalized.id));
179
179
  return normalized;
180
180
  }
181
181
 
@@ -183,10 +183,10 @@ export async function saveContact(
183
183
  * 读取 contact。
184
184
  */
185
185
  export async function readContact(
186
- project_root: string,
186
+ data_path: string,
187
187
  contactId: string,
188
188
  ): Promise<AgentContact | null> {
189
- const filePath = getContactJsonPath(project_root, contactId);
189
+ const filePath = getContactJsonPath(data_path, contactId);
190
190
  if (!(await fs.pathExists(filePath))) return null;
191
191
  const raw = await fs.readJson(filePath).catch(() => null);
192
192
  // 关键点(中文):读取时归一化可恢复字段,避免一次局部写入让已收到的 contact 在列表中消失。
@@ -196,14 +196,14 @@ export async function readContact(
196
196
  /**
197
197
  * 列出全部 contact。
198
198
  */
199
- export async function listContacts(project_root: string): Promise<AgentContact[]> {
200
- const root = getContactsRootPath(project_root);
199
+ export async function listContacts(data_path: string): Promise<AgentContact[]> {
200
+ const root = getContactsRootPath(data_path);
201
201
  if (!(await fs.pathExists(root))) return [];
202
202
  const entries = await fs.readdir(root, { withFileTypes: true });
203
203
  const contacts: AgentContact[] = [];
204
204
  for (const entry of entries) {
205
205
  if (!entry.isDirectory()) continue;
206
- const contact = await readContact(project_root, entry.name);
206
+ const contact = await readContact(data_path, entry.name);
207
207
  if (contact) contacts.push(contact);
208
208
  }
209
209
  return contacts.sort((a, b) => a.name.localeCompare(b.name));
@@ -213,12 +213,12 @@ export async function listContacts(project_root: string): Promise<AgentContact[]
213
213
  * 按 id/name 查找 contact。
214
214
  */
215
215
  export async function findContact(
216
- project_root: string,
216
+ data_path: string,
217
217
  query: string,
218
218
  ): Promise<AgentContact | null> {
219
219
  const value = String(query || "").trim();
220
220
  if (!value) return null;
221
- const contacts = await listContacts(project_root);
221
+ const contacts = await listContacts(data_path);
222
222
  const lower = value.toLowerCase();
223
223
  return (
224
224
  contacts.find((item) => item.id.toLowerCase() === lower) ||
@@ -232,11 +232,11 @@ export async function findContact(
232
232
  * 根据入站 token 查找 contact。
233
233
  */
234
234
  export async function findContactByInboundToken(
235
- project_root: string,
235
+ data_path: string,
236
236
  token: string,
237
237
  ): Promise<AgentContact | null> {
238
238
  const token_hash = hashContactToken(token);
239
- const contacts = await listContacts(project_root);
239
+ const contacts = await listContacts(data_path);
240
240
  return contacts.find((item) => item.inboundTokenHash === token_hash) || null;
241
241
  }
242
242
 
@@ -244,13 +244,13 @@ export async function findContactByInboundToken(
244
244
  * 更新 contact 最近在线时间。
245
245
  */
246
246
  export async function touchContactSeen(
247
- project_root: string,
247
+ data_path: string,
248
248
  contactId: string,
249
249
  seenAt: number = Date.now(),
250
250
  ): Promise<AgentContact | null> {
251
- const contact = await readContact(project_root, contactId);
251
+ const contact = await readContact(data_path, contactId);
252
252
  if (!contact) return null;
253
- return await saveContact(project_root, {
253
+ return await saveContact(data_path, {
254
254
  ...contact,
255
255
  lastSeenAt: seenAt,
256
256
  });
@@ -260,11 +260,11 @@ export async function touchContactSeen(
260
260
  * 追加 contact chat 消息。
261
261
  */
262
262
  export async function appendContactMessage(
263
- project_root: string,
263
+ data_path: string,
264
264
  contactId: string,
265
265
  message: ContactChatMessage,
266
266
  ): Promise<void> {
267
- const filePath = getContactMessagesPath(project_root, contactId);
267
+ const filePath = getContactMessagesPath(data_path, contactId);
268
268
  await fs.ensureDir(path.dirname(filePath));
269
269
  await fs.appendFile(filePath, `${JSON.stringify(message)}\n`, "utf-8");
270
270
  }
@@ -273,10 +273,10 @@ export async function appendContactMessage(
273
273
  * 读取 contact chat 历史。
274
274
  */
275
275
  export async function readContactMessages(
276
- project_root: string,
276
+ data_path: string,
277
277
  contactId: string,
278
278
  ): Promise<ContactChatMessage[]> {
279
- const filePath = getContactMessagesPath(project_root, contactId);
279
+ const filePath = getContactMessagesPath(data_path, contactId);
280
280
  if (!(await fs.pathExists(filePath))) return [];
281
281
  const text = await fs.readFile(filePath, "utf-8");
282
282
  const out: ContactChatMessage[] = [];
@@ -60,7 +60,7 @@ export function buildContactLinkNotes(params: {
60
60
  if (reachability === "loopback") {
61
61
  return [
62
62
  "This link endpoint is local-only. Only an agent on the same machine can approve it; a server agent cannot approve a link generated by this local agent.",
63
- "Start city from a reachable environment before generating a new link; downcity start automatically writes the public host used by contact links when it can detect one.",
63
+ "Start City from a reachable environment before generating a new link; `city on` writes the public host used by contact links when it can detect one.",
64
64
  ];
65
65
  }
66
66
  if (reachability === "private") {
@@ -118,7 +118,7 @@ export function buildContactApproveNotes(params: {
118
118
  );
119
119
  } else {
120
120
  notes.push(
121
- "This contact is outbound-only from this side: this agent can call the peer, but the peer cannot call back unless this agent was started with a reachable address that downcity start can provide to contact.",
121
+ "This contact is outbound-only from this side: this agent can call the peer, but the peer cannot call back unless City is running with a reachable address.",
122
122
  );
123
123
  }
124
124
  return notes;
@@ -52,11 +52,11 @@ function isMeta(input: unknown): input is ContactInboxShareMeta {
52
52
  * 保存 inbox share。
53
53
  */
54
54
  export async function saveContactInboxShare(
55
- project_root: string,
55
+ data_path: string,
56
56
  input: SaveContactInboxShareInput,
57
57
  ): Promise<ContactInboxShareMeta> {
58
- const inboxRoot = getContactInboxRootPath(project_root);
59
- const sharePath = getContactInboxSharePath(project_root, input.meta.id);
58
+ const inboxRoot = getContactInboxRootPath(data_path);
59
+ const sharePath = getContactInboxSharePath(data_path, input.meta.id);
60
60
  const tempRoot = path.join(path.dirname(inboxRoot), ".inbox-tmp");
61
61
  const tempPath = path.join(
62
62
  tempRoot,
@@ -103,10 +103,10 @@ export async function saveContactInboxShare(
103
103
  * 读取 inbox share meta。
104
104
  */
105
105
  export async function readContactInboxShareMeta(
106
- project_root: string,
106
+ data_path: string,
107
107
  shareId: string,
108
108
  ): Promise<ContactInboxShareMeta | null> {
109
- const filePath = getContactInboxShareMetaPath(project_root, shareId);
109
+ const filePath = getContactInboxShareMetaPath(data_path, shareId);
110
110
  if (!(await fs.pathExists(filePath))) return null;
111
111
  const raw = await fs.readJson(filePath).catch(() => null);
112
112
  return isMeta(raw) ? raw : null;
@@ -116,10 +116,10 @@ export async function readContactInboxShareMeta(
116
116
  * 读取 inbox share payload。
117
117
  */
118
118
  export async function readContactInboxSharePayload(
119
- project_root: string,
119
+ data_path: string,
120
120
  shareId: string,
121
121
  ): Promise<ContactInboxSharePayload | null> {
122
- const filePath = getContactInboxSharePayloadPath(project_root, shareId);
122
+ const filePath = getContactInboxSharePayloadPath(data_path, shareId);
123
123
  if (!(await fs.pathExists(filePath))) return null;
124
124
  const raw = await fs.readJson(filePath).catch(() => null);
125
125
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
@@ -131,15 +131,15 @@ export async function readContactInboxSharePayload(
131
131
  * 列出 inbox share。
132
132
  */
133
133
  export async function listContactInboxShares(
134
- project_root: string,
134
+ data_path: string,
135
135
  ): Promise<ContactInboxShareMeta[]> {
136
- const root = getContactInboxRootPath(project_root);
136
+ const root = getContactInboxRootPath(data_path);
137
137
  if (!(await fs.pathExists(root))) return [];
138
138
  const entries = await fs.readdir(root, { withFileTypes: true });
139
139
  const shares: ContactInboxShareMeta[] = [];
140
140
  for (const entry of entries) {
141
141
  if (!entry.isDirectory()) continue;
142
- const meta = await readContactInboxShareMeta(project_root, entry.name);
142
+ const meta = await readContactInboxShareMeta(data_path, entry.name);
143
143
  if (meta) shares.push(meta);
144
144
  }
145
145
  return shares.sort((a, b) => b.receivedAt - a.receivedAt);
@@ -149,22 +149,22 @@ export async function listContactInboxShares(
149
149
  * 标记 share 已接收,并复制轻量状态到 received。
150
150
  */
151
151
  export async function markContactInboxShareReceived(
152
- project_root: string,
152
+ data_path: string,
153
153
  shareId: string,
154
154
  ): Promise<ContactInboxShareMeta> {
155
- const meta = await readContactInboxShareMeta(project_root, shareId);
155
+ const meta = await readContactInboxShareMeta(data_path, shareId);
156
156
  if (!meta) throw new Error(`Share not found: ${shareId}`);
157
157
  const next: ContactInboxShareMeta = {
158
158
  ...meta,
159
159
  status: "received",
160
160
  };
161
- const receivedPath = getContactReceivedSharePath(project_root, shareId);
161
+ const receivedPath = getContactReceivedSharePath(data_path, shareId);
162
162
  await fs.ensureDir(receivedPath);
163
163
  await fs.writeJson(path.join(receivedPath, "meta.json"), next, {
164
164
  spaces: 2,
165
165
  });
166
166
  // received 区先完整写入,最后再更新 inbox meta,避免列表状态提前变成 received。
167
- await fs.writeJson(getContactInboxShareMetaPath(project_root, shareId), next, {
167
+ await fs.writeJson(getContactInboxShareMetaPath(data_path, shareId), next, {
168
168
  spaces: 2,
169
169
  });
170
170
  return next;
@@ -173,6 +173,6 @@ export async function markContactInboxShareReceived(
173
173
  /**
174
174
  * 读取 share 文件根目录。
175
175
  */
176
- export function getInboxShareFilesRoot(project_root: string, shareId: string): string {
177
- return getContactInboxShareFilesPath(project_root, shareId);
176
+ export function getInboxShareFilesRoot(data_path: string, shareId: string): string {
177
+ return getContactInboxShareFilesPath(data_path, shareId);
178
178
  }
@@ -99,31 +99,31 @@ function readCallbackCandidate(
99
99
  }
100
100
 
101
101
  async function findApprovedContact(params: {
102
- project_root: string;
102
+ data_path: string;
103
103
  agentName: string;
104
104
  }) {
105
105
  const stable = await readContact(
106
- params.project_root,
106
+ params.data_path,
107
107
  createStableContactId(params.agentName),
108
108
  );
109
109
  if (stable) return stable;
110
- const contacts = await listContacts(params.project_root);
110
+ const contacts = await listContacts(params.data_path);
111
111
  const lower = params.agentName.trim().toLowerCase();
112
112
  return contacts.find((item) => item.name.toLowerCase() === lower) || null;
113
113
  }
114
114
 
115
115
  async function saveApprovedInboundContact(params: {
116
- project_root: string;
116
+ data_path: string;
117
117
  agentName: string;
118
118
  tokenForOwner: string;
119
119
  nowMs: number;
120
120
  }) {
121
121
  const existing = await findApprovedContact({
122
- project_root: params.project_root,
122
+ data_path: params.data_path,
123
123
  agentName: params.agentName,
124
124
  });
125
125
  const hasOutboundSide = Boolean(existing?.endpoint && existing?.outboundToken);
126
- await saveContact(params.project_root, {
126
+ await saveContact(params.data_path, {
127
127
  id: existing?.id || createStableContactId(params.agentName),
128
128
  name: existing?.name || params.agentName,
129
129
  endpoint: existing?.endpoint || null,
@@ -143,7 +143,7 @@ export async function approveContactLinkRequest(
143
143
  input: ApproveContactLinkRequestInput,
144
144
  ): Promise<ContactApproveLinkResponse> {
145
145
  const nowMs = input.nowMs ?? Date.now();
146
- const link = await readContactLinkRecord(input.project_root, input.request.linkId);
146
+ const link = await readContactLinkRecord(input.data_path, input.request.linkId);
147
147
  if (!link) {
148
148
  return failure({
149
149
  ownerAgentName: input.ownerAgentName,
@@ -185,10 +185,10 @@ export async function approveContactLinkRequest(
185
185
  tokenForRequester: callbackCandidate.token,
186
186
  callbackReason: input.request.callbackReason || link.callbackReason || null,
187
187
  };
188
- await saveContactLinkRecord(input.project_root, nextLink);
188
+ await saveContactLinkRecord(input.data_path, nextLink);
189
189
  }
190
190
  await saveApprovedInboundContact({
191
- project_root: input.project_root,
191
+ data_path: input.data_path,
192
192
  agentName: input.request.agentName,
193
193
  tokenForOwner: link.tokenForOwner,
194
194
  nowMs,
@@ -219,9 +219,9 @@ export async function approveContactLinkRequest(
219
219
  };
220
220
 
221
221
  // 先消费 link,再派生 contact;重试时以 link 记录为来源修复 contact,避免孤儿 trusted contact。
222
- await saveContactLinkRecord(input.project_root, approvedLink);
222
+ await saveContactLinkRecord(input.data_path, approvedLink);
223
223
  await saveApprovedInboundContact({
224
- project_root: input.project_root,
224
+ data_path: input.data_path,
225
225
  agentName: input.request.agentName,
226
226
  tokenForOwner,
227
227
  nowMs,
@@ -242,7 +242,7 @@ export async function confirmContactLinkRequest(
242
242
  input: ConfirmContactLinkRequestInput,
243
243
  ): Promise<ContactConfirmResponse> {
244
244
  const nowMs = input.nowMs ?? Date.now();
245
- const link = await readContactLinkRecord(input.project_root, input.request.linkId);
245
+ const link = await readContactLinkRecord(input.data_path, input.request.linkId);
246
246
  if (!link) {
247
247
  return confirmFailure({
248
248
  ownerAgentName: input.ownerAgentName,
@@ -309,7 +309,7 @@ export async function confirmContactLinkRequest(
309
309
  });
310
310
  }
311
311
  const contact = await findApprovedContact({
312
- project_root: input.project_root,
312
+ data_path: input.data_path,
313
313
  agentName: input.request.agentName,
314
314
  });
315
315
  if (!contact || contact.status !== "trusted") {
@@ -332,7 +332,7 @@ export async function confirmContactLinkRequest(
332
332
  ) {
333
333
  if (!link.confirmedAt) {
334
334
  // contact 已经完成双向升级时,重试 confirm 需要补齐 link 状态,避免最终状态分裂。
335
- await saveContactLinkRecord(input.project_root, {
335
+ await saveContactLinkRecord(input.data_path, {
336
336
  ...link,
337
337
  approvedEndpoint: endpoint,
338
338
  tokenForRequester: token,
@@ -363,7 +363,7 @@ export async function confirmContactLinkRequest(
363
363
  };
364
364
  }
365
365
 
366
- await saveContact(input.project_root, {
366
+ await saveContact(input.data_path, {
367
367
  ...contact,
368
368
  endpoint,
369
369
  reachability: "bidirectional",
@@ -371,7 +371,7 @@ export async function confirmContactLinkRequest(
371
371
  inboundTokenHash: contact.inboundTokenHash,
372
372
  lastSeenAt: nowMs,
373
373
  });
374
- await saveContactLinkRecord(input.project_root, {
374
+ await saveContactLinkRecord(input.data_path, {
375
375
  ...link,
376
376
  approvedEndpoint: endpoint,
377
377
  tokenForRequester: token,
@@ -27,11 +27,11 @@ function isLinkRecord(input: unknown): input is ContactLinkRecord {
27
27
  * 保存 link 记录。
28
28
  */
29
29
  export async function saveContactLinkRecord(
30
- project_root: string,
30
+ data_path: string,
31
31
  record: ContactLinkRecord,
32
32
  ): Promise<void> {
33
- await fs.ensureDir(getContactLinksRootPath(project_root));
34
- await fs.writeJson(getContactLinkPath(project_root, record.id), record, {
33
+ await fs.ensureDir(getContactLinksRootPath(data_path));
34
+ await fs.writeJson(getContactLinkPath(data_path, record.id), record, {
35
35
  spaces: 2,
36
36
  });
37
37
  }
@@ -40,10 +40,10 @@ export async function saveContactLinkRecord(
40
40
  * 读取 link 记录。
41
41
  */
42
42
  export async function readContactLinkRecord(
43
- project_root: string,
43
+ data_path: string,
44
44
  linkId: string,
45
45
  ): Promise<ContactLinkRecord | null> {
46
- const filePath = getContactLinkPath(project_root, linkId);
46
+ const filePath = getContactLinkPath(data_path, linkId);
47
47
  if (!(await fs.pathExists(filePath))) return null;
48
48
  const raw = await fs.readJson(filePath).catch(() => null);
49
49
  return isLinkRecord(raw) ? raw : null;
@@ -2,7 +2,7 @@
2
2
  * contact plugin runtime 路径规则。
3
3
  *
4
4
  * 关键点(中文)
5
- * - 所有 contact 运行时状态都收敛在 `.downcity/contact`。
5
+ * - 所有 contact 运行时状态都收敛在 Agent private runtime directory 私有 `contact` 目录。
6
6
  * - 每个 contact 一个目录;每条 inbox share 一个目录。
7
7
  */
8
8
 
@@ -22,118 +22,118 @@ function cleanSegment(input: string, label: string): string {
22
22
  /**
23
23
  * contact 根目录。
24
24
  */
25
- export function getContactRootPath(project_root: string): string {
26
- return path.join(project_root, ".downcity", "contact");
25
+ export function getContactRootPath(data_path: string): string {
26
+ return path.join(data_path, "contact");
27
27
  }
28
28
 
29
29
  /**
30
30
  * contacts 根目录。
31
31
  */
32
- export function getContactsRootPath(project_root: string): string {
33
- return path.join(getContactRootPath(project_root), "contacts");
32
+ export function getContactsRootPath(data_path: string): string {
33
+ return path.join(getContactRootPath(data_path), "contacts");
34
34
  }
35
35
 
36
36
  /**
37
37
  * 单个 contact 目录。
38
38
  */
39
39
  export function getContactDirectoryPath(
40
- project_root: string,
40
+ data_path: string,
41
41
  contactId: string,
42
42
  ): string {
43
- return path.join(getContactsRootPath(project_root), cleanSegment(contactId, "contactId"));
43
+ return path.join(getContactsRootPath(data_path), cleanSegment(contactId, "contactId"));
44
44
  }
45
45
 
46
46
  /**
47
47
  * 单个 contact 元信息文件。
48
48
  */
49
- export function getContactJsonPath(project_root: string, contactId: string): string {
50
- return path.join(getContactDirectoryPath(project_root, contactId), "contact.json");
49
+ export function getContactJsonPath(data_path: string, contactId: string): string {
50
+ return path.join(getContactDirectoryPath(data_path, contactId), "contact.json");
51
51
  }
52
52
 
53
53
  /**
54
54
  * 单个 contact 的长期对话历史文件。
55
55
  */
56
56
  export function getContactMessagesPath(
57
- project_root: string,
57
+ data_path: string,
58
58
  contactId: string,
59
59
  ): string {
60
- return path.join(getContactDirectoryPath(project_root, contactId), "messages.jsonl");
60
+ return path.join(getContactDirectoryPath(data_path, contactId), "messages.jsonl");
61
61
  }
62
62
 
63
63
  /**
64
64
  * link 根目录。
65
65
  */
66
- export function getContactLinksRootPath(project_root: string): string {
67
- return path.join(getContactRootPath(project_root), "links");
66
+ export function getContactLinksRootPath(data_path: string): string {
67
+ return path.join(getContactRootPath(data_path), "links");
68
68
  }
69
69
 
70
70
  /**
71
71
  * 单个 link 记录文件。
72
72
  */
73
- export function getContactLinkPath(project_root: string, linkId: string): string {
74
- return path.join(getContactLinksRootPath(project_root), `${cleanSegment(linkId, "linkId")}.json`);
73
+ export function getContactLinkPath(data_path: string, linkId: string): string {
74
+ return path.join(getContactLinksRootPath(data_path), `${cleanSegment(linkId, "linkId")}.json`);
75
75
  }
76
76
 
77
77
  /**
78
78
  * inbox 根目录。
79
79
  */
80
- export function getContactInboxRootPath(project_root: string): string {
81
- return path.join(getContactRootPath(project_root), "inbox");
80
+ export function getContactInboxRootPath(data_path: string): string {
81
+ return path.join(getContactRootPath(data_path), "inbox");
82
82
  }
83
83
 
84
84
  /**
85
85
  * 单个 inbox share 目录。
86
86
  */
87
87
  export function getContactInboxSharePath(
88
- project_root: string,
88
+ data_path: string,
89
89
  shareId: string,
90
90
  ): string {
91
- return path.join(getContactInboxRootPath(project_root), cleanSegment(shareId, "shareId"));
91
+ return path.join(getContactInboxRootPath(data_path), cleanSegment(shareId, "shareId"));
92
92
  }
93
93
 
94
94
  /**
95
95
  * 单个 inbox share 元信息文件。
96
96
  */
97
97
  export function getContactInboxShareMetaPath(
98
- project_root: string,
98
+ data_path: string,
99
99
  shareId: string,
100
100
  ): string {
101
- return path.join(getContactInboxSharePath(project_root, shareId), "meta.json");
101
+ return path.join(getContactInboxSharePath(data_path, shareId), "meta.json");
102
102
  }
103
103
 
104
104
  /**
105
105
  * 单个 inbox share payload 文件。
106
106
  */
107
107
  export function getContactInboxSharePayloadPath(
108
- project_root: string,
108
+ data_path: string,
109
109
  shareId: string,
110
110
  ): string {
111
- return path.join(getContactInboxSharePath(project_root, shareId), "payload.json");
111
+ return path.join(getContactInboxSharePath(data_path, shareId), "payload.json");
112
112
  }
113
113
 
114
114
  /**
115
115
  * 单个 inbox share 文件根目录。
116
116
  */
117
117
  export function getContactInboxShareFilesPath(
118
- project_root: string,
118
+ data_path: string,
119
119
  shareId: string,
120
120
  ): string {
121
- return path.join(getContactInboxSharePath(project_root, shareId), "files");
121
+ return path.join(getContactInboxSharePath(data_path, shareId), "files");
122
122
  }
123
123
 
124
124
  /**
125
125
  * received 根目录。
126
126
  */
127
- export function getContactReceivedRootPath(project_root: string): string {
128
- return path.join(getContactRootPath(project_root), "received");
127
+ export function getContactReceivedRootPath(data_path: string): string {
128
+ return path.join(getContactRootPath(data_path), "received");
129
129
  }
130
130
 
131
131
  /**
132
132
  * 单个 received share 目录。
133
133
  */
134
134
  export function getContactReceivedSharePath(
135
- project_root: string,
135
+ data_path: string,
136
136
  shareId: string,
137
137
  ): string {
138
- return path.join(getContactReceivedRootPath(project_root), cleanSegment(shareId, "shareId"));
138
+ return path.join(getContactReceivedRootPath(data_path), cleanSegment(shareId, "shareId"));
139
139
  }
@@ -235,7 +235,7 @@ export async function receiveShare(params: {
235
235
  /**
236
236
  * 项目根目录。
237
237
  */
238
- project_root: string;
238
+ data_path: string;
239
239
  /**
240
240
  * share id。
241
241
  */
@@ -250,22 +250,22 @@ export async function receiveShare(params: {
250
250
  */
251
251
  receivedPath: string;
252
252
  }> {
253
- const payload = await readContactInboxSharePayload(params.project_root, params.shareId);
253
+ const payload = await readContactInboxSharePayload(params.data_path, params.shareId);
254
254
  if (!payload) throw new Error(`Share payload not found: ${params.shareId}`);
255
255
  if (payload.kind !== "share") throw new Error(`Unsupported share payload: ${payload.kind}`);
256
256
 
257
- const receivedPath = getContactReceivedSharePath(params.project_root, params.shareId);
257
+ const receivedPath = getContactReceivedSharePath(params.data_path, params.shareId);
258
258
  await fs.ensureDir(receivedPath);
259
259
  await fs.writeJson(path.join(receivedPath, "payload.json"), payload, { spaces: 2 });
260
260
 
261
- const filesRoot = getInboxShareFilesRoot(params.project_root, params.shareId);
261
+ const filesRoot = getInboxShareFilesRoot(params.data_path, params.shareId);
262
262
  if (await fs.pathExists(filesRoot)) {
263
263
  await fs.copy(filesRoot, path.join(receivedPath, "files"), {
264
264
  overwrite: true,
265
265
  });
266
266
  }
267
267
 
268
- await markContactInboxShareReceived(params.project_root, params.shareId);
268
+ await markContactInboxShareReceived(params.data_path, params.shareId);
269
269
  return {
270
270
  itemCount: payload.items.length,
271
271
  receivedPath,
@@ -43,7 +43,7 @@ export interface ApproveContactLinkRequestInput {
43
43
  /**
44
44
  * 当前 agent 项目根目录,用于读取 link 记录并保存 contact。
45
45
  */
46
- project_root: string;
46
+ data_path: string;
47
47
  /**
48
48
  * 当前 agent 名称,也就是 link 所属方名称。
49
49
  */
@@ -121,7 +121,7 @@ export interface ConfirmContactLinkRequestInput {
121
121
  /**
122
122
  * 当前 agent 项目根目录,用于读取 link 记录并更新 contact。
123
123
  */
124
- project_root: string;
124
+ data_path: string;
125
125
  /**
126
126
  * 当前 agent 名称,也就是 link 所属方名称。
127
127
  */