Documentation
¶
Overview ¶
Package userpreference is the memory Kind for one user's saved preference values, keyed per (classNamespace, className, key) in the user's own scope (memory.UserScope). Mutable — last write wins on the deterministic entry ID. ComponentWritten: only the operator's preferences commit path may author it; a session bearer is refused at the facade door, which is the structural guard that keeps a prompt-injected agent from bypassing the human-confirm flow.
Index ¶
Constants ¶
const IDPrefix = "upref-"
IDPrefix is the literal byte prefix every Entry of this Kind's ID starts with. EntryID always includes it — deliberately unlike factcontent.EntryID, whose callers apply the prefix themselves — because this Kind has exactly one deterministic-ID producer and no reason to make a caller repeat it.
const KindName = "user_preference"
KindName is the registered name of this memory Kind.
const SoftCap = 1024
SoftCap bounds pathology across classes; the schema already bounds keys per class.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kind ¶
type Kind struct{}
Kind is the memory.Kind implementation for user_preference.
func (Kind) ContentSchema ¶
func (Kind) IndexedFields ¶
func (Kind) NewScopeHooks ¶
func (Kind) NewScopeHooks(_ memory.Scope) memory.ScopeHooks
func (Kind) WriteAuthority ¶
func (Kind) WriteAuthority() memory.WriteAuthority
WriteAuthority: ComponentWritten — the operator's preferences commit path is the only author; see the package doc for the threat this closes.
type Preference ¶
type Preference struct {
// ClassNamespace is the AgentClass namespace the preference was set for.
ClassNamespace string `json:"classNamespace"`
// ClassName is the AgentClass name the preference was set for.
ClassName string `json:"className"`
// Key is the preference's declared key within the class's schema.
Key string `json:"key"`
// Value is the saved value, or JSON null for a cleared tombstone: an
// explicit "the user unset this" distinct from "never set", so a later
// read does not fall back to the class default it was deliberately
// cleared away from.
Value json.RawMessage `json:"value"`
// SetViaSession names the session the value was set through, when set
// through one — empty for values set by another route (e.g. a CLI/admin
// write).
SetViaSession string `json:"setViaSession,omitempty"`
}
Preference is the Kind's Content payload: one saved value for one class's declared preference key, in the user's own scope.