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

dendron-sdk

v1.0.1

Published

The Zero-Liability Behavioral Intelligence SDK — makes any website intelligent about its visitors

Downloads

23

Readme

Dendron SDK

The Zero-Liability Behavioral Intelligence SDK

Dendron makes any website intelligent about its visitors. It tracks in-session behavioral signals (scroll depth, reading time, cursor patterns, interaction focus), assembles structured intent data, and surfaces AI-generated Smart Cards through a chat-style widget overlay.

  • Zero server infrastructure — runs entirely in the browser
  • BYOK (Bring Your Own Key) — your backend, your LLM, your keys
  • 13KB gzipped — Web Worker architecture, zero main-thread blocking
  • Shadow DOM isolated — never leaks CSS into or out of the host page
  • Privacy-first — no cookies, no central data store, no PII collection

Quick Start

npm install dendron-sdk
import { Dendron } from 'dendron-sdk';

Dendron.init({
  onQuery: async (payload) => {
    const res = await fetch('/api/ai-proxy', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload),
    });
    return res.json();
  },
  systemContext: 'Acme is a developer platform for edge deployments.',
});

That's it. Dendron handles tracking, intent scoring, prompt building, and card rendering. Your backend handles the LLM call.

CDN

<script src="https://cdn.dendron.dev/v1/dendron.min.js"
  integrity="sha384-{hash}"
  crossorigin="anonymous"></script>

<script>
  Dendron.init({
    onQuery: async (payload) => {
      const res = await fetch('/api/ai-proxy', {
        method: 'POST',
        body: JSON.stringify(payload),
      });
      return res.json();
    }
  });
</script>

How It Works

Visitor scrolls/reads/clicks
    ↓  Main thread → Web Worker (postMessage)
Tracker captures behavioral signals
    ↓  Debounced, batched, off main thread
Context Engine scores intent (0-100)
    ↓  When threshold crossed (default: 55)
Prompt Builder assembles LLM-ready payload
    ↓  Passed to YOUR onQuery callback
Card Renderer shows Smart Card in Shadow DOM widget

Dendron never makes network requests. The only egress is your onQuery callback.

Smart Card Types

| Type | When | What it shows | |------|------|---------------| | Greeting | First 10s, low intent | Welcome message, product summary | | Feature | Deep engagement on feature section | Feature deep-dive, stats | | Pricing | Extended reading on pricing | Plan comparison table | | Engagement | High overall intent | Social proof, aggregated stats | | Comparison | Back-and-forth between sections | Side-by-side comparison |

Your Backend (the onQuery callback)

Dendron sends a DendronContextPayload to your callback. You forward it to your LLM and return a SmartCard JSON object.

// pages/api/dendron.ts (Next.js example)
import OpenAI from 'openai';

const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

export default async function handler(req, res) {
  const completion = await client.chat.completions.create({
    model: 'gpt-4o-mini',
    messages: [{ role: 'user', content: req.body.prompt }],
    response_format: { type: 'json_object' },
  });
  res.json(JSON.parse(completion.choices[0].message.content));
}

Works with any LLM provider: OpenAI, Anthropic, Groq, Ollama, etc.

Configuration

Dendron.init({
  onQuery: async (payload) => { /* required */ },

  tracking: {
    scrollDebounce: 200,       // ms
    cursorDebounce: 300,       // ms
    readingInterval: 1000,     // ms
    mutationFlushInterval: 500 // ms
  },

  intent: {
    triggerThreshold: 55,      // 0-100
    cooldownSeconds: 30,
    maxCardsPerSession: 5
  },

  storage: {
    maxStorageMB: 25,
    embeddingTTLDays: 7,
    cleanupIntervalMinutes: 5
  },

  ui: {
    position: 'bottom-right',  // or 'bottom-left'
    theme: 'auto',             // 'light' | 'dark' | 'auto'
    branding: true,
    zIndex: 999999
  },

  systemContext: 'Your product description here',
  webMCP: false,               // WebMCP agent-readiness plugin
  debug: false                 // devtools overlay
});

Event Hooks

Dendron.on('trigger', (payload) => {
  analytics.track('dendron_trigger', { score: payload.trigger.score });
});

Dendron.on('card:rendered', (card) => console.log('Card:', card.type));
Dendron.on('card:action', (action) => router.push(action.href));
Dendron.on('error', (err) => Sentry.captureException(err));

Framework Integration

React / Next.js

'use client';
import { useEffect } from 'react';
import { Dendron } from 'dendron-sdk';

export default function Layout({ children }) {
  useEffect(() => {
    Dendron.init({ onQuery: async (p) => (await fetch('/api/dendron', { method: 'POST', body: JSON.stringify(p) })).json() });
    return () => Dendron.destroy();
  }, []);
  return <>{children}</>;
}

Vue / Nuxt

<script setup>
import { onMounted, onUnmounted } from 'vue'
import { Dendron } from 'dendron-sdk'

onMounted(() => {
  Dendron.init({ onQuery: async (p) => (await $fetch('/api/dendron', { method: 'POST', body: p })) })
})
onUnmounted(() => Dendron.destroy())
</script>

Running the Demo

# Clone and install
git clone https://github.com/bitWise72/dendron.git
cd dendron && npm install

# Build the SDK
npm run build

# Start mock LLM backend
node demo/mock-backend.js

# In another terminal, serve the demo
npx vite demo

Open the demo page, scroll around, and watch Smart Cards appear based on your behavior.

Development

npm run build          # Production build (ESM + CJS + UMD + types)
npm run test           # Run test suite (67 tests)
npm run typecheck      # TypeScript strict check
npm run lint           # ESLint
npm run dev            # Dev server for demo

Architecture

| Module | Runs In | Responsibility | |--------|---------|----------------| | Tracker | Web Worker + Main Thread listeners | DOM observation, scroll/cursor/click capture | | Context Engine | Web Worker | Signal aggregation, intent scoring | | Prompt Builder | Main Thread | Assembles LLM-ready prompts from context | | Card Renderer | Main Thread (Shadow DOM) | Parses LLM response, renders Smart Cards | | Micro-Embeddings | Web Worker (optional) | Behavioral pattern vectors via Transformers.js | | WebMCP Plugin | Main Thread (optional) | Agent-readiness for agentic browsers |

Security

  • No API keys in browser — BYOK callback pattern eliminates exposure
  • No innerHTML on user/LLM content — DOM API only (createElement/textContent)
  • Shadow DOM isolation — closed shadow root, no CSS leakage
  • Zero network requests — Dendron makes no calls; only your onQuery does
  • CSP compatible — no eval(), no inline handlers
  • 0 production vulnerabilitiesnpm audit --omit=dev clean

Bundle Size

| Component | Size (gzipped) | |-----------|---------------| | Core SDK | 13KB | | Micro-Embeddings (lazy, optional) | ~25MB (loaded on first trigger) | | WebMCP Plugin (tree-shaken if unused) | ~2KB |

License

MIT