Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Candidate ¶
type Candidate struct {
ChunkID string
EntryID string
WorkspaceID string
Scope memcontract.Scope
AgentName string
AgentTier memcontract.AgentTier
Type memcontract.Type
Slug string
Filename string
Title string
Body string
ContentHash string
ModTime time.Time
Injection bool
UnicodeScore float64
TrigramScore float64
RecallScore float64
}
Candidate is one catalog chunk candidate returned by the storage source.
type Option ¶
type Option func(*Recaller)
Option customizes a deterministic Recaller.
func WithLogger ¶
WithLogger injects the logger used for failure-safe side effects.
func WithSignalRecorder ¶
func WithSignalRecorder(recorder *SignalRecorder) Option
WithSignalRecorder moves recall-signal writes onto a bounded async worker.
func WithWeights ¶
WithWeights overrides the deterministic score-fusion weights.
type Recaller ¶
type Recaller struct {
// contains filtered or unexported fields
}
Recaller implements deterministic Slice 1 recall.
func (*Recaller) Recall ¶
func (r *Recaller) Recall( ctx context.Context, query memcontract.Query, opts memcontract.RecallOptions, ) (memcontract.Packaged, error)
Recall returns a prompt-ready package using deterministic lexical ranking.
type Shadow ¶
type Shadow struct {
WinnerChunkID string
LoserChunkID string
WorkspaceID string
Scope memcontract.Scope
AgentName string
AgentTier memcontract.AgentTier
Type memcontract.Type
Slug string
}
Shadow records one candidate suppressed by a deeper scope owner.
type Signal ¶
type Signal struct {
ChunkID string
WorkspaceID string
SurfaceID string
Score float64
SurfacedAt time.Time
SessionID string
SignalReason string
}
Signal records that one chunk was surfaced by recall.
type SignalRecorder ¶
type SignalRecorder struct {
// contains filtered or unexported fields
}
SignalRecorder owns the bounded async write path for recall signals.
func NewSignalRecorder ¶
func NewSignalRecorder( ctx context.Context, source SignalRecorderSource, cfg SignalRecorderConfig, logger *slog.Logger, ) (*SignalRecorder, error)
NewSignalRecorder starts a bounded worker for one recall-signal authority.
func (*SignalRecorder) Close ¶
func (r *SignalRecorder) Close(ctx context.Context) error
Close stops the worker after draining already-queued batches.
func (*SignalRecorder) Stats ¶
func (r *SignalRecorder) Stats() SignalRecorderStats
Stats returns the current queue depth and cumulative worker counters.
func (*SignalRecorder) Submit ¶
func (r *SignalRecorder) Submit( _ context.Context, query memcontract.Query, signals []Signal, ) SignalRecorderSubmitResult
Submit enqueues recall signals without waiting for catalog writes.
type SignalRecorderConfig ¶
SignalRecorderConfig controls the bounded asynchronous recall-signal worker.
type SignalRecorderSource ¶
type SignalRecorderSource interface {
RecordRecall(ctx context.Context, signals []Signal) error
RecordRecallSignalFailed(ctx context.Context, query memcontract.Query, cause error) error
RecordRecallSignalDropped(ctx context.Context, query memcontract.Query, signals []Signal, queueDepth int) error
}
SignalRecorderSource persists recall signal side effects for the worker.
type SignalRecorderStats ¶
type SignalRecorderStats struct {
Submitted uint64
Recorded uint64
Dropped uint64
Failed uint64
QueueDepth int
}
SignalRecorderStats is a point-in-time snapshot of recorder counters.
type SignalRecorderSubmitResult ¶
SignalRecorderSubmitResult describes whether Submit accepted the batch and whether it had to drop an older queued batch first.
type Source ¶
type Source interface {
Candidates(ctx context.Context, query memcontract.Query, opts memcontract.RecallOptions) ([]Candidate, error)
RecordRecall(ctx context.Context, signals []Signal) error
RecordRecallExecuted(ctx context.Context, query memcontract.Query, resultCount int) error
RecordRecallSkipped(ctx context.Context, query memcontract.Query, reason string) error
RecordRecallSignalFailed(ctx context.Context, query memcontract.Query, cause error) error
RecordRecallSignalDropped(ctx context.Context, query memcontract.Query, signals []Signal, queueDepth int) error
RecordShadow(ctx context.Context, shadow Shadow) error
}
Source supplies candidates and stores recall side effects.