memory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionName     = "chat_memories"
	MaxMemoriesPerUser = 50
)

Variables

View Source
var (
	ErrMemoryDisabled  = errors.New("Chat memory is disabled in Settings")
	ErrAutoCaptureOff  = errors.New("automatic memory capture is disabled in Settings")
	ErrMemoryLimit     = errors.New("you can save at most 50 memories")
	ErrMemoryNotFound  = errors.New("memory not found")
	ErrInvalidCategory = errors.New("unsupported memory category")
	ErrInvalidOrigin   = errors.New("unsupported memory origin")
	ErrInvalidContent  = errors.New("memory content must be between 1 and 500 characters")
	ErrMemoryChanged   = errors.New("memory changed after the original Chat action")
	ErrUndoUnsupported = errors.New("this memory action cannot be undone")
)

Functions

func Register

func Register(app core.App)

Types

type EditableSnapshot

type EditableSnapshot struct {
	Category string `json:"category"`
	Content  string `json:"content"`
	Active   bool   `json:"active"`
}

type Memory

type Memory struct {
	ID                 string `json:"id"`
	Owner              string `json:"owner"`
	Category           string `json:"category"`
	Content            string `json:"content"`
	Active             bool   `json:"active"`
	Origin             string `json:"origin"`
	SourceConversation string `json:"source_conversation,omitempty"`
	SourceMessage      string `json:"source_message,omitempty"`
	Created            string `json:"created"`
	Updated            string `json:"updated"`
}

func ActiveForPrompt

func ActiveForPrompt(app core.App, ownerID string) ([]Memory, error)

func Forget

func Forget(app core.App, ownerID, id string) (Memory, error)

type UpsertInput

type UpsertInput struct {
	ID       string
	Category string
	Content  string
	Origin   string
}

type UpsertResult

type UpsertResult struct {
	Action         string            `json:"action"`
	OriginalAction string            `json:"original_action,omitempty"`
	Memory         Memory            `json:"memory"`
	Previous       *EditableSnapshot `json:"previous,omitempty"`
	UndoneAt       string            `json:"undone_at,omitempty"`
}

func UndoUpsert

func UndoUpsert(app core.App, ownerID string, result UpsertResult) (UpsertResult, error)

UndoUpsert reverses a completed Chat memory create or update when the underlying record still matches the tool result. Callers should run it in the same transaction that marks the persisted tool output as undone.

func Upsert

func Upsert(app core.App, ownerID, conversationID, messageID string, input UpsertInput) (UpsertResult, error)

Jump to

Keyboard shortcuts

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