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 🙏

© 2025 – Pkg Stats / Ryan Hefner

surmiser

v0.1.0

Published

The autocomplete primitive for the web. Add Smart Compose style predictive text to any input in minutes.

Readme

surmiser

The autocomplete primitive for the web.

Add "Smart Compose" style predictive text to any input in minutes. Local-first, privacy-focused, and completely UI agnostic.

Surmiser Demo

Why Surmiser?

Surmiser is a minimal, composable building block that works with your existing stack.

Key Differentiators:

  • UI-Agnostic: Not tied to any framework or component library
  • Privacy-First by Design: Local-only predictions, no tracking or telemetry
  • Production-Ready: Comprehensive test suite
  • Developer-Friendly: TypeScript-first with full type safety
  • Lightweight

Features

  • Batteries Included: Comes with a default corpus of common phrases
  • Remote Providers: Built-in support for AI APIs (OpenAI, Anthropic, etc.) with automatic fallback
  • UI Agnostic: Works with raw HTML, React, Shadcn, MUI, or any framework
  • Privacy First: Local predictive engine by default - no data leaves the client
  • Mobile Ready: Swipe right to accept, optimized for touch
  • Keyboard Friendly: Tab or Arrow Right to accept
  • Accessible: WCAG 2.1 AA compliant with proper ARIA attributes
  • Cross-Browser: Tested on Chrome, Firefox, Safari, Edge, and mobile browsers
  • TypeScript: Full type definitions included

Installation

npm install surmiser

Quick Start

1. React

Surmiser provides a drop-in component and a hook for maximum flexibility. No provider required - works standalone out of the box.

The Easy Way (SurmiserInput)

import { SurmiserInput } from 'surmiser/react';

function App() {
  return <SurmiserInput placeholder="Type something..." />;
}

The Custom Way (useSurmiser)

Integrates with existing UI libraries like Shadcn, MUI, or Chakra.

import { useSurmiser } from 'surmiser/react';
import { Input } from '@/components/ui/input'; // Your custom component

function MyCustomInput() {
  // 1. Get the attachRef
  const { attachRef } = useSurmiser();

  // 2. Attach it to your input
  return <Input ref={attachRef} />;
}

Optional: Use Provider for Shared Configuration

Want to share settings across multiple inputs? Use the optional <SurmiserProvider>:

import { SurmiserProvider, SurmiserInput } from 'surmiser/react';

function App() {
  return (
    <SurmiserProvider corpus={['shared', 'phrases']}>
      <SurmiserInput placeholder="Input 1..." />
      <SurmiserInput placeholder="Input 2..." />
    </SurmiserProvider>
  );
}

2. Vanilla JS

Works with any standard HTML input element.

import { attachSurmiser } from 'surmiser';

const input = document.getElementById('my-input');
attachSurmiser(input);

3. Remote Provider (AI-Powered)

Built-in support for remote API providers - perfect for AI-powered suggestions!

import { SurmiserProvider } from 'surmiser/react';
import { localPredictive } from 'surmiser';

function App() {
  return (
    <SurmiserProvider
      providers={[
        // AI-first with high priority
        {
          id: 'openai',
          endpoint: '/api/suggest',
          priority: 100,
        },
      ]}
    >
      <SurmiserInput placeholder="AI-powered suggestions..." />
    </SurmiserProvider>
  );
}

Your API endpoint receives:

{
  "inputValue": "hello",
  "cursorPosition": 5,
  "meta": {},
  "prompt": "..."
}

And responds:

{
  "suggestion": " world",
  "confidence": 0.9
}

Mix and match local + remote providers with automatic fallback!