Documentation
¶
Overview ¶
Package memory keeps the persistent notes native runs see at their start: entries the agent or the owner wrote and suggestions waiting for approval.
Index ¶
- Constants
- Variables
- func NewTool(service *Service) tools.Executor
- type Entry
- type Filter
- type Scope
- type Service
- func (s *Service) Approve(ctx context.Context, id string) (Entry, error)
- func (s *Service) Create(ctx context.Context, entry Entry) (Entry, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) List(ctx context.Context, filter Filter) ([]Entry, error)
- func (s *Service) PromptContext(ctx context.Context, workingDir string) (string, error)
- func (s *Service) Update(ctx context.Context, entry Entry) (Entry, error)
- type Store
Constants ¶
const DefaultLimit = 20
DefaultLimit is how many entries a listing and the prompt hold.
Variables ¶
var ErrInvalidInput = errors.New("invalid memory input")
ErrInvalidInput reports an entry or filter memory refuses.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
ID string `json:"id"`
Scope Scope `json:"scope"`
Key string `json:"key,omitempty"`
Content string `json:"content"`
WorkingDir string `json:"working_dir,omitempty"`
// Pending marks a suggestion of a session review that waits for the
// owner's approval; runs see only approved entries.
Pending bool `json:"pending,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Scope ¶
type Scope string
func ParseScope ¶
ParseScope reads a scope in any case; empty is global.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service checks and stamps entries before the store keeps them.
func (*Service) PromptContext ¶
PromptContext is the memory section of the prompt of a run in workingDir; empty without entries.
type Store ¶
type Store interface {
CreateMemory(ctx context.Context, entry Entry) error
UpdateMemory(ctx context.Context, entry Entry) error
DeleteMemory(ctx context.Context, id string) error
GetMemory(ctx context.Context, id string) (Entry, error)
ListMemories(ctx context.Context, filter Filter) ([]Entry, error)
}