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

@fleetx_io/ai-ui-dsl

v1.0.3

Published

A Domain Specific Language for describing rich, streaming AI chat interfaces via composable Blocks.

Readme

@fleetx_io/ai-ui-dsl

FleetX AI UI DSL — a domain-specific language for block-based, streaming AI chat UIs. Assistant replies are a Message made of an ordered list of Blocks (text, charts, tables, maps, forms, actions, tools, etc.), updated through a small streaming protocol.

This npm package ships TypeScript types and pure reducers (messageReducer, applyDelta, …). It is framework-agnostic (no React/Vue).

Install

npm install @fleetx_io/ai-ui-dsl

Core ideas

  1. Block composition — One message = a flat list of blocks; blocks are not nested.
  2. Incremental streaming — Each block follows block_start → block_delta (0..N) → block_end (or block_error).
  3. Immutable reducers — Feed StreamEvents into messageReducer; render the resulting Message.
  4. IDs and logical streamsid is assigned by the streaming engine for each block (and used in deltas / end / error events). Optional streamKey is set by the UI Composer Agent so the engine can treat a later block_start with the same key as continuing one logical stream instead of a new list entry. The bundled messageReducer ignores streamKey and always appends on block_start.

Server → client flow

message_start  →  create / bind Message
block_start    →  append Block (status streaming); or engine coalesces by streamKey
block_delta    →  applyDelta → re-render
block_end      →  mark Block completed
…
message_end    →  mark Message completed

Block types (summary)

| Block | type | Typical streaming | | --------------- | ------------- | ------------------------------------------ | | Text | text | text_delta (append to content) | | Chart | chart | json_patch on Highcharts config | | Table | table | json_patch (e.g. rows) | | Form | form | Often static at start; optional json_patch | | Action | action | Static | | Widget | widget | html_delta (sandboxed HTML) | | Tool use/result | tool_use / tool_result | input_json_delta / json_patch | | Step | step | json_patch on steps | | Loading | loading | loading_message | | Error | error | Static | | Map | map | json_patch markers, polylines, polygons | | Download file | download_file | Static |

Streaming protocol (summary)

Events: message_start, block_start, block_delta, block_end, block_error, message_end (includes messageId).

Deltas: text_delta, input_json_delta, json_patch, html_delta, status_delta, loading_message. Which block uses which delta is summarized in the table above.

Usage

import {
    createEmptyMessage,
    messageReducer,
    type StreamEvent,
} from '@fleetx_io/ai-ui-dsl';

let message = createEmptyMessage();

for await (const event of streamEvents) {
    message = messageReducer(message, event);
    // renderMessage(message);
}

Synchronous replay:

const events: StreamEvent[] = [
    { type: 'message_start', message: { id: 'm1', role: 'assistant' } },
    { type: 'block_start', block: { id: 'b1', type: 'text', content: '' } },
    { type: 'block_delta', blockId: 'b1', delta: { type: 'text_delta', text: 'Hi' } },
    { type: 'block_end', blockId: 'b1' },
    { type: 'message_end', messageId: 'm1' },
];

for (const event of events) {
    message = messageReducer(message, event);
}

Package exports

The package is ESM-only ("type": "module"): use import in Node 20+ or bundlers (e.g. Vite). Plain CommonJS require() is not supported.

Types: Block, block variants, Message, Conversation, Delta, StreamEvent, streaming callbacks, etc.

Functions: messageReducer, applyDelta, createEmptyMessage, setByPath, and isBlockType.

UI Composer Agent (concept)

A UI Composer Agent is an LLM layer that does not call tools: it takes tool results plus context and returns { blocks: Block[] } in this DSL. An orchestrator then turns those blocks into an SSE stream (block_start, deltas, block_end) for the client. Composition heuristics (e.g. open with a short text block, use charts or maps instead of raw JSON in prose, end with suggested actions) are up to your server-side prompt and validation schema.

License

ISC.