Documentation
¶
Overview ¶
Package activity records what touches the vault at runtime — MCP tool calls, connected clients and curator actions — in memory, so the workspace UI can show a live Connections panel and an Activity/curator log without a database. Everything here is best-effort and bounded: a fixed-size event ring and a session map that the HTTP layer populates. Nothing is persisted.
Index ¶
- type Event
- type Recorder
- func (r *Recorder) ClientOf(id string) (string, bool)
- func (r *Recorder) CuratorChangesSince(d time.Duration) int
- func (r *Recorder) Events(source string) []Event
- func (r *Recorder) Record(ev Event)
- func (r *Recorder) RevokeClient(clientID string) int
- func (r *Recorder) Sessions() []SessionView
- func (r *Recorder) TotalCalls() int
- func (r *Recorder) Touch(key, clientID, name, kind, tool string)
- type Session
- type SessionView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
ID string `json:"id"`
Source string `json:"source"` // mcp | curator | user
Actor string `json:"actor"` // client name, "Curator" or "You"
Kind string `json:"kind"` // write|read|search|move|delete|tag|link|organize|archive|summary
Target string `json:"target"` // note title/path or a phrase
Detail string `json:"detail"`
Pending bool `json:"pending,omitempty"`
At time.Time `json:"at"`
}
Event is one thing that happened to the vault.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is a concurrency-safe, bounded store of events and sessions.
func (*Recorder) ClientOf ¶ added in v1.13.0
ClientOf returns the OAuth client of a session ("" without auth) and whether the session exists.
func (*Recorder) CuratorChangesSince ¶
CuratorChangesSince counts curator events newer than d ago.
func (*Recorder) Events ¶
Events returns a copy filtered by source ("", "all" or a source name), newest first.
func (*Recorder) Record ¶
Record appends an event, assigning it an id and timestamp. The oldest events are dropped once the ring is full.
func (*Recorder) RevokeClient ¶ added in v1.13.0
RevokeClient drops every session of an OAuth client (one per access token it used) and reports how many it dropped.
func (*Recorder) Sessions ¶
func (r *Recorder) Sessions() []SessionView
Sessions returns non-revoked sessions, most recently seen first, each with an active/idle status derived from LastSeen.
func (*Recorder) TotalCalls ¶
TotalCalls sums calls across live sessions.
type Session ¶
type Session struct {
ID string `json:"id"` // short, non-secret handle
Name string `json:"name"`
Kind string `json:"kind"`
FirstSeen time.Time `json:"firstSeen"`
LastSeen time.Time `json:"lastSeen"`
LastTool string `json:"lastTool,omitempty"`
Calls int `json:"calls"`
// contains filtered or unexported fields
}
Session is a live (or recently seen) MCP client, keyed by its bearer token.
type SessionView ¶
SessionView is a Session enriched with a derived status for the API.