Documentation
¶
Overview ¶
Package activity is the console-facing ActivityService handler: it lists recent activity events (newest first, filtered) and serves a payload blob by ref for the /dashboard and log viewer. The view is DAEMON-WIDE - it merges the trail of every workspace the daemon has loaded, because the panel exists to answer "what is touching this daemon" and a per-workspace view would silently under-report every other workspace. It is READ-only and maps the on-disk trail.Event (internal/trail) to the magus.activity.v1alpha1 wire type at the boundary - the store owns the format, this owns the wire. Mounted on the console's human-facing API surface by the daemon, never under /mcp.
Index ¶
- type Service
- func (s *Service) GetPayload(_ context.Context, req *connect.Request[activityv1.GetPayloadRequest]) (*connect.Response[activityv1.Payload], error)
- func (s *Service) ListActivityEvents(_ context.Context, req *connect.Request[activityv1.ListActivityEventsRequest]) (*connect.Response[activityv1.ListActivityEventsResponse], error)
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements activityv1alpha1connect.ActivityServiceHandler over the activity trails of every workspace the daemon has loaded. Read-only: producers (the MCP handler, agent hooks, and later jobs/config/token) write the trails; this reads them.
func NewService ¶
NewService builds a Service merging the trails of the workspaces the source reports at call time. A nil source (or one that reports none) yields an empty view rather than an error.
func (*Service) GetPayload ¶
func (s *Service) GetPayload(_ context.Context, req *connect.Request[activityv1.GetPayloadRequest]) (*connect.Response[activityv1.Payload], error)
GetPayload serves a stored request or response body by its ref. Refs are content-addressed, so the same ref names the same bytes in whichever workspace's blob store holds it; the first hit across the loaded workspaces answers, and only an unresolvable ref is NotFound.
func (*Service) ListActivityEvents ¶ added in v0.4.0
func (s *Service) ListActivityEvents(_ context.Context, req *connect.Request[activityv1.ListActivityEventsRequest]) (*connect.Response[activityv1.ListActivityEventsResponse], error)
ListActivityEvents returns recent events, newest first, narrowed by the request filter.
The filter runs BEFORE the page is cut, so page_size counts MATCHING events. Truncating first was the bug this replaced: on a busy daemon the newest page_size events could all be filtered out, and the caller read the empty response as "there are none" - a false absence the review bells and the dashboard Agents tile all assert on.
page_token is a decimal offset into the filtered, newest-first stream, and next_page_token is set while events remain, so "load older activity" walks the whole retained trail instead of stopping at the first page.
type Workspace ¶ added in v0.4.0
Workspace names one workspace whose trail the view merges: its root (the identity a reader groups rows by) and the cache dir holding the trail. The daemon serves many workspaces, and a producer outside the daemon process - the agent hook, which runs as a short-lived client and resolves the LOCAL cache dir - writes to its own workspace's trail, so the daemon-wide view is the union of them.