hephaestus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidConfig indicates an invalid configuration
	ErrInvalidConfig = errors.New("invalid configuration")

	// ErrNodeNotFound indicates a node was not found
	ErrNodeNotFound = errors.New("node not found")

	// ErrNodeAlreadyExists indicates a node already exists
	ErrNodeAlreadyExists = errors.New("node already exists")

	// ErrInvalidNodeStatus indicates an invalid node status
	ErrInvalidNodeStatus = errors.New("invalid node status")

	// ErrRepositoryNotInitialized indicates the repository is not initialized
	ErrRepositoryNotInitialized = errors.New("repository not initialized")

	// ErrFileNotFound indicates a file was not found
	ErrFileNotFound = errors.New("file not found")

	// ErrFileTooLarge indicates a file exceeds the size limit
	ErrFileTooLarge = errors.New("file too large")

	// ErrInvalidLogEntry indicates an invalid log entry
	ErrInvalidLogEntry = errors.New("invalid log entry")

	// ErrAIProviderError indicates an error from the AI provider
	ErrAIProviderError = errors.New("AI provider error")

	// ErrGitHubError indicates an error from GitHub
	ErrGitHubError = errors.New("GitHub error")

	// ErrInvalidSolution indicates an invalid solution
	ErrInvalidSolution = errors.New("invalid solution")

	// ErrOperationTimeout indicates an operation timed out
	ErrOperationTimeout = errors.New("operation timed out")
)

Functions

func IsExternalError

func IsExternalError(err error) bool

IsExternalError checks if an error is from an external service

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if an error is a not found error

func IsTimeout

func IsTimeout(err error) bool

IsTimeout checks if an error is a timeout error

func IsValidationError

func IsValidationError(err error) bool

IsValidationError checks if an error is a validation error

func ValidateSystemConfiguration

func ValidateSystemConfiguration(config *SystemConfiguration) error

ValidateSystemConfiguration performs comprehensive validation of the system configuration

Types

type AIError

type AIError struct {
	Provider string
	Message  string
	Err      error
}

AIError represents an AI provider error

func (*AIError) Error

func (e *AIError) Error() string

func (*AIError) Unwrap

func (e *AIError) Unwrap() error

type CodeModification

type CodeModification struct {
	TargetFile   string `json:"file_path"`
	OriginalCode string `json:"original_code"`
	ModifiedCode string `json:"updated_code"`
	StartLine    int    `json:"line_start"`
	EndLine      int    `json:"line_end"`
}

CodeModification represents a specific code change in a solution

type ConfigValidationError

type ConfigValidationError struct {
	Field   string
	Message string
}

ConfigValidationError represents a configuration validation error

func (*ConfigValidationError) Error

func (e *ConfigValidationError) Error() string

type ConfigurationValidationError

type ConfigurationValidationError struct {
	FieldName    string
	ErrorMessage string
}

ConfigurationValidationError represents a configuration validation error

func (ConfigurationValidationError) Error

type FileMetadataInfo

type FileMetadataInfo struct {
	TotalLines   int                `json:"line_count"`
	Dependencies []string           `json:"imports"` // list of imports/dependencies
	VersionInfo  VersionControlInfo `json:"version_info"`
}

FileMetadataInfo contains extended file information

type GitHubError

type GitHubError struct {
	Operation string
	Message   string
	Err       error
}

GitHubError represents a GitHub API error

func (*GitHubError) Error

func (e *GitHubError) Error() string

func (*GitHubError) Unwrap

func (e *GitHubError) Unwrap() error

type InitializationResponse

type InitializationResponse struct {
	OperationalStatus string `json:"status"`
	StatusMessage     string `json:"message"`
	NodeIdentifier    string `json:"node_id"`
}

InitializationResponse represents the response from node initialization

type LogEntryData

type LogEntryData struct {
	NodeIdentifier string            `json:"node_id"`
	LogLevel       string            `json:"level"`
	LogMessage     string            `json:"message"`
	LogTimestamp   time.Time         `json:"timestamp"`
	LogMetadata    map[string]string `json:"metadata"`
	ErrorTrace     string            `json:"stack_trace"`
}

LogEntryData represents a structured log entry from the client

type LogProcessingError

type LogProcessingError struct {
	NodeID  string
	Message string
	Err     error
}

LogProcessingError represents a log processing error

func (*LogProcessingError) Error

func (e *LogProcessingError) Error() string

func (*LogProcessingError) Unwrap

func (e *LogProcessingError) Unwrap() error

type LogProcessingService

type LogProcessingService interface {
	// ProcessLogEntry processes a single log entry
	ProcessLogEntry(ctx context.Context, entry *LogEntryData) error

	// StreamLogEntries initiates streaming of logs for a specific node
	StreamLogEntries(ctx context.Context, nodeIdentifier string) (<-chan *LogEntryData, <-chan error)
}

LogProcessingService handles log entry processing and analysis

type LoggingConfiguration

type LoggingConfiguration struct {
	LogLevel     string `json:"level" yaml:"level"`
	OutputFormat string `json:"format" yaml:"format"`
}

LoggingConfiguration contains logging system settings

type MetricsCollectionService

type MetricsCollectionService interface {
	// RecordOperationMetrics records metrics for an operation
	RecordOperationMetrics(operationName string, duration time.Duration, successful bool)

	// RecordErrorMetrics records error-related metrics
	RecordErrorMetrics(componentName string, err error)

	// GetCurrentMetrics retrieves current system metrics
	GetCurrentMetrics() map[string]interface{}
}

MetricsCollectionService collects and manages system metrics

type ModelServiceConfiguration

type ModelServiceConfiguration struct {
	ServiceProvider string `json:"provider" yaml:"provider"`
	ServiceAPIKey   string `json:"api_key" yaml:"api_key"`
	ModelVersion    string `json:"model_version" yaml:"model_version"`
}

ModelServiceConfiguration contains model service provider settings

type ModelServiceProvider

type ModelServiceProvider interface {
	// GenerateSolutionProposal generates a solution for a given log entry
	GenerateSolutionProposal(ctx context.Context, entry *LogEntryData, repo RepositoryManager) (*ProposedSolution, error)

	// ValidateSolutionProposal validates a generated solution
	ValidateSolutionProposal(ctx context.Context, solution *ProposedSolution) error
}

ModelServiceProvider provides model-based analysis and solution generation

type NodeError

type NodeError struct {
	NodeID  string
	Message string
	Err     error
}

NodeError represents a node-related error

func (*NodeError) Error

func (e *NodeError) Error() string

func (*NodeError) Unwrap

func (e *NodeError) Unwrap() error

type NodeLifecycleManager

type NodeLifecycleManager interface {
	// CreateSystemNode initializes a new node with the provided configuration
	CreateSystemNode(ctx context.Context, config *SystemConfiguration) (*SystemNode, error)

	// GetSystemNode retrieves node information by identifier
	GetSystemNode(ctx context.Context, nodeIdentifier string) (*SystemNode, error)

	// DeleteSystemNode removes a node from the system
	DeleteSystemNode(ctx context.Context, nodeIdentifier string) error

	// UpdateNodeOperationalStatus updates the operational status of a node
	UpdateNodeOperationalStatus(ctx context.Context, nodeIdentifier string, status NodeOperationalStatus) error
}

NodeLifecycleManager manages the complete lifecycle of system nodes

type NodeOperationalStatus

type NodeOperationalStatus string

NodeOperationalStatus represents the current operational state of a node

const (
	NodeStatusInitializing NodeOperationalStatus = "initializing"
	NodeStatusOperational  NodeOperationalStatus = "operational"
	NodeStatusProcessing   NodeOperationalStatus = "processing"
	NodeStatusInactive     NodeOperationalStatus = "inactive"
	NodeStatusError        NodeOperationalStatus = "error"
)

type ProposedSolution

type ProposedSolution struct {
	SolutionID      string        `json:"id"`
	NodeIdentifier  string        `json:"node_id"`
	AssociatedLog   *LogEntryData `json:"log_entry"`
	ProposedChanges string        `json:"suggestion"`
	AffectedFiles   []string      `json:"files"`
	GenerationTime  time.Time     `json:"created_at"`
	ConfidenceScore float64       `json:"confidence"`
}

ProposedSolution represents a generated fix proposal for an issue

type RemoteRepositoryConfiguration

type RemoteRepositoryConfiguration struct {
	AuthToken       string `json:"token" yaml:"token"`
	RepositoryOwner string `json:"owner" yaml:"owner"`
	RepositoryName  string `json:"repository" yaml:"repository"`
	TargetBranch    string `json:"branch" yaml:"branch"`
}

RemoteRepositoryConfiguration contains remote repository integration settings

type RemoteRepositoryService

type RemoteRepositoryService interface {
	// CreateChangeRequest creates a change request for a proposed solution
	CreateChangeRequest(ctx context.Context, solution *ProposedSolution) (string, error)

	// SynchronizeRepository ensures local and remote repositories are in sync
	SynchronizeRepository(ctx context.Context) error
}

RemoteRepositoryService manages remote repository operations

type RepositoryConfiguration

type RepositoryConfiguration struct {
	RepositoryPath string `json:"path" yaml:"path"`
	FileLimit      int    `json:"max_files" yaml:"max_files"`
	FileSizeLimit  int64  `json:"max_file_size" yaml:"max_file_size"`
}

RepositoryConfiguration contains repository management settings

type RepositoryError

type RepositoryError struct {
	Path    string
	Message string
	Err     error
}

RepositoryError represents a repository-related error

func (*RepositoryError) Error

func (e *RepositoryError) Error() string

func (*RepositoryError) Unwrap

func (e *RepositoryError) Unwrap() error

type RepositoryFileNode

type RepositoryFileNode struct {
	FileIdentifier string           `json:"id"`
	FilePath       string           `json:"path"` // relative to repo root
	FileContents   string           `json:"content"`
	FileLanguage   string           `json:"language"` // programming language
	LastModified   time.Time        `json:"last_updated"`
	FileMetadata   FileMetadataInfo `json:"metadata"`
}

RepositoryFileNode represents a file in the virtual repository system

type RepositoryManager

type RepositoryManager interface {
	// InitializeRepository sets up the repository environment
	InitializeRepository(ctx context.Context, config *RepositoryConfiguration) error

	// GetFileContents retrieves contents of a specific file
	GetFileContents(ctx context.Context, filePath string) ([]byte, error)

	// UpdateFileContents updates the contents of a specific file
	UpdateFileContents(ctx context.Context, filePath string, contents []byte) error

	// ListRepositoryFiles lists all files in the repository
	ListRepositoryFiles(ctx context.Context) ([]string, error)
}

RepositoryManager manages the virtual repository system

type SystemConfiguration

type SystemConfiguration struct {
	RemoteSettings     RemoteRepositoryConfiguration `json:"remote" yaml:"remote"`
	ModelSettings      ModelServiceConfiguration     `json:"model" yaml:"model"`
	LoggingSettings    LoggingConfiguration          `json:"log" yaml:"log"`
	OperationalMode    string                        `json:"mode" yaml:"mode"`
	RepositorySettings RepositoryConfiguration       `json:"repository" yaml:"repository"`
}

SystemConfiguration represents the complete configuration for a Hephaestus node

type SystemNode

type SystemNode struct {
	NodeIdentifier string
	CurrentStatus  NodeOperationalStatus
	NodeConfig     *SystemConfiguration
	CreationTime   time.Time
	LastUpdateTime time.Time
}

SystemNode represents a Hephaestus system node instance

type ValidationError

type ValidationError struct {
	Object  string
	Field   string
	Message string
}

ValidationError represents a validation error

func (*ValidationError) Error

func (e *ValidationError) Error() string

type VersionControlInfo

type VersionControlInfo struct {
	LastCommitHash string    `json:"last_commit"`
	LastCommitter  string    `json:"last_author"`
	CommitTime     time.Time `json:"last_commit_date"`
}

VersionControlInfo contains version control specific file information

type VirtualRepositorySystem

type VirtualRepositorySystem struct {
	RepositoryID    string                         `json:"id"`
	RemoteReference string                         `json:"remote_repo"`
	TargetBranch    string                         `json:"branch"`
	FileCollection  map[string]*RepositoryFileNode `json:"files"`
	LastSyncTime    time.Time                      `json:"last_synced"`
	SystemConfig    *SystemConfiguration           `json:"configuration"`
}

VirtualRepositorySystem represents the complete virtual repository

Jump to

Keyboard shortcuts

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