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

naively

v0.2.0

Published

A minimal TypeScript wrapper around [Chrome Built-in AI APIs](https://developer.chrome.com/docs/ai/built-in-apis).

Readme

naively

A minimal TypeScript wrapper around Chrome Built-in AI APIs.

Status

Chrome Built-in AI APIs are actively shipping. As of Chrome 138 (stable):

| API | Status | Supported | |-----|--------|-----------| | Summarizer | ✅ Stable | ✅ | | Translator | ✅ Stable | ✅ | | Language Detector | ✅ Stable | ✅ | | Writer / Rewriter | 🧪 Developer Trial | Soon | | Prompt API (web) | 🔬 Origin Trial | Soon |

These APIs run a local Gemini Nano model on the user's device — no API key or network request required after the initial model download.

Requirements

  • Browser: Chrome 138+ (desktop only — not supported on Android or iOS)
  • OS: Windows 10+, macOS 13+, Linux, or ChromeOS (Chromebook Plus)
  • Storage: ~22 GB free disk space (for the model)
  • Hardware: GPU with 4 GB+ VRAM, or CPU with 16 GB RAM and 4+ cores

Installation

pnpm add naively
# or
npm install naively

Usage

Check support

import { getAiSupport, isSummarizerSupported, isTranslatorSupported, isLanguageDetectorSupported } from 'naively'

// Quick boolean checks
isSummarizerSupported()       // true | false
isTranslatorSupported()       // true | false
isLanguageDetectorSupported() // true | false

// Full support details
const support = await getAiSupport()
// {
//   summarizer:       { supported: true, availability: 'readily' | 'downloadable' | 'unavailable' | 'unsupported' }
//   translator:       { supported: true }
//   languageDetector: { supported: true, availability: 'readily' | 'downloadable' | 'unavailable' | 'unsupported' }
// }

Translator availability is language-pair specific — naively checks it internally when you call translate().

Summarizer availability values:

| Value | Meaning | |-------|---------| | readily | Model is downloaded and ready | | downloadable | Supported, but model needs to download first | | unavailable | Hardware/OS doesn't meet requirements | | unsupported | API not present in this browser |

Summarize text

import { summarize } from 'naively'

const result = await summarize(articleText)

if (result.ok) {
  console.log(result.data)
} else {
  console.error(result.error?.message)
}

With options:

const result = await summarize(articleText, {
  type: 'key-points',   // 'tl;dr' | 'key-points' | 'teaser' | 'headline'
  length: 'medium',     // 'short' | 'medium' | 'long'
  format: 'plain-text', // 'plain-text' | 'markdown'
})

Translate text

Language codes follow the BCP 47 format (e.g. 'en', 'fr', 'es', 'ja').

import { translate } from 'naively'

const result = await translate('Hello, world!', {
  sourceLanguage: 'en',
  targetLanguage: 'fr',
})

if (result.ok) {
  console.log(result.data) // 'Bonjour, le monde !'
} else {
  console.error(result.error?.message)
}

API Reference

summarize(text, options?): Promise<SummarizeResult>

| Option | Type | Default | |--------|------|---------| | type | 'tl;dr' \| 'key-points' \| 'teaser' \| 'headline' | 'key-points' | | length | 'short' \| 'medium' \| 'long' | 'medium' | | format | 'plain-text' \| 'markdown' | 'plain-text' |

detectLanguage(text): Promise<DetectLanguageResult>

Returns a ranked list of language candidates with confidence scores (0.0–1.0):

const result = await detectLanguage('Bonjour le monde')

if (result.ok) {
  console.log(result.data)
  // [
  //   { detectedLanguage: 'fr', confidence: 0.998 },
  //   { detectedLanguage: 'en', confidence: 0.001 },
  // ]
}

Accuracy is low for very short text or single words.

translate(text, options): Promise<TranslateResult>

| Option | Type | Required | |--------|------|----------| | sourceLanguage | string (BCP 47) | ✅ | | targetLanguage | string (BCP 47) | ✅ |

getAiSupport()

Returns support and availability details for all built-in AI APIs.

isSummarizerSupported() / isTranslatorSupported(): boolean

Synchronous presence checks.


Both summarize() and translate() always return a result without throwing:

interface SummarizeResult {
  ok: boolean
  data?: string
  error?: { code: string; message: string }
}

interface TranslateResult {
  ok: boolean
  data?: string
  error?: { code: string; message: string }
}

Edge cases handled internally: empty text, API not present, model unavailable, creation/runtime errors, and model cleanup (destroy()).

Development

pnpm install
pnpm build      # outputs to dist/
pnpm typecheck  # tsc --noEmit

Further Reading