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

@react-ai-form/core

v0.2.6

Published

Core utilities for AI-powered React forms — schema extraction, privacy filtering, streaming, caching

Readme

@react-ai-form/core

Provider-agnostic, zero-React core for AI-powered forms. Pure TypeScript — schema introspection, streaming routers, privacy utilities, and an LRU cache. Runs anywhere JavaScript runs.

npm bundle size license

🧪 See it in action at https://react-ai-form.vercel.app (source).

When to use this package

Install @react-ai-form/core directly only if you need schema / privacy utilities in Node or a non-React environment (e.g., server-side PII redaction, schema-to-prompt generation in a background job). If you're building a React app, you almost certainly want @react-ai-form/react or @react-ai-form/react-hook-form — both re-export everything you need from here.

Install

pnpm add @react-ai-form/core zod ai

zod and ai are peer dependencies and must be installed separately.

API

Schema Utilities

extractFieldMeta(schema) -- Walk a Zod schema and extract metadata (name, path, type, description, constraints, enums) for each field.

schemaToSystemPrompt(schema, options?) -- Generate an LLM system prompt from a Zod schema that instructs the model to return valid JSON matching field names, types, and constraints.

filterSchemaByPrivacy(schema, config) -- Return a new Zod schema with high-sensitivity fields removed.

Streaming

createFieldRouter(schema) -- Create a stateful router that diffs streaming partial JSON objects and emits per-field update events.

  • .update(partialObject) -- Feed a new snapshot, get back changed fields
  • .subscribe(fieldPath, callback) -- Listen to a specific field
  • .subscribeAll(callback) -- Listen to all field changes
  • .getSnapshot() -- Current accumulated state
  • .complete() -- Mark all fields as done

diffPartialObjects(prev, next) -- Pure function to diff two partial objects and return field updates.

Privacy

redactPII(text) -- Detect and replace emails, phones, SSNs, credit cards, IPs with reversible placeholders.

rehydratePII(text, mapping) -- Restore original values from placeholders.

classifyFieldSensitivity(fieldMeta) -- Auto-detect sensitivity from field name/description (high/low/none).

sanitizeFormDataForAI(data, schema, config) -- Remove high-sensitivity fields, redact PII in low-sensitivity fields, pass through the rest.

getFieldPrivacyConfig(fieldPath, config) -- Get merged privacy config for a field.

isFieldAIEnabled(fieldPath, config) -- Quick check if AI can process a field.

Cache

createAICache(options?) -- LRU cache with TTL expiration for AI responses.

createCacheKey({ schema, context, fieldPath? }) -- Deterministic cache key from schema + context.

Types

AIFieldConfig, AIFormConfig, AIFieldMeta, AIFieldUpdate, AIFillResult, AIFieldError, AIFormError, AIProvider, DeepPartial, FieldRouter, AICache

License

MIT