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

@one-agent/html

v0.0.3

Published

Streaming HTML → ANSI terminal renderer for ONE agent output.

Downloads

96

Readme

@one-agent/html

Streaming HTML → ANSI terminal renderer for ONE agent output.

Parses an HTML stream chunk-by-chunk and emits styled, word-wrapped ANSI text suitable for direct terminal output. Used internally by the one repl HTML REPL and available as a standalone library.

Install

npm install @one-agent/html
# or
pnpm add @one-agent/html

Quick start

import { StreamingHtmlRenderer, initSyntaxHighlighting } from "@one-agent/html";

// Optional: pre-warm the syntax highlighter (avoids first-call latency)
await initSyntaxHighlighting();

const renderer = new StreamingHtmlRenderer({
  columns: process.stdout.columns ?? 80,
  onFlush: (text) => {
    process.stdout.write(text + "\n");
  },
});

// Feed chunks as they arrive from the LLM stream
for await (const chunk of htmlStream) {
  renderer.write(chunk);
}
renderer.end();

API

new StreamingHtmlRenderer(options)

Creates a new renderer instance.

interface HtmlRendererOptions {
  /** Terminal column width for word-wrapping. Default: 80. */
  columns?: number;

  /**
   * Called when a complete block (paragraph, heading, code block, …) is ready.
   * If omitted, collect output with flush() instead.
   */
  onFlush?: (text: string) => void;

  /**
   * Called after each chunk with the current in-progress partial line.
   * Use to rewrite the last line: process.stdout.write('\r\x1b[K' + partial)
   */
  onPartial?: (partial: string) => void;
}

renderer.write(chunk: string)

Feed a new chunk of HTML. Safe to call with partial tags across chunk boundaries.

renderer.end()

Signal end-of-stream. Flushes any buffered content.

renderer.flush(): string

Returns all buffered output as a single string (when no onFlush callback is set).

initSyntaxHighlighting(): Promise<void>

Pre-warms the Shiki syntax highlighter. Call once at startup to avoid latency on the first code block. Safe to call multiple times (no-op after first load).

highlightCode(code: string, lang: string): string

Highlight a code string synchronously and return ANSI-colored text. Returns the original string if the highlighter is not yet initialised or the language is unsupported.

Supported HTML elements

| Element | Rendering | |---------|-----------| | <p> | Word-wrapped paragraph | | <h1><h6> | Bold + colored headings with # prefix | | <pre><code> | Syntax-highlighted code block with line numbers | | <code> (inline) | Dimmed monospace | | <strong>, <b> | Bold | | <em>, <i> | Italic | | <s>, <del> | Strikethrough | | <blockquote> | Indented with gutter | | <ul>, <ol> | Nested lists with / numbered bullets | | <li> | List item | | <hr> | Horizontal rule | | <br> | Line break | | <a> | Underlined text (href shown if different from text) |

License

Apache-2.0 — see LICENSE and NOTICE at the repository root.