models

package
v0.0.0-...-6a3e998 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 7 Imported by: 0

README

Models Package

Overview

The models package contains all domain models for the DevOps MCP AI Agent Orchestration Platform. It provides type-safe, production-ready data structures with built-in state machines, validation, and metrics collection for multi-agent coordination and distributed task processing.

Core Domain Models

Agent Models

The agent models represent AI agents in the system with comprehensive lifecycle management:

// Agent represents an AI agent with capabilities and workload tracking
type Agent struct {
    ID           uuid.UUID        `json:"id"`
    Name         string          `json:"name"`
    Status       AgentStatus     `json:"status"`
    Capabilities []AgentCapability `json:"capabilities"`
    Workload     *AgentWorkload  `json:"workload,omitempty"`
    Health       *AgentHealth    `json:"health,omitempty"`
}

// Agent States (complete state machine)
- AgentStatusOffline   → Starting
- AgentStatusStarting  → Active/Offline
- AgentStatusActive    → Draining/Inactive/Offline
- AgentStatusDraining  → Inactive
- AgentStatusInactive  → Active/Offline

Key Features:

  • Complete state machine with transition validation
  • Workload tracking (tasks in progress, completed, average time)
  • Health monitoring with last heartbeat
  • Capability-based routing (compute, storage, network, orchestrate, analyze, secure)
  • Automatic metrics collection on state changes
Task Models

Tasks represent units of work that can be assigned to agents:

// Task represents a work item that can be processed by agents
type Task struct {
    ID             uuid.UUID              `json:"id"`
    Type           string                `json:"type"`
    Status         TaskStatus            `json:"status"`
    Priority       TaskPriority          `json:"priority"`
    AssignedAgent  *uuid.UUID            `json:"assigned_agent"`
    Parameters     JSONMap               `json:"parameters"`
    Result         JSONMap               `json:"result"`
    Error          *string               `json:"error"`
    RetryCount     int                   `json:"retry_count"`
    MaxRetries     int                   `json:"max_retries"`
}

// Task States
- TaskStatusPending    → Assigned/Cancelled
- TaskStatusAssigned   → InProgress/Cancelled
- TaskStatusInProgress → Completed/Failed/Cancelled
- TaskStatusCompleted  (terminal)
- TaskStatusFailed     → Pending (retry)
- TaskStatusCancelled  (terminal)

Advanced Features:

  • Task delegation between agents
  • Parent-child task relationships
  • Retry logic with exponential backoff
  • Priority-based scheduling
  • Flexible JSONMap for parameters/results
Workflow Models

Workflows coordinate multi-agent task execution with various patterns:

// Workflow represents a multi-agent workflow definition
type Workflow struct {
    ID              uuid.UUID           `json:"id"`
    Name            string             `json:"name"`
    Type            WorkflowType       `json:"type"`
    Status          WorkflowStatus     `json:"status"`
    Steps           []WorkflowStep     `json:"steps"`
    ExecutionPlan   *WorkflowExecution `json:"execution_plan"`
    ResourceUsage   *ResourceUsage     `json:"resource_usage"`
}

// Workflow Types
- WorkflowTypeSequential  // Steps run one after another
- WorkflowTypeParallel    // Steps run simultaneously
- WorkflowTypeDAG         // Directed Acyclic Graph
- WorkflowTypeSaga        // Distributed transaction pattern
- WorkflowTypeStateMachine // State-based execution
- WorkflowTypeEventDriven  // Event-triggered execution

Workflow States:

Pending → Running → Completed/Failed/Cancelled
Paused ↔ Running
Failed → Pending (retry)

Step States:

Pending → Running → Completed/Failed/Skipped
Blocked → Pending
Failed → Pending (retry)
Document Models

Documents support collaborative editing with conflict resolution:

// Document represents a collaborative document
type Document struct {
    ID          uuid.UUID      `json:"id"`
    Type        DocumentType   `json:"type"`
    Name        string        `json:"name"`
    Content     string        `json:"content"`
    Version     int64         `json:"version"`
    UpdatedAt   time.Time     `json:"updated_at"`
    UpdatedBy   uuid.UUID     `json:"updated_by"`
}

// Document Types
- DocumentTypeMarkdown
- DocumentTypeJSON/YAML
- DocumentTypeCode/Script
- DocumentTypeDiagram/PlantUML
- DocumentTypeRunbook/Template
- DocumentTypeDocumentation/Notebook

Access Control Roles:

  • Owner: Full control
  • Admin: Manage members and settings
  • Editor: Read/write access
  • Commenter: Read and comment
  • Viewer: Read-only
  • Guest: Limited read access

Binary WebSocket Protocol

High-performance binary protocol for agent communication:

// Header is the binary protocol header (24 bytes)
type Header struct {
    Magic      [4]byte  // "DMCP" magic number
    Version    uint8    // Protocol version
    Type       uint8    // Message type
    Method     uint16   // Method enum
    Flags      uint8    // Compression, encryption flags
    Reserved   [3]byte  // Future use
    PayloadLen uint32   // Payload size
    RequestID  uint64   // Request identifier
}

// Message Types
- TypeRequest      // Client request
- TypeResponse     // Server response
- TypeNotification // Async notification
- TypeError        // Error response
- TypePing/Pong    // Keepalive

Performance Features:

  • Binary encoding for efficiency
  • Optional gzip compression
  • Method enums for fast routing
  • Connection state management
  • Automatic reconnection support

Distributed Task Coordination

Support for complex multi-agent task patterns:

// DistributedTask coordinates work across multiple agents
type DistributedTask struct {
    ID               uuid.UUID            `json:"id"`
    CoordinationMode CoordinationMode     `json:"coordination_mode"`
    CompletionMode   CompletionMode       `json:"completion_mode"`
    Partitions       []TaskPartition      `json:"partitions"`
    ExecutionPlan    *ExecutionPlan       `json:"execution_plan"`
    Progress         *TaskProgress        `json:"progress"`
}

// Coordination Modes
- ModeParallel      // All tasks run simultaneously
- ModeSequential    // Tasks run in order
- ModePipeline      // Data flows through stages
- ModeMapReduce     // Map-reduce pattern
- ModeLeaderElect   // Leader election pattern

// Completion Modes  
- CompletionAll       // All must complete
- CompletionAny       // First to complete wins
- CompletionMajority  // >50% must complete
- CompletionThreshold // Custom threshold
- CompletionBestOf    // Best result wins

State Machine Features

All stateful models include:

  1. Validation: Ensure valid state transitions
  2. Metrics: Automatic collection on transitions
  3. Events: State change notifications
  4. History: Transition audit trail
  5. Concurrency: Safe concurrent access

Example usage:

// Transition agent state with validation
if agent.CanTransitionTo(AgentStatusActive) {
    oldStatus := agent.Status
    agent.TransitionTo(AgentStatusActive)
    
    // Metrics automatically collected
    agentStatusTransitions.WithLabelValues(
        string(oldStatus), 
        string(agent.Status),
    ).Inc()
}

JSONMap Utility

Flexible map type for dynamic data:

type JSONMap map[string]interface{}

// Helper methods
func (j JSONMap) GetString(key string) (string, bool)
func (j JSONMap) GetInt(key string) (int, bool) 
func (j JSONMap) GetBool(key string) (bool, bool)
func (j JSONMap) GetStringSlice(key string) ([]string, bool)
func (j JSONMap) GetMap(key string) (JSONMap, bool)

Integration Models

GitHub Integration

Query models for GitHub operations:

// RepositoryQuery for repository operations
type RepositoryQuery struct {
    Owner      string
    Repo       string
    Path       string
    Branch     string
    Since      *time.Time
    PageSize   int
}

// Supports: repos, PRs, issues, commits, files
Entity Relationships

Track relationships between entities:

// Relationship between entities
type Relationship struct {
    ID           string
    FromEntity   EntityReference
    ToEntity     EntityReference
    Type         RelationshipType
    Properties   map[string]interface{}
    Strength     float64
}

// Relationship Types
- References, Contains, Creates
- Modifies, Implements, Tests
- Documents, Depends, Conflicts

Best Practices

1. State Management

Always use provided transition methods:

// Good
if agent.CanTransitionTo(newStatus) {
    agent.TransitionTo(newStatus)
}

// Bad  
agent.Status = newStatus // Bypasses validation
2. Version Control

Use version fields for optimistic locking:

// Update with version check
doc.Version++
err := repo.UpdateDocument(ctx, doc)
if err == ErrVersionConflict {
    // Handle conflict
}
3. Metrics Collection

Leverage built-in metrics:

// Metrics automatically collected for:
- State transitions
- Task assignments
- Workflow execution
- Error rates
4. Binary Protocol

Use provided encoders/decoders:

// Encode message
data, err := msg.Encode()

// Decode message  
msg, err := DecodeMessage(data)

Testing

The package includes comprehensive test coverage:

# Run tests
go test ./pkg/models/...

# With coverage
go test -cover ./pkg/models/...

# Benchmark binary protocol
go test -bench=. ./pkg/models/websocket/

Migration Guide

When updating models:

  1. Add new fields with omitempty tag
  2. Maintain backward compatibility
  3. Update validation rules
  4. Add migration logic if needed
  5. Update tests

Performance Considerations

  • Binary Protocol: ~70% smaller than JSON
  • State Machines: O(1) transition validation
  • JSONMap: Lazy parsing for efficiency
  • Metrics: Minimal overhead (<1μs)

Future Enhancements

  • Protocol buffer support
  • GraphQL schema generation
  • OpenAPI spec generation
  • Event sourcing support
  • CQRS patterns

References

Documentation

Overview

This file contains legacy entity methods for backward compatibility. The primary entity type definitions are now in relationships.go

Package models provides common data models used across the devops-mcp workspace. It contains definitions for entity relationships and connection models that represent relationships between various GitHub entities.

This package is part of the Go workspace migration and provides a standardized location for all shared model definitions.

Index

Constants

View Source
const (
	HarnessQueryTypePipeline          = "pipeline"
	HarnessQueryTypeCIBuild           = "ci_build"
	HarnessQueryTypeCDDeployment      = "cd_deployment"
	HarnessQueryTypeSTOExperiment     = "sto_experiment"
	HarnessQueryTypeFeatureFlag       = "feature_flag"
	HarnessQueryTypeCCMCost           = "ccm_cost"
	HarnessQueryTypeCCMRecommendation = "ccm_recommendation"
	HarnessQueryTypeCCMBudget         = "ccm_budget"
	HarnessQueryTypeCCMAnomaly        = "ccm_anomaly"
)

Harness query types

View Source
const (
	SonarQubeQueryTypeProject     = "project"
	SonarQubeQueryTypeQualityGate = "quality_gate"
	SonarQubeQueryTypeIssues      = "issues"
	SonarQubeQueryTypeMetrics     = "metrics"
)

SonarQube query types

View Source
const (
	ArtifactoryQueryTypeRepository = "repository"
	ArtifactoryQueryTypeArtifact   = "artifact"
	ArtifactoryQueryTypeBuild      = "build"
	ArtifactoryQueryTypeStorage    = "storage"
)

Artifactory query types

View Source
const (
	XrayQueryTypeSummary         = "summary"
	XrayQueryTypeVulnerabilities = "vulnerabilities"
	XrayQueryTypeLicenses        = "licenses"
	XrayQueryTypeScans           = "scans"
)

Xray query types

View Source
const (
	// DirectionOutgoing represents a relationship from source to target
	DirectionOutgoing = "outgoing"
	// DirectionIncoming represents a relationship from target to source
	DirectionIncoming = "incoming"
	// DirectionBidirectional represents a bidirectional relationship
	DirectionBidirectional = "bidirectional"
)

Relationship directions

View Source
const (
	StepStatusPending          = "pending"
	StepStatusQueued           = "queued"
	StepStatusRunning          = "running"
	StepStatusCompleted        = "completed"
	StepStatusFailed           = "failed"
	StepStatusSkipped          = "skipped"
	StepStatusRetrying         = "retrying"
	StepStatusCancelling       = "cancelling"
	StepStatusCancelled        = "cancelled"
	StepStatusTimeout          = "timeout"
	StepStatusAwaitingApproval = "awaiting_approval"
)

Step status constants

View Source
const (
	WorkflowExecutionStatusPending   = WorkflowStatusPending
	WorkflowExecutionStatusRunning   = WorkflowStatusRunning
	WorkflowExecutionStatusPaused    = WorkflowStatusPaused
	WorkflowExecutionStatusCompleted = WorkflowStatusCompleted
	WorkflowExecutionStatusFailed    = WorkflowStatusFailed
	WorkflowExecutionStatusCancelled = WorkflowStatusCancelled
	WorkflowExecutionStatusTimeout   = WorkflowStatusTimeout
)

Alias the existing WorkflowStatus constants for compatibility

Variables

View Source
var RolePermissions = map[WorkspaceMemberRole][]string{
	WorkspaceMemberRoleOwner:     {"*"},
	WorkspaceMemberRoleAdmin:     {"read", "write", "delete", "invite", "settings"},
	WorkspaceMemberRoleEditor:    {"read", "write", "comment"},
	WorkspaceMemberRoleCommenter: {"read", "comment"},
	WorkspaceMemberRoleViewer:    {"read"},
	WorkspaceMemberRoleGuest:     {"read:public"},
}

RolePermissions defines what each role can do

StepTransitions defines valid step state transitions

View Source
var WorkflowTransitions = map[WorkflowStatus][]WorkflowStatus{
	WorkflowStatusPending:   {WorkflowStatusRunning, WorkflowStatusCancelled},
	WorkflowStatusRunning:   {WorkflowStatusPaused, WorkflowStatusCompleted, WorkflowStatusFailed, WorkflowStatusCancelled, WorkflowStatusTimeout},
	WorkflowStatusPaused:    {WorkflowStatusRunning, WorkflowStatusCancelled, WorkflowStatusTimeout},
	WorkflowStatusCompleted: {},
	WorkflowStatusFailed:    {},
	WorkflowStatusCancelled: {},
	WorkflowStatusTimeout:   {},
}

WorkflowTransitions defines valid state transitions

Functions

func GenerateRelationshipID

func GenerateRelationshipID(
	relType RelationshipType,
	source EntityID,
	target EntityID,
	direction string,
) string

GenerateRelationshipID creates a deterministic ID for a relationship

func LegacyGenerateRelationshipID

func LegacyGenerateRelationshipID(arg1 any, arg2 any, arg3 any, arg4 ...any) string

LegacyGenerateRelationshipID generates a unique ID for a relationship Takes either (source, target, relType) or (relType, source, target, direction) - the latter ignores direction This is a legacy implementation for backward compatibility with existing code

Types

type Agent

type Agent struct {
	ID           string                 `json:"id" db:"id"`
	TenantID     uuid.UUID              `json:"tenant_id" db:"tenant_id"`
	Name         string                 `json:"name" db:"name"`
	ModelID      string                 `json:"model_id" db:"model_id"`
	Type         string                 `json:"type" db:"type"`
	Status       string                 `json:"status" db:"status"` // available, busy, offline
	Capabilities []string               `json:"capabilities" db:"capabilities"`
	Metadata     map[string]interface{} `json:"metadata" db:"metadata"`
	CreatedAt    time.Time              `json:"created_at" db:"created_at"`
	UpdatedAt    time.Time              `json:"updated_at" db:"updated_at"`
	LastSeenAt   *time.Time             `json:"last_seen_at" db:"last_seen_at"`
}

Agent represents an AI agent in the system

type AgentCapability

type AgentCapability string

AgentCapability defines what an agent can do

const (
	AgentCapabilityCompute     AgentCapability = "compute"
	AgentCapabilityStorage     AgentCapability = "storage"
	AgentCapabilityNetwork     AgentCapability = "network"
	AgentCapabilityOrchestrate AgentCapability = "orchestrate"
	AgentCapabilityAnalyze     AgentCapability = "analyze"
	AgentCapabilitySecure      AgentCapability = "secure"
	AgentCapabilitySpecialized AgentCapability = "specialized"
)

type AgentFilter

type AgentFilter struct {
	ID       string `json:"id,omitempty"`
	TenantID string `json:"tenant_id,omitempty"`
	Name     string `json:"name,omitempty"`
	ModelID  string `json:"model_id,omitempty"`
}

AgentFilter defines filter criteria for agent operations

type AgentHealth

type AgentHealth struct {
	Status    HealthStatus           `json:"status"`
	LastCheck time.Time              `json:"last_check"`
	NextCheck time.Time              `json:"next_check"`
	Checks    map[string]CheckResult `json:"checks"`
	Message   string                 `json:"message,omitempty"`
}

AgentHealth represents health check results

type AgentMetrics

type AgentMetrics struct {
	CPUUsage      float64   `json:"cpu_usage"`    // 0-100
	MemoryUsage   float64   `json:"memory_usage"` // 0-100
	DiskUsage     float64   `json:"disk_usage"`   // 0-100
	NetworkIO     float64   `json:"network_io"`   // bytes/sec
	TasksActive   int       `json:"tasks_active"`
	TasksQueued   int       `json:"tasks_queued"`
	TasksComplete int64     `json:"tasks_complete"`
	ErrorRate     float64   `json:"error_rate"`    // errors per minute
	ResponseTime  float64   `json:"response_time"` // milliseconds
	LastUpdated   time.Time `json:"last_updated"`
}

AgentMetrics tracks real-time agent performance

type AgentPerformance

type AgentPerformance struct {
	AgentID               string                 `json:"agent_id"`
	TasksCompleted        int64                  `json:"tasks_completed"`
	TasksFailed           int64                  `json:"tasks_failed"`
	AverageCompletionTime float64                `json:"average_completion_time"`
	SuccessRate           float64                `json:"success_rate"`
	LoadFactor            float64                `json:"load_factor"`
	SpeedScore            float64                `json:"speed_score"`
	TaskTypeMetrics       map[string]TaskMetrics `json:"task_type_metrics"`
}

AgentPerformance represents agent performance metrics

type AgentStatus

type AgentStatus string

AgentStatus represents the operational state of an agent

const (
	AgentStatusActive      AgentStatus = "active"
	AgentStatusInactive    AgentStatus = "inactive"
	AgentStatusMaintenance AgentStatus = "maintenance"
	AgentStatusDraining    AgentStatus = "draining"
	AgentStatusError       AgentStatus = "error"
	AgentStatusOffline     AgentStatus = "offline"
	AgentStatusStarting    AgentStatus = "starting"
	AgentStatusStopping    AgentStatus = "stopping"
)

func (AgentStatus) CanTransitionTo

func (s AgentStatus) CanTransitionTo(target AgentStatus) bool

CanTransitionTo checks if a status transition is valid

func (AgentStatus) TransitionTo

func (s AgentStatus) TransitionTo(target AgentStatus, metrics MetricsClient) (AgentStatus, error)

TransitionTo performs a validated state transition with metrics

func (AgentStatus) Validate

func (s AgentStatus) Validate() error

Validate ensures the status is valid

type AgentWorkload

type AgentWorkload struct {
	AgentID       string         `json:"agent_id"`
	ActiveTasks   int            `json:"active_tasks"`
	QueuedTasks   int            `json:"queued_tasks"`
	TasksByType   map[string]int `json:"tasks_by_type"`
	LoadScore     float64        `json:"load_score"`     // 0.0 (idle) to 1.0 (overloaded)
	EstimatedTime int            `json:"estimated_time"` // Estimated time to complete all tasks in seconds
}

AgentWorkload represents current workload for an agent

type AggregationConfig

type AggregationConfig struct {
	Method     string `json:"method"`       // combine_results, first_complete, majority_vote
	WaitForAll bool   `json:"wait_for_all"` // Whether to wait for all subtasks
	Timeout    int    `json:"timeout"`      // Timeout in seconds
}

AggregationConfig defines how results should be aggregated

type ApprovalDecision

type ApprovalDecision struct {
	ID         uuid.UUID              `json:"id"`
	Approved   bool                   `json:"approved"`
	ApprovedBy string                 `json:"approved_by"`
	Comments   string                 `json:"comments,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	Timestamp  time.Time              `json:"timestamp"`
}

ApprovalDecision represents an approval decision for a workflow step

func (*ApprovalDecision) GetID

func (a *ApprovalDecision) GetID() uuid.UUID

Add methods to make ApprovalDecision implement AggregateRoot

func (*ApprovalDecision) GetType

func (a *ApprovalDecision) GetType() string

func (*ApprovalDecision) GetVersion

func (a *ApprovalDecision) GetVersion() int

type Artifact

type Artifact struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	SHA1   string `json:"sha1"`
	MD5    string `json:"md5"`
	SHA256 string `json:"sha256"`
}

Artifact represents an artifact in an Artifactory build module

type ArtifactoryArtifact

type ArtifactoryArtifact struct {
	Repo        string               `json:"repo"`
	Path        string               `json:"path"`
	Name        string               `json:"name"`
	Type        string               `json:"type"`
	Size        int64                `json:"size"`
	Created     string               `json:"created"`
	CreatedBy   string               `json:"createdBy"`
	Modified    string               `json:"modified"`
	ModifiedBy  string               `json:"modifiedBy"`
	LastUpdated string               `json:"lastUpdated"`
	DownloadUri string               `json:"downloadUri"`
	MimeType    string               `json:"mimeType"`
	Checksums   ArtifactoryChecksums `json:"checksums"`
	Properties  map[string][]string  `json:"properties"`
}

ArtifactoryArtifact represents an artifact in Artifactory

type ArtifactoryBuild

type ArtifactoryBuild struct {
	BuildInfo struct {
		Name       string            `json:"name"`
		Number     string            `json:"number"`
		Started    time.Time         `json:"started"`
		BuildAgent BuildAgent        `json:"buildAgent"`
		Modules    []Module          `json:"modules"`
		Properties map[string]string `json:"properties"`
	} `json:"buildInfo"`
}

ArtifactoryBuild represents a build in Artifactory

type ArtifactoryChecksums

type ArtifactoryChecksums struct {
	SHA1   string `json:"sha1"`
	MD5    string `json:"md5"`
	SHA256 string `json:"sha256"`
}

ArtifactoryChecksums represents checksums for an artifact

type ArtifactoryQuery

type ArtifactoryQuery struct {
	Type        string `json:"type"`
	RepoKey     string `json:"repoKey"`
	Path        string `json:"path"`
	RepoType    string `json:"repoType"`
	PackageType string `json:"packageType"`
	BuildName   string `json:"buildName"`
	BuildNumber string `json:"buildNumber"`
}

ArtifactoryQuery defines parameters for querying Artifactory

type ArtifactoryRepositories

type ArtifactoryRepositories struct {
	Repositories []ArtifactoryRepository `json:"repositories"`
}

ArtifactoryRepositories represents repositories in Artifactory

type ArtifactoryRepository

type ArtifactoryRepository struct {
	Key         string `json:"key"`
	Type        string `json:"type"`
	Description string `json:"description"`
	URL         string `json:"url"`
	PackageType string `json:"packageType"`
}

ArtifactoryRepository represents a single repository in Artifactory

type ArtifactoryStorage

type ArtifactoryStorage struct {
	BinariesSummary struct {
		BinariesCount int64 `json:"binariesCount"`
		BinariesSize  int64 `json:"binariesSize"`
		ArtifactsSize int64 `json:"artifactsSize"`
		Optimization  int64 `json:"optimization"`
		ItemsCount    int64 `json:"itemsCount"`
	} `json:"binariesSummary"`
	FileStoreSummary struct {
		StorageType      string `json:"storageType"`
		StorageDirectory string `json:"storageDirectory"`
		TotalSpace       int64  `json:"totalSpace"`
		UsedSpace        int64  `json:"usedSpace"`
		FreeSpace        int64  `json:"freeSpace"`
	} `json:"fileStoreSummary"`
	RepositoriesSummary struct {
		RepoCount    int           `json:"repoCount"`
		Repositories []RepoSummary `json:"repositories"`
	} `json:"repositoriesSummary"`
}

ArtifactoryStorage represents storage info in Artifactory

type ArtifactoryWebhookData

type ArtifactoryWebhookData struct {
	RepoKey    string `json:"repo_key"`
	Path       string `json:"path"`
	Name       string `json:"name"`
	SHA1       string `json:"sha1"`
	SHA256     string `json:"sha256"`
	Size       int64  `json:"size"`
	Created    string `json:"created"`
	CreatedBy  string `json:"created_by"`
	Modified   string `json:"modified"`
	ModifiedBy string `json:"modified_by"`
}

ArtifactoryWebhookData represents the data in an Artifactory webhook event

type ArtifactoryWebhookEvent

type ArtifactoryWebhookEvent struct {
	Domain    string                 `json:"domain"`
	EventType string                 `json:"event_type"`
	Data      ArtifactoryWebhookData `json:"data"`
}

ArtifactoryWebhookEvent represents an Artifactory webhook event

type AutomationRule

type AutomationRule struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Enabled    bool                   `json:"enabled"`
	Trigger    string                 `json:"trigger"` // event type
	Conditions []RuleCondition        `json:"conditions,omitempty"`
	Actions    []RuleAction           `json:"actions"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

AutomationRule defines an automation rule for the workspace

type BuildAgent

type BuildAgent struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

BuildAgent represents a build agent in Artifactory

type Change

type Change struct {
	Type     string `json:"type"` // "add", "remove", "modify"
	Path     string `json:"path"`
	OldValue string `json:"old_value,omitempty"`
	NewValue string `json:"new_value,omitempty"`
	Line     int    `json:"line,omitempty"`
}

Change represents a single change in a document

type CheckResult

type CheckResult struct {
	Status      HealthStatus  `json:"status"`
	Message     string        `json:"message"`
	LastSuccess time.Time     `json:"last_success"`
	Duration    time.Duration `json:"duration"`
	Error       string        `json:"error,omitempty"`
}

type CollaborationMetrics

type CollaborationMetrics struct {
	DocumentID          uuid.UUID        `json:"document_id"`
	Period              time.Duration    `json:"period"`
	UniqueCollaborators int              `json:"unique_collaborators"`
	TotalOperations     int64            `json:"total_operations"`
	OperationsByType    map[string]int64 `json:"operations_by_type"`
	ConflictCount       int64            `json:"conflict_count"`
	AverageResponseTime time.Duration    `json:"average_response_time"`
	PeakConcurrency     int              `json:"peak_concurrency"`
}

CollaborationMetrics represents metrics for document collaboration

type CollaborationSettings

type CollaborationSettings struct {
	AllowGuestAccess   bool     `json:"allow_guest_access"`
	RequireApproval    bool     `json:"require_approval"`
	DefaultMemberRole  string   `json:"default_member_role"`
	AllowedDomains     []string `json:"allowed_domains,omitempty"`
	MaxMembers         int      `json:"max_members,omitempty"`
	EnablePresence     bool     `json:"enable_presence"`
	EnableTypingStatus bool     `json:"enable_typing_status"`
	ConflictResolution string   `json:"conflict_resolution"` // manual, auto_merge, last_write_wins
}

CollaborationSettings defines collaboration preferences

type CollaborativeWorkflow

type CollaborativeWorkflow struct {
	*Workflow
	RequiredAgents   []string          `json:"required_agents"`
	AgentRoles       map[string]string `json:"agent_roles"`
	CoordinationMode string            `json:"coordination_mode"` // parallel, sequential, consensus
	VotingStrategy   string            `json:"voting_strategy"`   // majority, unanimous, weighted
	SyncPoints       []string          `json:"sync_points"`       // Step IDs where agents must synchronize
}

CollaborativeWorkflow represents a workflow designed for multi-agent collaboration

type CompensationAction

type CompensationAction struct {
	ID          uuid.UUID              `json:"id"`
	ExecutionID uuid.UUID              `json:"execution_id"`
	StepID      string                 `json:"step_id"`
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters,omitempty"`
	Status      string                 `json:"status"`
	CreatedAt   time.Time              `json:"created_at"`
	ExecutedAt  *time.Time             `json:"executed_at,omitempty"`
	Result      map[string]interface{} `json:"result,omitempty"`
}

CompensationAction represents a compensation action for failed workflows

type CompletionMode

type CompletionMode string

CompletionMode defines when a distributed task is considered complete

const (
	CompletionModeAll       CompletionMode = "all"       // All subtasks must complete
	CompletionModeAny       CompletionMode = "any"       // Any subtask completion completes the task
	CompletionModeMajority  CompletionMode = "majority"  // Majority of subtasks must complete
	CompletionModeThreshold CompletionMode = "threshold" // Configurable threshold of completions
	CompletionModeBestOf    CompletionMode = "best_of"   // Best result from N attempts
)

func (CompletionMode) IsValid

func (m CompletionMode) IsValid() bool

IsCompletionValid checks if the completion mode is valid

type ConflictInfo

type ConflictInfo struct {
	ID            uuid.UUID              `json:"id"`
	DocumentID    uuid.UUID              `json:"document_id"`
	Type          string                 `json:"type"` // concurrent_edit, schema_mismatch, etc.
	LocalVersion  interface{}            `json:"local_version"`
	RemoteVersion interface{}            `json:"remote_version"`
	AffectedPath  string                 `json:"affected_path"`
	DetectedAt    time.Time              `json:"detected_at"`
	Metadata      map[string]interface{} `json:"metadata"`
}

ConflictInfo represents information about a detected conflict

type ConflictResolution

type ConflictResolution struct {
	ID                 uuid.UUID  `json:"id" db:"id"`
	TenantID           uuid.UUID  `json:"tenant_id" db:"tenant_id"`
	ResourceType       string     `json:"resource_type" db:"resource_type"`
	ResourceID         uuid.UUID  `json:"resource_id" db:"resource_id"`
	ConflictType       string     `json:"conflict_type" db:"conflict_type"`
	Description        string     `json:"description,omitempty" db:"description"`
	ResolutionStrategy string     `json:"resolution_strategy,omitempty" db:"resolution_strategy"`
	Details            JSONMap    `json:"details" db:"details"`
	ResolvedBy         *string    `json:"resolved_by,omitempty" db:"resolved_by"`
	ResolvedAt         *time.Time `json:"resolved_at,omitempty" db:"resolved_at"`
	CreatedAt          time.Time  `json:"created_at" db:"created_at"`
}

ConflictResolution represents a resolved conflict in document operations

type ConflictStrategy

type ConflictStrategy string
const (
	ConflictStrategyLatestWins ConflictStrategy = "latest_wins"
	ConflictStrategyMerge      ConflictStrategy = "merge"
	ConflictStrategyManual     ConflictStrategy = "manual"
	ConflictStrategyCustom     ConflictStrategy = "custom"
)

func (ConflictStrategy) Validate

func (c ConflictStrategy) Validate() error

Validate ensures the conflict strategy is valid

type Context

type Context struct {
	// ID is the unique identifier for this context
	ID string `json:"id" db:"id"`

	// Name is the display name of this context
	Name string `json:"name" db:"name"`

	// Description is a human-readable description of the context
	Description string `json:"description,omitempty" db:"description"`

	// AgentID is the identifier for the AI agent that owns this context
	AgentID string `json:"agent_id" db:"agent_id"`

	// TenantID is the tenant this context belongs to
	TenantID string `json:"tenant_id" db:"tenant_id"`

	// ModelID identifies which AI model this context is for
	ModelID string `json:"model_id" db:"model_id"`

	// SessionID is the identifier for the user session
	SessionID string `json:"session_id,omitempty" db:"session_id"`

	// Content contains the actual context data
	Content []ContextItem `json:"content" db:"-"`

	// Metadata contains additional information about the context
	Metadata map[string]any `json:"metadata,omitempty" db:"metadata"`

	// CreatedAt is when this context was created
	CreatedAt time.Time `json:"created_at" db:"created_at"`

	// UpdatedAt is when this context was last updated
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	// ExpiresAt is when this context expires (if applicable)
	ExpiresAt time.Time `json:"expires_at" db:"expires_at"`

	// MaxTokens is the maximum number of tokens this context can contain
	MaxTokens int `json:"max_tokens,omitempty" db:"max_tokens"`

	// CurrentTokens is the current token count for this context
	CurrentTokens int `json:"current_tokens,omitempty" db:"current_tokens"`
}

Context represents an AI model context

type ContextFilter

type ContextFilter struct {
	ID          string    `json:"id,omitempty"`
	TenantID    string    `json:"tenant_id,omitempty"`
	Name        string    `json:"name,omitempty"`
	ContentType string    `json:"content_type,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

ContextFilter defines filter criteria for context operations

type ContextItem

type ContextItem struct {
	// ID is the unique identifier for this context item
	ID string `json:"id,omitempty" db:"id"`

	// ContextID is the ID of the context this item belongs to
	ContextID string `json:"context_id,omitempty" db:"context_id"`

	// Role is the role of this context item (e.g., user, assistant, system)
	Role string `json:"role" db:"role"`

	// Content is the text content of this context item
	Content string `json:"content" db:"content"`

	// Timestamp is when this context item was created
	Timestamp time.Time `json:"timestamp" db:"timestamp"`

	// Tokens is the token count for this context item
	Tokens int `json:"tokens,omitempty" db:"tokens"`

	// Metadata contains additional information about this context item
	Metadata map[string]any `json:"metadata,omitempty" db:"metadata"`
}

ContextItem represents a single item in a context

type ContextUpdateOptions

type ContextUpdateOptions struct {
	// ReplaceContent indicates whether to replace the entire content or append to it
	ReplaceContent bool `json:"replace_content,omitempty"`

	// Truncate indicates whether to truncate the context if it exceeds the maximum tokens
	Truncate bool `json:"truncate,omitempty"`

	// TruncateStrategy defines the strategy for truncating the context
	TruncateStrategy string `json:"truncate_strategy,omitempty"`
}

ContextUpdateOptions provides options for updating a context

type CoordinationMode

type CoordinationMode string

CoordinationMode defines how subtasks are coordinated

const (
	CoordinationModeParallel    CoordinationMode = "parallel"     // All subtasks run in parallel
	CoordinationModeSequential  CoordinationMode = "sequential"   // Subtasks run one after another
	CoordinationModePipeline    CoordinationMode = "pipeline"     // Output of one feeds into next
	CoordinationModeMapReduce   CoordinationMode = "map_reduce"   // Map phase then reduce phase
	CoordinationModeLeaderElect CoordinationMode = "leader_elect" // One agent elected as coordinator
)

func (CoordinationMode) IsValid

func (m CoordinationMode) IsValid() bool

IsCoordinationValid checks if the coordination mode is valid

type CredentialRequest

type CredentialRequest struct {
	Action      string           `json:"action"`
	Parameters  interface{}      `json:"parameters"`
	Credentials *ToolCredentials `json:"credentials,omitempty"`
}

CredentialRequest wraps tool requests with optional credentials

type DelegationNode

type DelegationNode struct {
	Delegation *TaskDelegation
	Next       *DelegationNode
}

DelegationNode represents a node in the delegation chain

type DelegationType

type DelegationType string

DelegationType represents how a task was delegated

const (
	DelegationManual      DelegationType = "manual"
	DelegationAutomatic   DelegationType = "automatic"
	DelegationFailover    DelegationType = "failover"
	DelegationLoadBalance DelegationType = "load_balance"
)

type Dependency

type Dependency struct {
	ID     string `json:"id"`
	Type   string `json:"type"`
	SHA1   string `json:"sha1"`
	MD5    string `json:"md5"`
	SHA256 string `json:"sha256"`
}

Dependency represents a dependency in an Artifactory build module

type DistributedTask

type DistributedTask struct {
	ID          uuid.UUID         `json:"id"`
	Type        string            `json:"type"`
	Title       string            `json:"title"`
	Description string            `json:"description"`
	Priority    TaskPriority      `json:"priority"`
	Subtasks    []Subtask         `json:"subtasks"`
	Aggregation AggregationConfig `json:"aggregation"`
	SubtaskIDs  []uuid.UUID       `json:"subtask_ids,omitempty"`

	// Phase 3 additions
	Task                *Task            `json:"task,omitempty" db:"-"`
	CoordinationMode    CoordinationMode `json:"coordination_mode" db:"coordination_mode"`
	CompletionMode      CompletionMode   `json:"completion_mode" db:"completion_mode"`
	CompletionThreshold int              `json:"completion_threshold,omitempty" db:"completion_threshold"`

	// Execution tracking fields
	ExecutionPlan *ExecutionPlan  `json:"execution_plan,omitempty" db:"execution_plan"`
	Partitions    []TaskPartition `json:"partitions,omitempty" db:"-"`
	Progress      *TaskProgress   `json:"progress,omitempty" db:"-"`
	ResourceUsage *ResourceUsage  `json:"resource_usage,omitempty" db:"-"`

	// Timing fields
	StartedAt         *time.Time    `json:"started_at,omitempty" db:"started_at"`
	CompletedAt       *time.Time    `json:"completed_at,omitempty" db:"completed_at"`
	EstimatedDuration time.Duration `json:"estimated_duration,omitempty" db:"estimated_duration"`

	// Results aggregation
	ResultsCollected    int           `json:"results_collected" db:"results_collected"`
	FinalResult         interface{}   `json:"final_result,omitempty" db:"final_result"`
	IntermediateResults []interface{} `json:"intermediate_results,omitempty" db:"-"`
}

DistributedTask represents a task that can be split into subtasks

func (*DistributedTask) CalculateProgress

func (dt *DistributedTask) CalculateProgress() float64

CalculateProgress calculates the overall progress of the distributed task

func (*DistributedTask) GetEstimatedCompletion

func (dt *DistributedTask) GetEstimatedCompletion() *time.Time

GetEstimatedCompletion returns the estimated completion time

func (*DistributedTask) IsComplete

func (dt *DistributedTask) IsComplete() bool

IsComplete checks if the distributed task is complete based on completion mode

func (*DistributedTask) SetDefaults

func (dt *DistributedTask) SetDefaults()

SetDefaults sets default values for a distributed task

func (*DistributedTask) Validate

func (dt *DistributedTask) Validate() error

Validate validates the distributed task

type Document

type Document struct {
	ID          uuid.UUID  `json:"id" db:"id"`
	TenantID    uuid.UUID  `json:"tenant_id" db:"tenant_id"`
	WorkspaceID *uuid.UUID `json:"workspace_id,omitempty" db:"workspace_id"`
	Title       string     `json:"title" db:"title"`
	Type        string     `json:"type" db:"type"`
	Content     string     `json:"content" db:"content"`
	ContentType string     `json:"content_type" db:"content_type"`
	CreatedBy   string     `json:"created_by" db:"created_by"`
	Version     int        `json:"version" db:"version"`
	Permissions JSONMap    `json:"permissions" db:"permissions"`
	Metadata    JSONMap    `json:"metadata" db:"metadata"`
	CreatedAt   time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`
}

Document represents a shared document for collaboration

type DocumentChange

type DocumentChange struct {
	ID         uuid.UUID `json:"id" db:"id"`
	DocumentID uuid.UUID `json:"document_id" db:"document_id"`
	AgentID    string    `json:"agent_id" db:"agent_id"`
	ChangeType string    `json:"change_type" db:"change_type"`
	Position   int       `json:"position" db:"position"`
	Content    string    `json:"content" db:"content"`
	Length     int       `json:"length" db:"length"`
	Metadata   JSONMap   `json:"metadata" db:"metadata"`
	Timestamp  time.Time `json:"timestamp" db:"timestamp"`
}

DocumentChange represents a change to a document (for CRDT)

type DocumentConflictResolution

type DocumentConflictResolution struct {
	Strategy      ConflictStrategy `json:"strategy"`
	ResolvedBy    string           `json:"resolved_by"`
	ResolvedAt    time.Time        `json:"resolved_at"`
	OriginalValue interface{}      `json:"original_value,omitempty"`
}

type DocumentDiff

type DocumentDiff struct {
	FromVersion int       `json:"from_version"`
	ToVersion   int       `json:"to_version"`
	Changes     []Change  `json:"changes"`
	CreatedAt   time.Time `json:"created_at"`
}

DocumentDiff represents the difference between two document versions

type DocumentLock

type DocumentLock struct {
	DocumentID    uuid.UUID `json:"document_id"`
	LockedBy      string    `json:"locked_by"`
	LockedAt      time.Time `json:"locked_at"`
	LockExpiresAt time.Time `json:"lock_expires_at"`
	LockType      string    `json:"lock_type"` // "exclusive" or "shared"
}

DocumentLock represents lock information for a document

type DocumentOperation

type DocumentOperation struct {
	ID                uuid.UUID  `json:"id" db:"id"`
	DocumentID        uuid.UUID  `json:"document_id" db:"document_id"`
	TenantID          uuid.UUID  `json:"tenant_id" db:"tenant_id"`
	AgentID           string     `json:"agent_id" db:"agent_id"`
	OperationType     string     `json:"operation_type" db:"operation_type"`
	OperationData     JSONMap    `json:"operation_data" db:"operation_data"`
	VectorClock       JSONMap    `json:"vector_clock" db:"vector_clock"`
	SequenceNumber    int64      `json:"sequence_number" db:"sequence_number"`
	Timestamp         time.Time  `json:"timestamp" db:"timestamp"`
	ParentOperationID *uuid.UUID `json:"parent_operation_id,omitempty" db:"parent_operation_id"`
	IsApplied         bool       `json:"is_applied" db:"is_applied"`
}

DocumentOperation represents a CRDT operation on a document

func (*DocumentOperation) IsConflict

func (op *DocumentOperation) IsConflict(other *DocumentOperation) bool

IsConflict checks if this operation conflicts with another

type DocumentSnapshot

type DocumentSnapshot struct {
	ID          uuid.UUID `json:"id" db:"id"`
	DocumentID  uuid.UUID `json:"document_id" db:"document_id"`
	Version     int64     `json:"version" db:"version"`
	Content     string    `json:"content" db:"content"`
	VectorClock JSONMap   `json:"vector_clock" db:"vector_clock"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
	CreatedBy   string    `json:"created_by" db:"created_by"`
}

DocumentSnapshot represents a point-in-time snapshot of a document

type DocumentStats

type DocumentStats struct {
	DocumentID    uuid.UUID `json:"document_id"`
	TotalVersions int       `json:"total_versions"`
	TotalEdits    int       `json:"total_edits"`
	UniqueEditors int       `json:"unique_editors"`
	LastEditedAt  time.Time `json:"last_edited_at"`
	LastEditedBy  string    `json:"last_edited_by"`
	ContentLength int       `json:"content_length"`
	CreatedAt     time.Time `json:"created_at"`
}

DocumentStats represents statistics about a document

type DocumentType

type DocumentType string

DocumentType represents the type of document

const (
	DocumentTypeMarkdown DocumentType = "markdown"
	DocumentTypeJSON     DocumentType = "json"
	DocumentTypeYAML     DocumentType = "yaml"
	DocumentTypeCode     DocumentType = "code"
	DocumentTypeDiagram  DocumentType = "diagram"
	DocumentTypeRunbook  DocumentType = "runbook"
	DocumentTypePlaybook DocumentType = "playbook"
	DocumentTypeTemplate DocumentType = "template"
	DocumentTypeConfig   DocumentType = "config"
)

func (DocumentType) Validate

func (d DocumentType) Validate() error

Validate ensures the document type is valid

type DocumentUpdate

type DocumentUpdate struct {
	ID                 uuid.UUID                  `json:"id" db:"id"`
	DocumentID         uuid.UUID                  `json:"document_id" db:"document_id"`
	Version            int                        `json:"version" db:"version"`
	UpdateType         UpdateType                 `json:"update_type" db:"update_type"`
	Path               string                     `json:"path" db:"path"`
	OldValue           interface{}                `json:"old_value" db:"old_value"`
	NewValue           interface{}                `json:"new_value" db:"new_value"`
	UpdatedBy          string                     `json:"updated_by" db:"updated_by"`
	UpdatedAt          time.Time                  `json:"updated_at" db:"updated_at"`
	Metadata           map[string]interface{}     `json:"metadata" db:"metadata"`
	Checksum           string                     `json:"checksum" db:"checksum"`
	ConflictResolution DocumentConflictResolution `json:"conflict_resolution,omitempty" db:"conflict_resolution"`
}

DocumentUpdate represents a document update operation

type DocumentVersion

type DocumentVersion struct {
	ID         uuid.UUID `json:"id" db:"id"`
	DocumentID uuid.UUID `json:"document_id" db:"document_id"`
	Version    int       `json:"version" db:"version"`
	Content    string    `json:"content" db:"content"`
	CreatedBy  string    `json:"created_by" db:"created_by"`
	CreatedAt  time.Time `json:"created_at" db:"created_at"`
	Metadata   JSONMap   `json:"metadata" db:"metadata"`
}

DocumentVersion represents a specific version of a document

type Embedding

type Embedding struct {
	ID           string    `json:"id"`
	ContextID    string    `json:"context_id"`
	ContentIndex int       `json:"content_index"`
	Text         string    `json:"text"`
	Embedding    []float32 `json:"embedding"`
	ModelID      string    `json:"model_id"`
}

Embedding represents a vector embedding with additional metadata

type EndpointRateLimit

type EndpointRateLimit struct {
	RequestsPerMinute int `json:"requests_per_minute"`
	BurstSize         int `json:"burst_size"`
}

EndpointRateLimit represents rate limits for a specific endpoint

type EntityID

type EntityID struct {
	// Type of the entity
	Type EntityType `json:"type"`

	// Owner of the entity (GitHub username or organization)
	Owner string `json:"owner"`

	// Repository name
	Repo string `json:"repo"`

	// Identifier of the entity (issue number, PR number, commit hash, etc.)
	ID string `json:"id"`

	// Additional qualifiers for uniquely identifying the entity
	Qualifiers map[string]string `json:"qualifiers,omitempty"`
}

EntityID represents a unique identifier for an entity

func EntityIDFromContentMetadata

func EntityIDFromContentMetadata(contentType string, owner, repo, contentID string) EntityID

EntityIDFromContentMetadata creates an EntityID from storage content metadata

func NewEntityID

func NewEntityID(entityType EntityType, owner, repo, id string) EntityID

NewEntityID creates a new EntityID

func (EntityID) String

func (e EntityID) String() string

String returns a string representation of the entity ID

func (EntityID) WithQualifiers

func (e EntityID) WithQualifiers(qualifiers map[string]string) EntityID

WithQualifiers adds qualifiers to an EntityID

type EntityRelationship

type EntityRelationship struct {
	// ID is a unique identifier for this relationship
	ID string `json:"id"`

	// Type of relationship
	Type RelationshipType `json:"type"`

	// Direction of the relationship (outgoing, incoming, bidirectional)
	Direction string `json:"direction"`

	// Source entity
	Source EntityID `json:"source"`

	// Target entity
	Target EntityID `json:"target"`

	// Strength of the relationship (0.0 to 1.0)
	Strength float64 `json:"strength"`

	// Context provides additional information about the relationship
	Context string `json:"context,omitempty"`

	// Metadata contains additional structured data about the relationship
	Metadata map[string]any `json:"metadata,omitempty"`

	// CreatedAt is the timestamp when the relationship was created
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is the timestamp when the relationship was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

EntityRelationship represents a relationship between two GitHub entities

func NewEntityRelationship

func NewEntityRelationship(
	relType RelationshipType,
	source EntityID,
	target EntityID,
	direction string,
	strength float64,
) *EntityRelationship

NewEntityRelationship creates a new relationship between two entities

func (*EntityRelationship) WithContext

func (r *EntityRelationship) WithContext(context string) *EntityRelationship

WithContext adds context to a relationship

func (*EntityRelationship) WithContextMap

func (r *EntityRelationship) WithContextMap(keyOrMap any, value ...any) *EntityRelationship

WithContext adds context to the relationship with more flexible parameters It can be called with either a key-value pair or a complete map

func (*EntityRelationship) WithMetadata

func (r *EntityRelationship) WithMetadata(metadata map[string]any) *EntityRelationship

WithMetadata adds metadata to a relationship

func (*EntityRelationship) WithMetadataMap

func (r *EntityRelationship) WithMetadataMap(keyOrMap any, value ...any) *EntityRelationship

WithMetadataMap adds metadata to the relationship with more flexible parameters It can be called with either a key-value pair or a complete map

type EntityType

type EntityType string

EntityType represents the type of GitHub entity

const (
	// EntityTypeRepository represents a GitHub repository
	EntityTypeRepository EntityType = "repository"
	// EntityTypeIssue represents a GitHub issue
	EntityTypeIssue EntityType = "issue"
	// EntityTypePullRequest represents a GitHub pull request
	EntityTypePullRequest EntityType = "pull_request"
	// EntityTypeCommit represents a GitHub commit
	EntityTypeCommit EntityType = "commit"
	// EntityTypeFile represents a file in a GitHub repository
	EntityTypeFile EntityType = "file"
	// EntityTypeUser represents a GitHub user
	EntityTypeUser EntityType = "user"
	// EntityTypeOrganization represents a GitHub organization
	EntityTypeOrganization EntityType = "organization"
	// EntityTypeDiscussion represents a GitHub discussion
	EntityTypeDiscussion EntityType = "discussion"
	// EntityTypeComment represents a comment on an issue, PR, or discussion
	EntityTypeComment EntityType = "comment"
	// EntityTypeRelease represents a GitHub release
	EntityTypeRelease EntityType = "release"
	// EntityTypeCodeChunk represents a semantic code chunk
	EntityTypeCodeChunk EntityType = "code_chunk"
)

Entity types

type Event

type Event struct {
	// Source is the source of the event (e.g., openai, anthropic, langchain)
	Source string `json:"source"`

	// Type is the type of the event (e.g., context_update, model_request)
	Type string `json:"type"`

	// Timestamp is when the event occurred
	Timestamp time.Time `json:"timestamp"`

	// Data contains the event data
	Data any `json:"data"`

	// AgentID is the identifier for the AI agent that generated this event
	AgentID string `json:"agent_id"`

	// SessionID is the identifier for the user session
	SessionID string `json:"session_id,omitempty"`
}

Event represents an MCP event

type EventFilter

type EventFilter struct {
	Sources    []string  `json:"sources"`
	Types      []string  `json:"types"`
	AgentIDs   []string  `json:"agent_ids,omitempty"`
	SessionIDs []string  `json:"session_ids,omitempty"`
	After      time.Time `json:"after"`
	Before     time.Time `json:"before"`
}

EventFilter defines criteria for filtering events

func (*EventFilter) MatchEvent

func (f *EventFilter) MatchEvent(event Event) bool

MatchEvent checks if an event matches the filter criteria

type EventHandler

type EventHandler func(Event) error

EventHandler is a function that processes an event

type ExecutionContext

type ExecutionContext struct {
	ExecutionID   uuid.UUID              `json:"execution_id"`
	WorkflowID    uuid.UUID              `json:"workflow_id"`
	Status        string                 `json:"status"`
	CurrentStep   string                 `json:"current_step"`
	TotalSteps    int                    `json:"total_steps"`
	StartedAt     time.Time              `json:"started_at"`
	CompletedAt   *time.Time             `json:"completed_at,omitempty"`
	ExecutionTime time.Duration          `json:"execution_time"`
	StepResults   map[string]interface{} `json:"step_results"`
}

ExecutionContext for workflow executions

type ExecutionEvent

type ExecutionEvent struct {
	Timestamp   time.Time              `json:"timestamp"`
	EventType   string                 `json:"event_type"`
	StepID      string                 `json:"step_id,omitempty"`
	AgentID     string                 `json:"agent_id,omitempty"`
	Description string                 `json:"description"`
	Details     map[string]interface{} `json:"details,omitempty"`
}

ExecutionEvent represents an event in the workflow execution timeline

type ExecutionPhase

type ExecutionPhase struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	TaskIDs  []string `json:"task_ids"`
	Parallel bool     `json:"parallel"`
	MaxRetry int      `json:"max_retry"`
}

ExecutionPhase represents a phase in the execution plan

type ExecutionPlan

type ExecutionPlan struct {
	Phases      []ExecutionPhase       `json:"phases"`
	SyncPoints  []SyncPoint            `json:"sync_points,omitempty"`
	Constraints map[string]interface{} `json:"constraints,omitempty"`
	Timeout     time.Duration          `json:"timeout"`
}

ExecutionPlan represents the execution plan for a distributed task

type ExecutionStatus

type ExecutionStatus struct {
	ExecutionID    uuid.UUID              `json:"execution_id"`
	WorkflowID     uuid.UUID              `json:"workflow_id"`
	Status         string                 `json:"status"`
	Progress       int                    `json:"progress"`
	CurrentSteps   []string               `json:"current_steps"`
	CompletedSteps int                    `json:"completed_steps"`
	TotalSteps     int                    `json:"total_steps"`
	StartedAt      time.Time              `json:"started_at"`
	UpdatedAt      time.Time              `json:"updated_at"`
	EstimatedEnd   *time.Time             `json:"estimated_end,omitempty"`
	Metrics        map[string]interface{} `json:"metrics,omitempty"`
}

ExecutionStatus represents detailed workflow execution status

type ExecutionTrace

type ExecutionTrace struct {
	ExecutionID uuid.UUID              `json:"execution_id"`
	Steps       []StepTrace            `json:"steps"`
	Timeline    []TimelineEvent        `json:"timeline"`
	Metadata    map[string]interface{} `json:"metadata"`
}

ExecutionTrace represents a trace of workflow execution

type ExtendedDistributedTask

type ExtendedDistributedTask struct {
	DistributedTask

	// Embedded task reference
	Task *Task `json:"task,omitempty"`

	// Coordination fields
	CoordinationMode    CoordinationMode `json:"coordination_mode"`
	CompletionMode      CompletionMode   `json:"completion_mode"`
	CompletionThreshold int              `json:"completion_threshold,omitempty"` // For threshold mode

	// Execution tracking
	ExecutionPlan *ExecutionPlan  `json:"execution_plan,omitempty"`
	Partitions    []TaskPartition `json:"partitions,omitempty"`
	Progress      *TaskProgress   `json:"progress,omitempty"`
	ResourceUsage *ResourceUsage  `json:"resource_usage,omitempty"`

	// Timing
	StartedAt         *time.Time    `json:"started_at,omitempty"`
	CompletedAt       *time.Time    `json:"completed_at,omitempty"`
	EstimatedDuration time.Duration `json:"estimated_duration,omitempty"`

	// Results aggregation
	ResultsCollected    int           `json:"results_collected"`
	FinalResult         interface{}   `json:"final_result,omitempty"`
	IntermediateResults []interface{} `json:"intermediate_results,omitempty"`
}

ExtendedDistributedTask extends the DistributedTask with production fields

func (*ExtendedDistributedTask) CalculateProgress

func (dt *ExtendedDistributedTask) CalculateProgress() float64

CalculateProgress calculates the overall progress of the distributed task

func (*ExtendedDistributedTask) GetEstimatedCompletion

func (dt *ExtendedDistributedTask) GetEstimatedCompletion() *time.Time

GetEstimatedCompletion returns the estimated completion time

func (*ExtendedDistributedTask) IsComplete

func (dt *ExtendedDistributedTask) IsComplete() bool

IsComplete checks if the distributed task is complete based on completion mode

type GitHubQuery

type GitHubQuery struct {
	// Type specifies the type of query
	Type GitHubQueryType `json:"type"`

	// Owner is the repository owner (organization or user)
	Owner string `json:"owner"`

	// Repo is the repository name
	Repo string `json:"repo"`

	// State is used for filtering pull requests or issues
	State string `json:"state,omitempty"`

	// Branch is used for filtering commits or other branch-specific queries
	Branch string `json:"branch,omitempty"`

	// ID is used when querying a specific resource by ID
	ID string `json:"id,omitempty"`

	// Number is used when querying a specific pull request or issue by number
	Number int `json:"number,omitempty"`
}

GitHubQuery represents a query to the GitHub API

type GitHubQueryType

type GitHubQueryType string

GitHubQueryType defines the type of GitHub query

const (
	// GitHubQueryTypeRepository represents a repository query
	GitHubQueryTypeRepository GitHubQueryType = "repository"

	// GitHubQueryTypePullRequests represents a pull requests query
	GitHubQueryTypePullRequests GitHubQueryType = "pull_requests"

	// GitHubQueryTypeIssues represents an issues query
	GitHubQueryTypeIssues GitHubQueryType = "issues"

	// GitHubQueryTypeCommits represents a commits query
	GitHubQueryTypeCommits GitHubQueryType = "commits"
)

type HarnessCCMAnomaly

type HarnessCCMAnomaly struct {
	ID            string         `json:"id"`
	Name          string         `json:"name"`
	Status        string         `json:"status"`
	CloudProvider string         `json:"cloudProvider"`
	ResourceID    string         `json:"resourceId"`
	ResourceName  string         `json:"resourceName"`
	Description   string         `json:"description"`
	AnomalyCost   float64        `json:"anomalyCost"`
	ExpectedCost  float64        `json:"expectedCost"`
	Currency      string         `json:"currency"`
	DetectedAt    time.Time      `json:"detectedAt"`
	StartTime     time.Time      `json:"startTime"`
	EndTime       time.Time      `json:"endTime"`
	Details       map[string]any `json:"details"`
}

HarnessCCMAnomaly represents a cost anomaly in CCM

type HarnessCCMAnomalyQuery

type HarnessCCMAnomalyQuery struct {
	StartTime      time.Time `json:"startTime"`
	EndTime        time.Time `json:"endTime"`
	Status         string    `json:"status"`
	CloudProvider  string    `json:"cloudProvider"`
	IncludeDetails bool      `json:"includeDetails"`
}

HarnessCCMAnomalyQuery defines parameters for querying cost anomalies

type HarnessCCMBudget

type HarnessCCMBudget struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	Type            string         `json:"type"`
	Amount          float64        `json:"amount"`
	Currency        string         `json:"currency"`
	Period          string         `json:"period"`
	StartDate       time.Time      `json:"startDate"`
	EndDate         time.Time      `json:"endDate"`
	ActualSpend     float64        `json:"actualSpend"`
	ForecastedSpend float64        `json:"forecastedSpend"`
	Status          string         `json:"status"`
	CreatedAt       time.Time      `json:"createdAt"`
	LastUpdatedAt   time.Time      `json:"lastUpdatedAt"`
	Details         map[string]any `json:"details"`
}

HarnessCCMBudget represents a budget in CCM

type HarnessCCMBudgetQuery

type HarnessCCMBudgetQuery struct {
	BudgetID       string `json:"budgetId"`
	Status         string `json:"status"`
	IncludeDetails bool   `json:"includeDetails"`
}

HarnessCCMBudgetQuery defines parameters for querying budgets

type HarnessCCMCostData

type HarnessCCMCostData struct {
	TotalCost     float64              `json:"totalCost"`
	Currency      string               `json:"currency"`
	TimeGrain     string               `json:"timeGrain"`
	StartTime     time.Time            `json:"startTime"`
	EndTime       time.Time            `json:"endTime"`
	CostBreakdown []HarnessCCMCostItem `json:"costBreakdown"`
	Details       map[string]any       `json:"details"`
}

HarnessCCMCostData represents cost data from CCM

type HarnessCCMCostItem

type HarnessCCMCostItem struct {
	Name       string  `json:"name"`
	Cost       float64 `json:"cost"`
	Percentage float64 `json:"percentage"`
}

HarnessCCMCostItem represents a cost item breakdown

type HarnessCCMCostQuery

type HarnessCCMCostQuery struct {
	StartTime      time.Time `json:"startTime"`
	EndTime        time.Time `json:"endTime"`
	GroupBy        []string  `json:"groupBy"`
	FilterBy       []string  `json:"filterBy"`
	CloudProvider  string    `json:"cloudProvider"`
	PerspectiveID  string    `json:"perspectiveId"`
	IncludeDetails bool      `json:"includeDetails"`
}

HarnessCCMCostQuery defines parameters for querying cloud cost data

type HarnessCCMRecommendation

type HarnessCCMRecommendation struct {
	ID               string         `json:"id"`
	Type             string         `json:"type"`
	Status           string         `json:"status"`
	CloudProvider    string         `json:"cloudProvider"`
	ResourceID       string         `json:"resourceId"`
	ResourceName     string         `json:"resourceName"`
	Description      string         `json:"description"`
	PotentialSavings float64        `json:"potentialSavings"`
	Currency         string         `json:"currency"`
	CreatedAt        time.Time      `json:"createdAt"`
	ExpiresAt        time.Time      `json:"expiresAt"`
	Details          map[string]any `json:"details"`
}

HarnessCCMRecommendation represents a cost optimization recommendation

type HarnessCCMRecommendationQuery

type HarnessCCMRecommendationQuery struct {
	Status             string `json:"status"`
	CloudProvider      string `json:"cloudProvider"`
	RecommendationType string `json:"type"`
	ResourceID         string `json:"resourceId"`
	IncludeDetails     bool   `json:"includeDetails"`
}

HarnessCCMRecommendationQuery defines parameters for querying recommendations

type HarnessCDDeployment

type HarnessCDDeployment struct {
	ID            string    `json:"id"`
	PipelineID    string    `json:"pipelineId"`
	ServiceID     string    `json:"serviceId"`
	EnvironmentID string    `json:"environmentId"`
	Environment   string    `json:"environment"` // Added for test compatibility
	Service       string    `json:"service"`     // Added for test compatibility
	Status        string    `json:"status"`
	StartTime     time.Time `json:"startTime"`
	EndTime       time.Time `json:"endTime"`
	ArtifactID    string    `json:"artifactId"`
	TriggeredBy   string    `json:"triggeredBy"`
}

HarnessCDDeployment represents a Harness CD deployment

type HarnessCDDeploymentEvent

type HarnessCDDeploymentEvent struct {
	EventType  string              `json:"eventType"`
	Deployment HarnessCDDeployment `json:"deployment"`
}

HarnessCDDeploymentEvent represents a Harness CD deployment webhook event

type HarnessCIBuild

type HarnessCIBuild struct {
	ID          string    `json:"id"`
	BuildNumber int       `json:"buildNumber"`
	PipelineID  string    `json:"pipelineId"`
	CommitID    string    `json:"commitId"`
	Branch      string    `json:"branch"`
	Status      string    `json:"status"`
	StartTime   time.Time `json:"startTime"`
	EndTime     time.Time `json:"endTime"`
	Duration    int64     `json:"duration"`
	TriggeredBy string    `json:"triggeredBy"`
}

HarnessCIBuild represents a Harness CI build

type HarnessCIBuildEvent

type HarnessCIBuildEvent struct {
	EventType string         `json:"eventType"`
	Build     HarnessCIBuild `json:"build"`
}

HarnessCIBuildEvent represents a Harness CI build webhook event

type HarnessFeatureFlag

type HarnessFeatureFlag struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	Identifier     string         `json:"identifier"`
	ProjectID      string         `json:"projectId"`
	Description    string         `json:"description"`
	Variations     []any          `json:"variations"`
	DefaultServeOn string         `json:"defaultServeOn"`
	State          string         `json:"state"`
	Kind           string         `json:"kind"`
	Tags           []string       `json:"tags"`
	Targeting      map[string]any `json:"targeting"`
}

HarnessFeatureFlag represents a Harness feature flag

type HarnessFeatureFlagEvent

type HarnessFeatureFlagEvent struct {
	EventType   string             `json:"eventType"`
	FeatureFlag HarnessFeatureFlag `json:"featureFlag"`
}

HarnessFeatureFlagEvent represents a Harness feature flag webhook event

type HarnessPipeline

type HarnessPipeline struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Identifier     string    `json:"identifier"`
	ProjectID      string    `json:"projectId"`
	OrgID          string    `json:"orgId"`
	Status         string    `json:"status"`
	CreatedAt      time.Time `json:"createdAt"`
	LastRunAt      time.Time `json:"lastRunAt"`
	LastModifiedAt time.Time `json:"lastModifiedAt"`
	Tags           []string  `json:"tags"`
}

HarnessPipeline represents a Harness pipeline

type HarnessQuery

type HarnessQuery struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

HarnessQuery defines parameters for querying Harness

type HarnessSTOExperiment

type HarnessSTOExperiment struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	Status        string    `json:"status"`
	StartTime     time.Time `json:"startTime"`
	EndTime       time.Time `json:"endTime"`
	ServiceID     string    `json:"serviceId"`
	EnvironmentID string    `json:"environmentId"`
	Metrics       []string  `json:"metrics"`
}

HarnessSTOExperiment represents a Harness STO experiment

type HarnessSTOExperimentEvent

type HarnessSTOExperimentEvent struct {
	EventType  string               `json:"eventType"`
	Experiment HarnessSTOExperiment `json:"experiment"`
}

HarnessSTOExperimentEvent represents a Harness STO experiment webhook event

type HealthStatus

type HealthStatus string
const (
	HealthStatusHealthy   HealthStatus = "healthy"
	HealthStatusDegraded  HealthStatus = "degraded"
	HealthStatusUnhealthy HealthStatus = "unhealthy"
	HealthStatusUnknown   HealthStatus = "unknown"
)

type JSONMap

type JSONMap map[string]interface{}

JSONMap is a type alias for map[string]interface{} that implements sql.Scanner and driver.Valuer

func (*JSONMap) Scan

func (m *JSONMap) Scan(value interface{}) error

Scan implements sql.Scanner for JSONMap

func (JSONMap) Value

func (m JSONMap) Value() (driver.Value, error)

Value implements driver.Valuer for JSONMap

type KeyTypeRateLimit

type KeyTypeRateLimit struct {
	RequestsPerMinute int `json:"requests_per_minute"`
	RequestsPerHour   int `json:"requests_per_hour"`
	RequestsPerDay    int `json:"requests_per_day"`
}

KeyTypeRateLimit represents rate limits for a specific key type

type MemberActivity

type MemberActivity struct {
	WorkspaceID    uuid.UUID              `json:"workspace_id"`
	AgentID        string                 `json:"agent_id"`
	AgentName      string                 `json:"agent_name"`
	LastActivityAt time.Time              `json:"last_activity_at"`
	ActivityType   string                 `json:"activity_type"`
	ActivityCount  int64                  `json:"activity_count"`
	Details        map[string]interface{} `json:"details"`
}

MemberActivity represents activity of a workspace member

type MemberPresence

type MemberPresence struct {
	WorkspaceID uuid.UUID `json:"workspace_id"`
	AgentID     string    `json:"agent_id"`
	AgentName   string    `json:"agent_name"`
	Status      string    `json:"status"` // online, away, busy, offline
	LastSeenAt  time.Time `json:"last_seen_at"`
	Location    string    `json:"location,omitempty"` // Current location in workspace (e.g., document ID)
}

MemberPresence represents the presence status of a workspace member

type MemberRole

type MemberRole string

MemberRole defines the role of a member in a workspace

const (
	MemberRoleOwner  MemberRole = "owner"
	MemberRoleAdmin  MemberRole = "admin"
	MemberRoleMember MemberRole = "member"
	MemberRoleViewer MemberRole = "viewer"
)

type MetricsClient

type MetricsClient interface {
	IncrementCounter(name string, value float64, tags map[string]string)
	RecordGauge(name string, value float64, tags map[string]string)
	RecordHistogram(name string, value float64, tags map[string]string)
	RecordTiming(name string, duration time.Duration, tags map[string]string)
}

MetricsClient interface for metrics collection

type Model

type Model struct {
	ID        string     `json:"id" db:"id"`
	TenantID  string     `json:"tenant_id" db:"tenant_id"`
	Name      string     `json:"name" db:"name"`
	CreatedAt *time.Time `json:"created_at,omitempty" db:"created_at"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" db:"updated_at"`
}

type ModelFilter

type ModelFilter struct {
	ID       string `json:"id,omitempty"`
	TenantID string `json:"tenant_id,omitempty"`
	Name     string `json:"name,omitempty"`
}

ModelFilter defines filter criteria for model operations

type Module

type Module struct {
	ID           string       `json:"id"`
	Artifacts    []Artifact   `json:"artifacts"`
	Dependencies []Dependency `json:"dependencies"`
}

Module represents a module in an Artifactory build

type MultiAgentWorkflowStep

type MultiAgentWorkflowStep struct {
	ID                   uuid.UUID `json:"id" db:"id"`
	WorkflowID           uuid.UUID `json:"workflow_id" db:"workflow_id"`
	Name                 string    `json:"name" db:"name"`
	Type                 string    `json:"type" db:"type"`
	Order                int       `json:"order" db:"order"`
	Config               JSONMap   `json:"config" db:"config"`
	Dependencies         []string  `json:"dependencies" db:"dependencies"`
	AssignedAgents       []string  `json:"assigned_agents" db:"assigned_agents"`
	RequiredCapabilities []string  `json:"required_capabilities" db:"required_capabilities"`
	TimeoutSeconds       int       `json:"timeout_seconds" db:"timeout_seconds"`
	RetryPolicy          JSONMap   `json:"retry_policy" db:"retry_policy"`
	CreatedAt            time.Time `json:"created_at" db:"created_at"`
}

Enhanced WorkflowStep for multi-agent support

type NotificationSettings

type NotificationSettings struct {
	Enabled         bool                   `json:"enabled"`
	EmailEnabled    bool                   `json:"email_enabled"`
	WebhookEnabled  bool                   `json:"webhook_enabled"`
	WebhookURL      string                 `json:"webhook_url,omitempty"`
	EventTypes      []string               `json:"event_types,omitempty"`
	DigestFrequency string                 `json:"digest_frequency,omitempty"` // immediate, hourly, daily, weekly
	Preferences     map[string]interface{} `json:"preferences,omitempty"`
}

NotificationSettings defines notification preferences

type OptimizationSuggestion

type OptimizationSuggestion struct {
	Type        string  `json:"type"`
	StepID      string  `json:"step_id,omitempty"`
	Description string  `json:"description"`
	Impact      float64 `json:"impact"` // Estimated improvement percentage
}

OptimizationSuggestion represents a suggestion for workflow optimization

type PaginationInfo

type PaginationInfo struct {
	Total      int  `json:"total"`
	Page       int  `json:"page"`
	PageSize   int  `json:"page_size"`
	TotalPages int  `json:"total_pages"`
	HasNext    bool `json:"has_next"`
	HasPrev    bool `json:"has_prev"`
}

PaginationInfo contains pagination metadata

type PendingApproval

type PendingApproval struct {
	ExecutionID uuid.UUID              `json:"execution_id"`
	WorkflowID  uuid.UUID              `json:"workflow_id"`
	StepID      string                 `json:"step_id"`
	StepName    string                 `json:"step_name"`
	RequestedAt time.Time              `json:"requested_at"`
	RequiredBy  []string               `json:"required_by"`
	ApprovedBy  []string               `json:"approved_by,omitempty"`
	RejectedBy  []string               `json:"rejected_by,omitempty"`
	DueBy       *time.Time             `json:"due_by,omitempty"`
	Context     map[string]interface{} `json:"context,omitempty"`
}

PendingApproval represents a pending approval request

type QueryOptions

type QueryOptions struct {
	Limit  int    `json:"limit"`
	Offset int    `json:"offset"`
	SortBy string `json:"sortBy"`
	Order  string `json:"order"`
}

Database query options

type RateLimitConfig

type RateLimitConfig struct {
	// Default rate limits
	DefaultRequestsPerMinute int `json:"default_requests_per_minute"`
	DefaultRequestsPerHour   int `json:"default_requests_per_hour"`
	DefaultRequestsPerDay    int `json:"default_requests_per_day"`

	// Key type specific overrides
	KeyTypeOverrides map[string]KeyTypeRateLimit `json:"key_type_overrides,omitempty"`

	// Endpoint specific overrides
	EndpointOverrides map[string]EndpointRateLimit `json:"endpoint_overrides,omitempty"`
}

RateLimitConfig represents rate limiting configuration

func (*RateLimitConfig) Scan

func (r *RateLimitConfig) Scan(value interface{}) error

Scan implements sql.Scanner for RateLimitConfig

func (RateLimitConfig) Value

func (r RateLimitConfig) Value() (driver.Value, error)

Value implements driver.Valuer for RateLimitConfig

type RelationshipType

type RelationshipType string

RelationshipType represents the type of relationship between entities

const (
	// RelationshipTypeReferences indicates an entity references another entity
	RelationshipTypeReferences RelationshipType = "references"
	// RelationshipTypeContains indicates an entity contains another entity
	RelationshipTypeContains RelationshipType = "contains"
	// RelationshipTypeCreates indicates an entity created another entity
	RelationshipTypeCreates RelationshipType = "creates"
	// RelationshipTypeModifies indicates an entity modified another entity
	RelationshipTypeModifies RelationshipType = "modifies"
	// RelationshipTypeAssociates indicates a general association between entities
	RelationshipTypeAssociates RelationshipType = "associates"
	// RelationshipTypeDependsOn indicates an entity depends on another entity
	RelationshipTypeDependsOn RelationshipType = "depends_on"
	// RelationshipTypeImplements indicates an entity implements another entity
	RelationshipTypeImplements RelationshipType = "implements"
	// RelationshipTypeExtends indicates an entity extends another entity
	RelationshipTypeExtends RelationshipType = "extends"
	// RelationshipTypeReplaces indicates an entity replaces another entity
	RelationshipTypeReplaces RelationshipType = "replaces"
	// RelationshipTypeComments indicates an entity is a comment on another entity
	RelationshipTypeComments RelationshipType = "comments"
)

Relationship types

type RepoSummary

type RepoSummary struct {
	RepoKey      string `json:"repoKey"`
	RepoType     string `json:"repoType"`
	FoldersCount int    `json:"foldersCount"`
	FilesCount   int    `json:"filesCount"`
	UsedSpace    string `json:"usedSpace"`
	ItemsCount   int    `json:"itemsCount"`
	PackageType  string `json:"packageType"`
	Percentage   string `json:"percentage"`
}

RepoSummary represents a repository summary in Artifactory

type ResourceMetrics

type ResourceMetrics struct {
	CPUSeconds      float64 `json:"cpu_seconds"`
	MemoryMBSeconds float64 `json:"memory_mb_seconds"`
	NetworkMB       float64 `json:"network_mb"`
	StorageMB       float64 `json:"storage_mb"`
}

type ResourceUsage

type ResourceUsage struct {
	TaskID      uuid.UUID `json:"task_id"`
	CPUPercent  float64   `json:"cpu_percent"`
	MemoryMB    int64     `json:"memory_mb"`
	DiskIOMB    int64     `json:"disk_io_mb"`
	NetworkMB   int64     `json:"network_mb"`
	GPUPercent  float64   `json:"gpu_percent,omitempty"`
	StartTime   time.Time `json:"start_time"`
	LastUpdated time.Time `json:"last_updated"`
}

ResourceUsage represents resource usage for a task

type RuleAction

type RuleAction struct {
	Type       string                 `json:"type"` // webhook, notification, task, etc.
	Parameters map[string]interface{} `json:"parameters"`
}

RuleAction defines an action for an automation rule

type RuleCondition

type RuleCondition struct {
	Field    string      `json:"field"`
	Operator string      `json:"operator"` // eq, ne, gt, lt, contains, etc.
	Value    interface{} `json:"value"`
}

RuleCondition defines a condition for an automation rule

type SecuritySettings

type SecuritySettings struct {
	RequireMFA     bool     `json:"require_mfa"`
	AllowAPIAccess bool     `json:"allow_api_access"`
	IPWhitelist    []string `json:"ip_whitelist,omitempty"`
	SessionTimeout int      `json:"session_timeout"` // minutes
	DataEncryption bool     `json:"data_encryption"`
	AuditLogging   bool     `json:"audit_logging"`
	ComplianceMode string   `json:"compliance_mode,omitempty"` // HIPAA, SOC2, etc.
	RetentionDays  int      `json:"retention_days,omitempty"`
}

SecuritySettings defines security preferences

type SharedDocument

type SharedDocument struct {
	ID            uuid.UUID  `json:"id" db:"id"`
	WorkspaceID   uuid.UUID  `json:"workspace_id" db:"workspace_id"`
	TenantID      uuid.UUID  `json:"tenant_id" db:"tenant_id"`
	Type          string     `json:"type" db:"type"`
	Title         string     `json:"title" db:"title"`
	Content       string     `json:"content" db:"content"`
	ContentType   string     `json:"content_type" db:"content_type"`
	Version       int64      `json:"version" db:"version"`
	CreatedBy     string     `json:"created_by" db:"created_by"`
	Metadata      JSONMap    `json:"metadata" db:"metadata"`
	LockedBy      *string    `json:"locked_by,omitempty" db:"locked_by"`
	LockedAt      *time.Time `json:"locked_at,omitempty" db:"locked_at"`
	LockExpiresAt *time.Time `json:"lock_expires_at,omitempty" db:"lock_expires_at"`
	CreatedAt     time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt     *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`

	// Runtime data
	Operations    []*DocumentOperation `json:"operations,omitempty" db:"-"`
	Collaborators []string             `json:"collaborators,omitempty" db:"-"`
}

SharedDocument represents a collaborative document

func (*SharedDocument) CanEdit

func (d *SharedDocument) CanEdit(agentID string) bool

CanEdit returns true if the agent can edit the document

func (*SharedDocument) IsLocked

func (d *SharedDocument) IsLocked() bool

IsLocked returns true if the document is currently locked

type SimulationResult

type SimulationResult struct {
	Success         bool                       `json:"success"`
	ExecutionPath   []string                   `json:"execution_path"`
	EstimatedTime   time.Duration              `json:"estimated_time"`
	ResourceUsage   map[string]interface{}     `json:"resource_usage"`
	PotentialErrors []string                   `json:"potential_errors,omitempty"`
	Warnings        []string                   `json:"warnings,omitempty"`
	StepDetails     map[string]*StepSimulation `json:"step_details"`
}

SimulationResult represents the result of a workflow simulation

type SonarQubeBranchRef

type SonarQubeBranchRef struct {
	Name string `json:"name"`
	Type string `json:"type"`
	URL  string `json:"url"`
}

SonarQubeBranchRef represents a branch reference in a webhook

type SonarQubeCondition

type SonarQubeCondition struct {
	Status         string `json:"status"`
	MetricKey      string `json:"metricKey"`
	Comparator     string `json:"comparator"`
	ErrorThreshold string `json:"errorThreshold"`
	ActualValue    string `json:"actualValue"`
}

SonarQubeCondition represents a condition in a SonarQube quality gate

type SonarQubeConditionRef

type SonarQubeConditionRef struct {
	Metric         string `json:"metric"`
	Status         string `json:"status"`
	ErrorThreshold string `json:"errorThreshold"`
	ActualValue    string `json:"actualValue"`
}

SonarQubeConditionRef represents a condition reference in a webhook

type SonarQubeIssue

type SonarQubeIssue struct {
	Key          string    `json:"key"`
	Rule         string    `json:"rule"`
	Severity     string    `json:"severity"`
	Component    string    `json:"component"`
	Project      string    `json:"project"`
	Line         int       `json:"line"`
	Status       string    `json:"status"`
	Message      string    `json:"message"`
	Effort       string    `json:"effort"`
	Debt         string    `json:"debt"`
	CreationDate time.Time `json:"creationDate"`
}

SonarQubeIssue represents a single issue in SonarQube

type SonarQubeIssues

type SonarQubeIssues struct {
	Total  int              `json:"total"`
	Issues []SonarQubeIssue `json:"issues"`
}

SonarQubeIssues represents issues in SonarQube

type SonarQubeMeasure

type SonarQubeMeasure struct {
	Metric string `json:"metric"`
	Value  string `json:"value"`
	Period struct {
		Index int    `json:"index"`
		Value string `json:"value"`
	} `json:"period,omitempty"`
}

SonarQubeMeasure represents a measure in SonarQube

type SonarQubeMetrics

type SonarQubeMetrics struct {
	Component struct {
		Key       string             `json:"key"`
		Name      string             `json:"name"`
		Qualifier string             `json:"qualifier"`
		Measures  []SonarQubeMeasure `json:"measures"`
	} `json:"component"`
}

SonarQubeMetrics represents metrics in SonarQube

type SonarQubeProject

type SonarQubeProject struct {
	Key          string    `json:"key"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Qualifier    string    `json:"qualifier"`
	LastAnalysis time.Time `json:"lastAnalysisDate"`
	Visibility   string    `json:"visibility"`
}

SonarQubeProject represents a SonarQube project

type SonarQubeProjectRef

type SonarQubeProjectRef struct {
	Key  string `json:"key"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

SonarQubeProjectRef represents a project reference in a webhook

type SonarQubeQualityGate

type SonarQubeQualityGate struct {
	ProjectStatus struct {
		Status      string               `json:"status"`
		Conditions  []SonarQubeCondition `json:"conditions"`
		PeriodIndex int                  `json:"periodIndex"`
	} `json:"projectStatus"`
}

SonarQubeQualityGate represents a SonarQube quality gate

type SonarQubeQualityGateRef

type SonarQubeQualityGateRef struct {
	Name       string                  `json:"name"`
	Status     string                  `json:"status"`
	Conditions []SonarQubeConditionRef `json:"conditions"`
}

SonarQubeQualityGateRef represents a quality gate reference in a webhook

type SonarQubeQuery

type SonarQubeQuery struct {
	Type         string `json:"type"`
	ProjectKey   string `json:"projectKey"`
	Organization string `json:"organization"`
	Severity     string `json:"severity"`
	Status       string `json:"status"`
	MetricKeys   string `json:"metricKeys"`
}

SonarQubeQuery defines parameters for querying SonarQube

type SonarQubeTaskRef

type SonarQubeTaskRef struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	Status          string `json:"status"`
	StartedAt       string `json:"startedAt"`
	ExecutionTimeMs int64  `json:"executionTimeMs"`
}

SonarQubeTaskRef represents a task reference in a webhook

type SonarQubeWebhookEvent

type SonarQubeWebhookEvent struct {
	ServerURL   string                   `json:"serverUrl"`
	TaskID      string                   `json:"taskId"`
	Status      string                   `json:"status"`
	AnalysedAt  string                   `json:"analysedAt"`
	Project     *SonarQubeProjectRef     `json:"project,omitempty"`
	QualityGate *SonarQubeQualityGateRef `json:"qualityGate,omitempty"`
	Branch      *SonarQubeBranchRef      `json:"branch,omitempty"`
	Task        *SonarQubeTaskRef        `json:"task,omitempty"`
}

SonarQubeWebhookEvent represents a SonarQube webhook event

type StateOperation

type StateOperation struct {
	Type  string      `json:"type"`  // set, increment, add_to_set, remove_from_set
	Path  string      `json:"path"`  // JSON path to the field
	Value interface{} `json:"value"` // Value to set/add
	Delta int         `json:"delta"` // For increment operations
}

StateOperation represents an operation to modify workspace state

type StateSnapshot

type StateSnapshot struct {
	ID          uuid.UUID              `json:"id"`
	WorkspaceID uuid.UUID              `json:"workspace_id"`
	Version     int64                  `json:"version"`
	State       map[string]interface{} `json:"state"`
	CreatedAt   time.Time              `json:"created_at"`
	CreatedBy   string                 `json:"created_by"`
}

StateSnapshot represents a snapshot of workspace state

type StepExecution

type StepExecution struct {
	ExecutionID uuid.UUID  `json:"execution_id" db:"execution_id"`
	StepName    string     `json:"step_name" db:"step_name"`
	StartedAt   time.Time  `json:"started_at" db:"started_at"`
	CompletedAt *time.Time `json:"completed_at,omitempty" db:"completed_at"`
	Status      string     `json:"status" db:"status"`
	Result      JSONMap    `json:"result,omitempty" db:"result"`
	Error       *string    `json:"error,omitempty" db:"error"`
	RetryCount  int        `json:"retry_count" db:"retry_count"`
}

StepExecution represents the execution of a workflow step

type StepExecutionStatus

type StepExecutionStatus string

StepExecutionStatus for step execution state

Convert step status string constants to StepExecutionStatus

func (StepExecutionStatus) CanTransitionTo

func (s StepExecutionStatus) CanTransitionTo(target StepExecutionStatus) bool

CanTransitionTo checks if step status transition is valid

func (StepExecutionStatus) IsTerminal

func (s StepExecutionStatus) IsTerminal() bool

IsTerminal returns true if the step status is a terminal state

func (StepExecutionStatus) TransitionTo

TransitionTo performs a validated state transition with metrics

func (StepExecutionStatus) Validate

func (s StepExecutionStatus) Validate() error

Validate ensures the step status is valid

type StepMetrics

type StepMetrics struct {
	SuccessRate    float64        `json:"success_rate"`
	AverageTime    time.Duration  `json:"average_time"`
	FailureReasons map[string]int `json:"failure_reasons"`
}

StepMetrics represents metrics for a workflow step

type StepSimulation

type StepSimulation struct {
	StepID        string        `json:"step_id"`
	CanExecute    bool          `json:"can_execute"`
	EstimatedTime time.Duration `json:"estimated_time"`
	Requirements  []string      `json:"requirements,omitempty"`
	Issues        []string      `json:"issues,omitempty"`
}

StepSimulation represents simulation details for a single step

type StepStatus

type StepStatus struct {
	StepID      string                 `json:"step_id"`
	Status      string                 `json:"status"`
	AgentID     string                 `json:"agent_id"`
	Input       map[string]interface{} `json:"input,omitempty"`
	Output      map[string]interface{} `json:"output,omitempty"`
	Error       string                 `json:"error,omitempty"`
	StartedAt   *time.Time             `json:"started_at,omitempty"`
	CompletedAt *time.Time             `json:"completed_at,omitempty"`
	RetryCount  int                    `json:"retry_count"`
}

StepStatus represents the execution state of a workflow step

func (*StepStatus) GetAttempts

func (s *StepStatus) GetAttempts() int

func (*StepStatus) GetCreatedAt

func (s *StepStatus) GetCreatedAt() time.Time

func (*StepStatus) GetName

func (s *StepStatus) GetName() string

StepStatus extended methods

type StepTrace

type StepTrace struct {
	StepID    string                 `json:"step_id"`
	StartTime time.Time              `json:"start_time"`
	EndTime   time.Time              `json:"end_time"`
	Duration  time.Duration          `json:"duration"`
	Status    string                 `json:"status"`
	Input     map[string]interface{} `json:"input"`
	Output    map[string]interface{} `json:"output"`
	Error     string                 `json:"error,omitempty"`
}

StepTrace represents a trace of a step execution

type Subtask

type Subtask struct {
	ID          string                 `json:"id"`
	AgentID     string                 `json:"agent_id"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"`
}

Subtask represents a subtask definition

type SubtaskCreatedEvent

type SubtaskCreatedEvent struct {
	ParentTask *Task `json:"parent_task"`
	Subtask    *Task `json:"subtask"`
}

SubtaskCreatedEvent represents a subtask creation event

type SyncPoint

type SyncPoint struct {
	ID            string        `json:"id"`
	Name          string        `json:"name"`
	RequiredTasks []string      `json:"required_tasks"`
	Timeout       time.Duration `json:"timeout"`
	OnTimeout     string        `json:"on_timeout"` // continue, fail, retry
}

SyncPoint represents a synchronization point between subtasks

type Task

type Task struct {
	// Core fields
	ID       uuid.UUID    `json:"id" db:"id"`
	TenantID uuid.UUID    `json:"tenant_id" db:"tenant_id"`
	Type     string       `json:"type" db:"type"`
	Status   TaskStatus   `json:"status" db:"status"`
	Priority TaskPriority `json:"priority" db:"priority"`

	// Agent relationships
	CreatedBy  string  `json:"created_by" db:"created_by"`
	AssignedTo *string `json:"assigned_to,omitempty" db:"assigned_to"`

	// Task hierarchy
	ParentTaskID *uuid.UUID `json:"parent_task_id,omitempty" db:"parent_task_id"`

	// Task data
	Title       string  `json:"title" db:"title"`
	Description string  `json:"description,omitempty" db:"description"`
	Parameters  JSONMap `json:"parameters" db:"parameters"`
	Result      JSONMap `json:"result,omitempty" db:"result"`
	Error       string  `json:"error,omitempty" db:"error"`

	// Execution control
	MaxRetries     int `json:"max_retries" db:"max_retries"`
	RetryCount     int `json:"retry_count" db:"retry_count"`
	TimeoutSeconds int `json:"timeout_seconds" db:"timeout_seconds"`

	// Timestamps
	CreatedAt   time.Time  `json:"created_at" db:"created_at"`
	AssignedAt  *time.Time `json:"assigned_at,omitempty" db:"assigned_at"`
	StartedAt   *time.Time `json:"started_at,omitempty" db:"started_at"`
	CompletedAt *time.Time `json:"completed_at,omitempty" db:"completed_at"`
	UpdatedAt   time.Time  `json:"updated_at" db:"updated_at"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty" db:"deleted_at"`

	// Optimistic locking
	Version int `json:"version" db:"version"`

	// Computed fields (not stored)
	Subtasks     []*Task           `json:"subtasks,omitempty" db:"-"`
	Delegations  []*TaskDelegation `json:"delegations,omitempty" db:"-"`
	Tags         []string          `json:"tags,omitempty" db:"-"`
	Capabilities []string          `json:"capabilities,omitempty" db:"-"`
}

Task represents a unit of work in the multi-agent system

func (*Task) CanRetry

func (t *Task) CanRetry() bool

CanRetry returns true if the task can be retried

func (*Task) Duration

func (t *Task) Duration() time.Duration

Duration returns the task execution duration

func (*Task) GetID

func (t *Task) GetID() uuid.UUID

GetID returns the task ID (implements AggregateRoot)

func (*Task) GetType

func (t *Task) GetType() string

GetType returns the aggregate type (implements AggregateRoot)

func (*Task) GetVersion

func (t *Task) GetVersion() int

GetVersion returns the version (implements AggregateRoot)

func (*Task) IsOverdue

func (t *Task) IsOverdue() bool

IsOverdue returns true if the task has exceeded its timeout

func (*Task) IsTerminal

func (t *Task) IsTerminal() bool

IsTerminal returns true if the task is in a terminal state

type TaskConflict

type TaskConflict struct {
	Type   string        `json:"type"`   // status, assignment, priority
	Values []interface{} `json:"values"` // Conflicting values from different agents
}

TaskConflict represents a conflict in task updates

type TaskCreatedEvent

type TaskCreatedEvent struct {
	Task *Task `json:"task"`
}

TaskCreatedEvent represents a task creation event

type TaskDelegatedEvent

type TaskDelegatedEvent struct {
	Task          *Task           `json:"task"`
	Delegation    *TaskDelegation `json:"delegation"`
	PreviousAgent string          `json:"previous_agent"`
}

TaskDelegatedEvent represents a task delegation event

type TaskDelegation

type TaskDelegation struct {
	ID             uuid.UUID      `json:"id" db:"id"`
	TaskID         uuid.UUID      `json:"task_id" db:"task_id"`
	TaskCreatedAt  time.Time      `json:"task_created_at" db:"task_created_at"` // For partitioned table FK
	FromAgentID    string         `json:"from_agent_id" db:"from_agent_id"`
	ToAgentID      string         `json:"to_agent_id" db:"to_agent_id"`
	Reason         string         `json:"reason,omitempty" db:"reason"`
	DelegationType DelegationType `json:"delegation_type" db:"delegation_type"`
	Metadata       JSONMap        `json:"metadata" db:"metadata"`
	DelegatedAt    time.Time      `json:"delegated_at" db:"delegated_at"`
}

TaskDelegation represents a task being delegated between agents

type TaskEvent

type TaskEvent struct {
	ID        uuid.UUID              `json:"id" db:"id"`
	TaskID    uuid.UUID              `json:"task_id" db:"task_id"`
	Type      string                 `json:"type" db:"type"`
	Timestamp time.Time              `json:"timestamp" db:"timestamp"`
	AgentID   string                 `json:"agent_id" db:"agent_id"`
	Data      map[string]interface{} `json:"data" db:"data"`
}

TaskEvent represents an event in task lifecycle

type TaskMetrics

type TaskMetrics struct {
	Count       int64   `json:"count"`
	SuccessRate float64 `json:"success_rate"`
	AverageTime float64 `json:"average_time"`
	MedianTime  float64 `json:"median_time"`
	P95Time     float64 `json:"p95_time"`
}

TaskMetrics represents metrics for a specific task type

type TaskPartition

type TaskPartition struct {
	ID         string                 `json:"id"`
	RangeStart int64                  `json:"range_start,omitempty"`
	RangeEnd   int64                  `json:"range_end,omitempty"`
	DataSet    string                 `json:"data_set,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	Weight     float64                `json:"weight"` // Relative weight for load balancing
}

TaskPartition represents a partition of work for a subtask

type TaskPriority

type TaskPriority string

TaskPriority represents the urgency of a task

const (
	TaskPriorityLow      TaskPriority = "low"
	TaskPriorityNormal   TaskPriority = "normal"
	TaskPriorityHigh     TaskPriority = "high"
	TaskPriorityCritical TaskPriority = "critical"
)

type TaskProgress

type TaskProgress struct {
	TaskID                 uuid.UUID              `json:"task_id"`
	TotalSteps             int                    `json:"total_steps"`
	CompletedSteps         int                    `json:"completed_steps"`
	CurrentStep            string                 `json:"current_step"`
	PercentComplete        float64                `json:"percent_complete"`
	EstimatedTimeRemaining time.Duration          `json:"estimated_time_remaining,omitempty"`
	LastUpdated            time.Time              `json:"last_updated"`
	Details                map[string]interface{} `json:"details,omitempty"`
}

TaskProgress represents progress information for a task

type TaskStats

type TaskStats struct {
	TotalTasks      int64                  `json:"total_tasks"`
	TasksByStatus   map[TaskStatus]int64   `json:"tasks_by_status"`
	TasksByPriority map[TaskPriority]int64 `json:"tasks_by_priority"`
	TasksByType     map[string]int64       `json:"tasks_by_type"`
	AverageTime     float64                `json:"average_time_seconds"`
	SuccessRate     float64                `json:"success_rate"`
}

TaskStats represents task statistics

type TaskStatus

type TaskStatus string

TaskStatus represents the lifecycle state of a task

const (
	TaskStatusPending    TaskStatus = "pending"
	TaskStatusAssigned   TaskStatus = "assigned"
	TaskStatusAccepted   TaskStatus = "accepted"
	TaskStatusRejected   TaskStatus = "rejected"
	TaskStatusInProgress TaskStatus = "in_progress"
	TaskStatusCompleted  TaskStatus = "completed"
	TaskStatusFailed     TaskStatus = "failed"
	TaskStatusCancelled  TaskStatus = "cancelled"
	TaskStatusTimeout    TaskStatus = "timeout"
)

type TaskTree

type TaskTree struct {
	Root     *Task
	Children map[uuid.UUID][]*Task
	Depth    int
}

TaskTree represents a hierarchical task structure

type TemplateParameter

type TemplateParameter struct {
	Name         string      `json:"name"`
	Type         string      `json:"type"`
	Description  string      `json:"description"`
	Required     bool        `json:"required"`
	DefaultValue interface{} `json:"default_value,omitempty"`
}

TemplateParameter represents a parameter in a workflow template

type TenantConfig

type TenantConfig struct {
	ID              string                 `json:"id" db:"id"`
	TenantID        string                 `json:"tenant_id" db:"tenant_id"`
	RateLimitConfig RateLimitConfig        `json:"rate_limit_config" db:"rate_limit_config"`
	ServiceTokens   map[string]string      `json:"-" db:"-"`              // Decrypted in memory only
	EncryptedTokens json.RawMessage        `json:"-" db:"service_tokens"` // Encrypted in database
	AllowedOrigins  pq.StringArray         `json:"allowed_origins" db:"allowed_origins"`
	Features        map[string]interface{} `json:"features" db:"-"` // Parsed from JSONB
	FeaturesJSON    json.RawMessage        `json:"-" db:"features"` // Raw JSONB from database
	CreatedAt       time.Time              `json:"created_at" db:"created_at"`
	UpdatedAt       time.Time              `json:"updated_at" db:"updated_at"`
}

TenantConfig represents per-tenant configuration settings

func DefaultTenantConfig

func DefaultTenantConfig(tenantID string) *TenantConfig

DefaultTenantConfig returns a default configuration for a tenant

func (*TenantConfig) GetRateLimitForEndpoint

func (tc *TenantConfig) GetRateLimitForEndpoint(endpoint string) (EndpointRateLimit, bool)

GetRateLimitForEndpoint returns the rate limit configuration for a specific endpoint

func (*TenantConfig) GetRateLimitForKeyType

func (tc *TenantConfig) GetRateLimitForKeyType(keyType string) KeyTypeRateLimit

GetRateLimitForKeyType returns the rate limit configuration for a specific key type

func (*TenantConfig) GetServiceToken

func (tc *TenantConfig) GetServiceToken(provider string) (string, bool)

GetServiceToken returns the decrypted service token for a provider

func (*TenantConfig) HasServiceToken

func (tc *TenantConfig) HasServiceToken(provider string) bool

HasServiceToken checks if a service token exists for a provider

func (*TenantConfig) IsFeatureEnabled

func (tc *TenantConfig) IsFeatureEnabled(feature string) bool

IsFeatureEnabled checks if a specific feature is enabled for the tenant

type TimelineEvent

type TimelineEvent struct {
	Timestamp   time.Time              `json:"timestamp"`
	Type        string                 `json:"type"`
	StepID      string                 `json:"step_id,omitempty"`
	Description string                 `json:"description"`
	Data        map[string]interface{} `json:"data,omitempty"`
}

TimelineEvent represents an event in the execution timeline

type TokenCredential

type TokenCredential struct {
	Token     string    `json:"token"`
	Type      string    `json:"type,omitempty"`     // "pat", "oauth", "basic", "bearer"
	Username  string    `json:"username,omitempty"` // For basic auth
	BaseURL   string    `json:"base_url,omitempty"` // For self-hosted instances
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

TokenCredential represents a single credential

func (*TokenCredential) GetToken

func (tc *TokenCredential) GetToken() string

GetToken returns the token if valid, empty string if expired

func (*TokenCredential) IsExpired

func (tc *TokenCredential) IsExpired() bool

IsExpired checks if the credential has expired

func (*TokenCredential) SanitizedForLogging

func (tc *TokenCredential) SanitizedForLogging() map[string]interface{}

SanitizedForLogging returns credential info without sensitive data

type ToolCredentials

type ToolCredentials struct {
	GitHub      *TokenCredential `json:"github,omitempty"`
	Jira        *TokenCredential `json:"jira,omitempty"`
	SonarQube   *TokenCredential `json:"sonarqube,omitempty"`
	Artifactory *TokenCredential `json:"artifactory,omitempty"`
	Jenkins     *TokenCredential `json:"jenkins,omitempty"`
	GitLab      *TokenCredential `json:"gitlab,omitempty"`
	Bitbucket   *TokenCredential `json:"bitbucket,omitempty"`
	// Extensible for more tools
	Custom map[string]*TokenCredential `json:"custom,omitempty"`
}

ToolCredentials represents user-provided credentials for backend tools

func (*ToolCredentials) GetCredentialFor

func (tc *ToolCredentials) GetCredentialFor(tool string) *TokenCredential

GetCredentialFor retrieves the credential for a specific tool

func (*ToolCredentials) HasCredentialFor

func (tc *ToolCredentials) HasCredentialFor(tool string) bool

HasCredentialFor checks if credentials exist for a specific tool

func (*ToolCredentials) SanitizedForLogging

func (tc *ToolCredentials) SanitizedForLogging() map[string]interface{}

SanitizedForLogging returns a version safe for logging

type ToolFilter

type ToolFilter struct {
	ID       string `json:"id,omitempty"`
	TenantID string `json:"tenant_id,omitempty"`
	Name     string `json:"name,omitempty"`
	Type     string `json:"type,omitempty"`
}

ToolFilter defines filter criteria for tool operations

type TrendData

type TrendData struct {
	Current  float64 `json:"current"`
	Previous float64 `json:"previous"`
	Change   float64 `json:"change_percentage"`
	Trend    string  `json:"trend"` // increasing, decreasing, stable
}

TrendData represents trend information

type UpdateType

type UpdateType string
const (
	UpdateTypeInsert  UpdateType = "insert"
	UpdateTypeDelete  UpdateType = "delete"
	UpdateTypeReplace UpdateType = "replace"
	UpdateTypeMove    UpdateType = "move"
	UpdateTypeMerge   UpdateType = "merge"
)

func (UpdateType) Validate

func (u UpdateType) Validate() error

Validate ensures the update type is valid

type Vector

type Vector struct {
	ID        string         `json:"id" db:"id"`
	TenantID  string         `json:"tenant_id" db:"tenant_id"`
	Content   string         `json:"content" db:"content"`
	Embedding []float32      `json:"embedding" db:"embedding"`
	Metadata  map[string]any `json:"metadata" db:"metadata"`
	CreatedAt time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt time.Time      `json:"updated_at" db:"updated_at"`
}

Vector represents a vector embedding stored in the database

func NewVector

func NewVector(tenantID, content string, embedding []float32, metadata map[string]any) *Vector

NewVector creates a new vector embedding

type VectorFilter

type VectorFilter struct {
	ID        string `json:"id,omitempty"`
	TenantID  string `json:"tenant_id,omitempty"`
	ContextID string `json:"context_id,omitempty"`
	ModelID   string `json:"model_id,omitempty"`
}

VectorFilter defines filter criteria for vector operations

type Workflow

type Workflow struct {
	ID          uuid.UUID      `json:"id" db:"id"`
	TenantID    uuid.UUID      `json:"tenant_id" db:"tenant_id"`
	Name        string         `json:"name" db:"name"`
	Type        WorkflowType   `json:"type" db:"type"`
	Version     int            `json:"version" db:"version"`
	CreatedBy   string         `json:"created_by" db:"created_by"`
	Agents      JSONMap        `json:"agents" db:"agents"`
	Steps       WorkflowSteps  `json:"steps" db:"steps"`
	Config      JSONMap        `json:"config" db:"config"`
	Description string         `json:"description,omitempty" db:"description"`
	Tags        pq.StringArray `json:"tags,omitempty" db:"tags"`
	IsActive    bool           `json:"is_active" db:"is_active"`
	CreatedAt   time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at" db:"updated_at"`
	DeletedAt   *time.Time     `json:"deleted_at,omitempty" db:"deleted_at"`
}

Workflow represents a multi-agent workflow definition

func (*Workflow) GetID

func (w *Workflow) GetID() uuid.UUID

Add methods to make Workflow implement AggregateRoot

func (*Workflow) GetLastExecutedAt

func (w *Workflow) GetLastExecutedAt() *time.Time

Extend Workflow with additional fields

func (*Workflow) GetSteps

func (w *Workflow) GetSteps() []WorkflowStep

Helper function to get workflow steps as structured objects

func (*Workflow) GetType

func (w *Workflow) GetType() string

func (*Workflow) GetVersion

func (w *Workflow) GetVersion() int

func (*Workflow) SetLastExecutedAt

func (w *Workflow) SetLastExecutedAt(t time.Time)

type WorkflowExecution

type WorkflowExecution struct {
	ID          uuid.UUID      `json:"id" db:"id"`
	WorkflowID  uuid.UUID      `json:"workflow_id" db:"workflow_id"`
	TenantID    uuid.UUID      `json:"tenant_id" db:"tenant_id"`
	Status      WorkflowStatus `json:"status" db:"status"`
	Context     JSONMap        `json:"context" db:"context"`
	State       JSONMap        `json:"state" db:"state"`
	InitiatedBy string         `json:"initiated_by" db:"initiated_by"`
	Error       string         `json:"error,omitempty" db:"error"`
	StartedAt   time.Time      `json:"started_at" db:"started_at"`
	CompletedAt *time.Time     `json:"completed_at,omitempty" db:"completed_at"`
	UpdatedAt   time.Time      `json:"updated_at" db:"updated_at"`

	// Runtime data
	Workflow      *Workflow              `json:"workflow,omitempty" db:"-"`
	StepStatuses  map[string]*StepStatus `json:"step_statuses,omitempty" db:"-"`
	CurrentStepID string                 `json:"current_step_id,omitempty" db:"-"`
}

WorkflowExecution represents a running or completed workflow instance

func (*WorkflowExecution) Duration

func (e *WorkflowExecution) Duration() time.Duration

Duration returns the execution duration

func (*WorkflowExecution) GetCreatedAt

func (e *WorkflowExecution) GetCreatedAt() time.Time

func (*WorkflowExecution) GetID

func (e *WorkflowExecution) GetID() uuid.UUID

Add methods to make WorkflowExecution implement AggregateRoot

func (*WorkflowExecution) GetInput

func (e *WorkflowExecution) GetInput() map[string]interface{}

func (*WorkflowExecution) GetSteps

func (e *WorkflowExecution) GetSteps() map[string]*StepStatus

func (*WorkflowExecution) GetTriggeredBy

func (e *WorkflowExecution) GetTriggeredBy() string

Extend WorkflowExecution with additional fields through helper methods

func (*WorkflowExecution) GetType

func (e *WorkflowExecution) GetType() string

func (*WorkflowExecution) GetVersion

func (e *WorkflowExecution) GetVersion() int

func (*WorkflowExecution) IsTerminal

func (e *WorkflowExecution) IsTerminal() bool

IsTerminal returns true if the workflow is in a terminal state

func (*WorkflowExecution) SetInput

func (e *WorkflowExecution) SetInput(input map[string]interface{})

type WorkflowExecutionMetrics

type WorkflowExecutionMetrics struct {
	ExecutionID   uuid.UUID                `json:"execution_id"`
	TotalDuration time.Duration            `json:"total_duration"`
	StepDurations map[string]time.Duration `json:"step_durations"`
	QueueTime     time.Duration            `json:"queue_time"`
	RetryCount    int                      `json:"retry_count"`
	ResourceUsage ResourceMetrics          `json:"resource_usage"`
	CostEstimate  float64                  `json:"cost_estimate"`
}

WorkflowExecutionMetrics tracks workflow performance

type WorkflowExecutionRequest

type WorkflowExecutionRequest struct {
	WorkflowID  uuid.UUID              `json:"workflow_id"`
	Input       map[string]interface{} `json:"input"`
	Context     map[string]interface{} `json:"context"`
	TriggeredBy string                 `json:"triggered_by"`
	Priority    string                 `json:"priority"`
}

WorkflowExecutionRequest represents a request to execute a workflow

type WorkflowInsights

type WorkflowInsights struct {
	WorkflowID              uuid.UUID                `json:"workflow_id"`
	Period                  time.Duration            `json:"period"`
	BottleneckSteps         []string                 `json:"bottleneck_steps"`
	FailurePredictors       map[string]float64       `json:"failure_predictors"`
	OptimizationSuggestions []OptimizationSuggestion `json:"optimization_suggestions"`
	TrendAnalysis           map[string]TrendData     `json:"trend_analysis"`
}

WorkflowInsights represents insights about workflow performance

type WorkflowMetrics

type WorkflowMetrics struct {
	WorkflowID      uuid.UUID              `json:"workflow_id"`
	TotalExecutions int64                  `json:"total_executions"`
	SuccessfulRuns  int64                  `json:"successful_runs"`
	FailedRuns      int64                  `json:"failed_runs"`
	AverageRunTime  time.Duration          `json:"average_run_time"`
	MedianRunTime   time.Duration          `json:"median_run_time"`
	P95RunTime      time.Duration          `json:"p95_run_time"`
	StepMetrics     map[string]StepMetrics `json:"step_metrics"`
}

WorkflowMetrics represents metrics for a workflow

type WorkflowRetryPolicy

type WorkflowRetryPolicy struct {
	MaxAttempts int           `json:"max_attempts"`
	BackoffType string        `json:"backoff_type"` // linear, exponential
	InitialWait time.Duration `json:"initial_wait"`
	MaxWait     time.Duration `json:"max_wait"`
}

WorkflowRetryPolicy defines retry behavior for workflow steps

type WorkflowStatus

type WorkflowStatus string

WorkflowStatus represents the state of a workflow execution

const (
	WorkflowStatusPending   WorkflowStatus = "pending"
	WorkflowStatusRunning   WorkflowStatus = "running"
	WorkflowStatusPaused    WorkflowStatus = "paused"
	WorkflowStatusCompleted WorkflowStatus = "completed"
	WorkflowStatusFailed    WorkflowStatus = "failed"
	WorkflowStatusCancelled WorkflowStatus = "cancelled"
	WorkflowStatusTimeout   WorkflowStatus = "timeout"
)
const (
	WorkflowStatusActive   WorkflowStatus = "active"
	WorkflowStatusInactive WorkflowStatus = "inactive"
	WorkflowStatusDraft    WorkflowStatus = "draft"
	WorkflowStatusArchived WorkflowStatus = "archived"
)

WorkflowStatus constants for workflow definitions

func (WorkflowStatus) CanTransitionTo

func (s WorkflowStatus) CanTransitionTo(target WorkflowStatus) bool

CanTransitionTo checks if workflow status transition is valid

func (WorkflowStatus) IsTerminal

func (s WorkflowStatus) IsTerminal() bool

IsTerminal returns true if the status is a terminal state

type WorkflowStep

type WorkflowStep struct {
	ID              string                 `json:"id"`
	Name            string                 `json:"name"`
	Description     string                 `json:"description,omitempty"`
	Type            string                 `json:"type"`
	Action          string                 `json:"action"`
	AgentID         string                 `json:"agent_id"`
	Input           map[string]interface{} `json:"input"`
	Config          map[string]interface{} `json:"config"`
	Timeout         time.Duration          `json:"timeout"`
	TimeoutSeconds  int                    `json:"timeout_seconds,omitempty"`
	Retries         int                    `json:"retries"`
	RetryPolicy     WorkflowRetryPolicy    `json:"retry_policy,omitempty"`
	ContinueOnError bool                   `json:"continue_on_error"`
	Dependencies    []string               `json:"dependencies"`
	OnFailure       string                 `json:"on_failure,omitempty"` // fail_workflow, continue, compensate
}

WorkflowStep represents a step in a workflow

type WorkflowSteps

type WorkflowSteps []WorkflowStep

WorkflowSteps represents an array of workflow steps with proper database serialization

func (WorkflowSteps) GetByID

func (s WorkflowSteps) GetByID(id string) (*WorkflowStep, bool)

GetByID returns a step by its ID

func (WorkflowSteps) GetInExecutionOrder

func (s WorkflowSteps) GetInExecutionOrder() []WorkflowStep

GetInExecutionOrder returns steps in execution order based on dependencies

func (WorkflowSteps) MarshalJSON

func (s WorkflowSteps) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*WorkflowSteps) Scan

func (s *WorkflowSteps) Scan(value interface{}) error

Scan implements sql.Scanner for database deserialization

func (*WorkflowSteps) UnmarshalJSON

func (s *WorkflowSteps) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (WorkflowSteps) Validate

func (s WorkflowSteps) Validate() error

Validate ensures all steps are valid

func (WorkflowSteps) Value

func (s WorkflowSteps) Value() (driver.Value, error)

Value implements driver.Valuer for database serialization

type WorkflowTemplate

type WorkflowTemplate struct {
	ID          uuid.UUID              `json:"id" db:"id"`
	Name        string                 `json:"name" db:"name"`
	Description string                 `json:"description" db:"description"`
	Category    string                 `json:"category" db:"category"`
	Definition  map[string]interface{} `json:"definition" db:"definition"`
	Parameters  []TemplateParameter    `json:"parameters" db:"parameters"`
	CreatedBy   string                 `json:"created_by" db:"created_by"`
	CreatedAt   time.Time              `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at" db:"updated_at"`
}

WorkflowTemplate represents a reusable workflow template

func (*WorkflowTemplate) GetID

func (t *WorkflowTemplate) GetID() uuid.UUID

Add methods to make WorkflowTemplate implement AggregateRoot

func (*WorkflowTemplate) GetType

func (t *WorkflowTemplate) GetType() string

func (*WorkflowTemplate) GetVersion

func (t *WorkflowTemplate) GetVersion() int

type WorkflowType

type WorkflowType string

WorkflowType represents the execution strategy of a workflow

const (
	WorkflowTypeSequential    WorkflowType = "sequential"
	WorkflowTypeParallel      WorkflowType = "parallel"
	WorkflowTypeConditional   WorkflowType = "conditional"
	WorkflowTypeCollaborative WorkflowType = "collaborative"
)
const (
	WorkflowTypeStandard     WorkflowType = "standard"
	WorkflowTypeDAG          WorkflowType = "dag"
	WorkflowTypeSaga         WorkflowType = "saga"
	WorkflowTypeStateMachine WorkflowType = "state_machine"
	WorkflowTypeEvent        WorkflowType = "event_driven"
)

Add WorkflowTypeStandard to existing types

type WorkflowVersion

type WorkflowVersion struct {
	ID         uuid.UUID              `json:"id" db:"id"`
	WorkflowID uuid.UUID              `json:"workflow_id" db:"workflow_id"`
	Version    int                    `json:"version" db:"version"`
	Changes    string                 `json:"changes" db:"changes"`
	Definition map[string]interface{} `json:"definition" db:"definition"`
	CreatedBy  string                 `json:"created_by" db:"created_by"`
	CreatedAt  time.Time              `json:"created_at" db:"created_at"`
}

WorkflowVersion represents a version of a workflow

type WorkloadInfo

type WorkloadInfo struct {
	AgentID       string    `json:"agent_id"`
	ActiveTasks   int       `json:"active_tasks"`
	QueuedTasks   int       `json:"queued_tasks"`
	CPUUsage      float64   `json:"cpu_usage"`
	MemoryUsage   float64   `json:"memory_usage"`
	WorkloadScore float64   `json:"workload_score"` // Calculated score 0-100
	LastUpdated   time.Time `json:"last_updated"`
}

WorkloadInfo contains agent workload information

func (*WorkloadInfo) Calculate

func (w *WorkloadInfo) Calculate()

Calculate computes the overall workload score

type Workspace

type Workspace struct {
	ID             uuid.UUID           `json:"id" db:"id"`
	TenantID       uuid.UUID           `json:"tenant_id" db:"tenant_id"`
	Name           string              `json:"name" db:"name"`
	Type           string              `json:"type" db:"type"`
	OwnerID        string              `json:"owner_id" db:"owner_id"`
	Description    string              `json:"description,omitempty" db:"description"`
	Configuration  JSONMap             `json:"configuration" db:"configuration"`
	Visibility     WorkspaceVisibility `json:"visibility" db:"visibility"`
	State          JSONMap             `json:"state" db:"state"`
	StateVersion   int64               `json:"state_version" db:"state_version"`
	LastActivityAt time.Time           `json:"last_activity_at" db:"last_activity_at"`
	LockedBy       *string             `json:"locked_by,omitempty" db:"locked_by"`
	LockedAt       *time.Time          `json:"locked_at,omitempty" db:"locked_at"`
	LockExpiresAt  *time.Time          `json:"lock_expires_at,omitempty" db:"lock_expires_at"`
	CreatedAt      time.Time           `json:"created_at" db:"created_at"`
	UpdatedAt      time.Time           `json:"updated_at" db:"updated_at"`
	DeletedAt      *time.Time          `json:"deleted_at,omitempty" db:"deleted_at"`

	// New production fields for Phase 3
	IsPublic bool              `json:"is_public" db:"is_public"`
	Settings WorkspaceSettings `json:"settings" db:"settings"`
	Tags     pq.StringArray    `json:"tags" db:"tags"`
	Metadata JSONMap           `json:"metadata" db:"metadata"`

	// Additional fields for production
	Owner    string          `json:"owner" db:"owner"`
	Status   WorkspaceStatus `json:"status" db:"status"`
	Features pq.StringArray  `json:"features" db:"features"`
	Limits   WorkspaceLimits `json:"limits" db:"limits"`
	Stats    *WorkspaceStats `json:"stats,omitempty" db:"-"` // Computed field

	// Runtime data
	Members   []*WorkspaceMember `json:"members,omitempty" db:"-"`
	Documents []*SharedDocument  `json:"documents,omitempty" db:"-"`
}

Workspace represents a collaborative space for agents

func (*Workspace) HasFeature

func (w *Workspace) HasFeature(feature string) bool

HasFeature checks if the workspace has a specific feature enabled

func (*Workspace) HasTag

func (w *Workspace) HasTag(tag string) bool

HasTag checks if the workspace has a specific tag

func (*Workspace) IsActive

func (w *Workspace) IsActive() bool

IsActive returns true if the workspace is active

func (*Workspace) IsLocked

func (w *Workspace) IsLocked() bool

IsLocked returns true if the workspace is currently locked

func (*Workspace) SetDefaultValues

func (w *Workspace) SetDefaultValues()

SetDefaultValues sets default values for a new workspace

func (*Workspace) Validate

func (w *Workspace) Validate() error

Validate validates the workspace fields

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"`
	Description  string                 `json:"description" db:"description"`
	Details      map[string]interface{} `json:"details,omitempty" db:"details"`
	Timestamp    time.Time              `json:"timestamp" db:"timestamp"`
}

WorkspaceActivity represents an activity event in a workspace

type WorkspaceCollaborator

type WorkspaceCollaborator 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"`
	Role        string    `json:"role" db:"role"` // "owner", "editor", "viewer"
	Permissions []string  `json:"permissions" db:"permissions"`
	AddedAt     time.Time `json:"added_at" db:"added_at"`
	AddedBy     string    `json:"added_by" db:"added_by"`
}

WorkspaceCollaborator represents a collaborator in a workspace

type WorkspaceLimits

type WorkspaceLimits struct {
	MaxMembers       int   `json:"max_members"`
	MaxDocuments     int   `json:"max_documents"`
	MaxStorageBytes  int64 `json:"max_storage_bytes"`
	MaxOperationsDay int   `json:"max_operations_day"`
	MaxAgents        int   `json:"max_agents"`
	MaxConcurrent    int   `json:"max_concurrent"`
}

WorkspaceLimits defines resource limits for a workspace

func GetDefaultWorkspaceLimits

func GetDefaultWorkspaceLimits() WorkspaceLimits

GetDefaultWorkspaceLimits returns default workspace limits

func (WorkspaceLimits) IsWithinLimits

func (wl WorkspaceLimits) IsWithinLimits(members, documents int, storageBytes int64) bool

IsWithinLimits checks if the given values are within the workspace limits

func (*WorkspaceLimits) Scan

func (wl *WorkspaceLimits) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database retrieval

func (WorkspaceLimits) Value

func (wl WorkspaceLimits) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database storage

type WorkspaceMember

type WorkspaceMember struct {
	WorkspaceID uuid.UUID  `json:"workspace_id" db:"workspace_id"`
	AgentID     string     `json:"agent_id" db:"agent_id"`
	TenantID    uuid.UUID  `json:"tenant_id" db:"tenant_id"`
	Role        MemberRole `json:"role" db:"role"`
	Permissions JSONMap    `json:"permissions" db:"permissions"`
	JoinedAt    time.Time  `json:"joined_at" db:"joined_at"`
	LastSeenAt  *time.Time `json:"last_seen_at,omitempty" db:"last_seen_at"`

	// Runtime data
	Agent interface{} `json:"agent,omitempty" db:"-"` // Agent details if loaded
}

WorkspaceMember represents an agent's membership in a workspace

func (*WorkspaceMember) CanEdit

func (m *WorkspaceMember) CanEdit() bool

CanEdit returns true if the member has edit permissions

func (*WorkspaceMember) CanManage

func (m *WorkspaceMember) CanManage() bool

CanManage returns true if the member has management permissions

type WorkspaceMemberRole

type WorkspaceMemberRole string

WorkspaceMemberRole defines access levels

const (
	WorkspaceMemberRoleOwner     WorkspaceMemberRole = "owner"
	WorkspaceMemberRoleAdmin     WorkspaceMemberRole = "admin"
	WorkspaceMemberRoleEditor    WorkspaceMemberRole = "editor"
	WorkspaceMemberRoleCommenter WorkspaceMemberRole = "commenter"
	WorkspaceMemberRoleViewer    WorkspaceMemberRole = "viewer"
	WorkspaceMemberRoleGuest     WorkspaceMemberRole = "guest"
)

func (WorkspaceMemberRole) CanTransitionTo

func (r WorkspaceMemberRole) CanTransitionTo(target WorkspaceMemberRole) bool

CanTransitionTo checks if a role can be changed to another role

func (WorkspaceMemberRole) HasPermission

func (r WorkspaceMemberRole) HasPermission(permission string) bool

HasPermission checks if a role has a specific permission

func (WorkspaceMemberRole) IsHigherThan

func (r WorkspaceMemberRole) IsHigherThan(other WorkspaceMemberRole) bool

IsHigherThan checks if this role has more privileges than another

func (WorkspaceMemberRole) Validate

func (w WorkspaceMemberRole) Validate() error

Validate ensures the workspace member role is valid

type WorkspaceSettings

type WorkspaceSettings struct {
	Notifications   NotificationSettings   `json:"notifications"`
	Collaboration   CollaborationSettings  `json:"collaboration"`
	Security        SecuritySettings       `json:"security"`
	AutomationRules []AutomationRule       `json:"automation_rules,omitempty"`
	Preferences     map[string]interface{} `json:"preferences,omitempty"`
}

WorkspaceSettings represents the settings for a workspace

func GetDefaultWorkspaceSettings

func GetDefaultWorkspaceSettings() WorkspaceSettings

GetDefaultWorkspaceSettings returns default workspace settings

func (*WorkspaceSettings) Scan

func (ws *WorkspaceSettings) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database retrieval

func (WorkspaceSettings) Value

func (ws WorkspaceSettings) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database storage

type WorkspaceState

type WorkspaceState struct {
	WorkspaceID    uuid.UUID              `json:"workspace_id"`
	Version        int64                  `json:"version"`
	Data           map[string]interface{} `json:"data"`
	VectorClock    map[string]int         `json:"vector_clock"`
	LastModifiedBy string                 `json:"last_modified_by"`
	LastModifiedAt time.Time              `json:"last_modified_at"`
}

WorkspaceState represents the distributed state of a workspace

type WorkspaceStats

type WorkspaceStats struct {
	WorkspaceID      uuid.UUID `json:"workspace_id"`
	TotalMembers     int64     `json:"total_members"`
	ActiveMembers    int64     `json:"active_members"`
	TotalDocuments   int64     `json:"total_documents"`
	TotalOperations  int64     `json:"total_operations"`
	StorageUsedBytes int64     `json:"storage_used_bytes"`
	LastActivityAt   time.Time `json:"last_activity_at"`
}

WorkspaceStats represents statistics for a workspace

type WorkspaceStatus

type WorkspaceStatus string

WorkspaceStatus represents the status of a workspace

const (
	WorkspaceStatusActive   WorkspaceStatus = "active"
	WorkspaceStatusInactive WorkspaceStatus = "inactive"
	WorkspaceStatusArchived WorkspaceStatus = "archived"
	WorkspaceStatusDeleted  WorkspaceStatus = "deleted"
)

func (WorkspaceStatus) IsValid

func (s WorkspaceStatus) IsValid() bool

IsValid checks if the workspace status is valid

type WorkspaceVisibility

type WorkspaceVisibility string

WorkspaceVisibility defines who can access a workspace

const (
	WorkspaceVisibilityPrivate WorkspaceVisibility = "private"
	WorkspaceVisibilityTeam    WorkspaceVisibility = "team"
	WorkspaceVisibilityPublic  WorkspaceVisibility = "public"
)

type XrayIssue

type XrayIssue struct {
	ID        string             `json:"id"`
	Type      string             `json:"type"`
	Severity  string             `json:"severity"`
	Summary   string             `json:"summary"`
	Component XrayIssueComponent `json:"component"`
}

XrayIssue represents an issue in a JFrog Xray webhook event

type XrayIssueComponent

type XrayIssueComponent struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Path    string `json:"path"`
}

XrayIssueComponent represents a component in a JFrog Xray issue

type XrayLicense

type XrayLicense struct {
	Name        string   `json:"name"`
	FullName    string   `json:"full_name"`
	MoreInfoURL string   `json:"more_info_url"`
	Components  []string `json:"components"`
}

XrayLicense represents a license in Xray

type XrayLicenseComponent

type XrayLicenseComponent struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Path    string `json:"path"`
}

XrayLicenseComponent represents a component with a license in Xray

type XrayLicenseDetail

type XrayLicenseDetail struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	FullName    string                 `json:"full_name"`
	URL         string                 `json:"url"`
	Type        string                 `json:"type"`
	Description string                 `json:"description"`
	Components  []XrayLicenseComponent `json:"components"`
}

XrayLicenseDetail represents a detailed license in Xray

type XrayLicenses

type XrayLicenses struct {
	Licenses   []XrayLicenseDetail `json:"licenses"`
	TotalCount int                 `json:"total_count"`
}

XrayLicenses represents licenses in Xray

type XrayQuery

type XrayQuery struct {
	Type         string `json:"type"`
	ArtifactPath string `json:"artifactPath"`
	CVE          string `json:"cve"`
	LicenseID    string `json:"licenseId"`
	BuildName    string `json:"buildName"`
	BuildNumber  string `json:"buildNumber"`
}

XrayQuery defines parameters for querying JFrog Xray

type XrayScan

type XrayScan struct {
	ID                 string    `json:"id"`
	ResourceType       string    `json:"resource_type"`
	ResourceName       string    `json:"resource_name"`
	Status             string    `json:"status"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	VulnerabilityCount int       `json:"vulnerability_count"`
	LicenseCount       int       `json:"license_count"`
}

XrayScan represents a scan in Xray

type XrayScans

type XrayScans struct {
	Scans []XrayScan `json:"scans"`
}

XrayScans represents scans in Xray

type XraySummary

type XraySummary struct {
	Vulnerabilities    []XrayVulnerability `json:"vulnerabilities"`
	Licenses           []XrayLicense       `json:"licenses"`
	SecurityViolations []XrayViolation     `json:"security_violations"`
	LicenseViolations  []XrayViolation     `json:"license_violations"`
}

XraySummary represents a summary of threats in Xray

type XrayViolation

type XrayViolation struct {
	Type       string   `json:"type"`
	PolicyName string   `json:"policy_name"`
	WatchName  string   `json:"watch_name"`
	Components []string `json:"components"`
}

XrayViolation represents a violation in Xray

type XrayVulnerabilities

type XrayVulnerabilities struct {
	Vulnerabilities []XrayVulnerabilityDetail `json:"vulnerabilities"`
	TotalCount      int                       `json:"total_count"`
}

XrayVulnerabilities represents vulnerabilities in Xray

type XrayVulnerability

type XrayVulnerability struct {
	CVE           string   `json:"cve"`
	Summary       string   `json:"summary"`
	Severity      string   `json:"severity"`
	ImpactPath    []string `json:"impact_path"`
	FixedVersions []string `json:"fixed_versions"`
	Components    []string `json:"components"`
}

XrayVulnerability represents a vulnerability in Xray

type XrayVulnerabilityDetail

type XrayVulnerabilityDetail struct {
	ID            string   `json:"id"`
	Summary       string   `json:"summary"`
	Description   string   `json:"description"`
	CvssV2Score   float64  `json:"cvss_v2_score"`
	CvssV3Score   float64  `json:"cvss_v3_score"`
	Severity      string   `json:"severity"`
	PublishedDate string   `json:"published_date"`
	LastUpdated   string   `json:"last_updated"`
	References    []string `json:"references"`
	Remediation   string   `json:"remediation"`
}

XrayVulnerabilityDetail represents a detailed vulnerability in Xray

type XrayWebhookData

type XrayWebhookData struct {
	Issues     []XrayIssue `json:"issues"`
	ProjectKey string      `json:"project_key"`
	WatchName  string      `json:"watch_name"`
	PolicyName string      `json:"policy_name"`
}

XrayWebhookData represents the data in a JFrog Xray webhook event

type XrayWebhookEvent

type XrayWebhookEvent struct {
	EventType string          `json:"event_type"`
	Timestamp string          `json:"timestamp"`
	Data      XrayWebhookData `json:"data"`
}

XrayWebhookEvent represents a JFrog Xray webhook event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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