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

@manet/agent-ui-builder

v0.0.4

Published

Agent UI builder for generating replay HTML files

Downloads

12

Readme

@manet/agent-ui-builder

Simple and clean agent UI builder for generating replay HTML files from agent session data.

Features

  • Simple API: Just two methods - dump() and upload()
  • Type Safety: Strict TypeScript interfaces
  • Built-in Static Files: Includes pre-built agent UI static files
  • Smart Path Resolution: Automatic static path detection with fallbacks
  • Share Provider Support: Built-in upload functionality for sharing
  • Isomorphic Design: Prepared for Python SDK compatibility

Installation

pnpm add @manet/agent-ui-builder

Usage

Basic Usage

import { AgentUIBuilder } from '@manet/agent-ui-builder';

const builder = new AgentUIBuilder({
  events: sessionEvents,
  sessionInfo: sessionMetadata,
  // staticPath is optional - will use built-in static files if not provided
  serverInfo: versionInfo,
  uiConfig: uiConfig,
});

// Generate HTML in memory
const html = await builder.dump();
console.log('Generated HTML:', html);

Save to File

import { AgentUIBuilder } from '@manet/agent-ui-builder';

const builder = new AgentUIBuilder({
  events: sessionEvents,
  sessionInfo: sessionMetadata,
});

// Generate HTML and save to file
const html = await builder.dump('/path/to/output/replay.html');
console.log('HTML saved to file and returned:', html);

Upload to Share Provider

import { AgentUIBuilder } from '@manet/agent-ui-builder';

const builder = new AgentUIBuilder({
  events: sessionEvents,
  sessionInfo: sessionMetadata,
});

// Generate HTML
const html = await builder.dump();

// Upload to share provider
const shareUrl = await builder.upload(
  html,
  'https://share-provider.example.com/upload',
  {
    slug: 'my-session',
    query: 'original user query',
  },
);

console.log('Share URL:', shareUrl);

Combined Workflow

import { AgentUIBuilder } from '@manet/agent-ui-builder';

const builder = new AgentUIBuilder({
  events: sessionEvents,
  sessionInfo: sessionMetadata,
});

// Generate and save HTML
const html = await builder.dump('/local/backup/replay.html');

// Upload the same HTML for sharing
const shareUrl = await builder.upload(html, shareProviderUrl, {
  slug: 'user-session-backup',
  query: 'How to build a web app?',
});

console.log('Local file saved and share URL:', shareUrl);

API Reference

AgentUIBuilder

Constructor

new AgentUIBuilder(input: AgentUIBuilderInputOptions)

Parameters:

  • input.events: Array of agent events
  • input.sessionInfo: Session metadata
  • input.staticPath?: Optional path to static web UI files
  • input.serverInfo?: Optional server version info
  • input.uiConfig?: Optional Agent UI Configuration

Methods

dump(filePath?: string): string

Generates HTML from session data and optionally saves to file.

Parameters:

  • filePath?: Optional file path to save HTML

Returns: Generated HTML string

Example:

// Generate HTML only
const html = await builder.dump();

// Generate HTML and save to file
const html = await builder.dump('/path/to/file.html');
upload(html: string, shareProviderUrl: string, options?: UploadOptions): Promise<string>

Uploads HTML to a share provider and returns the share URL.

Parameters:

  • html: HTML content to upload
  • shareProviderUrl: URL of the share provider endpoint
  • options?: Upload options
    • slug?: Custom slug for the share URL
    • query?: Original user query for metadata

Returns: Promise resolving to share URL with replay parameter

Example:

const shareUrl = await builder.upload(html, 'https://api.example.com/share', {
  slug: 'my-session',
  query: 'How to use the API?',
});

Types

AgentUIBuilderInputOptions

interface AgentUIBuilderInputOptions {
  events: AgentEventStream.Event[];
  sessionInfo: SessionInfo;
  serverInfo?: AgentServerVersionInfo;
  uiConfig?: AgentWebUIImplementation;
}

UploadOptions

interface UploadOptions {
  slug?: string; // Custom slug for the share URL
  query?: string; // Original user query for metadata
}

Design Philosophy

This package follows a simple and clean design:

  1. Two Core Methods:

    • dump() for generating (and optionally saving) HTML
    • upload() for sharing HTML content
  2. No Complex Configurations: Simple parameters, clear responsibilities

  3. Flexible Workflow: Generate once, use multiple times (save locally + upload for sharing)

  4. Type Safety: Full TypeScript support with clear interfaces

Python SDK Compatibility

This package is designed with isomorphic principles to enable a Python SDK with identical interfaces:

# Future Python SDK (same API design)
from manet_agent_ui_builder import AgentUIBuilder

builder = AgentUIBuilder({
    'events': session_events,
    'session_info': session_metadata,
    'static_path': '/path/to/web-ui/static',
})

# Generate HTML
html = builder.dump()

# Save to file
html = builder.dump('/path/to/file.html')

# Upload for sharing
share_url = builder.upload(html, provider_url, {
    'slug': 'my-session',
    'query': 'user query'
})

License

Apache-2.0