npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ai-tui/core

v0.2.2

Published

Build AI agent terminal UIs with the Vercel AI SDK

Readme

@ai-tui/core

npm version License: MIT Node.js

A terminal UI framework for building AI agent interfaces with the Vercel AI SDK. Built with React and OpenTUI.

Get started | Features | Configuration | Theming | Tool renderers


Overview

@ai-tui/core lets you build rich terminal interfaces for AI agents in minutes. Define your agents, pick a theme, and get a full-featured TUI with chat, tool visualization, session management, and keyboard-driven navigation — all wired into the Vercel AI SDK.

Adapted from OpenCode by Anomaly Co., converted from Solid.js to React while preserving the core architecture, theme system, and UI components. See LICENSE for full attribution.

Getting started

Prerequisites

  • Node.js 20 or later

Installation

npm install @ai-tui/core

Peer dependencies

You'll also need the following:

npm install ai @ai-sdk/react react @opentui/core @opentui/react

Quick example

import { TerminalUI, Agent, type ConfigInput } from "@ai-tui/core";
import { anthropic } from "@ai-sdk/anthropic";
import { DirectChatTransport, ToolLoopAgent, stepCountIs } from "ai";

const myAgent = new Agent({
  id: "assistant",
  name: "Assistant",
  model: { providerName: "Anthropic", name: "Claude Sonnet 4" },
  color: "#82aaff",
  createTransport: async ({ transportOptions }) => {
    const agent = new ToolLoopAgent({
      model: anthropic("claude-sonnet-4-20250514"),
      tools: {},
      instructions: "You are a helpful assistant.",
      stopWhen: stepCountIs(50),
    });
    return new DirectChatTransport({ agent, ...transportOptions });
  },
});

const config: ConfigInput = {
  id: "my-agent-cli",
  agents: [myAgent],
  appName: {
    sections: [
      { text: "My", style: "muted" },
      { text: "Agent" },
    ],
  },
};

const tui = new TerminalUI(config);
await tui.run();

Features

  • Multi-agent support — define multiple agents and switch between them
  • Theming — built-in themes (OpenCode, Vercel, One Dark) with full customization support
  • Tool renderers — rich terminal UI for tool calls (bash, file edits, search, etc.) with custom renderer support
  • Slash commands — extensible command system with fuzzy autocomplete
  • Session persistence — XDG-compliant storage with session history and resume
  • File attachments — attach files and paste from clipboard
  • Keyboard-driven — comprehensive keybindings for navigation, dialogs, and agent switching
  • Subagent display — show subagent activity inline
  • Sidebar — context panel with files, todos, and session info
  • Elicitation — handle interactive prompts from AI agents

Configuration

ConfigInput

| Property | Type | Required | Description | |---|---|---|---| | id | string | Yes | App identifier for XDG storage paths (kebab-case) | | agents | Agent[] | Yes | Array of agent definitions | | appName | AppName | No | Title sections for the ASCII logo | | subagents | SubagentDefinition[] | No | Subagent definitions for inline display | | commands | CommandDefinition[] | No | Custom slash commands | | tips | string[] | No | Tips shown on the home screen |

Agent

| Property | Type | Required | Description | |---|---|---|---| | id | string | Yes | Unique agent identifier | | name | string | Yes | Display name | | model | { providerName, name } | Yes | Model info shown in the header | | color | HexColor \| RGBA | Yes | Agent accent color | | createTransport | AgentCreateTransport | Yes | Factory function returning a ChatTransport | | toolComponents | ToolComponentsMap | No | Custom tool renderers for this agent | | placeholders | string[] | No | Random placeholder text for the input |

Theming

Three built-in themes are available, and you can extend any of them:

import {
  openCodeTheme,
  vercelTheme,
  oneDarkTheme,
  resolveTheme,
  extendTheme,
} from "@ai-tui/core";

// Use a built-in theme
const theme = resolveTheme(vercelTheme, "dark");

// Extend with custom overrides
const customTheme = extendTheme(theme, {
  colors: { primary: "#ff6b6b" },
});

Each theme supports both "dark" and "light" modes. Themes control colors, syntax highlighting styles, and UI element appearance.

Tool renderers

The package includes built-in renderers for common tools (bash, file read/write/edit, glob, grep, search, etc.) and provides two base components for building custom renderers:

import { BlockTool, InlineTool } from "@ai-tui/core";

// Inline: single-line display for lightweight tools
function MyInlineRenderer({ tool, isComplete }: ToolRendererProps) {
  return (
    <InlineTool complete={isComplete} icon=">" pending="Running...">
      my-tool
    </InlineTool>
  );
}

// Block: multi-line display for tools with rich output
function MyBlockRenderer({ tool, isComplete }: ToolRendererProps) {
  return <BlockTool title="My Tool">{tool.result}</BlockTool>;
}

// Register per agent
const agent = new Agent({
  // ...
  toolComponents: {
    "my-tool": MyBlockRenderer,
  },
});

[!TIP] Custom toolComponents on an agent take precedence over the built-in renderers.