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

@heybeaux/sonder-core

v0.1.2

Published

Sonder event bus, envelope schema, and audit log

Readme

@heybeaux/sonder-core

The event bus, envelope schema, and audit log at the heart of the Sonder cognitive runtime.

Install

npm install @heybeaux/sonder-core

What it does

sonder-core defines three things:

  1. SonderEvent — the typed envelope that every agent action produces. It carries capability context (ACR), memory context (Engram), reasoning context (Parliament), governance context (Lattice), prediction context (LeWM), and intent context (AWM) on a single event.
  2. SonderBus — the in-process event bus. Adapters register on it, events flow through it, and the audit log is written by it.
  3. AuditLog — an append-only, queryable SQLite log. Every emitted SonderEvent is stored in full.

Most users should start with @heybeaux/sonder-sdk, which wraps this package with ergonomic helpers. Use sonder-core directly when you need fine-grained control over the bus.

Quick start

import { SonderBus } from '@heybeaux/sonder-core';

const bus = new SonderBus({ dbPath: './audit.db' }); // omit dbPath for in-memory

bus.onAny((event) => {
  console.log(event.id, event.intent.action, event.governance.validated);
});

const event = await bus.emit({
  agent_id: 'agent:my-agent',
  task_id:  'task:run-001',
  payload:  { action: 'summarise', input: '...' },
});

bus.close(); // flush WAL and close SQLite

SonderBus API

class SonderBus {
  constructor(options?: { dbPath?: string });

  // Register an adapter — all registered adapters run in parallel during contribute()
  register(adapter: SonderAdapter): void;

  // Emit an event — runs contribute, persists, then notifies observers
  emit(base: EmitInput): Promise<SonderEvent>;

  // Subscribe to events by intent.action type
  on(type: string, handler: (event: SonderEvent) => void): () => void;

  // Subscribe to all events
  onAny(handler: (event: SonderEvent) => void): () => void;

  // Query the audit log
  query(filter: EventFilter): SonderEvent[];

  // Close the audit log
  close(): void;
}

SonderEvent envelope

interface SonderEvent {
  id: string;           // ULID — lexicographically sortable
  version: '1';
  agent_id: string;
  task_id: string;
  parent_id?: string;
  timestamp: string;    // ISO 8601 UTC

  capabilities: CapabilityContext;  // ACR
  memory: MemoryContext;            // Engram
  reasoning: ReasoningContext;      // Parliament
  governance: GovernanceContext;    // Lattice
  prediction: PredictionContext;    // LeWM
  intent: IntentContext;            // AWM

  payload: unknown;
  metadata?: Record<string, unknown>;
}

Adapter contract

interface SonderAdapter {
  name: string;
  version: string;
  contribute(event: Partial<SonderEvent>): Promise<Partial<SonderEvent>>;
  observe(event: SonderEvent): Promise<void>;
}

contribute() is called before an event is emitted — all adapters run in parallel and their contributions are diff-merged. observe() is called after emission, fire-and-forget.

Audit log queries

const events = bus.query({
  task_id:   'task:run-001',
  validated: true,
  from:      '2026-01-01T00:00:00Z',
  to:        '2026-12-31T23:59:59Z',
  limit:     100,
  offset:    0,
});

Performance (M-series Mac, N=1000)

| Metric | Result | |---|---| | Emit latency p50 | 0.018 ms | | Emit latency p99 | 0.033 ms | | Audit log write throughput | 56,371 events/sec | | Audit log query latency p99 | 0.227 ms |

Packages

| Package | Description | |---|---| | @heybeaux/sonder-core | Event bus, envelope schema, audit log (this package) | | @heybeaux/sonder-sdk | createRuntime() + withSonder() HOC | | @heybeaux/sonder-adapter-acr | ACR capability context adapter | | @heybeaux/sonder-adapter-engram | Engram memory context adapter | | @heybeaux/sonder-adapter-parliament | Parliament reasoning context adapter | | @heybeaux/sonder-adapter-lattice | Lattice governance context adapter | | @heybeaux/sonder-adapter-lewm | LeWM prediction context adapter | | @heybeaux/sonder-adapter-awm | AWM intent context adapter |

License

MIT