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

@pi-outpost/embed

v0.23.1

Published

Mount pi-outpost as a Shadow-DOM-isolated widget inside another web app.

Readme

@pi-outpost/embed

Mount pi-outpost — a web chat UI for the pi coding agent — as a widget inside any web app.

The widget renders into a Shadow DOM, fully isolated from the host app's CSS in both directions: Tailwind's reset never touches the host page, and the host page's styles never bleed into the widget. React is a peer dependency (supplied by the host); everything else — Tailwind, markdown, mermaid, highlight.js, the wire protocol — is compiled into the package.

It talks to a pi-outpost server over WebSocket, so you need one running:

npx pi-outpost init   # writes a starter config
npx pi-outpost        # http://127.0.0.1:3141/

See the main README for configuring it.

Install

npm install @pi-outpost/embed

Requires react and react-dom ≥ 19 in the host app.

Usage

import { mount } from "@pi-outpost/embed";

const widget = mount(document.getElementById("assistant"), {
  serverUrl: "https://your-pi-outpost-server", // omit for same-origin
  theme: "dark", // optional; falls back to the server's branding.defaultTheme, then "system"
  token: "…", // only for servers with `server.token` set
  workspace: "/srv/projects/example", // optional resolved root of an already-open project
});

widget.setTheme("light"); // change the theme at runtime
widget.unmount(); // tear down the React tree

mount(container, options?) returns { unmount(), setTheme(theme) }. The container itself stays in the DOM after unmount(), with an empty shadow root.

When workspace is set, the host binds that widget to the named open project and the widget offers no project switcher. If the root is not open, the server falls back to its default project rather than leaving the widget disconnected.

Which theme wins

Strongest first:

  1. setTheme(), a { type: "pi-outpost:set-theme", theme } message, or the reader using the widget's own toggle — whatever was chosen while it was on screen;
  2. the theme you pass to mount(). Naming it means you get it: a reader who once used the toggle on this origin does not overrule the page that embeds the widget;
  3. a theme this browser remembered from an earlier visit;
  4. the server's branding.defaultTheme, itself falling back to "system".

So pass theme when your page has a look the widget has to match, and leave it out when the deployment's own branding.defaultTheme should decide.

Server-rendered apps

Importing the package is safe anywhere, but mount() needs a real DOM: it attaches a shadow root to the element you give it. In Next.js, Remix or Astro, call it from an effect (client-side only):

useEffect(() => {
  const widget = mount(ref.current);
  return () => widget.unmount();
}, []);

In Next.js, the component doing this must be a client component ("use client").

Server-side configuration

Configure this on the pi-outpost server, whatever the deployment topology:

  • server.allowedOrigins — the widget carries the host page's origin (e.g. https://your-app.example.com), not pi-outpost's own. Add it explicitly; even same-domain deployments need this (only localhost/127.0.0.1 are trusted automatically). Listing it is all a cross-origin mount needs: the server answers those origins with the CORS headers the browser requires on every HTTP route, and applies the same allowlist to the WebSocket handshake. It grants no authority of its own — a token-protected route still wants its token.
  • embed.workspaceControls — when the host does not pass workspace, choose what the widget exposes: "settings" (the one-project default), "root" (a compact root chooser) or "projects" (open/switch/close controls). workspaceLock still overrides this and pins the deployment to one project.

License

MIT