Documentation
¶
Index ¶
- Variables
- func CreateDefaultCircuitBreakerSettings() *gobreaker.Settings
- func ExponentialBackoff(base time.Duration, factor float64) func(attempt int) time.Duration
- type AESEncryptionService
- func (s *AESEncryptionService) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error)
- func (s *AESEncryptionService) DecryptString(ctx context.Context, ciphertext string) (string, error)
- func (s *AESEncryptionService) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error)
- func (s *AESEncryptionService) EncryptString(ctx context.Context, plaintext string) (string, error)
- type AgentNotInWorkspaceError
- type AgentService
- type AggregateRoot
- type AssignmentEngine
- type AssignmentStrategy
- type BaseService
- func (s *BaseService) CheckQuota(ctx context.Context, resource string, amount int64) error
- func (s *BaseService) CheckRateLimit(ctx context.Context, resource string) error
- func (s *BaseService) PublishEvent(ctx context.Context, eventType string, aggregate AggregateRoot, ...) error
- func (s *BaseService) SetEventPublisher(publisher events.EventPublisher)
- func (s *BaseService) SetEventStore(store events.EventStore)
- func (s *BaseService) SetHealthChecker(checker HealthChecker)
- func (s *BaseService) StartDistributedTransaction(ctx context.Context, opts ...TxOption) (context.Context, func(), func())
- func (s *BaseService) WithTransaction(ctx context.Context, fn func(ctx context.Context, tx Transaction) error) error
- type CapabilityMatchStrategy
- type CollaboratorAddedEvent
- type Compensator
- type ConcurrentModificationError
- type ConflictResolutionService
- type CostOptimizedStrategy
- type DeadlockInfo
- type DefaultSanitizer
- type DelegationError
- type DocumentLock
- type DocumentLockService
- type DocumentLockedError
- type DocumentService
- type EncryptionService
- type EnhancedTaskService
- func (s *EnhancedTaskService) AcceptTask(ctx context.Context, taskID uuid.UUID, agentID string) error
- func (s EnhancedTaskService) ArchiveCompletedTasks(ctx context.Context, before time.Time) (int64, error)
- func (s EnhancedTaskService) AssignTask(ctx context.Context, taskID uuid.UUID, agentID string) error
- func (s EnhancedTaskService) AutoAssignTask(ctx context.Context, taskID uuid.UUID, strategy AssignmentStrategy) error
- func (s EnhancedTaskService) CancelTaskTree(ctx context.Context, rootTaskID uuid.UUID, reason string) error
- func (s *EnhancedTaskService) CompleteTask(ctx context.Context, taskID uuid.UUID, agentID string, result interface{}) error
- func (s EnhancedTaskService) CompleteWorkflowTask(ctx context.Context, taskID uuid.UUID, output interface{}) error
- func (s *EnhancedTaskService) Create(ctx context.Context, task *models.Task, idempotencyKey string) error
- func (s EnhancedTaskService) CreateBatch(ctx context.Context, tasks []*models.Task) error
- func (s EnhancedTaskService) CreateDistributedTask(ctx context.Context, dt *models.DistributedTask) error
- func (s EnhancedTaskService) CreateWorkflowTask(ctx context.Context, workflowID, stepID uuid.UUID, ...) (*models.Task, error)
- func (s *EnhancedTaskService) DelegateTask(ctx context.Context, delegation *models.TaskDelegation) error
- func (s EnhancedTaskService) Delete(ctx context.Context, id uuid.UUID) error
- func (s EnhancedTaskService) FailTask(ctx context.Context, taskID uuid.UUID, agentID string, errorMsg string) error
- func (s EnhancedTaskService) GenerateTaskReport(ctx context.Context, filters interfaces.TaskFilters, format string) ([]byte, error)
- func (s EnhancedTaskService) Get(ctx context.Context, id uuid.UUID) (*models.Task, error)
- func (s EnhancedTaskService) GetAgentPerformance(ctx context.Context, agentID string, period time.Duration) (*models.AgentPerformance, error)
- func (s EnhancedTaskService) GetAgentTasks(ctx context.Context, agentID string, filters interfaces.TaskFilters) ([]*models.Task, error)
- func (s EnhancedTaskService) GetAvailableTasks(ctx context.Context, agentID string, capabilities []string) ([]*models.Task, error)
- func (s EnhancedTaskService) GetBatch(ctx context.Context, ids []uuid.UUID) ([]*models.Task, error)
- func (s EnhancedTaskService) GetTaskStats(ctx context.Context, filters interfaces.TaskFilters) (*models.TaskStats, error)
- func (s EnhancedTaskService) GetTaskTimeline(ctx context.Context, taskID uuid.UUID) ([]*models.TaskEvent, error)
- func (s EnhancedTaskService) GetTaskTree(ctx context.Context, rootTaskID uuid.UUID) (*models.TaskTree, error)
- func (s EnhancedTaskService) RebalanceTasks(ctx context.Context) error
- func (s EnhancedTaskService) RejectTask(ctx context.Context, taskID uuid.UUID, agentID string, reason string) error
- func (s EnhancedTaskService) RetryTask(ctx context.Context, taskID uuid.UUID) error
- func (s EnhancedTaskService) SearchTasks(ctx context.Context, query string, filters interfaces.TaskFilters) ([]*models.Task, error)
- func (s EnhancedTaskService) StartTask(ctx context.Context, taskID uuid.UUID, agentID string) error
- func (s EnhancedTaskService) SubmitSubtaskResult(ctx context.Context, parentTaskID, subtaskID uuid.UUID, result interface{}) error
- func (s EnhancedTaskService) Update(ctx context.Context, task *models.Task) error
- func (s EnhancedTaskService) UpdateProgress(ctx context.Context, taskID uuid.UUID, progress int, message string) error
- func (s *EnhancedTaskService) UpdateStatus(ctx context.Context, taskID uuid.UUID, newStatus models.TaskStatus, ...) error
- type EventBus
- type ExecutionMonitor
- type HealthChecker
- type InMemoryQuotaManager
- func (qm *InMemoryQuotaManager) GetQuota(ctx context.Context, tenantID uuid.UUID, resource string) (int64, error)
- func (qm *InMemoryQuotaManager) GetQuotaStatus(ctx context.Context, tenantID uuid.UUID) (*QuotaStatus, error)
- func (qm *InMemoryQuotaManager) GetUsage(ctx context.Context, tenantID uuid.UUID, resource string) (int64, error)
- func (qm *InMemoryQuotaManager) IncrementUsage(ctx context.Context, tenantID uuid.UUID, resource string, amount int64) error
- func (qm *InMemoryQuotaManager) SetQuota(ctx context.Context, tenantID uuid.UUID, resource string, limit int64) error
- type InMemoryRateLimiter
- func (rl *InMemoryRateLimiter) Check(ctx context.Context, key string) error
- func (rl *InMemoryRateLimiter) CheckWithLimit(ctx context.Context, key string, limit int, window time.Duration) error
- func (rl *InMemoryRateLimiter) GetRemaining(ctx context.Context, key string) (int, error)
- func (rl *InMemoryRateLimiter) Reset(ctx context.Context, key string) error
- type LeastLoadedStrategy
- type LockConflictError
- type LockNotFoundError
- type LockRefreshLimitError
- type LockType
- type MergeConflictError
- type NoEligibleAgentsError
- type NoOpEncryptionService
- func (s *NoOpEncryptionService) Decrypt(ctx context.Context, data []byte) ([]byte, error)
- func (s *NoOpEncryptionService) DecryptString(ctx context.Context, data string) (string, error)
- func (s *NoOpEncryptionService) Encrypt(ctx context.Context, data []byte) ([]byte, error)
- func (s *NoOpEncryptionService) EncryptString(ctx context.Context, data string) (string, error)
- type NoOpSpan
- type NotificationService
- type PerformanceBasedStrategy
- type ProgressTracker
- type QuotaError
- type QuotaExceededError
- type QuotaInfo
- type QuotaManager
- type QuotaStatus
- type RateLimitError
- type RateLimiter
- type ResultAggregator
- func (a *ResultAggregator) AddResult(parentTaskID, subtaskID uuid.UUID, result interface{})
- func (a *ResultAggregator) AggregateResults(parentTaskID uuid.UUID, config models.AggregationConfig) (interface{}, error)
- func (a *ResultAggregator) Clear(parentTaskID uuid.UUID)
- func (a *ResultAggregator) GetResults(parentTaskID uuid.UUID) map[uuid.UUID]interface{}
- type RoundRobinStrategy
- type Sanitizer
- type SectionLock
- type SectionLockConflictError
- type ServiceConfig
- type StateStore
- type StepDependencyError
- type StepNotFoundError
- type TaskCreationSaga
- func (s *TaskCreationSaga) CreateMainTask(ctx context.Context, tx Transaction) (*models.Task, error)
- func (s *TaskCreationSaga) CreateSubtask(ctx context.Context, tx Transaction, mainTask *models.Task, ...) (*models.Task, error)
- func (s *TaskCreationSaga) DeleteMainTask(ctx context.Context, taskID uuid.UUID) error
- func (s *TaskCreationSaga) DeleteSubtask(ctx context.Context, subtaskID uuid.UUID) error
- func (s *TaskCreationSaga) PublishEvents(ctx context.Context) error
- func (s *TaskCreationSaga) ValidateAgents(ctx context.Context, subtasks []models.Subtask) (map[string]*models.Agent, error)
- type TaskRebalancer
- type TaskService
- type TaskStateMachine
- type TenantAwareAuthService
- func (s *TenantAwareAuthService) CheckFeatureEnabled(ctx context.Context, tenantID, feature string) (bool, error)
- func (s *TenantAwareAuthService) GetAllowedOrigins(ctx context.Context, tenantID string) ([]string, error)
- func (s *TenantAwareAuthService) GetServiceToken(ctx context.Context, tenantID, provider string) (string, error)
- func (s *TenantAwareAuthService) ValidateAPIKeyWithTenantConfig(ctx context.Context, apiKey string) (*auth.User, *models.TenantConfig, error)
- func (s *TenantAwareAuthService) ValidateWithEndpointRateLimit(ctx context.Context, apiKey, endpoint string) (*auth.User, *models.EndpointRateLimit, error)
- type TenantConfigService
- type Transaction
- type TransactionParticipant
- type TransactionState
- type TransactionalWorkflowService
- func (s TransactionalWorkflowService) ArchiveCompletedExecutions(ctx context.Context, before time.Time) (int64, error)
- func (s TransactionalWorkflowService) CancelExecution(ctx context.Context, executionID uuid.UUID, reason string) error
- func (s TransactionalWorkflowService) CompleteStep(ctx context.Context, executionID uuid.UUID, stepID string, ...) error
- func (s TransactionalWorkflowService) CreateBranchingPath(ctx context.Context, executionID uuid.UUID, branchPoint string, ...) error
- func (s TransactionalWorkflowService) CreateCompensation(ctx context.Context, executionID uuid.UUID, failedStep string, ...) error
- func (s TransactionalWorkflowService) CreateExecution(ctx context.Context, execution *models.WorkflowExecution) error
- func (s TransactionalWorkflowService) CreateFromTemplate(ctx context.Context, templateID uuid.UUID, params map[string]interface{}) (*models.Workflow, error)
- func (s TransactionalWorkflowService) CreateWorkflow(ctx context.Context, workflow *models.Workflow) error
- func (s TransactionalWorkflowService) CreateWorkflowTemplate(ctx context.Context, template *models.WorkflowTemplate) error
- func (s TransactionalWorkflowService) DeleteWorkflow(ctx context.Context, id uuid.UUID) error
- func (s TransactionalWorkflowService) ExecuteCompensation(ctx context.Context, executionID uuid.UUID) error
- func (s TransactionalWorkflowService) ExecuteWithCircuitBreaker(ctx context.Context, operation string, fn func() (interface{}, error)) (interface{}, error)
- func (s *TransactionalWorkflowService) ExecuteWorkflow(ctx context.Context, workflowID uuid.UUID, input map[string]interface{}, ...) (*models.WorkflowExecution, error)
- func (s *TransactionalWorkflowService) ExecuteWorkflowStep(ctx context.Context, executionID uuid.UUID, stepID string) error
- func (s TransactionalWorkflowService) FailStep(ctx context.Context, executionID uuid.UUID, stepID string, reason string, ...) error
- func (s TransactionalWorkflowService) GenerateWorkflowReport(ctx context.Context, filters interfaces.WorkflowFilters, format string) ([]byte, error)
- func (s TransactionalWorkflowService) GetCurrentStep(ctx context.Context, executionID uuid.UUID) (*models.StepExecution, error)
- func (s TransactionalWorkflowService) GetExecution(ctx context.Context, executionID uuid.UUID) (*models.WorkflowExecution, error)
- func (s TransactionalWorkflowService) GetExecutionHistory(ctx context.Context, workflowID uuid.UUID) ([]*models.WorkflowExecution, error)
- func (s TransactionalWorkflowService) GetExecutionStatus(ctx context.Context, executionID uuid.UUID) (*models.ExecutionStatus, error)
- func (s TransactionalWorkflowService) GetExecutionTimeline(ctx context.Context, executionID uuid.UUID) ([]*models.ExecutionEvent, error)
- func (s TransactionalWorkflowService) GetPendingApprovals(ctx context.Context, approverID string) ([]*models.PendingApproval, error)
- func (s TransactionalWorkflowService) GetPendingSteps(ctx context.Context, executionID uuid.UUID) ([]*models.StepExecution, error)
- func (s TransactionalWorkflowService) GetStepExecution(ctx context.Context, executionID uuid.UUID, stepID string) (*models.StepExecution, error)
- func (s TransactionalWorkflowService) GetWorkflow(ctx context.Context, id uuid.UUID) (*models.Workflow, error)
- func (s TransactionalWorkflowService) GetWorkflowHistory(ctx context.Context, workflowID uuid.UUID, limit int, offset int) ([]*models.WorkflowExecution, error)
- func (s TransactionalWorkflowService) GetWorkflowMetrics(ctx context.Context, workflowID uuid.UUID) (*models.WorkflowMetrics, error)
- func (s TransactionalWorkflowService) GetWorkflowStats(ctx context.Context, workflowID uuid.UUID, period time.Duration) (*interfaces.WorkflowStats, error)
- func (s TransactionalWorkflowService) GetWorkflowTemplate(ctx context.Context, templateID uuid.UUID) (*models.WorkflowTemplate, error)
- func (s TransactionalWorkflowService) ListExecutions(ctx context.Context, workflowID uuid.UUID, filters interfaces.ExecutionFilters) ([]*models.WorkflowExecution, error)
- func (s TransactionalWorkflowService) ListWorkflowTemplates(ctx context.Context) ([]*models.WorkflowTemplate, error)
- func (s TransactionalWorkflowService) ListWorkflows(ctx context.Context, filters interfaces.WorkflowFilters) ([]*models.Workflow, error)
- func (s TransactionalWorkflowService) MergeBranchingPaths(ctx context.Context, executionID uuid.UUID, branchIDs []string) error
- func (s TransactionalWorkflowService) PauseExecution(ctx context.Context, executionID uuid.UUID, reason string) error
- func (s TransactionalWorkflowService) ResumeExecution(ctx context.Context, executionID uuid.UUID) error
- func (s TransactionalWorkflowService) RetryExecution(ctx context.Context, executionID uuid.UUID, fromStep string) error
- func (s TransactionalWorkflowService) RetryStep(ctx context.Context, executionID uuid.UUID, stepID string) error
- func (s TransactionalWorkflowService) SearchWorkflows(ctx context.Context, query string) ([]*models.Workflow, error)
- func (s TransactionalWorkflowService) SimulateWorkflow(ctx context.Context, workflow *models.Workflow, input map[string]interface{}) (*models.SimulationResult, error)
- func (s TransactionalWorkflowService) StartWorkflow(ctx context.Context, workflowID uuid.UUID, initiatorID string, ...) (*models.WorkflowExecution, error)
- func (s TransactionalWorkflowService) SubmitApproval(ctx context.Context, executionID uuid.UUID, stepID string, ...) error
- func (s TransactionalWorkflowService) UpdateExecution(ctx context.Context, execution *models.WorkflowExecution) error
- func (s TransactionalWorkflowService) UpdateWorkflow(ctx context.Context, workflow *models.Workflow) error
- func (s TransactionalWorkflowService) ValidateWorkflow(ctx context.Context, workflow *models.Workflow) error
- type TxConfig
- type TxOption
- type UnauthorizedError
- type UnauthorizedLockError
- type ValidationError
- type VersionMismatchError
- type WorkflowNotActiveError
- type WorkflowService
- type WorkspaceActivity
- type WorkspaceCreatedEvent
- type WorkspaceDeletedEvent
- type WorkspaceFullError
- type WorkspaceMember
- type WorkspaceMemberRole
- type WorkspaceMemberService
- type WorkspaceService
- type WorkspaceUpdatedEvent
Constants ¶
This section is empty.
Variables ¶
var ( ErrRateLimitExceeded = errors.New("rate limit exceeded") ErrQuotaExceeded = errors.New("quota exceeded") ErrInsufficientPermissions = errors.New("insufficient permissions") ErrConcurrentModification = errors.New("concurrent modification") ErrNoEligibleAgents = errors.New("no eligible agents") ErrNoCapableAgent = errors.New("no capable agent") ErrDelegationDenied = errors.New("delegation denied") ErrNotFound = errors.New("resource not found") ErrWorkflowNotActive = errors.New("workflow is not active") ErrDocumentLocked = errors.New("document is locked") ErrMergeConflict = errors.New("merge conflict detected") // Additional errors ErrInvalidID = errors.New("invalid ID format") ErrResourceNotFound = errors.New("resource not found") )
Service errors
var AssignmentStrategyLeastLoad = &LeastLoadedStrategy{}
AssignmentStrategyLeastLoad represents the least load assignment strategy
Functions ¶
func CreateDefaultCircuitBreakerSettings ¶
CreateDefaultCircuitBreakerSettings creates default circuit breaker settings
Types ¶
type AESEncryptionService ¶
type AESEncryptionService struct {
// contains filtered or unexported fields
}
AESEncryptionService provides AES-GCM encryption for production use
func (*AESEncryptionService) DecryptString ¶
func (s *AESEncryptionService) DecryptString(ctx context.Context, ciphertext string) (string, error)
DecryptString decrypts a base64 encoded string
func (*AESEncryptionService) EncryptString ¶
EncryptString encrypts a string and returns base64 encoded result
type AgentNotInWorkspaceError ¶
AgentNotInWorkspaceError represents agent not in workspace
func (AgentNotInWorkspaceError) Error ¶
func (e AgentNotInWorkspaceError) Error() string
type AgentService ¶
type AgentService interface {
GetAgent(ctx context.Context, agentID string) (*models.Agent, error)
GetAvailableAgents(ctx context.Context) ([]*models.Agent, error)
GetAgentCapabilities(ctx context.Context, agentID string) ([]string, error)
UpdateAgentStatus(ctx context.Context, agentID string, status string) error
GetAgentWorkload(ctx context.Context, agentID string) (*models.AgentWorkload, error)
}
AgentService provides agent management functionality
func NewAgentService ¶
func NewAgentService(config ServiceConfig, repo agent.Repository) AgentService
NewAgentService creates a new agent service
type AggregateRoot ¶
AggregateRoot represents an aggregate root for event sourcing
type AssignmentEngine ¶
type AssignmentEngine struct {
// contains filtered or unexported fields
}
AssignmentEngine handles intelligent task assignment
func NewAssignmentEngine ¶
func NewAssignmentEngine(ruleEngine rules.Engine, agentService AgentService, logger observability.Logger, metrics observability.MetricsClient) *AssignmentEngine
NewAssignmentEngine creates a new assignment engine
func (*AssignmentEngine) FindBestAgent ¶
func (e *AssignmentEngine) FindBestAgent(ctx context.Context, task *models.Task) (*models.Agent, error)
FindBestAgent finds the best agent for a task using rules and strategies
func (*AssignmentEngine) RegisterStrategy ¶
func (e *AssignmentEngine) RegisterStrategy(name string, strategy AssignmentStrategy)
RegisterStrategy registers an assignment strategy
type AssignmentStrategy ¶
type AssignmentStrategy interface {
Assign(ctx context.Context, task *models.Task, agents []*models.Agent) (*models.Agent, error)
GetName() string
}
AssignmentStrategy defines how tasks are assigned to agents
type BaseService ¶
type BaseService struct {
// contains filtered or unexported fields
}
BaseService provides common functionality for all services
func NewBaseService ¶
func NewBaseService(config ServiceConfig) BaseService
NewBaseService creates a new base service
func (*BaseService) CheckQuota ¶
CheckQuota verifies resource quota
func (*BaseService) CheckRateLimit ¶
func (s *BaseService) CheckRateLimit(ctx context.Context, resource string) error
CheckRateLimit enforces rate limiting per tenant/agent
func (*BaseService) PublishEvent ¶
func (s *BaseService) PublishEvent(ctx context.Context, eventType string, aggregate AggregateRoot, data interface{}) error
PublishEvent publishes an event with versioning and metadata
func (*BaseService) SetEventPublisher ¶
func (s *BaseService) SetEventPublisher(publisher events.EventPublisher)
SetEventPublisher sets the event publisher
func (*BaseService) SetEventStore ¶
func (s *BaseService) SetEventStore(store events.EventStore)
SetEventStore sets the event store
func (*BaseService) SetHealthChecker ¶
func (s *BaseService) SetHealthChecker(checker HealthChecker)
SetHealthChecker sets the health checker
func (*BaseService) StartDistributedTransaction ¶
func (s *BaseService) StartDistributedTransaction(ctx context.Context, opts ...TxOption) (context.Context, func(), func())
StartDistributedTransaction starts a new distributed transaction with options
func (*BaseService) WithTransaction ¶
func (s *BaseService) WithTransaction(ctx context.Context, fn func(ctx context.Context, tx Transaction) error) error
WithTransaction executes a function within a transaction with saga support
type CapabilityMatchStrategy ¶
type CapabilityMatchStrategy struct {
// contains filtered or unexported fields
}
CapabilityMatchStrategy assigns tasks based on agent capabilities
func (*CapabilityMatchStrategy) GetName ¶
func (s *CapabilityMatchStrategy) GetName() string
type CollaboratorAddedEvent ¶
type Compensator ¶
type Compensator struct {
// contains filtered or unexported fields
}
Compensator manages saga compensations
func NewCompensator ¶
func NewCompensator(logger observability.Logger) *Compensator
NewCompensator creates a new compensator
func (*Compensator) AddCompensation ¶
func (c *Compensator) AddCompensation(fn func() error)
AddCompensation adds a compensation function
func (*Compensator) Compensate ¶
func (c *Compensator) Compensate(ctx context.Context) error
Compensate runs all compensations
type ConcurrentModificationError ¶
ConcurrentModificationError represents a concurrent modification conflict
func (ConcurrentModificationError) Error ¶
func (e ConcurrentModificationError) Error() string
type ConflictResolutionService ¶
type ConflictResolutionService interface {
// Document conflict resolution
ResolveDocumentConflict(ctx context.Context, documentID uuid.UUID, operations []collaboration.DocumentOperation) (*models.Document, error)
GetDocumentCRDT(ctx context.Context, documentID uuid.UUID) (*collaboration.DocumentCRDT, error)
ApplyDocumentOperation(ctx context.Context, documentID uuid.UUID, operation *collaboration.CRDTOperation) error
SyncDocument(ctx context.Context, documentID uuid.UUID, remoteCRDT *collaboration.DocumentCRDT) error
// Workspace state conflict resolution
ResolveWorkspaceStateConflict(ctx context.Context, workspaceID uuid.UUID, operations []models.StateOperation) (*models.WorkspaceState, error)
GetWorkspaceStateCRDT(ctx context.Context, workspaceID uuid.UUID) (*collaboration.StateCRDT, error)
ApplyStateOperation(ctx context.Context, workspaceID uuid.UUID, operation *collaboration.StateOperation) error
SyncWorkspaceState(ctx context.Context, workspaceID uuid.UUID, remoteState *collaboration.StateCRDT) error
// Task conflict resolution
ResolveTaskConflict(ctx context.Context, taskID uuid.UUID, conflicts []models.TaskConflict) (*models.Task, error)
// General conflict detection
DetectConflicts(ctx context.Context, entityType string, entityID uuid.UUID) ([]*models.ConflictInfo, error)
GetConflictHistory(ctx context.Context, entityType string, entityID uuid.UUID) ([]*models.ConflictResolution, error)
// Vector clock management
GetVectorClock(ctx context.Context, nodeID string) (crdt.VectorClock, error)
UpdateVectorClock(ctx context.Context, nodeID string, clock crdt.VectorClock) error
}
ConflictResolutionService manages conflict resolution for collaborative entities
func NewConflictResolutionService ¶
func NewConflictResolutionService( config ServiceConfig, documentRepo interfaces.DocumentRepository, workspaceRepo interfaces.WorkspaceRepository, taskRepo interfaces.TaskRepository, nodeID string, ) ConflictResolutionService
NewConflictResolutionService creates a new conflict resolution service
type CostOptimizedStrategy ¶
type CostOptimizedStrategy struct {
// contains filtered or unexported fields
}
CostOptimizedStrategy assigns tasks based on cost optimization
func (*CostOptimizedStrategy) GetName ¶
func (s *CostOptimizedStrategy) GetName() string
type DeadlockInfo ¶
type DeadlockInfo struct {
ID string `json:"id"`
DetectedAt time.Time `json:"detected_at"`
InvolvedLocks []string `json:"involved_locks"`
Agents []string `json:"agents"`
CycleInfo string `json:"cycle_info"`
}
DeadlockInfo contains information about detected deadlocks
type DefaultSanitizer ¶
type DefaultSanitizer struct{}
DefaultSanitizer implements production-grade input sanitization
func (*DefaultSanitizer) SanitizeHTML ¶
func (s *DefaultSanitizer) SanitizeHTML(input string) string
func (*DefaultSanitizer) SanitizeJSON ¶
func (s *DefaultSanitizer) SanitizeJSON(input interface{}) (interface{}, error)
func (*DefaultSanitizer) SanitizeString ¶
func (s *DefaultSanitizer) SanitizeString(input string) string
type DelegationError ¶
type DelegationError struct {
Reason string
}
DelegationError provides delegation denial details
func (DelegationError) Error ¶
func (e DelegationError) Error() string
type DocumentLock ¶
type DocumentLock struct {
ID string `json:"id"`
DocumentID uuid.UUID `json:"document_id"`
AgentID string `json:"agent_id"`
Type LockType `json:"type"`
AcquiredAt time.Time `json:"acquired_at"`
ExpiresAt time.Time `json:"expires_at"`
RefreshCount int `json:"refresh_count"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
DocumentLock represents a lock on a document
type DocumentLockService ¶
type DocumentLockService interface {
// Document-level locking
LockDocument(ctx context.Context, documentID uuid.UUID, agentID string, duration time.Duration) (*DocumentLock, error)
UnlockDocument(ctx context.Context, documentID uuid.UUID, agentID string) error
ExtendLock(ctx context.Context, documentID uuid.UUID, agentID string, extension time.Duration) error
IsDocumentLocked(ctx context.Context, documentID uuid.UUID) (bool, *DocumentLock, error)
// Section-level locking
LockSection(ctx context.Context, documentID uuid.UUID, sectionID string, agentID string, duration time.Duration) (*SectionLock, error)
UnlockSection(ctx context.Context, documentID uuid.UUID, sectionID string, agentID string) error
GetSectionLocks(ctx context.Context, documentID uuid.UUID) ([]*SectionLock, error)
// Lock management
GetActiveLocks(ctx context.Context, agentID string) ([]*DocumentLock, error)
ReleaseAllLocks(ctx context.Context, agentID string) error
// Deadlock detection
DetectDeadlocks(ctx context.Context) ([]*DeadlockInfo, error)
ResolveDeadlock(ctx context.Context, deadlockID string) error
}
DocumentLockService provides distributed locking for documents
func NewDocumentLockService ¶
func NewDocumentLockService( config ServiceConfig, redisClient *redis.Client, ) DocumentLockService
NewDocumentLockService creates a new document lock service
type DocumentLockedError ¶
DocumentLockedError represents a locked document
func (DocumentLockedError) Error ¶
func (e DocumentLockedError) Error() string
type DocumentService ¶
type DocumentService interface {
// Document lifecycle
Create(ctx context.Context, doc *models.SharedDocument) error
Get(ctx context.Context, id uuid.UUID) (*models.SharedDocument, error)
Update(ctx context.Context, doc *models.SharedDocument) error
Delete(ctx context.Context, id uuid.UUID) error
// Collaborative editing
ApplyOperation(ctx context.Context, docID uuid.UUID, operation *collaboration.DocumentOperation) error
GetOperations(ctx context.Context, docID uuid.UUID, since time.Time) ([]*collaboration.DocumentOperation, error)
GetOperationsBySequence(ctx context.Context, docID uuid.UUID, fromSeq, toSeq int64) ([]*collaboration.DocumentOperation, error)
// Locking
AcquireLock(ctx context.Context, docID uuid.UUID, agentID string, duration time.Duration) error
ReleaseLock(ctx context.Context, docID uuid.UUID, agentID string) error
ExtendLock(ctx context.Context, docID uuid.UUID, agentID string, duration time.Duration) error
GetLockInfo(ctx context.Context, docID uuid.UUID) (*models.DocumentLock, error)
// Conflict resolution
DetectConflicts(ctx context.Context, docID uuid.UUID) ([]*models.ConflictInfo, error)
ResolveConflict(ctx context.Context, conflictID uuid.UUID, resolution interface{}) error
GetConflictHistory(ctx context.Context, docID uuid.UUID) ([]*models.ConflictResolution, error)
// Version management
CreateSnapshot(ctx context.Context, docID uuid.UUID) (*models.DocumentSnapshot, error)
GetSnapshot(ctx context.Context, docID uuid.UUID, version int64) (*models.DocumentSnapshot, error)
ListSnapshots(ctx context.Context, docID uuid.UUID) ([]*models.DocumentSnapshot, error)
RestoreSnapshot(ctx context.Context, docID uuid.UUID, version int64) error
// Search and query
SearchDocuments(ctx context.Context, query string, filters interfaces.DocumentFilters) ([]*models.SharedDocument, error)
GetDocumentsByWorkspace(ctx context.Context, workspaceID uuid.UUID) ([]*models.SharedDocument, error)
GetDocumentsByCreator(ctx context.Context, createdBy string) ([]*models.SharedDocument, error)
// Analytics
GetDocumentStats(ctx context.Context, docID uuid.UUID) (*interfaces.DocumentStats, error)
GetCollaborationMetrics(ctx context.Context, docID uuid.UUID, period time.Duration) (*models.CollaborationMetrics, error)
// Real-time updates
SubscribeToChanges(ctx context.Context, docID uuid.UUID, handler func(operation *collaboration.DocumentOperation)) (unsubscribe func())
BroadcastChange(ctx context.Context, docID uuid.UUID, operation *collaboration.DocumentOperation) error
}
DocumentService manages collaborative documents with conflict resolution
func NewDocumentService ¶
func NewDocumentService( config ServiceConfig, documentRepo interfaces.DocumentRepository, cache cache.Cache, ) DocumentService
NewDocumentService creates a production-grade document service
func NewDocumentServiceWithLocks ¶
func NewDocumentServiceWithLocks( config ServiceConfig, documentRepo interfaces.DocumentRepository, cache cache.Cache, lockService DocumentLockService, ) DocumentService
NewDocumentServiceWithLocks creates a document service with distributed locking
type EncryptionService ¶
type EncryptionService interface {
Encrypt(ctx context.Context, data []byte) ([]byte, error)
Decrypt(ctx context.Context, data []byte) ([]byte, error)
EncryptString(ctx context.Context, data string) (string, error)
DecryptString(ctx context.Context, data string) (string, error)
}
EncryptionService provides encryption functionality
func NewAESEncryptionService ¶
func NewAESEncryptionService(key []byte) (EncryptionService, error)
NewAESEncryptionService creates a production encryption service with AES-256-GCM
func NewNoOpEncryptionService ¶
func NewNoOpEncryptionService() EncryptionService
NewNoOpEncryptionService creates a new no-op encryption service
type EnhancedTaskService ¶
type EnhancedTaskService struct {
// contains filtered or unexported fields
}
EnhancedTaskService implements TaskService with production features
func (*EnhancedTaskService) AcceptTask ¶
func (s *EnhancedTaskService) AcceptTask(ctx context.Context, taskID uuid.UUID, agentID string) error
AcceptTask accepts a delegated task with validation
func (EnhancedTaskService) ArchiveCompletedTasks ¶
func (EnhancedTaskService) AssignTask ¶
func (EnhancedTaskService) AutoAssignTask ¶
func (EnhancedTaskService) CancelTaskTree ¶
func (*EnhancedTaskService) CompleteTask ¶
func (s *EnhancedTaskService) CompleteTask(ctx context.Context, taskID uuid.UUID, agentID string, result interface{}) error
CompleteTask completes a task with result storage
func (EnhancedTaskService) CompleteWorkflowTask ¶
func (*EnhancedTaskService) Create ¶
func (s *EnhancedTaskService) Create(ctx context.Context, task *models.Task, idempotencyKey string) error
Create creates a task with idempotency support
func (EnhancedTaskService) CreateBatch ¶
CreateBatch creates multiple tasks in a single operation
func (EnhancedTaskService) CreateDistributedTask ¶
func (s EnhancedTaskService) CreateDistributedTask(ctx context.Context, dt *models.DistributedTask) error
CreateDistributedTask creates a task with subtasks using saga pattern
func (EnhancedTaskService) CreateWorkflowTask ¶
func (*EnhancedTaskService) DelegateTask ¶
func (s *EnhancedTaskService) DelegateTask(ctx context.Context, delegation *models.TaskDelegation) error
DelegateTask delegates a task with history tracking
func (EnhancedTaskService) GenerateTaskReport ¶
func (s EnhancedTaskService) GenerateTaskReport(ctx context.Context, filters interfaces.TaskFilters, format string) ([]byte, error)
func (EnhancedTaskService) GetAgentPerformance ¶
func (EnhancedTaskService) GetAgentTasks ¶
func (s EnhancedTaskService) GetAgentTasks(ctx context.Context, agentID string, filters interfaces.TaskFilters) ([]*models.Task, error)
func (EnhancedTaskService) GetAvailableTasks ¶
func (EnhancedTaskService) GetTaskStats ¶
func (s EnhancedTaskService) GetTaskStats(ctx context.Context, filters interfaces.TaskFilters) (*models.TaskStats, error)
func (EnhancedTaskService) GetTaskTimeline ¶
func (EnhancedTaskService) GetTaskTree ¶
func (EnhancedTaskService) RebalanceTasks ¶
func (EnhancedTaskService) RejectTask ¶
func (EnhancedTaskService) SearchTasks ¶
func (s EnhancedTaskService) SearchTasks(ctx context.Context, query string, filters interfaces.TaskFilters) ([]*models.Task, error)
func (EnhancedTaskService) SubmitSubtaskResult ¶
func (EnhancedTaskService) UpdateProgress ¶
func (*EnhancedTaskService) UpdateStatus ¶
func (s *EnhancedTaskService) UpdateStatus(ctx context.Context, taskID uuid.UUID, newStatus models.TaskStatus, reason string) error
UpdateStatus updates task status with state machine validation
type EventBus ¶
type EventBus interface {
Subscribe(topic string, handler func(event interface{})) (unsubscribe func())
Publish(topic string, event interface{})
Close()
}
EventBus provides event broadcasting
type ExecutionMonitor ¶
type ExecutionMonitor struct {
// contains filtered or unexported fields
}
ExecutionMonitor monitors running workflow executions
func NewExecutionMonitor ¶
func NewExecutionMonitor(service *workflowService) *ExecutionMonitor
func (*ExecutionMonitor) Start ¶
func (m *ExecutionMonitor) Start()
func (*ExecutionMonitor) Stop ¶
func (m *ExecutionMonitor) Stop()
type HealthChecker ¶
type HealthChecker interface {
Check(ctx context.Context) error
RegisterCheck(name string, check func(context.Context) error)
}
HealthChecker provides health check functionality
type InMemoryQuotaManager ¶
type InMemoryQuotaManager struct {
// contains filtered or unexported fields
}
InMemoryQuotaManager implements a production-grade in-memory quota manager
func (*InMemoryQuotaManager) GetQuotaStatus ¶
func (qm *InMemoryQuotaManager) GetQuotaStatus(ctx context.Context, tenantID uuid.UUID) (*QuotaStatus, error)
func (*InMemoryQuotaManager) IncrementUsage ¶
type InMemoryRateLimiter ¶
type InMemoryRateLimiter struct {
// contains filtered or unexported fields
}
InMemoryRateLimiter implements a production-grade in-memory rate limiter
func (*InMemoryRateLimiter) Check ¶
func (rl *InMemoryRateLimiter) Check(ctx context.Context, key string) error
func (*InMemoryRateLimiter) CheckWithLimit ¶
func (*InMemoryRateLimiter) GetRemaining ¶
type LeastLoadedStrategy ¶
type LeastLoadedStrategy struct {
// contains filtered or unexported fields
}
LeastLoadedStrategy assigns tasks to the least loaded agent
func (*LeastLoadedStrategy) GetName ¶
func (s *LeastLoadedStrategy) GetName() string
type LockConflictError ¶
func (*LockConflictError) Error ¶
func (e *LockConflictError) Error() string
type LockNotFoundError ¶
func (*LockNotFoundError) Error ¶
func (e *LockNotFoundError) Error() string
type LockRefreshLimitError ¶
func (*LockRefreshLimitError) Error ¶
func (e *LockRefreshLimitError) Error() string
type MergeConflictError ¶
MergeConflictError represents a document merge conflict
func (MergeConflictError) Error ¶
func (e MergeConflictError) Error() string
type NoEligibleAgentsError ¶
NoEligibleAgentsError represents no eligible agents found
func (NoEligibleAgentsError) Error ¶
func (e NoEligibleAgentsError) Error() string
type NoOpEncryptionService ¶
type NoOpEncryptionService struct{}
NoOpEncryptionService implements a no-op encryption service for development In production, this would use AES-GCM or similar
func (*NoOpEncryptionService) DecryptString ¶
func (*NoOpEncryptionService) EncryptString ¶
type NoOpSpan ¶
type NoOpSpan struct{}
NoOpSpan implements a no-op span for tracing
func (NoOpSpan) RecordError ¶
func (NoOpSpan) SetAttribute ¶
type NotificationService ¶
type NotificationService interface {
NotifyTaskAssigned(ctx context.Context, agentID string, task interface{}) error
NotifyTaskCompleted(ctx context.Context, agentID string, task interface{}) error
NotifyTaskFailed(ctx context.Context, taskID uuid.UUID, agentID string, reason string) error
NotifyWorkflowStarted(ctx context.Context, workflow interface{}) error
NotifyWorkflowCompleted(ctx context.Context, workflow interface{}) error
NotifyWorkflowFailed(ctx context.Context, workflowID uuid.UUID, reason string) error
NotifyWorkflowUpdated(ctx context.Context, workflow interface{}) error
NotifyStepStarted(ctx context.Context, executionID uuid.UUID, stepID string) error
NotifyStepCompleted(ctx context.Context, executionID uuid.UUID, stepID string, output interface{}) error
NotifyResourceDeleted(ctx context.Context, resourceType string, resourceID uuid.UUID) error
BroadcastToAgents(ctx context.Context, agentIDs []string, message interface{}) error
BroadcastToWorkspace(ctx context.Context, workspaceID uuid.UUID, message interface{}) error
}
NotificationService handles notifications
func NewNotificationService ¶
func NewNotificationService(config ServiceConfig) NotificationService
NewNotificationService creates a new notification service
type PerformanceBasedStrategy ¶
type PerformanceBasedStrategy struct {
// contains filtered or unexported fields
}
PerformanceBasedStrategy assigns tasks based on agent performance metrics
func (*PerformanceBasedStrategy) GetName ¶
func (s *PerformanceBasedStrategy) GetName() string
type ProgressTracker ¶
type ProgressTracker struct {
// contains filtered or unexported fields
}
ProgressTracker tracks task progress
func NewProgressTracker ¶
func NewProgressTracker(service *taskService) *ProgressTracker
NewProgressTracker creates a new progress tracker
func (*ProgressTracker) Track ¶
func (t *ProgressTracker) Track(taskID uuid.UUID)
Track adds a task to track
func (*ProgressTracker) Untrack ¶
func (t *ProgressTracker) Untrack(taskID uuid.UUID)
Untrack removes a task from tracking
type QuotaError ¶
QuotaError provides quota details
func (QuotaError) Error ¶
func (e QuotaError) Error() string
type QuotaExceededError ¶
QuotaExceededError represents a quota exceeded error (alternative structure)
func (QuotaExceededError) Error ¶
func (e QuotaExceededError) Error() string
type QuotaManager ¶
type QuotaManager interface {
GetQuota(ctx context.Context, tenantID uuid.UUID, resource string) (int64, error)
GetUsage(ctx context.Context, tenantID uuid.UUID, resource string) (int64, error)
IncrementUsage(ctx context.Context, tenantID uuid.UUID, resource string, amount int64) error
SetQuota(ctx context.Context, tenantID uuid.UUID, resource string, limit int64) error
GetQuotaStatus(ctx context.Context, tenantID uuid.UUID) (*QuotaStatus, error)
}
QuotaManager manages resource quotas
func NewInMemoryQuotaManager ¶
func NewInMemoryQuotaManager() QuotaManager
NewInMemoryQuotaManager creates a new in-memory quota manager
type QuotaStatus ¶
QuotaStatus represents the quota status for a tenant
type RateLimitError ¶
RateLimitError provides rate limit details
func (RateLimitError) Error ¶
func (e RateLimitError) Error() string
type RateLimiter ¶
type RateLimiter interface {
Check(ctx context.Context, key string) error
CheckWithLimit(ctx context.Context, key string, limit int, window time.Duration) error
GetRemaining(ctx context.Context, key string) (int, error)
Reset(ctx context.Context, key string) error
}
RateLimiter provides rate limiting functionality
func NewInMemoryRateLimiter ¶
func NewInMemoryRateLimiter(rate int, window time.Duration) RateLimiter
NewInMemoryRateLimiter creates a new in-memory rate limiter
type ResultAggregator ¶
type ResultAggregator struct {
// contains filtered or unexported fields
}
ResultAggregator aggregates results from distributed tasks
func NewResultAggregator ¶
func NewResultAggregator() *ResultAggregator
NewResultAggregator creates a new result aggregator
func (*ResultAggregator) AddResult ¶
func (a *ResultAggregator) AddResult(parentTaskID, subtaskID uuid.UUID, result interface{})
AddResult adds a subtask result
func (*ResultAggregator) AggregateResults ¶
func (a *ResultAggregator) AggregateResults(parentTaskID uuid.UUID, config models.AggregationConfig) (interface{}, error)
AggregateResults aggregates results based on configuration
func (*ResultAggregator) Clear ¶
func (a *ResultAggregator) Clear(parentTaskID uuid.UUID)
Clear clears results for a parent task
func (*ResultAggregator) GetResults ¶
func (a *ResultAggregator) GetResults(parentTaskID uuid.UUID) map[uuid.UUID]interface{}
GetResults gets all results for a parent task
type RoundRobinStrategy ¶
type RoundRobinStrategy struct {
// contains filtered or unexported fields
}
RoundRobinStrategy assigns tasks in round-robin fashion
func (*RoundRobinStrategy) GetName ¶
func (s *RoundRobinStrategy) GetName() string
type Sanitizer ¶
type Sanitizer interface {
SanitizeString(input string) string
SanitizeJSON(input interface{}) (interface{}, error)
SanitizeHTML(input string) string
}
Sanitizer provides input sanitization
func NewDefaultSanitizer ¶
func NewDefaultSanitizer() Sanitizer
NewDefaultSanitizer creates a new default sanitizer
type SectionLock ¶
type SectionLock struct {
DocumentLock
SectionID string `json:"section_id"`
StartOffset int `json:"start_offset"`
EndOffset int `json:"end_offset"`
}
SectionLock represents a lock on a document section
type SectionLockConflictError ¶
func (*SectionLockConflictError) Error ¶
func (e *SectionLockConflictError) Error() string
type ServiceConfig ¶
type ServiceConfig struct {
// Resilience
CircuitBreaker *gobreaker.Settings
RetryPolicy resilience.RetryPolicy
TimeoutPolicy resilience.TimeoutPolicy
BulkheadPolicy resilience.BulkheadPolicy
// Rate Limiting
RateLimiter RateLimiter
QuotaManager QuotaManager
// Security
Authorizer auth.Authorizer
Sanitizer Sanitizer
EncryptionService EncryptionService
// Observability
Logger observability.Logger
Metrics observability.MetricsClient
Tracer observability.StartSpanFunc
// Business Rules
RuleEngine rules.Engine
PolicyManager rules.PolicyManager
}
ServiceConfig provides common configuration for all services
type StateStore ¶
type StateStore interface {
GetState(ctx context.Context, key string) (interface{}, error)
SetState(ctx context.Context, key string, value interface{}) error
GetStateForUpdate(ctx context.Context, key string) (interface{}, error)
SaveState(ctx context.Context, key string, state interface{}) error
}
StateStore provides state persistence
type StepDependencyError ¶
StepDependencyError represents a step dependency failure
func (StepDependencyError) Error ¶
func (e StepDependencyError) Error() string
type StepNotFoundError ¶
StepNotFoundError represents a missing workflow step
func (StepNotFoundError) Error ¶
func (e StepNotFoundError) Error() string
type TaskCreationSaga ¶
type TaskCreationSaga struct {
// contains filtered or unexported fields
}
TaskCreationSaga handles distributed task creation
func NewTaskCreationSaga ¶
func NewTaskCreationSaga(service *taskService, dt *models.DistributedTask) *TaskCreationSaga
NewTaskCreationSaga creates a new task creation saga
func (*TaskCreationSaga) CreateMainTask ¶
func (s *TaskCreationSaga) CreateMainTask(ctx context.Context, tx Transaction) (*models.Task, error)
CreateMainTask creates the main task
func (*TaskCreationSaga) CreateSubtask ¶
func (s *TaskCreationSaga) CreateSubtask(ctx context.Context, tx Transaction, mainTask *models.Task, subtaskDef models.Subtask, agent *models.Agent) (*models.Task, error)
CreateSubtask creates a subtask
func (*TaskCreationSaga) DeleteMainTask ¶
DeleteMainTask deletes the main task (compensation)
func (*TaskCreationSaga) DeleteSubtask ¶
DeleteSubtask deletes a subtask (compensation)
func (*TaskCreationSaga) PublishEvents ¶
func (s *TaskCreationSaga) PublishEvents(ctx context.Context) error
PublishEvents publishes all saga events
type TaskRebalancer ¶
type TaskRebalancer struct {
// contains filtered or unexported fields
}
TaskRebalancer handles task rebalancing
func NewTaskRebalancer ¶
func NewTaskRebalancer(service *taskService, ruleEngine rules.Engine) *TaskRebalancer
NewTaskRebalancer creates a new task rebalancer
type TaskService ¶
type TaskService interface {
// Task lifecycle with idempotency
Create(ctx context.Context, task *models.Task, idempotencyKey string) error
CreateBatch(ctx context.Context, tasks []*models.Task) error
Get(ctx context.Context, id uuid.UUID) (*models.Task, error)
GetBatch(ctx context.Context, ids []uuid.UUID) ([]*models.Task, error)
Update(ctx context.Context, task *models.Task) error
Delete(ctx context.Context, id uuid.UUID) error
// Task assignment with load balancing
AssignTask(ctx context.Context, taskID uuid.UUID, agentID string) error
AutoAssignTask(ctx context.Context, taskID uuid.UUID, strategy AssignmentStrategy) error
DelegateTask(ctx context.Context, delegation *models.TaskDelegation) error
AcceptTask(ctx context.Context, taskID uuid.UUID, agentID string) error
RejectTask(ctx context.Context, taskID uuid.UUID, agentID string, reason string) error
// Task execution with monitoring
StartTask(ctx context.Context, taskID uuid.UUID, agentID string) error
UpdateProgress(ctx context.Context, taskID uuid.UUID, progress int, message string) error
CompleteTask(ctx context.Context, taskID uuid.UUID, agentID string, result interface{}) error
FailTask(ctx context.Context, taskID uuid.UUID, agentID string, errorMsg string) error
RetryTask(ctx context.Context, taskID uuid.UUID) error
// Advanced querying with caching
GetAgentTasks(ctx context.Context, agentID string, filters interfaces.TaskFilters) ([]*models.Task, error)
GetAvailableTasks(ctx context.Context, agentID string, capabilities []string) ([]*models.Task, error)
SearchTasks(ctx context.Context, query string, filters interfaces.TaskFilters) ([]*models.Task, error)
GetTaskTimeline(ctx context.Context, taskID uuid.UUID) ([]*models.TaskEvent, error)
// Distributed task management
CreateDistributedTask(ctx context.Context, task *models.DistributedTask) error
SubmitSubtaskResult(ctx context.Context, parentTaskID, subtaskID uuid.UUID, result interface{}) error
GetTaskTree(ctx context.Context, rootTaskID uuid.UUID) (*models.TaskTree, error)
CancelTaskTree(ctx context.Context, rootTaskID uuid.UUID, reason string) error
// Workflow integration
CreateWorkflowTask(ctx context.Context, workflowID, stepID uuid.UUID, params map[string]interface{}) (*models.Task, error)
CompleteWorkflowTask(ctx context.Context, taskID uuid.UUID, output interface{}) error
// Analytics and reporting
GetTaskStats(ctx context.Context, filters interfaces.TaskFilters) (*models.TaskStats, error)
GetAgentPerformance(ctx context.Context, agentID string, period time.Duration) (*models.AgentPerformance, error)
GenerateTaskReport(ctx context.Context, filters interfaces.TaskFilters, format string) ([]byte, error)
// Maintenance
ArchiveCompletedTasks(ctx context.Context, before time.Time) (int64, error)
RebalanceTasks(ctx context.Context) error
}
TaskService handles task lifecycle with production features
func NewEnhancedTaskService ¶
func NewEnhancedTaskService( baseService *taskService, txManager repository.TransactionManager, uow database.UnitOfWork, eventPublisher events.Publisher, ) TaskService
NewEnhancedTaskService creates a production-ready task service
func NewTaskService ¶
func NewTaskService( config ServiceConfig, repo interfaces.TaskRepository, agentService AgentService, notifier NotificationService, ) TaskService
NewTaskService creates a production-ready task service
type TaskStateMachine ¶
type TaskStateMachine struct {
// contains filtered or unexported fields
}
TaskStateMachine defines valid state transitions
func NewTaskStateMachine ¶
func NewTaskStateMachine() *TaskStateMachine
NewTaskStateMachine creates a new state machine for task status transitions
func (*TaskStateMachine) CanTransition ¶
func (sm *TaskStateMachine) CanTransition(from, to models.TaskStatus) bool
CanTransition checks if a status transition is valid
type TenantAwareAuthService ¶
TenantAwareAuthService extends the auth service with tenant configuration support
func NewTenantAwareAuthService ¶
func NewTenantAwareAuthService(authService *auth.Service, tenantConfigService TenantConfigService, logger observability.Logger) *TenantAwareAuthService
NewTenantAwareAuthService creates a new tenant-aware auth service
func (*TenantAwareAuthService) CheckFeatureEnabled ¶
func (s *TenantAwareAuthService) CheckFeatureEnabled(ctx context.Context, tenantID, feature string) (bool, error)
CheckFeatureEnabled checks if a feature is enabled for a tenant
func (*TenantAwareAuthService) GetAllowedOrigins ¶
func (s *TenantAwareAuthService) GetAllowedOrigins(ctx context.Context, tenantID string) ([]string, error)
GetAllowedOrigins returns the allowed CORS origins for a tenant
func (*TenantAwareAuthService) GetServiceToken ¶
func (s *TenantAwareAuthService) GetServiceToken(ctx context.Context, tenantID, provider string) (string, error)
GetServiceToken retrieves a decrypted service token for a tenant and provider
func (*TenantAwareAuthService) ValidateAPIKeyWithTenantConfig ¶
func (s *TenantAwareAuthService) ValidateAPIKeyWithTenantConfig(ctx context.Context, apiKey string) (*auth.User, *models.TenantConfig, error)
ValidateAPIKeyWithTenantConfig validates an API key and returns both user and tenant configuration
func (*TenantAwareAuthService) ValidateWithEndpointRateLimit ¶
func (s *TenantAwareAuthService) ValidateWithEndpointRateLimit(ctx context.Context, apiKey, endpoint string) (*auth.User, *models.EndpointRateLimit, error)
ValidateWithEndpointRateLimit validates an API key and checks endpoint-specific rate limits
type TenantConfigService ¶
type TenantConfigService interface {
GetConfig(ctx context.Context, tenantID string) (*models.TenantConfig, error)
CreateConfig(ctx context.Context, config *models.TenantConfig) error
UpdateConfig(ctx context.Context, config *models.TenantConfig) error
DeleteConfig(ctx context.Context, tenantID string) error
// Service token management
SetServiceToken(ctx context.Context, tenantID, provider, token string) error
RemoveServiceToken(ctx context.Context, tenantID, provider string) error
// Feature flag management
SetFeature(ctx context.Context, tenantID, feature string, value interface{}) error
IsFeatureEnabled(ctx context.Context, tenantID, feature string) (bool, error)
// Rate limit management
SetRateLimitForKeyType(ctx context.Context, tenantID, keyType string, limit models.KeyTypeRateLimit) error
SetRateLimitForEndpoint(ctx context.Context, tenantID, endpoint string, limit models.EndpointRateLimit) error
}
TenantConfigService handles tenant configuration management
func NewTenantConfigService ¶
func NewTenantConfigService( repo repository.TenantConfigRepository, cache cache.Cache, encryption EncryptionService, logger observability.Logger, ) TenantConfigService
NewTenantConfigService creates a new tenant configuration service
type Transaction ¶
Transaction represents a distributed transaction
type TransactionParticipant ¶
type TransactionParticipant interface {
Prepare(ctx context.Context) error
Commit(ctx context.Context) error
Rollback(ctx context.Context) error
GetID() string
}
TransactionParticipant represents a participant in a distributed transaction
type TransactionState ¶
type TransactionState int
Transaction states
const ( TxStateActive TransactionState = iota TxStatePreparing TxStateCommitting TxStateAborting TxStateCommitted TxStateAborted )
type TransactionalWorkflowService ¶
type TransactionalWorkflowService struct {
// contains filtered or unexported fields
}
TransactionalWorkflowService extends the workflow service with proper transaction management
func (TransactionalWorkflowService) ArchiveCompletedExecutions ¶
func (TransactionalWorkflowService) CancelExecution ¶
func (TransactionalWorkflowService) CompleteStep ¶
func (s TransactionalWorkflowService) CompleteStep(ctx context.Context, executionID uuid.UUID, stepID string, output map[string]interface{}) error
CompleteStep marks a workflow step as completed
func (TransactionalWorkflowService) CreateBranchingPath ¶
func (TransactionalWorkflowService) CreateCompensation ¶
func (TransactionalWorkflowService) CreateExecution ¶
func (s TransactionalWorkflowService) CreateExecution(ctx context.Context, execution *models.WorkflowExecution) error
CreateExecution creates a new workflow execution record
func (TransactionalWorkflowService) CreateFromTemplate ¶
func (TransactionalWorkflowService) CreateWorkflow ¶
func (s TransactionalWorkflowService) CreateWorkflow(ctx context.Context, workflow *models.Workflow) error
CreateWorkflow creates a new workflow with validation
func (TransactionalWorkflowService) CreateWorkflowTemplate ¶
func (s TransactionalWorkflowService) CreateWorkflowTemplate(ctx context.Context, template *models.WorkflowTemplate) error
func (TransactionalWorkflowService) DeleteWorkflow ¶
func (TransactionalWorkflowService) ExecuteCompensation ¶
func (TransactionalWorkflowService) ExecuteWithCircuitBreaker ¶
func (s TransactionalWorkflowService) ExecuteWithCircuitBreaker(ctx context.Context, operation string, fn func() (interface{}, error)) (interface{}, error)
ExecuteWithCircuitBreaker executes a function with circuit breaker protection
func (*TransactionalWorkflowService) ExecuteWorkflow ¶
func (s *TransactionalWorkflowService) ExecuteWorkflow(ctx context.Context, workflowID uuid.UUID, input map[string]interface{}, idempotencyKey string) (*models.WorkflowExecution, error)
ExecuteWorkflow executes a workflow with full transaction support
func (*TransactionalWorkflowService) ExecuteWorkflowStep ¶
func (s *TransactionalWorkflowService) ExecuteWorkflowStep(ctx context.Context, executionID uuid.UUID, stepID string) error
ExecuteWorkflowStep executes a single workflow step with transaction and savepoint support
func (TransactionalWorkflowService) FailStep ¶
func (s TransactionalWorkflowService) FailStep(ctx context.Context, executionID uuid.UUID, stepID string, reason string, details map[string]interface{}) error
FailStep marks a workflow step as failed
func (TransactionalWorkflowService) GenerateWorkflowReport ¶
func (s TransactionalWorkflowService) GenerateWorkflowReport(ctx context.Context, filters interfaces.WorkflowFilters, format string) ([]byte, error)
func (TransactionalWorkflowService) GetCurrentStep ¶
func (s TransactionalWorkflowService) GetCurrentStep(ctx context.Context, executionID uuid.UUID) (*models.StepExecution, error)
GetCurrentStep returns the currently executing step
func (TransactionalWorkflowService) GetExecution ¶
func (TransactionalWorkflowService) GetExecutionHistory ¶
func (s TransactionalWorkflowService) GetExecutionHistory(ctx context.Context, workflowID uuid.UUID) ([]*models.WorkflowExecution, error)
GetExecutionHistory returns the execution history (same as GetWorkflowHistory for compatibility)
func (TransactionalWorkflowService) GetExecutionStatus ¶
func (TransactionalWorkflowService) GetExecutionTimeline ¶
func (TransactionalWorkflowService) GetPendingApprovals ¶
func (TransactionalWorkflowService) GetPendingSteps ¶
func (s TransactionalWorkflowService) GetPendingSteps(ctx context.Context, executionID uuid.UUID) ([]*models.StepExecution, error)
GetPendingSteps returns all pending steps for parallel execution
func (TransactionalWorkflowService) GetStepExecution ¶
func (s TransactionalWorkflowService) GetStepExecution(ctx context.Context, executionID uuid.UUID, stepID string) (*models.StepExecution, error)
GetStepExecution returns a specific step execution
func (TransactionalWorkflowService) GetWorkflow ¶
func (TransactionalWorkflowService) GetWorkflowHistory ¶
func (s TransactionalWorkflowService) GetWorkflowHistory(ctx context.Context, workflowID uuid.UUID, limit int, offset int) ([]*models.WorkflowExecution, error)
GetWorkflowHistory returns execution history for a workflow
func (TransactionalWorkflowService) GetWorkflowMetrics ¶
func (s TransactionalWorkflowService) GetWorkflowMetrics(ctx context.Context, workflowID uuid.UUID) (*models.WorkflowMetrics, error)
GetWorkflowMetrics returns metrics for a workflow
func (TransactionalWorkflowService) GetWorkflowStats ¶
func (s TransactionalWorkflowService) GetWorkflowStats(ctx context.Context, workflowID uuid.UUID, period time.Duration) (*interfaces.WorkflowStats, error)
func (TransactionalWorkflowService) GetWorkflowTemplate ¶
func (TransactionalWorkflowService) ListExecutions ¶
func (s TransactionalWorkflowService) ListExecutions(ctx context.Context, workflowID uuid.UUID, filters interfaces.ExecutionFilters) ([]*models.WorkflowExecution, error)
func (TransactionalWorkflowService) ListWorkflowTemplates ¶
func (s TransactionalWorkflowService) ListWorkflowTemplates(ctx context.Context) ([]*models.WorkflowTemplate, error)
func (TransactionalWorkflowService) ListWorkflows ¶
func (s TransactionalWorkflowService) ListWorkflows(ctx context.Context, filters interfaces.WorkflowFilters) ([]*models.Workflow, error)
func (TransactionalWorkflowService) MergeBranchingPaths ¶
func (TransactionalWorkflowService) PauseExecution ¶
func (TransactionalWorkflowService) ResumeExecution ¶
func (TransactionalWorkflowService) RetryExecution ¶
func (TransactionalWorkflowService) RetryStep ¶
func (s TransactionalWorkflowService) RetryStep(ctx context.Context, executionID uuid.UUID, stepID string) error
RetryStep retries a failed workflow step
func (TransactionalWorkflowService) SearchWorkflows ¶
func (TransactionalWorkflowService) SimulateWorkflow ¶
func (TransactionalWorkflowService) StartWorkflow ¶
func (s TransactionalWorkflowService) StartWorkflow(ctx context.Context, workflowID uuid.UUID, initiatorID string, input map[string]interface{}) (*models.WorkflowExecution, error)
StartWorkflow starts a new workflow execution
func (TransactionalWorkflowService) SubmitApproval ¶
func (TransactionalWorkflowService) UpdateExecution ¶
func (s TransactionalWorkflowService) UpdateExecution(ctx context.Context, execution *models.WorkflowExecution) error
func (TransactionalWorkflowService) UpdateWorkflow ¶
type TxConfig ¶
type TxConfig struct {
Timeout time.Duration
IsolationLevel string
RetryPolicy resilience.RetryPolicy
}
TxConfig holds transaction configuration
type TxOption ¶
type TxOption func(*TxConfig)
TxOption configures a distributed transaction
func WithTxIsolationLevel ¶
WithTxIsolationLevel sets the transaction isolation level
func WithTxRetryPolicy ¶
func WithTxRetryPolicy(policy resilience.RetryPolicy) TxOption
WithTxRetryPolicy sets the transaction retry policy
func WithTxTimeout ¶
WithTxTimeout sets the transaction timeout
type UnauthorizedError ¶
type UnauthorizedError struct {
}
UnauthorizedError provides authorization failure details
func (UnauthorizedError) Error ¶
func (e UnauthorizedError) Error() string
type UnauthorizedLockError ¶
type UnauthorizedLockError struct {
}
func (*UnauthorizedLockError) Error ¶
func (e *UnauthorizedLockError) Error() string
type ValidationError ¶
ValidationError represents a validation failure
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type VersionMismatchError ¶
VersionMismatchError represents a document version mismatch
func (VersionMismatchError) Error ¶
func (e VersionMismatchError) Error() string
type WorkflowNotActiveError ¶
WorkflowNotActiveError represents an inactive workflow
func (WorkflowNotActiveError) Error ¶
func (e WorkflowNotActiveError) Error() string
type WorkflowService ¶
type WorkflowService interface {
// Workflow management
CreateWorkflow(ctx context.Context, workflow *models.Workflow) error
GetWorkflow(ctx context.Context, id uuid.UUID) (*models.Workflow, error)
UpdateWorkflow(ctx context.Context, workflow *models.Workflow) error
DeleteWorkflow(ctx context.Context, id uuid.UUID) error
ListWorkflows(ctx context.Context, filters interfaces.WorkflowFilters) ([]*models.Workflow, error)
SearchWorkflows(ctx context.Context, query string) ([]*models.Workflow, error)
// Execution management
CreateExecution(ctx context.Context, execution *models.WorkflowExecution) error
ExecuteWorkflow(ctx context.Context, workflowID uuid.UUID, input map[string]interface{}, idempotencyKey string) (*models.WorkflowExecution, error)
ExecuteWorkflowStep(ctx context.Context, executionID uuid.UUID, stepID string) error
StartWorkflow(ctx context.Context, workflowID uuid.UUID, initiatorID string, input map[string]interface{}) (*models.WorkflowExecution, error)
GetExecution(ctx context.Context, executionID uuid.UUID) (*models.WorkflowExecution, error)
ListExecutions(ctx context.Context, workflowID uuid.UUID, filters interfaces.ExecutionFilters) ([]*models.WorkflowExecution, error)
GetExecutionStatus(ctx context.Context, executionID uuid.UUID) (*models.ExecutionStatus, error)
GetExecutionTimeline(ctx context.Context, executionID uuid.UUID) ([]*models.ExecutionEvent, error)
GetExecutionHistory(ctx context.Context, workflowID uuid.UUID) ([]*models.WorkflowExecution, error)
// Execution control
UpdateExecution(ctx context.Context, execution *models.WorkflowExecution) error
PauseExecution(ctx context.Context, executionID uuid.UUID, reason string) error
ResumeExecution(ctx context.Context, executionID uuid.UUID) error
CancelExecution(ctx context.Context, executionID uuid.UUID, reason string) error
RetryExecution(ctx context.Context, executionID uuid.UUID, fromStep string) error
// Step management
CompleteStep(ctx context.Context, executionID uuid.UUID, stepID string, output map[string]interface{}) error
FailStep(ctx context.Context, executionID uuid.UUID, stepID string, reason string, details map[string]interface{}) error
RetryStep(ctx context.Context, executionID uuid.UUID, stepID string) error
GetCurrentStep(ctx context.Context, executionID uuid.UUID) (*models.StepExecution, error)
GetPendingSteps(ctx context.Context, executionID uuid.UUID) ([]*models.StepExecution, error)
GetStepExecution(ctx context.Context, executionID uuid.UUID, stepID string) (*models.StepExecution, error)
// Approval management
SubmitApproval(ctx context.Context, executionID uuid.UUID, stepID string, approval *models.ApprovalDecision) error
GetPendingApprovals(ctx context.Context, approverID string) ([]*models.PendingApproval, error)
// Template management
CreateWorkflowTemplate(ctx context.Context, template *models.WorkflowTemplate) error
GetWorkflowTemplate(ctx context.Context, templateID uuid.UUID) (*models.WorkflowTemplate, error)
ListWorkflowTemplates(ctx context.Context) ([]*models.WorkflowTemplate, error)
CreateFromTemplate(ctx context.Context, templateID uuid.UUID, params map[string]interface{}) (*models.Workflow, error)
// Validation and simulation
ValidateWorkflow(ctx context.Context, workflow *models.Workflow) error
SimulateWorkflow(ctx context.Context, workflow *models.Workflow, input map[string]interface{}) (*models.SimulationResult, error)
// Analytics and reporting
GetWorkflowStats(ctx context.Context, workflowID uuid.UUID, period time.Duration) (*interfaces.WorkflowStats, error)
GetWorkflowHistory(ctx context.Context, workflowID uuid.UUID, limit int, offset int) ([]*models.WorkflowExecution, error)
GetWorkflowMetrics(ctx context.Context, workflowID uuid.UUID) (*models.WorkflowMetrics, error)
GenerateWorkflowReport(ctx context.Context, filters interfaces.WorkflowFilters, format string) ([]byte, error)
// Maintenance
ArchiveCompletedExecutions(ctx context.Context, before time.Time) (int64, error)
// Advanced features
CreateBranchingPath(ctx context.Context, executionID uuid.UUID, branchPoint string, conditions map[string]interface{}) error
MergeBranchingPaths(ctx context.Context, executionID uuid.UUID, branchIDs []string) error
CreateCompensation(ctx context.Context, executionID uuid.UUID, failedStep string, compensation *models.CompensationAction) error
ExecuteCompensation(ctx context.Context, executionID uuid.UUID) error
}
WorkflowService orchestrates multi-agent workflows with saga pattern
func NewTransactionalWorkflowService ¶
func NewTransactionalWorkflowService( baseService *workflowService, uow database.UnitOfWork, txManager repository.TransactionManager, compensationMgr repository.CompensationManager, ) WorkflowService
NewTransactionalWorkflowService creates a workflow service with transaction support
func NewWorkflowService ¶
func NewWorkflowService( config ServiceConfig, repo interfaces.WorkflowRepository, taskService TaskService, agentService AgentService, notifier NotificationService, ) WorkflowService
NewWorkflowService creates a production-ready workflow service
type WorkspaceActivity ¶
type WorkspaceActivity struct {
ID uuid.UUID `json:"id" db:"id"`
WorkspaceID uuid.UUID `json:"workspace_id" db:"workspace_id"`
AgentID string `json:"agent_id" db:"agent_id"`
ActivityType string `json:"activity_type" db:"activity_type"`
ResourceType string `json:"resource_type,omitempty" db:"resource_type"`
ResourceID string `json:"resource_id,omitempty" db:"resource_id"`
Action string `json:"action" db:"action"`
Metadata map[string]interface{} `json:"metadata" db:"metadata"`
IPAddress string `json:"ip_address,omitempty" db:"ip_address"`
UserAgent string `json:"user_agent,omitempty" db:"user_agent"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
WorkspaceActivity represents an activity log entry
type WorkspaceCreatedEvent ¶
type WorkspaceCreatedEvent struct {
WorkspaceID uuid.UUID
TenantID uuid.UUID
CreatedBy string
Timestamp time.Time
}
Event types for workspace operations
type WorkspaceDeletedEvent ¶
type WorkspaceFullError ¶
WorkspaceFullError represents a full workspace
func (WorkspaceFullError) Error ¶
func (e WorkspaceFullError) Error() string
type WorkspaceMember ¶
type WorkspaceMember struct {
WorkspaceID uuid.UUID `json:"workspace_id" db:"workspace_id"`
AgentID string `json:"agent_id" db:"agent_id"`
Role WorkspaceMemberRole `json:"role" db:"role"`
Permissions map[string]interface{} `json:"permissions" db:"permissions"`
JoinedAt time.Time `json:"joined_at" db:"joined_at"`
JoinedBy string `json:"joined_by" db:"joined_by"`
LastActive time.Time `json:"last_active" db:"last_active"`
Metadata map[string]interface{} `json:"metadata" db:"metadata"`
}
WorkspaceMember represents a member of a workspace with their role
type WorkspaceMemberRole ¶
type WorkspaceMemberRole string
WorkspaceMemberRole represents the role of a member in a workspace
const ( WorkspaceMemberRoleOwner WorkspaceMemberRole = "owner" WorkspaceMemberRoleAdmin WorkspaceMemberRole = "admin" WorkspaceMemberRoleMember WorkspaceMemberRole = "member" WorkspaceMemberRoleViewer WorkspaceMemberRole = "viewer" )
type WorkspaceMemberService ¶
type WorkspaceMemberService interface {
// Member management
AddMember(ctx context.Context, workspaceID uuid.UUID, agentID string, role WorkspaceMemberRole) error
UpdateMemberRole(ctx context.Context, workspaceID uuid.UUID, agentID string, newRole WorkspaceMemberRole) error
RemoveMember(ctx context.Context, workspaceID uuid.UUID, agentID string) error
GetMember(ctx context.Context, workspaceID uuid.UUID, agentID string) (*WorkspaceMember, error)
ListMembers(ctx context.Context, workspaceID uuid.UUID) ([]*WorkspaceMember, error)
// Role-based access control
CheckPermission(ctx context.Context, workspaceID uuid.UUID, agentID string, permission string) (bool, error)
GetMemberRole(ctx context.Context, workspaceID uuid.UUID, agentID string) (WorkspaceMemberRole, error)
// Activity tracking
LogActivity(ctx context.Context, activity *WorkspaceActivity) error
GetActivities(ctx context.Context, workspaceID uuid.UUID, limit int) ([]*WorkspaceActivity, error)
// Workspace quotas
CheckMemberQuota(ctx context.Context, workspaceID uuid.UUID) error
UpdateLastActive(ctx context.Context, workspaceID uuid.UUID, agentID string) error
}
WorkspaceMemberService handles workspace member management
func NewWorkspaceMemberService ¶
func NewWorkspaceMemberService( config ServiceConfig, txManager repository.TransactionManager, eventPublisher events.Publisher, authorizer auth.Authorizer, ) WorkspaceMemberService
NewWorkspaceMemberService creates a new workspace member service
type WorkspaceService ¶
type WorkspaceService interface {
// Workspace lifecycle
Create(ctx context.Context, workspace *models.Workspace) error
Get(ctx context.Context, id uuid.UUID) (*models.Workspace, error)
Update(ctx context.Context, workspace *models.Workspace) error
Delete(ctx context.Context, id uuid.UUID) error
Archive(ctx context.Context, id uuid.UUID) error
// Member management with permissions
AddMember(ctx context.Context, member *models.WorkspaceMember) error
RemoveMember(ctx context.Context, workspaceID uuid.UUID, agentID string) error
UpdateMemberRole(ctx context.Context, workspaceID uuid.UUID, agentID string, role string) error
UpdateMemberPermissions(ctx context.Context, workspaceID uuid.UUID, agentID string, permissions []string) error
ListMembers(ctx context.Context, workspaceID uuid.UUID) ([]*models.WorkspaceMember, error)
GetMemberActivity(ctx context.Context, workspaceID uuid.UUID) ([]*models.MemberActivity, error)
// State management with CRDT
GetState(ctx context.Context, workspaceID uuid.UUID) (*models.WorkspaceState, error)
UpdateState(ctx context.Context, workspaceID uuid.UUID, operation *models.StateOperation) error
MergeState(ctx context.Context, workspaceID uuid.UUID, remoteState *models.WorkspaceState) error
GetStateHistory(ctx context.Context, workspaceID uuid.UUID, limit int) ([]*models.StateSnapshot, error)
RestoreState(ctx context.Context, workspaceID uuid.UUID, snapshotID uuid.UUID) error
// Document management
CreateDocument(ctx context.Context, doc *models.SharedDocument) error
GetDocument(ctx context.Context, docID uuid.UUID) (*models.SharedDocument, error)
UpdateDocument(ctx context.Context, docID uuid.UUID, operation *collaboration.DocumentOperation) error
ListDocuments(ctx context.Context, workspaceID uuid.UUID) ([]*models.SharedDocument, error)
// Real-time collaboration
BroadcastToMembers(ctx context.Context, workspaceID uuid.UUID, message interface{}) error
SendToMember(ctx context.Context, workspaceID uuid.UUID, agentID string, message interface{}) error
GetPresence(ctx context.Context, workspaceID uuid.UUID) ([]*models.MemberPresence, error)
UpdatePresence(ctx context.Context, workspaceID uuid.UUID, agentID string, status string) error
// Search and discovery
ListByAgent(ctx context.Context, agentID string) ([]*models.Workspace, error)
SearchWorkspaces(ctx context.Context, query string, filters interfaces.WorkspaceFilters) ([]*models.Workspace, error)
GetRecommendedWorkspaces(ctx context.Context, agentID string) ([]*models.Workspace, error)
// Analytics
GetWorkspaceStats(ctx context.Context, workspaceID uuid.UUID) (*models.WorkspaceStats, error)
GetCollaborationMetrics(ctx context.Context, workspaceID uuid.UUID, period time.Duration) (*models.CollaborationMetrics, error)
}
WorkspaceService manages shared workspaces with distributed state
func NewWorkspaceService ¶
func NewWorkspaceService( config ServiceConfig, workspaceRepo interfaces.WorkspaceRepository, documentRepo interfaces.DocumentRepository, cache cache.Cache, ) WorkspaceService
NewWorkspaceService creates a production-grade workspace service
Source Files
¶
- agent_service_impl.go
- assignment_engine.go
- base_service.go
- conflict_resolution_service.go
- document_lock_service.go
- document_service.go
- document_service_impl.go
- errors.go
- interfaces.go
- notification_service_impl.go
- service_helpers.go
- task_helpers.go
- task_service.go
- task_service_enhanced.go
- task_service_impl.go
- tenant_aware_auth.go
- tenant_config.go
- workflow_service.go
- workflow_service_impl.go
- workflow_service_transactional.go
- workspace_member_service.go
- workspace_service.go
- workspace_service_impl.go