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

@lenso/bun-plugin

v0.4.1

Published

Bun Plugin runtime for Lenso vNext generated Capability providers.

Readme

@lenso/bun-plugin

definePlugin(...) describes one Plugin. Generated Capability values keep the author API typed while the SDK owns process startup, construction, dependency injection, cancellation, shutdown, limits, and Runtime Failure mapping.

import { definePlugin } from "@lenso/bun-plugin";
import { Conversation } from "./generated/conversation.ts";
import { Store } from "./generated/store.ts";

export default definePlugin({
  provides: [Conversation],
  dependencies: { store: Store.required() },

  async create({ dependencies }) {
    return {
      async *chat(_context, request) {
        const greeting = await dependencies.store.get(request.room);
        yield { text: greeting ?? "Hello" };
      },
    };
  },
});

provides accepts generated Capability values. TypeScript checks that the object returned by create implements every generated Provider interface in that list. The runtime binds those methods to the admitted endpoints; authors do not implement CapabilityProviderBinding, openStream, publishEvent, the process handshake, or the transport.

A Request-only generated Contract also supplies required(), optional(), and many(). The dependency table key is the default stable requirement id, so store: Store.required() needs no repeated string. Pass an explicit id only when it must differ from the local name. The Host injects only the exact provider routes selected by the immutable Plan.

create runs once for each admitted Plugin instance and receives decoded configuration plus generated dependency clients. It returns the instance whose methods provide behavior. stop runs at most once during managed shutdown. A Plugin with no provided Capability is valid when it only consumes dependencies or owns lifecycle work.

For a server-output Stream, a Provider may return an AsyncIterable or async generator. The SDK preserves pull-based backpressure, maps consumer cancellation to iterator.return(), accepts the consumer half-close, and reports an unexpected inbound message as a protocol violation. A Provider that needs bidirectional messages, independent half-close, terminal domain errors, or custom cancellation returns the generated StreamSession interface instead.

Event handlers may return void or Promise<void>. Publication waits for completion; a rejected Promise becomes a Plugin Runtime Failure rather than an unhandled background rejection.

Operation names such as chat, notify, or get come only from the Capability Descriptor. They are examples, not Plugin hooks or reserved SDK methods. Products such as Agent may lower their own tools syntax into an ordinary Capability, while the generic Plugin API remains product-neutral.

This release supports Request, Stream, and Event providers and generated outbound dependency clients over the Bun Authoring V2 process runtime. The same required(), optional(), and many() declarations work for every interaction kind. Stream clients preserve ordered messages, half-close, terminal domain outcomes, and cancellation. Event clients report the bounded admission result for every exact Plan-selected subscriber.

Rust Process and Rust Wasm guests expose the same three Capability interaction kinds through their generated clients. Execution mechanics still differ by Adapter; the portable contract, requirement identity, and Host-selected routes do not.

Generated entrypoints call the low-level Bun serving functions. Authors export the definition and do not call serve themselves. The older providers, provider(...), bind*Provider(...), and raw binding types remain as a compatibility and Adapter-lowering seam, but ordinary authoring should use generated Capability values through provides.