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

@agent-provider/ai-sdk

v0.1.5

Published

AI SDK LanguageModel fulfilled through the Agent Provider extension.

Readme

@agent-provider/ai-sdk

An AI SDK LanguageModel provider backed by the user-controlled Agent Provider browser extension.

npm install @agent-provider/ai-sdk ai

Provider credentials remain in the extension. The page selects a configured model alias and receives structured bridge failures when permission or policy requirements are not met.

What it does

This package implements the AI SDK LanguageModelV4 interface (@ai-sdk/provider) on top of the Agent Provider extension bridge. Instead of calling a model API directly, the page sends sanitized requests to the extension over a scoped postMessage protocol; the extension applies the user's origin grants, quotas, and policy, then brokers the call to a user-configured provider using credentials the page never sees.

Page code passes only allowlisted call options across the boundary: headers and provider-controlled URLs are stripped, non-function tools are dropped, and raw chunk inclusion is disabled. The extension re-checks all of this. Failures (permission denied, quota exhausted, bridge unavailable, timeouts) surface as typed AgentProviderBridgeError instances with code, retryable, and details fields, or as AbortError DOMExceptions on cancellation.

Requirements

  • A browser with the Agent Provider extension installed, and an exact-origin grant for the calling page. Without the bridge, connect() fails with a BRIDGE_UNAVAILABLE error.
  • A DOM environment: the default transport uses window.postMessage, ReadableStream, crypto.randomUUID, and DOMException. For non-window contexts, supply a custom AgentProviderBridgeTransport.
  • ai (AI SDK) version 7 or newer, >=7.0.34 <8.
  • ESM only; the package ships a single ESM entry point with TypeScript types.

Quick start

import { generateText } from "ai";
import { createAgentProviderProvider } from "@agent-provider/ai-sdk";

const agentProvider = createAgentProviderProvider({ appName: "My App" });

const { text } = await generateText({
  model: agentProvider("default"),
  prompt: "Summarize the current page selection.",
});

The argument to the provider is a model alias configured in the extension, not a provider model ID; it defaults to "default". Streaming works through the standard AI SDK APIs (streamText and friends) with no extra configuration.

API

  • createAgentProviderProvider(options?) — returns a provider callable: provider(alias?) or provider.languageModel(alias?) produces an AI SDK LanguageModelV4; provider.bridge exposes the underlying AgentProviderBridge. Options: defaultAlias, appName, clientId, connectTimeoutMs (default 3000), requestTimeoutMs (default 90000), a pre-built bridge, or a custom transport.
  • createAgentProviderModel(options?) — convenience escape hatch returning a LanguageModel directly; accepts alias plus the bridge options above.
  • AgentProviderBridge — lower-level session object. connect() opens the session and resolves the extension-reported BridgeCapabilities; requestPermission() and refreshPermission() drive the consent flow; requestToolApproval() and reportToolExecution() support the tool-use contract; snapshot holds the latest capabilities; dispose() tears down all pending work.
  • AgentProviderBridgeError — structured failure with code, retryable, and details.
  • AgentProviderBridgeTransport / WindowAgentProviderTransport — transport interface and the default window-based implementation.
  • Re-exported protocol types: BridgeCapabilities, BridgeLimits, PermissionState.

Links

License

CC0-1.0 OR Unlicense.