@downcity/city 1.1.39 → 1.1.47

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 (353) hide show
  1. package/README.md +4 -9
  2. package/bin/cli/Index.js +2 -0
  3. package/bin/cli/Index.js.map +1 -1
  4. package/bin/cli/agent/AgentChat.d.ts +2 -1
  5. package/bin/cli/agent/AgentChat.d.ts.map +1 -1
  6. package/bin/cli/agent/AgentChat.js +93 -214
  7. package/bin/cli/agent/AgentChat.js.map +1 -1
  8. package/bin/cli/agent/AgentChatTypes.d.ts +8 -12
  9. package/bin/cli/agent/AgentChatTypes.d.ts.map +1 -1
  10. package/bin/cli/agent/AgentHistory.js +2 -2
  11. package/bin/cli/agent/AgentHistory.js.map +1 -1
  12. package/bin/cli/agent/AgentManager.d.ts.map +1 -1
  13. package/bin/cli/agent/AgentManager.js +26 -27
  14. package/bin/cli/agent/AgentManager.js.map +1 -1
  15. package/bin/cli/agent/AgentManagerTypes.d.ts +2 -2
  16. package/bin/cli/agent/AgentManagerTypes.d.ts.map +1 -1
  17. package/bin/cli/agent/AgentReset.js +4 -4
  18. package/bin/cli/agent/AgentReset.js.map +1 -1
  19. package/bin/cli/agent/AgentSelection.js +6 -6
  20. package/bin/cli/agent/AgentSelection.js.map +1 -1
  21. package/bin/cli/agent/AgentSelectionTypes.d.ts +1 -1
  22. package/bin/cli/agent/AgentSelectionTypes.d.ts.map +1 -1
  23. package/bin/cli/agent/Init.js +10 -10
  24. package/bin/cli/agent/Init.js.map +1 -1
  25. package/bin/cli/agent/Restart.js +2 -2
  26. package/bin/cli/agent/Restart.js.map +1 -1
  27. package/bin/cli/agent/Run.d.ts +1 -1
  28. package/bin/cli/agent/Run.d.ts.map +1 -1
  29. package/bin/cli/agent/Run.js +37 -17
  30. package/bin/cli/agent/Run.js.map +1 -1
  31. package/bin/cli/agent/Start.js +2 -2
  32. package/bin/cli/agent/Start.js.map +1 -1
  33. package/bin/cli/agent/Stop.js +2 -2
  34. package/bin/cli/agent/Stop.js.map +1 -1
  35. package/bin/cli/control-plane/ControlPlaneProcess.js +5 -5
  36. package/bin/cli/control-plane/ControlPlaneProcess.js.map +1 -1
  37. package/bin/cli/model/ModelCreateCommand.js +1 -1
  38. package/bin/cli/model/ModelCreateCommand.js.map +1 -1
  39. package/bin/cli/model/ModelManageCommand.d.ts.map +1 -1
  40. package/bin/cli/model/ModelManageCommand.js +5 -3
  41. package/bin/cli/model/ModelManageCommand.js.map +1 -1
  42. package/bin/cli/model/ModelManager.js +3 -3
  43. package/bin/cli/model/ModelManager.js.map +1 -1
  44. package/bin/cli/model/ModelSupport.d.ts +0 -1
  45. package/bin/cli/model/ModelSupport.d.ts.map +1 -1
  46. package/bin/cli/model/ModelSupport.js +2 -11
  47. package/bin/cli/model/ModelSupport.js.map +1 -1
  48. package/bin/cli/shared/CliReporterTypes.d.ts +1 -1
  49. package/bin/cli/shared/Config.js +2 -2
  50. package/bin/cli/shared/Config.js.map +1 -1
  51. package/bin/cli/shared/Env.d.ts +1 -1
  52. package/bin/cli/shared/Env.d.ts.map +1 -1
  53. package/bin/cli/shared/Env.js +18 -149
  54. package/bin/cli/shared/Env.js.map +1 -1
  55. package/bin/cli/shared/IndexAgentCommand.d.ts.map +1 -1
  56. package/bin/cli/shared/IndexAgentCommand.js +3 -3
  57. package/bin/cli/shared/IndexAgentCommand.js.map +1 -1
  58. package/bin/cli/shared/IndexSupport.d.ts +3 -3
  59. package/bin/cli/shared/IndexSupport.d.ts.map +1 -1
  60. package/bin/cli/shared/IndexSupport.js +14 -8
  61. package/bin/cli/shared/IndexSupport.js.map +1 -1
  62. package/bin/cli/shared/ManagedPluginActionCommands.d.ts.map +1 -1
  63. package/bin/cli/shared/ManagedPluginActionCommands.js +5 -4
  64. package/bin/cli/shared/ManagedPluginActionCommands.js.map +1 -1
  65. package/bin/cli/shared/ManagedPluginRemote.d.ts.map +1 -1
  66. package/bin/cli/shared/ManagedPluginRemote.js +4 -4
  67. package/bin/cli/shared/ManagedPluginRemote.js.map +1 -1
  68. package/bin/cli/shared/PluginTargetSupport.d.ts +2 -2
  69. package/bin/cli/shared/PluginTargetSupport.d.ts.map +1 -1
  70. package/bin/cli/shared/PluginTargetSupport.js +19 -19
  71. package/bin/cli/shared/PluginTargetSupport.js.map +1 -1
  72. package/bin/cli/shared/Plugins.js +10 -10
  73. package/bin/cli/shared/Plugins.js.map +1 -1
  74. package/bin/cli/shared/PublicHostEnv.d.ts +1 -1
  75. package/bin/cli/shared/PublicHostEnv.js +2 -2
  76. package/bin/cli/shared/PublicHostEnv.js.map +1 -1
  77. package/bin/cli/shared/Terminal.d.ts +13 -0
  78. package/bin/cli/shared/Terminal.d.ts.map +1 -0
  79. package/bin/cli/shared/Terminal.js +22 -0
  80. package/bin/cli/shared/Terminal.js.map +1 -0
  81. package/bin/config/DowncitySchema.d.ts.map +1 -1
  82. package/bin/config/DowncitySchema.js +3 -111
  83. package/bin/config/DowncitySchema.js.map +1 -1
  84. package/bin/config/Paths.d.ts +0 -56
  85. package/bin/config/Paths.d.ts.map +1 -1
  86. package/bin/config/Paths.js +9 -51
  87. package/bin/config/Paths.js.map +1 -1
  88. package/bin/control/ControlGateway.js +1 -1
  89. package/bin/control/ControlGateway.js.map +1 -1
  90. package/bin/control/EnvApiRoutes.d.ts +1 -1
  91. package/bin/control/EnvApiRoutes.d.ts.map +1 -1
  92. package/bin/control/EnvApiRoutes.js +7 -79
  93. package/bin/control/EnvApiRoutes.js.map +1 -1
  94. package/bin/control/PlatformApiRoutes.d.ts +2 -2
  95. package/bin/control/PlatformApiRoutes.d.ts.map +1 -1
  96. package/bin/control/PlatformApiRoutes.js +2 -2
  97. package/bin/control/PlatformApiRoutes.js.map +1 -1
  98. package/bin/control/gateway/AgentActions.d.ts +2 -2
  99. package/bin/control/gateway/AgentActions.d.ts.map +1 -1
  100. package/bin/control/gateway/AgentActions.js +7 -7
  101. package/bin/control/gateway/AgentActions.js.map +1 -1
  102. package/bin/control/gateway/AgentCatalog.d.ts +3 -6
  103. package/bin/control/gateway/AgentCatalog.d.ts.map +1 -1
  104. package/bin/control/gateway/AgentCatalog.js +16 -18
  105. package/bin/control/gateway/AgentCatalog.js.map +1 -1
  106. package/bin/control/instant/InstantSessionRunner.d.ts.map +1 -1
  107. package/bin/control/instant/InstantSessionRunner.js +3 -1
  108. package/bin/control/instant/InstantSessionRunner.js.map +1 -1
  109. package/bin/env/ProcessEnv.d.ts +24 -0
  110. package/bin/env/ProcessEnv.d.ts.map +1 -0
  111. package/bin/env/ProcessEnv.js +41 -0
  112. package/bin/env/ProcessEnv.js.map +1 -0
  113. package/bin/http/auth/AuthEnv.d.ts +1 -1
  114. package/bin/http/auth/AuthEnv.js +1 -1
  115. package/bin/model/runtime/CreateRuntimeModel.d.ts +8 -0
  116. package/bin/model/runtime/CreateRuntimeModel.d.ts.map +1 -1
  117. package/bin/model/runtime/CreateRuntimeModel.js +43 -37
  118. package/bin/model/runtime/CreateRuntimeModel.js.map +1 -1
  119. package/bin/model/service/ModelPoolService.d.ts +1 -1
  120. package/bin/model/service/ModelPoolService.d.ts.map +1 -1
  121. package/bin/model/service/ModelPoolService.js +8 -6
  122. package/bin/model/service/ModelPoolService.js.map +1 -1
  123. package/bin/platform/store/StoreEnvRepository.d.ts +5 -49
  124. package/bin/platform/store/StoreEnvRepository.d.ts.map +1 -1
  125. package/bin/platform/store/StoreEnvRepository.js +31 -178
  126. package/bin/platform/store/StoreEnvRepository.js.map +1 -1
  127. package/bin/platform/store/StoreSchema.js +3 -44
  128. package/bin/platform/store/StoreSchema.js.map +1 -1
  129. package/bin/platform/store/index.d.ts +9 -45
  130. package/bin/platform/store/index.d.ts.map +1 -1
  131. package/bin/platform/store/index.js +12 -62
  132. package/bin/platform/store/index.js.map +1 -1
  133. package/bin/platform/store/schema.d.ts +2 -2
  134. package/bin/platform/store/schema.js +2 -2
  135. package/bin/process/daemon/Api.d.ts +1 -1
  136. package/bin/process/daemon/CliArgs.d.ts +1 -0
  137. package/bin/process/daemon/CliArgs.d.ts.map +1 -1
  138. package/bin/process/daemon/CliArgs.js +20 -1
  139. package/bin/process/daemon/CliArgs.js.map +1 -1
  140. package/bin/process/daemon/Client.d.ts +18 -2
  141. package/bin/process/daemon/Client.d.ts.map +1 -1
  142. package/bin/process/daemon/Client.js +70 -20
  143. package/bin/process/daemon/Client.js.map +1 -1
  144. package/bin/process/daemon/Manager.d.ts.map +1 -1
  145. package/bin/process/daemon/Manager.js +2 -1
  146. package/bin/process/daemon/Manager.js.map +1 -1
  147. package/bin/terminal/admin/auth-error.d.ts +34 -0
  148. package/bin/terminal/admin/auth-error.d.ts.map +1 -0
  149. package/bin/terminal/admin/auth-error.js +51 -0
  150. package/bin/terminal/admin/auth-error.js.map +1 -0
  151. package/bin/terminal/admin/commands/accounts.d.ts +6 -0
  152. package/bin/terminal/admin/commands/accounts.d.ts.map +1 -0
  153. package/bin/terminal/admin/commands/accounts.js +44 -0
  154. package/bin/terminal/admin/commands/accounts.js.map +1 -0
  155. package/bin/terminal/admin/commands/balance.d.ts +6 -0
  156. package/bin/terminal/admin/commands/balance.d.ts.map +1 -0
  157. package/bin/terminal/admin/commands/balance.js +153 -0
  158. package/bin/terminal/admin/commands/balance.js.map +1 -0
  159. package/bin/terminal/admin/commands/config.d.ts +10 -0
  160. package/bin/terminal/admin/commands/config.d.ts.map +1 -0
  161. package/bin/terminal/admin/commands/config.js +11 -0
  162. package/bin/terminal/admin/commands/config.js.map +1 -0
  163. package/bin/terminal/admin/commands/custom.d.ts +6 -0
  164. package/bin/terminal/admin/commands/custom.d.ts.map +1 -0
  165. package/bin/terminal/admin/commands/custom.js +47 -0
  166. package/bin/terminal/admin/commands/custom.js.map +1 -0
  167. package/bin/terminal/admin/commands/instruction.d.ts +9 -0
  168. package/bin/terminal/admin/commands/instruction.d.ts.map +1 -0
  169. package/bin/terminal/admin/commands/instruction.js +10 -0
  170. package/bin/terminal/admin/commands/instruction.js.map +1 -0
  171. package/bin/terminal/admin/commands/models.d.ts +14 -0
  172. package/bin/terminal/admin/commands/models.d.ts.map +1 -0
  173. package/bin/terminal/admin/commands/models.js +61 -0
  174. package/bin/terminal/admin/commands/models.js.map +1 -0
  175. package/bin/terminal/admin/commands/payment.d.ts +6 -0
  176. package/bin/terminal/admin/commands/payment.d.ts.map +1 -0
  177. package/bin/terminal/admin/commands/payment.js +59 -0
  178. package/bin/terminal/admin/commands/payment.js.map +1 -0
  179. package/bin/terminal/admin/commands/products.d.ts +6 -0
  180. package/bin/terminal/admin/commands/products.d.ts.map +1 -0
  181. package/bin/terminal/admin/commands/products.js +80 -0
  182. package/bin/terminal/admin/commands/products.js.map +1 -0
  183. package/bin/terminal/admin/commands/service-env.d.ts +11 -0
  184. package/bin/terminal/admin/commands/service-env.d.ts.map +1 -0
  185. package/bin/terminal/admin/commands/service-env.js +248 -0
  186. package/bin/terminal/admin/commands/service-env.js.map +1 -0
  187. package/bin/terminal/admin/commands/usage.d.ts +6 -0
  188. package/bin/terminal/admin/commands/usage.d.ts.map +1 -0
  189. package/bin/terminal/admin/commands/usage.js +44 -0
  190. package/bin/terminal/admin/commands/usage.js.map +1 -0
  191. package/bin/terminal/admin/loop.d.ts +6 -0
  192. package/bin/terminal/admin/loop.d.ts.map +1 -0
  193. package/bin/terminal/admin/loop.js +70 -0
  194. package/bin/terminal/admin/loop.js.map +1 -0
  195. package/bin/terminal/agent/pi-agent.d.ts +15 -0
  196. package/bin/terminal/agent/pi-agent.d.ts.map +1 -0
  197. package/bin/terminal/agent/pi-agent.js +136 -0
  198. package/bin/terminal/agent/pi-agent.js.map +1 -0
  199. package/bin/terminal/app.d.ts +13 -0
  200. package/bin/terminal/app.d.ts.map +1 -0
  201. package/bin/terminal/app.js +123 -0
  202. package/bin/terminal/app.js.map +1 -0
  203. package/bin/terminal/auth/admin.d.ts +8 -0
  204. package/bin/terminal/auth/admin.d.ts.map +1 -0
  205. package/bin/terminal/auth/admin.js +18 -0
  206. package/bin/terminal/auth/admin.js.map +1 -0
  207. package/bin/terminal/auth/mode-select.d.ts +11 -0
  208. package/bin/terminal/auth/mode-select.d.ts.map +1 -0
  209. package/bin/terminal/auth/mode-select.js +33 -0
  210. package/bin/terminal/auth/mode-select.js.map +1 -0
  211. package/bin/terminal/auth/server-switch.d.ts +22 -0
  212. package/bin/terminal/auth/server-switch.d.ts.map +1 -0
  213. package/bin/terminal/auth/server-switch.js +241 -0
  214. package/bin/terminal/auth/server-switch.js.map +1 -0
  215. package/bin/terminal/auth/user.d.ts +19 -0
  216. package/bin/terminal/auth/user.d.ts.map +1 -0
  217. package/bin/terminal/auth/user.js +261 -0
  218. package/bin/terminal/auth/user.js.map +1 -0
  219. package/bin/terminal/core/browser.d.ts +12 -0
  220. package/bin/terminal/core/browser.d.ts.map +1 -0
  221. package/bin/terminal/core/browser.js +29 -0
  222. package/bin/terminal/core/browser.js.map +1 -0
  223. package/bin/terminal/core/env.d.ts +15 -0
  224. package/bin/terminal/core/env.d.ts.map +1 -0
  225. package/bin/terminal/core/env.js +67 -0
  226. package/bin/terminal/core/env.js.map +1 -0
  227. package/bin/terminal/core/session.d.ts +97 -0
  228. package/bin/terminal/core/session.d.ts.map +1 -0
  229. package/bin/terminal/core/session.js +342 -0
  230. package/bin/terminal/core/session.js.map +1 -0
  231. package/bin/terminal/core/stripe.d.ts +26 -0
  232. package/bin/terminal/core/stripe.d.ts.map +1 -0
  233. package/bin/terminal/core/stripe.js +22 -0
  234. package/bin/terminal/core/stripe.js.map +1 -0
  235. package/bin/terminal/core/ui.d.ts +29 -0
  236. package/bin/terminal/core/ui.d.ts.map +1 -0
  237. package/bin/terminal/core/ui.js +60 -0
  238. package/bin/terminal/core/ui.js.map +1 -0
  239. package/bin/terminal/core/update.d.ts +20 -0
  240. package/bin/terminal/core/update.d.ts.map +1 -0
  241. package/bin/terminal/core/update.js +193 -0
  242. package/bin/terminal/core/update.js.map +1 -0
  243. package/bin/terminal/user/balance.d.ts +31 -0
  244. package/bin/terminal/user/balance.d.ts.map +1 -0
  245. package/bin/terminal/user/balance.js +131 -0
  246. package/bin/terminal/user/balance.js.map +1 -0
  247. package/bin/terminal/user/chat.d.ts +12 -0
  248. package/bin/terminal/user/chat.d.ts.map +1 -0
  249. package/bin/terminal/user/chat.js +70 -0
  250. package/bin/terminal/user/chat.js.map +1 -0
  251. package/bin/terminal/user/loop.d.ts +13 -0
  252. package/bin/terminal/user/loop.d.ts.map +1 -0
  253. package/bin/terminal/user/loop.js +93 -0
  254. package/bin/terminal/user/loop.js.map +1 -0
  255. package/bin/terminal/user/models.d.ts +10 -0
  256. package/bin/terminal/user/models.d.ts.map +1 -0
  257. package/bin/terminal/user/models.js +39 -0
  258. package/bin/terminal/user/models.js.map +1 -0
  259. package/bin/utils/storage.d.ts +0 -1
  260. package/bin/utils/storage.d.ts.map +1 -1
  261. package/bin/utils/storage.js +0 -6
  262. package/bin/utils/storage.js.map +1 -1
  263. package/package.json +7 -3
  264. package/public/app.js +3 -3
  265. package/src/cli/Index.ts +2 -0
  266. package/src/cli/agent/AgentChat.ts +113 -289
  267. package/src/cli/agent/AgentChatTypes.ts +8 -12
  268. package/src/cli/agent/AgentHistory.ts +2 -2
  269. package/src/cli/agent/AgentManager.ts +27 -28
  270. package/src/cli/agent/AgentManagerTypes.ts +2 -2
  271. package/src/cli/agent/AgentReset.ts +4 -4
  272. package/src/cli/agent/AgentSelection.ts +6 -6
  273. package/src/cli/agent/AgentSelectionTypes.ts +1 -1
  274. package/src/cli/agent/Init.ts +13 -13
  275. package/src/cli/agent/Restart.ts +2 -2
  276. package/src/cli/agent/Run.ts +38 -17
  277. package/src/cli/agent/Start.ts +2 -2
  278. package/src/cli/agent/Stop.ts +2 -2
  279. package/src/cli/control-plane/ControlPlaneProcess.ts +5 -5
  280. package/src/cli/model/ModelCreateCommand.ts +1 -1
  281. package/src/cli/model/ModelManageCommand.ts +5 -3
  282. package/src/cli/model/ModelManager.ts +3 -3
  283. package/src/cli/model/ModelSupport.ts +2 -10
  284. package/src/cli/shared/CliReporterTypes.ts +1 -1
  285. package/src/cli/shared/Config.ts +2 -2
  286. package/src/cli/shared/Env.ts +22 -230
  287. package/src/cli/shared/IndexAgentCommand.ts +3 -4
  288. package/src/cli/shared/IndexSupport.ts +16 -10
  289. package/src/cli/shared/ManagedPluginActionCommands.ts +4 -4
  290. package/src/cli/shared/ManagedPluginRemote.ts +4 -4
  291. package/src/cli/shared/PluginTargetSupport.ts +19 -19
  292. package/src/cli/shared/Plugins.ts +10 -10
  293. package/src/cli/shared/PublicHostEnv.ts +2 -2
  294. package/src/cli/shared/Terminal.ts +24 -0
  295. package/src/config/DowncitySchema.ts +3 -113
  296. package/src/config/Paths.ts +9 -90
  297. package/src/control/ControlGateway.ts +3 -3
  298. package/src/control/EnvApiRoutes.ts +7 -91
  299. package/src/control/PlatformApiRoutes.ts +6 -6
  300. package/src/control/gateway/AgentActions.ts +10 -10
  301. package/src/control/gateway/AgentCatalog.ts +17 -21
  302. package/src/control/instant/InstantSessionRunner.ts +3 -1
  303. package/src/env/ProcessEnv.ts +43 -0
  304. package/src/http/auth/AuthEnv.ts +1 -1
  305. package/src/model/runtime/CreateRuntimeModel.ts +54 -37
  306. package/src/model/service/ModelPoolService.ts +13 -11
  307. package/src/platform/store/StoreEnvRepository.ts +31 -234
  308. package/src/platform/store/StoreSchema.ts +3 -49
  309. package/src/platform/store/index.ts +11 -80
  310. package/src/platform/store/schema.ts +2 -2
  311. package/src/process/daemon/Api.ts +1 -1
  312. package/src/process/daemon/CliArgs.ts +24 -1
  313. package/src/process/daemon/Client.ts +90 -22
  314. package/src/process/daemon/Manager.ts +2 -1
  315. package/src/terminal/admin/auth-error.ts +62 -0
  316. package/src/terminal/admin/commands/accounts.ts +44 -0
  317. package/src/terminal/admin/commands/balance.ts +160 -0
  318. package/src/terminal/admin/commands/config.ts +13 -0
  319. package/src/terminal/admin/commands/custom.ts +46 -0
  320. package/src/terminal/admin/commands/instruction.ts +12 -0
  321. package/src/terminal/admin/commands/models.ts +64 -0
  322. package/src/terminal/admin/commands/payment.ts +94 -0
  323. package/src/terminal/admin/commands/products.ts +72 -0
  324. package/src/terminal/admin/commands/service-env.ts +256 -0
  325. package/src/terminal/admin/commands/usage.ts +44 -0
  326. package/src/terminal/admin/loop.ts +69 -0
  327. package/src/terminal/agent/pi-agent.ts +180 -0
  328. package/src/terminal/app.ts +120 -0
  329. package/src/terminal/auth/admin.ts +21 -0
  330. package/src/terminal/auth/mode-select.ts +38 -0
  331. package/src/terminal/auth/server-switch.ts +275 -0
  332. package/src/terminal/auth/user.ts +351 -0
  333. package/src/terminal/core/browser.ts +31 -0
  334. package/src/terminal/core/env.ts +71 -0
  335. package/src/terminal/core/session.ts +450 -0
  336. package/src/terminal/core/stripe.ts +37 -0
  337. package/src/terminal/core/ui.ts +84 -0
  338. package/src/terminal/core/update.ts +230 -0
  339. package/src/terminal/user/balance.ts +215 -0
  340. package/src/terminal/user/chat.ts +80 -0
  341. package/src/terminal/user/loop.ts +112 -0
  342. package/src/terminal/user/models.ts +43 -0
  343. package/src/utils/storage.ts +0 -7
  344. package/bin/process/rpc/Client.d.ts +0 -13
  345. package/bin/process/rpc/Client.d.ts.map +0 -1
  346. package/bin/process/rpc/Client.js +0 -98
  347. package/bin/process/rpc/Client.js.map +0 -1
  348. package/bin/process/rpc/Paths.d.ts +0 -14
  349. package/bin/process/rpc/Paths.d.ts.map +0 -1
  350. package/bin/process/rpc/Paths.js +0 -36
  351. package/bin/process/rpc/Paths.js.map +0 -1
  352. package/src/process/rpc/Client.ts +0 -113
  353. package/src/process/rpc/Paths.ts +0 -43
@@ -6,7 +6,6 @@
6
6
  * - 这里不负责命令注册,只负责 transport 调用与结果输出。
7
7
  */
8
8
 
9
- import { callAgentTransport } from "@downcity/agent";
10
9
  import { printResult } from "@/utils/cli/CliOutput.js";
11
10
  import type {
12
11
  PluginCliBaseOptions,
@@ -20,6 +19,7 @@ import {
20
19
  resolvePluginProjectRoot,
21
20
  validateAgentProjectRoot,
22
21
  } from "./PluginTargetSupport.js";
22
+ import { callServer } from "@/process/daemon/Client.js";
23
23
 
24
24
  const PLUGIN_COMMAND_TIMEOUT_MS = 120_000;
25
25
 
@@ -52,7 +52,7 @@ export async function runManagedPluginListCommand(options: PluginCliBaseOptions)
52
52
  });
53
53
  return;
54
54
  }
55
- const remote = await callAgentTransport<PluginStateListResponse>({
55
+ const remote = await callServer<PluginStateListResponse>({
56
56
  projectRoot,
57
57
  path: "/api/plugins/list",
58
58
  method: "GET",
@@ -117,7 +117,7 @@ export async function runManagedPluginControlCommand(params: {
117
117
  });
118
118
  return;
119
119
  }
120
- const remote = await callAgentTransport<PluginControlResponse>({
120
+ const remote = await callServer<PluginControlResponse>({
121
121
  projectRoot,
122
122
  path: "/api/plugins/control",
123
123
  method: "POST",
@@ -187,7 +187,7 @@ export async function runManagedPluginCommandBridge(params: {
187
187
  });
188
188
  return;
189
189
  }
190
- const remote = await callAgentTransport<PluginCommandResponse>({
190
+ const remote = await callServer<PluginCommandResponse>({
191
191
  projectRoot,
192
192
  path: "/api/plugins/command",
193
193
  method: "POST",
@@ -14,7 +14,7 @@ import { getProfileMdPath, getDowncityJsonPath } from "@/config/Paths.js";
14
14
  import { listManagedAgentEntries } from "@/process/registry/CityRegistry.js";
15
15
  import { isCityRunning } from "@/process/registry/CityRuntime.js";
16
16
  import type { JsonValue } from "@downcity/agent";
17
- import { parsePort, resolveAgentName } from "./IndexSupport.js";
17
+ import { parsePort, resolveAgentId } from "./IndexSupport.js";
18
18
  import { CliError } from "./CliError.js";
19
19
  import type { ActionScheduleJobStatus } from "@downcity/agent";
20
20
  import type { PluginCliBaseOptions } from "@downcity/agent";
@@ -126,13 +126,13 @@ export function resolveProjectRoot(pathInput?: string): string {
126
126
  }
127
127
 
128
128
  /**
129
- * 通过 agent 名称解析 projectRoot。
129
+ * 通过 agent id 解析 projectRoot。
130
130
  */
131
- export async function resolveProjectRootByAgentName(agentName: string): Promise<{
131
+ export async function resolveProjectRootByAgentId(agentId: string): Promise<{
132
132
  projectRoot?: string;
133
133
  error?: string;
134
134
  }> {
135
- const target = String(agentName || "").trim().toLowerCase();
135
+ const target = String(agentId || "").trim().toLowerCase();
136
136
  if (!target) {
137
137
  return { error: "--agent requires a non-empty value" };
138
138
  }
@@ -144,18 +144,18 @@ export async function resolveProjectRootByAgentName(agentName: string): Promise<
144
144
  .filter((root, index, all) => all.indexOf(root) === index)
145
145
  .filter((root) => {
146
146
  const byDirName = path.basename(root).toLowerCase() === target;
147
- const byShipName = resolveAgentName(root).toLowerCase() === target;
148
- return byDirName || byShipName;
147
+ const byProjectId = resolveAgentId(root).toLowerCase() === target;
148
+ return byDirName || byProjectId;
149
149
  });
150
150
 
151
151
  if (matchedRoots.length === 0) {
152
152
  return {
153
- error: `Agent not found in managed agent registry: ${agentName}. Run "city agent list" to inspect names.`,
153
+ error: `Agent not found in managed agent registry: ${agentId}. Run "city agent list" to inspect ids.`,
154
154
  };
155
155
  }
156
156
  if (matchedRoots.length > 1) {
157
157
  return {
158
- error: `Agent name is ambiguous: ${agentName}. Matched paths: ${matchedRoots.join(", ")}`,
158
+ error: `Agent id is ambiguous: ${agentId}. Matched paths: ${matchedRoots.join(", ")}`,
159
159
  };
160
160
  }
161
161
 
@@ -171,18 +171,18 @@ export async function resolvePluginProjectRoot(options: PluginCliBaseOptions): P
171
171
  }> {
172
172
  const explicitAgent = String(options.agent || "").trim();
173
173
  if (explicitAgent) {
174
- return resolveProjectRootByAgentName(explicitAgent);
174
+ return resolveProjectRootByAgentId(explicitAgent);
175
175
  }
176
176
 
177
177
  const rawPath = String(options.path || ".").trim() || ".";
178
178
  // 关键点(中文):在 agent shell 中,未显式传 --agent 且 path 走默认值时,
179
- // 优先使用注入的 DC_AGENT_NAME 走 registry 解析,确保多 agent 下目标稳定。
179
+ // 优先使用注入的 DC_AGENT_ID 走 registry 解析,确保多 agent 下目标稳定。
180
180
  if (rawPath === ".") {
181
- const envAgentName = String(process.env.DC_AGENT_NAME || "").trim();
182
- if (envAgentName) {
183
- const byName = await resolveProjectRootByAgentName(envAgentName);
184
- if (byName.projectRoot) {
185
- return byName;
181
+ const envAgentId = String(process.env.DC_AGENT_ID || "").trim();
182
+ if (envAgentId) {
183
+ const byId = await resolveProjectRootByAgentId(envAgentId);
184
+ if (byId.projectRoot) {
185
+ return byId;
186
186
  }
187
187
  }
188
188
  }
@@ -213,7 +213,7 @@ export async function resolvePluginScheduleProjectRoot(options: PluginCliBaseOpt
213
213
  }> {
214
214
  const explicitAgent = String(options.agent || "").trim();
215
215
  if (explicitAgent) {
216
- return resolveProjectRootByAgentName(explicitAgent);
216
+ return resolveProjectRootByAgentId(explicitAgent);
217
217
  }
218
218
  return {
219
219
  projectRoot: resolveProjectRoot(options.path),
@@ -257,10 +257,10 @@ export function parseCommandPayload(raw?: string): JsonValue | undefined {
257
257
  export function addPluginTargetOptions(command: Command): Command {
258
258
  return command
259
259
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
260
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
260
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
261
261
  .option("--host <host>", "Server host(覆盖自动解析)")
262
262
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
263
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
263
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
264
264
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true);
265
265
  }
266
266
 
@@ -270,6 +270,6 @@ export function addPluginTargetOptions(command: Command): Command {
270
270
  export function addPluginScheduleOptions(command: Command): Command {
271
271
  return command
272
272
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
273
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
273
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
274
274
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true);
275
275
  }
@@ -621,10 +621,10 @@ export function registerPluginsCommand(program: Command): void {
621
621
  .command("status <pluginName>")
622
622
  .description("按 agent 目标查看托管 plugin 运行状态")
623
623
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
624
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
624
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
625
625
  .option("--host <host>", "Server host(覆盖自动解析)")
626
626
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
627
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
627
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
628
628
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true)
629
629
  .action(async (pluginName: string, opts: PluginCliBaseOptions) => {
630
630
  await runManagedPluginControlCommand({
@@ -638,10 +638,10 @@ export function registerPluginsCommand(program: Command): void {
638
638
  .command("start <pluginName>")
639
639
  .description("按 agent 目标启动托管 plugin")
640
640
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
641
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
641
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
642
642
  .option("--host <host>", "Server host(覆盖自动解析)")
643
643
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
644
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
644
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
645
645
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true)
646
646
  .action(async (pluginName: string, opts: PluginCliBaseOptions) => {
647
647
  await runManagedPluginControlCommand({
@@ -655,10 +655,10 @@ export function registerPluginsCommand(program: Command): void {
655
655
  .command("stop <pluginName>")
656
656
  .description("按 agent 目标停止托管 plugin")
657
657
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
658
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
658
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
659
659
  .option("--host <host>", "Server host(覆盖自动解析)")
660
660
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
661
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
661
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
662
662
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true)
663
663
  .action(async (pluginName: string, opts: PluginCliBaseOptions) => {
664
664
  await runManagedPluginControlCommand({
@@ -672,10 +672,10 @@ export function registerPluginsCommand(program: Command): void {
672
672
  .command("restart <pluginName>")
673
673
  .description("按 agent 目标重启托管 plugin")
674
674
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
675
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
675
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
676
676
  .option("--host <host>", "Server host(覆盖自动解析)")
677
677
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
678
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
678
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
679
679
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true)
680
680
  .action(async (pluginName: string, opts: PluginCliBaseOptions) => {
681
681
  await runManagedPluginControlCommand({
@@ -690,10 +690,10 @@ export function registerPluginsCommand(program: Command): void {
690
690
  .description("按 agent 目标转发托管 plugin command")
691
691
  .option("--payload <json>", "可选 payload(JSON 字符串或普通字符串)")
692
692
  .option("--path <path>", "项目根目录(默认当前目录)", ".")
693
- .option("--agent <name>", "agent 名称(从 managed agent registry 解析)")
693
+ .option("--agent <id>", "agent id(从 managed agent registry 解析)")
694
694
  .option("--host <host>", "Server host(覆盖自动解析)")
695
695
  .option("--port <port>", "Server port(覆盖自动解析)", parsePort)
696
- .option("--token <token>", "覆盖 Bearer Token(仅远程 HTTP 调用需要;默认本地走 IPC)")
696
+ .option("--token <token>", "覆盖 Bearer Token(按 HTTP daemon 调用时可选)")
697
697
  .option("--json [enabled]", "以 JSON 输出", parseBoolean, true)
698
698
  .action(async (
699
699
  pluginName: string,
@@ -4,7 +4,7 @@
4
4
  * 关键点(中文)
5
5
  * - `city start` 时自动探测公网 IPv4,并写入平台 Env 的 `DOWNCITY_PUBLIC_HOST`。
6
6
  * - 若部署环境已经注入 `DOWNCITY_PUBLIC_URL/HOST`,绝不覆盖。
7
- * - 写入平台 Env 后,后续 agent daemon 启动会通过 `context.globalEnv` 读取到该值。
7
+ * - 写入平台 Env 后,后续 city 宿主会在启动 Agent/模型运行时前显式读取并传入。
8
8
  */
9
9
 
10
10
  import { PlatformStore } from "@/platform/store/index.js";
@@ -50,7 +50,7 @@ async function resolvePublicIpv4FromNetwork(): Promise<string | null> {
50
50
  function readGlobalEnvFromStore(): Record<string, string> {
51
51
  const store = new PlatformStore();
52
52
  try {
53
- return store.getGlobalEnvMapSync();
53
+ return store.getEnvMapSync();
54
54
  } catch {
55
55
  return {};
56
56
  } finally {
@@ -0,0 +1,24 @@
1
+ /**
2
+ * City terminal 命令装配模块。
3
+ *
4
+ * 关键点(中文)
5
+ * - `city terminal` 承接原独立 manager 的交互式管理入口。
6
+ * - 这里仅负责把 terminal 挂到 city CLI 命令树,具体状态机仍在 terminal 模块内部。
7
+ */
8
+
9
+ import type { Command } from "commander";
10
+ import { runTerminalApp } from "@/terminal/app.js";
11
+ import { createVersionBanner } from "./IndexSupport.js";
12
+
13
+ /**
14
+ * 注册 `city terminal` 命令。
15
+ */
16
+ export function registerTerminalCommand(program: Command, version: string): void {
17
+ program
18
+ .command("terminal [action]")
19
+ .description("打开 Downcity 服务终端(管理 infra/services server 与用户会话)")
20
+ .helpOption("--help", "display help for command")
21
+ .action(createVersionBanner(version, async (action?: string) => {
22
+ await runTerminalApp(action ? [action] : []);
23
+ }));
24
+ }
@@ -12,9 +12,8 @@ export const DOWNCITY_JSON_SCHEMA: JsonObject = {
12
12
  description:
13
13
  "JSON Schema reference for editor/IDE validation (e.g. ./.downcity/schema/downcity.schema.json).",
14
14
  },
15
- name: { type: "string" },
15
+ id: { type: "string" },
16
16
  version: { type: "string" },
17
- description: { type: "string" },
18
17
  start: {
19
18
  type: "object",
20
19
  additionalProperties: true,
@@ -29,70 +28,15 @@ export const DOWNCITY_JSON_SCHEMA: JsonObject = {
29
28
  properties: {
30
29
  type: {
31
30
  type: "string",
32
- enum: ["api", "acp", "local"],
31
+ enum: ["api"],
33
32
  },
34
33
  modelId: {
35
34
  type: "string",
36
35
  description:
37
36
  "API 执行模式下绑定的平台全局模型 ID。",
38
37
  },
39
- agent: {
40
- type: "object",
41
- additionalProperties: true,
42
- properties: {
43
- type: {
44
- type: "string",
45
- enum: ["codex", "claude", "kimi"],
46
- },
47
- command: { type: "string" },
48
- args: {
49
- type: "array",
50
- items: { type: "string" },
51
- },
52
- env: {
53
- type: "object",
54
- additionalProperties: { type: "string" },
55
- },
56
- },
57
- required: ["type"],
58
- },
59
- local: {
60
- type: "null",
61
- description:
62
- "本地执行模式不再从 execution.local 读取配置;请改为使用 plugins.lmp。",
63
- },
64
38
  },
65
- required: ["type"],
66
- allOf: [
67
- {
68
- if: {
69
- properties: {
70
- type: { const: "api" },
71
- },
72
- },
73
- then: {
74
- required: ["modelId"],
75
- },
76
- },
77
- {
78
- if: {
79
- properties: {
80
- type: { const: "acp" },
81
- },
82
- },
83
- then: {
84
- required: ["agent"],
85
- },
86
- },
87
- {
88
- if: {
89
- properties: {
90
- type: { const: "local" },
91
- },
92
- },
93
- then: true,
94
- },
95
- ],
39
+ required: ["type", "modelId"],
96
40
  },
97
41
  sandbox: {
98
42
  type: "object",
@@ -256,44 +200,6 @@ export const DOWNCITY_JSON_SCHEMA: JsonObject = {
256
200
  },
257
201
  },
258
202
  },
259
- lmp: {
260
- type: "object",
261
- additionalProperties: true,
262
- properties: {
263
- provider: {
264
- type: "string",
265
- enum: ["llama"],
266
- },
267
- model: {
268
- type: "string",
269
- description:
270
- "当前激活的本地模型文件名或绝对路径;相对路径默认相对 plugins.lmp.modelsDir。",
271
- },
272
- modelsDir: {
273
- type: "string",
274
- description: "本地模型目录,默认 ~/.models。",
275
- },
276
- command: {
277
- type: "string",
278
- description: "llama-server 可执行命令,默认 llama-server。",
279
- },
280
- args: {
281
- type: "array",
282
- items: { type: "string" },
283
- },
284
- host: { type: "string" },
285
- port: { type: "integer", minimum: 1, maximum: 65535 },
286
- contextSize: { type: "integer", minimum: 512, maximum: 1048576 },
287
- gpuLayers: { type: "integer", minimum: -1, maximum: 65535 },
288
- autoStart: { type: "boolean" },
289
- installedModels: {
290
- type: "array",
291
- items: {
292
- type: "string",
293
- },
294
- },
295
- },
296
- },
297
203
  },
298
204
  },
299
205
  llm: {
@@ -351,21 +257,5 @@ export const DOWNCITY_JSON_SCHEMA: JsonObject = {
351
257
  },
352
258
  required: ["providers", "models"],
353
259
  },
354
- context: {
355
- type: "object",
356
- additionalProperties: true,
357
- properties: {
358
- messages: {
359
- type: "object",
360
- additionalProperties: true,
361
- properties: {
362
- keepLastMessages: { type: "integer", minimum: 6, maximum: 5000 },
363
- maxInputTokensApprox: { type: "integer", minimum: 2000, maximum: 200000 },
364
- archiveOnCompact: { type: "boolean" },
365
- compactRatio: { type: "number", minimum: 0.1, maximum: 0.9 },
366
- },
367
- },
368
- },
369
- },
370
260
  },
371
261
  };
@@ -15,16 +15,12 @@ import path from "path";
15
15
  * - 统一使用大写文件名:`PROFILE.md`。
16
16
  * - 与 SOUL 一起作为静态 prompt 入口。
17
17
  */
18
- export const PROFILE_MD_FILE_CANDIDATES = ["PROFILE.md"] as const;
18
+ const PROFILE_MD_FILE_CANDIDATES = ["PROFILE.md"] as const;
19
19
 
20
20
  export function getProfileMdPath(cwd: string): string {
21
21
  return path.join(cwd, PROFILE_MD_FILE_CANDIDATES[0]);
22
22
  }
23
23
 
24
- export function getProfileMdCandidatePaths(cwd: string): string[] {
25
- return PROFILE_MD_FILE_CANDIDATES.map((filename) => path.join(cwd, filename));
26
- }
27
-
28
24
  /**
29
25
  * SOUL.md 候选文件名(按优先级从高到低)。
30
26
  *
@@ -32,16 +28,12 @@ export function getProfileMdCandidatePaths(cwd: string): string[] {
32
28
  * - 统一使用大写文件名:`SOUL.md`。
33
29
  * - 统一由 Paths 模块暴露,避免调用方散落硬编码。
34
30
  */
35
- export const SOUL_MD_FILE_CANDIDATES = ["SOUL.md"] as const;
31
+ const SOUL_MD_FILE_CANDIDATES = ["SOUL.md"] as const;
36
32
 
37
33
  export function getSoulMdPath(cwd: string): string {
38
34
  return path.join(cwd, SOUL_MD_FILE_CANDIDATES[0]);
39
35
  }
40
36
 
41
- export function getSoulMdCandidatePaths(cwd: string): string[] {
42
- return SOUL_MD_FILE_CANDIDATES.map((filename) => path.join(cwd, filename));
43
- }
44
-
45
37
  export function getDowncityJsonPath(cwd: string): string {
46
38
  return path.join(cwd, "downcity.json");
47
39
  }
@@ -54,37 +46,21 @@ export function getDowncitySchemaPath(cwd: string): string {
54
46
  return path.join(getDowncityDirPath(cwd), "schema", "downcity.schema.json");
55
47
  }
56
48
 
57
- export function getDowncityConfigDirPath(cwd: string): string {
58
- return path.join(getDowncityDirPath(cwd), "config");
59
- }
60
-
61
- export function getLogsDirPath(cwd: string): string {
62
- return path.join(getDowncityDirPath(cwd), "logs");
63
- }
64
-
65
49
  export function getCacheDirPath(cwd: string): string {
66
50
  return path.join(getDowncityDirPath(cwd), ".cache");
67
51
  }
68
52
 
69
- export function getDowncityProfileDirPath(cwd: string): string {
53
+ function getDowncityProfileDirPath(cwd: string): string {
70
54
  return path.join(getDowncityDirPath(cwd), "profile");
71
55
  }
72
56
 
73
- export function getDowncityProfilePrimaryPath(cwd: string): string {
74
- return path.join(getDowncityProfileDirPath(cwd), "Primary.md");
75
- }
76
-
77
- export function getDowncityProfileOtherPath(cwd: string): string {
78
- return path.join(getDowncityProfileDirPath(cwd), "other.md");
79
- }
80
-
81
57
  /**
82
58
  * Memory 根目录(V2)。
83
59
  *
84
60
  * 关键点(中文)
85
61
  * - `.downcity/memory` 为跨会话记忆目录。
86
62
  */
87
- export function getDowncityMemoryDirPath(cwd: string): string {
63
+ function getDowncityMemoryDirPath(cwd: string): string {
88
64
  return path.join(getDowncityDirPath(cwd), "memory");
89
65
  }
90
66
 
@@ -116,19 +92,11 @@ export function getDowncityMemoryDailyPath(cwd: string, date: string): string {
116
92
  * 关键点(中文)
117
93
  * - 调度任务属于项目 runtime 本地状态,因此放在项目 `.downcity/` 下。
118
94
  */
119
- export function getDowncityScheduleDbPath(cwd: string): string {
120
- return path.join(getDowncityDirPath(cwd), "schedule.jsonl");
121
- }
122
-
123
- export function getDowncityDataDirPath(cwd: string): string {
124
- return path.join(getDowncityDirPath(cwd), "data");
125
- }
126
-
127
- export function getDowncityAgentsRootDirPath(cwd: string): string {
95
+ function getDowncityAgentsRootDirPath(cwd: string): string {
128
96
  return path.join(getDowncityDirPath(cwd), "agents");
129
97
  }
130
98
 
131
- export function getDowncityAgentDirPath(cwd: string, agentId: string): string {
99
+ function getDowncityAgentDirPath(cwd: string, agentId: string): string {
132
100
  return path.join(
133
101
  getDowncityAgentsRootDirPath(cwd),
134
102
  encodeURIComponent(String(agentId || "").trim()),
@@ -168,29 +136,7 @@ export function getDowncitySessionMessagesDirPath(
168
136
  return path.join(getDowncitySessionDirPath(cwd, agentId, sessionId), "messages");
169
137
  }
170
138
 
171
- export function getDowncitySessionMessagesPath(
172
- cwd: string,
173
- agentId: string,
174
- sessionId: string,
175
- ): string {
176
- return path.join(
177
- getDowncitySessionMessagesDirPath(cwd, agentId, sessionId),
178
- "messages.jsonl",
179
- );
180
- }
181
-
182
- export function getDowncitySessionHistoryMetaPath(
183
- cwd: string,
184
- agentId: string,
185
- sessionId: string,
186
- ): string {
187
- return path.join(
188
- getDowncitySessionMessagesDirPath(cwd, agentId, sessionId),
189
- "meta.json",
190
- );
191
- }
192
-
193
- export function getDowncitySessionMessagesArchiveDirPath(
139
+ function getDowncitySessionMessagesArchiveDirPath(
194
140
  cwd: string,
195
141
  agentId: string,
196
142
  sessionId: string,
@@ -201,26 +147,6 @@ export function getDowncitySessionMessagesArchiveDirPath(
201
147
  );
202
148
  }
203
149
 
204
- export function getDowncitySessionMessagesArchivePath(
205
- cwd: string,
206
- agentId: string,
207
- sessionId: string,
208
- archiveId: string,
209
- ): string {
210
- return path.join(
211
- getDowncitySessionMessagesArchiveDirPath(cwd, agentId, sessionId),
212
- `${encodeURIComponent(String(archiveId || "").trim())}.json`,
213
- );
214
- }
215
-
216
- export function getDowncityPublicDirPath(cwd: string): string {
217
- return path.join(getDowncityDirPath(cwd), "public");
218
- }
219
-
220
- export function getDowncityTasksDirPath(cwd: string): string {
221
- return path.join(getDowncityDirPath(cwd), "task");
222
- }
223
-
224
150
  export function getDowncityDebugDirPath(cwd: string): string {
225
151
  return path.join(getDowncityDirPath(cwd), ".debug");
226
152
  }
@@ -232,7 +158,7 @@ export function getDowncityDebugDirPath(cwd: string): string {
232
158
  * - 该目录存放 `sessionId -> chat` 的最近映射快照
233
159
  * - 与 core session messages 分离,避免把平台路由细节耦合进 core
234
160
  */
235
- export function getDowncityChatDirPath(cwd: string): string {
161
+ function getDowncityChatDirPath(cwd: string): string {
236
162
  return path.join(getDowncityDirPath(cwd), "chat");
237
163
  }
238
164
 
@@ -257,17 +183,10 @@ export function getDowncityChannelMetaPath(cwd: string): string {
257
183
  return path.join(getDowncityChannelDirPath(cwd), "meta.json");
258
184
  }
259
185
 
260
- export function getDowncityChatMetaDirPath(cwd: string): string {
186
+ function getDowncityChatMetaDirPath(cwd: string): string {
261
187
  return path.join(getDowncityChatDirPath(cwd), "meta");
262
188
  }
263
189
 
264
- export function getDowncityChatMetaPath(cwd: string, sessionId: string): string {
265
- return path.join(
266
- getDowncityChatMetaDirPath(cwd),
267
- `${encodeURIComponent(String(sessionId || "").trim())}.json`,
268
- );
269
- }
270
-
271
190
  /**
272
191
  * Chat 会话目录(按 sessionId 组织)。
273
192
  *
@@ -306,13 +306,13 @@ export class ControlGateway {
306
306
  }
307
307
 
308
308
  private async initializeAgentProject(projectRoot: string, initialization: {
309
- agentName?: unknown;
309
+ id?: unknown;
310
310
  modelId?: unknown;
311
311
  forceOverwriteShipJson?: unknown;
312
312
  }): Promise<AgentProjectInitializationResult> {
313
313
  return initializePlatformAgentProject({
314
314
  projectRoot,
315
- agentName: initialization.agentName,
315
+ id: initialization.id,
316
316
  modelId: initialization.modelId,
317
317
  forceOverwriteShipJson: initialization.forceOverwriteShipJson,
318
318
  });
@@ -321,7 +321,7 @@ export class ControlGateway {
321
321
  private async startAgentByProjectRoot(projectRoot: string, options?: {
322
322
  initializeIfNeeded?: boolean;
323
323
  initialization?: {
324
- agentName?: unknown;
324
+ id?: unknown;
325
325
  modelId?: unknown;
326
326
  forceOverwriteShipJson?: unknown;
327
327
  };