memory

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package memory provides portable memory search/get tool coordination.

Index

Constants

View Source
const (
	// SearchName is the catalog name of unified memory search.
	SearchName = "memory_search"
	// GetName is the catalog name of memory snippet reads.
	GetName = "memory_get"
)

Variables

This section is empty.

Functions

func GetDefinition

func GetDefinition() toolcontract.Definition

GetDefinition returns the stable memory snippet schema.

func NewGetHandler

func NewGetHandler(opts Options) toolcontract.Handler

NewGetHandler constructs the bounded memory snippet implementation.

func NewSearchHandler

func NewSearchHandler(opts Options) toolcontract.Handler

NewSearchHandler constructs the unified memory search implementation.

func Register

func Register(reg toolcontract.Registrar, opts Options)

Register adds memory_search and memory_get when a Backend is available.

func SearchDefinition

func SearchDefinition() toolcontract.Definition

SearchDefinition returns the stable unified memory search schema.

Types

type Backend

type Backend interface {
	Search(context.Context, SearchRequest) (string, error)
	Get(context.Context, GetRequest) (string, error)
}

Backend is the narrow Host-owned memory data plane. Implementations own concrete stores, ranking models, visibility rules and source availability.

type BackendFuncs

type BackendFuncs struct {
	SearchFunc func(context.Context, SearchRequest) (string, error)
	GetFunc    func(context.Context, GetRequest) (string, error)
}

BackendFuncs adapts private Host functions to Backend.

func (BackendFuncs) Get

func (b BackendFuncs) Get(ctx context.Context, request GetRequest) (string, error)

Get delegates to GetFunc and fails closed when unavailable.

func (BackendFuncs) Search

func (b BackendFuncs) Search(ctx context.Context, request SearchRequest) (string, error)

Search delegates to SearchFunc and fails closed when unavailable.

type GetRequest

type GetRequest struct {
	Path  string
	From  int
	Lines int
}

GetRequest is the normalized bounded snippet request.

type Options

type Options struct {
	Backend             Backend
	MaxSearchResults    int
	MaxReadLines        int
	StructuredByDefault bool
}

Options configures model-facing memory tool coordination.

type SearchRequest

type SearchRequest struct {
	Query             string
	Limit             int
	Sources           []string
	IncludeMemory     bool
	IncludeStructured bool
	IncludeSessions   bool
	Session           SessionSearch
}

SearchRequest is the normalized unified recall request passed to a Host.

type SessionSearch

type SessionSearch struct {
	SessionID             string
	Status                string
	Statuses              []string
	Model                 string
	Models                []string
	Tag                   string
	Tags                  []string
	Mode                  string
	CandidateLimit        int
	RerankLimit           int
	IncludeClusters       bool
	ClusterLimit          int
	HistoryLines          int
	ExcludeCurrentLineage *bool
}

SessionSearch contains optional persisted-session recall filters. The Host remains responsible for visibility, lineage, hydration and ranking policy.

Jump to

Keyboard shortcuts

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