diff --git a/ui-tui/src/entry.tsx b/ui-tui/src/entry.tsx index 3ab4be96ba..abbcf7a4c8 100644 --- a/ui-tui/src/entry.tsx +++ b/ui-tui/src/entry.tsx @@ -1,7 +1,8 @@ #!/usr/bin/env node -import { render } from '@hermes/ink' - -import { App } from './app.js' +// Import order matters for cold start: `GatewayClient` has only node-builtin +// deps (<20ms), so spawning the python gateway before loading @hermes/ink +// + App (~200ms combined) gives python ~200ms of free parallel time to run +// its own module imports instead of starting those after node is done. import { GatewayClient } from './gatewayClient.js' if (!process.stdin.isTTY) { @@ -11,6 +12,7 @@ if (!process.stdin.isTTY) { const gw = new GatewayClient() gw.start() -render(, { - exitOnCtrlC: false -}) + +const [{ render }, { App }] = await Promise.all([import('@hermes/ink'), import('./app.js')]) + +render(, { exitOnCtrlC: false })