Activity
Every mutation is recorded with a global, monotonically increasing seq. Reading from a cursor is
how anything watches an artifact without a socket — a page that shows "3 new comments", a session
shelling in, or the webhook sender in ADR 0003.
GET /api/artifacts/{id}/events?after=812&limit=100&wait=25
→ { "events": [ { "seq": 813, "artifactId": "art_…", "event": { … }, "at": "…" } ], "cursor": 813 }
after— the last seq you have seen. Omitted or malformed reads from the beginning rather than guessing; that is the honest answer to "everything since a thing I cannot parse".limit— 100 by default, 500 maximum.wait— seconds to hold the request open (max 25). The server polls its own log every second and answers the moment something exists. With nothing to report it returns{ events: [], cursor }after the budget, so a client loop iswait=25and re-request with the cursor.
seq is global, not per artifact: one cursor can follow several artifacts in order, and a gap in a
single artifact's numbers is normal.
What is recorded
| event | when |
|---|---|
artifact.published / artifact.updated | a version was added |
artifact.shared / artifact.unshared | the public link changed |
artifact.viewed | a page was served — { version, channel }, one per GET; HEAD is not a view |
artifact.state.changed | a state key was written — { scope, key, bytes }, never the value |
comment.thread.created / comment.thread.resolved / comment.created | threads and replies |
The payload is the domain event plus seq, artifactId and at. Nothing that could be large or
sensitive (an HTML body, a state value) is ever in it: the event says what changed, and a consumer
fetches the thing if it needs it.
Adapters
| adapter | ordering | notes |
|---|---|---|
| memory | exact | reference implementation, gap-free |
| filesystem | exact, single process | append-only JSONL per artifact + a counter file |
| Postgres | exact, concurrent-safe | bigserial, insert returns the seq, so two appends cannot share one |
The Postgres one is the only adapter that is safe with more than one process; the counter in the filesystem adapter is a read-modify-write, the same restriction the artifact store has.
Telemetry is a side channel, not the record
createEventService writes the log first, then fans out to an optional downstream sink (PostHog, OTel).
A downstream failure is caught and reported through onDownstreamError, never propagated: a dashboard
having a bad afternoon must not fail somebody's publish. A log failure does reject — that one lost
data.
Webhook delivery
Webhook subscriptions, signed delivery and retries are implemented. Wire the event log and webhook service into your host and explicitly run the delivery drain; a configured event log alone does not deliver notifications. See Webhooks for the sender port, signature verification, retries and receiver deduplication.
Not yet
- Server-Sent Events. The cursor is the contract; SSE is only a transport for it.