| | |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.Extensions.Hosting; |
| | | using Microsoft.Extensions.Logging; |
| | | using Moli.Desktop.Audio; |
| | | using Moli.Desktop.Configuration; |
| | | using Moli.Desktop.Diagnostics; |
| | | using Moli.Desktop.Interop; |
| | | using Moli.Desktop.Layout; |
| | | using Moli.Desktop.Api; |
| | | using Moli.Desktop.Llm; |
| | | using Moli.Desktop.Management; |
| | | using Moli.Desktop.Plugins; |
| | | using Moli.Desktop.Runtime; |
| | | using Moli.Desktop.Tray; |
| | | using Moli.Desktop.WebView; |
| | | using Moli.Desktop.Windows; |
| | | |
| | |
| | | return Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) |
| | | .ConfigureLogging(logging => |
| | | { |
| | | var paths = new DesktopPaths(); |
| | | logging.ClearProviders(); |
| | | logging.AddDebug(); |
| | | logging.AddProvider(new DailyFileLoggerProvider(paths.LogDirectory)); |
| | | }) |
| | | .ConfigureServices(services => |
| | | { |
| | | services.AddSingleton<DesktopPaths>(); |
| | | services.AddSingleton<IDiagnosticsService, DiagnosticsService>(); |
| | | services.AddSingleton<IDefaultContentInstaller, DefaultContentInstaller>(); |
| | | services.AddSingleton<IRuntimeEventBus, RuntimeEventBus>(); |
| | | services.AddHostedService<WasapiLoopbackAudioSpectrumService>(); |
| | | services.AddSingleton<IRuntimeSurfaceController, RuntimeSurfaceController>(); |
| | | services.AddSingleton<IDesktopRuntime, DesktopRuntimeCoordinator>(); |
| | | services.AddSingleton<IConfigurationService, JsonConfigurationService>(); |
| | | services.AddSingleton<ILlmModelRegistry, LlmModelRegistry>(); |
| | | services.AddSingleton<ICredentialStore, EnvironmentCredentialStore>(); |
| | | services.AddHttpClient<OpenAICompatibleAdapter>(); |
| | | services.AddHttpClient<AiChatClient>(); |
| | | services.AddSingleton<IAiChatClient>(sp => sp.GetRequiredService<AiChatClient>()); |
| | | services.AddSingleton<ILlmProviderAdapter>(sp => sp.GetRequiredService<OpenAICompatibleAdapter>()); |
| | | services.AddSingleton<ILlmProviderAdapterFactory, LlmProviderAdapterFactory>(); |
| | | services.AddSingleton<ILlmGatewayService, LlmGatewayService>(); |
| | | services.AddSingleton<IPluginManifestValidator, PluginManifestValidator>(); |
| | | services.AddSingleton<PluginStateMachine>(); |
| | | services.AddSingleton<IPluginManager, PluginManager>(); |
| | |
| | | services.AddSingleton<IWin32InteropService, Win32InteropService>(); |
| | | services.AddSingleton<PluginBridgeDispatcher>(); |
| | | services.AddSingleton<IWebViewHostFactory, WebViewHostFactory>(); |
| | | services.AddSingleton<MainWindow>(); |
| | | services.AddSingleton<LocalApiService>(); |
| | | services.AddSingleton<ILocalApiStatus>(sp => sp.GetRequiredService<LocalApiService>()); |
| | | services.AddHostedService(sp => sp.GetRequiredService<LocalApiService>()); |
| | | services.AddSingleton<IStartupService, RegistryStartupService>(); |
| | | services.AddSingleton<ITrayShell, TrayShell>(); |
| | | services.AddTransient<ManagementWindow>(); |
| | | }); |
| | | } |
| | | } |