@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
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConsoleStore 模型与 Provider 仓储。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 只负责 model/provider 相关读写,不处理 env、channel account、secure settings。
|
|
6
|
-
* - 对外暴露纯函数,`ConsoleStore` 作为门面调用。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { eq } from "drizzle-orm";
|
|
10
|
-
import type {
|
|
11
|
-
StoredModel,
|
|
12
|
-
StoredModelProvider,
|
|
13
|
-
StoredProviderMeta,
|
|
14
|
-
UpsertModelInput,
|
|
15
|
-
UpsertModelProviderInput,
|
|
16
|
-
} from "@/types/store/Store.js";
|
|
17
|
-
import { decryptText, encryptText } from "./crypto.js";
|
|
18
|
-
import { modelProvidersTable, modelsTable } from "./schema.js";
|
|
19
|
-
import type { ConsoleStoreContext } from "./StoreShared.js";
|
|
20
|
-
import { nowIso } from "./StoreShared.js";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 列出 providers。
|
|
24
|
-
*/
|
|
25
|
-
export async function listStoredProviders(
|
|
26
|
-
context: ConsoleStoreContext,
|
|
27
|
-
): Promise<StoredModelProvider[]> {
|
|
28
|
-
const rows = context.db.select().from(modelProvidersTable).all();
|
|
29
|
-
const result: StoredModelProvider[] = [];
|
|
30
|
-
for (const row of rows) {
|
|
31
|
-
let apiKey: string | undefined;
|
|
32
|
-
if (row.apiKeyEncrypted) {
|
|
33
|
-
apiKey = await decryptText(row.apiKeyEncrypted);
|
|
34
|
-
}
|
|
35
|
-
result.push({
|
|
36
|
-
id: row.id,
|
|
37
|
-
type: row.type as StoredModelProvider["type"],
|
|
38
|
-
baseUrl: row.baseUrl || undefined,
|
|
39
|
-
apiKey,
|
|
40
|
-
createdAt: row.createdAt,
|
|
41
|
-
updatedAt: row.updatedAt,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 同步列出 provider 元信息(不含 API Key)。
|
|
49
|
-
*/
|
|
50
|
-
export function listStoredProviderMetas(
|
|
51
|
-
context: ConsoleStoreContext,
|
|
52
|
-
): StoredProviderMeta[] {
|
|
53
|
-
const rows = context.db.select().from(modelProvidersTable).all();
|
|
54
|
-
return rows.map((row) => ({
|
|
55
|
-
id: row.id,
|
|
56
|
-
type: row.type,
|
|
57
|
-
baseUrl: row.baseUrl || undefined,
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 获取单个 provider。
|
|
63
|
-
*/
|
|
64
|
-
export async function getStoredProvider(
|
|
65
|
-
context: ConsoleStoreContext,
|
|
66
|
-
providerId: string,
|
|
67
|
-
): Promise<StoredModelProvider | null> {
|
|
68
|
-
const row = context.db
|
|
69
|
-
.select()
|
|
70
|
-
.from(modelProvidersTable)
|
|
71
|
-
.where(eq(modelProvidersTable.id, providerId))
|
|
72
|
-
.get();
|
|
73
|
-
if (!row) return null;
|
|
74
|
-
let apiKey: string | undefined;
|
|
75
|
-
if (row.apiKeyEncrypted) {
|
|
76
|
-
apiKey = await decryptText(row.apiKeyEncrypted);
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
id: row.id,
|
|
80
|
-
type: row.type as StoredModelProvider["type"],
|
|
81
|
-
baseUrl: row.baseUrl || undefined,
|
|
82
|
-
apiKey,
|
|
83
|
-
createdAt: row.createdAt,
|
|
84
|
-
updatedAt: row.updatedAt,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 新增或更新 provider。
|
|
90
|
-
*/
|
|
91
|
-
export async function upsertStoredProvider(
|
|
92
|
-
context: ConsoleStoreContext,
|
|
93
|
-
input: UpsertModelProviderInput,
|
|
94
|
-
): Promise<void> {
|
|
95
|
-
const id = String(input.id || "").trim();
|
|
96
|
-
if (!id) throw new Error("providerId cannot be empty");
|
|
97
|
-
|
|
98
|
-
const existing = context.db
|
|
99
|
-
.select()
|
|
100
|
-
.from(modelProvidersTable)
|
|
101
|
-
.where(eq(modelProvidersTable.id, id))
|
|
102
|
-
.get();
|
|
103
|
-
const createdAt = existing?.createdAt || nowIso();
|
|
104
|
-
const updatedAt = nowIso();
|
|
105
|
-
const hasApiKeyField = Object.prototype.hasOwnProperty.call(input, "apiKey");
|
|
106
|
-
let apiKeyEncrypted: string | null = existing?.apiKeyEncrypted || null;
|
|
107
|
-
if (hasApiKeyField) {
|
|
108
|
-
if (typeof input.apiKey === "string" && input.apiKey.length > 0) {
|
|
109
|
-
apiKeyEncrypted = await encryptText(input.apiKey);
|
|
110
|
-
} else {
|
|
111
|
-
apiKeyEncrypted = null;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
context.db
|
|
116
|
-
.insert(modelProvidersTable)
|
|
117
|
-
.values({
|
|
118
|
-
id,
|
|
119
|
-
type: input.type,
|
|
120
|
-
baseUrl: input.baseUrl || null,
|
|
121
|
-
apiKeyEncrypted,
|
|
122
|
-
createdAt,
|
|
123
|
-
updatedAt,
|
|
124
|
-
})
|
|
125
|
-
.onConflictDoUpdate({
|
|
126
|
-
target: modelProvidersTable.id,
|
|
127
|
-
set: {
|
|
128
|
-
type: input.type,
|
|
129
|
-
baseUrl: input.baseUrl || null,
|
|
130
|
-
apiKeyEncrypted,
|
|
131
|
-
updatedAt,
|
|
132
|
-
},
|
|
133
|
-
})
|
|
134
|
-
.run();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* 删除 provider。
|
|
139
|
-
*/
|
|
140
|
-
export function removeStoredProvider(
|
|
141
|
-
context: ConsoleStoreContext,
|
|
142
|
-
providerId: string,
|
|
143
|
-
): void {
|
|
144
|
-
const refs = context.db
|
|
145
|
-
.select()
|
|
146
|
-
.from(modelsTable)
|
|
147
|
-
.where(eq(modelsTable.providerId, providerId))
|
|
148
|
-
.all();
|
|
149
|
-
if (refs.length > 0) {
|
|
150
|
-
throw new Error(
|
|
151
|
-
`Provider "${providerId}" is referenced by models: ${refs.map((item) => item.id).join(", ")}`,
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
context.db
|
|
155
|
-
.delete(modelProvidersTable)
|
|
156
|
-
.where(eq(modelProvidersTable.id, providerId))
|
|
157
|
-
.run();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* 列出 models。
|
|
162
|
-
*/
|
|
163
|
-
export function listStoredModels(context: ConsoleStoreContext): StoredModel[] {
|
|
164
|
-
const rows = context.db.select().from(modelsTable).all();
|
|
165
|
-
return rows.map((row) => ({
|
|
166
|
-
id: row.id,
|
|
167
|
-
providerId: row.providerId,
|
|
168
|
-
name: row.name,
|
|
169
|
-
temperature: row.temperature ?? undefined,
|
|
170
|
-
maxTokens: row.maxTokens ?? undefined,
|
|
171
|
-
topP: row.topP ?? undefined,
|
|
172
|
-
frequencyPenalty: row.frequencyPenalty ?? undefined,
|
|
173
|
-
presencePenalty: row.presencePenalty ?? undefined,
|
|
174
|
-
anthropicVersion: row.anthropicVersion ?? undefined,
|
|
175
|
-
isPaused: Number(row.isPaused || 0) === 1,
|
|
176
|
-
createdAt: row.createdAt,
|
|
177
|
-
updatedAt: row.updatedAt,
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* 获取单个 model。
|
|
183
|
-
*/
|
|
184
|
-
export function getStoredModel(
|
|
185
|
-
context: ConsoleStoreContext,
|
|
186
|
-
modelId: string,
|
|
187
|
-
): StoredModel | null {
|
|
188
|
-
const row = context.db
|
|
189
|
-
.select()
|
|
190
|
-
.from(modelsTable)
|
|
191
|
-
.where(eq(modelsTable.id, modelId))
|
|
192
|
-
.get();
|
|
193
|
-
if (!row) return null;
|
|
194
|
-
return {
|
|
195
|
-
id: row.id,
|
|
196
|
-
providerId: row.providerId,
|
|
197
|
-
name: row.name,
|
|
198
|
-
temperature: row.temperature ?? undefined,
|
|
199
|
-
maxTokens: row.maxTokens ?? undefined,
|
|
200
|
-
topP: row.topP ?? undefined,
|
|
201
|
-
frequencyPenalty: row.frequencyPenalty ?? undefined,
|
|
202
|
-
presencePenalty: row.presencePenalty ?? undefined,
|
|
203
|
-
anthropicVersion: row.anthropicVersion ?? undefined,
|
|
204
|
-
isPaused: Number(row.isPaused || 0) === 1,
|
|
205
|
-
createdAt: row.createdAt,
|
|
206
|
-
updatedAt: row.updatedAt,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* 新增或更新 model。
|
|
212
|
-
*/
|
|
213
|
-
export function upsertStoredModel(
|
|
214
|
-
context: ConsoleStoreContext,
|
|
215
|
-
input: UpsertModelInput,
|
|
216
|
-
): void {
|
|
217
|
-
const id = String(input.id || "").trim();
|
|
218
|
-
if (!id) throw new Error("modelId cannot be empty");
|
|
219
|
-
const providerId = String(input.providerId || "").trim();
|
|
220
|
-
if (!providerId) throw new Error("providerId cannot be empty");
|
|
221
|
-
const provider = context.db
|
|
222
|
-
.select()
|
|
223
|
-
.from(modelProvidersTable)
|
|
224
|
-
.where(eq(modelProvidersTable.id, providerId))
|
|
225
|
-
.get();
|
|
226
|
-
if (!provider) throw new Error(`Provider not found: ${providerId}`);
|
|
227
|
-
|
|
228
|
-
const existing = context.db
|
|
229
|
-
.select()
|
|
230
|
-
.from(modelsTable)
|
|
231
|
-
.where(eq(modelsTable.id, id))
|
|
232
|
-
.get();
|
|
233
|
-
const createdAt = existing?.createdAt || nowIso();
|
|
234
|
-
const updatedAt = nowIso();
|
|
235
|
-
|
|
236
|
-
context.db
|
|
237
|
-
.insert(modelsTable)
|
|
238
|
-
.values({
|
|
239
|
-
id,
|
|
240
|
-
providerId,
|
|
241
|
-
name: input.name,
|
|
242
|
-
temperature: input.temperature ?? null,
|
|
243
|
-
maxTokens: input.maxTokens ?? null,
|
|
244
|
-
topP: input.topP ?? null,
|
|
245
|
-
frequencyPenalty: input.frequencyPenalty ?? null,
|
|
246
|
-
presencePenalty: input.presencePenalty ?? null,
|
|
247
|
-
anthropicVersion: input.anthropicVersion ?? null,
|
|
248
|
-
isPaused: input.isPaused === true ? 1 : 0,
|
|
249
|
-
createdAt,
|
|
250
|
-
updatedAt,
|
|
251
|
-
})
|
|
252
|
-
.onConflictDoUpdate({
|
|
253
|
-
target: modelsTable.id,
|
|
254
|
-
set: {
|
|
255
|
-
providerId,
|
|
256
|
-
name: input.name,
|
|
257
|
-
temperature: input.temperature ?? null,
|
|
258
|
-
maxTokens: input.maxTokens ?? null,
|
|
259
|
-
topP: input.topP ?? null,
|
|
260
|
-
frequencyPenalty: input.frequencyPenalty ?? null,
|
|
261
|
-
presencePenalty: input.presencePenalty ?? null,
|
|
262
|
-
anthropicVersion: input.anthropicVersion ?? null,
|
|
263
|
-
isPaused: input.isPaused === true ? 1 : 0,
|
|
264
|
-
updatedAt,
|
|
265
|
-
},
|
|
266
|
-
})
|
|
267
|
-
.run();
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 切换 model 暂停状态。
|
|
272
|
-
*/
|
|
273
|
-
export function setStoredModelPaused(
|
|
274
|
-
context: ConsoleStoreContext,
|
|
275
|
-
modelId: string,
|
|
276
|
-
paused: boolean,
|
|
277
|
-
): void {
|
|
278
|
-
const id = String(modelId || "").trim();
|
|
279
|
-
if (!id) throw new Error("modelId cannot be empty");
|
|
280
|
-
const current = getStoredModel(context, id);
|
|
281
|
-
if (!current) throw new Error(`Model not found: ${id}`);
|
|
282
|
-
context.db
|
|
283
|
-
.update(modelsTable)
|
|
284
|
-
.set({
|
|
285
|
-
isPaused: paused ? 1 : 0,
|
|
286
|
-
updatedAt: nowIso(),
|
|
287
|
-
})
|
|
288
|
-
.where(eq(modelsTable.id, id))
|
|
289
|
-
.run();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* 删除 model。
|
|
294
|
-
*/
|
|
295
|
-
export function removeStoredModel(
|
|
296
|
-
context: ConsoleStoreContext,
|
|
297
|
-
modelId: string,
|
|
298
|
-
): void {
|
|
299
|
-
context.db.delete(modelsTable).where(eq(modelsTable.id, modelId)).run();
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* 获取“model + provider”聚合信息。
|
|
304
|
-
*/
|
|
305
|
-
export async function getResolvedStoredModel(
|
|
306
|
-
context: ConsoleStoreContext,
|
|
307
|
-
modelId: string,
|
|
308
|
-
): Promise<{ model: StoredModel; provider: StoredModelProvider } | null> {
|
|
309
|
-
const model = getStoredModel(context, modelId);
|
|
310
|
-
if (!model) return null;
|
|
311
|
-
const provider = await getStoredProvider(context, model.providerId);
|
|
312
|
-
if (!provider) return null;
|
|
313
|
-
return { model, provider };
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* 清空模型相关表。
|
|
318
|
-
*/
|
|
319
|
-
export function clearStoredModelsAndProviders(
|
|
320
|
-
context: ConsoleStoreContext,
|
|
321
|
-
): void {
|
|
322
|
-
context.sqlite.exec("DELETE FROM models;");
|
|
323
|
-
context.sqlite.exec("DELETE FROM model_providers;");
|
|
324
|
-
}
|
package/src/store/StoreSchema.ts
DELETED
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConsoleStore Schema 管理。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 负责 `ConsoleStore` 的建表与轻量迁移。
|
|
6
|
-
* - 启动时执行,不承担任何查询写入业务逻辑。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { ConsoleStoreContext } from "./StoreShared.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 初始化 ConsoleStore 所需表结构。
|
|
13
|
-
*/
|
|
14
|
-
export function ensureConsoleStoreSchema(context: ConsoleStoreContext): void {
|
|
15
|
-
context.sqlite.exec(`
|
|
16
|
-
CREATE TABLE IF NOT EXISTS model_providers (
|
|
17
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
18
|
-
type TEXT NOT NULL,
|
|
19
|
-
base_url TEXT,
|
|
20
|
-
api_key_encrypted TEXT,
|
|
21
|
-
created_at TEXT NOT NULL,
|
|
22
|
-
updated_at TEXT NOT NULL
|
|
23
|
-
);
|
|
24
|
-
`);
|
|
25
|
-
context.sqlite.exec(`
|
|
26
|
-
CREATE TABLE IF NOT EXISTS models (
|
|
27
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
28
|
-
provider_id TEXT NOT NULL,
|
|
29
|
-
name TEXT NOT NULL,
|
|
30
|
-
temperature REAL,
|
|
31
|
-
max_tokens INTEGER,
|
|
32
|
-
top_p REAL,
|
|
33
|
-
frequency_penalty REAL,
|
|
34
|
-
presence_penalty REAL,
|
|
35
|
-
anthropic_version TEXT,
|
|
36
|
-
is_paused INTEGER NOT NULL DEFAULT 0,
|
|
37
|
-
created_at TEXT NOT NULL,
|
|
38
|
-
updated_at TEXT NOT NULL
|
|
39
|
-
);
|
|
40
|
-
`);
|
|
41
|
-
ensureModelsTableColumns(context);
|
|
42
|
-
context.sqlite.exec(`
|
|
43
|
-
CREATE INDEX IF NOT EXISTS models_provider_id_idx
|
|
44
|
-
ON models(provider_id);
|
|
45
|
-
`);
|
|
46
|
-
context.sqlite.exec(`
|
|
47
|
-
CREATE TABLE IF NOT EXISTS console_secure_settings (
|
|
48
|
-
key TEXT PRIMARY KEY NOT NULL,
|
|
49
|
-
value_encrypted TEXT NOT NULL,
|
|
50
|
-
created_at TEXT NOT NULL,
|
|
51
|
-
updated_at TEXT NOT NULL
|
|
52
|
-
);
|
|
53
|
-
`);
|
|
54
|
-
context.sqlite.exec(`
|
|
55
|
-
CREATE TABLE IF NOT EXISTS env_entries (
|
|
56
|
-
scope TEXT NOT NULL,
|
|
57
|
-
agent_id TEXT NOT NULL DEFAULT '',
|
|
58
|
-
key TEXT NOT NULL,
|
|
59
|
-
description TEXT,
|
|
60
|
-
value_encrypted TEXT NOT NULL,
|
|
61
|
-
created_at TEXT NOT NULL,
|
|
62
|
-
updated_at TEXT NOT NULL,
|
|
63
|
-
PRIMARY KEY (scope, agent_id, key)
|
|
64
|
-
);
|
|
65
|
-
`);
|
|
66
|
-
context.sqlite.exec(`
|
|
67
|
-
CREATE INDEX IF NOT EXISTS env_entries_scope_idx
|
|
68
|
-
ON env_entries(scope);
|
|
69
|
-
`);
|
|
70
|
-
context.sqlite.exec(`
|
|
71
|
-
CREATE INDEX IF NOT EXISTS env_entries_agent_id_idx
|
|
72
|
-
ON env_entries(agent_id);
|
|
73
|
-
`);
|
|
74
|
-
ensureEnvEntriesMigration(context);
|
|
75
|
-
context.sqlite.exec(`
|
|
76
|
-
CREATE TABLE IF NOT EXISTS channel_accounts (
|
|
77
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
78
|
-
channel TEXT NOT NULL,
|
|
79
|
-
name TEXT NOT NULL,
|
|
80
|
-
identity TEXT,
|
|
81
|
-
owner TEXT,
|
|
82
|
-
creator TEXT,
|
|
83
|
-
bot_token_encrypted TEXT,
|
|
84
|
-
app_id_encrypted TEXT,
|
|
85
|
-
app_secret_encrypted TEXT,
|
|
86
|
-
domain TEXT,
|
|
87
|
-
sandbox INTEGER,
|
|
88
|
-
created_at TEXT NOT NULL,
|
|
89
|
-
updated_at TEXT NOT NULL
|
|
90
|
-
);
|
|
91
|
-
`);
|
|
92
|
-
context.sqlite.exec(`
|
|
93
|
-
CREATE INDEX IF NOT EXISTS channel_accounts_channel_idx
|
|
94
|
-
ON channel_accounts(channel);
|
|
95
|
-
`);
|
|
96
|
-
ensureChannelAccountsTableColumns(context);
|
|
97
|
-
ensureAuthSchema(context);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 初始化 Console 认证与授权表结构。
|
|
102
|
-
*
|
|
103
|
-
* 关键点(中文)
|
|
104
|
-
* - 该 schema 属于 console 级全局能力,不依赖任何单个 agent 项目。
|
|
105
|
-
* - V1 只建表与索引,不在这里写入默认数据,默认数据由 auth bootstrap 负责。
|
|
106
|
-
*/
|
|
107
|
-
function ensureAuthSchema(context: ConsoleStoreContext): void {
|
|
108
|
-
context.sqlite.exec(`
|
|
109
|
-
CREATE TABLE IF NOT EXISTS auth_users (
|
|
110
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
111
|
-
username TEXT NOT NULL,
|
|
112
|
-
password_hash TEXT NOT NULL,
|
|
113
|
-
display_name TEXT,
|
|
114
|
-
status TEXT NOT NULL,
|
|
115
|
-
created_at TEXT NOT NULL,
|
|
116
|
-
updated_at TEXT NOT NULL
|
|
117
|
-
);
|
|
118
|
-
`);
|
|
119
|
-
context.sqlite.exec(`
|
|
120
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_users_username_uq
|
|
121
|
-
ON auth_users(username);
|
|
122
|
-
`);
|
|
123
|
-
|
|
124
|
-
context.sqlite.exec(`
|
|
125
|
-
CREATE TABLE IF NOT EXISTS auth_roles (
|
|
126
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
127
|
-
name TEXT NOT NULL,
|
|
128
|
-
description TEXT,
|
|
129
|
-
created_at TEXT NOT NULL,
|
|
130
|
-
updated_at TEXT NOT NULL
|
|
131
|
-
);
|
|
132
|
-
`);
|
|
133
|
-
context.sqlite.exec(`
|
|
134
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_roles_name_uq
|
|
135
|
-
ON auth_roles(name);
|
|
136
|
-
`);
|
|
137
|
-
|
|
138
|
-
context.sqlite.exec(`
|
|
139
|
-
CREATE TABLE IF NOT EXISTS auth_permissions (
|
|
140
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
141
|
-
key TEXT NOT NULL,
|
|
142
|
-
description TEXT,
|
|
143
|
-
created_at TEXT NOT NULL,
|
|
144
|
-
updated_at TEXT NOT NULL
|
|
145
|
-
);
|
|
146
|
-
`);
|
|
147
|
-
context.sqlite.exec(`
|
|
148
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_permissions_key_uq
|
|
149
|
-
ON auth_permissions(key);
|
|
150
|
-
`);
|
|
151
|
-
|
|
152
|
-
context.sqlite.exec(`
|
|
153
|
-
CREATE TABLE IF NOT EXISTS auth_user_roles (
|
|
154
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
155
|
-
user_id TEXT NOT NULL,
|
|
156
|
-
role_id TEXT NOT NULL,
|
|
157
|
-
created_at TEXT NOT NULL
|
|
158
|
-
);
|
|
159
|
-
`);
|
|
160
|
-
context.sqlite.exec(`
|
|
161
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_user_roles_user_role_uq
|
|
162
|
-
ON auth_user_roles(user_id, role_id);
|
|
163
|
-
`);
|
|
164
|
-
context.sqlite.exec(`
|
|
165
|
-
CREATE INDEX IF NOT EXISTS auth_user_roles_user_id_idx
|
|
166
|
-
ON auth_user_roles(user_id);
|
|
167
|
-
`);
|
|
168
|
-
context.sqlite.exec(`
|
|
169
|
-
CREATE INDEX IF NOT EXISTS auth_user_roles_role_id_idx
|
|
170
|
-
ON auth_user_roles(role_id);
|
|
171
|
-
`);
|
|
172
|
-
|
|
173
|
-
context.sqlite.exec(`
|
|
174
|
-
CREATE TABLE IF NOT EXISTS auth_role_permissions (
|
|
175
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
176
|
-
role_id TEXT NOT NULL,
|
|
177
|
-
permission_id TEXT NOT NULL,
|
|
178
|
-
created_at TEXT NOT NULL
|
|
179
|
-
);
|
|
180
|
-
`);
|
|
181
|
-
context.sqlite.exec(`
|
|
182
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_role_permissions_role_permission_uq
|
|
183
|
-
ON auth_role_permissions(role_id, permission_id);
|
|
184
|
-
`);
|
|
185
|
-
context.sqlite.exec(`
|
|
186
|
-
CREATE INDEX IF NOT EXISTS auth_role_permissions_role_id_idx
|
|
187
|
-
ON auth_role_permissions(role_id);
|
|
188
|
-
`);
|
|
189
|
-
context.sqlite.exec(`
|
|
190
|
-
CREATE INDEX IF NOT EXISTS auth_role_permissions_permission_id_idx
|
|
191
|
-
ON auth_role_permissions(permission_id);
|
|
192
|
-
`);
|
|
193
|
-
|
|
194
|
-
context.sqlite.exec(`
|
|
195
|
-
CREATE TABLE IF NOT EXISTS auth_tokens (
|
|
196
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
197
|
-
user_id TEXT NOT NULL,
|
|
198
|
-
name TEXT NOT NULL,
|
|
199
|
-
token_hash TEXT NOT NULL,
|
|
200
|
-
expires_at TEXT,
|
|
201
|
-
revoked_at TEXT,
|
|
202
|
-
last_used_at TEXT,
|
|
203
|
-
created_at TEXT NOT NULL,
|
|
204
|
-
updated_at TEXT NOT NULL
|
|
205
|
-
);
|
|
206
|
-
`);
|
|
207
|
-
context.sqlite.exec(`
|
|
208
|
-
CREATE UNIQUE INDEX IF NOT EXISTS auth_tokens_token_hash_uq
|
|
209
|
-
ON auth_tokens(token_hash);
|
|
210
|
-
`);
|
|
211
|
-
context.sqlite.exec(`
|
|
212
|
-
CREATE INDEX IF NOT EXISTS auth_tokens_user_id_idx
|
|
213
|
-
ON auth_tokens(user_id);
|
|
214
|
-
`);
|
|
215
|
-
context.sqlite.exec(`
|
|
216
|
-
CREATE INDEX IF NOT EXISTS auth_tokens_expires_at_idx
|
|
217
|
-
ON auth_tokens(expires_at);
|
|
218
|
-
`);
|
|
219
|
-
|
|
220
|
-
context.sqlite.exec(`
|
|
221
|
-
CREATE TABLE IF NOT EXISTS auth_audit_logs (
|
|
222
|
-
id TEXT PRIMARY KEY NOT NULL,
|
|
223
|
-
actor_user_id TEXT,
|
|
224
|
-
actor_token_id TEXT,
|
|
225
|
-
resource_type TEXT NOT NULL,
|
|
226
|
-
resource_id TEXT,
|
|
227
|
-
action TEXT NOT NULL,
|
|
228
|
-
result TEXT NOT NULL,
|
|
229
|
-
request_id TEXT,
|
|
230
|
-
ip TEXT,
|
|
231
|
-
user_agent TEXT,
|
|
232
|
-
meta_json TEXT,
|
|
233
|
-
created_at TEXT NOT NULL
|
|
234
|
-
);
|
|
235
|
-
`);
|
|
236
|
-
context.sqlite.exec(`
|
|
237
|
-
CREATE INDEX IF NOT EXISTS auth_audit_logs_actor_created_idx
|
|
238
|
-
ON auth_audit_logs(actor_user_id, created_at);
|
|
239
|
-
`);
|
|
240
|
-
context.sqlite.exec(`
|
|
241
|
-
CREATE INDEX IF NOT EXISTS auth_audit_logs_action_created_idx
|
|
242
|
-
ON auth_audit_logs(action, created_at);
|
|
243
|
-
`);
|
|
244
|
-
context.sqlite.exec(`
|
|
245
|
-
CREATE INDEX IF NOT EXISTS auth_audit_logs_resource_idx
|
|
246
|
-
ON auth_audit_logs(resource_type, resource_id);
|
|
247
|
-
`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* 补齐 models 表的增量列。
|
|
252
|
-
*/
|
|
253
|
-
function ensureModelsTableColumns(context: ConsoleStoreContext): void {
|
|
254
|
-
const rows = context.sqlite
|
|
255
|
-
.prepare("PRAGMA table_info(models)")
|
|
256
|
-
.all() as Array<{ name?: unknown }>;
|
|
257
|
-
const columns = new Set(
|
|
258
|
-
rows.map((row) => String(row.name || "").trim()).filter(Boolean),
|
|
259
|
-
);
|
|
260
|
-
if (!columns.has("is_paused")) {
|
|
261
|
-
context.sqlite.exec(
|
|
262
|
-
"ALTER TABLE models ADD COLUMN is_paused INTEGER NOT NULL DEFAULT 0;",
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* 补齐 channel_accounts 表的增量列。
|
|
269
|
-
*/
|
|
270
|
-
function ensureChannelAccountsTableColumns(context: ConsoleStoreContext): void {
|
|
271
|
-
const rows = context.sqlite
|
|
272
|
-
.prepare("PRAGMA table_info(channel_accounts)")
|
|
273
|
-
.all() as Array<{ name?: unknown }>;
|
|
274
|
-
const columns = new Set(
|
|
275
|
-
rows.map((row) => String(row.name || "").trim()).filter(Boolean),
|
|
276
|
-
);
|
|
277
|
-
if (!columns.has("owner")) {
|
|
278
|
-
context.sqlite.exec("ALTER TABLE channel_accounts ADD COLUMN owner TEXT;");
|
|
279
|
-
}
|
|
280
|
-
if (!columns.has("creator")) {
|
|
281
|
-
context.sqlite.exec("ALTER TABLE channel_accounts ADD COLUMN creator TEXT;");
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 迁移历史 env 双表到统一单表。
|
|
287
|
-
*/
|
|
288
|
-
function ensureEnvEntriesMigration(context: ConsoleStoreContext): void {
|
|
289
|
-
const envEntryColumns = context.sqlite
|
|
290
|
-
.prepare("PRAGMA table_info(env_entries)")
|
|
291
|
-
.all() as Array<{ name?: unknown }>;
|
|
292
|
-
const envEntryColumnNames = new Set(
|
|
293
|
-
envEntryColumns.map((row) => String(row.name || "").trim()).filter(Boolean),
|
|
294
|
-
);
|
|
295
|
-
if (!envEntryColumnNames.has("description")) {
|
|
296
|
-
context.sqlite.exec("ALTER TABLE env_entries ADD COLUMN description TEXT;");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const tableRows = context.sqlite
|
|
300
|
-
.prepare(
|
|
301
|
-
"SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('global_env', 'agent_env');",
|
|
302
|
-
)
|
|
303
|
-
.all() as Array<{ name?: unknown }>;
|
|
304
|
-
const tableNames = new Set(
|
|
305
|
-
tableRows.map((row) => String(row.name || "").trim()).filter(Boolean),
|
|
306
|
-
);
|
|
307
|
-
if (tableNames.has("global_env")) {
|
|
308
|
-
context.sqlite.exec(`
|
|
309
|
-
INSERT OR IGNORE INTO env_entries (
|
|
310
|
-
scope, agent_id, key, description, value_encrypted, created_at, updated_at
|
|
311
|
-
)
|
|
312
|
-
SELECT
|
|
313
|
-
'global',
|
|
314
|
-
'',
|
|
315
|
-
key,
|
|
316
|
-
NULL,
|
|
317
|
-
value_encrypted,
|
|
318
|
-
created_at,
|
|
319
|
-
updated_at
|
|
320
|
-
FROM global_env;
|
|
321
|
-
`);
|
|
322
|
-
}
|
|
323
|
-
if (tableNames.has("agent_env")) {
|
|
324
|
-
context.sqlite.exec(`
|
|
325
|
-
INSERT OR IGNORE INTO env_entries (
|
|
326
|
-
scope, agent_id, key, description, value_encrypted, created_at, updated_at
|
|
327
|
-
)
|
|
328
|
-
SELECT
|
|
329
|
-
'agent',
|
|
330
|
-
agent_id,
|
|
331
|
-
key,
|
|
332
|
-
NULL,
|
|
333
|
-
value_encrypted,
|
|
334
|
-
created_at,
|
|
335
|
-
updated_at
|
|
336
|
-
FROM agent_env;
|
|
337
|
-
`);
|
|
338
|
-
context.sqlite.exec(`
|
|
339
|
-
UPDATE env_entries
|
|
340
|
-
SET agent_id = ''
|
|
341
|
-
WHERE scope = 'global' AND agent_id IS NULL;
|
|
342
|
-
`);
|
|
343
|
-
}
|
|
344
|
-
}
|