downcity 1.1.228 → 1.1.237

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 (328) hide show
  1. package/bin/city/agent/AgentChat.d.ts +1 -1
  2. package/bin/city/agent/AgentChat.js +4 -4
  3. package/bin/city/agent/AgentChatHelpers.d.ts +2 -2
  4. package/bin/city/agent/AgentChatHelpers.js +7 -7
  5. package/bin/city/agent/AgentChatInteractiveRenderer.d.ts +1 -1
  6. package/bin/city/agent/AgentChatInteractiveRenderer.js +2 -2
  7. package/bin/city/agent/AgentChatRemote.d.ts +1 -1
  8. package/bin/city/agent/AgentChatRemote.js +3 -3
  9. package/bin/city/agent/AgentChatToolFormatter.d.ts +1 -1
  10. package/bin/city/agent/AgentChatTui.d.ts +2 -2
  11. package/bin/city/agent/AgentChatTui.js +1 -1
  12. package/bin/city/agent/AgentHistory.d.ts +1 -1
  13. package/bin/city/agent/AgentHistory.js +5 -5
  14. package/bin/city/agent/AgentHttpGateway.js +6 -6
  15. package/bin/city/agent/AgentManager.d.ts.map +1 -1
  16. package/bin/city/agent/AgentManager.js +17 -13
  17. package/bin/city/agent/AgentManager.js.map +1 -1
  18. package/bin/city/agent/AgentManagerHelpers.d.ts +3 -3
  19. package/bin/city/agent/AgentManagerHelpers.d.ts.map +1 -1
  20. package/bin/city/agent/AgentManagerHelpers.js +101 -46
  21. package/bin/city/agent/AgentManagerHelpers.js.map +1 -1
  22. package/bin/city/agent/AgentReset.d.ts.map +1 -1
  23. package/bin/city/agent/AgentReset.js +8 -22
  24. package/bin/city/agent/AgentReset.js.map +1 -1
  25. package/bin/city/agent/AgentSelection.d.ts +1 -1
  26. package/bin/city/agent/AgentSelection.js +8 -8
  27. package/bin/city/agent/Init.js +6 -6
  28. package/bin/city/agent/Init.js.map +1 -1
  29. package/bin/city/agent/Restart.d.ts +1 -1
  30. package/bin/city/agent/Restart.js +8 -8
  31. package/bin/city/agent/Restart.js.map +1 -1
  32. package/bin/city/agent/Run.d.ts +1 -1
  33. package/bin/city/agent/Run.js +6 -6
  34. package/bin/city/agent/Start.d.ts +2 -2
  35. package/bin/city/agent/Start.js +7 -7
  36. package/bin/city/agent/Status.js +3 -3
  37. package/bin/city/agent/Stop.js +3 -3
  38. package/bin/city/agent/control/ExecuteBySession.d.ts +1 -1
  39. package/bin/city/agent/control/ExecuteBySession.js +1 -1
  40. package/bin/city/agent/control/ExecuteInput.d.ts +1 -1
  41. package/bin/city/agent/control/ExecuteInput.js +1 -1
  42. package/bin/city/agent/control/Helpers.d.ts +5 -5
  43. package/bin/city/agent/control/Helpers.js +5 -5
  44. package/bin/city/agent/control/MessageTimeline.d.ts +1 -1
  45. package/bin/city/agent/control/MessageTimeline.js +1 -1
  46. package/bin/city/agent/control/SessionSummaryStore.d.ts +1 -1
  47. package/bin/city/agent/control/SessionSummaryStore.js +3 -3
  48. package/bin/city/agent/control/TaskStore.d.ts +1 -1
  49. package/bin/city/agent/control/TaskStore.js +3 -3
  50. package/bin/city/agent/http/control/ControlApiRoutes.d.ts +1 -1
  51. package/bin/city/agent/http/control/ControlApiRoutes.js +4 -4
  52. package/bin/city/agent/http/control/ControlAuthorizationRoutes.js +1 -1
  53. package/bin/city/agent/http/control/ControlRouter.js +1 -1
  54. package/bin/city/agent/http/control/OverviewRoutes.d.ts +1 -1
  55. package/bin/city/agent/http/control/OverviewRoutes.js +2 -2
  56. package/bin/city/agent/http/control/SessionRoutes.d.ts +1 -1
  57. package/bin/city/agent/http/control/SessionRoutes.js +4 -4
  58. package/bin/city/agent/http/control/TaskRoutes.d.ts +1 -1
  59. package/bin/city/agent/http/control/TaskRoutes.js +3 -3
  60. package/bin/city/agent/http/static/static.js +1 -1
  61. package/bin/city/agent/tui/AgentChatTuiCoordinator.d.ts +2 -2
  62. package/bin/city/agent/tui/AgentChatTuiCoordinator.js +5 -5
  63. package/bin/city/agent/tui/PiTuiChatRenderer.d.ts +2 -2
  64. package/bin/city/agent/tui/PiTuiChatRenderer.js +1 -1
  65. package/bin/city/agent/tui/commands/dispatch.d.ts +2 -2
  66. package/bin/city/agent/tui/commands/index.d.ts +6 -6
  67. package/bin/city/agent/tui/commands/index.js +4 -4
  68. package/bin/city/agent/tui/commands/parse.d.ts +1 -1
  69. package/bin/city/agent/tui/commands/registry.d.ts +1 -1
  70. package/bin/city/agent/tui/commands/resolve.d.ts +1 -1
  71. package/bin/city/agent/tui/commands/resolve.js +1 -1
  72. package/bin/city/agent/tui/components/AssistantMessage.js +4 -4
  73. package/bin/city/agent/tui/components/ChatEditor.js +5 -5
  74. package/bin/city/agent/tui/components/MessageList.d.ts +1 -1
  75. package/bin/city/agent/tui/components/MessageList.js +7 -7
  76. package/bin/city/agent/tui/components/NoticeMessage.js +1 -1
  77. package/bin/city/agent/tui/components/StatusLine.d.ts +1 -1
  78. package/bin/city/agent/tui/components/StatusLine.js +2 -2
  79. package/bin/city/agent/tui/components/StatusMessage.d.ts +1 -1
  80. package/bin/city/agent/tui/components/StatusMessage.js +1 -1
  81. package/bin/city/agent/tui/components/ToolCallBlock.d.ts +1 -1
  82. package/bin/city/agent/tui/components/ToolCallBlock.js +3 -3
  83. package/bin/city/agent/tui/components/UserMessage.js +2 -2
  84. package/bin/city/agent/tui/components/editor/FileMentionProvider.d.ts +1 -1
  85. package/bin/city/agent/tui/components/editor/WrappingSelectList.js +1 -1
  86. package/bin/city/agent/tui/components/index.d.ts +6 -6
  87. package/bin/city/agent/tui/components/index.js +6 -6
  88. package/bin/city/agent/tui/controllers/StreamingUI.d.ts +1 -1
  89. package/bin/city/agent/tui/controllers/StreamingUI.js +3 -3
  90. package/bin/city/agent/tui/dialogs/SessionPicker.d.ts +1 -1
  91. package/bin/city/agent/tui/dialogs/SessionPicker.js +7 -7
  92. package/bin/city/agent/tui/index.d.ts +3 -3
  93. package/bin/city/agent/tui/index.js +2 -2
  94. package/bin/city/agent/tui/theme/index.d.ts +4 -4
  95. package/bin/city/agent/tui/theme/index.js +2 -2
  96. package/bin/city/agent/tui/theme/pi-tui-theme.js +1 -1
  97. package/bin/city/agent/tui/theme/theme.d.ts +1 -1
  98. package/bin/city/agent/tui/theme/theme.js +1 -1
  99. package/bin/city/command/AgentCommand.js +16 -16
  100. package/bin/city/command/ChatAuthCommand.js +4 -4
  101. package/bin/city/command/ChatCommand.js +3 -3
  102. package/bin/city/command/ConfigCommand.js +5 -5
  103. package/bin/city/command/EnvCommand.js +5 -5
  104. package/bin/city/command/FederationCommand.js +4 -4
  105. package/bin/city/command/GatewayCommand.d.ts +6 -9
  106. package/bin/city/command/GatewayCommand.d.ts.map +1 -1
  107. package/bin/city/command/GatewayCommand.js +15 -66
  108. package/bin/city/command/GatewayCommand.js.map +1 -1
  109. package/bin/city/command/ManagedPluginActionCommand.js +4 -4
  110. package/bin/city/command/PluginCommand.js +7 -7
  111. package/bin/city/command/PluginScheduleCommand.js +4 -4
  112. package/bin/city/command/TokenCommand.js +3 -3
  113. package/bin/city/command/plugin/PluginHelpers.d.ts.map +1 -1
  114. package/bin/city/command/plugin/PluginHelpers.js +13 -23
  115. package/bin/city/command/plugin/PluginHelpers.js.map +1 -1
  116. package/bin/city/command/token/TokenActions.js +3 -3
  117. package/bin/city/command/token/TokenPrompts.js +3 -3
  118. package/bin/city/command/token/TokenRender.js +2 -2
  119. package/bin/city/env/ProcessEnv.d.ts +7 -1
  120. package/bin/city/env/ProcessEnv.d.ts.map +1 -1
  121. package/bin/city/env/ProcessEnv.js +30 -3
  122. package/bin/city/env/ProcessEnv.js.map +1 -1
  123. package/bin/city/index.d.ts +1 -1
  124. package/bin/city/index.d.ts.map +1 -1
  125. package/bin/city/index.js +13 -14
  126. package/bin/city/index.js.map +1 -1
  127. package/bin/city/process/daemon/CliArgs.d.ts +1 -1
  128. package/bin/city/process/daemon/CliArgs.js +1 -1
  129. package/bin/city/process/daemon/Client.d.ts +1 -1
  130. package/bin/city/process/daemon/Client.js +2 -2
  131. package/bin/city/process/daemon/Manager.d.ts +1 -1
  132. package/bin/city/process/daemon/Manager.js +5 -5
  133. package/bin/city/process/registry/AgentHostRuntime.js +1 -1
  134. package/bin/city/process/registry/CityPaths.d.ts +4 -4
  135. package/bin/city/process/registry/CityPaths.js +4 -4
  136. package/bin/city/process/registry/CityRegistry.d.ts +1 -1
  137. package/bin/city/process/registry/CityRegistry.d.ts.map +1 -1
  138. package/bin/city/process/registry/CityRegistry.js +2 -7
  139. package/bin/city/process/registry/CityRegistry.js.map +1 -1
  140. package/bin/city/runtime/auth/AuthMiddleware.d.ts +1 -1
  141. package/bin/city/runtime/auth/AuthMiddleware.js +1 -1
  142. package/bin/city/runtime/auth/AuthRoutes.d.ts +1 -1
  143. package/bin/city/runtime/auth/AuthRoutes.js +3 -3
  144. package/bin/city/runtime/auth/AuthService.d.ts +1 -1
  145. package/bin/city/runtime/auth/AuthService.js +4 -4
  146. package/bin/city/runtime/auth/AuthStore.js +3 -3
  147. package/bin/city/runtime/auth/CliAuthStateStore.js +1 -1
  148. package/bin/city/runtime/auth/RoutePolicy.d.ts +2 -2
  149. package/bin/city/runtime/auth/RoutePolicy.js +2 -2
  150. package/bin/city/runtime/city-model/CityAiServiceBinding.js +1 -1
  151. package/bin/city/runtime/city-model/CreateRuntimeModel.js +1 -1
  152. package/bin/city/runtime/city-model/ExecutionModelBinding.d.ts +1 -1
  153. package/bin/city/runtime/city-model/ExecutionModelBinding.js +3 -3
  154. package/bin/city/runtime/gateway/runtime/GatewayInit.d.ts +1 -1
  155. package/bin/city/runtime/gateway/runtime/GatewayInit.js +5 -5
  156. package/bin/city/runtime/plugins/CityBuiltinPlugins.js +2 -2
  157. package/bin/city/runtime/store/StoreChannelAccountRepository.d.ts +1 -1
  158. package/bin/city/runtime/store/StoreChannelAccountRepository.js +2 -2
  159. package/bin/city/runtime/store/StoreEnvRepository.d.ts +1 -1
  160. package/bin/city/runtime/store/StoreEnvRepository.js +2 -2
  161. package/bin/city/runtime/store/StoreSchema.d.ts +1 -1
  162. package/bin/city/runtime/store/StoreSecureSettings.d.ts +1 -1
  163. package/bin/city/runtime/store/StoreSecureSettings.js +2 -2
  164. package/bin/city/runtime/store/crypto.js +1 -1
  165. package/bin/city/runtime/store/index.d.ts +1 -1
  166. package/bin/city/runtime/store/index.js +6 -6
  167. package/bin/city/shared/Alias.js +1 -1
  168. package/bin/city/shared/ChatManager.js +4 -4
  169. package/bin/city/shared/CityAgentRuntime.d.ts +2 -3
  170. package/bin/city/shared/CityAgentRuntime.d.ts.map +1 -1
  171. package/bin/city/shared/CityAgentRuntime.js +8 -16
  172. package/bin/city/shared/CityAgentRuntime.js.map +1 -1
  173. package/bin/city/shared/CityBalance.d.ts +1 -1
  174. package/bin/city/shared/CityBalance.js +2 -2
  175. package/bin/city/shared/CityManager.d.ts +1 -4
  176. package/bin/city/shared/CityManager.d.ts.map +1 -1
  177. package/bin/city/shared/CityManager.js +8 -16
  178. package/bin/city/shared/CityManager.js.map +1 -1
  179. package/bin/city/shared/CityStateStore.d.ts +4 -4
  180. package/bin/city/shared/CityStateStore.js +1 -1
  181. package/bin/city/shared/CityUserLogin.d.ts +1 -1
  182. package/bin/city/shared/CityUserLogin.js +2 -2
  183. package/bin/city/shared/CityUserManager.d.ts +1 -1
  184. package/bin/city/shared/CityUserManager.js +1 -1
  185. package/bin/city/shared/FederationConnection.d.ts +1 -1
  186. package/bin/city/shared/FederationConnection.js +7 -7
  187. package/bin/city/shared/InteractiveLocale.d.ts +1 -1
  188. package/bin/city/shared/InteractiveLocale.js +4 -4
  189. package/bin/city/shared/ManagedPluginRemote.js +3 -3
  190. package/bin/city/shared/PluginTargetSupport.d.ts +2 -3
  191. package/bin/city/shared/PluginTargetSupport.d.ts.map +1 -1
  192. package/bin/city/shared/PluginTargetSupport.js +7 -15
  193. package/bin/city/shared/PluginTargetSupport.js.map +1 -1
  194. package/bin/city/shared/Update.js +4 -4
  195. package/bin/city/shared/Update.js.map +1 -1
  196. package/bin/city/tui/CityDashboard.d.ts +4 -3
  197. package/bin/city/tui/CityDashboard.d.ts.map +1 -1
  198. package/bin/city/tui/CityDashboard.js +11 -44
  199. package/bin/city/tui/CityDashboard.js.map +1 -1
  200. package/bin/city/tui/FederationManagerFormat.d.ts +5 -5
  201. package/bin/city/tui/FederationManagerFormat.js +4 -4
  202. package/bin/city/tui/FederationManagerFormat.js.map +1 -1
  203. package/bin/city/tui/FederationManagerPrompts.d.ts +1 -1
  204. package/bin/city/tui/FederationManagerPrompts.js +3 -3
  205. package/bin/city/tui/FederationManagerState.d.ts +5 -5
  206. package/bin/city/tui/FederationManagerState.d.ts.map +1 -1
  207. package/bin/city/tui/FederationManagerState.js +8 -8
  208. package/bin/city/tui/FederationManagerTui.d.ts.map +1 -1
  209. package/bin/city/tui/FederationManagerTui.js +57 -34
  210. package/bin/city/tui/FederationManagerTui.js.map +1 -1
  211. package/bin/city/tui/Prompts.d.ts +2 -0
  212. package/bin/city/tui/Prompts.d.ts.map +1 -1
  213. package/bin/city/tui/Prompts.js +42 -15
  214. package/bin/city/tui/Prompts.js.map +1 -1
  215. package/bin/city/types/CityState.d.ts +2 -2
  216. package/bin/city/utils/cli/CliOutput.d.ts +1 -1
  217. package/bin/city/utils/cli/CliOutput.js +1 -1
  218. package/bin/downcity.d.ts +11 -0
  219. package/bin/downcity.d.ts.map +1 -0
  220. package/bin/downcity.js +25 -0
  221. package/bin/downcity.js.map +1 -0
  222. package/bin/downfed.d.ts +11 -0
  223. package/bin/downfed.d.ts.map +1 -0
  224. package/bin/downfed.js +25 -0
  225. package/bin/downfed.js.map +1 -0
  226. package/bin/federation/admin/commands/accounts.d.ts +1 -1
  227. package/bin/federation/admin/commands/accounts.js +2 -2
  228. package/bin/federation/admin/commands/balance.d.ts +1 -1
  229. package/bin/federation/admin/commands/balance.js +2 -2
  230. package/bin/federation/admin/commands/cities.d.ts +1 -1
  231. package/bin/federation/admin/commands/cities.js +2 -2
  232. package/bin/federation/admin/commands/config.d.ts +1 -1
  233. package/bin/federation/admin/commands/custom.d.ts +1 -1
  234. package/bin/federation/admin/commands/custom.js +2 -2
  235. package/bin/federation/admin/commands/instruction.d.ts +1 -1
  236. package/bin/federation/admin/commands/instruction.js +1 -1
  237. package/bin/federation/admin/commands/models.d.ts +1 -1
  238. package/bin/federation/admin/commands/models.js +2 -2
  239. package/bin/federation/admin/commands/payment.d.ts +1 -1
  240. package/bin/federation/admin/commands/payment.js +3 -3
  241. package/bin/federation/admin/commands/service-env.d.ts +1 -1
  242. package/bin/federation/admin/commands/service-env.js +2 -2
  243. package/bin/federation/admin/commands/usage.d.ts +1 -1
  244. package/bin/federation/admin/commands/usage.js +2 -2
  245. package/bin/federation/admin/loop.d.ts +2 -2
  246. package/bin/federation/admin/loop.js +12 -12
  247. package/bin/federation/app.js +11 -11
  248. package/bin/federation/auth/admin.d.ts +1 -1
  249. package/bin/federation/auth/admin.js +2 -2
  250. package/bin/federation/core/session.d.ts +1 -1
  251. package/bin/federation/core/session.js +1 -1
  252. package/bin/federation/core/stripe.js +1 -1
  253. package/bin/federation/core/ui.d.ts +1 -1
  254. package/bin/federation/core/ui.js +1 -1
  255. package/bin/federation/create/commands/create.js +4 -4
  256. package/bin/federation/deploy/commands/deploy.js +5 -5
  257. package/bin/federation/deploy/config/FederationDeployTargetResolver.d.ts +1 -1
  258. package/bin/federation/deploy/config/FederationDeployTargetResolver.js +1 -1
  259. package/bin/federation/deploy/config/FederationProjectConfigReader.d.ts +1 -1
  260. package/bin/federation/deploy/config/FederationProjectConfigReader.js +1 -1
  261. package/bin/federation/deploy/config/FederationProjectEnvLoader.d.ts +1 -1
  262. package/bin/federation/deploy/runtime/CloudflareAccountResolver.d.ts +1 -1
  263. package/bin/federation/deploy/runtime/CloudflareAccountResolver.js +5 -5
  264. package/bin/federation/deploy/runtime/CloudflareWorkersDeployer.d.ts +1 -1
  265. package/bin/federation/deploy/runtime/CloudflareWorkersDeployer.js +10 -10
  266. package/bin/federation/deploy/runtime/CommandRunner.js +1 -1
  267. package/bin/federation/deploy/runtime/D1DatabaseResolver.d.ts +1 -1
  268. package/bin/federation/deploy/runtime/D1DatabaseResolver.js +4 -4
  269. package/bin/federation/deploy/runtime/PackageScriptRunner.js +2 -2
  270. package/bin/federation/deploy/runtime/WranglerConfigWriter.d.ts +1 -1
  271. package/bin/federation/index.js +10 -10
  272. package/bin/federation/server/FederationServerManager.d.ts +1 -1
  273. package/bin/federation/server/FederationServerManager.js +4 -4
  274. package/bin/federation/server/FederationServerWorkspace.js +6 -6
  275. package/bin/federation/tui/AdminTuiRuntime.d.ts +1 -1
  276. package/bin/federation/tui/AdminTuiRuntime.js +1 -1
  277. package/bin/federation/tui/FederationDashboard.d.ts +2 -2
  278. package/bin/federation/tui/FederationDashboard.js +3 -3
  279. package/bin/federation/tui/Prompts.d.ts.map +1 -1
  280. package/bin/federation/tui/Prompts.js +20 -10
  281. package/bin/federation/tui/Prompts.js.map +1 -1
  282. package/bin/index.js +3 -3
  283. package/bin/shared/CliLocale.d.ts +1 -1
  284. package/bin/shared/CliReporter.d.ts +1 -1
  285. package/bin/shared/IndexSupport.js +2 -2
  286. package/bin/shared/tui/ManagedTuiRuntime.d.ts +2 -1
  287. package/bin/shared/tui/ManagedTuiRuntime.d.ts.map +1 -1
  288. package/bin/shared/tui/ManagedTuiRuntime.js +8 -2
  289. package/bin/shared/tui/ManagedTuiRuntime.js.map +1 -1
  290. package/bin/shared/tui/TuiComponents.d.ts +13 -11
  291. package/bin/shared/tui/TuiComponents.d.ts.map +1 -1
  292. package/bin/shared/tui/TuiComponents.js +142 -102
  293. package/bin/shared/tui/TuiComponents.js.map +1 -1
  294. package/bin/shared/tui/TuiText.d.ts +8 -0
  295. package/bin/shared/tui/TuiText.d.ts.map +1 -1
  296. package/bin/shared/tui/TuiText.js +12 -0
  297. package/bin/shared/tui/TuiText.js.map +1 -1
  298. package/bin/shared/types/TuiPrompt.d.ts +2 -2
  299. package/bin/shared/types/TuiPrompt.d.ts.map +1 -1
  300. package/package.json +7 -7
  301. package/bin/city/process/registry/CityRuntime.d.ts +0 -21
  302. package/bin/city/process/registry/CityRuntime.d.ts.map +0 -1
  303. package/bin/city/process/registry/CityRuntime.js +0 -45
  304. package/bin/city/process/registry/CityRuntime.js.map +0 -1
  305. package/bin/city/runtime/gateway/runtime/GatewayAuthBootstrap.d.ts +0 -25
  306. package/bin/city/runtime/gateway/runtime/GatewayAuthBootstrap.d.ts.map +0 -1
  307. package/bin/city/runtime/gateway/runtime/GatewayAuthBootstrap.js +0 -56
  308. package/bin/city/runtime/gateway/runtime/GatewayAuthBootstrap.js.map +0 -1
  309. package/bin/city/runtime/gateway/runtime/GatewayProcess.d.ts +0 -62
  310. package/bin/city/runtime/gateway/runtime/GatewayProcess.d.ts.map +0 -1
  311. package/bin/city/runtime/gateway/runtime/GatewayProcess.js +0 -433
  312. package/bin/city/runtime/gateway/runtime/GatewayProcess.js.map +0 -1
  313. package/bin/city/runtime/gateway/runtime/GatewayStatus.d.ts +0 -18
  314. package/bin/city/runtime/gateway/runtime/GatewayStatus.d.ts.map +0 -1
  315. package/bin/city/runtime/gateway/runtime/GatewayStatus.js +0 -135
  316. package/bin/city/runtime/gateway/runtime/GatewayStatus.js.map +0 -1
  317. package/bin/city/shared/PortHints.d.ts +0 -35
  318. package/bin/city/shared/PortHints.d.ts.map +0 -1
  319. package/bin/city/shared/PortHints.js +0 -58
  320. package/bin/city/shared/PortHints.js.map +0 -1
  321. package/bin/city/shared/PublicHostEnv.d.ts +0 -14
  322. package/bin/city/shared/PublicHostEnv.d.ts.map +0 -1
  323. package/bin/city/shared/PublicHostEnv.js +0 -104
  324. package/bin/city/shared/PublicHostEnv.js.map +0 -1
  325. package/bin/city/shared/PublicHostEnvTypes.d.ts +0 -35
  326. package/bin/city/shared/PublicHostEnvTypes.d.ts.map +0 -1
  327. package/bin/city/shared/PublicHostEnvTypes.js +0 -5
  328. package/bin/city/shared/PublicHostEnvTypes.js.map +0 -1
@@ -8,7 +8,7 @@
8
8
  * - 远程访问统一走 `RemoteAgent({ url })`,不再在 CLI 侧维护第二套 HTTP SDK transport。
9
9
  * - 远程连接、session 创建/列表等操作委托给 `AgentChatRemote.ts`。
10
10
  */
11
- import type { AgentChatCliOptions } from "@/city/agent/AgentChatTypes.js";
11
+ import type { AgentChatCliOptions } from "./AgentChatTypes.js";
12
12
  /**
13
13
  * `city agent chat` 统一入口。
14
14
  */
@@ -8,10 +8,10 @@
8
8
  * - 远程访问统一走 `RemoteAgent({ url })`,不再在 CLI 侧维护第二套 HTTP SDK transport。
9
9
  * - 远程连接、session 创建/列表等操作委托给 `AgentChatRemote.ts`。
10
10
  */
11
- import { emitCliBlock } from "@/shared/CliReporter.js";
12
- import { createRemoteChatSession, listRemoteChatSessions, } from "@/city/agent/AgentChatRemote.js";
13
- import { run_agent_chat_tui } from "@/city/agent/AgentChatTui.js";
14
- import { normalizeChatMessage, resolveAgentChatSessionOptions, resolveChatTargetAgentId, resolveInteractiveChatSession, runOneShotChat, runSdkPromptTurn, } from "@/city/agent/AgentChatHelpers.js";
11
+ import { emitCliBlock } from "../../shared/CliReporter.js";
12
+ import { createRemoteChatSession, listRemoteChatSessions, } from "./AgentChatRemote.js";
13
+ import { run_agent_chat_tui } from "./AgentChatTui.js";
14
+ import { normalizeChatMessage, resolveAgentChatSessionOptions, resolveChatTargetAgentId, resolveInteractiveChatSession, runOneShotChat, runSdkPromptTurn, } from "./AgentChatHelpers.js";
15
15
  /**
16
16
  * `city agent chat` 统一入口。
17
17
  */
@@ -9,8 +9,8 @@
9
9
  * - 远程连接、session 创建/列表等操作委托给 `AgentChatRemote.ts`。
10
10
  */
11
11
  import { RemoteAgent } from "@downcity/agent";
12
- import type { AgentChatCliOptions, AgentChatExecutionOutcome, AgentChatSessionOptions } from "@/city/agent/AgentChatTypes.js";
13
- import type { AgentChatInteractiveRendererPort } from "@/city/types/AgentChatInteractive.js";
12
+ import type { AgentChatCliOptions, AgentChatExecutionOutcome, AgentChatSessionOptions } from "./AgentChatTypes.js";
13
+ import type { AgentChatInteractiveRendererPort } from "../types/AgentChatInteractive.js";
14
14
  export type ResolvedAgentChatTarget = {
15
15
  /** 目标 agent id。 */
16
16
  agentId: string;
@@ -8,13 +8,13 @@
8
8
  * - 远程访问统一走 `RemoteAgent({ url })`,不再在 CLI 侧维护第二套 HTTP SDK transport。
9
9
  * - 远程连接、session 创建/列表等操作委托给 `AgentChatRemote.ts`。
10
10
  */
11
- import prompts from "@/city/tui/Prompts.js";
12
- import { emitCliBlock } from "@/shared/CliReporter.js";
13
- import { printResult } from "@/city/utils/cli/CliOutput.js";
14
- import { resolveProjectRootByAgentId, validateAgentProjectRoot, } from "@/city/shared/PluginTargetSupport.js";
15
- import { listRegisteredAgentsForCli } from "@/city/agent/AgentSelection.js";
16
- import { createAgentChatSessionId, createRemoteAgent, createRemoteChatSession, getOrCreateRemoteSession, buildAgentChatFailureText, listRemoteChatSessions, } from "@/city/agent/AgentChatRemote.js";
17
- import { AGENT_CHAT_DEFAULT_SESSION_ID, } from "@/city/agent/AgentChatTypes.js";
11
+ import prompts from "../tui/Prompts.js";
12
+ import { emitCliBlock } from "../../shared/CliReporter.js";
13
+ import { printResult } from "../utils/cli/CliOutput.js";
14
+ import { resolveProjectRootByAgentId, validateAgentProjectRoot, } from "../shared/PluginTargetSupport.js";
15
+ import { listRegisteredAgentsForCli } from "./AgentSelection.js";
16
+ import { createAgentChatSessionId, createRemoteAgent, createRemoteChatSession, getOrCreateRemoteSession, buildAgentChatFailureText, listRemoteChatSessions, } from "./AgentChatRemote.js";
17
+ import { AGENT_CHAT_DEFAULT_SESSION_ID, } from "./AgentChatTypes.js";
18
18
  export function normalizeChatMessage(input) {
19
19
  return String(input || "").trim();
20
20
  }
@@ -7,7 +7,7 @@
7
7
  * - 把“终端展示状态机”从主命令流程中拆出,降低 `AgentChat.ts` 复杂度。
8
8
  */
9
9
  import type { AgentSessionEvent } from "@downcity/agent";
10
- import type { AgentChatInteractiveRenderSnapshot, AgentChatInteractiveRendererPort } from "@/city/types/AgentChatInteractive.js";
10
+ import type { AgentChatInteractiveRenderSnapshot, AgentChatInteractiveRendererPort } from "../types/AgentChatInteractive.js";
11
11
  /**
12
12
  * 交互式单轮渲染器。
13
13
  */
@@ -7,8 +7,8 @@
7
7
  * - 把“终端展示状态机”从主命令流程中拆出,降低 `AgentChat.ts` 复杂度。
8
8
  */
9
9
  import chalk from "chalk";
10
- import { createSpinner, shouldRenderSpinner, } from "@/city/utils/cli/Spinner.js";
11
- import { format_tool_call_block, format_tool_result_block, } from "@/city/agent/AgentChatToolFormatter.js";
10
+ import { createSpinner, shouldRenderSpinner, } from "../utils/cli/Spinner.js";
11
+ import { format_tool_call_block, format_tool_result_block, } from "./AgentChatToolFormatter.js";
12
12
  function format_approval_request_block(event) {
13
13
  const operation = event.operation || (event.toolName === "shell_write" ? "write" : "exec");
14
14
  const command_label = operation === "write" ? "input_preview" : "cmd";
@@ -6,7 +6,7 @@
6
6
  * - 不处理命令行交互与本地 agent 解析,只负责与 daemon RPC 的通信侧逻辑。
7
7
  */
8
8
  import { RemoteAgent, type AgentSessionSummary, type AgentSession } from "@downcity/agent";
9
- import { type AgentChatSessionSummaryView, type AgentChatTransportOptions } from "@/city/agent/AgentChatTypes.js";
9
+ import { type AgentChatSessionSummaryView, type AgentChatTransportOptions } from "./AgentChatTypes.js";
10
10
  /**
11
11
  * 远端访问目标。
12
12
  */
@@ -5,10 +5,10 @@
5
5
  * - 封装 `RemoteAgent` 创建、session 列表、session 创建/获取等远程操作。
6
6
  * - 不处理命令行交互与本地 agent 解析,只负责与 daemon RPC 的通信侧逻辑。
7
7
  */
8
- import { generateId } from "@/city/utils/Id.js";
8
+ import { generateId } from "../utils/Id.js";
9
9
  import { RemoteAgent, } from "@downcity/agent";
10
- import { resolveDaemonRpcEndpoint } from "@/city/process/daemon/Client.js";
11
- import { AGENT_CHAT_DEFAULT_SESSION_ID, AGENT_CHAT_NEW_SESSION_ID_PREFIX, } from "@/city/agent/AgentChatTypes.js";
10
+ import { resolveDaemonRpcEndpoint } from "../process/daemon/Client.js";
11
+ import { AGENT_CHAT_DEFAULT_SESSION_ID, AGENT_CHAT_NEW_SESSION_ID_PREFIX, } from "./AgentChatTypes.js";
12
12
  /**
13
13
  * 生成 CLI chat 专用的新 sessionId。
14
14
  */
@@ -7,7 +7,7 @@
7
7
  * - 为后续继续贴近 Codex CLI / Claude Code 风格保留独立演进边界。
8
8
  */
9
9
  import type { JsonValue } from "@downcity/agent";
10
- import type { AgentChatToolDisplayBlock } from "@/city/types/AgentChatInteractive.js";
10
+ import type { AgentChatToolDisplayBlock } from "../types/AgentChatInteractive.js";
11
11
  /**
12
12
  * 格式化 tool 开始事件。
13
13
  */
@@ -5,8 +5,8 @@
5
5
  * - 该模块只做协调器创建与生命周期对接,不再直接持有 UI 状态。
6
6
  * - 真实的渲染、输入、布局逻辑在 `tui/AgentChatTuiCoordinator` 中。
7
7
  */
8
- import type { AgentChatInteractiveRendererPort } from "@/city/types/AgentChatInteractive.js";
9
- import type { AgentChatSessionSummaryView } from "@/city/agent/AgentChatTypes.js";
8
+ import type { AgentChatInteractiveRendererPort } from "../types/AgentChatInteractive.js";
9
+ import type { AgentChatSessionSummaryView } from "./AgentChatTypes.js";
10
10
  /**
11
11
  * 启动 city agent chat 的交互式 TUI。
12
12
  *
@@ -5,7 +5,7 @@
5
5
  * - 该模块只做协调器创建与生命周期对接,不再直接持有 UI 状态。
6
6
  * - 真实的渲染、输入、布局逻辑在 `tui/AgentChatTuiCoordinator` 中。
7
7
  */
8
- import { AgentChatTuiCoordinator } from "@/city/agent/tui/AgentChatTuiCoordinator.js";
8
+ import { AgentChatTuiCoordinator } from "./tui/AgentChatTuiCoordinator.js";
9
9
  /**
10
10
  * 启动 city agent chat 的交互式 TUI。
11
11
  *
@@ -6,7 +6,7 @@
6
6
  * - 清理范围固定为 session messages、chat audit、channel route 三处。
7
7
  * - 命令必须显式传 `--hard`,避免误删运行时历史。
8
8
  */
9
- import type { AgentHistoryCleanOptions, AgentHistoryCleanResult } from "@/city/agent/AgentHistoryTypes.js";
9
+ import type { AgentHistoryCleanOptions, AgentHistoryCleanResult } from "./AgentHistoryTypes.js";
10
10
  /**
11
11
  * 执行 `city agent history clean`。
12
12
  */
@@ -8,11 +8,11 @@
8
8
  */
9
9
  import fs from "fs-extra";
10
10
  import path from "node:path";
11
- import { getDowncityChannelDirPath, getDowncityChannelMetaPath, getDowncityChatSessionDirPath, getDowncitySessionDirPath, } from "@/city/config/Paths.js";
12
- import { CliError } from "@/shared/CliError.js";
13
- import { emitCliBlock } from "@/shared/CliReporter.js";
14
- import { printResult } from "@/city/utils/cli/CliOutput.js";
15
- import { resolveAgentId } from "@/shared/IndexSupport.js";
11
+ import { getDowncityChannelDirPath, getDowncityChannelMetaPath, getDowncityChatSessionDirPath, getDowncitySessionDirPath, } from "../config/Paths.js";
12
+ import { CliError } from "../../shared/CliError.js";
13
+ import { emitCliBlock } from "../../shared/CliReporter.js";
14
+ import { printResult } from "../utils/cli/CliOutput.js";
15
+ import { resolveAgentId } from "../../shared/IndexSupport.js";
16
16
  function normalizeText(input) {
17
17
  return String(input || "").trim();
18
18
  }
@@ -13,12 +13,12 @@ import http from "node:http";
13
13
  import { Readable } from "node:stream";
14
14
  import { finished } from "node:stream/promises";
15
15
  import { logger as serverLogger } from "@downcity/agent/internal/utils/logger/Logger.js";
16
- import { createExecuteRouter } from "@/city/agent/http/execute/execute.js";
17
- import { healthRouter } from "@/city/agent/http/health/health.js";
18
- import { createPluginsRouter } from "@/city/agent/http/plugins/plugins.js";
19
- import { createStaticRouter } from "@/city/agent/http/static/static.js";
20
- import { createControlRouter } from "@/city/agent/http/control/ControlRouter.js";
21
- import { createShellRouter } from "@/city/agent/http/shell/shell.js";
16
+ import { createExecuteRouter } from "./http/execute/execute.js";
17
+ import { healthRouter } from "./http/health/health.js";
18
+ import { createPluginsRouter } from "./http/plugins/plugins.js";
19
+ import { createStaticRouter } from "./http/static/static.js";
20
+ import { createControlRouter } from "./http/control/ControlRouter.js";
21
+ import { createShellRouter } from "./http/shell/shell.js";
22
22
  /**
23
23
  * 创建 Agent HTTP 网关 Hono 应用。
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentManager.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH;;GAEG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAuChE"}
1
+ {"version":3,"file":"AgentManager.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH;;GAEG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAmChE"}
@@ -5,16 +5,18 @@
5
5
  * - 裸 `city agent` 在交互式终端里进入这里,而不是只输出静态 help。
6
6
  * - 保留原有脚本化子命令不变,只把高频的人类操作收敛成轻量 manager。
7
7
  */
8
- import { emitCliBlock } from "@/shared/CliReporter.js";
9
- import { isInteractiveTerminal, loadAgentSummaries, promptAgentListSelection, runCreateFlow, runSelectedAgentManager, } from "@/city/agent/AgentManagerHelpers.js";
8
+ import { emitCliBlock } from "../../shared/CliReporter.js";
9
+ import { isInteractiveTerminal, loadAgentSummaries, promptAgentListSelection, runCreateFlow, runSelectedAgentManager, } from "./AgentManagerHelpers.js";
10
10
  /**
11
11
  * 运行 `city agent` 交互式管理器。
12
12
  */
13
13
  export async function runInteractiveAgentManager() {
14
14
  if (!isInteractiveTerminal())
15
15
  return;
16
+ let last_message = "";
16
17
  while (true) {
17
- const selection = await promptAgentListSelection();
18
+ const selection = await promptAgentListSelection(last_message);
19
+ last_message = "";
18
20
  if (!selection || selection.type === "exit") {
19
21
  emitCliBlock({
20
22
  tone: "info",
@@ -25,29 +27,31 @@ export async function runInteractiveAgentManager() {
25
27
  try {
26
28
  if (selection.type === "create") {
27
29
  await runCreateFlow();
30
+ last_message = "Agent 创建流程已结束";
28
31
  continue;
29
32
  }
30
33
  if (selection.type === "agent") {
31
34
  const agents = await loadAgentSummaries();
32
35
  const agent = agents.find((item) => item.projectRoot === selection.project_root);
33
36
  if (!agent) {
34
- emitCliBlock({
35
- tone: "info",
36
- title: "Agent not found",
37
- note: selection.project_root,
38
- });
37
+ last_message = `Agent 不存在:${selection.project_root}`;
39
38
  continue;
40
39
  }
41
40
  await runSelectedAgentManager(agent);
41
+ last_message = `已返回 Agent 列表`;
42
42
  }
43
43
  }
44
44
  catch (error) {
45
- emitCliBlock({
46
- tone: "error",
47
- title: "Agent manager action failed",
48
- note: error instanceof Error ? error.message : String(error),
49
- });
45
+ last_message = `操作失败:${format_agent_manager_error(error)}`;
50
46
  }
51
47
  }
52
48
  }
49
+ function format_agent_manager_error(error) {
50
+ if (error && typeof error === "object" && "note" in error) {
51
+ const note = String(error.note ?? "").trim();
52
+ if (note)
53
+ return note;
54
+ }
55
+ return error instanceof Error ? error.message : String(error);
56
+ }
53
57
  //# sourceMappingURL=AgentManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentManager.js","sourceRoot":"","sources":["../../../src/city/agent/AgentManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B;IAC9C,IAAI,CAAC,qBAAqB,EAAE;QAAE,OAAO;IAErC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,MAAM,wBAAwB,EAAE,CAAC;QACnD,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC5C,YAAY,CAAC;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,sBAAsB;aAC9B,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,IAAI,SAAS,CAAC,I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I,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACrE,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import type { DowncityConfig } from "@downcity/agent";
9
9
  import type { StoredChannelAccount, StoredChannelAccountChannel } from "@downcity/agent";
10
- import type { AgentManagerAgentAction, AgentManagerConfigAction, AgentManagerListSelection, AgentManagerAgentSummary } from "@/city/agent/AgentManagerTypes.js";
10
+ import type { AgentManagerAgentAction, AgentManagerConfigAction, AgentManagerListSelection, AgentManagerAgentSummary } from "./AgentManagerTypes.js";
11
11
  type DanglingChannelAccount = {
12
12
  /**
13
13
  * 出现悬空引用的聊天渠道。
@@ -34,8 +34,8 @@ export declare function findDanglingChannelAccounts(config: DowncityConfig | nul
34
34
  export declare function loadChannelAccounts(channel?: StoredChannelAccountChannel): StoredChannelAccount[];
35
35
  export declare function loadChannelAccountMap(): Map<string, StoredChannelAccount>;
36
36
  export declare function formatAgentDetail(agent: AgentManagerAgentSummary): string;
37
- export declare function promptAgentListSelection(): Promise<AgentManagerListSelection | null>;
38
- export declare function promptAgentAction(agent: AgentManagerAgentSummary): Promise<AgentManagerAgentAction | null>;
37
+ export declare function promptAgentListSelection(lastMessage?: string): Promise<AgentManagerListSelection | null>;
38
+ export declare function promptAgentAction(agent: AgentManagerAgentSummary, lastMessage?: string): Promise<AgentManagerAgentAction | null>;
39
39
  export declare function formatAgentConfigPanelDescription(agent: AgentManagerAgentSummary): string;
40
40
  export declare function startActionChoices(agent: AgentManagerAgentSummary): Array<{
41
41
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AgentManagerHelpers.d.ts","sourceRoot":"","sources":["../../../src/city/agent/AgentManagerHelpers.ts"],"names":[],"mappings":"AAAA;;;;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AsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAUnD;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA+CzG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAGvE;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,OAAO,EAAE,2BAA2B,CAAC;IACrC,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAkCrC;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA4GnC;AAED,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiFlG"}
@@ -5,21 +5,21 @@
5
5
  * - 负责 Agent 列表加载、配置读取、账号绑定、prompts 与运行时操作封装。
6
6
  * - 交互式 manager 不能长期持有旧快照,启动/停止后需要重新加载摘要。
7
7
  */
8
- import prompts from "@/city/tui/Prompts.js";
8
+ import prompts from "../tui/Prompts.js";
9
9
  import fs from "fs-extra";
10
- import { initCommand } from "@/city/agent/Init.js";
11
- import { runCommand } from "@/city/agent/Run.js";
12
- import { startCommand } from "@/city/agent/Start.js";
13
- import { stopCommand } from "@/city/agent/Stop.js";
14
- import { restartCommand } from "@/city/agent/Restart.js";
15
- import { chatCommand } from "@/city/agent/AgentChat.js";
16
- import { listRegisteredAgentsForCli } from "@/city/agent/AgentSelection.js";
17
- import { emitCliBlock, emitCliList } from "@/shared/CliReporter.js";
18
- import { injectAgentContext } from "@/shared/IndexSupport.js";
19
- import { prepareForegroundAgent } from "@/city/shared/CityAgentRuntime.js";
20
- import { getDowncityJsonPath } from "@/city/config/Paths.js";
21
- import { PlatformStore } from "@/city/runtime/store/index.js";
22
- import { t } from "@/shared/CliLocale.js";
10
+ import { initCommand } from "./Init.js";
11
+ import { runCommand } from "./Run.js";
12
+ import { startCommand } from "./Start.js";
13
+ import { stopCommand } from "./Stop.js";
14
+ import { restartCommand } from "./Restart.js";
15
+ import { chatCommand } from "./AgentChat.js";
16
+ import { listRegisteredAgentsForCli } from "./AgentSelection.js";
17
+ import { emitCliBlock, emitCliList } from "../../shared/CliReporter.js";
18
+ import { injectAgentContext } from "../../shared/IndexSupport.js";
19
+ import { prepareForegroundAgent } from "../shared/CityAgentRuntime.js";
20
+ import { getDowncityJsonPath } from "../config/Paths.js";
21
+ import { PlatformStore } from "../runtime/store/index.js";
22
+ import { t } from "../../shared/CliLocale.js";
23
23
  const CHAT_CHANNELS = ["telegram", "feishu", "qq"];
24
24
  export function isInteractiveTerminal() {
25
25
  return process.stdin.isTTY === true && process.stdout.isTTY === true;
@@ -110,33 +110,28 @@ export function formatAgentDetail(agent) {
110
110
  en: "not configured",
111
111
  });
112
112
  const channels = agent.channels.length > 0
113
- ? agent.channels.join(", ")
113
+ ? agent.channels.length === 1
114
+ ? agent.channels[0]
115
+ : t({ zh: `${agent.channels.length} 个账号`, en: `${agent.channels.length} accounts` })
114
116
  : t({ zh: "未连接", en: "not connected" });
115
117
  return t({
116
118
  zh: [
117
- `状态:${agent.status === "running" ? "运行中" : "已停止"}`,
118
- `执行绑定:${execution_binding}`,
119
- `Chat 账号:${channels}`,
120
- `项目路径:${agent.projectRoot}`,
121
- "",
122
- "Enter 进入该 Agent 的管理面板。运行控制在“状态”里,侧边栏只保留聊天和配置入口。",
119
+ `状态 ${agent.status === "running" ? "运行中" : "已停止"} · 模型 ${execution_binding} · Chat ${channels}`,
120
+ "Enter 进入管理面板。",
123
121
  ].join("\n"),
124
122
  en: [
125
- `Status: ${agent.status}`,
126
- `Execution: ${execution_binding}`,
127
- `Chat accounts: ${channels}`,
128
- `Project: ${agent.projectRoot}`,
129
- "",
130
- "Press Enter to open this agent's management panel. Runtime controls live under Status; the sidebar keeps Chat and Config as separate entries.",
123
+ `Status ${agent.status} · Model ${execution_binding} · Chat ${channels}`,
124
+ "Press Enter to manage this agent.",
131
125
  ].join("\n"),
132
126
  });
133
127
  }
134
- export async function promptAgentListSelection() {
128
+ export async function promptAgentListSelection(lastMessage) {
135
129
  const agents = await loadAgentSummaries();
136
130
  const response = (await prompts({
137
131
  type: "select",
138
132
  name: "selection",
139
133
  message: t({ zh: "Agent 管理", en: "Agent management" }),
134
+ subtitle: lastMessage,
140
135
  choices: [
141
136
  {
142
137
  title: t({ zh: "Agent 列表", en: "Agents" }),
@@ -189,7 +184,7 @@ export async function promptAgentListSelection() {
189
184
  }));
190
185
  return response.selection || null;
191
186
  }
192
- export async function promptAgentAction(agent) {
187
+ export async function promptAgentAction(agent, lastMessage) {
193
188
  const response = (await prompts({
194
189
  type: "select",
195
190
  name: "action",
@@ -197,6 +192,7 @@ export async function promptAgentAction(agent) {
197
192
  zh: `管理 Agent · ${agent.id}`,
198
193
  en: `Manage agent · ${agent.id}`,
199
194
  }),
195
+ subtitle: lastMessage,
200
196
  choices: [
201
197
  {
202
198
  title: t({ zh: "Agent", en: "Agent" }),
@@ -237,16 +233,12 @@ export async function promptAgentAction(agent) {
237
233
  export function formatAgentConfigPanelDescription(agent) {
238
234
  return t({
239
235
  zh: [
240
- `Agent ID:${agent.id}`,
241
- `Chat 账号:${agent.channels.length > 0 ? agent.channels.join(", ") : "未连接"}`,
242
- "",
243
- "Enter 后配置 Agent ID 或连接 City 全局 Chat 账号。",
236
+ `Agent ${agent.id} · Chat ${agent.channels.length > 0 ? agent.channels.length : "未连接"}`,
237
+ "配置 Agent ID 或连接 City 全局 Chat 账号。",
244
238
  ].join("\n"),
245
239
  en: [
246
- `Agent ID: ${agent.id}`,
247
- `Chat accounts: ${agent.channels.length > 0 ? agent.channels.join(", ") : "not connected"}`,
248
- "",
249
- "Press Enter to configure the Agent ID or bind City-level Chat accounts.",
240
+ `Agent ${agent.id} · Chat ${agent.channels.length > 0 ? agent.channels.length : "not connected"}`,
241
+ "Configure the Agent ID or bind City-level Chat accounts.",
250
242
  ].join("\n"),
251
243
  });
252
244
  }
@@ -553,9 +545,11 @@ export async function connectAgentChannels(agent) {
553
545
  }
554
546
  export async function runSelectedAgentManager(agent_input) {
555
547
  let agent = agent_input;
548
+ let last_message = "";
556
549
  while (true) {
557
550
  agent = await reloadAgentSummary(agent.projectRoot, agent);
558
- const action = await promptAgentAction(agent);
551
+ const action = await promptAgentAction(agent, last_message);
552
+ last_message = "";
559
553
  if (!action) {
560
554
  emitCliBlock({
561
555
  tone: "info",
@@ -568,27 +562,32 @@ export async function runSelectedAgentManager(agent_input) {
568
562
  try {
569
563
  if (action === "start") {
570
564
  await startAgentProject(agent.projectRoot);
565
+ const previous_agent = agent;
571
566
  agent = await reloadAgentSummary(agent.projectRoot, agent);
567
+ last_message = format_agent_start_result(previous_agent, agent);
572
568
  continue;
573
569
  }
574
570
  if (action === "stop") {
571
+ const previous_agent = agent;
575
572
  await stopCommand(agent.projectRoot);
576
573
  agent = await reloadAgentSummary(agent.projectRoot, agent);
574
+ last_message = format_agent_stop_result(previous_agent, agent);
577
575
  continue;
578
576
  }
579
577
  if (action === "restart") {
578
+ const previous_agent = agent;
580
579
  injectAgentContext(agent.projectRoot);
581
580
  await restartCommand(agent.projectRoot, {});
582
581
  agent = await reloadAgentSummary(agent.projectRoot, agent);
582
+ last_message = format_agent_restart_result(previous_agent, agent);
583
583
  continue;
584
584
  }
585
585
  if (action === "chat") {
586
586
  agent = await reloadAgentSummary(agent.projectRoot, agent);
587
587
  if (agent.status !== "running") {
588
- emitCliBlock({
589
- tone: "error",
590
- title: "Agent is not running",
591
- note: "请先启动当前 agent,再进入聊天。",
588
+ last_message = t({
589
+ zh: "无法聊天:请先启动当前 Agent",
590
+ en: "Cannot chat: start this agent first",
592
591
  });
593
592
  continue;
594
593
  }
@@ -603,21 +602,77 @@ export async function runSelectedAgentManager(agent_input) {
603
602
  }
604
603
  if (config_action === "configureId") {
605
604
  agent = await configureAgentId(agent);
605
+ last_message = t({
606
+ zh: `配置已更新:${agent.id}`,
607
+ en: `Config updated: ${agent.id}`,
608
+ });
606
609
  continue;
607
610
  }
608
611
  if (config_action === "connectChatAccounts") {
609
612
  agent = await connectAgentChannels(agent);
613
+ last_message = t({
614
+ zh: "Chat 账号连接已更新",
615
+ en: "Chat account bindings updated",
616
+ });
610
617
  continue;
611
618
  }
612
619
  }
613
620
  }
614
621
  catch (error) {
615
- emitCliBlock({
616
- tone: "error",
617
- title: "Agent manager action failed",
618
- note: error instanceof Error ? error.message : String(error),
622
+ last_message = t({
623
+ zh: `操作失败:${format_agent_action_error(error)}`,
624
+ en: `Action failed: ${format_agent_action_error(error)}`,
619
625
  });
620
626
  }
621
627
  }
622
628
  }
629
+ function format_agent_action_error(error) {
630
+ if (error && typeof error === "object" && "note" in error) {
631
+ const note = String(error.note ?? "").trim();
632
+ if (note)
633
+ return note;
634
+ }
635
+ return error instanceof Error ? error.message : String(error);
636
+ }
637
+ function format_agent_start_result(_previous_agent, next_agent) {
638
+ if (next_agent.status === "running") {
639
+ return t({
640
+ zh: `已启动 ${next_agent.id}`,
641
+ en: `Started ${next_agent.id}`,
642
+ });
643
+ }
644
+ return t({
645
+ zh: `启动未生效:${next_agent.id} 仍是已停止`,
646
+ en: `Start did not take effect: ${next_agent.id} is still stopped`,
647
+ });
648
+ }
649
+ function format_agent_stop_result(previous_agent, next_agent) {
650
+ if (next_agent.status === "stopped") {
651
+ return previous_agent.status === "running"
652
+ ? t({
653
+ zh: `已停止 ${next_agent.id}`,
654
+ en: `Stopped ${next_agent.id}`,
655
+ })
656
+ : t({
657
+ zh: `${next_agent.id} 本来就是已停止`,
658
+ en: `${next_agent.id} was already stopped`,
659
+ });
660
+ }
661
+ return t({
662
+ zh: `停止未生效:${next_agent.id} 仍在运行`,
663
+ en: `Stop did not take effect: ${next_agent.id} is still running`,
664
+ });
665
+ }
666
+ function format_agent_restart_result(_previous_agent, next_agent) {
667
+ if (next_agent.status === "running") {
668
+ return t({
669
+ zh: `已重启 ${next_agent.id}`,
670
+ en: `Restarted ${next_agent.id}`,
671
+ });
672
+ }
673
+ return t({
674
+ zh: `重启未生效:${next_agent.id} 当前已停止`,
675
+ en: `Restart did not take effect: ${next_agent.id} is stopped`,
676
+ });
677
+ }
623
678
  //# sourceMappingURL=AgentManagerHelpers.js.map