@downcity/city 1.1.4 → 1.1.6

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 (1001) hide show
  1. package/README.md +245 -0
  2. package/bin/cli/Index.js +12 -12
  3. package/bin/cli/Index.js.map +1 -1
  4. package/bin/cli/agent/AgentChat.d.ts +22 -0
  5. package/bin/cli/agent/AgentChat.d.ts.map +1 -0
  6. package/bin/cli/agent/AgentChat.js +357 -0
  7. package/bin/cli/agent/AgentChat.js.map +1 -0
  8. package/bin/cli/agent/AgentChatTypes.d.ts +87 -0
  9. package/bin/cli/agent/AgentChatTypes.d.ts.map +1 -0
  10. package/bin/cli/agent/AgentChatTypes.js +12 -0
  11. package/bin/cli/agent/AgentChatTypes.js.map +1 -0
  12. package/bin/cli/agent/AgentHistory.d.ts +14 -0
  13. package/bin/cli/agent/AgentHistory.d.ts.map +1 -0
  14. package/bin/cli/agent/AgentHistory.js +157 -0
  15. package/bin/cli/agent/AgentHistory.js.map +1 -0
  16. package/bin/cli/agent/AgentHistoryTypes.d.ts +36 -0
  17. package/bin/cli/agent/AgentHistoryTypes.d.ts.map +1 -0
  18. package/bin/cli/agent/AgentHistoryTypes.js +9 -0
  19. package/bin/cli/agent/AgentHistoryTypes.js.map +1 -0
  20. package/bin/cli/agent/AgentManager.d.ts.map +1 -0
  21. package/bin/cli/agent/AgentManager.js +602 -0
  22. package/bin/cli/agent/AgentManager.js.map +1 -0
  23. package/bin/cli/agent/AgentManagerTypes.d.ts +13 -0
  24. package/bin/cli/agent/AgentManagerTypes.d.ts.map +1 -0
  25. package/bin/cli/agent/AgentManagerTypes.js +5 -0
  26. package/bin/cli/agent/AgentManagerTypes.js.map +1 -0
  27. package/bin/cli/agent/AgentReset.d.ts +13 -0
  28. package/bin/cli/agent/AgentReset.d.ts.map +1 -0
  29. package/bin/cli/agent/AgentReset.js +167 -0
  30. package/bin/cli/agent/AgentReset.js.map +1 -0
  31. package/bin/cli/agent/AgentSelection.d.ts +43 -0
  32. package/bin/cli/agent/AgentSelection.d.ts.map +1 -0
  33. package/bin/cli/agent/AgentSelection.js +243 -0
  34. package/bin/cli/agent/AgentSelection.js.map +1 -0
  35. package/bin/cli/agent/AgentSelectionTypes.d.ts +30 -0
  36. package/bin/cli/agent/AgentSelectionTypes.d.ts.map +1 -0
  37. package/bin/cli/agent/AgentSelectionTypes.js +5 -0
  38. package/bin/cli/agent/AgentSelectionTypes.js.map +1 -0
  39. package/bin/cli/agent/Init.d.ts.map +1 -0
  40. package/bin/cli/agent/Init.js +252 -0
  41. package/bin/cli/agent/Init.js.map +1 -0
  42. package/bin/cli/agent/Restart.d.ts +19 -0
  43. package/bin/cli/agent/Restart.d.ts.map +1 -0
  44. package/bin/cli/agent/Restart.js +60 -0
  45. package/bin/cli/agent/Restart.js.map +1 -0
  46. package/bin/cli/agent/Run.d.ts +24 -0
  47. package/bin/cli/agent/Run.d.ts.map +1 -0
  48. package/bin/cli/agent/Run.js +119 -0
  49. package/bin/cli/agent/Run.js.map +1 -0
  50. package/bin/cli/agent/Start.d.ts +23 -0
  51. package/bin/cli/agent/Start.d.ts.map +1 -0
  52. package/bin/cli/agent/Start.js +63 -0
  53. package/bin/cli/agent/Start.js.map +1 -0
  54. package/bin/cli/agent/Status.d.ts.map +1 -0
  55. package/bin/cli/agent/Status.js +103 -0
  56. package/bin/cli/agent/Status.js.map +1 -0
  57. package/bin/cli/agent/Stop.d.ts.map +1 -0
  58. package/bin/cli/agent/Stop.js +44 -0
  59. package/bin/cli/agent/Stop.js.map +1 -0
  60. package/bin/cli/control-plane/ControlPlaneAuthBootstrap.d.ts +25 -0
  61. package/bin/cli/control-plane/ControlPlaneAuthBootstrap.d.ts.map +1 -0
  62. package/bin/cli/control-plane/ControlPlaneAuthBootstrap.js +56 -0
  63. package/bin/cli/control-plane/ControlPlaneAuthBootstrap.js.map +1 -0
  64. package/bin/cli/control-plane/ControlPlaneCommand.d.ts +29 -0
  65. package/bin/cli/control-plane/ControlPlaneCommand.d.ts.map +1 -0
  66. package/bin/cli/control-plane/ControlPlaneCommand.js +152 -0
  67. package/bin/cli/control-plane/ControlPlaneCommand.js.map +1 -0
  68. package/bin/cli/control-plane/ControlPlaneInit.d.ts +17 -0
  69. package/bin/cli/control-plane/ControlPlaneInit.d.ts.map +1 -0
  70. package/bin/cli/control-plane/ControlPlaneInit.js +76 -0
  71. package/bin/cli/control-plane/ControlPlaneInit.js.map +1 -0
  72. package/bin/cli/control-plane/ControlPlaneProcess.d.ts +61 -0
  73. package/bin/cli/control-plane/ControlPlaneProcess.d.ts.map +1 -0
  74. package/bin/cli/control-plane/ControlPlaneProcess.js +395 -0
  75. package/bin/cli/control-plane/ControlPlaneProcess.js.map +1 -0
  76. package/bin/cli/control-plane/ControlPlaneRuntime.d.ts +98 -0
  77. package/bin/cli/control-plane/ControlPlaneRuntime.d.ts.map +1 -0
  78. package/bin/cli/control-plane/ControlPlaneRuntime.js +515 -0
  79. package/bin/cli/control-plane/ControlPlaneRuntime.js.map +1 -0
  80. package/bin/cli/control-plane/ControlPlaneStatus.d.ts +27 -0
  81. package/bin/cli/control-plane/ControlPlaneStatus.d.ts.map +1 -0
  82. package/bin/cli/control-plane/ControlPlaneStatus.js +135 -0
  83. package/bin/cli/control-plane/ControlPlaneStatus.js.map +1 -0
  84. package/bin/cli/model/Model.d.ts.map +1 -0
  85. package/bin/cli/model/Model.js.map +1 -0
  86. package/bin/cli/model/ModelCommandShared.d.ts +28 -0
  87. package/bin/cli/model/ModelCommandShared.d.ts.map +1 -0
  88. package/bin/cli/model/ModelCommandShared.js +109 -0
  89. package/bin/cli/model/ModelCommandShared.js.map +1 -0
  90. package/bin/cli/model/ModelCreateCommand.d.ts.map +1 -0
  91. package/bin/cli/model/ModelCreateCommand.js +367 -0
  92. package/bin/cli/model/ModelCreateCommand.js.map +1 -0
  93. package/bin/cli/model/ModelManageCommand.d.ts.map +1 -0
  94. package/bin/cli/model/ModelManageCommand.js.map +1 -0
  95. package/bin/cli/model/ModelManager.d.ts.map +1 -0
  96. package/bin/cli/model/ModelManager.js +588 -0
  97. package/bin/cli/model/ModelManager.js.map +1 -0
  98. package/bin/cli/model/ModelManagerTypes.d.ts +21 -0
  99. package/bin/cli/model/ModelManagerTypes.d.ts.map +1 -0
  100. package/bin/cli/model/ModelManagerTypes.js +5 -0
  101. package/bin/cli/model/ModelManagerTypes.js.map +1 -0
  102. package/bin/cli/model/ModelReadCommand.d.ts +13 -0
  103. package/bin/cli/model/ModelReadCommand.d.ts.map +1 -0
  104. package/bin/cli/model/ModelReadCommand.js +198 -0
  105. package/bin/cli/model/ModelReadCommand.js.map +1 -0
  106. package/bin/cli/model/ModelSupport.d.ts +40 -0
  107. package/bin/cli/model/ModelSupport.d.ts.map +1 -0
  108. package/bin/cli/model/ModelSupport.js +201 -0
  109. package/bin/cli/model/ModelSupport.js.map +1 -0
  110. package/bin/cli/model/preset/ModelPresetManager.d.ts +71 -0
  111. package/bin/cli/model/preset/ModelPresetManager.d.ts.map +1 -0
  112. package/bin/cli/model/preset/ModelPresetManager.js +187 -0
  113. package/bin/cli/model/preset/ModelPresetManager.js.map +1 -0
  114. package/bin/cli/service/ServiceActionCommands.d.ts.map +1 -0
  115. package/bin/cli/service/ServiceActionCommands.js +343 -0
  116. package/bin/cli/service/ServiceActionCommands.js.map +1 -0
  117. package/bin/cli/service/ServiceCommandRemote.d.ts +30 -0
  118. package/bin/cli/service/ServiceCommandRemote.d.ts.map +1 -0
  119. package/bin/cli/service/ServiceCommandRemote.js +200 -0
  120. package/bin/cli/service/ServiceCommandRemote.js.map +1 -0
  121. package/bin/cli/service/ServiceCommandSupport.d.ts +82 -0
  122. package/bin/cli/service/ServiceCommandSupport.d.ts.map +1 -0
  123. package/bin/cli/service/ServiceCommandSupport.js +224 -0
  124. package/bin/cli/service/ServiceCommandSupport.js.map +1 -0
  125. package/bin/cli/service/ServiceScheduleCommand.d.ts +36 -0
  126. package/bin/cli/service/ServiceScheduleCommand.d.ts.map +1 -0
  127. package/bin/cli/service/ServiceScheduleCommand.js +271 -0
  128. package/bin/cli/service/ServiceScheduleCommand.js.map +1 -0
  129. package/bin/cli/service/Services.d.ts.map +1 -0
  130. package/bin/cli/service/Services.js +154 -0
  131. package/bin/cli/service/Services.js.map +1 -0
  132. package/bin/cli/shared/Alias.d.ts.map +1 -0
  133. package/bin/cli/shared/Alias.js.map +1 -0
  134. package/bin/cli/shared/Chat.d.ts.map +1 -0
  135. package/bin/cli/shared/Chat.js.map +1 -0
  136. package/bin/cli/shared/ChatAuth.d.ts.map +1 -0
  137. package/bin/cli/shared/ChatAuth.js +151 -0
  138. package/bin/cli/shared/ChatAuth.js.map +1 -0
  139. package/bin/cli/shared/ChatManager.d.ts.map +1 -0
  140. package/bin/cli/shared/ChatManager.js +383 -0
  141. package/bin/cli/shared/ChatManager.js.map +1 -0
  142. package/bin/cli/shared/ChatManagerTypes.d.ts +6 -0
  143. package/bin/cli/shared/ChatManagerTypes.d.ts.map +1 -0
  144. package/bin/cli/shared/ChatManagerTypes.js +5 -0
  145. package/bin/cli/shared/ChatManagerTypes.js.map +1 -0
  146. package/bin/cli/shared/CliError.d.ts.map +1 -0
  147. package/bin/cli/shared/CliError.js.map +1 -0
  148. package/bin/cli/shared/CliReporter.d.ts +50 -0
  149. package/bin/cli/shared/CliReporter.d.ts.map +1 -0
  150. package/bin/cli/shared/CliReporter.js.map +1 -0
  151. package/bin/cli/shared/CliReporterTypes.d.ts +157 -0
  152. package/bin/cli/shared/CliReporterTypes.d.ts.map +1 -0
  153. package/bin/cli/shared/CliReporterTypes.js +10 -0
  154. package/bin/cli/shared/CliReporterTypes.js.map +1 -0
  155. package/bin/cli/shared/Config.d.ts.map +1 -0
  156. package/bin/cli/shared/Config.js +239 -0
  157. package/bin/cli/shared/Config.js.map +1 -0
  158. package/bin/cli/shared/Env.d.ts +14 -0
  159. package/bin/cli/shared/Env.d.ts.map +1 -0
  160. package/bin/cli/shared/Env.js +419 -0
  161. package/bin/cli/shared/Env.js.map +1 -0
  162. package/bin/cli/shared/IndexAgentCommand.d.ts.map +1 -0
  163. package/bin/cli/shared/IndexAgentCommand.js +218 -0
  164. package/bin/cli/shared/IndexAgentCommand.js.map +1 -0
  165. package/bin/cli/shared/IndexSupport.d.ts.map +1 -0
  166. package/bin/cli/shared/IndexSupport.js +123 -0
  167. package/bin/cli/shared/IndexSupport.js.map +1 -0
  168. package/bin/cli/shared/Plugins.d.ts.map +1 -0
  169. package/bin/cli/shared/Plugins.js +472 -0
  170. package/bin/cli/shared/Plugins.js.map +1 -0
  171. package/bin/cli/shared/PortHints.d.ts +35 -0
  172. package/bin/cli/shared/PortHints.d.ts.map +1 -0
  173. package/bin/cli/shared/PortHints.js +58 -0
  174. package/bin/cli/shared/PortHints.js.map +1 -0
  175. package/bin/cli/shared/PublicAccess.d.ts +24 -0
  176. package/bin/cli/shared/PublicAccess.d.ts.map +1 -0
  177. package/bin/cli/shared/PublicAccess.js +100 -0
  178. package/bin/cli/shared/PublicAccess.js.map +1 -0
  179. package/bin/cli/shared/PublicHostEnv.d.ts +14 -0
  180. package/bin/cli/shared/PublicHostEnv.d.ts.map +1 -0
  181. package/bin/cli/shared/PublicHostEnv.js +104 -0
  182. package/bin/cli/shared/PublicHostEnv.js.map +1 -0
  183. package/bin/cli/shared/PublicHostEnvTypes.d.ts +23 -0
  184. package/bin/cli/shared/PublicHostEnvTypes.d.ts.map +1 -0
  185. package/bin/cli/shared/PublicHostEnvTypes.js +5 -0
  186. package/bin/cli/shared/PublicHostEnvTypes.js.map +1 -0
  187. package/bin/cli/shared/Reset.d.ts.map +1 -0
  188. package/bin/cli/shared/Reset.js.map +1 -0
  189. package/bin/cli/shared/Token.d.ts.map +1 -0
  190. package/bin/cli/shared/Token.js +638 -0
  191. package/bin/cli/shared/Token.js.map +1 -0
  192. package/bin/cli/shared/Update.d.ts.map +1 -0
  193. package/bin/cli/shared/Update.js +150 -0
  194. package/bin/cli/shared/Update.js.map +1 -0
  195. package/bin/config/DowncitySchema.d.ts +3 -0
  196. package/bin/config/DowncitySchema.d.ts.map +1 -0
  197. package/bin/config/DowncitySchema.js +367 -0
  198. package/bin/config/DowncitySchema.js.map +1 -0
  199. package/bin/control/AgentStatusApiRoutes.d.ts +28 -0
  200. package/bin/control/AgentStatusApiRoutes.d.ts.map +1 -0
  201. package/bin/control/AgentStatusApiRoutes.js +165 -0
  202. package/bin/control/AgentStatusApiRoutes.js.map +1 -0
  203. package/bin/control/ChannelAccountApiRoutes.d.ts +15 -0
  204. package/bin/control/ChannelAccountApiRoutes.d.ts.map +1 -0
  205. package/bin/control/ChannelAccountApiRoutes.js +93 -0
  206. package/bin/control/ChannelAccountApiRoutes.js.map +1 -0
  207. package/bin/control/ControlGateway.d.ts +102 -0
  208. package/bin/control/ControlGateway.d.ts.map +1 -0
  209. package/bin/control/ControlGateway.js +283 -0
  210. package/bin/control/ControlGateway.js.map +1 -0
  211. package/bin/control/EnvApiRoutes.d.ts +18 -0
  212. package/bin/control/EnvApiRoutes.d.ts.map +1 -0
  213. package/bin/control/EnvApiRoutes.js +228 -0
  214. package/bin/control/EnvApiRoutes.js.map +1 -0
  215. package/bin/control/ModelApiRoutes.d.ts +35 -0
  216. package/bin/control/ModelApiRoutes.d.ts.map +1 -0
  217. package/bin/control/ModelApiRoutes.js +237 -0
  218. package/bin/control/ModelApiRoutes.js.map +1 -0
  219. package/bin/control/ModelPoolService.d.ts +126 -0
  220. package/bin/control/ModelPoolService.d.ts.map +1 -0
  221. package/bin/control/ModelPoolService.js +327 -0
  222. package/bin/control/ModelPoolService.js.map +1 -0
  223. package/bin/control/PlatformApiRoutes.d.ts +133 -0
  224. package/bin/control/PlatformApiRoutes.d.ts.map +1 -0
  225. package/bin/control/PlatformApiRoutes.js +292 -0
  226. package/bin/control/PlatformApiRoutes.js.map +1 -0
  227. package/bin/control/PluginApiRoutes.d.ts +28 -0
  228. package/bin/control/PluginApiRoutes.d.ts.map +1 -0
  229. package/bin/control/PluginApiRoutes.js +282 -0
  230. package/bin/control/PluginApiRoutes.js.map +1 -0
  231. package/bin/control/gateway/AgentActions.d.ts +107 -0
  232. package/bin/control/gateway/AgentActions.d.ts.map +1 -0
  233. package/bin/control/gateway/AgentActions.js +314 -0
  234. package/bin/control/gateway/AgentActions.js.map +1 -0
  235. package/bin/control/gateway/AgentCatalog.d.ts +83 -0
  236. package/bin/control/gateway/AgentCatalog.d.ts.map +1 -0
  237. package/bin/control/gateway/AgentCatalog.js +484 -0
  238. package/bin/control/gateway/AgentCatalog.js.map +1 -0
  239. package/bin/control/gateway/FrontendAssets.d.ts +21 -0
  240. package/bin/control/gateway/FrontendAssets.d.ts.map +1 -0
  241. package/bin/control/gateway/FrontendAssets.js +77 -0
  242. package/bin/control/gateway/FrontendAssets.js.map +1 -0
  243. package/bin/control/gateway/GatewaySupport.d.ts +34 -0
  244. package/bin/control/gateway/GatewaySupport.d.ts.map +1 -0
  245. package/bin/control/gateway/GatewaySupport.js +32 -0
  246. package/bin/control/gateway/GatewaySupport.js.map +1 -0
  247. package/bin/control/gateway/Proxy.d.ts +16 -0
  248. package/bin/control/gateway/Proxy.d.ts.map +1 -0
  249. package/bin/control/gateway/Proxy.js +47 -0
  250. package/bin/control/gateway/Proxy.js.map +1 -0
  251. package/bin/control/instant/InstantApiRoutes.d.ts +19 -0
  252. package/bin/control/instant/InstantApiRoutes.d.ts.map +1 -0
  253. package/bin/control/instant/InstantApiRoutes.js +58 -0
  254. package/bin/control/instant/InstantApiRoutes.js.map +1 -0
  255. package/bin/control/instant/InstantSessionService.d.ts +36 -0
  256. package/bin/control/instant/InstantSessionService.d.ts.map +1 -0
  257. package/bin/control/instant/InstantSessionService.js +183 -0
  258. package/bin/control/instant/InstantSessionService.js.map +1 -0
  259. package/bin/control/instant/InstantSystemComposer.d.ts +34 -0
  260. package/bin/control/instant/InstantSystemComposer.d.ts.map +1 -0
  261. package/bin/control/instant/InstantSystemComposer.js +38 -0
  262. package/bin/control/instant/InstantSystemComposer.js.map +1 -0
  263. package/bin/http/auth/AuthMiddleware.d.ts +1 -1
  264. package/bin/http/auth/AuthMiddleware.d.ts.map +1 -1
  265. package/bin/http/auth/AuthService.d.ts +2 -2
  266. package/bin/http/auth/AuthService.d.ts.map +1 -1
  267. package/bin/http/auth/AuthService.js +1 -1
  268. package/bin/http/auth/AuthService.js.map +1 -1
  269. package/bin/http/auth/AuthStore.d.ts +4 -4
  270. package/bin/http/auth/AuthStore.d.ts.map +1 -1
  271. package/bin/http/auth/AuthStore.js +7 -7
  272. package/bin/http/auth/AuthStore.js.map +1 -1
  273. package/bin/http/auth/RoutePolicy.d.ts +3 -3
  274. package/bin/http/auth/RoutePolicy.d.ts.map +1 -1
  275. package/bin/http/auth/RoutePolicy.js +6 -6
  276. package/bin/http/auth/RoutePolicy.js.map +1 -1
  277. package/bin/process/daemon/Api.d.ts +60 -0
  278. package/bin/process/daemon/Api.d.ts.map +1 -0
  279. package/bin/process/daemon/Api.js.map +1 -0
  280. package/bin/process/daemon/CliArgs.d.ts +17 -0
  281. package/bin/process/daemon/CliArgs.d.ts.map +1 -0
  282. package/bin/process/daemon/CliArgs.js +30 -0
  283. package/bin/process/daemon/CliArgs.js.map +1 -0
  284. package/bin/process/daemon/Client.d.ts.map +1 -0
  285. package/bin/process/daemon/Client.js +158 -0
  286. package/bin/process/daemon/Client.js.map +1 -0
  287. package/bin/process/daemon/Manager.d.ts +92 -0
  288. package/bin/process/daemon/Manager.d.ts.map +1 -0
  289. package/bin/process/daemon/Manager.js +287 -0
  290. package/bin/process/daemon/Manager.js.map +1 -0
  291. package/bin/process/daemon/PortAllocator.d.ts.map +1 -0
  292. package/bin/process/daemon/PortAllocator.js.map +1 -0
  293. package/bin/process/registry/AgentHostRuntime.d.ts +10 -0
  294. package/bin/process/registry/AgentHostRuntime.d.ts.map +1 -0
  295. package/bin/process/registry/AgentHostRuntime.js +47 -0
  296. package/bin/process/registry/AgentHostRuntime.js.map +1 -0
  297. package/bin/process/registry/CityPaths.d.ts +53 -0
  298. package/bin/process/registry/CityPaths.d.ts.map +1 -0
  299. package/bin/process/registry/CityPaths.js +78 -0
  300. package/bin/process/registry/CityPaths.js.map +1 -0
  301. package/bin/process/registry/CityRegistry.d.ts +51 -0
  302. package/bin/process/registry/CityRegistry.d.ts.map +1 -0
  303. package/bin/process/registry/CityRegistry.js +217 -0
  304. package/bin/process/registry/CityRegistry.js.map +1 -0
  305. package/bin/process/registry/CityRuntime.d.ts +21 -0
  306. package/bin/process/registry/CityRuntime.d.ts.map +1 -0
  307. package/bin/process/registry/CityRuntime.js +45 -0
  308. package/bin/process/registry/CityRuntime.js.map +1 -0
  309. package/bin/process/registry/PluginRuntime.d.ts +24 -0
  310. package/bin/process/registry/PluginRuntime.d.ts.map +1 -0
  311. package/bin/process/registry/PluginRuntime.js.map +1 -0
  312. package/bin/process/registry/ProcessSweep.d.ts +76 -0
  313. package/bin/process/registry/ProcessSweep.d.ts.map +1 -0
  314. package/bin/process/registry/ProcessSweep.js +202 -0
  315. package/bin/process/registry/ProcessSweep.js.map +1 -0
  316. package/bin/process/rpc/Client.d.ts +13 -0
  317. package/bin/process/rpc/Client.d.ts.map +1 -0
  318. package/bin/process/rpc/Client.js.map +1 -0
  319. package/bin/process/rpc/Paths.d.ts.map +1 -0
  320. package/bin/process/rpc/Paths.js +36 -0
  321. package/bin/process/rpc/Paths.js.map +1 -0
  322. package/bin/utils/cli/CliOutput.d.ts +1 -1
  323. package/bin/utils/cli/CliOutput.d.ts.map +1 -1
  324. package/bin/utils/cli/CliOutput.js +1 -1
  325. package/bin/utils/cli/CliOutput.js.map +1 -1
  326. package/bin/utils/storage.d.ts +1 -1
  327. package/bin/utils/storage.d.ts.map +1 -1
  328. package/package.json +2 -2
  329. package/scripts/lint-import-boundaries.mjs +17 -85
  330. package/src/cli/Index.ts +12 -12
  331. package/src/cli/agent/AgentChat.ts +415 -0
  332. package/src/cli/agent/AgentChatTypes.ts +92 -0
  333. package/src/cli/agent/AgentHistory.ts +187 -0
  334. package/src/cli/agent/AgentHistoryTypes.ts +39 -0
  335. package/src/cli/agent/AgentManager.ts +667 -0
  336. package/src/cli/agent/AgentManagerTypes.ts +29 -0
  337. package/src/cli/agent/AgentReset.ts +181 -0
  338. package/src/cli/agent/AgentSelection.ts +297 -0
  339. package/src/cli/agent/AgentSelectionTypes.ts +36 -0
  340. package/src/cli/agent/Init.ts +291 -0
  341. package/src/cli/agent/Restart.ts +68 -0
  342. package/src/cli/agent/Run.ts +148 -0
  343. package/src/cli/agent/Start.ts +72 -0
  344. package/src/cli/agent/Status.ts +116 -0
  345. package/src/cli/agent/Stop.ts +45 -0
  346. package/src/cli/control-plane/ControlPlaneAuthBootstrap.ts +72 -0
  347. package/src/cli/control-plane/ControlPlaneCommand.ts +216 -0
  348. package/src/cli/control-plane/ControlPlaneInit.ts +83 -0
  349. package/src/cli/control-plane/ControlPlaneProcess.ts +497 -0
  350. package/src/cli/control-plane/ControlPlaneRuntime.ts +611 -0
  351. package/src/cli/control-plane/ControlPlaneStatus.ts +152 -0
  352. package/src/cli/model/ModelCommandShared.ts +129 -0
  353. package/src/cli/model/ModelCreateCommand.ts +424 -0
  354. package/src/cli/model/ModelManageCommand.ts +516 -0
  355. package/src/cli/model/ModelManager.ts +631 -0
  356. package/src/cli/model/ModelManagerTypes.ts +37 -0
  357. package/src/cli/model/ModelReadCommand.ts +207 -0
  358. package/src/cli/model/ModelSupport.ts +223 -0
  359. package/src/cli/model/preset/ModelPresetManager.ts +242 -0
  360. package/src/cli/service/ServiceActionCommands.ts +416 -0
  361. package/src/cli/service/ServiceCommandRemote.ts +230 -0
  362. package/src/cli/service/ServiceCommandSupport.ts +275 -0
  363. package/src/cli/service/ServiceScheduleCommand.ts +305 -0
  364. package/src/cli/service/Services.ts +189 -0
  365. package/src/cli/shared/ChatAuth.ts +203 -0
  366. package/src/cli/shared/ChatManager.ts +441 -0
  367. package/src/cli/shared/ChatManagerTypes.ts +19 -0
  368. package/src/cli/shared/CliReporter.ts +362 -0
  369. package/src/cli/shared/CliReporterTypes.ts +167 -0
  370. package/src/cli/shared/Config.ts +301 -0
  371. package/src/cli/shared/Env.ts +556 -0
  372. package/src/cli/shared/IndexAgentCommand.ts +302 -0
  373. package/src/cli/shared/IndexSupport.ts +138 -0
  374. package/src/cli/shared/Plugins.ts +567 -0
  375. package/src/cli/shared/PortHints.ts +80 -0
  376. package/src/cli/shared/PublicAccess.ts +106 -0
  377. package/src/cli/shared/PublicHostEnv.ts +116 -0
  378. package/src/cli/shared/PublicHostEnvTypes.ts +27 -0
  379. package/src/cli/shared/Token.ts +702 -0
  380. package/src/cli/shared/Update.ts +183 -0
  381. package/src/config/DowncitySchema.ts +377 -0
  382. package/src/control/AgentStatusApiRoutes.ts +225 -0
  383. package/src/control/ChannelAccountApiRoutes.ts +119 -0
  384. package/src/control/ControlGateway.ts +463 -0
  385. package/src/control/EnvApiRoutes.ts +257 -0
  386. package/src/control/ModelApiRoutes.ts +336 -0
  387. package/src/control/ModelPoolService.ts +395 -0
  388. package/src/control/PlatformApiRoutes.ts +495 -0
  389. package/src/control/PluginApiRoutes.ts +439 -0
  390. package/src/control/gateway/AgentActions.ts +413 -0
  391. package/src/control/gateway/AgentCatalog.ts +611 -0
  392. package/src/control/gateway/FrontendAssets.ts +79 -0
  393. package/src/control/gateway/GatewaySupport.ts +59 -0
  394. package/src/control/gateway/Proxy.ts +62 -0
  395. package/src/control/instant/InstantApiRoutes.ts +74 -0
  396. package/src/control/instant/InstantSessionService.ts +278 -0
  397. package/src/control/instant/InstantSystemComposer.ts +60 -0
  398. package/src/http/auth/AuthMiddleware.ts +1 -1
  399. package/src/http/auth/AuthService.ts +3 -3
  400. package/src/http/auth/AuthStore.ts +11 -11
  401. package/src/http/auth/RoutePolicy.ts +8 -8
  402. package/src/process/daemon/Api.ts +64 -0
  403. package/src/process/daemon/CliArgs.ts +39 -0
  404. package/src/process/daemon/Client.ts +182 -0
  405. package/src/process/daemon/Manager.ts +344 -0
  406. package/src/process/registry/AgentHostRuntime.ts +65 -0
  407. package/src/process/registry/CityPaths.ts +87 -0
  408. package/src/process/registry/CityRegistry.ts +256 -0
  409. package/src/process/registry/CityRuntime.ts +45 -0
  410. package/src/process/registry/PluginRuntime.ts +42 -0
  411. package/src/process/registry/ProcessSweep.ts +256 -0
  412. package/src/process/rpc/Client.ts +113 -0
  413. package/src/process/rpc/Paths.ts +43 -0
  414. package/src/utils/cli/CliOutput.ts +2 -2
  415. package/src/utils/storage.ts +1 -1
  416. package/tsconfig.json +2 -1
  417. package/bin/cli/AgentChat.d.ts +0 -22
  418. package/bin/cli/AgentChat.d.ts.map +0 -1
  419. package/bin/cli/AgentChat.js +0 -357
  420. package/bin/cli/AgentChat.js.map +0 -1
  421. package/bin/cli/AgentHistory.d.ts +0 -14
  422. package/bin/cli/AgentHistory.d.ts.map +0 -1
  423. package/bin/cli/AgentHistory.js +0 -157
  424. package/bin/cli/AgentHistory.js.map +0 -1
  425. package/bin/cli/AgentManager.d.ts.map +0 -1
  426. package/bin/cli/AgentManager.js +0 -602
  427. package/bin/cli/AgentManager.js.map +0 -1
  428. package/bin/cli/AgentReset.d.ts +0 -13
  429. package/bin/cli/AgentReset.d.ts.map +0 -1
  430. package/bin/cli/AgentReset.js +0 -167
  431. package/bin/cli/AgentReset.js.map +0 -1
  432. package/bin/cli/AgentSelection.d.ts +0 -43
  433. package/bin/cli/AgentSelection.d.ts.map +0 -1
  434. package/bin/cli/AgentSelection.js +0 -243
  435. package/bin/cli/AgentSelection.js.map +0 -1
  436. package/bin/cli/Alias.d.ts.map +0 -1
  437. package/bin/cli/Alias.js.map +0 -1
  438. package/bin/cli/Chat.d.ts.map +0 -1
  439. package/bin/cli/Chat.js.map +0 -1
  440. package/bin/cli/ChatAuth.d.ts.map +0 -1
  441. package/bin/cli/ChatAuth.js +0 -152
  442. package/bin/cli/ChatAuth.js.map +0 -1
  443. package/bin/cli/ChatManager.d.ts.map +0 -1
  444. package/bin/cli/ChatManager.js +0 -383
  445. package/bin/cli/ChatManager.js.map +0 -1
  446. package/bin/cli/CliReporter.d.ts +0 -50
  447. package/bin/cli/CliReporter.d.ts.map +0 -1
  448. package/bin/cli/CliReporter.js.map +0 -1
  449. package/bin/cli/Config.d.ts.map +0 -1
  450. package/bin/cli/Config.js +0 -239
  451. package/bin/cli/Config.js.map +0 -1
  452. package/bin/cli/Console.d.ts +0 -97
  453. package/bin/cli/Console.d.ts.map +0 -1
  454. package/bin/cli/Console.js +0 -514
  455. package/bin/cli/Console.js.map +0 -1
  456. package/bin/cli/ConsoleAuthBootstrap.d.ts +0 -25
  457. package/bin/cli/ConsoleAuthBootstrap.d.ts.map +0 -1
  458. package/bin/cli/ConsoleAuthBootstrap.js +0 -56
  459. package/bin/cli/ConsoleAuthBootstrap.js.map +0 -1
  460. package/bin/cli/ConsoleInit.d.ts +0 -17
  461. package/bin/cli/ConsoleInit.d.ts.map +0 -1
  462. package/bin/cli/ConsoleInit.js +0 -76
  463. package/bin/cli/ConsoleInit.js.map +0 -1
  464. package/bin/cli/Env.d.ts +0 -14
  465. package/bin/cli/Env.d.ts.map +0 -1
  466. package/bin/cli/Env.js +0 -419
  467. package/bin/cli/Env.js.map +0 -1
  468. package/bin/cli/IndexAgentCommand.d.ts.map +0 -1
  469. package/bin/cli/IndexAgentCommand.js +0 -218
  470. package/bin/cli/IndexAgentCommand.js.map +0 -1
  471. package/bin/cli/IndexConsoleCommand.d.ts +0 -24
  472. package/bin/cli/IndexConsoleCommand.d.ts.map +0 -1
  473. package/bin/cli/IndexConsoleCommand.js +0 -147
  474. package/bin/cli/IndexConsoleCommand.js.map +0 -1
  475. package/bin/cli/IndexConsoleProcess.d.ts +0 -61
  476. package/bin/cli/IndexConsoleProcess.d.ts.map +0 -1
  477. package/bin/cli/IndexConsoleProcess.js +0 -395
  478. package/bin/cli/IndexConsoleProcess.js.map +0 -1
  479. package/bin/cli/IndexConsoleStatus.d.ts +0 -27
  480. package/bin/cli/IndexConsoleStatus.d.ts.map +0 -1
  481. package/bin/cli/IndexConsoleStatus.js +0 -135
  482. package/bin/cli/IndexConsoleStatus.js.map +0 -1
  483. package/bin/cli/IndexSupport.d.ts.map +0 -1
  484. package/bin/cli/IndexSupport.js +0 -123
  485. package/bin/cli/IndexSupport.js.map +0 -1
  486. package/bin/cli/Init.d.ts.map +0 -1
  487. package/bin/cli/Init.js +0 -252
  488. package/bin/cli/Init.js.map +0 -1
  489. package/bin/cli/Model.d.ts.map +0 -1
  490. package/bin/cli/Model.js.map +0 -1
  491. package/bin/cli/ModelCommandShared.d.ts +0 -28
  492. package/bin/cli/ModelCommandShared.d.ts.map +0 -1
  493. package/bin/cli/ModelCommandShared.js +0 -109
  494. package/bin/cli/ModelCommandShared.js.map +0 -1
  495. package/bin/cli/ModelCreateCommand.d.ts.map +0 -1
  496. package/bin/cli/ModelCreateCommand.js +0 -367
  497. package/bin/cli/ModelCreateCommand.js.map +0 -1
  498. package/bin/cli/ModelManageCommand.d.ts.map +0 -1
  499. package/bin/cli/ModelManageCommand.js.map +0 -1
  500. package/bin/cli/ModelManager.d.ts.map +0 -1
  501. package/bin/cli/ModelManager.js +0 -588
  502. package/bin/cli/ModelManager.js.map +0 -1
  503. package/bin/cli/ModelReadCommand.d.ts +0 -13
  504. package/bin/cli/ModelReadCommand.d.ts.map +0 -1
  505. package/bin/cli/ModelReadCommand.js +0 -198
  506. package/bin/cli/ModelReadCommand.js.map +0 -1
  507. package/bin/cli/ModelSupport.d.ts +0 -40
  508. package/bin/cli/ModelSupport.d.ts.map +0 -1
  509. package/bin/cli/ModelSupport.js +0 -201
  510. package/bin/cli/ModelSupport.js.map +0 -1
  511. package/bin/cli/Plugins.d.ts.map +0 -1
  512. package/bin/cli/Plugins.js +0 -474
  513. package/bin/cli/Plugins.js.map +0 -1
  514. package/bin/cli/PortHints.d.ts +0 -35
  515. package/bin/cli/PortHints.d.ts.map +0 -1
  516. package/bin/cli/PortHints.js +0 -58
  517. package/bin/cli/PortHints.js.map +0 -1
  518. package/bin/cli/PublicAccess.d.ts +0 -24
  519. package/bin/cli/PublicAccess.d.ts.map +0 -1
  520. package/bin/cli/PublicAccess.js +0 -100
  521. package/bin/cli/PublicAccess.js.map +0 -1
  522. package/bin/cli/PublicHostEnv.d.ts +0 -14
  523. package/bin/cli/PublicHostEnv.d.ts.map +0 -1
  524. package/bin/cli/PublicHostEnv.js +0 -104
  525. package/bin/cli/PublicHostEnv.js.map +0 -1
  526. package/bin/cli/Reset.d.ts.map +0 -1
  527. package/bin/cli/Reset.js.map +0 -1
  528. package/bin/cli/Restart.d.ts +0 -19
  529. package/bin/cli/Restart.d.ts.map +0 -1
  530. package/bin/cli/Restart.js +0 -60
  531. package/bin/cli/Restart.js.map +0 -1
  532. package/bin/cli/Run.d.ts +0 -24
  533. package/bin/cli/Run.d.ts.map +0 -1
  534. package/bin/cli/Run.js +0 -119
  535. package/bin/cli/Run.js.map +0 -1
  536. package/bin/cli/ServiceActionCommands.d.ts.map +0 -1
  537. package/bin/cli/ServiceActionCommands.js +0 -345
  538. package/bin/cli/ServiceActionCommands.js.map +0 -1
  539. package/bin/cli/ServiceCommandRemote.d.ts +0 -30
  540. package/bin/cli/ServiceCommandRemote.d.ts.map +0 -1
  541. package/bin/cli/ServiceCommandRemote.js +0 -200
  542. package/bin/cli/ServiceCommandRemote.js.map +0 -1
  543. package/bin/cli/ServiceCommandSupport.d.ts +0 -82
  544. package/bin/cli/ServiceCommandSupport.d.ts.map +0 -1
  545. package/bin/cli/ServiceCommandSupport.js +0 -224
  546. package/bin/cli/ServiceCommandSupport.js.map +0 -1
  547. package/bin/cli/ServiceScheduleCommand.d.ts +0 -36
  548. package/bin/cli/ServiceScheduleCommand.d.ts.map +0 -1
  549. package/bin/cli/ServiceScheduleCommand.js +0 -271
  550. package/bin/cli/ServiceScheduleCommand.js.map +0 -1
  551. package/bin/cli/Services.d.ts.map +0 -1
  552. package/bin/cli/Services.js +0 -154
  553. package/bin/cli/Services.js.map +0 -1
  554. package/bin/cli/Start.d.ts +0 -23
  555. package/bin/cli/Start.d.ts.map +0 -1
  556. package/bin/cli/Start.js +0 -63
  557. package/bin/cli/Start.js.map +0 -1
  558. package/bin/cli/Status.d.ts.map +0 -1
  559. package/bin/cli/Status.js +0 -103
  560. package/bin/cli/Status.js.map +0 -1
  561. package/bin/cli/Stop.d.ts.map +0 -1
  562. package/bin/cli/Stop.js +0 -44
  563. package/bin/cli/Stop.js.map +0 -1
  564. package/bin/cli/Token.d.ts.map +0 -1
  565. package/bin/cli/Token.js +0 -638
  566. package/bin/cli/Token.js.map +0 -1
  567. package/bin/cli/Update.d.ts.map +0 -1
  568. package/bin/cli/Update.js +0 -150
  569. package/bin/cli/Update.js.map +0 -1
  570. package/bin/console/AgentStatusApiRoutes.d.ts +0 -28
  571. package/bin/console/AgentStatusApiRoutes.d.ts.map +0 -1
  572. package/bin/console/AgentStatusApiRoutes.js +0 -165
  573. package/bin/console/AgentStatusApiRoutes.js.map +0 -1
  574. package/bin/console/ChannelAccountApiRoutes.d.ts +0 -15
  575. package/bin/console/ChannelAccountApiRoutes.d.ts.map +0 -1
  576. package/bin/console/ChannelAccountApiRoutes.js +0 -93
  577. package/bin/console/ChannelAccountApiRoutes.js.map +0 -1
  578. package/bin/console/ConsoleClient.d.ts +0 -53
  579. package/bin/console/ConsoleClient.d.ts.map +0 -1
  580. package/bin/console/ConsoleClient.js +0 -258
  581. package/bin/console/ConsoleClient.js.map +0 -1
  582. package/bin/console/ConsoleGateway.d.ts +0 -102
  583. package/bin/console/ConsoleGateway.d.ts.map +0 -1
  584. package/bin/console/ConsoleGateway.js +0 -283
  585. package/bin/console/ConsoleGateway.js.map +0 -1
  586. package/bin/console/ConsoleGatewayRoutes.d.ts +0 -133
  587. package/bin/console/ConsoleGatewayRoutes.d.ts.map +0 -1
  588. package/bin/console/ConsoleGatewayRoutes.js +0 -292
  589. package/bin/console/ConsoleGatewayRoutes.js.map +0 -1
  590. package/bin/console/EnvApiRoutes.d.ts +0 -18
  591. package/bin/console/EnvApiRoutes.d.ts.map +0 -1
  592. package/bin/console/EnvApiRoutes.js +0 -228
  593. package/bin/console/EnvApiRoutes.js.map +0 -1
  594. package/bin/console/InlineInstantRoutes.d.ts +0 -19
  595. package/bin/console/InlineInstantRoutes.d.ts.map +0 -1
  596. package/bin/console/InlineInstantRoutes.js +0 -58
  597. package/bin/console/InlineInstantRoutes.js.map +0 -1
  598. package/bin/console/InlineInstantSessionService.d.ts +0 -36
  599. package/bin/console/InlineInstantSessionService.d.ts.map +0 -1
  600. package/bin/console/InlineInstantSessionService.js +0 -190
  601. package/bin/console/InlineInstantSessionService.js.map +0 -1
  602. package/bin/console/InlineInstantSystemComposer.d.ts +0 -34
  603. package/bin/console/InlineInstantSystemComposer.d.ts.map +0 -1
  604. package/bin/console/InlineInstantSystemComposer.js +0 -40
  605. package/bin/console/InlineInstantSystemComposer.js.map +0 -1
  606. package/bin/console/ModelApiRoutes.d.ts +0 -35
  607. package/bin/console/ModelApiRoutes.d.ts.map +0 -1
  608. package/bin/console/ModelApiRoutes.js +0 -237
  609. package/bin/console/ModelApiRoutes.js.map +0 -1
  610. package/bin/console/ModelPoolService.d.ts +0 -126
  611. package/bin/console/ModelPoolService.d.ts.map +0 -1
  612. package/bin/console/ModelPoolService.js +0 -327
  613. package/bin/console/ModelPoolService.js.map +0 -1
  614. package/bin/console/PluginApiRoutes.d.ts +0 -28
  615. package/bin/console/PluginApiRoutes.d.ts.map +0 -1
  616. package/bin/console/PluginApiRoutes.js +0 -299
  617. package/bin/console/PluginApiRoutes.js.map +0 -1
  618. package/bin/console/gateway/AgentActions.d.ts +0 -107
  619. package/bin/console/gateway/AgentActions.d.ts.map +0 -1
  620. package/bin/console/gateway/AgentActions.js +0 -314
  621. package/bin/console/gateway/AgentActions.js.map +0 -1
  622. package/bin/console/gateway/AgentCatalog.d.ts +0 -83
  623. package/bin/console/gateway/AgentCatalog.d.ts.map +0 -1
  624. package/bin/console/gateway/AgentCatalog.js +0 -484
  625. package/bin/console/gateway/AgentCatalog.js.map +0 -1
  626. package/bin/console/gateway/FrontendAssets.d.ts +0 -21
  627. package/bin/console/gateway/FrontendAssets.d.ts.map +0 -1
  628. package/bin/console/gateway/FrontendAssets.js +0 -77
  629. package/bin/console/gateway/FrontendAssets.js.map +0 -1
  630. package/bin/console/gateway/GatewaySupport.d.ts +0 -34
  631. package/bin/console/gateway/GatewaySupport.d.ts.map +0 -1
  632. package/bin/console/gateway/GatewaySupport.js +0 -32
  633. package/bin/console/gateway/GatewaySupport.js.map +0 -1
  634. package/bin/console/gateway/Proxy.d.ts +0 -16
  635. package/bin/console/gateway/Proxy.d.ts.map +0 -1
  636. package/bin/console/gateway/Proxy.js +0 -47
  637. package/bin/console/gateway/Proxy.js.map +0 -1
  638. package/bin/constants/DowncitySchema.d.ts +0 -3
  639. package/bin/constants/DowncitySchema.d.ts.map +0 -1
  640. package/bin/constants/DowncitySchema.js +0 -367
  641. package/bin/constants/DowncitySchema.js.map +0 -1
  642. package/bin/daemon/Api.d.ts +0 -60
  643. package/bin/daemon/Api.d.ts.map +0 -1
  644. package/bin/daemon/Api.js.map +0 -1
  645. package/bin/daemon/CliArgs.d.ts +0 -17
  646. package/bin/daemon/CliArgs.d.ts.map +0 -1
  647. package/bin/daemon/CliArgs.js +0 -30
  648. package/bin/daemon/CliArgs.js.map +0 -1
  649. package/bin/daemon/Client.d.ts.map +0 -1
  650. package/bin/daemon/Client.js +0 -158
  651. package/bin/daemon/Client.js.map +0 -1
  652. package/bin/daemon/Manager.d.ts +0 -92
  653. package/bin/daemon/Manager.d.ts.map +0 -1
  654. package/bin/daemon/Manager.js +0 -287
  655. package/bin/daemon/Manager.js.map +0 -1
  656. package/bin/daemon/PortAllocator.d.ts.map +0 -1
  657. package/bin/daemon/PortAllocator.js.map +0 -1
  658. package/bin/http/dashboard/AuthDashboardService.d.ts +0 -30
  659. package/bin/http/dashboard/AuthDashboardService.d.ts.map +0 -1
  660. package/bin/http/dashboard/AuthDashboardService.js +0 -120
  661. package/bin/http/dashboard/AuthDashboardService.js.map +0 -1
  662. package/bin/http/dashboard/CommonHelpers.d.ts +0 -24
  663. package/bin/http/dashboard/CommonHelpers.d.ts.map +0 -1
  664. package/bin/http/dashboard/CommonHelpers.js +0 -46
  665. package/bin/http/dashboard/CommonHelpers.js.map +0 -1
  666. package/bin/http/dashboard/ExecuteInput.d.ts +0 -18
  667. package/bin/http/dashboard/ExecuteInput.d.ts.map +0 -1
  668. package/bin/http/dashboard/ExecuteInput.js +0 -201
  669. package/bin/http/dashboard/ExecuteInput.js.map +0 -1
  670. package/bin/http/dashboard/MessageTimeline.d.ts +0 -22
  671. package/bin/http/dashboard/MessageTimeline.d.ts.map +0 -1
  672. package/bin/http/dashboard/MessageTimeline.js +0 -226
  673. package/bin/http/dashboard/MessageTimeline.js.map +0 -1
  674. package/bin/http/dashboard/SessionSummaryStore.d.ts +0 -19
  675. package/bin/http/dashboard/SessionSummaryStore.d.ts.map +0 -1
  676. package/bin/http/dashboard/SessionSummaryStore.js +0 -62
  677. package/bin/http/dashboard/SessionSummaryStore.js.map +0 -1
  678. package/bin/http/dashboard/TaskStore.d.ts +0 -33
  679. package/bin/http/dashboard/TaskStore.d.ts.map +0 -1
  680. package/bin/http/dashboard/TaskStore.js +0 -157
  681. package/bin/http/dashboard/TaskStore.js.map +0 -1
  682. package/bin/model/ModelCommand.d.ts +0 -60
  683. package/bin/model/ModelCommand.d.ts.map +0 -1
  684. package/bin/model/ModelCommand.js +0 -46
  685. package/bin/model/ModelCommand.js.map +0 -1
  686. package/bin/model/ModelManager.d.ts +0 -71
  687. package/bin/model/ModelManager.d.ts.map +0 -1
  688. package/bin/model/ModelManager.js +0 -187
  689. package/bin/model/ModelManager.js.map +0 -1
  690. package/bin/registry/AgentHostRuntime.d.ts +0 -10
  691. package/bin/registry/AgentHostRuntime.d.ts.map +0 -1
  692. package/bin/registry/AgentHostRuntime.js +0 -47
  693. package/bin/registry/AgentHostRuntime.js.map +0 -1
  694. package/bin/registry/CityPaths.d.ts +0 -61
  695. package/bin/registry/CityPaths.d.ts.map +0 -1
  696. package/bin/registry/CityPaths.js +0 -90
  697. package/bin/registry/CityPaths.js.map +0 -1
  698. package/bin/registry/CityRegistry.d.ts +0 -51
  699. package/bin/registry/CityRegistry.d.ts.map +0 -1
  700. package/bin/registry/CityRegistry.js +0 -217
  701. package/bin/registry/CityRegistry.js.map +0 -1
  702. package/bin/registry/CityRuntime.d.ts +0 -21
  703. package/bin/registry/CityRuntime.d.ts.map +0 -1
  704. package/bin/registry/CityRuntime.js +0 -45
  705. package/bin/registry/CityRuntime.js.map +0 -1
  706. package/bin/registry/PluginRuntime.d.ts +0 -24
  707. package/bin/registry/PluginRuntime.d.ts.map +0 -1
  708. package/bin/registry/PluginRuntime.js.map +0 -1
  709. package/bin/registry/ProcessSweep.d.ts +0 -76
  710. package/bin/registry/ProcessSweep.d.ts.map +0 -1
  711. package/bin/registry/ProcessSweep.js +0 -202
  712. package/bin/registry/ProcessSweep.js.map +0 -1
  713. package/bin/rpc/Client.d.ts +0 -13
  714. package/bin/rpc/Client.d.ts.map +0 -1
  715. package/bin/rpc/Client.js.map +0 -1
  716. package/bin/rpc/Paths.d.ts.map +0 -1
  717. package/bin/rpc/Paths.js +0 -36
  718. package/bin/rpc/Paths.js.map +0 -1
  719. package/bin/sandbox/MacOsSeatbeltSandbox.d.ts +0 -16
  720. package/bin/sandbox/MacOsSeatbeltSandbox.d.ts.map +0 -1
  721. package/bin/sandbox/MacOsSeatbeltSandbox.js +0 -152
  722. package/bin/sandbox/MacOsSeatbeltSandbox.js.map +0 -1
  723. package/bin/sandbox/SandboxConfigResolver.d.ts +0 -31
  724. package/bin/sandbox/SandboxConfigResolver.d.ts.map +0 -1
  725. package/bin/sandbox/SandboxConfigResolver.js +0 -113
  726. package/bin/sandbox/SandboxConfigResolver.js.map +0 -1
  727. package/bin/sandbox/SandboxRunner.d.ts +0 -46
  728. package/bin/sandbox/SandboxRunner.d.ts.map +0 -1
  729. package/bin/sandbox/SandboxRunner.js +0 -70
  730. package/bin/sandbox/SandboxRunner.js.map +0 -1
  731. package/bin/store/StoreChannelAccountRepository.d.ts +0 -34
  732. package/bin/store/StoreChannelAccountRepository.d.ts.map +0 -1
  733. package/bin/store/StoreChannelAccountRepository.js +0 -198
  734. package/bin/store/StoreChannelAccountRepository.js.map +0 -1
  735. package/bin/store/StoreEnvRepository.d.ts +0 -98
  736. package/bin/store/StoreEnvRepository.d.ts.map +0 -1
  737. package/bin/store/StoreEnvRepository.js +0 -334
  738. package/bin/store/StoreEnvRepository.js.map +0 -1
  739. package/bin/store/StoreModelRepository.d.ts +0 -61
  740. package/bin/store/StoreModelRepository.d.ts.map +0 -1
  741. package/bin/store/StoreModelRepository.js +0 -278
  742. package/bin/store/StoreModelRepository.js.map +0 -1
  743. package/bin/store/StoreSchema.d.ts +0 -13
  744. package/bin/store/StoreSchema.d.ts.map +0 -1
  745. package/bin/store/StoreSchema.js +0 -319
  746. package/bin/store/StoreSchema.js.map +0 -1
  747. package/bin/store/StoreSecureSettings.d.ts +0 -33
  748. package/bin/store/StoreSecureSettings.d.ts.map +0 -1
  749. package/bin/store/StoreSecureSettings.js +0 -91
  750. package/bin/store/StoreSecureSettings.js.map +0 -1
  751. package/bin/store/StoreShared.d.ts +0 -44
  752. package/bin/store/StoreShared.d.ts.map +0 -1
  753. package/bin/store/StoreShared.js +0 -40
  754. package/bin/store/StoreShared.js.map +0 -1
  755. package/bin/store/crypto.d.ts +0 -24
  756. package/bin/store/crypto.d.ts.map +0 -1
  757. package/bin/store/crypto.js +0 -101
  758. package/bin/store/crypto.js.map +0 -1
  759. package/bin/store/index.d.ts +0 -230
  760. package/bin/store/index.d.ts.map +0 -1
  761. package/bin/store/index.js +0 -360
  762. package/bin/store/index.js.map +0 -1
  763. package/bin/store/schema.d.ts +0 -690
  764. package/bin/store/schema.d.ts.map +0 -1
  765. package/bin/store/schema.js +0 -81
  766. package/bin/store/schema.js.map +0 -1
  767. package/bin/types/chat/ChatSession.d.ts +0 -30
  768. package/bin/types/chat/ChatSession.d.ts.map +0 -1
  769. package/bin/types/chat/ChatSession.js +0 -9
  770. package/bin/types/chat/ChatSession.js.map +0 -1
  771. package/bin/types/city/PublicHostEnv.d.ts +0 -72
  772. package/bin/types/city/PublicHostEnv.d.ts.map +0 -1
  773. package/bin/types/city/PublicHostEnv.js +0 -9
  774. package/bin/types/city/PublicHostEnv.js.map +0 -1
  775. package/bin/types/cli/AgentChat.d.ts +0 -147
  776. package/bin/types/cli/AgentChat.d.ts.map +0 -1
  777. package/bin/types/cli/AgentChat.js +0 -12
  778. package/bin/types/cli/AgentChat.js.map +0 -1
  779. package/bin/types/cli/AgentHistory.d.ts +0 -127
  780. package/bin/types/cli/AgentHistory.d.ts.map +0 -1
  781. package/bin/types/cli/AgentHistory.js +0 -9
  782. package/bin/types/cli/AgentHistory.js.map +0 -1
  783. package/bin/types/cli/AgentManager.d.ts +0 -113
  784. package/bin/types/cli/AgentManager.d.ts.map +0 -1
  785. package/bin/types/cli/AgentManager.js +0 -9
  786. package/bin/types/cli/AgentManager.js.map +0 -1
  787. package/bin/types/cli/AgentSelection.d.ts +0 -146
  788. package/bin/types/cli/AgentSelection.d.ts.map +0 -1
  789. package/bin/types/cli/AgentSelection.js +0 -9
  790. package/bin/types/cli/AgentSelection.js.map +0 -1
  791. package/bin/types/cli/ChatManager.d.ts +0 -64
  792. package/bin/types/cli/ChatManager.d.ts.map +0 -1
  793. package/bin/types/cli/ChatManager.js +0 -9
  794. package/bin/types/cli/ChatManager.js.map +0 -1
  795. package/bin/types/cli/CliError.d.ts.map +0 -1
  796. package/bin/types/cli/CliError.js.map +0 -1
  797. package/bin/types/cli/CliReporter.d.ts +0 -157
  798. package/bin/types/cli/CliReporter.d.ts.map +0 -1
  799. package/bin/types/cli/CliReporter.js +0 -10
  800. package/bin/types/cli/CliReporter.js.map +0 -1
  801. package/bin/types/cli/ModelManager.d.ts +0 -127
  802. package/bin/types/cli/ModelManager.d.ts.map +0 -1
  803. package/bin/types/cli/ModelManager.js +0 -9
  804. package/bin/types/cli/ModelManager.js.map +0 -1
  805. package/bin/types/contact/Contact.d.ts +0 -78
  806. package/bin/types/contact/Contact.d.ts.map +0 -1
  807. package/bin/types/contact/Contact.js +0 -9
  808. package/bin/types/contact/Contact.js.map +0 -1
  809. package/bin/types/contact/ContactApproval.d.ts +0 -145
  810. package/bin/types/contact/ContactApproval.d.ts.map +0 -1
  811. package/bin/types/contact/ContactApproval.js +0 -9
  812. package/bin/types/contact/ContactApproval.js.map +0 -1
  813. package/bin/types/contact/ContactChat.d.ts +0 -46
  814. package/bin/types/contact/ContactChat.d.ts.map +0 -1
  815. package/bin/types/contact/ContactChat.js +0 -9
  816. package/bin/types/contact/ContactChat.js.map +0 -1
  817. package/bin/types/contact/ContactCheck.d.ts +0 -66
  818. package/bin/types/contact/ContactCheck.d.ts.map +0 -1
  819. package/bin/types/contact/ContactCheck.js +0 -9
  820. package/bin/types/contact/ContactCheck.js.map +0 -1
  821. package/bin/types/contact/ContactCommand.d.ts +0 -93
  822. package/bin/types/contact/ContactCommand.d.ts.map +0 -1
  823. package/bin/types/contact/ContactCommand.js +0 -8
  824. package/bin/types/contact/ContactCommand.js.map +0 -1
  825. package/bin/types/contact/ContactEndpoint.d.ts +0 -12
  826. package/bin/types/contact/ContactEndpoint.d.ts.map +0 -1
  827. package/bin/types/contact/ContactEndpoint.js +0 -9
  828. package/bin/types/contact/ContactEndpoint.js.map +0 -1
  829. package/bin/types/contact/ContactLink.d.ts +0 -160
  830. package/bin/types/contact/ContactLink.d.ts.map +0 -1
  831. package/bin/types/contact/ContactLink.js +0 -9
  832. package/bin/types/contact/ContactLink.js.map +0 -1
  833. package/bin/types/contact/ContactShare.d.ts +0 -163
  834. package/bin/types/contact/ContactShare.d.ts.map +0 -1
  835. package/bin/types/contact/ContactShare.js +0 -9
  836. package/bin/types/contact/ContactShare.js.map +0 -1
  837. package/bin/types/sandbox/SandboxRuntime.d.ts +0 -318
  838. package/bin/types/sandbox/SandboxRuntime.d.ts.map +0 -1
  839. package/bin/types/sandbox/SandboxRuntime.js +0 -10
  840. package/bin/types/sandbox/SandboxRuntime.js.map +0 -1
  841. package/bin/types/store/Store.d.ts +0 -26
  842. package/bin/types/store/Store.d.ts.map +0 -1
  843. package/bin/types/store/Store.js +0 -9
  844. package/bin/types/store/Store.js.map +0 -1
  845. package/bin/types/task/TaskRunner.d.ts +0 -186
  846. package/bin/types/task/TaskRunner.d.ts.map +0 -1
  847. package/bin/types/task/TaskRunner.js +0 -9
  848. package/bin/types/task/TaskRunner.js.map +0 -1
  849. package/src/cli/AgentChat.ts +0 -415
  850. package/src/cli/AgentHistory.ts +0 -187
  851. package/src/cli/AgentManager.ts +0 -667
  852. package/src/cli/AgentReset.ts +0 -181
  853. package/src/cli/AgentSelection.ts +0 -297
  854. package/src/cli/ChatAuth.ts +0 -203
  855. package/src/cli/ChatManager.ts +0 -439
  856. package/src/cli/CliReporter.ts +0 -362
  857. package/src/cli/Config.ts +0 -301
  858. package/src/cli/Console.ts +0 -610
  859. package/src/cli/ConsoleAuthBootstrap.ts +0 -72
  860. package/src/cli/ConsoleInit.ts +0 -83
  861. package/src/cli/Env.ts +0 -556
  862. package/src/cli/IndexAgentCommand.ts +0 -303
  863. package/src/cli/IndexConsoleCommand.ts +0 -211
  864. package/src/cli/IndexConsoleProcess.ts +0 -497
  865. package/src/cli/IndexConsoleStatus.ts +0 -152
  866. package/src/cli/IndexSupport.ts +0 -138
  867. package/src/cli/Init.ts +0 -291
  868. package/src/cli/ModelCommandShared.ts +0 -126
  869. package/src/cli/ModelCreateCommand.ts +0 -424
  870. package/src/cli/ModelManageCommand.ts +0 -516
  871. package/src/cli/ModelManager.ts +0 -631
  872. package/src/cli/ModelReadCommand.ts +0 -207
  873. package/src/cli/ModelSupport.ts +0 -223
  874. package/src/cli/Plugins.ts +0 -568
  875. package/src/cli/PortHints.ts +0 -80
  876. package/src/cli/PublicAccess.ts +0 -106
  877. package/src/cli/PublicHostEnv.ts +0 -116
  878. package/src/cli/Restart.ts +0 -68
  879. package/src/cli/Run.ts +0 -148
  880. package/src/cli/ServiceActionCommands.ts +0 -414
  881. package/src/cli/ServiceCommandRemote.ts +0 -230
  882. package/src/cli/ServiceCommandSupport.ts +0 -275
  883. package/src/cli/ServiceScheduleCommand.ts +0 -305
  884. package/src/cli/Services.ts +0 -189
  885. package/src/cli/Start.ts +0 -72
  886. package/src/cli/Status.ts +0 -116
  887. package/src/cli/Stop.ts +0 -45
  888. package/src/cli/Token.ts +0 -702
  889. package/src/cli/Update.ts +0 -183
  890. package/src/console/AgentStatusApiRoutes.ts +0 -225
  891. package/src/console/ChannelAccountApiRoutes.ts +0 -119
  892. package/src/console/ConsoleClient.ts +0 -293
  893. package/src/console/ConsoleGateway.ts +0 -463
  894. package/src/console/ConsoleGatewayRoutes.ts +0 -495
  895. package/src/console/EnvApiRoutes.ts +0 -257
  896. package/src/console/InlineInstantRoutes.ts +0 -74
  897. package/src/console/InlineInstantSessionService.ts +0 -277
  898. package/src/console/InlineInstantSystemComposer.ts +0 -58
  899. package/src/console/ModelApiRoutes.ts +0 -336
  900. package/src/console/ModelPoolService.ts +0 -395
  901. package/src/console/PluginApiRoutes.ts +0 -453
  902. package/src/console/gateway/AgentActions.ts +0 -413
  903. package/src/console/gateway/AgentCatalog.ts +0 -606
  904. package/src/console/gateway/FrontendAssets.ts +0 -79
  905. package/src/console/gateway/GatewaySupport.ts +0 -59
  906. package/src/console/gateway/Proxy.ts +0 -62
  907. package/src/constants/DowncitySchema.ts +0 -377
  908. package/src/daemon/Api.ts +0 -64
  909. package/src/daemon/CliArgs.ts +0 -39
  910. package/src/daemon/Client.ts +0 -182
  911. package/src/daemon/Manager.ts +0 -344
  912. package/src/http/dashboard/AuthDashboardService.ts +0 -161
  913. package/src/http/dashboard/CommonHelpers.ts +0 -50
  914. package/src/http/dashboard/ExecuteInput.ts +0 -236
  915. package/src/http/dashboard/MessageTimeline.ts +0 -269
  916. package/src/http/dashboard/SessionSummaryStore.ts +0 -77
  917. package/src/http/dashboard/TaskStore.ts +0 -222
  918. package/src/model/ModelCommand.ts +0 -95
  919. package/src/model/ModelManager.ts +0 -242
  920. package/src/registry/AgentHostRuntime.ts +0 -65
  921. package/src/registry/CityPaths.ts +0 -101
  922. package/src/registry/CityRegistry.ts +0 -256
  923. package/src/registry/CityRuntime.ts +0 -45
  924. package/src/registry/PluginRuntime.ts +0 -42
  925. package/src/registry/ProcessSweep.ts +0 -256
  926. package/src/rpc/Client.ts +0 -110
  927. package/src/rpc/Paths.ts +0 -43
  928. package/src/sandbox/MacOsSeatbeltSandbox.ts +0 -196
  929. package/src/sandbox/SandboxConfigResolver.ts +0 -134
  930. package/src/sandbox/SandboxRunner.ts +0 -101
  931. package/src/store/StoreChannelAccountRepository.ts +0 -269
  932. package/src/store/StoreEnvRepository.ts +0 -452
  933. package/src/store/StoreModelRepository.ts +0 -324
  934. package/src/store/StoreSchema.ts +0 -344
  935. package/src/store/StoreSecureSettings.ts +0 -126
  936. package/src/store/StoreShared.ts +0 -67
  937. package/src/store/crypto.ts +0 -112
  938. package/src/store/index.ts +0 -497
  939. package/src/store/schema.ts +0 -103
  940. package/src/types/chat/ChatSession.ts +0 -32
  941. package/src/types/city/PublicHostEnv.ts +0 -76
  942. package/src/types/cli/AgentChat.ts +0 -172
  943. package/src/types/cli/AgentHistory.ts +0 -146
  944. package/src/types/cli/AgentManager.ts +0 -119
  945. package/src/types/cli/AgentSelection.ts +0 -162
  946. package/src/types/cli/ChatManager.ts +0 -65
  947. package/src/types/cli/CliReporter.ts +0 -167
  948. package/src/types/cli/ModelManager.ts +0 -139
  949. package/src/types/contact/Contact.ts +0 -82
  950. package/src/types/contact/ContactApproval.ts +0 -150
  951. package/src/types/contact/ContactChat.ts +0 -47
  952. package/src/types/contact/ContactCheck.ts +0 -67
  953. package/src/types/contact/ContactCommand.ts +0 -98
  954. package/src/types/contact/ContactEndpoint.ts +0 -16
  955. package/src/types/contact/ContactLink.ts +0 -169
  956. package/src/types/contact/ContactShare.ts +0 -172
  957. package/src/types/sandbox/SandboxRuntime.ts +0 -377
  958. package/src/types/store/Store.ts +0 -27
  959. package/src/types/task/TaskRunner.ts +0 -199
  960. /package/bin/cli/{AgentManager.d.ts → agent/AgentManager.d.ts} +0 -0
  961. /package/bin/cli/{Init.d.ts → agent/Init.d.ts} +0 -0
  962. /package/bin/cli/{Status.d.ts → agent/Status.d.ts} +0 -0
  963. /package/bin/cli/{Stop.d.ts → agent/Stop.d.ts} +0 -0
  964. /package/bin/cli/{Model.d.ts → model/Model.d.ts} +0 -0
  965. /package/bin/cli/{Model.js → model/Model.js} +0 -0
  966. /package/bin/cli/{ModelCreateCommand.d.ts → model/ModelCreateCommand.d.ts} +0 -0
  967. /package/bin/cli/{ModelManageCommand.d.ts → model/ModelManageCommand.d.ts} +0 -0
  968. /package/bin/cli/{ModelManageCommand.js → model/ModelManageCommand.js} +0 -0
  969. /package/bin/cli/{ModelManager.d.ts → model/ModelManager.d.ts} +0 -0
  970. /package/bin/cli/{ServiceActionCommands.d.ts → service/ServiceActionCommands.d.ts} +0 -0
  971. /package/bin/cli/{Services.d.ts → service/Services.d.ts} +0 -0
  972. /package/bin/cli/{Alias.d.ts → shared/Alias.d.ts} +0 -0
  973. /package/bin/cli/{Alias.js → shared/Alias.js} +0 -0
  974. /package/bin/cli/{Chat.d.ts → shared/Chat.d.ts} +0 -0
  975. /package/bin/cli/{Chat.js → shared/Chat.js} +0 -0
  976. /package/bin/cli/{ChatAuth.d.ts → shared/ChatAuth.d.ts} +0 -0
  977. /package/bin/cli/{ChatManager.d.ts → shared/ChatManager.d.ts} +0 -0
  978. /package/bin/{types/cli → cli/shared}/CliError.d.ts +0 -0
  979. /package/bin/{types/cli → cli/shared}/CliError.js +0 -0
  980. /package/bin/cli/{CliReporter.js → shared/CliReporter.js} +0 -0
  981. /package/bin/cli/{Config.d.ts → shared/Config.d.ts} +0 -0
  982. /package/bin/cli/{IndexAgentCommand.d.ts → shared/IndexAgentCommand.d.ts} +0 -0
  983. /package/bin/cli/{IndexSupport.d.ts → shared/IndexSupport.d.ts} +0 -0
  984. /package/bin/cli/{Plugins.d.ts → shared/Plugins.d.ts} +0 -0
  985. /package/bin/cli/{Reset.d.ts → shared/Reset.d.ts} +0 -0
  986. /package/bin/cli/{Reset.js → shared/Reset.js} +0 -0
  987. /package/bin/cli/{Token.d.ts → shared/Token.d.ts} +0 -0
  988. /package/bin/cli/{Update.d.ts → shared/Update.d.ts} +0 -0
  989. /package/bin/{daemon → process/daemon}/Api.js +0 -0
  990. /package/bin/{daemon → process/daemon}/Client.d.ts +0 -0
  991. /package/bin/{daemon → process/daemon}/PortAllocator.d.ts +0 -0
  992. /package/bin/{daemon → process/daemon}/PortAllocator.js +0 -0
  993. /package/bin/{registry → process/registry}/PluginRuntime.js +0 -0
  994. /package/bin/{rpc → process/rpc}/Client.js +0 -0
  995. /package/bin/{rpc → process/rpc}/Paths.d.ts +0 -0
  996. /package/src/cli/{Model.ts → model/Model.ts} +0 -0
  997. /package/src/cli/{Alias.ts → shared/Alias.ts} +0 -0
  998. /package/src/cli/{Chat.ts → shared/Chat.ts} +0 -0
  999. /package/src/{types/cli → cli/shared}/CliError.ts +0 -0
  1000. /package/src/cli/{Reset.ts → shared/Reset.ts} +0 -0
  1001. /package/src/{daemon → process/daemon}/PortAllocator.ts +0 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * CityPaths:city 全局运行态与 control plane 共享的路径规则。
3
+ *
4
+ * 关键点(中文)
5
+ * - Downcity 的全局根目录固定在用户目录 `~/.downcity/`。
6
+ * - `~/.downcity/downcity.db`:全局 SQLite 数据库,保存模型池与平台级配置。
7
+ * - `~/.downcity/main/*`:city 后台与 control plane 共享的运行文件目录。
8
+ * - 这里定义的是“全局路径约定”,不是单个 agent 项目的 `.downcity/` 路径。
9
+ */
10
+
11
+ import os from "node:os";
12
+ import path from "node:path";
13
+
14
+ /**
15
+ * 全局根目录(用户级)。
16
+ *
17
+ * 关键点(中文)
18
+ * - 测试或多实例隔离场景可通过 `DC_PLATFORM_ROOT` 显式覆盖。
19
+ */
20
+ export function getPlatformRootDirPath(): string {
21
+ const explicitRoot = String(process.env.DC_PLATFORM_ROOT || "").trim();
22
+ if (explicitRoot) return path.resolve(explicitRoot);
23
+ return path.join(os.homedir(), ".downcity");
24
+ }
25
+
26
+ /**
27
+ * 全局 SQLite 数据库路径(用户级)。
28
+ */
29
+ export function getPlatformStoreDbPath(): string {
30
+ return path.join(getPlatformRootDirPath(), "downcity.db");
31
+ }
32
+
33
+ /**
34
+ * city 全局运行目录(pid/log/registry)。
35
+ */
36
+ export function getCityRuntimeDirPath(): string {
37
+ return path.join(getPlatformRootDirPath(), "main");
38
+ }
39
+
40
+ /**
41
+ * 全局模型存储密钥文件路径。
42
+ */
43
+ export function getPlatformStoreKeyPath(): string {
44
+ return path.join(getCityRuntimeDirPath(), "model-db.key");
45
+ }
46
+
47
+ /**
48
+ * city 后台 pid 文件路径。
49
+ */
50
+ export function getCityPidPath(): string {
51
+ return path.join(getCityRuntimeDirPath(), "city.pid");
52
+ }
53
+
54
+ /**
55
+ * city 后台日志路径(stdout/stderr 合并)。
56
+ */
57
+ export function getCityLogPath(): string {
58
+ return path.join(getCityRuntimeDirPath(), "city.log");
59
+ }
60
+
61
+ /**
62
+ * control plane pid 文件路径。
63
+ */
64
+ export function getControlPlanePidPath(): string {
65
+ return path.join(getCityRuntimeDirPath(), "control-plane.pid");
66
+ }
67
+
68
+ /**
69
+ * control plane 日志路径(stdout/stderr 合并)。
70
+ */
71
+ export function getControlPlaneLogPath(): string {
72
+ return path.join(getCityRuntimeDirPath(), "control-plane.log");
73
+ }
74
+
75
+ /**
76
+ * control plane 元数据路径。
77
+ */
78
+ export function getControlPlaneMetaPath(): string {
79
+ return path.join(getCityRuntimeDirPath(), "control-plane.json");
80
+ }
81
+
82
+ /**
83
+ * 受管 agent registry 文件路径(city 维护的 agent 清单)。
84
+ */
85
+ export function getManagedAgentRegistryPath(): string {
86
+ return path.join(getCityRuntimeDirPath(), "agents.json");
87
+ }
@@ -0,0 +1,256 @@
1
+ /**
2
+ * CityRegistry:city 后台维护的 agent registry(`~/.downcity/main/agents.json`)。
3
+ *
4
+ * 关键点(中文)
5
+ * - registry 只维护“city 认知到的 agent 项目列表”,用于统一观测与批量管理。
6
+ * - registry 不承载实时健康检查:status/list 会读取每个项目的 daemon pid 并判活。
7
+ * - agent daemon 启动成功后必须登记到 city 后台(强约束)。
8
+ */
9
+
10
+ import fs from "fs-extra";
11
+ import path from "node:path";
12
+ import type {
13
+ ManagedAgentRegistryEntry,
14
+ ManagedAgentRegistryV1,
15
+ } from "@downcity/agent";
16
+ import { getManagedAgentRegistryPath, getCityRuntimeDirPath } from "./CityPaths.js";
17
+ import { isCityRunning } from "./CityRuntime.js";
18
+
19
+ const CONSOLE_DIR = getCityRuntimeDirPath();
20
+ const MANAGED_AGENTS_FILE = getManagedAgentRegistryPath();
21
+
22
+ function buildEmptyRegistry(): ManagedAgentRegistryV1 {
23
+ return {
24
+ v: 1,
25
+ updatedAt: new Date().toISOString(),
26
+ agents: [],
27
+ };
28
+ }
29
+
30
+ function normalizeProjectRoot(projectRoot: string): string {
31
+ const resolved = path.resolve(String(projectRoot || "").trim());
32
+ if (!resolved) throw new Error("projectRoot is required");
33
+ return resolved;
34
+ }
35
+
36
+ function normalizePid(pid: number): number {
37
+ if (!Number.isFinite(pid) || Number.isNaN(pid) || !Number.isInteger(pid) || pid < 1) {
38
+ throw new Error(`Invalid pid: ${pid}`);
39
+ }
40
+ return pid;
41
+ }
42
+
43
+ function normalizeIsoTime(input: string | undefined): string {
44
+ const value = String(input || "").trim();
45
+ if (!value) return new Date().toISOString();
46
+ const ms = Date.parse(value);
47
+ if (!Number.isFinite(ms)) return new Date().toISOString();
48
+ return new Date(ms).toISOString();
49
+ }
50
+
51
+ function normalizeRegistryEntry(
52
+ entry: Partial<ManagedAgentRegistryEntry>,
53
+ ): ManagedAgentRegistryEntry | null {
54
+ try {
55
+ const projectRoot = normalizeProjectRoot(String(entry.projectRoot || ""));
56
+ const pid = normalizePid(Number(entry.pid));
57
+ const startedAt = normalizeIsoTime(
58
+ typeof entry.startedAt === "string" ? entry.startedAt : undefined,
59
+ );
60
+ const updatedAt = normalizeIsoTime(
61
+ typeof entry.updatedAt === "string" ? entry.updatedAt : undefined,
62
+ );
63
+ return {
64
+ projectRoot,
65
+ pid,
66
+ startedAt,
67
+ updatedAt,
68
+ status:
69
+ entry.status === "stopped"
70
+ ? "stopped"
71
+ : "running",
72
+ stoppedAt:
73
+ entry.status === "stopped"
74
+ ? normalizeIsoTime(
75
+ typeof entry.stoppedAt === "string"
76
+ ? entry.stoppedAt
77
+ : undefined,
78
+ )
79
+ : undefined,
80
+ };
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+
86
+ function normalizeRegistry(
87
+ value: Partial<ManagedAgentRegistryV1> | null | undefined,
88
+ ): ManagedAgentRegistryV1 {
89
+ if (!value || typeof value !== "object") return buildEmptyRegistry();
90
+ const source = Array.isArray(value.agents) ? value.agents : [];
91
+ const normalizedAgents: ManagedAgentRegistryEntry[] = [];
92
+ for (const item of source) {
93
+ if (!item || typeof item !== "object") continue;
94
+ const normalized = normalizeRegistryEntry(item as ManagedAgentRegistryEntry);
95
+ if (!normalized) continue;
96
+ const existingIndex = normalizedAgents.findIndex(
97
+ (entry) => entry.projectRoot === normalized.projectRoot,
98
+ );
99
+ if (existingIndex >= 0) {
100
+ normalizedAgents[existingIndex] = normalized;
101
+ continue;
102
+ }
103
+ normalizedAgents.push(normalized);
104
+ }
105
+ return {
106
+ v: 1,
107
+ updatedAt: normalizeIsoTime(
108
+ typeof value.updatedAt === "string" ? value.updatedAt : undefined,
109
+ ),
110
+ agents: normalizedAgents.sort((a, b) =>
111
+ a.projectRoot.localeCompare(b.projectRoot),
112
+ ),
113
+ };
114
+ }
115
+
116
+ async function writeManagedAgentRegistry(
117
+ registry: ManagedAgentRegistryV1,
118
+ ): Promise<void> {
119
+ await fs.ensureDir(CONSOLE_DIR);
120
+ await fs.writeJson(MANAGED_AGENTS_FILE, normalizeRegistry(registry), {
121
+ spaces: 2,
122
+ });
123
+ }
124
+
125
+ /**
126
+ * 确保 city agent registry 文件存在。
127
+ *
128
+ * 关键点(中文)
129
+ * - 空 city 运行态也应拥有显式的空 registry,避免 Console 将“尚未启动任何 agent”误判为异常。
130
+ * - 若文件已存在则不覆盖,保持历史记录不丢失。
131
+ */
132
+ export async function ensureManagedAgentRegistry(): Promise<void> {
133
+ await fs.ensureDir(CONSOLE_DIR);
134
+ if (await fs.pathExists(MANAGED_AGENTS_FILE)) {
135
+ return;
136
+ }
137
+ await writeManagedAgentRegistry(buildEmptyRegistry());
138
+ }
139
+
140
+ /**
141
+ * 获取 city agent registry 文件路径。
142
+ */
143
+ export function getManagedAgentsRegistryPath(): string {
144
+ return MANAGED_AGENTS_FILE;
145
+ }
146
+
147
+ /**
148
+ * 读取 city agent registry(容错)。
149
+ *
150
+ * 关键点(中文)
151
+ * - 文件不存在或损坏时返回空 registry,避免影响主流程。
152
+ */
153
+ export async function readManagedAgentRegistry(): Promise<ManagedAgentRegistryV1> {
154
+ try {
155
+ if (!(await fs.pathExists(MANAGED_AGENTS_FILE))) {
156
+ return buildEmptyRegistry();
157
+ }
158
+ const raw = (await fs.readJson(MANAGED_AGENTS_FILE)) as Partial<ManagedAgentRegistryV1>;
159
+ return normalizeRegistry(raw);
160
+ } catch {
161
+ return buildEmptyRegistry();
162
+ }
163
+ }
164
+
165
+ /**
166
+ * 列出 city registry 中记录的 agent(按 projectRoot 排序)。
167
+ */
168
+ export async function listManagedAgentEntries(): Promise<ManagedAgentRegistryEntry[]> {
169
+ const registry = await readManagedAgentRegistry();
170
+ return [...registry.agents].sort((a, b) => a.projectRoot.localeCompare(b.projectRoot));
171
+ }
172
+
173
+ /**
174
+ * 新增或更新一条 city agent 记录。
175
+ */
176
+ export async function upsertManagedAgentEntry(input: {
177
+ projectRoot: string;
178
+ pid: number;
179
+ startedAt?: string;
180
+ status?: "running" | "stopped";
181
+ stoppedAt?: string;
182
+ }): Promise<void> {
183
+ // 关键点(中文):agent 必须登记到 city 后台才“有效”,因此 city 未启动时拒绝写入 registry。
184
+ if (!(await isCityRunning())) {
185
+ throw new Error("city runtime is not running");
186
+ }
187
+
188
+ const projectRoot = normalizeProjectRoot(input.projectRoot);
189
+ const pid = normalizePid(input.pid);
190
+ const nowIso = new Date().toISOString();
191
+
192
+ const registry = await readManagedAgentRegistry();
193
+ const index = registry.agents.findIndex((entry) => entry.projectRoot === projectRoot);
194
+ if (index >= 0) {
195
+ const existing = registry.agents[index];
196
+ registry.agents[index] = {
197
+ projectRoot,
198
+ pid,
199
+ startedAt: normalizeIsoTime(existing.startedAt || input.startedAt),
200
+ updatedAt: nowIso,
201
+ status: input.status === "stopped" ? "stopped" : "running",
202
+ stoppedAt:
203
+ input.status === "stopped"
204
+ ? normalizeIsoTime(input.stoppedAt || nowIso)
205
+ : undefined,
206
+ };
207
+ } else {
208
+ registry.agents.push({
209
+ projectRoot,
210
+ pid,
211
+ startedAt: normalizeIsoTime(input.startedAt),
212
+ updatedAt: nowIso,
213
+ status: input.status === "stopped" ? "stopped" : "running",
214
+ stoppedAt:
215
+ input.status === "stopped"
216
+ ? normalizeIsoTime(input.stoppedAt || nowIso)
217
+ : undefined,
218
+ });
219
+ }
220
+
221
+ registry.updatedAt = nowIso;
222
+ await writeManagedAgentRegistry(registry);
223
+ }
224
+
225
+ /**
226
+ * 标记 agent 为 stopped(保留历史记录,不删除)。
227
+ */
228
+ export async function markManagedAgentStopped(projectRoot: string): Promise<void> {
229
+ const key = normalizeProjectRoot(projectRoot);
230
+ const registry = await readManagedAgentRegistry();
231
+ const index = registry.agents.findIndex((entry) => entry.projectRoot === key);
232
+ if (index < 0) return;
233
+ const nowIso = new Date().toISOString();
234
+ const current = registry.agents[index];
235
+ registry.agents[index] = {
236
+ ...current,
237
+ status: "stopped",
238
+ stoppedAt: nowIso,
239
+ updatedAt: nowIso,
240
+ };
241
+ registry.updatedAt = nowIso;
242
+ await writeManagedAgentRegistry(registry);
243
+ }
244
+
245
+ /**
246
+ * 按 projectRoot 移除一条 agent 记录。
247
+ */
248
+ export async function removeManagedAgentEntry(projectRoot: string): Promise<void> {
249
+ const key = normalizeProjectRoot(projectRoot);
250
+ const registry = await readManagedAgentRegistry();
251
+ const nextAgents = registry.agents.filter((entry) => entry.projectRoot !== key);
252
+ if (nextAgents.length === registry.agents.length) return;
253
+ registry.agents = nextAgents;
254
+ registry.updatedAt = new Date().toISOString();
255
+ await writeManagedAgentRegistry(registry);
256
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * CityRuntime:city 后台进程状态工具。
3
+ *
4
+ * 关键点(中文)
5
+ * - city 后台负责统一管理/观测多个 agent daemon。
6
+ * - 这里处理的是 city 后台自身的 pid 与判活,不涉及 control plane 进程。
7
+ * - agent daemon 启动前必须确保 city 后台已启动(强约束)。
8
+ */
9
+
10
+ import fs from "fs-extra";
11
+ import { getCityPidPath } from "./CityPaths.js";
12
+
13
+ /**
14
+ * 读取 city 后台 pid(读取失败或内容非法返回 null)。
15
+ */
16
+ export async function readCityPid(): Promise<number | null> {
17
+ try {
18
+ const raw = await fs.readFile(getCityPidPath(), "utf-8");
19
+ const pid = Number.parseInt(String(raw).trim(), 10);
20
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+
26
+ /**
27
+ * 判断 city 后台进程是否存活。
28
+ */
29
+ export function isCityProcessAlive(pid: number): boolean {
30
+ try {
31
+ process.kill(pid, 0);
32
+ return true;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+
38
+ /**
39
+ * 判断 city 后台是否在运行(基于 pid file + 判活)。
40
+ */
41
+ export async function isCityRunning(): Promise<boolean> {
42
+ const pid = await readCityPid();
43
+ if (!pid) return false;
44
+ return isCityProcessAlive(pid);
45
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * PluginRuntime:city 级 plugin 运行时注入模块。
3
+ *
4
+ * 关键点(中文)
5
+ * - PluginRegistry / PluginManager 属于 city runtime,不应直接反向 import agent AgentContext 单例。
6
+ * - 当前模块只负责保存“当前执行上下文 resolver”的注入入口。
7
+ * - agent runtime 仅作为 context provider 注册方,不再成为 plugin manager 的宿主。
8
+ */
9
+
10
+ import type { AgentContext } from "@downcity/agent";
11
+
12
+ type AgentContextResolver = () => AgentContext;
13
+
14
+ let executionContextResolver: AgentContextResolver | null = null;
15
+
16
+ /**
17
+ * 设置当前 city plugin runtime 的执行上下文 resolver。
18
+ */
19
+ export function setPluginRuntimeContextResolver(
20
+ resolver: AgentContextResolver,
21
+ ): void {
22
+ executionContextResolver = resolver;
23
+ }
24
+
25
+ /**
26
+ * 清理当前 city plugin runtime 的执行上下文 resolver。
27
+ */
28
+ export function clearPluginRuntimeContextResolver(): void {
29
+ executionContextResolver = null;
30
+ }
31
+
32
+ /**
33
+ * 读取当前 city plugin runtime 的执行上下文 resolver。
34
+ */
35
+ export function getPluginRuntimeContextResolver(): AgentContextResolver {
36
+ if (!executionContextResolver) {
37
+ throw new Error(
38
+ "Plugin runtime context resolver is not configured. Configure city plugin runtime before using PluginManager.",
39
+ );
40
+ }
41
+ return executionContextResolver;
42
+ }
@@ -0,0 +1,256 @@
1
+ /**
2
+ * 孤儿进程清扫工具。
3
+ *
4
+ * 关键点(中文)
5
+ * - 处理“pid 文件不存在,但旧的 detached 进程还活着”的场景。
6
+ * - 仅匹配 Downcity CLI 自己拉起的 `run` / `console run` / `agent start --foreground true`。
7
+ * - 作为 stop/start 的兜底清理层,避免旧版本进程占住端口却无法被当前 pid 文件追踪。
8
+ * - `run` 指 city 后台,`console run` 指 control plane 命令,二者需要明确区分。
9
+ */
10
+
11
+ import { execFile as execFileCb } from "node:child_process";
12
+ import { promisify } from "node:util";
13
+
14
+ const execFileAsync = promisify(execFileCb);
15
+
16
+ function isProcessAlive(pid: number): boolean {
17
+ try {
18
+ process.kill(pid, 0);
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ function normalizeCommand(command: string): string {
26
+ return String(command || "").replace(/\s+/g, " ").trim();
27
+ }
28
+
29
+ /**
30
+ * 构建 detached 进程停机时的信号目标。
31
+ *
32
+ * 关键点(中文)
33
+ * - POSIX 下 `detached: true` 会让子进程成为新的进程组 leader。
34
+ * - `-pid` 表示向整个进程组发信号,可覆盖 ACP、shell、watcher 等孙进程。
35
+ * - Windows 不支持负 pid 进程组语义,只能回退到单 pid。
36
+ */
37
+ export function buildDetachedProcessSignalTargets(pid: number): number[] {
38
+ if (!Number.isInteger(pid) || pid <= 0) return [];
39
+ if (process.platform === "win32") return [pid];
40
+ return [-pid, pid];
41
+ }
42
+
43
+ /**
44
+ * 向 detached 进程发送信号。
45
+ *
46
+ * 关键点(中文)
47
+ * - 优先发送到进程组;失败后再尝试单 pid。
48
+ * - 返回值只表示至少有一个目标接收到了信号,不代表进程已经退出。
49
+ */
50
+ export function signalDetachedProcess(
51
+ pid: number,
52
+ signal: NodeJS.Signals,
53
+ ): boolean {
54
+ for (const target of buildDetachedProcessSignalTargets(pid)) {
55
+ try {
56
+ process.kill(target, signal);
57
+ return true;
58
+ } catch {
59
+ // 尝试下一个目标。
60
+ }
61
+ }
62
+ return false;
63
+ }
64
+
65
+ function parseDowncityCliArgs(command: string): string | null {
66
+ const normalized = normalizeCommand(command);
67
+ const match = normalized.match(
68
+ /(?:^|\s)(\S*[\\/]Index\.js)(?:\s+(.+)|$)/,
69
+ );
70
+ if (!match) return null;
71
+ const entryPath = String(match[1] || "");
72
+ const isKnownEntry =
73
+ /[\\/]bin[\\/]cli[\\/]Index\.js$/.test(entryPath) ||
74
+ /[\\/]bin[\\/]main[\\/]modules[\\/]cli[\\/]Index\.js$/.test(entryPath);
75
+ if (!isKnownEntry) return null;
76
+
77
+ const args = String(match[2] || "").trim();
78
+ return args;
79
+ }
80
+
81
+ export function isDowncityCliCommand(command: string): boolean {
82
+ return parseDowncityCliArgs(command) !== null;
83
+ }
84
+
85
+ /**
86
+ * 判断命令行是否属于本次清扫目标。
87
+ *
88
+ * 关键点(中文)
89
+ * - `Index.js run` 是 city runtime。
90
+ * - `Index.js console run` 是 control plane runtime。
91
+ * - 两者都包含 `run`,因此必须按完整子命令匹配,不能只查 `run` 词元。
92
+ */
93
+ export function shouldSweepDetachedCityCommand(
94
+ command: string,
95
+ params: {
96
+ includeConsole?: boolean;
97
+ includeUi?: boolean;
98
+ includeAgent?: boolean;
99
+ },
100
+ ): boolean {
101
+ const args = parseDowncityCliArgs(command);
102
+ if (args === null) return false;
103
+ if (
104
+ params.includeConsole &&
105
+ /^run(?:\s|$)/.test(args)
106
+ ) {
107
+ return true;
108
+ }
109
+ if (
110
+ params.includeUi &&
111
+ /^console\s+run(?:\s|$)/.test(args)
112
+ ) {
113
+ return true;
114
+ }
115
+ if (
116
+ params.includeAgent &&
117
+ /^agent\s+start(?:\s|$)/.test(args) &&
118
+ /--foreground\s+true\b/.test(args)
119
+ ) {
120
+ return true;
121
+ }
122
+ return false;
123
+ }
124
+
125
+ async function listDetachedCityProcesses(params: {
126
+ includeConsole?: boolean;
127
+ includeUi?: boolean;
128
+ includeAgent?: boolean;
129
+ excludePids: Set<number>;
130
+ }): Promise<Array<{ pid: number; command: string }>> {
131
+ if (process.platform === "win32") {
132
+ return [];
133
+ }
134
+
135
+ try {
136
+ const { stdout } = await execFileAsync(
137
+ "ps",
138
+ ["-axo", "pid=,command="],
139
+ {
140
+ maxBuffer: 1024 * 1024,
141
+ },
142
+ );
143
+
144
+ return String(stdout || "")
145
+ .split("\n")
146
+ .map((line) => line.match(/^\s*(\d+)\s+(.*)$/))
147
+ .filter((item): item is RegExpMatchArray => Boolean(item))
148
+ .map((item) => ({
149
+ pid: Number.parseInt(item[1] || "", 10),
150
+ command: normalizeCommand(item[2] || ""),
151
+ }))
152
+ .filter((item) => Number.isInteger(item.pid) && item.pid > 0)
153
+ .filter((item) => !params.excludePids.has(item.pid))
154
+ .filter((item) => shouldSweepDetachedCityCommand(item.command, params));
155
+ } catch {
156
+ return [];
157
+ }
158
+ }
159
+
160
+ /**
161
+ * 只探测失联的 Downcity detached 进程,不执行停止动作。
162
+ */
163
+ export async function findDetachedCityProcesses(params?: {
164
+ includeConsole?: boolean;
165
+ includeUi?: boolean;
166
+ includeAgent?: boolean;
167
+ excludePids?: number[];
168
+ }): Promise<Array<{ pid: number; command: string }>> {
169
+ const excludePids = new Set<number>([
170
+ process.pid,
171
+ ...(Array.isArray(params?.excludePids) ? params.excludePids : []),
172
+ ]);
173
+
174
+ return listDetachedCityProcesses({
175
+ includeConsole: params?.includeConsole,
176
+ includeUi: params?.includeUi,
177
+ includeAgent: params?.includeAgent,
178
+ excludePids,
179
+ });
180
+ }
181
+
182
+ async function stopPid(pid: number, timeoutMs: number): Promise<boolean> {
183
+ if (!isProcessAlive(pid)) return true;
184
+
185
+ if (!signalDetachedProcess(pid, "SIGTERM")) {
186
+ return !isProcessAlive(pid);
187
+ }
188
+
189
+ const termStart = Date.now();
190
+ while (Date.now() - termStart < timeoutMs) {
191
+ if (!isProcessAlive(pid)) return true;
192
+ await new Promise((resolve) => setTimeout(resolve, 200));
193
+ }
194
+
195
+ try {
196
+ if (isProcessAlive(pid)) {
197
+ signalDetachedProcess(pid, "SIGKILL");
198
+ }
199
+ } catch {
200
+ return !isProcessAlive(pid);
201
+ }
202
+
203
+ const killStart = Date.now();
204
+ while (Date.now() - killStart < 2_000) {
205
+ if (!isProcessAlive(pid)) return true;
206
+ await new Promise((resolve) => setTimeout(resolve, 100));
207
+ }
208
+
209
+ return !isProcessAlive(pid);
210
+ }
211
+
212
+ /**
213
+ * 清扫失联的 Downcity detached 进程。
214
+ */
215
+ export async function sweepDetachedCityProcesses(params?: {
216
+ includeConsole?: boolean;
217
+ includeUi?: boolean;
218
+ includeAgent?: boolean;
219
+ timeoutMs?: number;
220
+ excludePids?: number[];
221
+ }): Promise<{
222
+ matched: Array<{ pid: number; command: string }>;
223
+ stopped: Array<{ pid: number; command: string }>;
224
+ alive: Array<{ pid: number; command: string }>;
225
+ }> {
226
+ const timeoutMs = params?.timeoutMs ?? 8_000;
227
+ const excludePids = new Set<number>([
228
+ process.pid,
229
+ ...(Array.isArray(params?.excludePids) ? params.excludePids : []),
230
+ ]);
231
+ const matched = await listDetachedCityProcesses({
232
+ includeConsole: params?.includeConsole,
233
+ includeUi: params?.includeUi,
234
+ includeAgent: params?.includeAgent,
235
+ excludePids,
236
+ });
237
+
238
+ const stopped: Array<{ pid: number; command: string }> = [];
239
+ const alive: Array<{ pid: number; command: string }> = [];
240
+
241
+ for (const item of matched) {
242
+ // 关键点(中文):逐个停止,避免并发 kill 时输出与状态难以对应。
243
+ const ok = await stopPid(item.pid, timeoutMs);
244
+ if (ok) {
245
+ stopped.push(item);
246
+ } else {
247
+ alive.push(item);
248
+ }
249
+ }
250
+
251
+ return {
252
+ matched,
253
+ stopped,
254
+ alive,
255
+ };
256
+ }