JSPM

  • Created
  • Published
  • Downloads 463
  • Score
    100M100P100Q101335F

Core primitives for mu: IDs, events, DAG helpers, and persistence interfaces.

Package Exports

  • @femtomc/mu-core
  • @femtomc/mu-core/browser
  • @femtomc/mu-core/node

Readme

@femtomc/mu-core

Core runtime primitives shared across mu packages.

Install

After publishing:

npm install @femtomc/mu-core
# or: bun add @femtomc/mu-core

From this repo:

cd mu
bun install
bun run build

Usage

import { EventLog, InMemoryJsonlStore, JsonlEventSink, newRunId, runContext } from "@femtomc/mu-core/node";

const jsonl = new InMemoryJsonlStore();
const events = new EventLog(new JsonlEventSink(jsonl));

await runContext({ runId: newRunId() }, async () => {
    await events.emit("demo.event", { source: "readme", payload: { ok: true } });
});

console.log(await jsonl.read());

Tests / Typecheck

From the mu/ repo root:

bun test packages/core
bun run typecheck

Runtime

  • @femtomc/mu-core is runtime-agnostic (no Node builtins).
  • @femtomc/mu-core/node is Node-only (node:fs, node:async_hooks).
  • @femtomc/mu-core/browser is browser-only (IndexedDB/localStorage).