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

agentcomposerui

v0.1.3

Published

Composer UI Components for AI Agents — React & Tailwind CSS

Readme

AgentComposerUI

Composer UI components for AI Agents — React & Tailwind CSS.
Native human-in-the-loop (HITL) composer cards that agents can stream into and users can review, edit, and approve.

npm version License: MIT


The Problem

When building AI agent workflows (like social media managers, marketing assistants, or outreach bots), the agent creates structured drafts. But developers are left reinventing the wheel:

  • Building complex review and editing UIs from scratch
  • Implementing live platform-specific preview cards (e.g., LinkedIn feed truncation, character counters)
  • Handling human-in-the-loop state machines (streaming → reviewing → revising → approving)
  • Converting Zod schemas to tool definitions for OpenAI, Anthropic, and Gemini

The Solution

agentcomposerui provides plug-and-play, compound React components purpose-built for AI agent architectures.

  • Drop-in or Compound API: Use <LinkedInComposer /> directly or compose <LinkedInComposer.Root>, <Header>, <Editor>, <Preview>, <Actions>.
  • Universal LLM Schema: Standard JSON Schema export ready for OpenAI tool calls, Anthropic tools, and Gemini function declarations.
  • Full HITL State Machine: Built-in states (idle → streaming → reviewing → approved / rejected) with feedback prompts for agent revision loops.
  • Real-Time Platform Preview: Dynamic desktop and mobile preview with realistic fold truncation simulation (...see more).
  • Tailwind CSS & CSS Variables: Zero runtime CSS overhead, dark-mode ready, customizable via --acu-* design tokens.
  • Ultra Fast: Linted with oxlint, formatted with oxfmt, tested with vitest.

Installation

# bun
bun add agentcomposerui

# npm
npm install agentcomposerui

# pnpm
pnpm add agentcomposerui

Peer Dependencies

Ensure you have react (>=18), react-dom (>=18), and tailwindcss (>=3) installed in your project.


Quick Setup

1. Import Base Styles

In your root layout or entry file (e.g. app/layout.tsx or src/index.tsx):

import "agentcomposerui/styles.css";

2. Configure Tailwind CSS

If you are using Tailwind v3, add agentcomposerui to your tailwind.config.js content list:

module.exports = {
  content: ["./src/**/*.{js,ts,jsx,tsx}", "./node_modules/agentcomposerui/**/*.{js,cjs}"],
};

If using Tailwind v4 in CSS:

@import "tailwindcss";
@source "../node_modules/agentcomposerui";

LLM & Server Integration

Next.js & Server Environments: Always import schemas and types from "agentcomposerui/schemas" in server environments (API routes, Server Actions, edge functions) to avoid bundling React client components. Import UI components from "agentcomposerui" inside client components ("use client").

Vercel AI SDK Tool

import { tool } from "ai";
import { linkedInPostSchema, type LinkedInPostData } from "agentcomposerui/schemas";

export const linkedInTool = tool({
  description: "Draft an engaging LinkedIn post with hook, body, CTA, and hashtags.",
  parameters: linkedInPostSchema,
  execute: async (postData: LinkedInPostData) => {
    return { success: true, draft: postData };
  },
});

OpenAI Function Calling

import { linkedInPostJsonSchema } from "agentcomposerui/schemas";

export const postComposerTool = {
  type: "function",
  function: {
    name: "compose_linkedin_post",
    description: "Draft an engaging LinkedIn post with hook, body, CTA, and hashtags.",
    parameters: linkedInPostJsonSchema,
  },
};

Anthropic Claude Tool Definition

import { linkedInPostJsonSchema } from "agentcomposerui/schemas";

export const postComposerTool = {
  name: "compose_linkedin_post",
  description: "Draft an engaging LinkedIn post with hook, body, CTA, and hashtags.",
  input_schema: linkedInPostJsonSchema,
};

React Usage

Option A: Ready-to-Use Drop-in Component

"use client";

import { useState } from "react";
import { LinkedInComposer, type LinkedInPostData, type ComposerStatus } from "agentcomposerui";

export function AgentPostReview({ initialPost }: { initialPost: LinkedInPostData }) {
  const [post, setPost] = useState<LinkedInPostData>(initialPost);
  const [status, setStatus] = useState<ComposerStatus>("reviewing");

  const handleApprove = async (finalData: LinkedInPostData) => {
    // Send approved post to your publishing API or queue
    await fetch("/api/publish", {
      method: "POST",
      body: JSON.stringify(finalData),
    });
    setStatus("approved");
  };

  const handleReject = async (feedback: string) => {
    // Send feedback back to your agent for revision
    await fetch("/api/agent/revise", {
      method: "POST",
      body: JSON.stringify({ feedback, currentDraft: post }),
    });
    setStatus("streaming");
  };

  return (
    <LinkedInComposer
      data={post}
      status={status}
      onChange={setPost}
      onApprove={handleApprove}
      onReject={handleReject}
      author={{
        name: "Jane Doe",
        title: "Founder & CEO",
      }}
    />
  );
}

Option B: Compound Components (Total Layout Flexibility)

Need a custom layout or want to swap out pieces? Use the compound components:

import { LinkedInComposer } from "agentcomposerui";

export function CustomPostComposer({ post, status, onApprove, onReject }) {
  return (
    <LinkedInComposer.Root data={post} status={status} onApprove={onApprove} onReject={onReject}>
      <LinkedInComposer.Header>
        <LinkedInComposer.Author name="Jane Doe" title="Tech Lead" />
        <LinkedInComposer.StageIndicator />
      </LinkedInComposer.Header>

      <LinkedInComposer.Editor placeholder="Edit post draft..." />
      <LinkedInComposer.HashtagBar />
      <LinkedInComposer.MediaDropzone />
      <LinkedInComposer.Preview />

      <LinkedInComposer.Actions>
        <LinkedInComposer.CharacterCount limit={3000} />
        <div className="flex items-center gap-2">
          <LinkedInComposer.RejectButton label="Request Changes" />
          <LinkedInComposer.ApproveButton label="Schedule & Publish" />
        </div>
      </LinkedInComposer.Actions>
    </LinkedInComposer.Root>
  );
}

HITL State Machine (useComposerState)

For custom agent coordination or managing state outside of the component:

import { useComposerState } from "agentcomposerui";

const { data, status, isLoading, setStatus, updateData, approve, reject } = useComposerState({
  initialData: postDraft,
  initialStatus: "reviewing",
  onApprove: async (data) => {
    /* publish */
  },
  onReject: async (feedback) => {
    /* send feedback to LLM */
  },
});

Theming & Design Tokens

AgentComposerUI styles are powered by CSS custom properties. You can easily customize any token in your CSS:

:root {
  --acu-primary: 240 5.9% 10%; /* Brand action (pure black in light mode) */
  --acu-radius: 0.75rem; /* Corner radius */
  --acu-background: 0 0% 100%; /* Surface background */
  --acu-foreground: 240 10% 3.9%; /* Main text */
  --acu-border: 240 5.9% 90%; /* Borders */
}

.dark {
  --acu-background: 240 10% 3.9%;
  --acu-foreground: 0 0% 98%;
  --acu-primary: 0 0% 98%; /* Pure crisp white in dark mode */
  --acu-border: 240 3.7% 15.9%;
}

Development & Testing

This project uses modern tooling for maximum speed:

# Typecheck
bun run typecheck

# Lint (oxlint)
bun run lint
bun run lint:fix

# Format (oxfmt)
bun run format
bun run format:check

# Run Vitest test suite
bun run test

# Build package bundle
bun run build

License

MIT © theajmalrazaq