Repository navigation
Description
Description
Introduce a "Headless API Mode" for the core engine that completely bypasses Ink.js terminal rendering when the --acp flag is provided. This will act as a pure state machine that streams raw JSON/ACP events over WebSocket, drastically improving GUI responsiveness and eliminating the "Double-React" rendering penalty.
Use Case
Currently, when the VS Code extension connects to the background Nanocoder CLI process via WebSocket, the CLI is still processing LLM streams and rendering a virtual DOM in the background using Ink.js (React for the terminal). It then serializes that state and sends it to the VS Code Webview, which uses React to render it again.
This Double-React pipeline introduces noticeable UI stuttering, input lag, and high CPU usage. By bypassing the terminal rendering layer entirely when connected to a GUI, the VS Code extension and Web Mode will feel instantly snappy, native, and identical to deeply-integrated IDEs like Antigravity or Cursor.
Proposed Solution
- In
source/cli.tsxorsource/app.tsx, detect if the--acpflag (or a specific--headlessflag) is active. - If true, skip mounting the
Ink.js<App />component. - Instead, pipe the output of
useChatHandleranduseAppStatedirectly into theWebSocketClient/AcpServerlayer as raw JSON stream events. - Ensure all native terminal commands (like the CLI
/settingsUI) gracefully degrade or redirect to the GUI equivalents when running headless.
Alternatives Considered
- Optimizing Ink.js render loops: We could try to throttle Ink's virtual DOM updates, but the fundamental architectural overhead of building a terminal UI string just to serialize it for a Webview remains. A true headless mode is the only correct architectural path for GUI clients.
Additional Context
- I have searched existing issues to ensure this is not a duplicate
- This feature aligns with the project's goals (local-first AI assistance)
Activity
[-][Feature] [Feature] Headless API Mode to Bypass Ink.js Rendering (Performance)[/-][+][Feature] Headless API Mode to Bypass Ink.js Rendering (Performance)[/+]AryanNandanwar commentedon Aug 6, 2026
Hey @akramcodez , I'd like to work on this.