memorysvc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleUser = model.RoleUser
	RoleOrg  = model.RoleOrg
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Principal string
	Role      string
	Agent     string
}

Actor is the authenticated (or local) caller. On the server, Principal and Role come from a verified JWT sub/role — never from the request body.

type CompactResponse

type CompactResponse struct {
	Results []compactResult `json:"results"`
	Hint    string          `json:"hint,omitempty"`
}

func ToCompact

func ToCompact(resp search.RecallResponse) CompactResponse

ToCompact projects a full RecallResponse into the compact LLM-friendly shape.

type EmbedInput

type EmbedInput struct {
	ID     string
	All    bool
	Status bool
}

type ForgetInput

type ForgetInput struct {
	ID string
}

type GCInput

type GCInput struct {
	Threshold float64
	Limit     int
	KeepID    string
}

type ImportInput

type ImportInput struct {
	Draft  []byte
	NoDiff bool
	DryRun bool
}

type ImportResult

type ImportResult struct {
	Index   int    `json:"index"`
	ID      string `json:"id"`
	Content string `json:"content"`
	Action  string `json:"action"`
	Error   string `json:"error,omitempty"`
}

type LinkInput

type LinkInput struct {
	SourceID string
	TargetID string
	Type     string
	Weight   float64
	MetaJSON string
}

type LogInput

type LogInput struct {
	Limit int
}

type Options

type Options struct {
	EmbedModel  string
	MaxInsights int
	EnforceACL  bool
	StoreName   string
}

Options configures a memory service.

type RecallInput

type RecallInput struct {
	Query    string
	Category string
	Limit    int
	Source   string
	Basic    bool
	Intent   string
	Verbose  bool
}

type ReceiptDocument

type ReceiptDocument struct {
	Schema      string           `json:"schema"`
	GeneratedAt string           `json:"generated_at"`
	Store       string           `json:"store"`
	Limit       int              `json:"limit"`
	Count       int              `json:"count"`
	Privacy     map[string]any   `json:"privacy"`
	Events      []map[string]any `json:"events"`
}

func BuildReceipt

func BuildReceipt(storeName string, limit int, entries []store.OplogEntry, generatedAt time.Time) ReceiptDocument

type ReceiptInput

type ReceiptInput struct {
	Limit int
}

type RelatedInput

type RelatedInput struct {
	ID       string
	EdgeType string
	Depth    int
}

type RelatedResult

type RelatedResult struct {
	ID             string `json:"id"`
	Content        string `json:"content"`
	Category       string `json:"category"`
	Importance     int    `json:"importance"`
	Depth          int    `json:"depth"`
	EdgeType       string `json:"via_edge_type,omitempty"`
	OwnerPrincipal string `json:"owner_principal,omitempty"`
	Layer          string `json:"layer,omitempty"`
}

type RememberInput

type RememberInput struct {
	Content    string
	Category   string
	Importance int
	Tags       string
	Source     string
	Entities   string
	EntityMode string
	NoDiff     bool
}

type Result

type Result struct {
	JSON     []byte
	Text     string
	Warnings []string
}

Result is JSON (or text) plus warnings that belong on the client stderr.

type SearchInput

type SearchInput struct {
	Query string
	Limit int
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the single Memory implementation used by the local CLI and mnemon-server.

func New

func New(db *store.DB, opts Options) *Service

New wraps an already-open store. The caller owns Close.

func (*Service) DB

func (s *Service) DB() *store.DB

func (*Service) Embed

func (s *Service) Embed(actor Actor, req EmbedInput) (Result, error)

func (*Service) Forget

func (s *Service) Forget(actor Actor, req ForgetInput) (Result, error)

func (*Service) GC

func (s *Service) GC(actor Actor, req GCInput) (Result, error)

func (*Service) Import

func (s *Service) Import(actor Actor, req ImportInput) (Result, error)
func (s *Service) Link(actor Actor, req LinkInput) (Result, error)

func (*Service) Log

func (s *Service) Log(actor Actor, req LogInput) (Result, error)

func (*Service) Recall

func (s *Service) Recall(actor Actor, req RecallInput) (Result, error)

func (*Service) Receipt

func (s *Service) Receipt(actor Actor, req ReceiptInput) (Result, error)

func (*Service) Related

func (s *Service) Related(actor Actor, req RelatedInput) (Result, error)

func (*Service) Remember

func (s *Service) Remember(actor Actor, req RememberInput) (Result, error)

func (*Service) Search

func (s *Service) Search(actor Actor, req SearchInput) (Result, error)

func (*Service) Status

func (s *Service) Status(actor Actor) (Result, error)

func (*Service) Viz

func (s *Service) Viz(actor Actor, req VizInput) (Result, error)

type VizInput

type VizInput struct {
	Format string
}

Jump to

Keyboard shortcuts

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