Skip to content
lukachiPublic

About

Native UI for terminal coding agents: OpenUI Lang drawn with gpui-kit in a Herdr pane

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

openGPUI

Native UI for terminal coding agents. An agent writes a short OpenUI Lang file, and openGPUI draws it as a real interface in a Herdr pane next to the agent. The person reads tables and charts, fills in forms, clicks buttons, and the answer goes back to the agent.

A launch review an agent drew with openGPUI: metrics, charts, a table, a rollout plan and a form, in light and dark

Why

Terminal agents talk in text. That works until the agent needs a decision with context: a release with numbers to review, a form with five fields, a choice between three plans. openGPUI gives any agent that can run a shell command a way to show that as UI and wait for the answer. It needs no browser and no web server, and the agent's own harness stays as it is.

What you get

  • The whole OpenUI component library. All 86 components of OpenUI's openui and chat libraries: layout, text and markdown, tables, charts, forms, buttons, cards. They are ported from @openuidev/react-ui to native gpui-kit elements and look and behave like upstream.
  • Diagrams. The agent draws what's easier to see than to read: architecture, flowcharts, state machines, data models, sequence diagrams, roadmaps. The pane lays them out automatically, with numbered steps that light up the part they talk about. Click a box and the agent tells you more.
  • Answers come back. Button clicks arrive as JSON events, with the form's values, in the agent's terminal (hc send) or through opengpui wait.
  • Streaming. The pane redraws as the agent writes the file and holds the inputs until it is complete.
  • Works with any agent. A small CLI (prompt, check, show, wait, events, close) and a skill teach the agent the language and the loop. It was tried with Codex and omp.
  • Fits Herdr. The pane draws in Herdr's theme colors, or in OpenUI's own light and dark look.

Install

You need Herdr and Node.js 18+ (or Bun) for the CLI. Ask your agent, in a Herdr terminal:

Read ~/.config/herdr-app/AGENTS.md, then add this mod: herdr.dev/mods/lukachi/opengpui

It copies the mod into ~/.config/herdr-app/mods/opengpui. Then put the CLI on your PATH:

ln -s ~/.config/herdr-app/mods/opengpui/cli/opengpui ~/.local/bin/opengpui

Or by hand, from the latest release:

tar -xzf opengpui-v*.tar.gz -C ~/.config/herdr-app/mods
ln -s ~/.config/herdr-app/mods/opengpui/cli/opengpui ~/.local/bin/opengpui

To build from source, see Development.

Updating

When a newer release is out, opengpui show and opengpui --version say so (they ask GitHub at most once a day; OPENGPUI_NO_UPDATE_CHECK=1 turns that off). Your agent tells you and, if you agree, updates by the skill's "Updating" steps. By hand:

tmp=$(mktemp -d)
curl -fL https://github.com/lukachi/openGPUI/releases/download/v<version>/opengpui-v<version>.tar.gz | tar -xz -C "$tmp"
rm -rf ~/.config/herdr-app/mods/opengpui && mv "$tmp/opengpui" ~/.config/herdr-app/mods/opengpui

Herdr picks the new build up in place; restart it if the release changed the fonts. A copy of the skill saved as a file stays old: refresh it with opengpui skill > <that SKILL.md>.

Try it

From a terminal inside Herdr:

cat > review.oui <<'EOF'
root = Stack([title, form])
title = CardHeader("Deploy 2.4?", "Canary is healthy for 30 minutes")
form = Form("deploy", Buttons([Button("Deploy", @ToAssistant("Deploy"), "primary"), Button("Hold", @ToAssistant("Hold"), "secondary")]), [note])
note = FormControl("Note", TextArea("note", "Optional", 2))
EOF
opengpui check review.oui   # ok: /…/review.oui
opengpui show review.oui    # opens the pane beside this terminal
opengpui wait review.oui    # blocks until the person clicks, then prints the event
{"at":"…","src":"/…/review.oui","type":"continue_conversation","message":"Deploy","params":{},"formName":"deploy","formState":{"deploy":{"note":"ship it"}}}

To let an agent do this on its own, give it the skill: opengpui skill prints it (skills/opengpui/SKILL.md), and opengpui prompt prints the language manual.

How it works

flowchart LR
  A["Agent writes ui.oui"] --> B["Herdr pane: opengpui mod"]
  B --> C["Session: OpenUI lang-core parser, state, queries"]
  C --> D["Surface: native gpui-kit renderers"]
  D --> E["Person clicks / types"]
  E -- "hc send + events file" --> A
Loading

The language, parser, $state, queries and actions are OpenUI's own @openuidev/lang-core. The component library (names, schemas, prompts) is OpenUI's own genui-lib, compiled without React. Only the drawing is new.

Documentation

License and credits

MIT, see LICENSE.

  • OpenUI (MIT, Thesys Inc.): openGPUI ports and compiles parts of it (licenses/openui.txt).
  • Inter (SIL OFL 1.1): the mod ships modified cuts (licenses/inter.txt).
  • lucide (ISC): icons (licenses/lucide.txt).
  • Eclipse Layout Kernel (elkjs, EPL-2.0): lays out Diagrams, inside the mod's CLI (licenses/elkjs.txt).
  • gpui-kit and Herdr: the native toolkit and the host.

The mod carries these licenses in its licenses/ folder (Inter's in fonts/).

About

Native UI for terminal coding agents: OpenUI Lang drawn with gpui-kit in a Herdr pane

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages