userpreference

package
v0.0.0-...-7c75ef6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 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 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

View Source
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.

View Source
const KindName = "user_preference"

KindName is the registered name of this memory Kind.

View Source
const SoftCap = 1024

SoftCap bounds pathology across classes; the schema already bounds keys per class.

Variables

This section is empty.

Functions

func EntryID

func EntryID(classNS, className, key string) string

EntryID is deterministic per (classNS, className, key) so a re-save overwrites; the 0x1f separator prevents field-boundary collisions (("ns","a","bc") must not hash the same as ("ns","ab","c")).

Types

type Kind

type Kind struct{}

Kind is the memory.Kind implementation for user_preference.

func (Kind) ContentSchema

func (Kind) ContentSchema() reflect.Type

func (Kind) IDPrefix

func (Kind) IDPrefix() string

func (Kind) IndexedFields

func (Kind) IndexedFields() []string

func (Kind) Name

func (Kind) Name() string

func (Kind) NewScopeHooks

func (Kind) NewScopeHooks(_ memory.Scope) memory.ScopeHooks

func (Kind) Retention

func (Kind) Retention() memory.Retention

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.

Jump to

Keyboard shortcuts

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