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

@dornick/hooks

v0.1.0

Published

Dornick hooks — programmatic and declarative lifecycle events for the in-browser agent SDK.

Readme

@dornick/hooks

Lifecycle hooks for the in-browser agent SDK.

An 18-event registry with veto + transform pipelines. Subscribe programmatically (dornick.on("event", handler)) or declaratively via a JSON config block in your Configuration (each event maps to webhook URLs or log lines).

npm bundle license

Install

npm i @dornick/hooks

@dornick/core already depends on this — install directly only if you're embedding the registry into your own runtime.

Events

sessionStart · sessionEnd · onUserMessage · beforeFieldFill · afterFieldFill · onFileUpload · onComplete · onError · beforeLLMCall · afterLLMCall · beforeExtract · afterExtract · onSkillActivate · onSkillAction · onPlanReady · onCompact · onHandoff · onAbandon.

Six of these are vetoable — return { veto: true, reason } from any handler to block:

onUserMessage · beforeFieldFill · onFileUpload · onSkillActivate · onSkillAction · onPlanReady.

Mutation-capable events let a handler return { mutation: { ... } } to transform the ctx before downstream handlers see it (e.g. lowercasing an email before fill, or rewriting extracted data).

Programmatic

dornick.on("beforeFieldFill", ({ field, value, source }) => {
  if (field === "email" && !value.includes("@")) {
    return { veto: true, reason: "needs @" };
  }
  if (source === "agent") {
    return { mutation: { value: value.toLowerCase() } };
  }
});

dornick.on("onComplete", async ({ data }) => {
  await fetch("/api/save", { method: "POST", body: JSON.stringify(data) });
});

dornick.on(event, handler) returns a disposer; call it to unsubscribe.

Declarative

In your Configuration:

{
  "hooks": {
    "onComplete": { "type": "webhook", "url": "https://example.com/done" },
    "onFileUpload": { "type": "log", "level": "info", "prefix": "[upload]" },
    "beforeFieldFill": [
      { "type": "webhook", "url": "/api/validate", "vetoOnNonOk": true }
    ]
  }
}

Supported declarative actions:

  • { type: "webhook", url, method?, headers?, vetoOnNonOk?, timeoutMs? } — POSTs the event ctx as JSON. vetoOnNonOk: true turns any non-2xx response into a veto.
  • { type: "log", level?, prefix? } — emits to console.{info,debug,warn} with an optional prefix.

Each event accepts a single hook or an array. They run in order, and a veto from any handler short-circuits the rest.

Ctx shapes

Every event has a typed ctx and (where applicable) mutation interface. Common ones:

sessionStart      { configName: string; startedAt: number }
onUserMessage     { text: string }          → mutation: { text? }
beforeFieldFill   { field, value, source }  → mutation: { value? }
afterFieldFill    { field, value }
onFileUpload      { field, name, mimeType, size, base64 }
onComplete        { data: Record<string, unknown> }   → mutation: { data? }
onError           { error: Error; during: string }
beforeLLMCall     { model, provider, systemChars, messageCount, toolCount }
afterLLMCall      { model, provider, inputTokens, outputTokens, stopReason, durationMs, ... }

Full list: see packages/hooks/src/events.ts.

Links

License

MIT — © Dipankar Sarkar