repository

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextRepositoryV2 added in v1.2.2

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

ContextRepositoryV2 handles context snapshot data operations with PocketBase

func NewContextRepositoryV2 added in v1.2.2

func NewContextRepositoryV2(app *pocketbase.PocketBase) *ContextRepositoryV2

NewContextRepositoryV2 creates a new context repository

func (*ContextRepositoryV2) CreateContextSnapshot added in v1.2.2

CreateContextSnapshot creates a new context snapshot in PocketBase

func (*ContextRepositoryV2) DeleteContextSnapshot added in v1.2.2

func (r *ContextRepositoryV2) DeleteContextSnapshot(ctx context.Context, id string) error

DeleteContextSnapshot deletes a context snapshot by ID from PocketBase

func (*ContextRepositoryV2) GetContextSnapshot added in v1.2.2

func (r *ContextRepositoryV2) GetContextSnapshot(ctx context.Context, id string) (*models.ContextSnapshot, error)

GetContextSnapshot retrieves a context snapshot by ID from PocketBase

func (*ContextRepositoryV2) ListContextSnapshots added in v1.2.2

ListContextSnapshots lists context snapshots based on criteria

func (*ContextRepositoryV2) UpdateContextSnapshot added in v1.2.2

UpdateContextSnapshot updates an existing context snapshot in PocketBase

type MemoryRepository

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

MemoryRepository handles all database operations for memory management

func NewMemoryRepository

func NewMemoryRepository(db *sql.DB, logger *log.Logger) *MemoryRepository

NewMemoryRepository creates a new memory repository

func (*MemoryRepository) AnalyzeRiskCorrelation

func (r *MemoryRepository) AnalyzeRiskCorrelation(ctx context.Context, sessionID string) ([]*models.RiskCorrelation, error)

AnalyzeRiskCorrelation analyzes correlations between vulnerabilities

func (*MemoryRepository) BatchCreateMemoryEntries

func (r *MemoryRepository) BatchCreateMemoryEntries(ctx context.Context, sessionID string, requests []*models.CreateMemoryEntryRequest) ([]*models.MemoryEntry, error)

BatchCreateMemoryEntries creates multiple memory entries in a single transaction

func (*MemoryRepository) BatchDeleteMemoryEntries

func (r *MemoryRepository) BatchDeleteMemoryEntries(ctx context.Context, memoryIDs []string) error

BatchDeleteMemoryEntries deletes multiple memory entries in a single transaction

func (*MemoryRepository) BatchUpdateMemoryEntries

func (r *MemoryRepository) BatchUpdateMemoryEntries(ctx context.Context, updates []*models.UpdateMemoryEntryRequest) ([]*models.MemoryEntry, error)

BatchUpdateMemoryEntries updates multiple memory entries in a single transaction

func (*MemoryRepository) CalculateSemanticSimilarity

func (r *MemoryRepository) CalculateSemanticSimilarity(embedding1, embedding2 []float64) (float64, error)

CalculateSemanticSimilarity calculates similarity between two embeddings (placeholder)

func (*MemoryRepository) CheckForDuplicateMemories

func (r *MemoryRepository) CheckForDuplicateMemories(ctx context.Context, sessionID string) error

CheckForDuplicateMemories checks for potential duplicate memories and creates notifications

func (*MemoryRepository) CheckForDuplicates

func (r *MemoryRepository) CheckForDuplicates(ctx context.Context, sessionID, title, content string) ([]models.MemoryEntry, error)

CheckForDuplicates checks if a memory entry is a duplicate of existing entries

func (*MemoryRepository) CheckForHighPriorityMemories

func (r *MemoryRepository) CheckForHighPriorityMemories(ctx context.Context, sessionID string) error

CheckForHighPriorityMemories checks for high-priority memories and creates notifications

func (*MemoryRepository) CleanupLowPriorityMemories

func (r *MemoryRepository) CleanupLowPriorityMemories(ctx context.Context, maxPriority int, maxConfidence float64, dryRun bool) (int, error)

CleanupLowPriorityMemories removes memories with low priority and confidence

func (*MemoryRepository) CleanupOldMemories

func (r *MemoryRepository) CleanupOldMemories(ctx context.Context, maxAgeDays int, dryRun bool) (int, error)

CleanupOldMemories removes memories older than the specified age

func (*MemoryRepository) CleanupUnusedMemories

func (r *MemoryRepository) CleanupUnusedMemories(ctx context.Context, maxUnusedDays int, dryRun bool) (int, error)

CleanupUnusedMemories removes memories that haven't been accessed recently

func (*MemoryRepository) CreateCleanupNotification

func (r *MemoryRepository) CreateCleanupNotification(ctx context.Context, cleanupType string, count int, sessionID string) error

CreateCleanupNotification creates a notification when cleanup operations are performed

func (*MemoryRepository) CreateContextSnapshot

func (r *MemoryRepository) CreateContextSnapshot(ctx context.Context, sessionID, name, description string, contextData map[string]interface{}) (*models.ContextSnapshot, error)

CreateContextSnapshot creates a snapshot of the current context for a session

func (*MemoryRepository) CreateMemoryCreatedNotification

func (r *MemoryRepository) CreateMemoryCreatedNotification(ctx context.Context, memory *models.MemoryEntry) error

CreateMemoryCreatedNotification creates a notification when a memory is created

func (*MemoryRepository) CreateMemoryEntry

CreateMemoryEntry creates a new memory entry

func (*MemoryRepository) CreateMemoryFromTemplate

func (r *MemoryRepository) CreateMemoryFromTemplate(ctx context.Context, sessionID, templateName string, replacements map[string]string) (*models.MemoryEntry, error)

CreateMemoryFromTemplate creates a memory entry from a predefined template

func (*MemoryRepository) CreateNotification

func (r *MemoryRepository) CreateNotification(ctx context.Context, notification *Notification) error

CreateNotification creates a new notification

func (*MemoryRepository) CreateRelationship

CreateRelationship creates a relationship between two memory entries

func (*MemoryRepository) CreateSession

func (r *MemoryRepository) CreateSession(ctx context.Context, session *models.Session) error

CreateSession creates a new session

func (*MemoryRepository) CreateTaskProgress

func (r *MemoryRepository) CreateTaskProgress(ctx context.Context, sessionID, taskName, stage, status, notes string, progressPercentage int) (*models.TaskProgress, error)

CreateTaskProgress creates a new task progress entry

func (*MemoryRepository) ExportSessionData

func (r *MemoryRepository) ExportSessionData(ctx context.Context, sessionID string) (map[string]interface{}, error)

ExportSessionData exports all data for a session in JSON format

func (*MemoryRepository) FindSimilarMemories

func (r *MemoryRepository) FindSimilarMemories(ctx context.Context, sessionID, content string, threshold float64) ([]models.MemoryEntry, error)

FindSimilarMemories finds memories similar to the given content

func (*MemoryRepository) GenerateEmbedding

func (r *MemoryRepository) GenerateEmbedding(ctx context.Context, text string) ([]float64, error)

GenerateEmbedding generates an embedding for text (placeholder for future implementation)

func (*MemoryRepository) GetCVEMapping

func (r *MemoryRepository) GetCVEMapping(ctx context.Context, sessionID, cweID string) (*models.CVEMapping, error)

GetCVEMapping retrieves CVE mapping for a CWE

func (*MemoryRepository) GetContextSnapshot

func (r *MemoryRepository) GetContextSnapshot(ctx context.Context, snapshotID string) (*models.ContextSnapshot, error)

GetContextSnapshot retrieves a context snapshot by ID

func (*MemoryRepository) GetDetailedMemoryInfo

func (r *MemoryRepository) GetDetailedMemoryInfo(ctx context.Context, memoryID string) (map[string]interface{}, error)

GetDetailedMemoryInfo returns comprehensive information about a memory entry for debugging

func (*MemoryRepository) GetMemoryEntry

func (r *MemoryRepository) GetMemoryEntry(ctx context.Context, entryID string) (*models.MemoryEntry, error)

GetMemoryEntry retrieves a memory entry by ID and updates access tracking

func (*MemoryRepository) GetMemoryStats

func (r *MemoryRepository) GetMemoryStats(ctx context.Context) (map[string]interface{}, error)

GetMemoryStats returns statistics about memory usage and aging

func (*MemoryRepository) GetNotifications

func (r *MemoryRepository) GetNotifications(ctx context.Context, sessionID string, limit int, offset int) ([]*Notification, error)

GetNotifications retrieves notifications for a session

func (*MemoryRepository) GetRelatedEntries

func (r *MemoryRepository) GetRelatedEntries(ctx context.Context, entryID string, relationshipType string, limit int) ([]*models.MemoryEntry, error)

GetRelatedEntries retrieves entries related to a given entry

func (*MemoryRepository) GetSecurityTemplates

func (r *MemoryRepository) GetSecurityTemplates() map[string]interface{}

GetSecurityTemplates returns predefined templates for common security patterns

func (*MemoryRepository) GetSession

func (r *MemoryRepository) GetSession(ctx context.Context, sessionID string) (*models.Session, error)

GetSession retrieves a session by ID

func (*MemoryRepository) GetSystemDiagnostics

func (r *MemoryRepository) GetSystemDiagnostics(ctx context.Context) (map[string]interface{}, error)

GetSystemDiagnostics returns comprehensive system diagnostics for debugging

func (*MemoryRepository) GetTaskProgress

func (r *MemoryRepository) GetTaskProgress(ctx context.Context, taskID string) (*models.TaskProgress, error)

GetTaskProgress retrieves a task progress entry by ID

func (*MemoryRepository) ImportSessionData

func (r *MemoryRepository) ImportSessionData(ctx context.Context, importData map[string]interface{}) (string, error)

ImportSessionData imports session data from JSON format

func (*MemoryRepository) ListContextSnapshots

func (r *MemoryRepository) ListContextSnapshots(ctx context.Context, sessionID string, limit, offset int) ([]*models.ContextSnapshot, error)

ListContextSnapshots lists context snapshots for a session

func (*MemoryRepository) ListSessions

func (r *MemoryRepository) ListSessions(ctx context.Context, taskType string, status string, limit, offset int) ([]*models.Session, error)

ListSessions retrieves all sessions with optional filtering

func (*MemoryRepository) ListTaskProgress

func (r *MemoryRepository) ListTaskProgress(ctx context.Context, sessionID string, status string, limit, offset int) ([]*models.TaskProgress, error)

ListTaskProgress lists task progress entries for a session

func (*MemoryRepository) MapToCVE

func (r *MemoryRepository) MapToCVE(ctx context.Context, sessionID, cweID string) (*models.CVEMapping, error)

MapToCVE maps a CWE to known CVE entries

func (*MemoryRepository) MapToCompliance

func (r *MemoryRepository) MapToCompliance(ctx context.Context, sessionID, standard string) (*models.ComplianceMapping, error)

MapToCompliance maps vulnerabilities to compliance standards

func (*MemoryRepository) MarkNotificationRead

func (r *MemoryRepository) MarkNotificationRead(ctx context.Context, notificationID string) error

MarkNotificationRead marks a notification as read

func (*MemoryRepository) SearchMemoryEntries

func (r *MemoryRepository) SearchMemoryEntries(ctx context.Context, req *models.SearchRequest) ([]*models.SearchResult, error)

SearchMemoryEntries performs a search across memory entries

func (*MemoryRepository) SemanticSearch

func (r *MemoryRepository) SemanticSearch(ctx context.Context, query string, sessionID string, limit int) ([]*models.MemoryEntry, error)

SemanticSearch performs semantic search using embeddings (placeholder for future implementation)

func (*MemoryRepository) StoreEmbedding

func (r *MemoryRepository) StoreEmbedding(ctx context.Context, memoryID string, embedding []float64) error

StoreEmbedding stores an embedding for a memory entry (placeholder)

func (*MemoryRepository) UpdateTaskProgress

func (r *MemoryRepository) UpdateTaskProgress(ctx context.Context, taskID, stage, status, notes string, progressPercentage int) (*models.TaskProgress, error)

UpdateTaskProgress updates an existing task progress entry

type MemoryRepositoryV2 added in v1.2.2

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

MemoryRepositoryV2 handles memory data operations with PocketBase

func NewMemoryRepositoryV2 added in v1.2.2

func NewMemoryRepositoryV2(app *pocketbase.PocketBase) *MemoryRepositoryV2

NewMemoryRepositoryV2 creates a new memory repository

func (*MemoryRepositoryV2) DeleteMemory added in v1.2.2

func (r *MemoryRepositoryV2) DeleteMemory(ctx context.Context, id string) error

DeleteMemory deletes a memory entry by ID from PocketBase

func (*MemoryRepositoryV2) GetMemory added in v1.2.2

func (r *MemoryRepositoryV2) GetMemory(ctx context.Context, id string) (*models.Memory, error)

GetMemory retrieves a memory entry by ID from PocketBase

func (*MemoryRepositoryV2) SearchMemories added in v1.2.2

func (r *MemoryRepositoryV2) SearchMemories(ctx context.Context, req *models.MemorySearchRequest) ([]*models.Memory, int, error)

SearchMemories searches for memories based on criteria

func (*MemoryRepositoryV2) StoreMemory added in v1.2.2

StoreMemory creates a new memory entry in PocketBase

func (*MemoryRepositoryV2) UpdateMemory added in v1.2.2

UpdateMemory updates an existing memory entry in PocketBase

type Notification

type Notification struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"` // "memory_created", "memory_updated", "duplicate_found", "high_priority", "cleanup_performed"
	Title     string                 `json:"title"`
	Message   string                 `json:"message"`
	MemoryID  string                 `json:"memory_id,omitempty"`
	SessionID string                 `json:"session_id,omitempty"`
	Priority  int                    `json:"priority"`
	Metadata  map[string]interface{} `json:"metadata"`
	CreatedAt time.Time              `json:"created_at"`
	Read      bool                   `json:"read"`
}

Notification represents a memory-related notification

type NotificationService

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

NotificationService handles real-time memory notifications and alerts

type RelationshipRepositoryV2 added in v1.2.2

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

RelationshipRepositoryV2 handles relationship data operations with PocketBase

func NewRelationshipRepositoryV2 added in v1.2.2

func NewRelationshipRepositoryV2(app *pocketbase.PocketBase) *RelationshipRepositoryV2

NewRelationshipRepositoryV2 creates a new relationship repository

func (*RelationshipRepositoryV2) CreateRelationship added in v1.2.2

CreateRelationship creates a new relationship in PocketBase

func (*RelationshipRepositoryV2) DeleteRelationship added in v1.2.2

func (r *RelationshipRepositoryV2) DeleteRelationship(ctx context.Context, id string) error

DeleteRelationship deletes a relationship by ID from PocketBase

func (*RelationshipRepositoryV2) GetRelationship added in v1.2.2

func (r *RelationshipRepositoryV2) GetRelationship(ctx context.Context, id string) (*models.Relationship, error)

GetRelationship retrieves a relationship by ID from PocketBase

func (*RelationshipRepositoryV2) ListRelationships added in v1.2.2

ListRelationships lists relationships based on criteria

func (*RelationshipRepositoryV2) UpdateRelationship added in v1.2.2

UpdateRelationship updates an existing relationship in PocketBase

type SecurityRepository

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

SecurityRepository handles security data operations

func NewSecurityRepository

func NewSecurityRepository(db *database.Database, logger *log.Logger) *SecurityRepository

NewSecurityRepository creates a new security repository

func (*SecurityRepository) GetSecurityDataSummary

func (r *SecurityRepository) GetSecurityDataSummary(ctx context.Context) (map[string]models.SecurityDataSummary, error)

GetSecurityDataSummary returns a summary of security data

func (*SecurityRepository) QueryATTACK

QueryATTACK searches ATT&CK data based on criteria

func (*SecurityRepository) QueryNVD

QueryNVD searches NVD data based on criteria

func (*SecurityRepository) StoreATTACKDataset

func (r *SecurityRepository) StoreATTACKDataset(ctx context.Context, techniques []models.ATTACKTechnique, tactics []models.ATTACKTactic) error

StoreATTACKDataset stores MITRE ATT&CK data in the database

func (*SecurityRepository) StoreNVDDataset

func (r *SecurityRepository) StoreNVDDataset(ctx context.Context, cves []models.NVDCVE) error

StoreNVDDataset stores NVD CVE data in the database

func (*SecurityRepository) UpdateSecurityDataStatus

func (r *SecurityRepository) UpdateSecurityDataStatus(ctx context.Context, dataSource string, status string, totalRecords *int, errorMessage *string) error

UpdateSecurityDataStatus updates the status of security data updates

type SecurityRepositoryInterface

type SecurityRepositoryInterface interface {
	StoreNVDDataset(ctx context.Context, cves []models.NVDCVE) error
	StoreATTACKDataset(ctx context.Context, techniques []models.ATTACKTechnique, tactics []models.ATTACKTactic) error
	QueryNVD(ctx context.Context, req models.NVDSearchRequest) ([]models.NVDCVE, int, error)
	QueryATTACK(ctx context.Context, req models.ATTACKSearchRequest) ([]models.ATTACKTechnique, int, error)
	GetSecurityDataSummary(ctx context.Context) (map[string]models.SecurityDataSummary, error)
	UpdateSecurityDataStatus(ctx context.Context, dataSource string, status string, totalRecords *int, errorMessage *string) error
}

SecurityRepositoryInterface defines the interface for security data operations

type SessionRepositoryV2 added in v1.2.2

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

SessionRepositoryV2 handles session data operations with PocketBase

func NewSessionRepositoryV2 added in v1.2.2

func NewSessionRepositoryV2(app *pocketbase.PocketBase) *SessionRepositoryV2

NewSessionRepositoryV2 creates a new session repository

func (*SessionRepositoryV2) CreateSession added in v1.2.2

CreateSession creates a new session in PocketBase

func (*SessionRepositoryV2) DeleteSession added in v1.2.2

func (r *SessionRepositoryV2) DeleteSession(ctx context.Context, id string) error

DeleteSession deletes a session by ID from PocketBase

func (*SessionRepositoryV2) GetSession added in v1.2.2

func (r *SessionRepositoryV2) GetSession(ctx context.Context, id string) (*models.Session, error)

GetSession retrieves a session by ID from PocketBase

func (*SessionRepositoryV2) ListSessions added in v1.2.2

ListSessions lists sessions based on criteria

func (*SessionRepositoryV2) UpdateSession added in v1.2.2

UpdateSession updates an existing session in PocketBase

type TaskRepositoryV2 added in v1.2.2

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

TaskRepositoryV2 handles task progress data operations with PocketBase

func NewTaskRepositoryV2 added in v1.2.2

func NewTaskRepositoryV2(app *pocketbase.PocketBase) *TaskRepositoryV2

NewTaskRepositoryV2 creates a new task repository

func (*TaskRepositoryV2) CreateTaskProgress added in v1.2.2

CreateTaskProgress creates a new task progress entry in PocketBase

func (*TaskRepositoryV2) DeleteTaskProgress added in v1.2.2

func (r *TaskRepositoryV2) DeleteTaskProgress(ctx context.Context, id string) error

DeleteTaskProgress deletes a task progress entry by ID from PocketBase

func (*TaskRepositoryV2) GetTaskProgress added in v1.2.2

func (r *TaskRepositoryV2) GetTaskProgress(ctx context.Context, id string) (*models.TaskProgress, error)

GetTaskProgress retrieves a task progress entry by ID from PocketBase

func (*TaskRepositoryV2) ListTaskProgress added in v1.2.2

ListTaskProgress lists task progress entries based on criteria

func (*TaskRepositoryV2) UpdateTaskProgress added in v1.2.2

UpdateTaskProgress updates an existing task progress entry in PocketBase

Jump to

Keyboard shortcuts

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