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
+4 -1
View File
@@ -25,7 +25,7 @@ type Options = {
capabilities: CapabilityService
executionSpaceResolver: ExecutionSpaceResolver
terminalManager: TerminalSessionManager
localEnvironment: LocalToolEnvironmentService
localEnvironment: Pick<LocalToolEnvironmentService, 'launchEnvironmentProvider' | 'whenReady'>
bundledRuntimePaths: BundledRuntimePaths
rootDirectory: string
managedNodeDirectory: string
@@ -122,6 +122,9 @@ export class NativeClientCoordinator {
}
async open(ownerId: number, conversationId: string): Promise<RuntimeNativeClientResult> {
this.assertOwner(ownerId)
// Native clients launch with the prepared tool PATH; startup builds it in the background.
await this.options.localEnvironment.whenReady()
this.assertOwner(ownerId)
const context = await this.resolve(conversationId)
this.assertOwner(ownerId)