primaryEntity
- Returns:
- the first
EntityRef, ornullif the act touched no entity.
UI → AI counterpart to EasyAIEvent (which is AI → UI).
As a user works inside a TabForge application — opening an order, running a search, jotting a
note — each of those acts is captured as one UserActivityEvent and dropped onto a short,
per-tab timeline. When the user later asks the assistant something context-dependent
("summarise this", "email that customer"), we render a compact
slice of this timeline into the prompt so the assistant already knows what "this" and "that"
refer to. The user never has to re-type the context they just clicked through.
Familiar analogy: a flight recorder's event track — not the raw cockpit video,
just the labelled milestones: "gear up", "autopilot engaged", "descent started". Each milestone
is timestamped, typed, and tagged with what it concerned. When you want to understand the last
few minutes, you read this clean track, not hours of footage. A UserActivityEvent is one
such milestone, and crucially it is semantic: because we live inside the app we record
"opened order #4711", never "clicked pixel (812, 344)".
type is the coarse category, verb is the specific act in the app's own
vocabulary (e.g. "approve", "cancel"), entities are the business objects
the act touched (the raw material for resolving "this"/"that"), and text is any free text
the user authored (a note or a search query). sessionId and tabId scope the
timeline — by default the assistant only sees activity from the current tab and session, which is
what makes @TabScoped per-tab memory fall out for free. timestamp orders the
timeline.
Instances are created via UserActivityEvent.Builder (typically by the capture layer, not application
code) and are immutable, so they are safe to share across threads, queues, or a ring-buffer store.
static final class UserActivityEvent.static enum static UserActivityEvent.Builderentities()tabId()text()toString()type()verb()null.null if unscoped.null if none.null."approve"), or null.null
(empty when the act concerned no specific entity, e.g. a free search).null.EntityRef, or null if the act touched no entity.type - the coarse category (required)UserActivityEvent.Builder