Skip to content

[Feature] Headless API Mode to Bypass Ink.js Rendering (Performance) #810

Closed

Description

@akramcodez

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.tsx or source/app.tsx, detect if the --acp flag (or a specific --headless flag) is active.
  • If true, skip mounting the Ink.js <App /> component.
  • Instead, pipe the output of useChatHandler and useAppState directly into the WebSocketClient / AcpServer layer as raw JSON stream events.
  • Ensure all native terminal commands (like the CLI /settings UI) 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

  1. added
    enhancement
    performance
    architecture
    on Aug 6, 2026
  2. changed the title [-][Feature] [Feature] Headless API Mode to Bypass Ink.js Rendering (Performance)[/-] [+][Feature] Headless API Mode to Bypass Ink.js Rendering (Performance)[/+] on Aug 6, 2026
  3. AryanNandanwar commented on Aug 6, 2026

    @AryanNandanwar
    Contributor

    Hey @akramcodez , I'd like to work on this.

  4. added
    area:vscode
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

architecturearea:vscodeenhancementperformance

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions