intelligence

package
v0.0.0-...-b8e807e Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventExecutionQueued   = "execution.queued"
	EventExecutionStarted  = "execution.started"
	EventExecutionComplete = "execution.complete"
	EventExecutionFailed   = "execution.failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPattern

type AccessPattern struct {
	Key         string
	RelatedKeys []string
	Probability float64
	Priority    int
}

type Alert

type Alert struct {
	Severity AlertSeverity
	Title    string
	Message  string
	Labels   []attribute.KeyValue
}

type AlertChannel

type AlertChannel interface {
	Send(alert Alert) error
}

type AlertLevel

type AlertLevel string
const (
	AlertLevelInfo     AlertLevel = "info"
	AlertLevelWarning  AlertLevel = "warning"
	AlertLevelCritical AlertLevel = "critical"
)

type AlertManager

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

func NewAlertManager

func NewAlertManager(channels []AlertChannel, logger interface{}) *AlertManager

func (*AlertManager) SendAlert

func (m *AlertManager) SendAlert(alert Alert)

type AlertSeverity

type AlertSeverity string
const (
	AlertSeverityInfo     AlertSeverity = "info"
	AlertSeverityWarning  AlertSeverity = "warning"
	AlertSeverityCritical AlertSeverity = "critical"
)

type AuditLogger

type AuditLogger interface {
	LogSecurityEvent(ctx context.Context, event SecurityAuditEvent)
}

type BatchItem

type BatchItem struct {
	ID        uuid.UUID
	Operation string
	Data      interface{}
	Callback  func(result interface{}, err error)
}

type BatchProcessor

type BatchProcessor struct{}

func NewBatchProcessor

func NewBatchProcessor(config BatchProcessorConfig) *BatchProcessor

func (*BatchProcessor) ProcessBatch

func (b *BatchProcessor) ProcessBatch(ctx context.Context, items []BatchItem) ([]BatchResult, error)

type BatchProcessorConfig

type BatchProcessorConfig struct {
	BatchSize    int
	BatchTimeout time.Duration
	MaxWait      time.Duration
	Logger       observability.Logger
}

type BatchResult

type BatchResult struct {
	ID     uuid.UUID
	Result interface{}
	Error  error
}

type CacheConfig

type CacheConfig struct {
	EnableL1         bool
	EnableL2         bool
	TTL              time.Duration
	MaxSize          int
	EvictionPolicy   string // "lru", "lfu", "arc"
	CompressionLevel int    // 0-9
}

CacheConfig defines cache behavior

type CacheService

type CacheService interface {
	Get(ctx context.Context, key string) (interface{}, error)
	Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error
	Delete(ctx context.Context, key string) error
}

type CachedItem

type CachedItem struct {
	Value      interface{}
	Expiration time.Time
	Version    int
	Metadata   map[string]interface{}
}

func (CachedItem) IsExpired

func (c CachedItem) IsExpired() bool

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	MaxRequests uint32
	Interval    time.Duration
	Timeout     time.Duration
}

type ClassificationRule

type ClassificationRule struct {
	Name           string
	Pattern        *regexp.Regexp
	Keywords       []string
	Classification DataClassification
}

ClassificationRule defines a classification rule

type CompensationFunc

type CompensationFunc func(context.Context) error

type ContentAnalysis

type ContentAnalysis struct {
	ContentType ContentType
	Metadata    *ContentMetadata
	Entities    []Entity
	Topics      []Topic
	Keywords    []string
	Summary     string
	Language    string
}

type ContentAnalyzer

type ContentAnalyzer interface {
	Analyze(ctx context.Context, content []byte) (*ContentAnalysis, error)
}

type ContentMetadata

type ContentMetadata struct {
	Size        int
	LineCount   int
	WordCount   int
	CharCount   int
	HasCode     bool
	HasMarkdown bool
	HasJSON     bool
	HasHTML     bool
	HasPII      bool
	HasSecrets  bool
}

type ContentType

type ContentType string
const (
	ContentTypeText          ContentType = "text"
	ContentTypeCode          ContentType = "code"
	ContentTypeJSON          ContentType = "json"
	ContentTypeHTML          ContentType = "html"
	ContentTypeMarkdown      ContentType = "markdown"
	ContentTypeAPI           ContentType = "api_response"
	ContentTypeDocumentation ContentType = "documentation"
	ContentTypeUnknown       ContentType = "unknown"
)

type CostAlert

type CostAlert struct {
	Level    AlertLevel
	TenantID uuid.UUID
	Message  string
	Spend    decimal.Decimal
	Limit    decimal.Decimal
}

type CostBreakdown

type CostBreakdown struct {
	ExecutionID   uuid.UUID
	TenantID      uuid.UUID
	Timestamp     time.Time
	ToolCost      decimal.Decimal
	EmbeddingCost decimal.Decimal
	AnalysisCost  decimal.Decimal
	StorageCost   decimal.Decimal
	Discount      decimal.Decimal
	Total         decimal.Decimal
}

type CostCheckRequest

type CostCheckRequest struct {
	TenantID        uuid.UUID
	ToolExecution   bool
	ToolType        string
	EmbeddingTokens int
	EmbeddingModel  string
	AnalysisTokens  int
	AnalysisModel   string
	StorageMB       float64
}

type CostCheckResponse

type CostCheckResponse struct {
	Allowed       bool
	EstimatedCost decimal.Decimal
	CurrentSpend  decimal.Decimal
	DailyLimit    decimal.Decimal
	Remaining     decimal.Decimal
	PercentUsed   float64
	ShouldWarn    bool
	BlockReason   string
	GracePeriod   bool
}

type CostControlConfig

type CostControlConfig struct {
	// Global limits
	GlobalDailyLimit   float64
	GlobalMonthlyLimit float64

	// Alert thresholds
	WarningThreshold  float64 // 0.8 = alert at 80% of budget
	CriticalThreshold float64 // 0.95 = critical at 95%

	// Rate limits
	EnableRateLimiting bool
	CostPerMinute      float64 // Max cost per minute per tenant

	// Tracking
	TrackingGranularity string // "execution", "hourly", "daily"
	RetentionDays       int

	// Enforcement
	StrictEnforcement  bool // Block when budget exceeded
	GracePeriodMinutes int  // Allow temporary overages
}

CostControlConfig contains cost control configuration

type CostControlDependencies

type CostControlDependencies struct {
	DB         *sql.DB
	Repository CostRepository
	Logger     observability.Logger
}

CostControlDependencies for NewCostController

type CostController

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

CostController manages cost tracking and budget enforcement

func NewCostController

func NewCostController(config CostControlConfig, deps CostControlDependencies) (*CostController, error)

NewCostController creates a new cost controller

func (*CostController) CheckBudget

CheckBudget checks if an operation can proceed within budget

func (*CostController) GetCostBreakdown

func (c *CostController) GetCostBreakdown(ctx context.Context, executionID uuid.UUID) (*CostBreakdown, error)

GetCostBreakdown returns detailed cost breakdown for an execution

func (*CostController) GetTenantUsage

func (c *CostController) GetTenantUsage(ctx context.Context, tenantID uuid.UUID, period TimePeriod) (*UsageSummary, error)

GetTenantUsage returns usage summary for a tenant

func (*CostController) RecordCost

func (c *CostController) RecordCost(ctx context.Context, record CostRecord) error

RecordCost records actual cost after execution

type CostMetricsCollector

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

func NewCostMetricsCollector

func NewCostMetricsCollector(meter interface{}) *CostMetricsCollector

func (*CostMetricsCollector) GetStats

func (c *CostMetricsCollector) GetStats() map[string]interface{}

type CostRateTable

type CostRateTable struct {
	ToolRates      map[string]decimal.Decimal
	EmbeddingRates map[string]decimal.Decimal
	AnalysisRates  map[string]decimal.Decimal
	StorageRate    decimal.Decimal
}

func NewCostRateTable

func NewCostRateTable() *CostRateTable

func (*CostRateTable) GetAnalysisRate

func (c *CostRateTable) GetAnalysisRate(model string) decimal.Decimal

func (*CostRateTable) GetEmbeddingRate

func (c *CostRateTable) GetEmbeddingRate(model string) decimal.Decimal

func (*CostRateTable) GetStorageRate

func (c *CostRateTable) GetStorageRate() decimal.Decimal

func (*CostRateTable) GetToolRate

func (c *CostRateTable) GetToolRate(toolType string) decimal.Decimal

type CostRecord

type CostRecord struct {
	ExecutionID     uuid.UUID
	TenantID        uuid.UUID
	ToolExecution   bool
	ToolType        string
	EmbeddingTokens int
	EmbeddingModel  string
	AnalysisTokens  int
	AnalysisModel   string
	StorageMB       float64
}

CostRecord for RecordCost

type CostRepository

type CostRepository interface {
	StoreCost(ctx context.Context, record CostRecord, breakdown *CostBreakdown) error
	GetCostBreakdown(ctx context.Context, executionID uuid.UUID) (*CostBreakdown, error)
	GetUsageBreakdown(ctx context.Context, tenantID uuid.UUID, period TimePeriod) (*UsageBreakdown, error)
	GetTenantBudget(ctx context.Context, tenantID uuid.UUID) (*TenantBudget, error)
	GetAllTenantBudgets(ctx context.Context) ([]*TenantBudget, error)
	IsInGracePeriod(ctx context.Context, tenantID uuid.UUID) (bool, error)
	StoreAlert(ctx context.Context, alert CostAlert) error
}

type DataClassification

type DataClassification int

DataClassification levels

const (
	ClassificationPublic DataClassification = iota
	ClassificationInternal
	ClassificationConfidential
	ClassificationRestricted
)

type DataClassifier

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

DataClassifier classifies data sensitivity

func NewDataClassifier

func NewDataClassifier() *DataClassifier

NewDataClassifier creates a new data classifier

func (*DataClassifier) Classify

func (c *DataClassifier) Classify(content []byte) DataClassification

Classify determines data classification

type DynamicToolRepository

type DynamicToolRepository interface {
	GetTool(ctx context.Context, toolID uuid.UUID) (*models.DynamicTool, error)
	UpdateToolUsage(ctx context.Context, toolID uuid.UUID, usage ToolUsage) error
}

type DynamicToolsIntegration

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

DynamicToolsIntegration integrates intelligence with the DynamicToolsService

func NewDynamicToolsIntegration

func NewDynamicToolsIntegration(
	config IntegrationConfig,
	deps IntegrationDependencies,
) (*DynamicToolsIntegration, error)

NewDynamicToolsIntegration creates the integration layer

func (*DynamicToolsIntegration) ExecuteToolActionWithIntelligence

func (i *DynamicToolsIntegration) ExecuteToolActionWithIntelligence(
	ctx context.Context,
	request ToolExecutionRequest,
) (*ToolExecutionResponse, error)

ExecuteToolActionWithIntelligence wraps tool execution with intelligence processing

type EmbeddingService

type EmbeddingService interface {
	GenerateEmbedding(ctx context.Context, content string, metadata map[string]interface{}) (*uuid.UUID, error)
}

EmbeddingService is a wrapper interface for the embedding service

func NewEmbeddingServiceAdapter

func NewEmbeddingServiceAdapter(service *embedding.ServiceV2, tenantID uuid.UUID, agentID *uuid.UUID) EmbeddingService

NewEmbeddingServiceAdapter creates a new adapter

type EmbeddingServiceAdapter

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

EmbeddingServiceAdapter adapts the embedding.ServiceV2 to our EmbeddingService interface

func (*EmbeddingServiceAdapter) GenerateEmbedding

func (a *EmbeddingServiceAdapter) GenerateEmbedding(ctx context.Context, content string, metadata map[string]interface{}) (*uuid.UUID, error)

GenerateEmbedding implements the EmbeddingService interface

type Encryptor

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

Encryptor provides encryption services

func NewEncryptor

func NewEncryptor(key []byte) *Encryptor

NewEncryptor creates a new encryptor

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(ciphertext string) ([]byte, error)

Decrypt decrypts data

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(plaintext []byte) (string, error)

Encrypt encrypts data

type Entity

type Entity struct {
	Type       string // person, organization, location, etc.
	Value      string
	Confidence float64
	Metadata   map[string]interface{}
}

type Event

type Event struct {
	ID          uuid.UUID
	Type        string
	ExecutionID uuid.UUID
	Timestamp   time.Time
	Data        interface{}
}

type EventStore

type EventStore interface {
	PublishEvent(ctx context.Context, event Event) error
	Subscribe(ctx context.Context, eventType string) (<-chan Event, error)
}

type ExecutionCheckpoint

type ExecutionCheckpoint struct {
	ID         uuid.UUID
	StartTime  time.Time
	Request    ExecutionRequest
	Stages     map[string]StageCheckpoint
	LastUpdate time.Time
}

type ExecutionMetrics

type ExecutionMetrics struct {
	ExecutionTimeMs      int64
	EmbeddingTimeMs      int64
	IntelligenceDeferred bool
	TotalTokens          int
	TotalCostUSD         float64
	Queued               bool
}

type ExecutionMetricsCollector

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

func NewExecutionMetricsCollector

func NewExecutionMetricsCollector(meter interface{}) *ExecutionMetricsCollector

func (*ExecutionMetricsCollector) GetStats

func (c *ExecutionMetricsCollector) GetStats() map[string]interface{}

type ExecutionMode

type ExecutionMode string

ExecutionMode defines how the execution should be processed

const (
	ModeSync   ExecutionMode = "sync"   // Wait for everything
	ModeAsync  ExecutionMode = "async"  // Return immediately, process in background
	ModeHybrid ExecutionMode = "hybrid" // Return tool result, async intelligence
)

type ExecutionRequest

type ExecutionRequest struct {
	ToolID   uuid.UUID
	AgentID  uuid.UUID
	TenantID uuid.UUID
	Action   string
	Params   map[string]interface{}
	Mode     ExecutionMode
	Metadata map[string]interface{}
}

type ExecutionResponse

type ExecutionResponse struct {
	ExecutionID     uuid.UUID
	ToolResult      interface{}
	Intelligence    IntelligenceMetadata
	ContextID       uuid.UUID
	RelatedContexts []uuid.UUID
	Metrics         ExecutionMetrics
}

type HTTPConnectionPool

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

func NewHTTPConnectionPool

func NewHTTPConnectionPool(maxConns int) *HTTPConnectionPool

func (*HTTPConnectionPool) Acquire

func (p *HTTPConnectionPool) Acquire()

func (*HTTPConnectionPool) Release

func (p *HTTPConnectionPool) Release()

type IntegrationConfig

type IntegrationConfig struct {
	// Feature flags
	AutoEmbedding       bool
	IntelligenceEnabled bool
	SecurityChecks      bool
	CostTracking        bool

	// Execution modes
	DefaultMode    ExecutionMode
	AsyncThreshold int // Use async for results > this size

	// Performance
	CacheEnabled    bool
	BatchingEnabled bool
}

IntegrationConfig contains integration configuration

type IntegrationDependencies

type IntegrationDependencies struct {
	ToolExecutor     ToolExecutor
	ContentAnalyzer  ContentAnalyzer
	EmbeddingService EmbeddingService // Use the interface, not the concrete type
	SemanticGraph    SemanticGraphService
	DynamicToolsRepo DynamicToolRepository
	DB               *sql.DB
	CacheService     CacheService
	EventStore       EventStore
	Logger           observability.Logger
	MetricsClient    observability.MetricsClient
}

type IntelligenceMetadata

type IntelligenceMetadata struct {
	ContentType    ContentType
	Entities       []Entity
	Topics         []Topic
	Keywords       []string
	Summary        string
	Sentiment      SentimentAnalysis
	Language       string
	Classification DataClassification
}

type IntelligenceResult

type IntelligenceResult struct {
	Metadata          IntelligenceMetadata
	EmbeddingID       *uuid.UUID
	RelatedContexts   []uuid.UUID
	SemanticLinks     []SemanticLink
	EmbeddingDuration time.Duration
	TokensUsed        int
	Cost              float64
}

type Logger

type Logger = observability.Logger

Logger is an alias for the observability.Logger interface

type MetricsCollector

type MetricsCollector struct{}

MetricsCollector stub for service.go

func NewMetricsCollector

func NewMetricsCollector(meter interface{}) (*MetricsCollector, error)

func (*MetricsCollector) RecordConcurrencyLimitExceeded

func (m *MetricsCollector) RecordConcurrencyLimitExceeded()

func (*MetricsCollector) RecordError

func (m *MetricsCollector) RecordError(err error, labels ...interface{})

func (*MetricsCollector) RecordExecutionDuration

func (m *MetricsCollector) RecordExecutionDuration(duration interface{}, labels ...interface{})

func (*MetricsCollector) RecordRateLimitExceeded

func (m *MetricsCollector) RecordRateLimitExceeded()

func (*MetricsCollector) RecordSLOViolation

func (m *MetricsCollector) RecordSLOViolation(name string, duration interface{})

func (*MetricsCollector) RecordSuccess

func (m *MetricsCollector) RecordSuccess(labels ...interface{})

type OperationUsage

type OperationUsage struct {
	Operation   string
	Count       int
	TotalCost   decimal.Decimal
	AverageCost decimal.Decimal
}

type OptimizationDependencies

type OptimizationDependencies struct {
	RedisClient *redis.Client
	CacheConfig CacheConfig
	DBPool      *sql.DB
	Logger      observability.Logger
}

Performance optimizer dependencies

type PIIDetector

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

PIIDetector detects personally identifiable information

func NewPIIDetector

func NewPIIDetector() *PIIDetector

NewPIIDetector creates a new PII detector

func (*PIIDetector) Detect

func (d *PIIDetector) Detect(content []byte) []string

Detect finds PII in content

func (*PIIDetector) Redact

func (d *PIIDetector) Redact(content []byte, piiTypes []string) []byte

Redact removes PII from content

type PerformanceConfig

type PerformanceConfig struct {
	// Cache settings
	L1CacheSize int
	L2CacheTTL  time.Duration
	CacheWarmup bool

	// Batching settings
	BatchSize    int
	BatchTimeout time.Duration
	MaxBatchWait time.Duration

	// Connection pool settings
	DBMaxConns     int
	DBMaxIdleConns int
	RedisPoolSize  int
	HTTPMaxConns   int

	// Prefetch settings
	PrefetchEnabled   bool
	PrefetchThreshold float64 // 0.8 = prefetch when 80% likely
	PrefetchWorkers   int
}

PerformanceConfig contains performance optimization settings

type PerformanceMetricsCollector

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

func NewPerformanceMetricsCollector

func NewPerformanceMetricsCollector(meter interface{}) *PerformanceMetricsCollector

func (*PerformanceMetricsCollector) GetStats

func (c *PerformanceMetricsCollector) GetStats() map[string]interface{}

func (*PerformanceMetricsCollector) UpdateGauge

func (c *PerformanceMetricsCollector) UpdateGauge(name string, value float64, labels ...attribute.KeyValue)

type PerformanceOptimizer

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

PerformanceOptimizer manages caching, batching, and connection pooling

func NewPerformanceOptimizer

func NewPerformanceOptimizer(config PerformanceConfig, deps OptimizationDependencies) (*PerformanceOptimizer, error)

NewPerformanceOptimizer creates a performance optimization layer

func (*PerformanceOptimizer) BatchExecute

func (p *PerformanceOptimizer) BatchExecute(ctx context.Context, items []BatchItem) ([]BatchResult, error)

BatchExecute processes operations in batches

func (*PerformanceOptimizer) GetWithCache

func (p *PerformanceOptimizer) GetWithCache(ctx context.Context, key string, loader func() (interface{}, error)) (interface{}, error)

GetWithCache retrieves data with multi-level caching

func (*PerformanceOptimizer) OptimizeQuery

func (p *PerformanceOptimizer) OptimizeQuery(ctx context.Context, query QueryRequest) (*QueryResult, error)

OptimizeQuery optimizes database queries with caching and pooling

type PrefetchRequest

type PrefetchRequest struct {
	Key         string
	RelatedKeys []string
	Priority    int
}

type Prefetcher

type Prefetcher struct{}

func NewPrefetcher

func NewPrefetcher(config PrefetcherConfig) *Prefetcher

type PrefetcherConfig

type PrefetcherConfig struct {
	Workers   int
	Threshold float64
	Logger    observability.Logger
}

type QueryRequest

type QueryRequest struct {
	SQL       string
	Args      []interface{}
	Cacheable bool
	Prepared  bool
	Timeout   time.Duration
}

type QueryResult

type QueryResult struct {
	Rows     []map[string]interface{}
	RowCount int
}

type RateLimitConfig

type RateLimitConfig struct {
	RequestsPerSecond float64
	BurstSize         int
}

type ResilientExecutionService

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

ResilientExecutionService provides fault-tolerant tool execution with intelligence

func NewResilientExecutionService

func NewResilientExecutionService(config *ServiceConfig, deps ServiceDependencies) (*ResilientExecutionService, error)

NewResilientExecutionService creates a production-ready execution service

func (*ResilientExecutionService) Execute

Execute performs tool execution with intelligence processing

type RetryConfig

type RetryConfig struct {
	MaxRetries     int
	InitialBackoff time.Duration
	MaxBackoff     time.Duration
	Multiplier     float64
}

type SLOConfig

type SLOConfig struct {
	P50LatencyMs    float64 // 200ms
	P99LatencyMs    float64 // 500ms
	ErrorRatePct    float64 // 0.1%
	AvailabilityPct float64 // 99.9%
}

SLOConfig defines service level objectives

type SLOMonitor

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

func NewSLOMonitor

func NewSLOMonitor(targets SLOTargets, logger observability.Logger) *SLOMonitor

func (*SLOMonitor) CheckExecution

func (m *SLOMonitor) CheckExecution(duration time.Duration, err error)

func (*SLOMonitor) Start

func (m *SLOMonitor) Start()

type SLOTargets

type SLOTargets struct {
	LatencyP50   time.Duration
	LatencyP99   time.Duration
	ErrorRate    float64
	Availability float64
}

type SecretScanner

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

SecretScanner scans for secrets and credentials

func NewSecretScanner

func NewSecretScanner() *SecretScanner

NewSecretScanner creates a new secret scanner

func (*SecretScanner) Scan

func (s *SecretScanner) Scan(content []byte) []string

Scan finds secrets in content

type SecurityAuditEvent

type SecurityAuditEvent struct {
	EventID         uuid.UUID
	EventType       string
	Timestamp       time.Time
	TenantID        uuid.UUID
	AgentID         uuid.UUID
	Classification  DataClassification
	PIIDetected     bool
	SecretsDetected bool
	Passed          bool
	Details         map[string]interface{}
}

SecurityAuditEvent represents a security audit event

type SecurityConfig

type SecurityConfig struct {
	EnablePIIDetection   bool
	EnableSecretScanning bool
	EnableEncryption     bool
	EncryptionKey        []byte
	RedactPII            bool
	BlockOnSecrets       bool
	AuditEnabled         bool
	SensitivePatterns    []string
}

SecurityConfig contains security configuration

type SecurityLayer

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

SecurityLayer provides security checks and data protection

func NewSecurityLayer

func NewSecurityLayer(config SecurityConfig) *SecurityLayer

NewSecurityLayer creates a new security layer

func (*SecurityLayer) ValidateContent

func (s *SecurityLayer) ValidateContent(ctx context.Context, content []byte) (*SecurityValidation, error)

ValidateContent performs security validation on content

type SecurityMetricsCollector

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

func NewSecurityMetricsCollector

func NewSecurityMetricsCollector(meter interface{}) *SecurityMetricsCollector

func (*SecurityMetricsCollector) GetStats

func (c *SecurityMetricsCollector) GetStats() map[string]interface{}

type SecurityValidation

type SecurityValidation struct {
	ID               uuid.UUID
	Timestamp        time.Time
	Passed           bool
	PIIDetected      bool
	PIITypes         []string
	SecretsDetected  bool
	SecretTypes      []string
	Classification   DataClassification
	ContentRedacted  bool
	BlockReason      string
	ProcessedContent []byte
}

SecurityValidation contains security validation results

type SemanticGraphService

type SemanticGraphService interface {
	AddNode(ctx context.Context, nodeID uuid.UUID, metadata map[string]interface{}) error
	CreateRelationship(ctx context.Context, source, target uuid.UUID, relationship string) error
	FindRelated(ctx context.Context, nodeID uuid.UUID, maxDistance int) ([]uuid.UUID, error)
}
type SemanticLink struct {
	TargetID     uuid.UUID
	Relationship string
	Confidence   float64
}

type SentimentAnalysis

type SentimentAnalysis struct {
	Polarity     float64 // -1 (negative) to 1 (positive)
	Subjectivity float64 // 0 (objective) to 1 (subjective)
	Confidence   float64
}

type ServiceConfig

type ServiceConfig struct {
	// Execution modes
	DefaultMode         ExecutionMode
	EnableAsyncFallback bool

	// Performance
	MaxConcurrency int64
	TimeoutSeconds int
	CacheEnabled   bool
	CacheTTL       time.Duration

	// Resilience
	CircuitBreakerConfig CircuitBreakerConfig
	RetryConfig          RetryConfig
	RateLimitConfig      RateLimitConfig

	// Security
	SecurityConfig SecurityConfig

	// Cost
	CostThresholdUSD float64
	DailyBudgetUSD   float64
}

ServiceConfig contains all configuration for the service

type ServiceDependencies

type ServiceDependencies struct {
	ToolExecutor     ToolExecutor
	ContentAnalyzer  ContentAnalyzer
	EmbeddingService EmbeddingService // Use the interface, not the concrete type
	SemanticGraph    SemanticGraphService
	DB               *sql.DB
	Cache            CacheService
	EventStore       EventStore
	Logger           observability.Logger
	MetricsClient    observability.MetricsClient
}

ServiceDependencies for NewResilientExecutionService

type StageCheckpoint

type StageCheckpoint struct {
	Name       string
	Status     StageStatus
	StartTime  time.Time
	EndTime    *time.Time
	InputData  interface{}
	OutputData interface{}
	Error      error
}

type StageStatus

type StageStatus string
const (
	StageStatusPending   StageStatus = "pending"
	StageStatusRunning   StageStatus = "running"
	StageStatusCompleted StageStatus = "completed"
	StageStatusFailed    StageStatus = "failed"
	StageStatusSkipped   StageStatus = "skipped"
)

type TenantBudget

type TenantBudget struct {
	TenantID        uuid.UUID
	DailyLimit      decimal.Decimal
	MonthlyLimit    decimal.Decimal
	WarningPercent  float64
	DiscountPercent float64
	GracePeriod     time.Duration
}

type TimePeriod

type TimePeriod struct {
	Start time.Time
	End   time.Time
}

type ToolExecutionRequest

type ToolExecutionRequest struct {
	ToolID          uuid.UUID
	AgentID         uuid.UUID
	TenantID        uuid.UUID
	Action          string
	Params          map[string]interface{}
	PassthroughAuth *models.PassthroughAuthBundle
	Metadata        map[string]interface{}
}

type ToolExecutionResponse

type ToolExecutionResponse struct {
	ExecutionID     uuid.UUID
	Result          interface{}
	Intelligence    IntelligenceMetadata
	ContextID       uuid.UUID
	RelatedContexts []uuid.UUID
	Duration        time.Duration
	Metrics         ExecutionMetrics
}

type ToolExecutor

type ToolExecutor interface {
	Execute(ctx context.Context, toolID uuid.UUID, action string, params map[string]interface{}) (*ToolResult, error)
}

type ToolResult

type ToolResult struct {
	Data     interface{}
	Duration time.Duration
	Error    error
}

type ToolUsage

type ToolUsage struct {
	LastUsed       time.Time
	ExecutionCount int64
	TotalTokens    int64
	TotalCost      float64
}

type Topic

type Topic struct {
	Name     string
	Score    float64
	Keywords []string
}

type UsageBreakdown

type UsageBreakdown struct {
	ToolCosts      decimal.Decimal
	EmbeddingCosts decimal.Decimal
	AnalysisCosts  decimal.Decimal
	StorageCosts   decimal.Decimal
	TotalCost      decimal.Decimal
}

type UsageSummary

type UsageSummary struct {
	TenantID        uuid.UUID
	Period          TimePeriod
	DailySpend      decimal.Decimal
	MonthlySpend    decimal.Decimal
	DailyLimit      decimal.Decimal
	MonthlyLimit    decimal.Decimal
	Breakdown       *UsageBreakdown
	Trends          *UsageTrends
	TopOperations   []OperationUsage
	Recommendations []string
}

type UsageTrends

type UsageTrends struct {
	DailyGrowthRate   float64
	WeeklyGrowthRate  float64
	MonthlyGrowthRate float64
	PeakHour          int
	PeakDay           string
}

Jump to

Keyboard shortcuts

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