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

@openmic/openmic-chat-widget

v0.3.1

Published

Embeddable chat widget for OpenMic AI assistants

Readme

OpenMic Chat Widget

Embeddable chat widget for OpenMic AI assistants. Drop one <script> tag into any website to add a floating chat button that connects to your OpenMic chat agent.

Quick start

<openmic-chat-widget
    bot-uid="your-bot-uid"
    public-api-key="omic_pub_xxx">
</openmic-chat-widget>

<script src="https://unpkg.com/openmic-chat-widget@latest/widget/widget-standalone.js"></script>

That's it. A floating chat button will appear in the bottom-right corner of the page.

Attributes

| Attribute | Required | Default | Description | |-----------|----------|---------|-------------| | bot-uid | Yes (or bot-id) | — | The OpenMic bot UID to chat with | | bot-id | Yes (or bot-uid) | — | Numeric bot ID (alternative to bot-uid) | | public-api-key | Yes | — | Your OpenMic public API key (omic_pub_...) | | api-base | No | https://api.openmic.ai/v1 | API base URL (override for self-hosted or local dev) | | title | No | Chat with us | Header title shown in the chat panel | | subtitle | No | We typically reply within minutes | Header subtitle | | primary-color | No | #4f46e5 | Primary brand color (CSS color value) |

Local development

To test the widget against a local backend:

<openmic-chat-widget
    bot-uid="your-bot-uid"
    public-api-key="omic_pub_xxx"
    api-base="http://localhost:3005/v1">
</openmic-chat-widget>
<script src="./widget/widget-standalone.js"></script>

See examples/test.html for a complete working example.

How it works

The widget calls these endpoints on your OpenMic backend:

  • POST /v1/create-chat — creates a new chat session for the configured bot
  • POST /v1/create-chat-completion — sends a user message and streams the AI response
  • POST /v1/end-chat/:sessionId — ends the chat session

Authentication uses your public API key in the Authorization: Bearer ... header.

Production features

This widget is built for real-world deployment on customer websites:

  • Shadow DOM isolation — host site CSS cannot break the widget; widget styles cannot leak into the host page. Works on sites with strict CSS resets, Tailwind, Bootstrap, etc.
  • CSP-friendly — all styles are scoped inside the shadow root, no inline <style> in the document head, compatible with strict Content Security Policies
  • AbortController-based fetch cancellation — closing the chat panel aborts in-flight requests immediately. No ghost billing for messages the user never sees.
  • Exponential backoff retry — transient network errors and 5xx responses are retried up to 3 times (250ms, 500ms, 1000ms). 4xx errors fail fast (no retry on auth/config errors).
  • Session persistence — chat sessions survive page reloads via localStorage. Stale sessions auto-recover with a clear "session expired" message.
  • Lazy panel rendering — the chat panel DOM is only built when the user clicks the launcher. Saves DOM nodes for users who never open chat.
  • Memory cleanupMutationObserver watches for <openmic-chat-widget> element removal and tears down listeners + aborts fetches when the widget is removed from DOM.
  • Browser compatibility check — runtime check on load. If the browser is missing required features (fetch, ReadableStream, MutationObserver, AbortController, Shadow DOM), logs a clear error and disables the widget instead of silently failing.
  • Multi-instance safe — multiple widgets on the same page work independently. Re-loading the script is a no-op.

Browser support

Modern evergreen browsers — Chrome 89+, Firefox 85+, Safari 14+, Edge 89+.

Requires fetch, ReadableStream, MutationObserver, AbortController, and Shadow DOM v1.

License

MIT