Expand description
Persistent activity log for the trusty-memory daemon (issue #96).
Why: The dashboard activity feed (ActivityFeed.svelte) used to be a pure
live-stream over /sse — opening the UI showed an empty feed until the
next event fired, and writes from the MCP path (memory_remember,
palace_create, etc.) never reached the feed because only the HTTP API
handlers emitted. This module backs a single redb table under the daemon
data dir so the feed can fetch historical entries on mount and so every
mutating path (HTTP, MCP, future Hook) flows through the same record.
What: Exposes ActivityLog — a thread-safe wrapper around a redb
database holding ActivityEntry rows keyed by a monotonic u64 id, with a
FIFO eviction policy that caps the table at MAX_ENTRIES rows. The
ActivitySource enum tags every entry with its origin (HTTP, MCP, Hook).
Test: see the tests module at the bottom of this file — exercises append
ordering, FIFO eviction, and the source/palace/time filters used by the
GET /api/v1/activity handler.
Structs§
- Activity
Entry - A single persisted activity entry.
- Activity
Filter - Query filters accepted by
ActivityLog::list.
Enums§
- Activity
Log - Thread-safe handle to the persisted activity log.
- Activity
Source - Originating subsystem for an activity entry.
Constants§
- ACTIVITY_
DB_ FILENAME - File name of the redb database under the daemon
data_root. - MAX_
ENTRIES - Hard upper bound on rows retained in the activity log.