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

@subako-ai/react-hook-form

v0.1.2

Published

react-hook-form as a form tool for Subako sessions

Readme

@subako-ai/react-hook-form

react-hook-form as a formTool spec for @subako-ai/tools: the registered names describe the form, setValue is the write, and getValues with formState.errors is the read back.

Requires react-hook-form 7.50 or newer and Node 22 or newer for the build. The package is ESM only.

pnpm add @subako-ai/react-hook-form @subako-ai/tools

fromReactHookForm

import { useTool } from "@subako-ai/react";
import { fromReactHookForm } from "@subako-ai/react-hook-form";
import { formTool } from "@subako-ai/tools";

const form = useForm({ defaultValues: { email: "", message: "" } });
useTool(client, "fill_contact_form", formTool({ ...fromReactHookForm(form), description: "The contact form." }));

fromReactHookForm(form, { schema? }) answers with fields or schema, apply and read, which is everything formTool takes.

It writes with setValue(name, value, { shouldValidate: true, shouldDirty: true }) and reads with getValues() and formState.errors, so the model sees what the form's own validation made of the fill.

Nested and array errors use dotted paths, such as meta.subject and signers.0.email. Root errors are included too, for example root.server.

apply waits for the form to catch up. formTool reads the form back as soon as apply resolves, and setValue returns before two things have happened: the validation it asked for, and the update that publishes the result to formState. So apply awaits trigger() and then a turn of the task queue — waiting for only the first is enough when a fill clears an error and not when it raises one. Without both, a fill is read back with the errors of the fill before it, and a model reading that sees a field it has just corrected still reported as wrong. trigger() validates the whole form, so read reports the form as it now stands rather than only the fields that call happened to write. Without a schema the fields are the registered names, every one of them a string, so a form of numbers or checkboxes wants a schema: any Standard Schema value — zod, valibot, arktype — and, when the library cannot describe itself as JSON Schema, a parameters next to it in the formTool call.

Nested values are written by path. setValue takes a dotted path, so a call of { meta: { subject: "…" } } writes meta.subject rather than meta, and the siblings under meta survive. An array is a leaf: it is what useFieldArray holds, and writing one means replacing it. So is anything carrying a prototype of its own, a Date or a File among them. fieldsOf only sees the top-level keys, so without a schema a nested form advertises meta to the model as a string field, not an object — a nested form wants a schema too.

The form is typed structurally — the setValue, trigger, getValues and formState a UseFormReturn carries — so this package imports nothing from react-hook-form at runtime; the peer states the range that shape was written against.