@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
@@ -15,18 +15,16 @@ export const AGENT_CHAT_DEFAULT_SESSION_ID = "local-cli-chat-main";
15
15
  * `city agent chat` 命令选项。
16
16
  */
17
17
  export interface AgentChatCliOptions {
18
- /** 目标 agent 名称。 */
18
+ /** 目标 agent id。 */
19
19
  to?: string;
20
20
  /** 一次性发送的消息文本。 */
21
21
  message?: string;
22
22
  /** 是否输出 JSON。 */
23
23
  json?: boolean;
24
- /** 覆盖目标 runtime host。 */
24
+ /** 覆盖目标 RPC host。 */
25
25
  host?: string;
26
- /** 覆盖目标 runtime port。 */
26
+ /** 覆盖目标 RPC port。 */
27
27
  port?: number;
28
- /** 显式覆盖 Bearer Token。 */
29
- token?: string;
30
28
  }
31
29
 
32
30
  /**
@@ -45,7 +43,7 @@ export interface AgentChatExecuteResult {
45
43
  * SDK prompt 响应体。
46
44
  */
47
45
  export interface AgentChatExecuteResponse {
48
- /** HTTP 路由层是否成功处理请求。 */
46
+ /** 本轮 chat 执行是否成功。 */
49
47
  success: boolean;
50
48
  /** 实际执行使用的 sessionId。 */
51
49
  sessionId?: string;
@@ -59,20 +57,18 @@ export interface AgentChatExecuteResponse {
59
57
  * 复用 chat transport 时的基础选项。
60
58
  */
61
59
  export interface AgentChatTransportOptions {
62
- /** 覆盖目标 runtime host。 */
60
+ /** 覆盖目标 RPC host。 */
63
61
  host?: string;
64
- /** 覆盖目标 runtime port。 */
62
+ /** 覆盖目标 RPC port。 */
65
63
  port?: number;
66
- /** 显式覆盖 Bearer Token。 */
67
- token?: string;
68
64
  }
69
65
 
70
66
  /**
71
67
  * 单轮 chat 执行结果。
72
68
  */
73
69
  export interface AgentChatExecutionOutcome {
74
- /** 目标 agent 名称。 */
75
- agentName: string;
70
+ /** 目标 agent id。 */
71
+ agentId: string;
76
72
  /** 目标 agent 项目根目录。 */
77
73
  projectRoot?: string;
78
74
  /** 实际执行使用的 sessionId。 */
@@ -23,7 +23,7 @@ import type {
23
23
  } from "./AgentHistoryTypes.js";
24
24
  import { emitCliBlock } from "../shared/CliReporter.js";
25
25
  import { printResult } from "@/utils/cli/CliOutput.js";
26
- import { resolveAgentName } from "../shared/IndexSupport.js";
26
+ import { resolveAgentId } from "../shared/IndexSupport.js";
27
27
 
28
28
  function normalizeText(input: unknown): string {
29
29
  return String(input || "").trim();
@@ -149,7 +149,7 @@ export async function agentHistoryCleanCommand(
149
149
 
150
150
  const sessionDir = getDowncitySessionDirPath(
151
151
  projectRoot,
152
- resolveAgentName(projectRoot),
152
+ resolveAgentId(projectRoot),
153
153
  sessionId,
154
154
  );
155
155
  const chatDir = getDowncityChatSessionDirPath(projectRoot, sessionId);
@@ -56,9 +56,8 @@ async function loadAgentSummaries(): Promise<AgentManagerAgentSummary[]> {
56
56
  const agents = await listRegisteredAgentsForCli();
57
57
  return agents.map((agent) => {
58
58
  const config = readAgentConfig(agent.projectRoot);
59
- const configuredName = String(config?.name || "").trim();
60
59
  return {
61
- name: configuredName || agent.name,
60
+ id: String(config?.id || "").trim() || agent.id,
62
61
  projectRoot: agent.projectRoot,
63
62
  status: agent.status,
64
63
  modelId: readAgentModelId(config),
@@ -149,7 +148,7 @@ async function emitAgentManagerList(): Promise<void> {
149
148
  summary: `${agents.length} registered`,
150
149
  items: agents.map((agent) => ({
151
150
  tone: agent.status === "running" ? "success" : "info",
152
- title: agent.name,
151
+ title: agent.id,
153
152
  facts: [
154
153
  { label: "Status", value: agent.status },
155
154
  { label: "Model", value: agent.modelId || "not configured" },
@@ -219,7 +218,7 @@ async function promptAgentProjectRoot(): Promise<AgentManagerAgentSummary | null
219
218
  name: "projectRoot",
220
219
  message: "选择要管理的 Agent",
221
220
  choices: agents.map((agent) => ({
222
- title: agent.name,
221
+ title: agent.id,
223
222
  description: `${formatAgentListDescription(agent)} · ${agent.projectRoot}`,
224
223
  value: agent.projectRoot,
225
224
  })),
@@ -237,7 +236,7 @@ async function promptAgentAction(
237
236
  const response = (await prompts({
238
237
  type: "select",
239
238
  name: "action",
240
- message: `管理 agent · ${agent.name}`,
239
+ message: `管理 agent · ${agent.id}`,
241
240
  choices: [
242
241
  {
243
242
  title: "查看状态",
@@ -265,9 +264,9 @@ async function promptAgentAction(
265
264
  value: "chat",
266
265
  },
267
266
  {
268
- title: "配置名称",
269
- description: `当前:${agent.name}`,
270
- value: "configureName",
267
+ title: "配置 ID",
268
+ description: `当前:${agent.id}`,
269
+ value: "configureId",
271
270
  },
272
271
  {
273
272
  title: "配置模型",
@@ -363,50 +362,50 @@ async function runStartFlow(): Promise<void> {
363
362
  await startAgentProject(projectRoot);
364
363
  }
365
364
 
366
- async function configureAgentName(agent: AgentManagerAgentSummary): Promise<AgentManagerAgentSummary> {
365
+ async function configureAgentId(agent: AgentManagerAgentSummary): Promise<AgentManagerAgentSummary> {
367
366
  const response = (await prompts({
368
367
  type: "text",
369
- name: "name",
370
- message: "Agent 名称",
371
- initial: agent.name,
368
+ name: "id",
369
+ message: "Agent ID",
370
+ initial: agent.id,
372
371
  validate: (value) =>
373
- String(value || "").trim().length > 0 ? true : "Agent 名称不能为空",
374
- })) as { name?: string };
372
+ String(value || "").trim().length > 0 ? true : "Agent ID 不能为空",
373
+ })) as { id?: string };
375
374
 
376
- if (response.name === undefined) {
375
+ if (response.id === undefined) {
377
376
  emitCliBlock({
378
377
  tone: "info",
379
- title: "Agent name unchanged",
378
+ title: "Agent id unchanged",
380
379
  });
381
380
  return agent;
382
381
  }
383
382
 
384
- const nextName = String(response.name || "").trim();
385
- if (nextName === agent.name) {
383
+ const nextId = String(response.id || "").trim();
384
+ if (nextId === agent.id) {
386
385
  emitCliBlock({
387
386
  tone: "info",
388
- title: "Agent name unchanged",
389
- summary: agent.name,
387
+ title: "Agent id unchanged",
388
+ summary: agent.id,
390
389
  });
391
390
  return agent;
392
391
  }
393
392
 
394
393
  const shipJsonPath = getDowncityJsonPath(agent.projectRoot);
395
394
  const raw = fs.readJsonSync(shipJsonPath) as DowncityConfig;
396
- raw.name = nextName;
395
+ raw.id = nextId;
397
396
  await fs.writeJson(shipJsonPath, raw, { spaces: 2 });
398
397
  emitCliBlock({
399
398
  tone: "success",
400
- title: "Agent name updated",
399
+ title: "Agent id updated",
401
400
  facts: [
402
- { label: "previous", value: agent.name },
403
- { label: "current", value: nextName },
401
+ { label: "previous", value: agent.id },
402
+ { label: "current", value: nextId },
404
403
  { label: "project", value: agent.projectRoot },
405
404
  ],
406
405
  });
407
406
  return {
408
407
  ...agent,
409
- name: nextName,
408
+ id: nextId,
410
409
  };
411
410
  }
412
411
 
@@ -595,11 +594,11 @@ async function runSelectedAgentManager(): Promise<void> {
595
594
  continue;
596
595
  }
597
596
  if (action === "chat") {
598
- await chatCommand({ to: agent.name });
597
+ await chatCommand({ to: agent.id });
599
598
  continue;
600
599
  }
601
- if (action === "configureName") {
602
- agent = await configureAgentName(agent);
600
+ if (action === "configureId") {
601
+ agent = await configureAgentId(agent);
603
602
  continue;
604
603
  }
605
604
  if (action === "configureModel") {
@@ -15,13 +15,13 @@ export type AgentManagerAgentAction =
15
15
  | "stop"
16
16
  | "restart"
17
17
  | "chat"
18
- | "configureName"
18
+ | "configureId"
19
19
  | "configureModel"
20
20
  | "connectChannels"
21
21
  | "back";
22
22
 
23
23
  export interface AgentManagerAgentSummary {
24
- name: string;
24
+ id: string;
25
25
  projectRoot: string;
26
26
  status: "running" | "stopped";
27
27
  modelId?: string;
@@ -14,7 +14,7 @@ import { getDowncityJsonPath } from "@/config/Paths.js";
14
14
  import { PlatformStore } from "@/platform/store/index.js";
15
15
  import { emitCliBlock } from "../shared/CliReporter.js";
16
16
  import { CliError } from "../shared/CliError.js";
17
- import { resolveAgentName } from "../shared/IndexSupport.js";
17
+ import { resolveAgentId } from "../shared/IndexSupport.js";
18
18
 
19
19
  /**
20
20
  * 读取当前 agent 的 execution.modelId。
@@ -100,7 +100,7 @@ export async function agentResetCommand(cwd: string = "."): Promise<void> {
100
100
  emitCliBlock({
101
101
  tone: "info",
102
102
  title: "Agent reset cancelled",
103
- summary: resolveAgentName(projectRoot),
103
+ summary: resolveAgentId(projectRoot),
104
104
  });
105
105
  return;
106
106
  }
@@ -109,7 +109,7 @@ export async function agentResetCommand(cwd: string = "."): Promise<void> {
109
109
  emitCliBlock({
110
110
  tone: "info",
111
111
  title: "Model unchanged",
112
- summary: resolveAgentName(projectRoot),
112
+ summary: resolveAgentId(projectRoot),
113
113
  facts: [
114
114
  { label: "modelId", value: current },
115
115
  { label: "project", value: projectRoot },
@@ -126,7 +126,7 @@ export async function agentResetCommand(cwd: string = "."): Promise<void> {
126
126
  emitCliBlock({
127
127
  tone: "success",
128
128
  title: "Agent reconfigured",
129
- summary: resolveAgentName(projectRoot),
129
+ summary: resolveAgentId(projectRoot),
130
130
  facts: [
131
131
  { label: "previous", value: current || "(none)" },
132
132
  { label: "current", value: nextModelId },
@@ -22,7 +22,7 @@ import type {
22
22
  import { emitCliBlock, emitCliList } from "../shared/CliReporter.js";
23
23
  import { printResult } from "@/utils/cli/CliOutput.js";
24
24
  import { CliError } from "../shared/CliError.js";
25
- import { resolveAgentName } from "../shared/IndexSupport.js";
25
+ import { resolveAgentId } from "../shared/IndexSupport.js";
26
26
  import { resolveRunningManagedAgents } from "../control-plane/ControlPlaneProcess.js";
27
27
 
28
28
  /**
@@ -40,7 +40,7 @@ function toCliRegisteredAgentView(
40
40
  ): CliRegisteredAgentView {
41
41
  const projectRoot = resolve(String(entry.projectRoot || "").trim() || ".");
42
42
  return {
43
- name: resolveAgentName(projectRoot),
43
+ id: resolveAgentId(projectRoot),
44
44
  projectRoot,
45
45
  status: entry.status === "stopped" ? "stopped" : "running",
46
46
  };
@@ -66,7 +66,7 @@ export async function listRegisteredAgentsForCli(): Promise<CliRegisteredAgentVi
66
66
  } satisfies CliRegisteredAgentView;
67
67
  })
68
68
  .sort((left, right) =>
69
- left.name.localeCompare(right.name) || left.projectRoot.localeCompare(right.projectRoot),
69
+ left.id.localeCompare(right.id) || left.projectRoot.localeCompare(right.projectRoot),
70
70
  );
71
71
  }
72
72
 
@@ -77,7 +77,7 @@ export function buildCliAgentPromptChoices(
77
77
  agents: CliRegisteredAgentView[],
78
78
  ): CliAgentPromptChoice[] {
79
79
  return agents.map((agent) => ({
80
- title: agent.name,
80
+ title: agent.id,
81
81
  value: agent.projectRoot,
82
82
  description: `${agent.status} · ${agent.projectRoot}`,
83
83
  }));
@@ -165,7 +165,7 @@ export async function emitRegisteredAgentList(): Promise<void> {
165
165
  summary: `${filteredAgents.length} registered`,
166
166
  items: filteredAgents.map((agent) => ({
167
167
  tone: agent.status === "running" ? "success" : "info",
168
- title: agent.name,
168
+ title: agent.id,
169
169
  facts: [
170
170
  {
171
171
  label: "Project",
@@ -232,7 +232,7 @@ export async function emitRegisteredAgentListWithOptions(options?: {
232
232
  : `${agents.length} registered`,
233
233
  items: agents.map((agent) => ({
234
234
  tone: agent.status === "running" ? "success" : "info",
235
- title: agent.name,
235
+ title: agent.id,
236
236
  facts: [
237
237
  {
238
238
  label: "Project",
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  export type CliRegisteredAgentView = {
6
- name: string;
6
+ id: string;
7
7
  projectRoot: string;
8
8
  status: "running" | "stopped";
9
9
  };
@@ -18,7 +18,7 @@ import fg from "fast-glob";
18
18
  import { getProfileMdPath, getDowncityJsonPath, getSoulMdPath } from "@/config/Paths.js";
19
19
  import {
20
20
  initializeAgentProject,
21
- normalizeDefaultAgentName,
21
+ normalizeDefaultAgentId,
22
22
  } from "@downcity/agent";
23
23
  import type { AgentProjectChannel } from "@downcity/agent";
24
24
  import type { ExecutionBindingConfig } from "@downcity/agent";
@@ -30,7 +30,7 @@ import {
30
30
  } from "@/model/runtime/ExecutionModelBinding.js";
31
31
 
32
32
  type InitPromptResponse = {
33
- name?: string;
33
+ id?: string;
34
34
  primaryModelId?: string;
35
35
  channels?: string[];
36
36
  };
@@ -51,8 +51,8 @@ export async function initCommand(
51
51
  ): Promise<void> {
52
52
  const projectRoot = path.resolve(cwd);
53
53
  const projectBaseName = path.basename(projectRoot);
54
- const defaultAgentName =
55
- normalizeDefaultAgentName(projectBaseName) || projectBaseName;
54
+ const default_agent_id =
55
+ normalizeDefaultAgentId(projectBaseName) || projectBaseName;
56
56
  let allowOverwrite = Boolean(options.force);
57
57
 
58
58
  emitCliBlock({
@@ -96,13 +96,13 @@ export async function initCommand(
96
96
  }
97
97
 
98
98
  // Collect configuration information
99
- // 交互采集(中文):agent name + model + channels。
99
+ // 交互采集(中文):agent id + model + channels。
100
100
  const response = (await prompts([
101
101
  {
102
102
  type: "text",
103
- name: "name",
104
- message: "Agent name",
105
- initial: defaultAgentName,
103
+ name: "id",
104
+ message: "Agent id",
105
+ initial: default_agent_id,
106
106
  },
107
107
  {
108
108
  type: "select",
@@ -124,9 +124,9 @@ export async function initCommand(
124
124
  },
125
125
  ])) as InitPromptResponse;
126
126
 
127
- // 关键点(中文):agent_name 同时用于 `downcity.json.name` 与 init 模板变量渲染,避免两处来源不一致。
128
- const agentName =
129
- String(response.name || "").trim() || defaultAgentName;
127
+ // 关键点(中文):agent_id 同时用于 `downcity.json.id` 与 init 模板变量渲染,避免两处来源不一致。
128
+ const agent_id =
129
+ String(response.id || "").trim() || default_agent_id;
130
130
  const primaryModelId =
131
131
  String(response.primaryModelId || "").trim() || "default";
132
132
  if (modelChoiceIds.length === 0) {
@@ -147,7 +147,7 @@ export async function initCommand(
147
147
  const initResult = await initializeAgentProject(
148
148
  {
149
149
  projectRoot,
150
- agentName,
150
+ id: agent_id,
151
151
  execution,
152
152
  channels: selectedChannels,
153
153
  forceOverwriteShipJson: allowOverwrite,
@@ -172,7 +172,7 @@ export async function initCommand(
172
172
  emitCliBlock({
173
173
  tone: "success",
174
174
  title: "Initialization complete",
175
- summary: agentName,
175
+ summary: agent_id,
176
176
  });
177
177
  emitCliList({
178
178
  tone: "accent",
@@ -13,7 +13,7 @@ import { buildRunArgsFromOptions } from "@/process/daemon/CliArgs.js";
13
13
  import { startDaemonProcess, stopDaemonProcess } from "@/process/daemon/Manager.js";
14
14
  import type { StartOptions } from "@downcity/agent";
15
15
  import { emitCliBlock } from "../shared/CliReporter.js";
16
- import { resolveAgentName } from "../shared/IndexSupport.js";
16
+ import { resolveAgentId } from "../shared/IndexSupport.js";
17
17
  import { checkAgentPreflight } from "../shared/PluginTargetSupport.js";
18
18
  import { CliError } from "../shared/CliError.js";
19
19
 
@@ -51,7 +51,7 @@ export async function restartCommand(
51
51
  emitCliBlock({
52
52
  tone: "success",
53
53
  title: "Agent daemon restarted",
54
- summary: resolveAgentName(projectRoot),
54
+ summary: resolveAgentId(projectRoot),
55
55
  facts: [
56
56
  {
57
57
  label: "Project",
@@ -16,13 +16,15 @@ import {
16
16
  loadDowncityConfig,
17
17
  loadStaticSystemPrompts,
18
18
  shellTools,
19
+ startServer,
19
20
  StaticPromptCatalog,
20
21
  } from "@downcity/agent";
21
22
  import { createBuiltinPlugins } from "@downcity/plugins";
22
23
  import type { StartOptions } from "@downcity/agent";
23
24
  import { CliError } from "../shared/CliError.js";
24
25
  import { createRuntimeModel } from "@/model/runtime/CreateRuntimeModel.js";
25
- import { resolveAgentName } from "../shared/IndexSupport.js";
26
+ import { readPlatformGlobalEnv } from "@/env/ProcessEnv.js";
27
+ import { resolveAgentId } from "../shared/IndexSupport.js";
26
28
 
27
29
  /**
28
30
  * 前台启动入口(由 `agent start` 前台模式与内部 daemon 子进程复用)。
@@ -30,7 +32,7 @@ import { resolveAgentName } from "../shared/IndexSupport.js";
30
32
  * 职责(中文)
31
33
  * - 初始化 agent 状态(配置、日志、services 依赖)
32
34
  * - 解析并合并启动参数(CLI > downcity.json > 默认值)
33
- * - 启动主 HTTP 服务
35
+ * - 启动 agent 本机 RPC 与 city 托管的 HTTP gateway(双端口)
34
36
  * - 启动 services(例如 task cron)
35
37
  * - 统一处理进程信号并优雅停机
36
38
  */
@@ -39,6 +41,7 @@ export async function runCommand(
39
41
  options: StartOptions,
40
42
  ): Promise<void> {
41
43
  const projectRoot = path.resolve(cwd);
44
+ const hostEnv = readPlatformGlobalEnv();
42
45
  // 端口解析(中文):允许 number / string;空值返回 undefined 以便走配置回退链。
43
46
  const parsePort = (
44
47
  value: string | number | undefined,
@@ -57,30 +60,41 @@ export async function runCommand(
57
60
  };
58
61
  // Resolve startup options: CLI flags override built-in defaults.
59
62
  let port: number;
63
+ let rpc_port: number;
60
64
  try {
61
65
  port = parsePort(options.port, "port") ?? 5314;
66
+ rpc_port = parsePort(options.rpcPort, "rpcPort") ?? 15314;
62
67
  } catch (error) {
63
68
  throw new CliError({
64
69
  title: "Invalid start options",
65
70
  note: error instanceof Error ? error.message : String(error),
66
71
  });
67
72
  }
73
+ if (port === rpc_port) {
74
+ throw new CliError({
75
+ title: "Invalid start options",
76
+ note: "port and rpcPort must be different",
77
+ });
78
+ }
68
79
 
69
80
  const host = (options.host ?? "0.0.0.0").trim();
70
- const agentName = resolveAgentName(projectRoot);
81
+ const rpc_host = "127.0.0.1";
82
+ const agentId = resolveAgentId(projectRoot);
71
83
  let currentSystems = loadStaticSystemPrompts(projectRoot);
72
84
  const config = loadDowncityConfig(projectRoot);
73
85
  const model = await createRuntimeModel({
74
86
  config,
87
+ env: hostEnv,
75
88
  });
76
89
 
77
90
  const agent = new Agent({
78
- id: agentName,
91
+ id: agentId,
79
92
  path: projectRoot,
80
93
  instruction: currentSystems,
81
94
  tools: shellTools,
82
95
  plugins: createBuiltinPlugins(),
83
96
  model,
97
+ env: hostEnv,
84
98
  });
85
99
 
86
100
  const promptCatalog = new StaticPromptCatalog({
@@ -94,30 +108,36 @@ export async function runCommand(
94
108
  });
95
109
  promptCatalog.start();
96
110
 
97
- process.env.DC_SERVER_PORT = String(port);
98
- process.env.DC_SERVER_HOST = host;
111
+ process.env.DC_CITY_PORT = String(port);
112
+ process.env.DC_CITY_HOST = host;
113
+ process.env.DC_AGENT_RPC_PORT = String(rpc_port);
114
+ process.env.DC_AGENT_RPC_HOST = rpc_host;
115
+ process.env.DC_AGENT_ID = agentId;
99
116
  process.env.DC_AGENT_PATH = projectRoot;
100
- process.env.DC_AGENT_NAME = agentName;
101
117
 
102
118
  const startResult = await agent.start({
103
- http: {
104
- port,
105
- host,
119
+ rpc: {
120
+ port: rpc_port,
121
+ host: rpc_host,
106
122
  },
107
- rpc: true,
108
123
  plugins: true,
109
124
  });
110
-
111
- const server = startResult.http?.server;
112
- const localRpc = startResult.rpc?.server;
113
- if (!server || !localRpc) {
114
- throw new Error("Agent start did not return expected HTTP/RPC bindings");
125
+ if (!startResult.rpc?.server) {
126
+ throw new Error("Agent start did not return expected RPC binding");
115
127
  }
116
128
 
129
+ const server = await startServer({
130
+ host,
131
+ port,
132
+ getAgentRuntime: () => agent.getRuntime(),
133
+ getAgentContext: () => agent.getContext(),
134
+ sessionCollection: agent.getSessionCollection(),
135
+ });
136
+
117
137
  const agentLogger = agent.getLogger();
118
138
 
119
139
  // 处理进程信号
120
- // 停机顺序(中文):plugin runtimes -> API server -> flush logs。
140
+ // 停机顺序(中文):HTTP gateway -> plugin runtimes / RPC server -> flush logs。
121
141
  let isShuttingDown = false;
122
142
  const shutdown = async (signal: string) => {
123
143
  if (isShuttingDown) return;
@@ -126,6 +146,7 @@ export async function runCommand(
126
146
  agentLogger.info(`Received ${signal} signal, shutting down...`);
127
147
  promptCatalog.stop();
128
148
 
149
+ await server.stop();
129
150
  await agent.stop();
130
151
 
131
152
  // Save logs
@@ -17,7 +17,7 @@ import { startDaemonProcess } from "@/process/daemon/Manager.js";
17
17
  import { buildRunArgsFromOptions } from "@/process/daemon/CliArgs.js";
18
18
  import type { StartOptions } from "@downcity/agent";
19
19
  import { emitCliBlock } from "../shared/CliReporter.js";
20
- import { resolveAgentName } from "../shared/IndexSupport.js";
20
+ import { resolveAgentId } from "../shared/IndexSupport.js";
21
21
  import { checkAgentPreflight } from "../shared/PluginTargetSupport.js";
22
22
  import { CliError } from "../shared/CliError.js";
23
23
 
@@ -55,7 +55,7 @@ export async function startCommand(
55
55
  emitCliBlock({
56
56
  tone: "success",
57
57
  title: "Agent daemon started",
58
- summary: resolveAgentName(projectRoot),
58
+ summary: resolveAgentId(projectRoot),
59
59
  facts: [
60
60
  {
61
61
  label: "Project",
@@ -10,7 +10,7 @@
10
10
  import path from "path";
11
11
  import { stopDaemonProcess } from "@/process/daemon/Manager.js";
12
12
  import { emitCliBlock } from "../shared/CliReporter.js";
13
- import { resolveAgentName } from "../shared/IndexSupport.js";
13
+ import { resolveAgentId } from "../shared/IndexSupport.js";
14
14
 
15
15
  /**
16
16
  * stop 命令执行流程。
@@ -26,7 +26,7 @@ export async function stopCommand(cwd: string = "."): Promise<void> {
26
26
  emitCliBlock({
27
27
  tone: result.stopped ? "success" : "info",
28
28
  title: result.stopped ? "Agent daemon stopped" : "Agent daemon not running",
29
- summary: resolveAgentName(projectRoot),
29
+ summary: resolveAgentId(projectRoot),
30
30
  facts: [
31
31
  {
32
32
  label: "Project",
@@ -42,7 +42,7 @@ import { startCommand } from "../agent/Start.js";
42
42
  import type { StartOptions } from "@downcity/agent";
43
43
  import {
44
44
  injectAgentContext,
45
- resolveAgentName,
45
+ resolveAgentId,
46
46
  sleep,
47
47
  } from "../shared/IndexSupport.js";
48
48
  import { buildRuntimePortFacts } from "../shared/PortHints.js";
@@ -202,11 +202,11 @@ export async function stopCityRuntimeCommand(params?: { timeoutMs?: number }): P
202
202
  try {
203
203
  const result = await runWithSpinner(
204
204
  () => stopDaemonProcess({ projectRoot: item.projectRoot }),
205
- { text: `Stopping ${resolveAgentName(item.projectRoot)}...` },
205
+ { text: `Stopping ${resolveAgentId(item.projectRoot)}...` },
206
206
  );
207
207
  emitCliBlock({
208
208
  tone: result.stopped ? "success" : "info",
209
- title: resolveAgentName(item.projectRoot),
209
+ title: resolveAgentId(item.projectRoot),
210
210
  summary: result.stopped ? "stopped" : "already stopped",
211
211
  facts: [{ label: "project", value: item.projectRoot }],
212
212
  });
@@ -214,7 +214,7 @@ export async function stopCityRuntimeCommand(params?: { timeoutMs?: number }): P
214
214
  } catch (error) {
215
215
  emitCliBlock({
216
216
  tone: "error",
217
- title: resolveAgentName(item.projectRoot),
217
+ title: resolveAgentId(item.projectRoot),
218
218
  summary: "failed",
219
219
  facts: [
220
220
  { label: "project", value: item.projectRoot },
@@ -368,7 +368,7 @@ export async function restartManagedAgents(cliPath: string): Promise<void> {
368
368
  emitCliBlock({
369
369
  tone: "error",
370
370
  title: "Managed agent restart failed",
371
- summary: resolveAgentName(item.projectRoot),
371
+ summary: resolveAgentId(item.projectRoot),
372
372
  facts: [
373
373
  {
374
374
  label: "Project",
@@ -102,7 +102,7 @@ async function runInteractiveProviderCreate(
102
102
  {
103
103
  type: "text",
104
104
  name: "apiKey",
105
- message: "API Key(支持 ${ENV_VAR})",
105
+ message: "API Key",
106
106
  validate: (value: string) =>
107
107
  String(value || "").trim().length > 0 ? true : "apiKey 不能为空",
108
108
  },