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

@netwatchai/chat

v0.6.0

Published

Embeddable AI chat widget for Netwatch monitoring

Downloads

1,011

Readme

Netwatch Widget

An AI-powered monitoring assistant shipped as a self-contained Web Component (Shadow DOM — styles are fully isolated from the host page). Drop in one script tag to add a chat bubble to any page.

Published to npm as @netwatchai/chat and served over jsDelivr:

https://cdn.jsdelivr.net/npm/@netwatchai/chat@latest/lib/web.min.js

(Pin a version with @0.1.0 instead of @latest for stability.)

Features

  • 💬 Real-time streaming chat interface
  • 📱 Fully responsive and embeddable
  • 🎨 Tailwind CSS styling with complete style isolation
  • 🔄 Web Component with Shadow DOM
  • ↔️ Resizable and expandable interface
  • 🌙 Dark mode support
  • 📦 Distributable via CDN

Embedding

Two equivalent ways — both load the single bundle from jsDelivr.

1. Declarative (custom element)

<script type="module"
  src="https://cdn.jsdelivr.net/npm/@netwatchai/chat@latest/lib/web.min.js"></script>

<netwatch-widget
  client-id="b48ea317-…"
  api-endpoint="http://your-api:8000">
</netwatch-widget>

2. Programmatic (one-liner — PHP / CMS friendly)

<script type="module">
  import NetwatchChat from "https://cdn.jsdelivr.net/npm/@netwatchai/chat@latest/lib/web.min.js";
  NetwatchChat.initBubble({
    clientId: "b48ea317-…",
    apiHost:  "http://your-api:8000",
  });
</script>

Options

| Attribute | initBubble key | Required | Notes | |----------------|-----------------------|----------|-------| | client-id | clientId | yes | Netwatch client UUID | | api-endpoint | apiHost / apiEndpoint | yes | API base URL (a trailing /api/chat is stripped automatically) | | username | username | no | Auto-resolved from the host page's localStorage when embedded in the Netwatch UI. Pass explicitly to override, or when embedding on other hosts. |

Embedding in the Netwatch monitoring UI

The widget auto-reads the logged-in user from the host page's localStorage, so it only needs its script injected on every (logged-in) page. The UI has no built-in custom-JS setting, so use one of:

Option A — reverse proxy injection (recommended, survives upgrades). With nginx in front of the frontend:

location / {
    proxy_pass http://frontend-upstream;
    proxy_set_header Accept-Encoding "";   # sub_filter needs uncompressed HTML
    sub_filter_once on;
    sub_filter_types text/html;
    sub_filter '</body>'
      '<script type="module">import N from "https://cdn.jsdelivr.net/npm/@netwatchai/chat@latest/lib/web.min.js";N.initBubble({clientId:"b48ea317-…",apiHost:"http://your-api:8000"});</script></body>';
}

Option B — edit the frontend's page layout template (ui/include/views/layout.htmlpage.php), just before the </body> output. ⚠️ This is overwritten on every upgrade, so reapply it after upgrading:

echo '<script type="module">import N from "https://cdn.jsdelivr.net/npm/@netwatchai/chat@latest/lib/web.min.js";N.initBubble({clientId:"b48ea317-…",apiHost:"http://your-api:8000"});</script>';

⚠️ Mixed content: if the UI is served over HTTPS but api-endpoint is http://…, browsers silently block the API calls. Serve the API over HTTPS too, or keep both on plain HTTP within a private network/tunnel.

Development

pnpm install

# Copy the env template and fill it in.
cp .env.example .env

Edit .env:

VITE_API_ENDPOINT=http://localhost:8000
VITE_DEV_CLIENT_ID=your-client-uuid
VITE_DEV_USERNAME=your-netwatch-username

Both .env and .env.local are gitignored; only .env.example is committed.

Start the dev server:

pnpm run dev

Visit http://localhost:5173 for the test page; it reads the env vars via src/config.js and mounts the widget automatically.

Build

pnpm run build

Outputs to lib/ (the @latest/lib/web.min.js jsDelivr path):

  • lib/web.min.js — ES module (modern <script type="module"> / npm import)
  • lib/web.umd.js — UMD build (legacy <script> tag → window.NetwatchChat)

Publishing

Published to npm as @netwatchai/chat by .github/workflows/widget-publish.yml (changesets-driven). Normal flow:

  1. Add a changeset describing your change:

    pnpm changeset      # pick the bump, write a summary

    The summary becomes the public CHANGELOG.md — keep it in Netwatch terms.

  2. Commit the .changeset/*.md and push to main.

Org caveat: this GitHub org currently disallows Actions creating pull requests, so the changesets bot can't open the "Version Packages" PR. Until that's enabled (or Trusted Publishing is set up), do the version bump locally instead of relying on the bot:

pnpm run version-packages   # bumps package.json + CHANGELOG, consumes changesets
git commit -am "widget: version" && git push origin main

With no changesets left, the workflow's publish step runs changeset publish.

Requires repo secret NPM_TOKEN — a granular npm token with "Bypass two-factor authentication (2FA)" checked and read/write on the @netwatchai scope (a token without the 2FA bypass fails publish with EOTP).

Architecture

  • Web Components — native browser API for encapsulation
  • Shadow DOM — complete style isolation from the parent page
  • React — internal rendering framework
  • Vercel AI SDK — streaming chat interface
  • Tailwind CSS — utility-first styling
  • Streamdown — markdown rendering

License

MIT