Build on Bevia

Events

What makes Bevia a runtime rather than something you query. The engine tells you what happened; you decide what to do about it.

The vocabulary

EventWhen
world.publishedthe engine published a new version — version, basis_seq, manifest
attention.createdan insight appears that the previous publication did not carry — kind, headline, why_now, matter_ids
capture.admitteda capture landed as a moment — the moment id, source_kind, write_kind
proposal.created · resolved · withdrawn · receiptthe proposal ledger moved; resolved carries the outcome and, for an action, authorized

Subscribe

const sub = bevia.events.on("attention.created", async (ev) => {
  const detail = await bevia.world.inspect(String(ev.data.matter_ids?.[0]));
  // …text me, update the dashboard, run an agent, create a task
});
sub.close();                                              // when you are done

for await (const ev of bevia.events.subscribe({ kinds: ["world.published"], signal })) {
  console.log(ev.kind, ev.data.version);                  // stop by aborting the signal
}

const page = await bevia.events.read(cursor);             // one page, pull-shaped

On the wire: GET /events (no cursor = the head; ?after= for a page) and GET /events/stream (server-sent events; resume with Last-Event-ID). Filter with ?kinds=world.published,attention.created.

Cursors

Every event's id is a cursor. Resume from any event and nothing before it is replayed. No cursor means now: a fresh subscriber reads the World for the state rather than replaying its history. Take the head cursor before the action whose events you want, so nothing lands in the gap.

Rules a subscriber can rely on

  • Events carry identity, never evidence text. Read the substance through the read doors, gated by their own capability.
  • Pull, never push. The engine never calls out. Your program connects; the stream polls the ledgers every two seconds and sends a keepalive every twenty.
  • Retention. Publication and proposal events are as durable as the publication chain and the ledger. Engine facts (capture.admitted) come from the engine's consequence ledger, which prunes completed rows after a few days — a subscriber away for weeks re-reads the World.

Proposals & actions →