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

yggio-ai

v0.0.20

Published

The AI components - provider settings, model picker, chat, agent runs, the model store, usage - over one AiEngine port, its Node implementation over the yggio addon and its browser client over HTTP

Readme

yggio-ai

The AI components - provider settings, the model picker, chat, agent runs, the model store, usage - over one port, AiEngine, and the two sides that answer it: the engine over the yggio addon's async ai doors with the request listener serving it, and the browser client over that listener's routes. It is the npm view of the Rust crate yggio-ai: every shape the port carries is that crate's serde JSON, every refusal its text as it came. Nothing of it is market-specific; the components draw with the design system yggio-market owns, imported from yggio-market/react, never copied. The version is the version of the yggio package whose ai namespace it calls. Documentation: https://platob.github.io/yggio/ai/

Install

npm install yggio-ai yggio-market react react-dom   # the components and the browser client
npm install yggio-ai yggio                          # the Node side

The styles are yggio-market's brand tokens: import yggio-market/brand.css (Tailwind v4) or the yggio-market/tailwind-preset (v3), and let Tailwind scan node_modules/yggio-ai/dist beside yggio-market's.

Subpaths

| Import | Holds | Runs where | | --- | --- | --- | | yggio-ai | The port - AiEngine, AiSettings, AiServed, AiModel, AiReply, AiAgentEvent, AiStored, AiProgress, ... - AI_APIS, the presets (AI_PRESETS, HUGGINGFACE_BASE_URL, OLLAMA_BASE_URL, named after their Rust owners) and the pure helpers (replyText, agentSteps, priceText, progressFraction, isAbort, ...) | anywhere: no React, no addon | | yggio-ai/react | ProviderSettings, ModelPicker, ChatPanel, AgentRunView, ModelStoreBrowser, UsageMeter, useAi, useAiTask | the browser; props in, events out, no fetch | | yggio-ai/node | nodeAiEngine(yggio, options?), aiRequestHandler(engine, { prefix }) | Node, beside the addon the caller loaded | | yggio-ai/http | httpAiEngine(base = '', { prefix, fetch }) | the browser; the package's only fetch |

Use

The Node side, beside the application's own routes:

import { createServer } from 'node:http'
import * as yggio from 'yggio'
import { aiRequestHandler, nodeAiEngine } from 'yggio-ai/node'

const ai = aiRequestHandler(nodeAiEngine(yggio))
createServer((request, response) => {
  if (ai(request, response)) return
  // ... the application's own routes
}).listen(3000)

The page:

import { httpAiEngine } from 'yggio-ai/http'
import { ChatPanel, ProviderSettings } from 'yggio-ai/react'

const engine = httpAiEngine()

export function AiPage() {
  return (
    <>
      <ProviderSettings engine={engine} />
      <ChatPanel engine={engine} system="Answer in one paragraph." />
    </>
  )
}

nodeAiEngine takes the yggio module as its argument and never imports it; options.path names a settings file other than Settings.path(), and options.agent(llm, request) builds the agent runAgent runs (by default an Agent of the request's system prompt that offers no tool).

The port

AiEngine answers every method with a Promise: settings(), saveSettings(settings) (answers them as the core read them back), available() (what the build serves and the core's refusal of the rest), models(), chat(request, { onText, signal }), runAgent(request, { onEvent, signal }), store(), pull(model, { onProgress, signal }) and remove(model). A run rejects with an AbortError the moment its signal aborts; the Node engine also stops the addon's worker at its next piece, step or downloaded chunk. A component holds no credential: the settings name the variable a key is in, never the key.

The routes

aiRequestHandler(engine, { prefix = '/api/ai' }) is a Node (request, response) => boolean: true for a request under prefix, which it answers; false for anything else, which the application serves.

| Route | Body | Answer | | --- | --- | --- | | GET {prefix}/settings | | the settings JSON | | PUT {prefix}/settings | the settings JSON | the settings as the core read them back | | GET {prefix}/available | | { apis, refusals } | | GET {prefix}/models | | the catalog | | GET {prefix}/store | | the manifests the store keeps | | POST {prefix}/chat | an AiRequest | server-sent text events, then one reply or error | | POST {prefix}/agent | an AiRequest | event events, then one reply or error | | POST {prefix}/pull | { model } | progress events, then one done or error | | DELETE {prefix}/store/:model | | 204; the model URL-encoded |

Each event's data is one JSON line. A refusal of a JSON route is { error } with 422 (the engine's) or a 4xx (the request's: a body that is not JSON or not the route's shape, an unknown route, a method it does not serve); a stream's is its error event, { error }, carrying the core's text. A client that goes away aborts the run.

Local by default, and what the published build serves

Settings default to local and smollm2-135m: a model run on this machine. The published yggio packages are built without yggio-ai's local feature, so Settings.available() lists every API but local, and available() carries the core's refusal for it. ProviderSettings shows Local unavailable with that refusal, moves the draft to the first API the build serves and says so - "Showing Claude (Anthropic) instead; save to keep it" - never choosing silently; a pull in such a build rejects with the same refusal.

Design

The components spell the design contract yggio-market holds (node/market/tests/react/design.test.ts walks src/react here too): radius, shadow and motion on the brand scale only. Chat messages are rounded-brand-lg bubbles entering with animate-brand-in, the reply being written ends in a pulsing caret; the engine's health is a StatusDot (connecting while it reads, ready, fallback where the stored API is not served, unavailable on a refusal); the settings and the store load behind one visually hidden status line and, after 150 ms, skeletons echoing their shape; a pull's bar is a rounded-full track in the muted fill, the accent scaled to the fraction, an indeterminate sweep before the first file reports. Under reduced motion the loops hold still and the bar pulses.

Size budget

Measured by tests/bundle.test.ts (esbuild, minified, React, yggio and yggio-market external), which fails past the budget and asserts no entry inlines a peer; a KB is 1024 bytes:

| Bundle | Budget, gzipped | Measured | | --- | --- | --- | | yggio-ai | 1.9 KB | 1.5 KB | | yggio-ai/react | 9.5 KB | 7.7 KB | | yggio-ai/node | 4 KB | 3.2 KB | | yggio-ai/http | 1.25 KB | 1.0 KB |

Development

npm install                            # pinned development dependencies
npm test                               # vitest (jsdom for the components), then tsc --noEmit
npx vitest run tests/bundle.test.ts    # the size budget, its "bundle sizes" line
npm run build                          # tsup: dist/{index,react,node,http}.{js,cjs,d.ts}

yggio-market/react resolves to ../market/src/react and yggio to the addon's loader beside this package, so no test needs a build of either; the Node tests hand nodeAiEngine a module object of their own and never load the addon, and the handler and the browser client meet over node:http on an ephemeral port.