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

@zllling/pageway-agent

v0.3.0

Published

Fetch-native AG-UI agent handler for OpenAI-compatible APIs

Readme

@zllling/pageway-agent

OpenAI-compatible credential proxy, streaming model adapter, and optional AG-UI HTTP handler for Pageway.

pnpm add @zllling/pageway-agent

Standard model proxy

The React SDK runs the agent loop in the browser. If you already have an OpenAI-compatible gateway, point PagewayProvider's apiOrigin at it; installing this server package is optional. To keep a provider credential server-side:

import { createOpenAIProxyHandler } from '@zllling/pageway-agent';

// Mount at POST /api/openai/chat/completions after application authentication.
export const POST = createOpenAIProxyHandler({
  baseURL: process.env.MODEL_BASE_URL!,
  apiKey: process.env.MODEL_API_KEY,
  allowedModels: [process.env.MODEL_NAME!],
  timeoutMs: 180_000,
});

The corresponding frontend uses <PagewayProvider apiOrigin="/api/openai" model="your-model">. Both HTTP sides speak ordinary Chat Completions, including messages, tools, stream, and tool results. The proxy does not execute tools or keep conversation state.

The upstream URL is fixed by server configuration. apiPath defaults to chat/completions; apiKey is optional for anonymous/local providers. allowedModels restricts client-selected model IDs. The handler never forwards the client's Authorization header upstream; it uses its configured credential. It enforces a 1 MiB body limit by default (maxBodyBytes), supports timeout and cancellation, streams successful responses, and redacts upstream error bodies.

The handler accepts a standard Fetch Request and returns a Response, so it can run in frameworks supporting that interface. Add application authentication, quota controls, and any CORS policy around the handler. Model providers must support streaming Chat Completions, function calls, and tool-result continuation.

Existing AG-UI endpoint

Applications using endpoint="/api/agent" can continue using the original API:

import { createAgentHandler } from '@zllling/pageway-agent';

export const POST = createAgentHandler({
  mode: 'openai',
  baseURL: process.env.MODEL_BASE_URL,
  model: process.env.MODEL_NAME,
  apiKey: process.env.MODEL_API_KEY,
  timeoutMs: 180_000,
});

This handler accepts AG-UI RunAgentInput and returns AG-UI SSE. Browser tools still execute on the frontend, with their results supplied in the next request. createAgentHandler() without configuration uses a deterministic playground demo, not an LLM. The HTTP proxy and AG-UI handler are alternatives; do not route an apiOrigin frontend to an AG-UI endpoint.

WebMCP-only pages do not need either handler: external browser agents call the registered frontend tools through the browser API.

See integration, protocol, and provider setup. MIT licensed.