activity

package
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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 New

func New() *Recorder

New returns an empty Recorder using the wall clock.

func (*Recorder) ClientOf added in v1.13.0

func (r *Recorder) ClientOf(id string) (string, bool)

ClientOf returns the OAuth client of a session ("" without auth) and whether the session exists.

func (*Recorder) CuratorChangesSince

func (r *Recorder) CuratorChangesSince(d time.Duration) int

CuratorChangesSince counts curator events newer than d ago.

func (*Recorder) Events

func (r *Recorder) Events(source string) []Event

Events returns a copy filtered by source ("", "all" or a source name), newest first.

func (*Recorder) Record

func (r *Recorder) Record(ev Event)

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

func (r *Recorder) RevokeClient(clientID string) int

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

func (r *Recorder) TotalCalls() int

TotalCalls sums calls across live sessions.

func (*Recorder) Touch

func (r *Recorder) Touch(key, clientID, name, kind, tool string)

Touch upserts a session by key and, when tool is non-empty, counts a call. key is a stable non-secret handle (e.g. a token hash prefix); clientID is the OAuth client the token was issued to, empty when auth is off.

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.

func (Session) ClientID added in v1.13.0

func (s Session) ClientID() string

ClientID is the OAuth client the session's token was issued to, empty when auth is off.

type SessionView

type SessionView struct {
	Session
	Status string `json:"status"` // active | idle
}

SessionView is a Session enriched with a derived status for the API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL