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

@cef-ai/testing

v0.1.10

Published

Simulator harness for CEF agents — `testAgent` for single-agent in-process tests, `testPlatform` for multi-agent tests with a vault simulation.

Readme

@cef-ai/testing

Simulator harness for CEF agents — testAgent for single-agent in-process tests, testPlatform for multi-agent tests with a vault simulation.

Install

pnpm add -D @cef-ai/testing

Import the harness directly from @cef-ai/testing in test files:

import { testAgent, testPlatform } from "@cef-ai/testing";

testAgent quickstart

testAgent(AgentClass, opts) constructs an in-memory simulator around a single agent class. It wires ctx.cubby to per-alias SQLite, ctx.fetch to a URL-pattern mock, ctx.models[alias] to stubs, and ctx.publish to a collector you can assert on.

import { describe, it, expect, afterEach } from "vitest";
import { testAgent, type TestHarness } from "@cef-ai/testing";
import Echo from "../src/agent.js";

describe("echo", () => {
  let h: TestHarness | undefined;
  afterEach(() => h?.dispose());

  it("acks user_message", async () => {
    h = testAgent(Echo, {
      cubbies: [{ alias: "history", migrations: "./migrations/history" }],
    });
    const events = await h.dispatch({
      type: "user_message",
      payload: { text: "hello" },
    });
    expect(events.map((e) => e.type)).toContain("ack");
  });
});

testPlatform quickstart

testPlatform({ agents, models, ... }) lifts the harness into a multi-agent world: each agent runs in its own simulator, a shared vault routes events between them, and the test drives interactions through vault.agents / vault.events. Use this when an agent talks to peers or when an application client (your "app") publishes into the vault.

import { describe, it, expect, afterEach } from "vitest";
import { testPlatform, createModelMock, type TestPlatform } from "@cef-ai/testing";
import Assistant from "../agent/src/assistant.js";

describe("assistant + app", () => {
  let p: TestPlatform | undefined;
  afterEach(() => p?.dispose());

  it("answers a user message", async () => {
    const llm = createModelMock();
    llm.expect({ prompt: "hi" }).respond({ text: "hello back" });

    p = testPlatform({
      agents: {
        assistant: {
          source: Assistant,
          cubbies: [{ alias: "history", migrations: "./migrations/history" }],
        },
      },
      models: { llm },
    });

    await p.vault.agents.connect({ agentId: "assistant" });
    // ...drive the vault, assert published events / cubby state
  });
});

API summary

| Symbol | Returns | Notes | | --- | --- | --- | | testAgent(AgentClass, opts?) | TestHarness | Single-agent simulator. Reads AGENT_METADATA to find decorated handlers. | | testPlatform(opts) | TestPlatform | Multi-agent simulator with a shared vault, model registry, and per-agent cubbies. | | mockAgent(spec) | MockAgentDescriptor | Peer descriptor for testPlatform — drop in for an agent you don't want to bring into the test bundle. | | fromMarketplace(url) | MockAgentDescriptor | v1: throws (not yet wired). v2: will fetch a published bundle. | | createModelMock() | ModelMockHandle | Expectation-builder model handle: mock.expect(input).respond(output). |

TestHarness exposes:

  • dispatch({ type, payload, from? }) — drive a single event; returns the publishes from this call.
  • published — every publish since construction (cumulative log).
  • cubby(alias)CubbyHandle for assertions.
  • runInCubby(alias, fn) — run with both the public handle and the raw better-sqlite3 database for sync, prepared-statement assertions.
  • start() / close(reason?) — drive @OnStart / @OnClose.
  • lifecycle{ state: "idle" | "started" | "closed", terminalReason?: ... }.
  • snapshot() / restore(snap) — capture and restore cubbies + clock + publish log.
  • replay(jsonlPath) — feed a JSONL fixture of events through the harness.
  • advanceTime(ms) / now() — manipulate the injected clock.
  • fetchMock() — URL-pattern fetch mock attached to ctx.fetch.
  • models — the model handle map attached to ctx.models.
  • dispose() — release SQLite handles. Idempotent.

TestPlatform exposes:

  • vault — the simulated vault (agents.connect, event streams, scoped per-conversation channels).
  • runInCubby(agentId, alias, fn) — assert on a specific agent's cubby.
  • dispose() — tear down every per-agent simulator.

Companion packages

  • @cef-ai/agent-sdk — the decorators and types the harness is testing.
  • @cef-ai/clicef build / cef typegen for the build that these tests run alongside.

References

  • Agent SDK spec: ../../../company-memory-bank/specs/platform/03-components/agent-sdk.md §9 (testing surface).
  • Runtime integration contract: ../../../company-memory-bank/specs/platform/03-components/sdk-runtime-integration-contract.md.

The ../company-memory-bank/... paths point at an internal sibling repo and are not browsable from a fresh clone.