perf(startup): build the local tool environment in the background and gate its consumers

Runtime creation, MCP launches, Obsidian, native clients and the tool-environment IPC await the initialization promise instead of startup awaiting it before the window path. A failure still fails startup with the same diagnostic.
This commit is contained in:
mesalogo
2026-10-03 16:56:13 +08:00
parent b28ddd4ba8
commit 68cc0792e1
11 changed files with 149 additions and 19 deletions
+3 -1
View File
@@ -64,7 +64,7 @@ export function registerCapabilityIpcHandlers(
runtimeExtensionStore?: RuntimeExtensionStore
knowledgeGateway?: Pick<KnowledgeMcpGateway, 'revokeObsidianCapabilities'>
obsidianService?: Pick<ObsidianService, 'testConnection'>
localToolEnvironmentService?: Pick<LocalToolEnvironmentService, 'launchEnvironmentProvider'>
localToolEnvironmentService?: Pick<LocalToolEnvironmentService, 'launchEnvironmentProvider' | 'whenReady'>
}
): void {
registerHandler(
@@ -266,6 +266,8 @@ export function registerCapabilityIpcHandlers(
ipcChannels.capabilitiesTestMcp,
async (event, input: unknown): Promise<McpServerTestResult> => {
assertTrustedSender(event, window)
// A stdio MCP test must launch with the prepared tool PATH.
await localToolEnvironmentService?.whenReady()
return testMcpServer(
await capabilityService.getResolvedMcpServer(
mcpServerIdSchema.parse(input)