@lovyou-ai/eventgraph
v0.6.0
Published
Hash-chained, append-only, causal event graph
Downloads
610
Maintainers
Readme
@lovyou-ai/eventgraph
A hash-chained, append-only, causal event graph. The foundation for building systems where every action is signed, auditable, and causally linked.
Install
npm install @lovyou-ai/eventgraphQuick Start
import {
ActorId, EventType, ConversationId, Hash,
createBootstrap, createEvent, NoopSigner, InMemoryStore,
} from "@lovyou-ai/eventgraph";
// Create store and bootstrap
const store = new InMemoryStore();
const signer = new NoopSigner();
const source = new ActorId("actor_alice");
const boot = createBootstrap(source, signer);
store.append(boot);
// Record an event — hash-chained and causally linked
const ev = createEvent(
new EventType("trust.updated"),
source,
{ score: 0.85, domain: "code_review" },
[boot.id],
new ConversationId("conv_1"),
boot.hash,
signer,
);
store.append(ev);
// Verify chain integrity
const result = store.verifyChain();
console.log(result.valid); // trueWhat's Included
- Types — Always-valid domain models: Score [0,1], Weight [-1,1], Activation [0,1], Layer [0,13], Cadence [1,+inf), typed IDs (EventId, ActorId, Hash, etc.)
- Event — Immutable events with canonical form, SHA-256 hash chain, and causal links
- Store — Store interface and InMemoryStore with chain integrity enforcement
- Bus — Pub/sub event bus with pattern-based subscriptions
- Primitive — Primitive interface, lifecycle state machine, and registry
- Tick Engine — Ripple-wave processor with cadence control and quiescence detection
Conformance
This package produces identical SHA-256 hashes to the Go reference implementation for the same canonical form inputs. 124 tests including conformance hash vectors.
Links
License
BSL 1.1 converting to Apache 2.0 on 26 February 2030.
