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

@mosesaic/core

v0.1.1

Published

Mosesaic TypeScript core — actor runtime, message bus, agent lifecycle

Downloads

28

Readme

@mosesaic/core

TypeScript actor runtime for the Mosesaic agent framework.

npm install @mosesaic/core

Quick Start

import { defineAgent, AgentRuntime } from "@mosesaic/core";

// Define agents
const echo = defineAgent({ name: "echo" }, async (ctx) => {
  const msg = await ctx.receive();
  await ctx.send("upper", msg.payload);
});

const upper = defineAgent({ name: "upper" }, async (ctx) => {
  const msg = await ctx.receive();
  console.log(String(msg.payload).toUpperCase()); // "HELLO MOSESAIC"
});

// Wire up the runtime
const runtime = new AgentRuntime();
runtime.register(echo);
runtime.register(upper);

// Send a message and run until all agents finish
await runtime.sendExternal("echo", "hello mosesaic");
await runtime.runUntilComplete(5000);

// Inspect the full message history
console.log(runtime.eventLog);

API

defineAgent(opts, fn)

const myAgent = defineAgent({ name: "my-agent" }, async (ctx) => {
  const msg = await ctx.receive();     // wait for next message
  await ctx.send("other", "payload");  // send to another agent
  await ctx.checkpoint();              // pause/stop point
});

AgentRuntime

const runtime = new AgentRuntime();

runtime.register(myAgent);              // add agent
await runtime.sendExternal("name", p); // queue message before start
await runtime.runUntilComplete(ms);    // run until all agents exit
runtime.eventLog                        // all messages (readonly)

// Lifecycle (call during runtime.run())
runtime.pause("name");
runtime.resume("name");
runtime.stop("name");

AgentContext (ctx)

| Method | Description | |---|---| | ctx.receive() | Wait for next message in this agent's inbox | | ctx.send(to, payload) | Send a message to another agent | | ctx.reply(original, payload) | Reply, preserving trace_id | | ctx.checkpoint() | Cooperative pause/stop point | | ctx.isStopped | True after runtime.stop() was called |

Messages

Each message has:

{
  id: string;           // UUID
  type: "task" | "result" | "error" | "control";
  from_agent: string;
  to_agent: string;
  payload?: unknown;
  trace_id?: string;    // propagated across a call chain
  parent_message_id?: string;
  timestamp: string;    // ISO 8601
}

Concepts

Actor model — each agent runs concurrently in its own loop, communicating only via typed messages. No shared mutable state.

Event sourcing — every message is written to the event log before delivery. runtime.eventLog is always the complete history of what happened.

Lifecyclepause() suspends at the next ctx.checkpoint(). stop() cancels execution. resume() unblocks a paused agent.

Trace IDs — messages sent by ctx.send() carry the agent's trace_id, making it easy to follow a request across multiple agents.


Python SDK

The full framework is available in Python with additional packages:

pip install mosesaic-core mosesaic-llm mosesaic-tools mosesaic-workflow mosesaic-mcp mosesaic-server

See the main README for the full feature set including LLM routing, MCP tool integration, workflow DSL, REST API server, and CLI.