@downcity/city 1.1.4 → 1.1.5
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.
- package/README.md +245 -0
- package/bin/cli/Index.js +12 -12
- package/bin/cli/Index.js.map +1 -1
- package/bin/cli/agent/AgentChat.d.ts +22 -0
- package/bin/cli/agent/AgentChat.d.ts.map +1 -0
- package/bin/cli/agent/AgentChat.js +357 -0
- package/bin/cli/agent/AgentChat.js.map +1 -0
- package/bin/cli/agent/AgentChatTypes.d.ts +87 -0
- package/bin/cli/agent/AgentChatTypes.d.ts.map +1 -0
- package/bin/cli/agent/AgentChatTypes.js +12 -0
- package/bin/cli/agent/AgentChatTypes.js.map +1 -0
- package/bin/cli/agent/AgentHistory.d.ts +14 -0
- package/bin/cli/agent/AgentHistory.d.ts.map +1 -0
- package/bin/cli/agent/AgentHistory.js +157 -0
- package/bin/cli/agent/AgentHistory.js.map +1 -0
- package/bin/cli/agent/AgentHistoryTypes.d.ts +36 -0
- package/bin/cli/agent/AgentHistoryTypes.d.ts.map +1 -0
- package/bin/cli/agent/AgentHistoryTypes.js +9 -0
- package/bin/cli/agent/AgentHistoryTypes.js.map +1 -0
- package/bin/cli/agent/AgentManager.d.ts.map +1 -0
- package/bin/cli/agent/AgentManager.js +602 -0
- package/bin/cli/agent/AgentManager.js.map +1 -0
- package/bin/cli/agent/AgentManagerTypes.d.ts +13 -0
- package/bin/cli/agent/AgentManagerTypes.d.ts.map +1 -0
- package/bin/cli/agent/AgentManagerTypes.js +5 -0
- package/bin/cli/agent/AgentManagerTypes.js.map +1 -0
- package/bin/cli/agent/AgentReset.d.ts +13 -0
- package/bin/cli/agent/AgentReset.d.ts.map +1 -0
- package/bin/cli/agent/AgentReset.js +167 -0
- package/bin/cli/agent/AgentReset.js.map +1 -0
- package/bin/cli/agent/AgentSelection.d.ts +43 -0
- package/bin/cli/agent/AgentSelection.d.ts.map +1 -0
- package/bin/cli/agent/AgentSelection.js +243 -0
- package/bin/cli/agent/AgentSelection.js.map +1 -0
- package/bin/cli/agent/AgentSelectionTypes.d.ts +30 -0
- package/bin/cli/agent/AgentSelectionTypes.d.ts.map +1 -0
- package/bin/cli/agent/AgentSelectionTypes.js +5 -0
- package/bin/cli/agent/AgentSelectionTypes.js.map +1 -0
- package/bin/cli/agent/Init.d.ts.map +1 -0
- package/bin/cli/agent/Init.js +252 -0
- package/bin/cli/agent/Init.js.map +1 -0
- package/bin/cli/agent/Restart.d.ts +19 -0
- package/bin/cli/agent/Restart.d.ts.map +1 -0
- package/bin/cli/agent/Restart.js +60 -0
- package/bin/cli/agent/Restart.js.map +1 -0
- package/bin/cli/agent/Run.d.ts +24 -0
- package/bin/cli/agent/Run.d.ts.map +1 -0
- package/bin/cli/agent/Run.js +119 -0
- package/bin/cli/agent/Run.js.map +1 -0
- package/bin/cli/agent/Start.d.ts +23 -0
- package/bin/cli/agent/Start.d.ts.map +1 -0
- package/bin/cli/agent/Start.js +63 -0
- package/bin/cli/agent/Start.js.map +1 -0
- package/bin/cli/agent/Status.d.ts.map +1 -0
- package/bin/cli/agent/Status.js +103 -0
- package/bin/cli/agent/Status.js.map +1 -0
- package/bin/cli/agent/Stop.d.ts.map +1 -0
- package/bin/cli/agent/Stop.js +44 -0
- package/bin/cli/agent/Stop.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneAuthBootstrap.d.ts +25 -0
- package/bin/cli/control-plane/ControlPlaneAuthBootstrap.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneAuthBootstrap.js +56 -0
- package/bin/cli/control-plane/ControlPlaneAuthBootstrap.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneCommand.d.ts +29 -0
- package/bin/cli/control-plane/ControlPlaneCommand.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneCommand.js +152 -0
- package/bin/cli/control-plane/ControlPlaneCommand.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneInit.d.ts +17 -0
- package/bin/cli/control-plane/ControlPlaneInit.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneInit.js +76 -0
- package/bin/cli/control-plane/ControlPlaneInit.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneProcess.d.ts +61 -0
- package/bin/cli/control-plane/ControlPlaneProcess.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneProcess.js +395 -0
- package/bin/cli/control-plane/ControlPlaneProcess.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneRuntime.d.ts +98 -0
- package/bin/cli/control-plane/ControlPlaneRuntime.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneRuntime.js +515 -0
- package/bin/cli/control-plane/ControlPlaneRuntime.js.map +1 -0
- package/bin/cli/control-plane/ControlPlaneStatus.d.ts +27 -0
- package/bin/cli/control-plane/ControlPlaneStatus.d.ts.map +1 -0
- package/bin/cli/control-plane/ControlPlaneStatus.js +135 -0
- package/bin/cli/control-plane/ControlPlaneStatus.js.map +1 -0
- package/bin/cli/model/Model.d.ts.map +1 -0
- package/bin/cli/model/Model.js.map +1 -0
- package/bin/cli/model/ModelCommandShared.d.ts +28 -0
- package/bin/cli/model/ModelCommandShared.d.ts.map +1 -0
- package/bin/cli/model/ModelCommandShared.js +109 -0
- package/bin/cli/model/ModelCommandShared.js.map +1 -0
- package/bin/cli/model/ModelCreateCommand.d.ts.map +1 -0
- package/bin/cli/model/ModelCreateCommand.js +367 -0
- package/bin/cli/model/ModelCreateCommand.js.map +1 -0
- package/bin/cli/model/ModelManageCommand.d.ts.map +1 -0
- package/bin/cli/model/ModelManageCommand.js.map +1 -0
- package/bin/cli/model/ModelManager.d.ts.map +1 -0
- package/bin/cli/model/ModelManager.js +588 -0
- package/bin/cli/model/ModelManager.js.map +1 -0
- package/bin/cli/model/ModelManagerTypes.d.ts +21 -0
- package/bin/cli/model/ModelManagerTypes.d.ts.map +1 -0
- package/bin/cli/model/ModelManagerTypes.js +5 -0
- package/bin/cli/model/ModelManagerTypes.js.map +1 -0
- package/bin/cli/model/ModelReadCommand.d.ts +13 -0
- package/bin/cli/model/ModelReadCommand.d.ts.map +1 -0
- package/bin/cli/model/ModelReadCommand.js +198 -0
- package/bin/cli/model/ModelReadCommand.js.map +1 -0
- package/bin/cli/model/ModelSupport.d.ts +40 -0
- package/bin/cli/model/ModelSupport.d.ts.map +1 -0
- package/bin/cli/model/ModelSupport.js +201 -0
- package/bin/cli/model/ModelSupport.js.map +1 -0
- package/bin/cli/model/preset/ModelPresetManager.d.ts +71 -0
- package/bin/cli/model/preset/ModelPresetManager.d.ts.map +1 -0
- package/bin/cli/model/preset/ModelPresetManager.js +187 -0
- package/bin/cli/model/preset/ModelPresetManager.js.map +1 -0
- package/bin/cli/service/ServiceActionCommands.d.ts.map +1 -0
- package/bin/cli/service/ServiceActionCommands.js +343 -0
- package/bin/cli/service/ServiceActionCommands.js.map +1 -0
- package/bin/cli/service/ServiceCommandRemote.d.ts +30 -0
- package/bin/cli/service/ServiceCommandRemote.d.ts.map +1 -0
- package/bin/cli/service/ServiceCommandRemote.js +200 -0
- package/bin/cli/service/ServiceCommandRemote.js.map +1 -0
- package/bin/cli/service/ServiceCommandSupport.d.ts +82 -0
- package/bin/cli/service/ServiceCommandSupport.d.ts.map +1 -0
- package/bin/cli/service/ServiceCommandSupport.js +224 -0
- package/bin/cli/service/ServiceCommandSupport.js.map +1 -0
- package/bin/cli/service/ServiceScheduleCommand.d.ts +36 -0
- package/bin/cli/service/ServiceScheduleCommand.d.ts.map +1 -0
- package/bin/cli/service/ServiceScheduleCommand.js +271 -0
- package/bin/cli/service/ServiceScheduleCommand.js.map +1 -0
- package/bin/cli/service/Services.d.ts.map +1 -0
- package/bin/cli/service/Services.js +154 -0
- package/bin/cli/service/Services.js.map +1 -0
- package/bin/cli/shared/Alias.d.ts.map +1 -0
- package/bin/cli/shared/Alias.js.map +1 -0
- package/bin/cli/shared/Chat.d.ts.map +1 -0
- package/bin/cli/shared/Chat.js.map +1 -0
- package/bin/cli/shared/ChatAuth.d.ts.map +1 -0
- package/bin/cli/shared/ChatAuth.js +151 -0
- package/bin/cli/shared/ChatAuth.js.map +1 -0
- package/bin/cli/shared/ChatManager.d.ts.map +1 -0
- package/bin/cli/shared/ChatManager.js +383 -0
- package/bin/cli/shared/ChatManager.js.map +1 -0
- package/bin/cli/shared/ChatManagerTypes.d.ts +6 -0
- package/bin/cli/shared/ChatManagerTypes.d.ts.map +1 -0
- package/bin/cli/shared/ChatManagerTypes.js +5 -0
- package/bin/cli/shared/ChatManagerTypes.js.map +1 -0
- package/bin/cli/shared/CliError.d.ts.map +1 -0
- package/bin/cli/shared/CliError.js.map +1 -0
- package/bin/cli/shared/CliReporter.d.ts +50 -0
- package/bin/cli/shared/CliReporter.d.ts.map +1 -0
- package/bin/cli/shared/CliReporter.js.map +1 -0
- package/bin/cli/shared/CliReporterTypes.d.ts +157 -0
- package/bin/cli/shared/CliReporterTypes.d.ts.map +1 -0
- package/bin/cli/shared/CliReporterTypes.js +10 -0
- package/bin/cli/shared/CliReporterTypes.js.map +1 -0
- package/bin/cli/shared/Config.d.ts.map +1 -0
- package/bin/cli/shared/Config.js +239 -0
- package/bin/cli/shared/Config.js.map +1 -0
- package/bin/cli/shared/Env.d.ts +14 -0
- package/bin/cli/shared/Env.d.ts.map +1 -0
- package/bin/cli/shared/Env.js +419 -0
- package/bin/cli/shared/Env.js.map +1 -0
- package/bin/cli/shared/IndexAgentCommand.d.ts.map +1 -0
- package/bin/cli/shared/IndexAgentCommand.js +218 -0
- package/bin/cli/shared/IndexAgentCommand.js.map +1 -0
- package/bin/cli/shared/IndexSupport.d.ts.map +1 -0
- package/bin/cli/shared/IndexSupport.js +123 -0
- package/bin/cli/shared/IndexSupport.js.map +1 -0
- package/bin/cli/shared/Plugins.d.ts.map +1 -0
- package/bin/cli/shared/Plugins.js +472 -0
- package/bin/cli/shared/Plugins.js.map +1 -0
- package/bin/cli/shared/PortHints.d.ts +35 -0
- package/bin/cli/shared/PortHints.d.ts.map +1 -0
- package/bin/cli/shared/PortHints.js +58 -0
- package/bin/cli/shared/PortHints.js.map +1 -0
- package/bin/cli/shared/PublicAccess.d.ts +24 -0
- package/bin/cli/shared/PublicAccess.d.ts.map +1 -0
- package/bin/cli/shared/PublicAccess.js +100 -0
- package/bin/cli/shared/PublicAccess.js.map +1 -0
- package/bin/cli/shared/PublicHostEnv.d.ts +14 -0
- package/bin/cli/shared/PublicHostEnv.d.ts.map +1 -0
- package/bin/cli/shared/PublicHostEnv.js +104 -0
- package/bin/cli/shared/PublicHostEnv.js.map +1 -0
- package/bin/cli/shared/PublicHostEnvTypes.d.ts +23 -0
- package/bin/cli/shared/PublicHostEnvTypes.d.ts.map +1 -0
- package/bin/cli/shared/PublicHostEnvTypes.js +5 -0
- package/bin/cli/shared/PublicHostEnvTypes.js.map +1 -0
- package/bin/cli/shared/Reset.d.ts.map +1 -0
- package/bin/cli/shared/Reset.js.map +1 -0
- package/bin/cli/shared/Token.d.ts.map +1 -0
- package/bin/cli/shared/Token.js +638 -0
- package/bin/cli/shared/Token.js.map +1 -0
- package/bin/cli/shared/Update.d.ts.map +1 -0
- package/bin/cli/shared/Update.js +150 -0
- package/bin/cli/shared/Update.js.map +1 -0
- package/bin/config/DowncitySchema.d.ts +3 -0
- package/bin/config/DowncitySchema.d.ts.map +1 -0
- package/bin/config/DowncitySchema.js +367 -0
- package/bin/config/DowncitySchema.js.map +1 -0
- package/bin/control/AgentStatusApiRoutes.d.ts +28 -0
- package/bin/control/AgentStatusApiRoutes.d.ts.map +1 -0
- package/bin/control/AgentStatusApiRoutes.js +165 -0
- package/bin/control/AgentStatusApiRoutes.js.map +1 -0
- package/bin/control/ChannelAccountApiRoutes.d.ts +15 -0
- package/bin/control/ChannelAccountApiRoutes.d.ts.map +1 -0
- package/bin/control/ChannelAccountApiRoutes.js +93 -0
- package/bin/control/ChannelAccountApiRoutes.js.map +1 -0
- package/bin/control/ControlGateway.d.ts +102 -0
- package/bin/control/ControlGateway.d.ts.map +1 -0
- package/bin/control/ControlGateway.js +283 -0
- package/bin/control/ControlGateway.js.map +1 -0
- package/bin/control/EnvApiRoutes.d.ts +18 -0
- package/bin/control/EnvApiRoutes.d.ts.map +1 -0
- package/bin/control/EnvApiRoutes.js +228 -0
- package/bin/control/EnvApiRoutes.js.map +1 -0
- package/bin/control/ModelApiRoutes.d.ts +35 -0
- package/bin/control/ModelApiRoutes.d.ts.map +1 -0
- package/bin/control/ModelApiRoutes.js +237 -0
- package/bin/control/ModelApiRoutes.js.map +1 -0
- package/bin/control/ModelPoolService.d.ts +126 -0
- package/bin/control/ModelPoolService.d.ts.map +1 -0
- package/bin/control/ModelPoolService.js +327 -0
- package/bin/control/ModelPoolService.js.map +1 -0
- package/bin/control/PlatformApiRoutes.d.ts +133 -0
- package/bin/control/PlatformApiRoutes.d.ts.map +1 -0
- package/bin/control/PlatformApiRoutes.js +292 -0
- package/bin/control/PlatformApiRoutes.js.map +1 -0
- package/bin/control/PluginApiRoutes.d.ts +28 -0
- package/bin/control/PluginApiRoutes.d.ts.map +1 -0
- package/bin/control/PluginApiRoutes.js +282 -0
- package/bin/control/PluginApiRoutes.js.map +1 -0
- package/bin/control/gateway/AgentActions.d.ts +107 -0
- package/bin/control/gateway/AgentActions.d.ts.map +1 -0
- package/bin/control/gateway/AgentActions.js +314 -0
- package/bin/control/gateway/AgentActions.js.map +1 -0
- package/bin/control/gateway/AgentCatalog.d.ts +83 -0
- package/bin/control/gateway/AgentCatalog.d.ts.map +1 -0
- package/bin/control/gateway/AgentCatalog.js +484 -0
- package/bin/control/gateway/AgentCatalog.js.map +1 -0
- package/bin/control/gateway/FrontendAssets.d.ts +21 -0
- package/bin/control/gateway/FrontendAssets.d.ts.map +1 -0
- package/bin/control/gateway/FrontendAssets.js +77 -0
- package/bin/control/gateway/FrontendAssets.js.map +1 -0
- package/bin/control/gateway/GatewaySupport.d.ts +34 -0
- package/bin/control/gateway/GatewaySupport.d.ts.map +1 -0
- package/bin/control/gateway/GatewaySupport.js +32 -0
- package/bin/control/gateway/GatewaySupport.js.map +1 -0
- package/bin/control/gateway/Proxy.d.ts +16 -0
- package/bin/control/gateway/Proxy.d.ts.map +1 -0
- package/bin/control/gateway/Proxy.js +47 -0
- package/bin/control/gateway/Proxy.js.map +1 -0
- package/bin/control/instant/InstantApiRoutes.d.ts +19 -0
- package/bin/control/instant/InstantApiRoutes.d.ts.map +1 -0
- package/bin/control/instant/InstantApiRoutes.js +58 -0
- package/bin/control/instant/InstantApiRoutes.js.map +1 -0
- package/bin/control/instant/InstantSessionService.d.ts +36 -0
- package/bin/control/instant/InstantSessionService.d.ts.map +1 -0
- package/bin/control/instant/InstantSessionService.js +183 -0
- package/bin/control/instant/InstantSessionService.js.map +1 -0
- package/bin/control/instant/InstantSystemComposer.d.ts +34 -0
- package/bin/control/instant/InstantSystemComposer.d.ts.map +1 -0
- package/bin/control/instant/InstantSystemComposer.js +38 -0
- package/bin/control/instant/InstantSystemComposer.js.map +1 -0
- package/bin/http/auth/AuthMiddleware.d.ts +1 -1
- package/bin/http/auth/AuthMiddleware.d.ts.map +1 -1
- package/bin/http/auth/AuthService.d.ts +2 -2
- package/bin/http/auth/AuthService.d.ts.map +1 -1
- package/bin/http/auth/AuthService.js +1 -1
- package/bin/http/auth/AuthService.js.map +1 -1
- package/bin/http/auth/AuthStore.d.ts +4 -4
- package/bin/http/auth/AuthStore.d.ts.map +1 -1
- package/bin/http/auth/AuthStore.js +7 -7
- package/bin/http/auth/AuthStore.js.map +1 -1
- package/bin/http/auth/RoutePolicy.d.ts +3 -3
- package/bin/http/auth/RoutePolicy.d.ts.map +1 -1
- package/bin/http/auth/RoutePolicy.js +6 -6
- package/bin/http/auth/RoutePolicy.js.map +1 -1
- package/bin/process/daemon/Api.d.ts +60 -0
- package/bin/process/daemon/Api.d.ts.map +1 -0
- package/bin/process/daemon/Api.js.map +1 -0
- package/bin/process/daemon/CliArgs.d.ts +17 -0
- package/bin/process/daemon/CliArgs.d.ts.map +1 -0
- package/bin/process/daemon/CliArgs.js +30 -0
- package/bin/process/daemon/CliArgs.js.map +1 -0
- package/bin/process/daemon/Client.d.ts.map +1 -0
- package/bin/process/daemon/Client.js +158 -0
- package/bin/process/daemon/Client.js.map +1 -0
- package/bin/process/daemon/Manager.d.ts +92 -0
- package/bin/process/daemon/Manager.d.ts.map +1 -0
- package/bin/process/daemon/Manager.js +287 -0
- package/bin/process/daemon/Manager.js.map +1 -0
- package/bin/process/daemon/PortAllocator.d.ts.map +1 -0
- package/bin/process/daemon/PortAllocator.js.map +1 -0
- package/bin/process/registry/AgentHostRuntime.d.ts +10 -0
- package/bin/process/registry/AgentHostRuntime.d.ts.map +1 -0
- package/bin/process/registry/AgentHostRuntime.js +47 -0
- package/bin/process/registry/AgentHostRuntime.js.map +1 -0
- package/bin/process/registry/CityPaths.d.ts +53 -0
- package/bin/process/registry/CityPaths.d.ts.map +1 -0
- package/bin/process/registry/CityPaths.js +78 -0
- package/bin/process/registry/CityPaths.js.map +1 -0
- package/bin/process/registry/CityRegistry.d.ts +51 -0
- package/bin/process/registry/CityRegistry.d.ts.map +1 -0
- package/bin/process/registry/CityRegistry.js +217 -0
- package/bin/process/registry/CityRegistry.js.map +1 -0
- package/bin/process/registry/CityRuntime.d.ts +21 -0
- package/bin/process/registry/CityRuntime.d.ts.map +1 -0
- package/bin/process/registry/CityRuntime.js +45 -0
- package/bin/process/registry/CityRuntime.js.map +1 -0
- package/bin/process/registry/PluginRuntime.d.ts +24 -0
- package/bin/process/registry/PluginRuntime.d.ts.map +1 -0
- package/bin/process/registry/PluginRuntime.js.map +1 -0
- package/bin/process/registry/ProcessSweep.d.ts +76 -0
- package/bin/process/registry/ProcessSweep.d.ts.map +1 -0
- package/bin/process/registry/ProcessSweep.js +202 -0
- package/bin/process/registry/ProcessSweep.js.map +1 -0
- package/bin/process/rpc/Client.d.ts +13 -0
- package/bin/process/rpc/Client.d.ts.map +1 -0
- package/bin/process/rpc/Client.js.map +1 -0
- package/bin/process/rpc/Paths.d.ts.map +1 -0
- package/bin/process/rpc/Paths.js +36 -0
- package/bin/process/rpc/Paths.js.map +1 -0
- package/bin/utils/cli/CliOutput.d.ts +1 -1
- package/bin/utils/cli/CliOutput.d.ts.map +1 -1
- package/bin/utils/cli/CliOutput.js +1 -1
- package/bin/utils/cli/CliOutput.js.map +1 -1
- package/bin/utils/storage.d.ts +1 -1
- package/bin/utils/storage.d.ts.map +1 -1
- package/package.json +2 -2
- package/scripts/lint-import-boundaries.mjs +17 -85
- package/src/cli/Index.ts +12 -12
- package/src/cli/agent/AgentChat.ts +415 -0
- package/src/cli/agent/AgentChatTypes.ts +92 -0
- package/src/cli/agent/AgentHistory.ts +187 -0
- package/src/cli/agent/AgentHistoryTypes.ts +39 -0
- package/src/cli/agent/AgentManager.ts +667 -0
- package/src/cli/agent/AgentManagerTypes.ts +29 -0
- package/src/cli/agent/AgentReset.ts +181 -0
- package/src/cli/agent/AgentSelection.ts +297 -0
- package/src/cli/agent/AgentSelectionTypes.ts +36 -0
- package/src/cli/agent/Init.ts +291 -0
- package/src/cli/agent/Restart.ts +68 -0
- package/src/cli/agent/Run.ts +148 -0
- package/src/cli/agent/Start.ts +72 -0
- package/src/cli/agent/Status.ts +116 -0
- package/src/cli/agent/Stop.ts +45 -0
- package/src/cli/control-plane/ControlPlaneAuthBootstrap.ts +72 -0
- package/src/cli/control-plane/ControlPlaneCommand.ts +216 -0
- package/src/cli/control-plane/ControlPlaneInit.ts +83 -0
- package/src/cli/control-plane/ControlPlaneProcess.ts +497 -0
- package/src/cli/control-plane/ControlPlaneRuntime.ts +611 -0
- package/src/cli/control-plane/ControlPlaneStatus.ts +152 -0
- package/src/cli/model/ModelCommandShared.ts +129 -0
- package/src/cli/model/ModelCreateCommand.ts +424 -0
- package/src/cli/model/ModelManageCommand.ts +516 -0
- package/src/cli/model/ModelManager.ts +631 -0
- package/src/cli/model/ModelManagerTypes.ts +37 -0
- package/src/cli/model/ModelReadCommand.ts +207 -0
- package/src/cli/model/ModelSupport.ts +223 -0
- package/src/cli/model/preset/ModelPresetManager.ts +242 -0
- package/src/cli/service/ServiceActionCommands.ts +416 -0
- package/src/cli/service/ServiceCommandRemote.ts +230 -0
- package/src/cli/service/ServiceCommandSupport.ts +275 -0
- package/src/cli/service/ServiceScheduleCommand.ts +305 -0
- package/src/cli/service/Services.ts +189 -0
- package/src/cli/shared/ChatAuth.ts +203 -0
- package/src/cli/shared/ChatManager.ts +441 -0
- package/src/cli/shared/ChatManagerTypes.ts +19 -0
- package/src/cli/shared/CliReporter.ts +362 -0
- package/src/cli/shared/CliReporterTypes.ts +167 -0
- package/src/cli/shared/Config.ts +301 -0
- package/src/cli/shared/Env.ts +556 -0
- package/src/cli/shared/IndexAgentCommand.ts +302 -0
- package/src/cli/shared/IndexSupport.ts +138 -0
- package/src/cli/shared/Plugins.ts +567 -0
- package/src/cli/shared/PortHints.ts +80 -0
- package/src/cli/shared/PublicAccess.ts +106 -0
- package/src/cli/shared/PublicHostEnv.ts +116 -0
- package/src/cli/shared/PublicHostEnvTypes.ts +27 -0
- package/src/cli/shared/Token.ts +702 -0
- package/src/cli/shared/Update.ts +183 -0
- package/src/config/DowncitySchema.ts +377 -0
- package/src/control/AgentStatusApiRoutes.ts +225 -0
- package/src/control/ChannelAccountApiRoutes.ts +119 -0
- package/src/control/ControlGateway.ts +463 -0
- package/src/control/EnvApiRoutes.ts +257 -0
- package/src/control/ModelApiRoutes.ts +336 -0
- package/src/control/ModelPoolService.ts +395 -0
- package/src/control/PlatformApiRoutes.ts +495 -0
- package/src/control/PluginApiRoutes.ts +439 -0
- package/src/control/gateway/AgentActions.ts +413 -0
- package/src/control/gateway/AgentCatalog.ts +611 -0
- package/src/control/gateway/FrontendAssets.ts +79 -0
- package/src/control/gateway/GatewaySupport.ts +59 -0
- package/src/control/gateway/Proxy.ts +62 -0
- package/src/control/instant/InstantApiRoutes.ts +74 -0
- package/src/control/instant/InstantSessionService.ts +278 -0
- package/src/control/instant/InstantSystemComposer.ts +60 -0
- package/src/http/auth/AuthMiddleware.ts +1 -1
- package/src/http/auth/AuthService.ts +3 -3
- package/src/http/auth/AuthStore.ts +11 -11
- package/src/http/auth/RoutePolicy.ts +8 -8
- package/src/process/daemon/Api.ts +64 -0
- package/src/process/daemon/CliArgs.ts +39 -0
- package/src/process/daemon/Client.ts +182 -0
- package/src/process/daemon/Manager.ts +344 -0
- package/src/process/registry/AgentHostRuntime.ts +65 -0
- package/src/process/registry/CityPaths.ts +87 -0
- package/src/process/registry/CityRegistry.ts +256 -0
- package/src/process/registry/CityRuntime.ts +45 -0
- package/src/process/registry/PluginRuntime.ts +42 -0
- package/src/process/registry/ProcessSweep.ts +256 -0
- package/src/process/rpc/Client.ts +113 -0
- package/src/process/rpc/Paths.ts +43 -0
- package/src/utils/cli/CliOutput.ts +2 -2
- package/src/utils/storage.ts +1 -1
- package/tsconfig.json +3 -1
- package/bin/cli/AgentChat.d.ts +0 -22
- package/bin/cli/AgentChat.d.ts.map +0 -1
- package/bin/cli/AgentChat.js +0 -357
- package/bin/cli/AgentChat.js.map +0 -1
- package/bin/cli/AgentHistory.d.ts +0 -14
- package/bin/cli/AgentHistory.d.ts.map +0 -1
- package/bin/cli/AgentHistory.js +0 -157
- package/bin/cli/AgentHistory.js.map +0 -1
- package/bin/cli/AgentManager.d.ts.map +0 -1
- package/bin/cli/AgentManager.js +0 -602
- package/bin/cli/AgentManager.js.map +0 -1
- package/bin/cli/AgentReset.d.ts +0 -13
- package/bin/cli/AgentReset.d.ts.map +0 -1
- package/bin/cli/AgentReset.js +0 -167
- package/bin/cli/AgentReset.js.map +0 -1
- package/bin/cli/AgentSelection.d.ts +0 -43
- package/bin/cli/AgentSelection.d.ts.map +0 -1
- package/bin/cli/AgentSelection.js +0 -243
- package/bin/cli/AgentSelection.js.map +0 -1
- package/bin/cli/Alias.d.ts.map +0 -1
- package/bin/cli/Alias.js.map +0 -1
- package/bin/cli/Chat.d.ts.map +0 -1
- package/bin/cli/Chat.js.map +0 -1
- package/bin/cli/ChatAuth.d.ts.map +0 -1
- package/bin/cli/ChatAuth.js +0 -152
- package/bin/cli/ChatAuth.js.map +0 -1
- package/bin/cli/ChatManager.d.ts.map +0 -1
- package/bin/cli/ChatManager.js +0 -383
- package/bin/cli/ChatManager.js.map +0 -1
- package/bin/cli/CliReporter.d.ts +0 -50
- package/bin/cli/CliReporter.d.ts.map +0 -1
- package/bin/cli/CliReporter.js.map +0 -1
- package/bin/cli/Config.d.ts.map +0 -1
- package/bin/cli/Config.js +0 -239
- package/bin/cli/Config.js.map +0 -1
- package/bin/cli/Console.d.ts +0 -97
- package/bin/cli/Console.d.ts.map +0 -1
- package/bin/cli/Console.js +0 -514
- package/bin/cli/Console.js.map +0 -1
- package/bin/cli/ConsoleAuthBootstrap.d.ts +0 -25
- package/bin/cli/ConsoleAuthBootstrap.d.ts.map +0 -1
- package/bin/cli/ConsoleAuthBootstrap.js +0 -56
- package/bin/cli/ConsoleAuthBootstrap.js.map +0 -1
- package/bin/cli/ConsoleInit.d.ts +0 -17
- package/bin/cli/ConsoleInit.d.ts.map +0 -1
- package/bin/cli/ConsoleInit.js +0 -76
- package/bin/cli/ConsoleInit.js.map +0 -1
- package/bin/cli/Env.d.ts +0 -14
- package/bin/cli/Env.d.ts.map +0 -1
- package/bin/cli/Env.js +0 -419
- package/bin/cli/Env.js.map +0 -1
- package/bin/cli/IndexAgentCommand.d.ts.map +0 -1
- package/bin/cli/IndexAgentCommand.js +0 -218
- package/bin/cli/IndexAgentCommand.js.map +0 -1
- package/bin/cli/IndexConsoleCommand.d.ts +0 -24
- package/bin/cli/IndexConsoleCommand.d.ts.map +0 -1
- package/bin/cli/IndexConsoleCommand.js +0 -147
- package/bin/cli/IndexConsoleCommand.js.map +0 -1
- package/bin/cli/IndexConsoleProcess.d.ts +0 -61
- package/bin/cli/IndexConsoleProcess.d.ts.map +0 -1
- package/bin/cli/IndexConsoleProcess.js +0 -395
- package/bin/cli/IndexConsoleProcess.js.map +0 -1
- package/bin/cli/IndexConsoleStatus.d.ts +0 -27
- package/bin/cli/IndexConsoleStatus.d.ts.map +0 -1
- package/bin/cli/IndexConsoleStatus.js +0 -135
- package/bin/cli/IndexConsoleStatus.js.map +0 -1
- package/bin/cli/IndexSupport.d.ts.map +0 -1
- package/bin/cli/IndexSupport.js +0 -123
- package/bin/cli/IndexSupport.js.map +0 -1
- package/bin/cli/Init.d.ts.map +0 -1
- package/bin/cli/Init.js +0 -252
- package/bin/cli/Init.js.map +0 -1
- package/bin/cli/Model.d.ts.map +0 -1
- package/bin/cli/Model.js.map +0 -1
- package/bin/cli/ModelCommandShared.d.ts +0 -28
- package/bin/cli/ModelCommandShared.d.ts.map +0 -1
- package/bin/cli/ModelCommandShared.js +0 -109
- package/bin/cli/ModelCommandShared.js.map +0 -1
- package/bin/cli/ModelCreateCommand.d.ts.map +0 -1
- package/bin/cli/ModelCreateCommand.js +0 -367
- package/bin/cli/ModelCreateCommand.js.map +0 -1
- package/bin/cli/ModelManageCommand.d.ts.map +0 -1
- package/bin/cli/ModelManageCommand.js.map +0 -1
- package/bin/cli/ModelManager.d.ts.map +0 -1
- package/bin/cli/ModelManager.js +0 -588
- package/bin/cli/ModelManager.js.map +0 -1
- package/bin/cli/ModelReadCommand.d.ts +0 -13
- package/bin/cli/ModelReadCommand.d.ts.map +0 -1
- package/bin/cli/ModelReadCommand.js +0 -198
- package/bin/cli/ModelReadCommand.js.map +0 -1
- package/bin/cli/ModelSupport.d.ts +0 -40
- package/bin/cli/ModelSupport.d.ts.map +0 -1
- package/bin/cli/ModelSupport.js +0 -201
- package/bin/cli/ModelSupport.js.map +0 -1
- package/bin/cli/Plugins.d.ts.map +0 -1
- package/bin/cli/Plugins.js +0 -474
- package/bin/cli/Plugins.js.map +0 -1
- package/bin/cli/PortHints.d.ts +0 -35
- package/bin/cli/PortHints.d.ts.map +0 -1
- package/bin/cli/PortHints.js +0 -58
- package/bin/cli/PortHints.js.map +0 -1
- package/bin/cli/PublicAccess.d.ts +0 -24
- package/bin/cli/PublicAccess.d.ts.map +0 -1
- package/bin/cli/PublicAccess.js +0 -100
- package/bin/cli/PublicAccess.js.map +0 -1
- package/bin/cli/PublicHostEnv.d.ts +0 -14
- package/bin/cli/PublicHostEnv.d.ts.map +0 -1
- package/bin/cli/PublicHostEnv.js +0 -104
- package/bin/cli/PublicHostEnv.js.map +0 -1
- package/bin/cli/Reset.d.ts.map +0 -1
- package/bin/cli/Reset.js.map +0 -1
- package/bin/cli/Restart.d.ts +0 -19
- package/bin/cli/Restart.d.ts.map +0 -1
- package/bin/cli/Restart.js +0 -60
- package/bin/cli/Restart.js.map +0 -1
- package/bin/cli/Run.d.ts +0 -24
- package/bin/cli/Run.d.ts.map +0 -1
- package/bin/cli/Run.js +0 -119
- package/bin/cli/Run.js.map +0 -1
- package/bin/cli/ServiceActionCommands.d.ts.map +0 -1
- package/bin/cli/ServiceActionCommands.js +0 -345
- package/bin/cli/ServiceActionCommands.js.map +0 -1
- package/bin/cli/ServiceCommandRemote.d.ts +0 -30
- package/bin/cli/ServiceCommandRemote.d.ts.map +0 -1
- package/bin/cli/ServiceCommandRemote.js +0 -200
- package/bin/cli/ServiceCommandRemote.js.map +0 -1
- package/bin/cli/ServiceCommandSupport.d.ts +0 -82
- package/bin/cli/ServiceCommandSupport.d.ts.map +0 -1
- package/bin/cli/ServiceCommandSupport.js +0 -224
- package/bin/cli/ServiceCommandSupport.js.map +0 -1
- package/bin/cli/ServiceScheduleCommand.d.ts +0 -36
- package/bin/cli/ServiceScheduleCommand.d.ts.map +0 -1
- package/bin/cli/ServiceScheduleCommand.js +0 -271
- package/bin/cli/ServiceScheduleCommand.js.map +0 -1
- package/bin/cli/Services.d.ts.map +0 -1
- package/bin/cli/Services.js +0 -154
- package/bin/cli/Services.js.map +0 -1
- package/bin/cli/Start.d.ts +0 -23
- package/bin/cli/Start.d.ts.map +0 -1
- package/bin/cli/Start.js +0 -63
- package/bin/cli/Start.js.map +0 -1
- package/bin/cli/Status.d.ts.map +0 -1
- package/bin/cli/Status.js +0 -103
- package/bin/cli/Status.js.map +0 -1
- package/bin/cli/Stop.d.ts.map +0 -1
- package/bin/cli/Stop.js +0 -44
- package/bin/cli/Stop.js.map +0 -1
- package/bin/cli/Token.d.ts.map +0 -1
- package/bin/cli/Token.js +0 -638
- package/bin/cli/Token.js.map +0 -1
- package/bin/cli/Update.d.ts.map +0 -1
- package/bin/cli/Update.js +0 -150
- package/bin/cli/Update.js.map +0 -1
- package/bin/console/AgentStatusApiRoutes.d.ts +0 -28
- package/bin/console/AgentStatusApiRoutes.d.ts.map +0 -1
- package/bin/console/AgentStatusApiRoutes.js +0 -165
- package/bin/console/AgentStatusApiRoutes.js.map +0 -1
- package/bin/console/ChannelAccountApiRoutes.d.ts +0 -15
- package/bin/console/ChannelAccountApiRoutes.d.ts.map +0 -1
- package/bin/console/ChannelAccountApiRoutes.js +0 -93
- package/bin/console/ChannelAccountApiRoutes.js.map +0 -1
- package/bin/console/ConsoleClient.d.ts +0 -53
- package/bin/console/ConsoleClient.d.ts.map +0 -1
- package/bin/console/ConsoleClient.js +0 -258
- package/bin/console/ConsoleClient.js.map +0 -1
- package/bin/console/ConsoleGateway.d.ts +0 -102
- package/bin/console/ConsoleGateway.d.ts.map +0 -1
- package/bin/console/ConsoleGateway.js +0 -283
- package/bin/console/ConsoleGateway.js.map +0 -1
- package/bin/console/ConsoleGatewayRoutes.d.ts +0 -133
- package/bin/console/ConsoleGatewayRoutes.d.ts.map +0 -1
- package/bin/console/ConsoleGatewayRoutes.js +0 -292
- package/bin/console/ConsoleGatewayRoutes.js.map +0 -1
- package/bin/console/EnvApiRoutes.d.ts +0 -18
- package/bin/console/EnvApiRoutes.d.ts.map +0 -1
- package/bin/console/EnvApiRoutes.js +0 -228
- package/bin/console/EnvApiRoutes.js.map +0 -1
- package/bin/console/InlineInstantRoutes.d.ts +0 -19
- package/bin/console/InlineInstantRoutes.d.ts.map +0 -1
- package/bin/console/InlineInstantRoutes.js +0 -58
- package/bin/console/InlineInstantRoutes.js.map +0 -1
- package/bin/console/InlineInstantSessionService.d.ts +0 -36
- package/bin/console/InlineInstantSessionService.d.ts.map +0 -1
- package/bin/console/InlineInstantSessionService.js +0 -190
- package/bin/console/InlineInstantSessionService.js.map +0 -1
- package/bin/console/InlineInstantSystemComposer.d.ts +0 -34
- package/bin/console/InlineInstantSystemComposer.d.ts.map +0 -1
- package/bin/console/InlineInstantSystemComposer.js +0 -40
- package/bin/console/InlineInstantSystemComposer.js.map +0 -1
- package/bin/console/ModelApiRoutes.d.ts +0 -35
- package/bin/console/ModelApiRoutes.d.ts.map +0 -1
- package/bin/console/ModelApiRoutes.js +0 -237
- package/bin/console/ModelApiRoutes.js.map +0 -1
- package/bin/console/ModelPoolService.d.ts +0 -126
- package/bin/console/ModelPoolService.d.ts.map +0 -1
- package/bin/console/ModelPoolService.js +0 -327
- package/bin/console/ModelPoolService.js.map +0 -1
- package/bin/console/PluginApiRoutes.d.ts +0 -28
- package/bin/console/PluginApiRoutes.d.ts.map +0 -1
- package/bin/console/PluginApiRoutes.js +0 -299
- package/bin/console/PluginApiRoutes.js.map +0 -1
- package/bin/console/gateway/AgentActions.d.ts +0 -107
- package/bin/console/gateway/AgentActions.d.ts.map +0 -1
- package/bin/console/gateway/AgentActions.js +0 -314
- package/bin/console/gateway/AgentActions.js.map +0 -1
- package/bin/console/gateway/AgentCatalog.d.ts +0 -83
- package/bin/console/gateway/AgentCatalog.d.ts.map +0 -1
- package/bin/console/gateway/AgentCatalog.js +0 -484
- package/bin/console/gateway/AgentCatalog.js.map +0 -1
- package/bin/console/gateway/FrontendAssets.d.ts +0 -21
- package/bin/console/gateway/FrontendAssets.d.ts.map +0 -1
- package/bin/console/gateway/FrontendAssets.js +0 -77
- package/bin/console/gateway/FrontendAssets.js.map +0 -1
- package/bin/console/gateway/GatewaySupport.d.ts +0 -34
- package/bin/console/gateway/GatewaySupport.d.ts.map +0 -1
- package/bin/console/gateway/GatewaySupport.js +0 -32
- package/bin/console/gateway/GatewaySupport.js.map +0 -1
- package/bin/console/gateway/Proxy.d.ts +0 -16
- package/bin/console/gateway/Proxy.d.ts.map +0 -1
- package/bin/console/gateway/Proxy.js +0 -47
- package/bin/console/gateway/Proxy.js.map +0 -1
- package/bin/constants/DowncitySchema.d.ts +0 -3
- package/bin/constants/DowncitySchema.d.ts.map +0 -1
- package/bin/constants/DowncitySchema.js +0 -367
- package/bin/constants/DowncitySchema.js.map +0 -1
- package/bin/daemon/Api.d.ts +0 -60
- package/bin/daemon/Api.d.ts.map +0 -1
- package/bin/daemon/Api.js.map +0 -1
- package/bin/daemon/CliArgs.d.ts +0 -17
- package/bin/daemon/CliArgs.d.ts.map +0 -1
- package/bin/daemon/CliArgs.js +0 -30
- package/bin/daemon/CliArgs.js.map +0 -1
- package/bin/daemon/Client.d.ts.map +0 -1
- package/bin/daemon/Client.js +0 -158
- package/bin/daemon/Client.js.map +0 -1
- package/bin/daemon/Manager.d.ts +0 -92
- package/bin/daemon/Manager.d.ts.map +0 -1
- package/bin/daemon/Manager.js +0 -287
- package/bin/daemon/Manager.js.map +0 -1
- package/bin/daemon/PortAllocator.d.ts.map +0 -1
- package/bin/daemon/PortAllocator.js.map +0 -1
- package/bin/http/dashboard/AuthDashboardService.d.ts +0 -30
- package/bin/http/dashboard/AuthDashboardService.d.ts.map +0 -1
- package/bin/http/dashboard/AuthDashboardService.js +0 -120
- package/bin/http/dashboard/AuthDashboardService.js.map +0 -1
- package/bin/http/dashboard/CommonHelpers.d.ts +0 -24
- package/bin/http/dashboard/CommonHelpers.d.ts.map +0 -1
- package/bin/http/dashboard/CommonHelpers.js +0 -46
- package/bin/http/dashboard/CommonHelpers.js.map +0 -1
- package/bin/http/dashboard/ExecuteInput.d.ts +0 -18
- package/bin/http/dashboard/ExecuteInput.d.ts.map +0 -1
- package/bin/http/dashboard/ExecuteInput.js +0 -201
- package/bin/http/dashboard/ExecuteInput.js.map +0 -1
- package/bin/http/dashboard/MessageTimeline.d.ts +0 -22
- package/bin/http/dashboard/MessageTimeline.d.ts.map +0 -1
- package/bin/http/dashboard/MessageTimeline.js +0 -226
- package/bin/http/dashboard/MessageTimeline.js.map +0 -1
- package/bin/http/dashboard/SessionSummaryStore.d.ts +0 -19
- package/bin/http/dashboard/SessionSummaryStore.d.ts.map +0 -1
- package/bin/http/dashboard/SessionSummaryStore.js +0 -62
- package/bin/http/dashboard/SessionSummaryStore.js.map +0 -1
- package/bin/http/dashboard/TaskStore.d.ts +0 -33
- package/bin/http/dashboard/TaskStore.d.ts.map +0 -1
- package/bin/http/dashboard/TaskStore.js +0 -157
- package/bin/http/dashboard/TaskStore.js.map +0 -1
- package/bin/model/ModelCommand.d.ts +0 -60
- package/bin/model/ModelCommand.d.ts.map +0 -1
- package/bin/model/ModelCommand.js +0 -46
- package/bin/model/ModelCommand.js.map +0 -1
- package/bin/model/ModelManager.d.ts +0 -71
- package/bin/model/ModelManager.d.ts.map +0 -1
- package/bin/model/ModelManager.js +0 -187
- package/bin/model/ModelManager.js.map +0 -1
- package/bin/registry/AgentHostRuntime.d.ts +0 -10
- package/bin/registry/AgentHostRuntime.d.ts.map +0 -1
- package/bin/registry/AgentHostRuntime.js +0 -47
- package/bin/registry/AgentHostRuntime.js.map +0 -1
- package/bin/registry/CityPaths.d.ts +0 -61
- package/bin/registry/CityPaths.d.ts.map +0 -1
- package/bin/registry/CityPaths.js +0 -90
- package/bin/registry/CityPaths.js.map +0 -1
- package/bin/registry/CityRegistry.d.ts +0 -51
- package/bin/registry/CityRegistry.d.ts.map +0 -1
- package/bin/registry/CityRegistry.js +0 -217
- package/bin/registry/CityRegistry.js.map +0 -1
- package/bin/registry/CityRuntime.d.ts +0 -21
- package/bin/registry/CityRuntime.d.ts.map +0 -1
- package/bin/registry/CityRuntime.js +0 -45
- package/bin/registry/CityRuntime.js.map +0 -1
- package/bin/registry/PluginRuntime.d.ts +0 -24
- package/bin/registry/PluginRuntime.d.ts.map +0 -1
- package/bin/registry/PluginRuntime.js.map +0 -1
- package/bin/registry/ProcessSweep.d.ts +0 -76
- package/bin/registry/ProcessSweep.d.ts.map +0 -1
- package/bin/registry/ProcessSweep.js +0 -202
- package/bin/registry/ProcessSweep.js.map +0 -1
- package/bin/rpc/Client.d.ts +0 -13
- package/bin/rpc/Client.d.ts.map +0 -1
- package/bin/rpc/Client.js.map +0 -1
- package/bin/rpc/Paths.d.ts.map +0 -1
- package/bin/rpc/Paths.js +0 -36
- package/bin/rpc/Paths.js.map +0 -1
- package/bin/sandbox/MacOsSeatbeltSandbox.d.ts +0 -16
- package/bin/sandbox/MacOsSeatbeltSandbox.d.ts.map +0 -1
- package/bin/sandbox/MacOsSeatbeltSandbox.js +0 -152
- package/bin/sandbox/MacOsSeatbeltSandbox.js.map +0 -1
- package/bin/sandbox/SandboxConfigResolver.d.ts +0 -31
- package/bin/sandbox/SandboxConfigResolver.d.ts.map +0 -1
- package/bin/sandbox/SandboxConfigResolver.js +0 -113
- package/bin/sandbox/SandboxConfigResolver.js.map +0 -1
- package/bin/sandbox/SandboxRunner.d.ts +0 -46
- package/bin/sandbox/SandboxRunner.d.ts.map +0 -1
- package/bin/sandbox/SandboxRunner.js +0 -70
- package/bin/sandbox/SandboxRunner.js.map +0 -1
- package/bin/store/StoreChannelAccountRepository.d.ts +0 -34
- package/bin/store/StoreChannelAccountRepository.d.ts.map +0 -1
- package/bin/store/StoreChannelAccountRepository.js +0 -198
- package/bin/store/StoreChannelAccountRepository.js.map +0 -1
- package/bin/store/StoreEnvRepository.d.ts +0 -98
- package/bin/store/StoreEnvRepository.d.ts.map +0 -1
- package/bin/store/StoreEnvRepository.js +0 -334
- package/bin/store/StoreEnvRepository.js.map +0 -1
- package/bin/store/StoreModelRepository.d.ts +0 -61
- package/bin/store/StoreModelRepository.d.ts.map +0 -1
- package/bin/store/StoreModelRepository.js +0 -278
- package/bin/store/StoreModelRepository.js.map +0 -1
- package/bin/store/StoreSchema.d.ts +0 -13
- package/bin/store/StoreSchema.d.ts.map +0 -1
- package/bin/store/StoreSchema.js +0 -319
- package/bin/store/StoreSchema.js.map +0 -1
- package/bin/store/StoreSecureSettings.d.ts +0 -33
- package/bin/store/StoreSecureSettings.d.ts.map +0 -1
- package/bin/store/StoreSecureSettings.js +0 -91
- package/bin/store/StoreSecureSettings.js.map +0 -1
- package/bin/store/StoreShared.d.ts +0 -44
- package/bin/store/StoreShared.d.ts.map +0 -1
- package/bin/store/StoreShared.js +0 -40
- package/bin/store/StoreShared.js.map +0 -1
- package/bin/store/crypto.d.ts +0 -24
- package/bin/store/crypto.d.ts.map +0 -1
- package/bin/store/crypto.js +0 -101
- package/bin/store/crypto.js.map +0 -1
- package/bin/store/index.d.ts +0 -230
- package/bin/store/index.d.ts.map +0 -1
- package/bin/store/index.js +0 -360
- package/bin/store/index.js.map +0 -1
- package/bin/store/schema.d.ts +0 -690
- package/bin/store/schema.d.ts.map +0 -1
- package/bin/store/schema.js +0 -81
- package/bin/store/schema.js.map +0 -1
- package/bin/types/chat/ChatSession.d.ts +0 -30
- package/bin/types/chat/ChatSession.d.ts.map +0 -1
- package/bin/types/chat/ChatSession.js +0 -9
- package/bin/types/chat/ChatSession.js.map +0 -1
- package/bin/types/city/PublicHostEnv.d.ts +0 -72
- package/bin/types/city/PublicHostEnv.d.ts.map +0 -1
- package/bin/types/city/PublicHostEnv.js +0 -9
- package/bin/types/city/PublicHostEnv.js.map +0 -1
- package/bin/types/cli/AgentChat.d.ts +0 -147
- package/bin/types/cli/AgentChat.d.ts.map +0 -1
- package/bin/types/cli/AgentChat.js +0 -12
- package/bin/types/cli/AgentChat.js.map +0 -1
- package/bin/types/cli/AgentHistory.d.ts +0 -127
- package/bin/types/cli/AgentHistory.d.ts.map +0 -1
- package/bin/types/cli/AgentHistory.js +0 -9
- package/bin/types/cli/AgentHistory.js.map +0 -1
- package/bin/types/cli/AgentManager.d.ts +0 -113
- package/bin/types/cli/AgentManager.d.ts.map +0 -1
- package/bin/types/cli/AgentManager.js +0 -9
- package/bin/types/cli/AgentManager.js.map +0 -1
- package/bin/types/cli/AgentSelection.d.ts +0 -146
- package/bin/types/cli/AgentSelection.d.ts.map +0 -1
- package/bin/types/cli/AgentSelection.js +0 -9
- package/bin/types/cli/AgentSelection.js.map +0 -1
- package/bin/types/cli/ChatManager.d.ts +0 -64
- package/bin/types/cli/ChatManager.d.ts.map +0 -1
- package/bin/types/cli/ChatManager.js +0 -9
- package/bin/types/cli/ChatManager.js.map +0 -1
- package/bin/types/cli/CliError.d.ts.map +0 -1
- package/bin/types/cli/CliError.js.map +0 -1
- package/bin/types/cli/CliReporter.d.ts +0 -157
- package/bin/types/cli/CliReporter.d.ts.map +0 -1
- package/bin/types/cli/CliReporter.js +0 -10
- package/bin/types/cli/CliReporter.js.map +0 -1
- package/bin/types/cli/ModelManager.d.ts +0 -127
- package/bin/types/cli/ModelManager.d.ts.map +0 -1
- package/bin/types/cli/ModelManager.js +0 -9
- package/bin/types/cli/ModelManager.js.map +0 -1
- package/bin/types/contact/Contact.d.ts +0 -78
- package/bin/types/contact/Contact.d.ts.map +0 -1
- package/bin/types/contact/Contact.js +0 -9
- package/bin/types/contact/Contact.js.map +0 -1
- package/bin/types/contact/ContactApproval.d.ts +0 -145
- package/bin/types/contact/ContactApproval.d.ts.map +0 -1
- package/bin/types/contact/ContactApproval.js +0 -9
- package/bin/types/contact/ContactApproval.js.map +0 -1
- package/bin/types/contact/ContactChat.d.ts +0 -46
- package/bin/types/contact/ContactChat.d.ts.map +0 -1
- package/bin/types/contact/ContactChat.js +0 -9
- package/bin/types/contact/ContactChat.js.map +0 -1
- package/bin/types/contact/ContactCheck.d.ts +0 -66
- package/bin/types/contact/ContactCheck.d.ts.map +0 -1
- package/bin/types/contact/ContactCheck.js +0 -9
- package/bin/types/contact/ContactCheck.js.map +0 -1
- package/bin/types/contact/ContactCommand.d.ts +0 -93
- package/bin/types/contact/ContactCommand.d.ts.map +0 -1
- package/bin/types/contact/ContactCommand.js +0 -8
- package/bin/types/contact/ContactCommand.js.map +0 -1
- package/bin/types/contact/ContactEndpoint.d.ts +0 -12
- package/bin/types/contact/ContactEndpoint.d.ts.map +0 -1
- package/bin/types/contact/ContactEndpoint.js +0 -9
- package/bin/types/contact/ContactEndpoint.js.map +0 -1
- package/bin/types/contact/ContactLink.d.ts +0 -160
- package/bin/types/contact/ContactLink.d.ts.map +0 -1
- package/bin/types/contact/ContactLink.js +0 -9
- package/bin/types/contact/ContactLink.js.map +0 -1
- package/bin/types/contact/ContactShare.d.ts +0 -163
- package/bin/types/contact/ContactShare.d.ts.map +0 -1
- package/bin/types/contact/ContactShare.js +0 -9
- package/bin/types/contact/ContactShare.js.map +0 -1
- package/bin/types/sandbox/SandboxRuntime.d.ts +0 -318
- package/bin/types/sandbox/SandboxRuntime.d.ts.map +0 -1
- package/bin/types/sandbox/SandboxRuntime.js +0 -10
- package/bin/types/sandbox/SandboxRuntime.js.map +0 -1
- package/bin/types/store/Store.d.ts +0 -26
- package/bin/types/store/Store.d.ts.map +0 -1
- package/bin/types/store/Store.js +0 -9
- package/bin/types/store/Store.js.map +0 -1
- package/bin/types/task/TaskRunner.d.ts +0 -186
- package/bin/types/task/TaskRunner.d.ts.map +0 -1
- package/bin/types/task/TaskRunner.js +0 -9
- package/bin/types/task/TaskRunner.js.map +0 -1
- package/src/cli/AgentChat.ts +0 -415
- package/src/cli/AgentHistory.ts +0 -187
- package/src/cli/AgentManager.ts +0 -667
- package/src/cli/AgentReset.ts +0 -181
- package/src/cli/AgentSelection.ts +0 -297
- package/src/cli/ChatAuth.ts +0 -203
- package/src/cli/ChatManager.ts +0 -439
- package/src/cli/CliReporter.ts +0 -362
- package/src/cli/Config.ts +0 -301
- package/src/cli/Console.ts +0 -610
- package/src/cli/ConsoleAuthBootstrap.ts +0 -72
- package/src/cli/ConsoleInit.ts +0 -83
- package/src/cli/Env.ts +0 -556
- package/src/cli/IndexAgentCommand.ts +0 -303
- package/src/cli/IndexConsoleCommand.ts +0 -211
- package/src/cli/IndexConsoleProcess.ts +0 -497
- package/src/cli/IndexConsoleStatus.ts +0 -152
- package/src/cli/IndexSupport.ts +0 -138
- package/src/cli/Init.ts +0 -291
- package/src/cli/ModelCommandShared.ts +0 -126
- package/src/cli/ModelCreateCommand.ts +0 -424
- package/src/cli/ModelManageCommand.ts +0 -516
- package/src/cli/ModelManager.ts +0 -631
- package/src/cli/ModelReadCommand.ts +0 -207
- package/src/cli/ModelSupport.ts +0 -223
- package/src/cli/Plugins.ts +0 -568
- package/src/cli/PortHints.ts +0 -80
- package/src/cli/PublicAccess.ts +0 -106
- package/src/cli/PublicHostEnv.ts +0 -116
- package/src/cli/Restart.ts +0 -68
- package/src/cli/Run.ts +0 -148
- package/src/cli/ServiceActionCommands.ts +0 -414
- package/src/cli/ServiceCommandRemote.ts +0 -230
- package/src/cli/ServiceCommandSupport.ts +0 -275
- package/src/cli/ServiceScheduleCommand.ts +0 -305
- package/src/cli/Services.ts +0 -189
- package/src/cli/Start.ts +0 -72
- package/src/cli/Status.ts +0 -116
- package/src/cli/Stop.ts +0 -45
- package/src/cli/Token.ts +0 -702
- package/src/cli/Update.ts +0 -183
- package/src/console/AgentStatusApiRoutes.ts +0 -225
- package/src/console/ChannelAccountApiRoutes.ts +0 -119
- package/src/console/ConsoleClient.ts +0 -293
- package/src/console/ConsoleGateway.ts +0 -463
- package/src/console/ConsoleGatewayRoutes.ts +0 -495
- package/src/console/EnvApiRoutes.ts +0 -257
- package/src/console/InlineInstantRoutes.ts +0 -74
- package/src/console/InlineInstantSessionService.ts +0 -277
- package/src/console/InlineInstantSystemComposer.ts +0 -58
- package/src/console/ModelApiRoutes.ts +0 -336
- package/src/console/ModelPoolService.ts +0 -395
- package/src/console/PluginApiRoutes.ts +0 -453
- package/src/console/gateway/AgentActions.ts +0 -413
- package/src/console/gateway/AgentCatalog.ts +0 -606
- package/src/console/gateway/FrontendAssets.ts +0 -79
- package/src/console/gateway/GatewaySupport.ts +0 -59
- package/src/console/gateway/Proxy.ts +0 -62
- package/src/constants/DowncitySchema.ts +0 -377
- package/src/daemon/Api.ts +0 -64
- package/src/daemon/CliArgs.ts +0 -39
- package/src/daemon/Client.ts +0 -182
- package/src/daemon/Manager.ts +0 -344
- package/src/http/dashboard/AuthDashboardService.ts +0 -161
- package/src/http/dashboard/CommonHelpers.ts +0 -50
- package/src/http/dashboard/ExecuteInput.ts +0 -236
- package/src/http/dashboard/MessageTimeline.ts +0 -269
- package/src/http/dashboard/SessionSummaryStore.ts +0 -77
- package/src/http/dashboard/TaskStore.ts +0 -222
- package/src/model/ModelCommand.ts +0 -95
- package/src/model/ModelManager.ts +0 -242
- package/src/registry/AgentHostRuntime.ts +0 -65
- package/src/registry/CityPaths.ts +0 -101
- package/src/registry/CityRegistry.ts +0 -256
- package/src/registry/CityRuntime.ts +0 -45
- package/src/registry/PluginRuntime.ts +0 -42
- package/src/registry/ProcessSweep.ts +0 -256
- package/src/rpc/Client.ts +0 -110
- package/src/rpc/Paths.ts +0 -43
- package/src/sandbox/MacOsSeatbeltSandbox.ts +0 -196
- package/src/sandbox/SandboxConfigResolver.ts +0 -134
- package/src/sandbox/SandboxRunner.ts +0 -101
- package/src/store/StoreChannelAccountRepository.ts +0 -269
- package/src/store/StoreEnvRepository.ts +0 -452
- package/src/store/StoreModelRepository.ts +0 -324
- package/src/store/StoreSchema.ts +0 -344
- package/src/store/StoreSecureSettings.ts +0 -126
- package/src/store/StoreShared.ts +0 -67
- package/src/store/crypto.ts +0 -112
- package/src/store/index.ts +0 -497
- package/src/store/schema.ts +0 -103
- package/src/types/chat/ChatSession.ts +0 -32
- package/src/types/city/PublicHostEnv.ts +0 -76
- package/src/types/cli/AgentChat.ts +0 -172
- package/src/types/cli/AgentHistory.ts +0 -146
- package/src/types/cli/AgentManager.ts +0 -119
- package/src/types/cli/AgentSelection.ts +0 -162
- package/src/types/cli/ChatManager.ts +0 -65
- package/src/types/cli/CliReporter.ts +0 -167
- package/src/types/cli/ModelManager.ts +0 -139
- package/src/types/contact/Contact.ts +0 -82
- package/src/types/contact/ContactApproval.ts +0 -150
- package/src/types/contact/ContactChat.ts +0 -47
- package/src/types/contact/ContactCheck.ts +0 -67
- package/src/types/contact/ContactCommand.ts +0 -98
- package/src/types/contact/ContactEndpoint.ts +0 -16
- package/src/types/contact/ContactLink.ts +0 -169
- package/src/types/contact/ContactShare.ts +0 -172
- package/src/types/sandbox/SandboxRuntime.ts +0 -377
- package/src/types/store/Store.ts +0 -27
- package/src/types/task/TaskRunner.ts +0 -199
- /package/bin/cli/{AgentManager.d.ts → agent/AgentManager.d.ts} +0 -0
- /package/bin/cli/{Init.d.ts → agent/Init.d.ts} +0 -0
- /package/bin/cli/{Status.d.ts → agent/Status.d.ts} +0 -0
- /package/bin/cli/{Stop.d.ts → agent/Stop.d.ts} +0 -0
- /package/bin/cli/{Model.d.ts → model/Model.d.ts} +0 -0
- /package/bin/cli/{Model.js → model/Model.js} +0 -0
- /package/bin/cli/{ModelCreateCommand.d.ts → model/ModelCreateCommand.d.ts} +0 -0
- /package/bin/cli/{ModelManageCommand.d.ts → model/ModelManageCommand.d.ts} +0 -0
- /package/bin/cli/{ModelManageCommand.js → model/ModelManageCommand.js} +0 -0
- /package/bin/cli/{ModelManager.d.ts → model/ModelManager.d.ts} +0 -0
- /package/bin/cli/{ServiceActionCommands.d.ts → service/ServiceActionCommands.d.ts} +0 -0
- /package/bin/cli/{Services.d.ts → service/Services.d.ts} +0 -0
- /package/bin/cli/{Alias.d.ts → shared/Alias.d.ts} +0 -0
- /package/bin/cli/{Alias.js → shared/Alias.js} +0 -0
- /package/bin/cli/{Chat.d.ts → shared/Chat.d.ts} +0 -0
- /package/bin/cli/{Chat.js → shared/Chat.js} +0 -0
- /package/bin/cli/{ChatAuth.d.ts → shared/ChatAuth.d.ts} +0 -0
- /package/bin/cli/{ChatManager.d.ts → shared/ChatManager.d.ts} +0 -0
- /package/bin/{types/cli → cli/shared}/CliError.d.ts +0 -0
- /package/bin/{types/cli → cli/shared}/CliError.js +0 -0
- /package/bin/cli/{CliReporter.js → shared/CliReporter.js} +0 -0
- /package/bin/cli/{Config.d.ts → shared/Config.d.ts} +0 -0
- /package/bin/cli/{IndexAgentCommand.d.ts → shared/IndexAgentCommand.d.ts} +0 -0
- /package/bin/cli/{IndexSupport.d.ts → shared/IndexSupport.d.ts} +0 -0
- /package/bin/cli/{Plugins.d.ts → shared/Plugins.d.ts} +0 -0
- /package/bin/cli/{Reset.d.ts → shared/Reset.d.ts} +0 -0
- /package/bin/cli/{Reset.js → shared/Reset.js} +0 -0
- /package/bin/cli/{Token.d.ts → shared/Token.d.ts} +0 -0
- /package/bin/cli/{Update.d.ts → shared/Update.d.ts} +0 -0
- /package/bin/{daemon → process/daemon}/Api.js +0 -0
- /package/bin/{daemon → process/daemon}/Client.d.ts +0 -0
- /package/bin/{daemon → process/daemon}/PortAllocator.d.ts +0 -0
- /package/bin/{daemon → process/daemon}/PortAllocator.js +0 -0
- /package/bin/{registry → process/registry}/PluginRuntime.js +0 -0
- /package/bin/{rpc → process/rpc}/Client.js +0 -0
- /package/bin/{rpc → process/rpc}/Paths.d.ts +0 -0
- /package/src/cli/{Model.ts → model/Model.ts} +0 -0
- /package/src/cli/{Alias.ts → shared/Alias.ts} +0 -0
- /package/src/cli/{Chat.ts → shared/Chat.ts} +0 -0
- /package/src/{types/cli → cli/shared}/CliError.ts +0 -0
- /package/src/cli/{Reset.ts → shared/Reset.ts} +0 -0
- /package/src/{daemon → process/daemon}/PortAllocator.ts +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon API 协议类型模块。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 这里描述的是 CLI 与 agent daemon 之间的远程访问契约,不包含具体 HTTP 实现。
|
|
6
|
+
* - service 等上层模块只依赖这些协议类型,不需要感知 city/daemon 的内部实现细节。
|
|
7
|
+
* - 该文件属于 `main/city/daemon/*` 的协议边界,而不是通用 HTTP 类型目录。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { JsonValue } from "@downcity/agent";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Daemon 服务端点。
|
|
14
|
+
*/
|
|
15
|
+
export type DaemonEndpoint = {
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Daemon HTTP 方法白名单。
|
|
23
|
+
*/
|
|
24
|
+
export type DaemonHttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* JSON API 调用参数。
|
|
28
|
+
*
|
|
29
|
+
* 关键点(中文)
|
|
30
|
+
* - `projectRoot` 用于解析 downcity.json 与默认 endpoint。
|
|
31
|
+
* - `host/port` 可显式覆盖自动解析结果。
|
|
32
|
+
*/
|
|
33
|
+
export type DaemonJsonApiCallParams = {
|
|
34
|
+
projectRoot: string;
|
|
35
|
+
path: string;
|
|
36
|
+
method?: DaemonHttpMethod;
|
|
37
|
+
body?: JsonValue;
|
|
38
|
+
/**
|
|
39
|
+
* 单次调用超时(毫秒)。
|
|
40
|
+
*
|
|
41
|
+
* 说明(中文)
|
|
42
|
+
* - 仅本地 IPC transport 当前会消费该参数。
|
|
43
|
+
* - 用于 `session execute`、`service command` 这类可能持续几十秒的请求,
|
|
44
|
+
* 避免被默认短超时误判成“Agent server 未启动”。
|
|
45
|
+
*/
|
|
46
|
+
timeoutMs?: number;
|
|
47
|
+
host?: string;
|
|
48
|
+
port?: number;
|
|
49
|
+
authToken?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* JSON API 通用返回结构。
|
|
54
|
+
*
|
|
55
|
+
* 语义(中文)
|
|
56
|
+
* - `success=true` 时读取 `data`。
|
|
57
|
+
* - `success=false` 时读取 `error`(可选 `status`)。
|
|
58
|
+
*/
|
|
59
|
+
export type DaemonJsonApiCallResult<T> = {
|
|
60
|
+
success: boolean;
|
|
61
|
+
status?: number;
|
|
62
|
+
data?: T;
|
|
63
|
+
error?: string;
|
|
64
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 负责把 commander 解析到的 options 转换成子进程 CLI 参数。
|
|
3
|
+
*
|
|
4
|
+
* 关键点
|
|
5
|
+
* - daemon(来自 `agent start` / `agent restart`)会拉起一个前台 `agent start`
|
|
6
|
+
* 进程(显式 `--foreground true`),这里负责拼装其 argv。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { StartOptions } from "@downcity/agent";
|
|
10
|
+
import { allocateAvailablePort } from "@/process/daemon/PortAllocator.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 将 daemon 选项转换为 `agent start` 子进程 argv。
|
|
14
|
+
*
|
|
15
|
+
* 关键点(中文)
|
|
16
|
+
* - daemon 始终启动 `agent start` 前台流程,因此参数统一映射到 `agent start` CLI 形态。
|
|
17
|
+
* - 只透传用户显式传入的字段,避免污染默认值决策。
|
|
18
|
+
*/
|
|
19
|
+
export const buildRunArgsFromOptions = async (
|
|
20
|
+
projectRoot: string,
|
|
21
|
+
options: StartOptions,
|
|
22
|
+
): Promise<string[]> => {
|
|
23
|
+
// 关键点(中文):daemon 子进程必须强制前台模式,避免再次进入 startCommand 形成递归拉起。
|
|
24
|
+
const args: string[] = ["agent", "start", projectRoot, "--foreground", "true"];
|
|
25
|
+
|
|
26
|
+
// 关键点(中文):host 未指定时统一落到 0.0.0.0,保持历史监听行为。
|
|
27
|
+
const host = String(options.host || "0.0.0.0").trim() || "0.0.0.0";
|
|
28
|
+
|
|
29
|
+
// 关键点(中文):agent 端口统一由 console 分配,不接受命令行显式覆盖。
|
|
30
|
+
const port = await allocateAvailablePort({ host });
|
|
31
|
+
if (!Number.isFinite(port) || Number.isNaN(port) || port <= 0 || port > 65535) {
|
|
32
|
+
throw new Error(`Invalid allocated port: ${String(port)}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
args.push("--port", String(port));
|
|
36
|
+
args.push("--host", host);
|
|
37
|
+
|
|
38
|
+
return args;
|
|
39
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemon API 客户端(process 子模块)。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 业务模块统一通过 daemon API 与运行时通信。
|
|
6
|
+
* - 地址解析优先级:CLI 参数 > 环境变量 > daemon meta > 默认值。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from "fs-extra";
|
|
10
|
+
import {
|
|
11
|
+
type DaemonEndpoint,
|
|
12
|
+
type DaemonJsonApiCallParams,
|
|
13
|
+
type DaemonJsonApiCallResult,
|
|
14
|
+
} from "./Api.js";
|
|
15
|
+
import {
|
|
16
|
+
formatCliBearerHeaderValue,
|
|
17
|
+
resolveCliAuthToken,
|
|
18
|
+
} from "@/http/auth/CliAuthStateStore.js";
|
|
19
|
+
import { getDaemonMetaPath } from "@/process/daemon/Manager.js";
|
|
20
|
+
import type { JsonObject, JsonValue } from "@downcity/agent";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 解析端口值。
|
|
24
|
+
*
|
|
25
|
+
* 关键点(中文)
|
|
26
|
+
* - 仅接受 1~65535 的整数;非法值返回 undefined。
|
|
27
|
+
*/
|
|
28
|
+
function parsePortLike(input: string | number | undefined): number | undefined {
|
|
29
|
+
if (input === undefined || input === null || input === "") return undefined;
|
|
30
|
+
const raw =
|
|
31
|
+
typeof input === "number" ? input : Number.parseInt(String(input), 10);
|
|
32
|
+
if (!Number.isFinite(raw) || Number.isNaN(raw)) return undefined;
|
|
33
|
+
if (!Number.isInteger(raw) || raw <= 0 || raw > 65535) return undefined;
|
|
34
|
+
return raw;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 归一化 host。
|
|
39
|
+
*
|
|
40
|
+
* 关键点(中文)
|
|
41
|
+
* - `0.0.0.0`/`::` 会转换为 `127.0.0.1`,避免客户端直连通配地址失败。
|
|
42
|
+
*/
|
|
43
|
+
function normalizeHost(input: string | undefined): string | undefined {
|
|
44
|
+
const host = typeof input === "string" ? input.trim() : "";
|
|
45
|
+
if (!host) return undefined;
|
|
46
|
+
if (host === "0.0.0.0" || host === "::") return "127.0.0.1";
|
|
47
|
+
return host;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function parseErrorMessageFromPayload(data: JsonValue | null): string | null {
|
|
51
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return null;
|
|
52
|
+
const payload = data as JsonObject;
|
|
53
|
+
if (typeof payload.error === "string") return payload.error;
|
|
54
|
+
if (typeof payload.message === "string") return payload.message;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function pickArgValue(args: string[], key: string): string | undefined {
|
|
59
|
+
const idx = args.findIndex((item) => String(item).trim() === key);
|
|
60
|
+
if (idx < 0) return undefined;
|
|
61
|
+
const next = String(args[idx + 1] || "").trim();
|
|
62
|
+
return next || undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 解析 daemon endpoint。
|
|
67
|
+
*
|
|
68
|
+
* 优先级(中文)
|
|
69
|
+
* 1) 显式入参 `host/port`
|
|
70
|
+
* 2) 环境变量 `DC_SERVER_*` / `DC_CTX_SERVER_*`
|
|
71
|
+
* 3) daemon meta args(`downcity.daemon.json`)
|
|
72
|
+
* 4) 默认 `127.0.0.1:5314`
|
|
73
|
+
*/
|
|
74
|
+
function resolveDaemonEndpoint(params: {
|
|
75
|
+
projectRoot: string;
|
|
76
|
+
host?: string;
|
|
77
|
+
port?: number;
|
|
78
|
+
}): DaemonEndpoint {
|
|
79
|
+
const explicitHost = normalizeHost(params.host);
|
|
80
|
+
const explicitPort = parsePortLike(params.port);
|
|
81
|
+
|
|
82
|
+
const envHost =
|
|
83
|
+
normalizeHost(process.env.DC_SERVER_HOST) ||
|
|
84
|
+
normalizeHost(process.env.DC_CTX_SERVER_HOST);
|
|
85
|
+
const envPort =
|
|
86
|
+
parsePortLike(process.env.DC_SERVER_PORT) ||
|
|
87
|
+
parsePortLike(process.env.DC_CTX_SERVER_PORT);
|
|
88
|
+
|
|
89
|
+
let daemonArgHost: string | undefined;
|
|
90
|
+
let daemonArgPort: number | undefined;
|
|
91
|
+
try {
|
|
92
|
+
const metaPath = getDaemonMetaPath(params.projectRoot);
|
|
93
|
+
if (fs.existsSync(metaPath)) {
|
|
94
|
+
const raw = fs.readJsonSync(metaPath) as { args?: unknown };
|
|
95
|
+
const args = Array.isArray(raw?.args)
|
|
96
|
+
? raw.args.map((item) => String(item))
|
|
97
|
+
: [];
|
|
98
|
+
daemonArgHost = normalizeHost(pickArgValue(args, "--host"));
|
|
99
|
+
daemonArgPort = parsePortLike(pickArgValue(args, "--port"));
|
|
100
|
+
}
|
|
101
|
+
} catch {
|
|
102
|
+
// ignore daemon meta errors, fallback to other sources
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const host = explicitHost || envHost || daemonArgHost || "127.0.0.1";
|
|
106
|
+
const port = explicitPort || envPort || daemonArgPort || 5314;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
host,
|
|
110
|
+
port,
|
|
111
|
+
baseUrl: `http://${host}:${port}`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 调用 daemon JSON API。
|
|
117
|
+
*
|
|
118
|
+
* 错误语义(中文)
|
|
119
|
+
* - 网络异常:`success=false` + `error`(无 status)。
|
|
120
|
+
* - HTTP 非 2xx:`success=false` + `status` + `error`。
|
|
121
|
+
*/
|
|
122
|
+
export async function callServer<T>(
|
|
123
|
+
params: DaemonJsonApiCallParams,
|
|
124
|
+
): Promise<DaemonJsonApiCallResult<T>> {
|
|
125
|
+
const endpoint = resolveDaemonEndpoint({
|
|
126
|
+
projectRoot: params.projectRoot,
|
|
127
|
+
host: params.host,
|
|
128
|
+
port: params.port,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const url = new URL(params.path, endpoint.baseUrl).toString();
|
|
132
|
+
const method = params.method || "GET";
|
|
133
|
+
const hasBody = params.body !== undefined && method !== "GET";
|
|
134
|
+
const headers: Record<string, string> = {};
|
|
135
|
+
const authHeaderValue = formatCliBearerHeaderValue(
|
|
136
|
+
resolveCliAuthToken({
|
|
137
|
+
explicitToken: params.authToken,
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
140
|
+
if (hasBody) {
|
|
141
|
+
headers["Content-Type"] = "application/json";
|
|
142
|
+
}
|
|
143
|
+
if (authHeaderValue) {
|
|
144
|
+
headers.Authorization = authHeaderValue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
const response = await fetch(url, {
|
|
149
|
+
method,
|
|
150
|
+
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
151
|
+
body: hasBody ? JSON.stringify(params.body) : undefined,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
let data: JsonValue | null = null;
|
|
155
|
+
try {
|
|
156
|
+
data = (await response.json()) as JsonValue;
|
|
157
|
+
} catch {
|
|
158
|
+
data = null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!response.ok) {
|
|
162
|
+
const messageFromData =
|
|
163
|
+
parseErrorMessageFromPayload(data) || `HTTP ${response.status}`;
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
status: response.status,
|
|
167
|
+
error: messageFromData,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
success: true,
|
|
173
|
+
status: response.status,
|
|
174
|
+
data: data as T,
|
|
175
|
+
};
|
|
176
|
+
} catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
success: false,
|
|
179
|
+
error: `Failed to call ${url}: ${String(error)}`,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downcity daemon 管理(PID / 日志 / 启停)。
|
|
3
|
+
*
|
|
4
|
+
* 目标
|
|
5
|
+
* - `downcity agent start`:后台启动(终端退出后仍运行)
|
|
6
|
+
* - `downcity agent restart`:重启后台进程
|
|
7
|
+
*
|
|
8
|
+
* 约定
|
|
9
|
+
* - 所有 daemon 相关文件都写入 `.downcity/debug/`,便于排查:
|
|
10
|
+
* - `downcity.pid`:进程 pid
|
|
11
|
+
* - `downcity.daemon.log`:stdout/stderr 合并日志
|
|
12
|
+
* - `downcity.daemon.json`:元数据(启动时间、参数等)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fs from "fs-extra";
|
|
16
|
+
import path from "path";
|
|
17
|
+
import { spawn } from "child_process";
|
|
18
|
+
import { getDowncityDebugDirPath } from "@/config/Paths.js";
|
|
19
|
+
import {
|
|
20
|
+
DAEMON_LOG_FILENAME,
|
|
21
|
+
DAEMON_META_FILENAME,
|
|
22
|
+
DAEMON_PID_FILENAME,
|
|
23
|
+
type DaemonMeta,
|
|
24
|
+
type DaemonStaleReason,
|
|
25
|
+
} from "@downcity/agent";
|
|
26
|
+
import {
|
|
27
|
+
markManagedAgentStopped,
|
|
28
|
+
upsertManagedAgentEntry,
|
|
29
|
+
} from "@/process/registry/CityRegistry.js";
|
|
30
|
+
import { signalDetachedProcess } from "@/process/registry/ProcessSweep.js";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 异步睡眠工具。
|
|
34
|
+
*/
|
|
35
|
+
const sleep = async (ms: number): Promise<void> =>
|
|
36
|
+
new Promise((resolve) => setTimeout(resolve, ms));
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 计算 daemon pid 文件路径。
|
|
40
|
+
*/
|
|
41
|
+
export const getDaemonPidPath = (projectRoot: string): string =>
|
|
42
|
+
path.join(getDowncityDebugDirPath(projectRoot), DAEMON_PID_FILENAME);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 计算 daemon 日志文件路径。
|
|
46
|
+
*/
|
|
47
|
+
export const getDaemonLogPath = (projectRoot: string): string =>
|
|
48
|
+
path.join(getDowncityDebugDirPath(projectRoot), DAEMON_LOG_FILENAME);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 计算 daemon 元数据文件路径。
|
|
52
|
+
*/
|
|
53
|
+
export const getDaemonMetaPath = (projectRoot: string): string =>
|
|
54
|
+
path.join(getDowncityDebugDirPath(projectRoot), DAEMON_META_FILENAME);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 读取 daemon pid。
|
|
58
|
+
*
|
|
59
|
+
* 关键点(中文)
|
|
60
|
+
* - 读取失败或内容非法统一返回 `null`,调用方走无进程分支。
|
|
61
|
+
*/
|
|
62
|
+
export const readDaemonPid = async (
|
|
63
|
+
projectRoot: string,
|
|
64
|
+
): Promise<number | null> => {
|
|
65
|
+
try {
|
|
66
|
+
const raw = await fs.readFile(getDaemonPidPath(projectRoot), "utf-8");
|
|
67
|
+
const pid = Number.parseInt(String(raw).trim(), 10);
|
|
68
|
+
return Number.isFinite(pid) && pid > 0 ? pid : null;
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 检查进程是否存活。
|
|
76
|
+
*/
|
|
77
|
+
export const isProcessAlive = (pid: number): boolean => {
|
|
78
|
+
try {
|
|
79
|
+
process.kill(pid, 0);
|
|
80
|
+
return true;
|
|
81
|
+
} catch {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 读取 daemon meta(宽松模式)。
|
|
88
|
+
*
|
|
89
|
+
* 关键点(中文)
|
|
90
|
+
* - 返回 null 表示文件缺失、解析失败或结构非法。
|
|
91
|
+
* - 该函数用于状态展示,不抛异常。
|
|
92
|
+
*/
|
|
93
|
+
export const readDaemonMeta = async (
|
|
94
|
+
projectRoot: string,
|
|
95
|
+
): Promise<DaemonMeta | null> => {
|
|
96
|
+
try {
|
|
97
|
+
const value = await fs.readJson(getDaemonMetaPath(projectRoot));
|
|
98
|
+
const pid = Number((value as { pid?: unknown })?.pid);
|
|
99
|
+
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
100
|
+
const startedAt = String(
|
|
101
|
+
(value as { startedAt?: unknown })?.startedAt || "",
|
|
102
|
+
).trim();
|
|
103
|
+
if (!startedAt) return null;
|
|
104
|
+
const command = String(
|
|
105
|
+
(value as { command?: unknown })?.command || "",
|
|
106
|
+
).trim();
|
|
107
|
+
const project = String(
|
|
108
|
+
(value as { projectRoot?: unknown })?.projectRoot || "",
|
|
109
|
+
).trim();
|
|
110
|
+
if (!command || !project) return null;
|
|
111
|
+
return value as DaemonMeta;
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 诊断 stale 原因。
|
|
119
|
+
*/
|
|
120
|
+
export const diagnoseDaemonStaleReasons = async (
|
|
121
|
+
projectRoot: string,
|
|
122
|
+
pid: number,
|
|
123
|
+
): Promise<DaemonStaleReason[]> => {
|
|
124
|
+
const reasons: DaemonStaleReason[] = [];
|
|
125
|
+
reasons.push({
|
|
126
|
+
code: "process_not_alive",
|
|
127
|
+
message: "pid file exists but process is not alive",
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const metaPath = getDaemonMetaPath(projectRoot);
|
|
131
|
+
const metaExists = await fs.pathExists(metaPath);
|
|
132
|
+
if (!metaExists) {
|
|
133
|
+
reasons.push({
|
|
134
|
+
code: "meta_missing",
|
|
135
|
+
message: "daemon meta file is missing",
|
|
136
|
+
});
|
|
137
|
+
return reasons;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
await fs.readJson(metaPath);
|
|
142
|
+
} catch {
|
|
143
|
+
reasons.push({
|
|
144
|
+
code: "meta_invalid",
|
|
145
|
+
message: "daemon meta file is invalid JSON",
|
|
146
|
+
});
|
|
147
|
+
return reasons;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const parsedMeta = await readDaemonMeta(projectRoot);
|
|
151
|
+
if (!parsedMeta) {
|
|
152
|
+
reasons.push({
|
|
153
|
+
code: "meta_invalid",
|
|
154
|
+
message: "daemon meta file has invalid structure",
|
|
155
|
+
});
|
|
156
|
+
return reasons;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (parsedMeta.pid !== pid) {
|
|
160
|
+
reasons.push({
|
|
161
|
+
code: "meta_pid_mismatch",
|
|
162
|
+
message: `meta pid (${parsedMeta.pid}) does not match pid file (${pid})`,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const metaProjectRoot = path.resolve(String(parsedMeta.projectRoot || ""));
|
|
167
|
+
const expectedProjectRoot = path.resolve(projectRoot);
|
|
168
|
+
if (metaProjectRoot !== expectedProjectRoot) {
|
|
169
|
+
reasons.push({
|
|
170
|
+
code: "meta_project_mismatch",
|
|
171
|
+
message: `meta project root mismatch (${metaProjectRoot})`,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return reasons;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 清理僵尸 daemon 标记文件。
|
|
180
|
+
*
|
|
181
|
+
* 算法(中文)
|
|
182
|
+
* - 若 pid 文件存在但进程不存在,移除 pid/meta,恢复可重启状态。
|
|
183
|
+
*/
|
|
184
|
+
export const cleanupStaleDaemonFiles = async (
|
|
185
|
+
projectRoot: string,
|
|
186
|
+
): Promise<void> => {
|
|
187
|
+
const pid = await readDaemonPid(projectRoot);
|
|
188
|
+
if (!pid) return;
|
|
189
|
+
if (isProcessAlive(pid)) return;
|
|
190
|
+
|
|
191
|
+
// 关键注释:pid 文件存在但进程已退出,属于“脏状态”,这里直接清理。
|
|
192
|
+
await fs.remove(getDaemonPidPath(projectRoot));
|
|
193
|
+
await fs.remove(getDaemonMetaPath(projectRoot));
|
|
194
|
+
// 关键点(中文):僵尸 daemon 清理时标记 stopped,保留历史记录。
|
|
195
|
+
try {
|
|
196
|
+
await markManagedAgentStopped(projectRoot);
|
|
197
|
+
} catch {
|
|
198
|
+
// ignore registry sync errors
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 写入 daemon pid 与元数据文件。
|
|
204
|
+
*/
|
|
205
|
+
export const writeDaemonFiles = async (
|
|
206
|
+
projectRoot: string,
|
|
207
|
+
meta: DaemonMeta,
|
|
208
|
+
): Promise<void> => {
|
|
209
|
+
await fs.ensureDir(getDowncityDebugDirPath(projectRoot));
|
|
210
|
+
await fs.writeFile(getDaemonPidPath(projectRoot), String(meta.pid), "utf-8");
|
|
211
|
+
await fs.writeJson(getDaemonMetaPath(projectRoot), meta, { spaces: 2 });
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 启动 daemon 子进程。
|
|
216
|
+
*
|
|
217
|
+
* 流程(中文)
|
|
218
|
+
* 1) 清理脏 pid/meta
|
|
219
|
+
* 2) 检查是否已有存活 daemon
|
|
220
|
+
* 3) detached + unref 拉起 `node cli.js run ...`
|
|
221
|
+
* 4) 写入 pid/meta 供 stop/restart 使用
|
|
222
|
+
*/
|
|
223
|
+
export const startDaemonProcess = async (params: {
|
|
224
|
+
projectRoot: string;
|
|
225
|
+
cliPath: string;
|
|
226
|
+
args: string[];
|
|
227
|
+
}): Promise<{ pid: number; logPath: string }> => {
|
|
228
|
+
const { projectRoot, cliPath, args } = params;
|
|
229
|
+
|
|
230
|
+
await fs.ensureDir(getDowncityDebugDirPath(projectRoot));
|
|
231
|
+
await cleanupStaleDaemonFiles(projectRoot);
|
|
232
|
+
|
|
233
|
+
const existingPid = await readDaemonPid(projectRoot);
|
|
234
|
+
if (existingPid && isProcessAlive(existingPid)) {
|
|
235
|
+
throw new Error(`Daemon already running (pid: ${existingPid})`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const logPath = getDaemonLogPath(projectRoot);
|
|
239
|
+
const logFd = fs.openSync(logPath, "a");
|
|
240
|
+
|
|
241
|
+
const childEnv: NodeJS.ProcessEnv = {
|
|
242
|
+
...process.env,
|
|
243
|
+
DOWNCITY_DAEMON: "1",
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// 关键注释:daemon 进程必须 detached + unref 才能在父进程退出后继续运行。
|
|
247
|
+
const child = spawn(process.execPath, [cliPath, ...args], {
|
|
248
|
+
cwd: projectRoot,
|
|
249
|
+
detached: true,
|
|
250
|
+
stdio: ["ignore", logFd, logFd],
|
|
251
|
+
env: childEnv,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
child.unref();
|
|
255
|
+
|
|
256
|
+
if (!child.pid) {
|
|
257
|
+
throw new Error("Failed to start daemon process (missing pid)");
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
await writeDaemonFiles(projectRoot, {
|
|
261
|
+
pid: child.pid,
|
|
262
|
+
projectRoot,
|
|
263
|
+
startedAt: new Date().toISOString(),
|
|
264
|
+
command: process.execPath,
|
|
265
|
+
args: [cliPath, ...args],
|
|
266
|
+
node: process.version,
|
|
267
|
+
platform: process.platform,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// 关键点(中文):启动成功后必须登记到 managed agent registry,否则该 daemon 视为“无效启动”。
|
|
271
|
+
try {
|
|
272
|
+
await upsertManagedAgentEntry({
|
|
273
|
+
projectRoot,
|
|
274
|
+
pid: child.pid,
|
|
275
|
+
status: "running",
|
|
276
|
+
});
|
|
277
|
+
} catch (error) {
|
|
278
|
+
// 回滚:无法登记时立即停止 daemon 并清理状态文件。
|
|
279
|
+
signalDetachedProcess(child.pid, "SIGTERM");
|
|
280
|
+
await sleep(300);
|
|
281
|
+
try {
|
|
282
|
+
if (isProcessAlive(child.pid)) signalDetachedProcess(child.pid, "SIGKILL");
|
|
283
|
+
} catch {
|
|
284
|
+
// ignore
|
|
285
|
+
}
|
|
286
|
+
await fs.remove(getDaemonPidPath(projectRoot));
|
|
287
|
+
await fs.remove(getDaemonMetaPath(projectRoot));
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return { pid: child.pid, logPath };
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 停止 daemon 子进程。
|
|
296
|
+
*
|
|
297
|
+
* 策略(中文)
|
|
298
|
+
* - 先发 `SIGTERM` 做优雅退出;超时后回退 `SIGKILL`。
|
|
299
|
+
* - 无论 stop 结果如何,最终清理 pid/meta,避免状态残留。
|
|
300
|
+
*/
|
|
301
|
+
export const stopDaemonProcess = async (params: {
|
|
302
|
+
projectRoot: string;
|
|
303
|
+
timeoutMs?: number;
|
|
304
|
+
}): Promise<{ stopped: boolean; pid?: number }> => {
|
|
305
|
+
const { projectRoot, timeoutMs = 10_000 } = params;
|
|
306
|
+
|
|
307
|
+
await cleanupStaleDaemonFiles(projectRoot);
|
|
308
|
+
const pid = await readDaemonPid(projectRoot);
|
|
309
|
+
if (!pid) return { stopped: false };
|
|
310
|
+
|
|
311
|
+
if (!isProcessAlive(pid)) {
|
|
312
|
+
await fs.remove(getDaemonPidPath(projectRoot));
|
|
313
|
+
await fs.remove(getDaemonMetaPath(projectRoot));
|
|
314
|
+
return { stopped: false, pid };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
signalDetachedProcess(pid, "SIGTERM");
|
|
318
|
+
|
|
319
|
+
const startedAt = Date.now();
|
|
320
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
321
|
+
if (!isProcessAlive(pid)) break;
|
|
322
|
+
await sleep(200);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (isProcessAlive(pid)) {
|
|
326
|
+
// 关键注释:尽量优雅停止,超时后再强杀,避免后台进程“卡死”。
|
|
327
|
+
try {
|
|
328
|
+
signalDetachedProcess(pid, "SIGKILL");
|
|
329
|
+
} catch {
|
|
330
|
+
// ignore
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
await fs.remove(getDaemonPidPath(projectRoot));
|
|
335
|
+
await fs.remove(getDaemonMetaPath(projectRoot));
|
|
336
|
+
// 关键点(中文):停止后标记为 stopped,保留历史记录。
|
|
337
|
+
try {
|
|
338
|
+
await markManagedAgentStopped(projectRoot);
|
|
339
|
+
} catch {
|
|
340
|
+
// ignore registry sync errors
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return { stopped: true, pid };
|
|
344
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentHostRuntime:装配 AgentRuntime 宿主能力。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - `main/agent/*` 负责创建这些宿主能力对象,再注入到 AgentRuntime。
|
|
6
|
+
* - services / session / plugins 只消费这些对象,不再直接 import `main/*`。
|
|
7
|
+
* - 当前先收敛路径与 plugin 配置持久化两类宿主能力。
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
getCacheDirPath,
|
|
11
|
+
getDowncityChannelDirPath,
|
|
12
|
+
getDowncityChannelMetaPath,
|
|
13
|
+
getDowncityChatHistoryPath,
|
|
14
|
+
getDowncityDirPath,
|
|
15
|
+
getDowncityMemoryDailyDirPath,
|
|
16
|
+
getDowncityMemoryDailyPath,
|
|
17
|
+
getDowncityMemoryIndexPath,
|
|
18
|
+
getDowncityMemoryLongTermPath,
|
|
19
|
+
getDowncitySessionDirPath,
|
|
20
|
+
getDowncitySessionRootDirPath,
|
|
21
|
+
} from "@/config/Paths.js";
|
|
22
|
+
import { persistProjectPluginConfig } from "@downcity/agent";
|
|
23
|
+
import type {
|
|
24
|
+
AgentPathRuntime,
|
|
25
|
+
AgentPluginConfigRuntime,
|
|
26
|
+
} from "@downcity/agent";
|
|
27
|
+
import type { DowncityConfig } from "@downcity/agent";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 创建当前项目的路径能力集合。
|
|
31
|
+
*/
|
|
32
|
+
export function createAgentPathRuntime(projectRoot: string): AgentPathRuntime {
|
|
33
|
+
const rootPath = String(projectRoot || "").trim();
|
|
34
|
+
return {
|
|
35
|
+
projectRoot: rootPath,
|
|
36
|
+
getDowncityDirPath: () => getDowncityDirPath(rootPath),
|
|
37
|
+
getCacheDirPath: () => getCacheDirPath(rootPath),
|
|
38
|
+
getDowncityChannelDirPath: () => getDowncityChannelDirPath(rootPath),
|
|
39
|
+
getDowncityChannelMetaPath: () => getDowncityChannelMetaPath(rootPath),
|
|
40
|
+
getDowncityChatHistoryPath: (sessionId) => getDowncityChatHistoryPath(rootPath, sessionId),
|
|
41
|
+
getDowncityMemoryIndexPath: () => getDowncityMemoryIndexPath(rootPath),
|
|
42
|
+
getDowncityMemoryLongTermPath: () => getDowncityMemoryLongTermPath(rootPath),
|
|
43
|
+
getDowncityMemoryDailyDirPath: () => getDowncityMemoryDailyDirPath(rootPath),
|
|
44
|
+
getDowncityMemoryDailyPath: (date) => getDowncityMemoryDailyPath(rootPath, date),
|
|
45
|
+
getDowncitySessionRootDirPath: () => getDowncitySessionRootDirPath(rootPath),
|
|
46
|
+
getDowncitySessionDirPath: (sessionId) => getDowncitySessionDirPath(rootPath, sessionId),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 创建 plugin 配置持久化能力集合。
|
|
52
|
+
*/
|
|
53
|
+
export function createAgentPluginConfigRuntime(projectRoot: string): AgentPluginConfigRuntime {
|
|
54
|
+
const rootPath = String(projectRoot || "").trim();
|
|
55
|
+
return {
|
|
56
|
+
async persistProjectPlugins(plugins: DowncityConfig["plugins"] | undefined): Promise<string> {
|
|
57
|
+
return persistProjectPluginConfig({
|
|
58
|
+
projectRoot: rootPath,
|
|
59
|
+
sections: {
|
|
60
|
+
...(plugins !== undefined ? { plugins } : {}),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|