rest

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package rest provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.

Package rest exposes memini's HTTP/JSON API. The surface is API-first: the routes, parameters, and request/response models are generated from api/openapi.yaml (see gen.go / api.gen.go); this file implements the generated ServerInterface on top of the service layer. The MCP surface (internal/api/mcp) shares the same service.

Index

Constants

View Source
const (
	BearerAuthScopes bearerAuthContextKey = "bearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux added in v0.0.6

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL added in v0.0.6

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions added in v0.0.6

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type AnswerQuestionJSONRequestBody added in v0.0.6

type AnswerQuestionJSONRequestBody = AnswerRequest

AnswerQuestionJSONRequestBody defines body for AnswerQuestion for application/json ContentType.

type AnswerQuestionParams added in v0.0.6

type AnswerQuestionParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

AnswerQuestionParams defines parameters for AnswerQuestion.

type AnswerRequest added in v0.0.6

type AnswerRequest struct {
	// Limit Caps how many recalled memories ground the answer.
	Limit *int `json:"limit,omitempty"`

	// Metadata Ground only on memories whose top-level metadata contains every listed key=value pair (AND).
	Metadata *map[string]string `json:"metadata,omitempty"`
	Query    string             `json:"query"`

	// Tags Ground only on memories carrying every listed tag (AND).
	Tags  *[]string `json:"tags,omitempty"`
	Tiers *[]Tier   `json:"tiers,omitempty"`
}

AnswerRequest defines model for AnswerRequest.

type AnswerResponse added in v0.0.6

type AnswerResponse struct {
	Answer  string         `json:"answer"`
	Sources []ScoredMemory `json:"sources"`
}

AnswerResponse defines model for AnswerResponse.

type AuthConfig

type AuthConfig struct {
	// APIKey, when non-empty, is required as "Authorization: Bearer <key>".
	APIKey string
	// NamespaceHeader names the request header carrying the tenant namespace.
	NamespaceHeader string
	// DefaultNamespace is used when the header is absent.
	DefaultNamespace string
}

AuthConfig configures the optional bearer-token auth and namespace resolution.

type Briefing added in v0.0.11

type Briefing struct {
	// Facts Durable semantic facts, highest-retention first.
	Facts     *[]Memory `json:"facts,omitempty"`
	Namespace string    `json:"namespace"`

	// Pinned Pinned memories (any tier).
	Pinned *[]Memory `json:"pinned,omitempty"`

	// Procedures Procedural how-to memories, highest-retention first.
	Procedures *[]Memory `json:"procedures,omitempty"`

	// Recent Recent episodic activity, newest first.
	Recent *[]Memory `json:"recent,omitempty"`
}

Briefing defines model for Briefing.

type ChiServerOptions added in v0.0.6

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type ClusterAction added in v0.0.8

type ClusterAction struct {
	RepresentativeId string   `json:"representative_id"`
	Size             int      `json:"size"`
	TombstonedIds    []string `json:"tombstoned_ids"`
}

ClusterAction defines model for ClusterAction.

type DedupReport added in v0.0.8

type DedupReport struct {
	// Actions Per-cluster representative selection. Omitted when no clusters were found.
	Actions       *[]ClusterAction `json:"actions,omitempty"`
	ClustersFound int              `json:"clusters_found"`
	DryRun        bool             `json:"dry_run"`
	MemoriesSeen  int              `json:"memories_seen"`
	Namespaces    int              `json:"namespaces"`
	Tombstoned    int              `json:"tombstoned"`
}

DedupReport defines model for DedupReport.

type DedupRequest added in v0.0.8

type DedupRequest struct {
	// AllNamespaces Run the pass over every namespace instead of just the request's
	// namespace. Defaults to false (scope to the request namespace).
	AllNamespaces *bool `json:"all_namespaces,omitempty"`

	// DryRun Report what would happen without tombstoning anything.
	DryRun *bool `json:"dry_run,omitempty"`

	// MinClusterSize Smallest cluster acted on. 0 falls back to 2.
	MinClusterSize *int `json:"min_cluster_size,omitempty"`

	// NeighboursPerAnchor Per-anchor vector-search fan-out. 0 falls back to 20.
	NeighboursPerAnchor *int `json:"neighbours_per_anchor,omitempty"`

	// Similarity Cosine-like threshold for cluster membership. Higher = stricter
	// (fewer, tighter clusters). 0 falls back to 0.85.
	Similarity *float64 `json:"similarity,omitempty"`

	// Tiers Restrict the pass to these tiers; empty means all.
	Tiers *[]Tier `json:"tiers,omitempty"`
}

DedupRequest Optional knobs for one dedup pass. The zero value uses the production defaults (similarity 0.85, cluster size ≥ 2, all tiers, 20 neighbours per anchor, dry_run false), scoped to the request's namespace.

type DeleteByTagResponse added in v0.0.11

type DeleteByTagResponse struct {
	// Deleted Number of memories deleted
	Deleted int `json:"deleted"`
}

DeleteByTagResponse defines model for DeleteByTagResponse.

type DeleteNamespaceResponse added in v0.0.8

type DeleteNamespaceResponse struct {
	// Deleted Number of memories deleted
	Deleted int `json:"deleted"`
}

DeleteNamespaceResponse defines model for DeleteNamespaceResponse.

type Error added in v0.0.6

type Error struct {
	Error *string `json:"error,omitempty"`
}

Error defines model for Error.

type ForgetByTagParams added in v0.0.11

type ForgetByTagParams struct {
	// Tag Exact tag a memory must carry to be deleted.
	Tag string `form:"tag" json:"tag"`

	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

ForgetByTagParams defines parameters for ForgetByTag.

type ForgetMemoryParams added in v0.0.6

type ForgetMemoryParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

ForgetMemoryParams defines parameters for ForgetMemory.

type FsckReport added in v0.0.6

type FsckReport struct {
	DuplicateGroups  *[][]string `json:"duplicate_groups,omitempty"`
	ExpiredPurged    int         `json:"expired_purged"`
	Namespaces       int         `json:"namespaces"`
	ShortTermEvicted int         `json:"short_term_evicted"`
}

FsckReport defines model for FsckReport.

type GetBriefingParams added in v0.0.11

type GetBriefingParams struct {
	// PerSection Max memories per section (facts/procedures/recent). Default 5.
	PerSection *int `form:"per_section,omitempty" json:"per_section,omitempty"`
}

GetBriefingParams defines parameters for GetBriefing.

type GetMemoryParams added in v0.0.6

type GetMemoryParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

GetMemoryParams defines parameters for GetMemory.

type GetStatsParams added in v0.0.6

type GetStatsParams struct {
	// AllNamespaces Aggregate counts across every namespace, ignoring the namespace header. Returns a single merged overview (namespace reported as "") so the admin UI's "All projects" view fetches one response instead of one request per namespace.
	AllNamespaces *bool `form:"all_namespaces,omitempty" json:"all_namespaces,omitempty"`

	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

GetStatsParams defines parameters for GetStats.

type InvalidParamFormatError added in v0.0.6

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error added in v0.0.6

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap added in v0.0.6

func (e *InvalidParamFormatError) Unwrap() error

type ListMemoriesParams added in v0.0.6

type ListMemoriesParams struct {
	// Tier Repeatable and/or comma-separated tier filter; omitted means all tiers.
	Tier *[]Tier `form:"tier,omitempty" json:"tier,omitempty"`

	// Tag Repeatable and/or comma-separated tag filter; a memory must carry every listed tag (AND).
	Tag *[]string `form:"tag,omitempty" json:"tag,omitempty"`

	// Meta Repeatable metadata filter in "key=value" form; a memory's top-level metadata must contain every listed pair (AND). Only string values match.
	Meta              *[]string `form:"meta,omitempty" json:"meta,omitempty"`
	IncludeExpired    *bool     `form:"include_expired,omitempty" json:"include_expired,omitempty"`
	IncludeSuperseded *bool     `form:"include_superseded,omitempty" json:"include_superseded,omitempty"`

	// Limit Caps the result count; 0 or absent returns all matches.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// AllNamespaces Aggregate across every namespace, ignoring the namespace header. The server merges all namespaces and applies limit as a single global cap (newest first), so the admin UI's "All projects" view fetches one response instead of one request per namespace.
	AllNamespaces *bool `form:"all_namespaces,omitempty" json:"all_namespaces,omitempty"`

	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

ListMemoriesParams defines parameters for ListMemories.

type ListResponse added in v0.0.6

type ListResponse struct {
	Memories []Memory `json:"memories"`
}

ListResponse defines model for ListResponse.

type Memory added in v0.0.6

type Memory struct {
	AccessCount int `json:"access_count"`

	// Confidence Corroboration of a durable fact in [0,1]; null when not tracked.
	Confidence     *float64                `json:"confidence,omitempty"`
	Content        string                  `json:"content"`
	CreatedAt      time.Time               `json:"created_at"`
	ExpiresAt      *time.Time              `json:"expires_at,omitempty"`
	Id             string                  `json:"id"`
	Importance     float64                 `json:"importance"`
	LastAccessedAt time.Time               `json:"last_accessed_at"`
	Metadata       *map[string]interface{} `json:"metadata,omitempty"`
	Namespace      string                  `json:"namespace"`
	Summary        *string                 `json:"summary,omitempty"`
	SupersededBy   *string                 `json:"superseded_by,omitempty"`
	Tags           *[]string               `json:"tags,omitempty"`
	Tier           Tier                    `json:"tier"`
	UpdatedAt      time.Time               `json:"updated_at"`

	// ValidFrom Start of the wall-clock interval the fact was true; null means open ("always, until valid_to"). Used by time-travel (as_of) recall.
	ValidFrom *time.Time `json:"valid_from,omitempty"`

	// ValidTo End of the interval the fact was true; null means open ("still true"). Stamped automatically when a fact is superseded.
	ValidTo *time.Time `json:"valid_to,omitempty"`
}

Memory defines model for Memory.

type MiddlewareFunc added in v0.0.6

type MiddlewareFunc func(http.Handler) http.Handler

type Namespace added in v0.0.6

type Namespace = string

Namespace defines model for Namespace.

type NamespacesResponse added in v0.0.6

type NamespacesResponse struct {
	Namespaces []string `json:"namespaces"`
}

NamespacesResponse defines model for NamespacesResponse.

type RememberMemoryJSONRequestBody added in v0.0.6

type RememberMemoryJSONRequestBody = RememberRequest

RememberMemoryJSONRequestBody defines body for RememberMemory for application/json ContentType.

type RememberMemoryParams added in v0.0.6

type RememberMemoryParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

RememberMemoryParams defines parameters for RememberMemory.

type RememberRequest added in v0.0.6

type RememberRequest struct {
	// Confidence Seed corroboration for a durable fact (e.g. a trusted import). Omit to use the default seed; ignored for short-term tiers.
	Confidence *float64 `json:"confidence,omitempty"`
	Content    string   `json:"content"`

	// Id Upserts an existing memory when provided.
	Id         *string                 `json:"id,omitempty"`
	Importance *float64                `json:"importance,omitempty"`
	Metadata   *map[string]interface{} `json:"metadata,omitempty"`
	Summary    *string                 `json:"summary,omitempty"`
	Tags       *[]string               `json:"tags,omitempty"`
	Tier       *Tier                   `json:"tier,omitempty"`

	// TtlSeconds Overrides the tier default TTL; negative means never expire.
	TtlSeconds *int `json:"ttl_seconds,omitempty"`

	// ValidFrom Start of the interval the fact was true. Defaults to now; backdate it to record a historical fact so time-travel (as_of) recall surfaces it.
	ValidFrom *time.Time `json:"valid_from,omitempty"`

	// ValidTo End of the interval the fact was true (for recording a fact that was true only in the past). Omit for a fact that is still true.
	ValidTo *time.Time `json:"valid_to,omitempty"`
}

RememberRequest defines model for RememberRequest.

type RequiredHeaderError added in v0.0.6

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error added in v0.0.6

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap added in v0.0.6

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError added in v0.0.6

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error added in v0.0.6

func (e *RequiredParamError) Error() string

type RunDedupJSONRequestBody added in v0.0.8

type RunDedupJSONRequestBody = DedupRequest

RunDedupJSONRequestBody defines body for RunDedup for application/json ContentType.

type RunDedupParams added in v0.0.8

type RunDedupParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

RunDedupParams defines parameters for RunDedup.

type RunFsckParams added in v0.0.6

type RunFsckParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

RunFsckParams defines parameters for RunFsck.

type ScoredMemory added in v0.0.6

type ScoredMemory struct {
	Memory Memory  `json:"memory"`
	Score  float64 `json:"score"`
}

ScoredMemory defines model for ScoredMemory.

type SearchMemoriesJSONRequestBody added in v0.0.6

type SearchMemoriesJSONRequestBody = SearchRequest

SearchMemoriesJSONRequestBody defines body for SearchMemories for application/json ContentType.

type SearchMemoriesParams added in v0.0.6

type SearchMemoriesParams struct {
	// XMeminiNamespace Tenant/agent namespace; falls back to the server default.
	XMeminiNamespace *Namespace `json:"X-Memini-Namespace,omitempty"`
}

SearchMemoriesParams defines parameters for SearchMemories.

type SearchRequest added in v0.0.6

type SearchRequest struct {
	// AsOf Time-travel recall: return facts whose validity window contained this instant (including ones since superseded), for "what was true then" queries.
	AsOf *time.Time `json:"as_of,omitempty"`

	// ExcludeMetadata Drop memories whose top-level metadata carries any of these key=value pairs (the inverse of metadata). Lets a caller keep its own just-written memories out of recall — e.g. excluding the current session's captured turns so they are not echoed back as memory.
	ExcludeMetadata   *map[string]string `json:"exclude_metadata,omitempty"`
	IncludeExpired    *bool              `json:"include_expired,omitempty"`
	IncludeSuperseded *bool              `json:"include_superseded,omitempty"`
	Limit             *int               `json:"limit,omitempty"`

	// Metadata A memory's top-level metadata must contain every listed key=value pair (AND).
	Metadata *map[string]string `json:"metadata,omitempty"`
	Query    string             `json:"query"`

	// Scope exact (default) searches only the request namespace; subtree also searches namespaces nested under it ("project" reads "project/agent"), for the multi-agent read-shared-plus-private pattern.
	Scope *SearchRequestScope `json:"scope,omitempty"`

	// Tags A memory must carry every listed tag (AND).
	Tags  *[]string `json:"tags,omitempty"`
	Tiers *[]Tier   `json:"tiers,omitempty"`
}

SearchRequest defines model for SearchRequest.

type SearchRequestScope added in v0.0.11

type SearchRequestScope string

SearchRequestScope exact (default) searches only the request namespace; subtree also searches namespaces nested under it ("project" reads "project/agent"), for the multi-agent read-shared-plus-private pattern.

const (
	Exact   SearchRequestScope = "exact"
	Subtree SearchRequestScope = "subtree"
)

Defines values for SearchRequestScope.

func (SearchRequestScope) Valid added in v0.0.11

func (e SearchRequestScope) Valid() bool

Valid indicates whether the value is a known member of the SearchRequestScope enum.

type SearchResponse added in v0.0.6

type SearchResponse struct {
	Results []ScoredMemory `json:"results"`
}

SearchResponse defines model for SearchResponse.

type Server added in v0.0.6

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

Server implements the spec-generated ServerInterface backed by a service.Service.

func New

func New(svc *service.Service, auth AuthConfig) *Server

New builds the REST server.

func (*Server) AnswerQuestion added in v0.0.6

func (h *Server) AnswerQuestion(w http.ResponseWriter, r *http.Request, _ AnswerQuestionParams)

AnswerQuestion implements POST /v1/answer.

func (*Server) DeleteNamespace added in v0.0.8

func (h *Server) DeleteNamespace(w http.ResponseWriter, r *http.Request, name string)

DeleteNamespace implements DELETE /v1/namespaces/{name}.

func (*Server) ForgetByTag added in v0.0.11

func (h *Server) ForgetByTag(w http.ResponseWriter, r *http.Request, params ForgetByTagParams)

ForgetByTag implements DELETE /v1/memories?tag=... — bulk-delete every memory in the namespace carrying the tag. The tag is required (spec-enforced) so a missing tag cannot delete the whole namespace.

func (*Server) ForgetMemory added in v0.0.6

func (h *Server) ForgetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ ForgetMemoryParams)

ForgetMemory implements DELETE /v1/memories/{id}.

func (*Server) GetBriefing added in v0.0.11

func (h *Server) GetBriefing(w http.ResponseWriter, r *http.Request, name string, params GetBriefingParams)

GetBriefing implements GET /v1/namespaces/{name}/briefing.

func (*Server) GetMemory added in v0.0.6

func (h *Server) GetMemory(w http.ResponseWriter, r *http.Request, boundID string, _ GetMemoryParams)

GetMemory implements GET /v1/memories/{id}.

func (*Server) GetStats added in v0.0.6

func (h *Server) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)

GetStats implements GET /v1/stats.

func (*Server) ListMemories added in v0.0.6

func (h *Server) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)

ListMemories implements GET /v1/memories.

func (*Server) ListNamespaces added in v0.0.6

func (h *Server) ListNamespaces(w http.ResponseWriter, r *http.Request)

ListNamespaces implements GET /v1/namespaces.

Unlike the other /v1 routes it is not namespace-scoped: it deliberately spans tenants. memini authenticates with a single MEMINI_API_KEY that already grants access to any namespace (the caller picks it via the namespace header), so enumerating namespaces confers no extra privilege. If memini ever grows per-tenant credentials, this endpoint must be gated behind an admin scope.

func (*Server) Mount added in v0.0.6

func (h *Server) Mount(r chi.Router)

Mount attaches the spec-generated /v1 routes to r, wrapped in namespace + auth middleware. Binding failures on declared parameters (e.g. ?limit=abc) are rejected with 400 by the generated wrappers.

func (*Server) RememberMemory added in v0.0.6

func (h *Server) RememberMemory(w http.ResponseWriter, r *http.Request, _ RememberMemoryParams)

RememberMemory implements POST /v1/memories.

func (*Server) RunDedup added in v0.0.8

func (h *Server) RunDedup(w http.ResponseWriter, r *http.Request, _ RunDedupParams)

RunDedup implements POST /v1/dedup. The optional body tunes the pass; the zero value uses the production defaults. The pass is scoped to the request's namespace unless all_namespaces is set. Dry-run reports what would happen without tombstoning.

func (*Server) RunFsck added in v0.0.6

func (h *Server) RunFsck(w http.ResponseWriter, r *http.Request, _ RunFsckParams)

RunFsck implements POST /v1/fsck.

func (*Server) SearchMemories added in v0.0.6

func (h *Server) SearchMemories(w http.ResponseWriter, r *http.Request, _ SearchMemoriesParams)

SearchMemories implements POST /v1/search.

type ServerInterface added in v0.0.6

type ServerInterface interface {
	// Recall memories and answer a question grounded on them (requires an LLM)
	// (POST /v1/answer)
	AnswerQuestion(w http.ResponseWriter, r *http.Request, params AnswerQuestionParams)
	// Collapse near-duplicate memories (vector cluster) — tombstone the lower-scored members of each cluster
	// (POST /v1/dedup)
	RunDedup(w http.ResponseWriter, r *http.Request, params RunDedupParams)
	// Run a consistency sweep (purge expired, enforce short-term cap, audit duplicates)
	// (POST /v1/fsck)
	RunFsck(w http.ResponseWriter, r *http.Request, params RunFsckParams)
	// Delete every memory in the namespace carrying a tag
	// (DELETE /v1/memories)
	ForgetByTag(w http.ResponseWriter, r *http.Request, params ForgetByTagParams)
	// List memories in a namespace (backs the admin UI browser)
	// (GET /v1/memories)
	ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)
	// Remember (store) a memory
	// (POST /v1/memories)
	RememberMemory(w http.ResponseWriter, r *http.Request, params RememberMemoryParams)
	// Forget (delete) a memory
	// (DELETE /v1/memories/{id})
	ForgetMemory(w http.ResponseWriter, r *http.Request, id string, params ForgetMemoryParams)
	// Fetch a memory by ID
	// (GET /v1/memories/{id})
	GetMemory(w http.ResponseWriter, r *http.Request, id string, params GetMemoryParams)
	// List the distinct namespaces holding memories
	// (GET /v1/namespaces)
	ListNamespaces(w http.ResponseWriter, r *http.Request)
	// Delete every memory in a namespace
	// (DELETE /v1/namespaces/{name})
	DeleteNamespace(w http.ResponseWriter, r *http.Request, name string)
	// Layered session-start briefing for a namespace
	// (GET /v1/namespaces/{name}/briefing)
	GetBriefing(w http.ResponseWriter, r *http.Request, name string, params GetBriefingParams)
	// Recall memories via hybrid (vector + keyword) search
	// (POST /v1/search)
	SearchMemories(w http.ResponseWriter, r *http.Request, params SearchMemoriesParams)
	// Per-namespace overview (counts by tier, accesses, importance)
	// (GET /v1/stats)
	GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper added in v0.0.6

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AnswerQuestion added in v0.0.6

func (siw *ServerInterfaceWrapper) AnswerQuestion(w http.ResponseWriter, r *http.Request)

AnswerQuestion operation middleware

func (*ServerInterfaceWrapper) DeleteNamespace added in v0.0.8

func (siw *ServerInterfaceWrapper) DeleteNamespace(w http.ResponseWriter, r *http.Request)

DeleteNamespace operation middleware

func (*ServerInterfaceWrapper) ForgetByTag added in v0.0.11

func (siw *ServerInterfaceWrapper) ForgetByTag(w http.ResponseWriter, r *http.Request)

ForgetByTag operation middleware

func (*ServerInterfaceWrapper) ForgetMemory added in v0.0.6

func (siw *ServerInterfaceWrapper) ForgetMemory(w http.ResponseWriter, r *http.Request)

ForgetMemory operation middleware

func (*ServerInterfaceWrapper) GetBriefing added in v0.0.11

func (siw *ServerInterfaceWrapper) GetBriefing(w http.ResponseWriter, r *http.Request)

GetBriefing operation middleware

func (*ServerInterfaceWrapper) GetMemory added in v0.0.6

func (siw *ServerInterfaceWrapper) GetMemory(w http.ResponseWriter, r *http.Request)

GetMemory operation middleware

func (*ServerInterfaceWrapper) GetStats added in v0.0.6

func (siw *ServerInterfaceWrapper) GetStats(w http.ResponseWriter, r *http.Request)

GetStats operation middleware

func (*ServerInterfaceWrapper) ListMemories added in v0.0.6

func (siw *ServerInterfaceWrapper) ListMemories(w http.ResponseWriter, r *http.Request)

ListMemories operation middleware

func (*ServerInterfaceWrapper) ListNamespaces added in v0.0.6

func (siw *ServerInterfaceWrapper) ListNamespaces(w http.ResponseWriter, r *http.Request)

ListNamespaces operation middleware

func (*ServerInterfaceWrapper) RememberMemory added in v0.0.6

func (siw *ServerInterfaceWrapper) RememberMemory(w http.ResponseWriter, r *http.Request)

RememberMemory operation middleware

func (*ServerInterfaceWrapper) RunDedup added in v0.0.8

func (siw *ServerInterfaceWrapper) RunDedup(w http.ResponseWriter, r *http.Request)

RunDedup operation middleware

func (*ServerInterfaceWrapper) RunFsck added in v0.0.6

RunFsck operation middleware

func (*ServerInterfaceWrapper) SearchMemories added in v0.0.6

func (siw *ServerInterfaceWrapper) SearchMemories(w http.ResponseWriter, r *http.Request)

SearchMemories operation middleware

type Stats added in v0.0.6

type Stats struct {
	AvgImportance float64 `json:"avg_importance"`

	// ByMemoryType Live count per typed-extraction memory_type (decision/preference/problem).
	ByMemoryType *map[string]int `json:"by_memory_type,omitempty"`
	ByTier       map[string]int  `json:"by_tier"`
	Expired      int             `json:"expired"`
	LastWriteAt  *time.Time      `json:"last_write_at,omitempty"`

	// LowConfidenceDurable Live durable memories whose decayed confidence is below the demote floor — reclaimable, uncorroborated debris.
	LowConfidenceDurable int    `json:"low_confidence_durable"`
	Namespace            string `json:"namespace"`
	Superseded           int    `json:"superseded"`

	// Total Live memories (excludes expired/superseded)
	Total         int `json:"total"`
	TotalAccesses int `json:"total_accesses"`
}

Stats defines model for Stats.

type Tier added in v0.0.6

type Tier string

Tier defines model for Tier.

const (
	Episodic   Tier = "episodic"
	Procedural Tier = "procedural"
	Semantic   Tier = "semantic"
	Working    Tier = "working"
)

Defines values for Tier.

func (Tier) Valid added in v0.0.6

func (e Tier) Valid() bool

Valid indicates whether the value is a known member of the Tier enum.

type TooManyValuesForParamError added in v0.0.6

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error added in v0.0.6

type UnescapedCookieParamError added in v0.0.6

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error added in v0.0.6

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap added in v0.0.6

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented added in v0.0.6

type Unimplemented struct{}

func (Unimplemented) AnswerQuestion added in v0.0.6

func (_ Unimplemented) AnswerQuestion(w http.ResponseWriter, r *http.Request, params AnswerQuestionParams)

Recall memories and answer a question grounded on them (requires an LLM) (POST /v1/answer)

func (Unimplemented) DeleteNamespace added in v0.0.8

func (_ Unimplemented) DeleteNamespace(w http.ResponseWriter, r *http.Request, name string)

Delete every memory in a namespace (DELETE /v1/namespaces/{name})

func (Unimplemented) ForgetByTag added in v0.0.11

func (_ Unimplemented) ForgetByTag(w http.ResponseWriter, r *http.Request, params ForgetByTagParams)

Delete every memory in the namespace carrying a tag (DELETE /v1/memories)

func (Unimplemented) ForgetMemory added in v0.0.6

func (_ Unimplemented) ForgetMemory(w http.ResponseWriter, r *http.Request, id string, params ForgetMemoryParams)

Forget (delete) a memory (DELETE /v1/memories/{id})

func (Unimplemented) GetBriefing added in v0.0.11

func (_ Unimplemented) GetBriefing(w http.ResponseWriter, r *http.Request, name string, params GetBriefingParams)

Layered session-start briefing for a namespace (GET /v1/namespaces/{name}/briefing)

func (Unimplemented) GetMemory added in v0.0.6

func (_ Unimplemented) GetMemory(w http.ResponseWriter, r *http.Request, id string, params GetMemoryParams)

Fetch a memory by ID (GET /v1/memories/{id})

func (Unimplemented) GetStats added in v0.0.6

func (_ Unimplemented) GetStats(w http.ResponseWriter, r *http.Request, params GetStatsParams)

Per-namespace overview (counts by tier, accesses, importance) (GET /v1/stats)

func (Unimplemented) ListMemories added in v0.0.6

func (_ Unimplemented) ListMemories(w http.ResponseWriter, r *http.Request, params ListMemoriesParams)

List memories in a namespace (backs the admin UI browser) (GET /v1/memories)

func (Unimplemented) ListNamespaces added in v0.0.6

func (_ Unimplemented) ListNamespaces(w http.ResponseWriter, r *http.Request)

List the distinct namespaces holding memories (GET /v1/namespaces)

func (Unimplemented) RememberMemory added in v0.0.6

func (_ Unimplemented) RememberMemory(w http.ResponseWriter, r *http.Request, params RememberMemoryParams)

Remember (store) a memory (POST /v1/memories)

func (Unimplemented) RunDedup added in v0.0.8

func (_ Unimplemented) RunDedup(w http.ResponseWriter, r *http.Request, params RunDedupParams)

Collapse near-duplicate memories (vector cluster) — tombstone the lower-scored members of each cluster (POST /v1/dedup)

func (Unimplemented) RunFsck added in v0.0.6

func (_ Unimplemented) RunFsck(w http.ResponseWriter, r *http.Request, params RunFsckParams)

Run a consistency sweep (purge expired, enforce short-term cap, audit duplicates) (POST /v1/fsck)

func (Unimplemented) SearchMemories added in v0.0.6

func (_ Unimplemented) SearchMemories(w http.ResponseWriter, r *http.Request, params SearchMemoriesParams)

Recall memories via hybrid (vector + keyword) search (POST /v1/search)

type UnmarshalingParamError added in v0.0.6

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error added in v0.0.6

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap added in v0.0.6

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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