Documentation
¶
Index ¶
- type CreateProfileRequest
- type FileStorage
- func (fs *FileStorage) Close() error
- func (fs *FileStorage) Delete(profileID string) error
- func (fs *FileStorage) Load(profileID string) (*Profile, error)
- func (fs *FileStorage) LoadAll() ([]*Profile, error)
- func (fs *FileStorage) LoadByUserID(userID string) ([]*Profile, error)
- func (fs *FileStorage) Save(profile *Profile) error
- func (fs *FileStorage) Update(profile *Profile) error
- type MemoryStorage
- func (ms *MemoryStorage) Close() error
- func (ms *MemoryStorage) Delete(profileID string) error
- func (ms *MemoryStorage) Load(profileID string) (*Profile, error)
- func (ms *MemoryStorage) LoadAll() ([]*Profile, error)
- func (ms *MemoryStorage) LoadByUserID(userID string) ([]*Profile, error)
- func (ms *MemoryStorage) Save(profile *Profile) error
- func (ms *MemoryStorage) Update(profile *Profile) error
- type MessageTemplate
- type Profile
- type ProfileListResponse
- type ProfileResponse
- type RepositoryEntry
- type Service
- func (s *Service) AddMessageTemplate(profileID string, template MessageTemplate) error
- func (s *Service) AddRepositoryEntry(profileID string, entry RepositoryEntry) error
- func (s *Service) CreateProfile(userID string, req *CreateProfileRequest) (*Profile, error)
- func (s *Service) DeleteProfile(profileID string) error
- func (s *Service) GetProfile(profileID string) (*Profile, error)
- func (s *Service) GetUserProfiles(userID string) ([]*Profile, error)
- func (s *Service) MergeEnvironmentVariables(profileID string, providedEnv map[string]string) (map[string]string, error)
- func (s *Service) UpdateLastUsed(profileID string) error
- func (s *Service) UpdateProfile(profileID string, req *UpdateProfileRequest) (*Profile, error)
- type StartSessionWithProfileRequest
- type Storage
- type UpdateProfileRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateProfileRequest ¶
type CreateProfileRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Environment map[string]string `json:"environment"`
RepositoryHistory []RepositoryEntry `json:"repository_history,omitempty"`
SystemPrompt string `json:"system_prompt"`
MessageTemplates []MessageTemplate `json:"message_templates,omitempty"`
}
CreateProfileRequest represents the request body for creating a new profile
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
FileStorage implements profile storage using JSON files
func NewFileStorage ¶
func NewFileStorage(filePath string) (*FileStorage, error)
NewFileStorage creates a new file-based profile storage
func (*FileStorage) Delete ¶
func (fs *FileStorage) Delete(profileID string) error
Delete removes a profile from storage
func (*FileStorage) Load ¶
func (fs *FileStorage) Load(profileID string) (*Profile, error)
Load retrieves a profile by ID
func (*FileStorage) LoadAll ¶
func (fs *FileStorage) LoadAll() ([]*Profile, error)
LoadAll retrieves all profiles
func (*FileStorage) LoadByUserID ¶
func (fs *FileStorage) LoadByUserID(userID string) ([]*Profile, error)
LoadByUserID retrieves all profiles for a specific user
func (*FileStorage) Save ¶
func (fs *FileStorage) Save(profile *Profile) error
Save persists a profile to storage
func (*FileStorage) Update ¶
func (fs *FileStorage) Update(profile *Profile) error
Update updates an existing profile
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage implements in-memory profile storage for testing
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
NewMemoryStorage creates a new in-memory profile storage
func (*MemoryStorage) Delete ¶
func (ms *MemoryStorage) Delete(profileID string) error
Delete removes a profile from memory
func (*MemoryStorage) Load ¶
func (ms *MemoryStorage) Load(profileID string) (*Profile, error)
Load retrieves a profile by ID
func (*MemoryStorage) LoadAll ¶
func (ms *MemoryStorage) LoadAll() ([]*Profile, error)
LoadAll retrieves all profiles
func (*MemoryStorage) LoadByUserID ¶
func (ms *MemoryStorage) LoadByUserID(userID string) ([]*Profile, error)
LoadByUserID retrieves all profiles for a specific user
func (*MemoryStorage) Save ¶
func (ms *MemoryStorage) Save(profile *Profile) error
Save persists a profile to memory
func (*MemoryStorage) Update ¶
func (ms *MemoryStorage) Update(profile *Profile) error
Update updates an existing profile
type MessageTemplate ¶
type MessageTemplate struct {
ID string `json:"id"`
Name string `json:"name"`
Content string `json:"content"`
Variables []string `json:"variables,omitempty"`
Category string `json:"category,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
MessageTemplate represents a predefined message template
type Profile ¶
type Profile struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Environment map[string]string `json:"environment"`
RepositoryHistory []RepositoryEntry `json:"repository_history"`
SystemPrompt string `json:"system_prompt"`
MessageTemplates []MessageTemplate `json:"message_templates"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
}
Profile represents a user profile with environment variables, repository history, system prompt, and message templates
type ProfileListResponse ¶
ProfileListResponse represents the response for listing profiles
type ProfileResponse ¶
type ProfileResponse struct {
Profile *Profile `json:"profile"`
}
ProfileResponse represents the response for profile operations
type RepositoryEntry ¶
type RepositoryEntry struct {
ID string `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Branch string `json:"branch,omitempty"`
LastCommit string `json:"last_commit,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
AccessedAt time.Time `json:"accessed_at"`
}
RepositoryEntry represents a repository in the user's history
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles profile business logic
func NewService ¶
NewService creates a new profile service
func (*Service) AddMessageTemplate ¶
func (s *Service) AddMessageTemplate(profileID string, template MessageTemplate) error
AddMessageTemplate adds a message template to a profile
func (*Service) AddRepositoryEntry ¶
func (s *Service) AddRepositoryEntry(profileID string, entry RepositoryEntry) error
AddRepositoryEntry adds a repository entry to a profile's history
func (*Service) CreateProfile ¶
func (s *Service) CreateProfile(userID string, req *CreateProfileRequest) (*Profile, error)
CreateProfile creates a new profile
func (*Service) DeleteProfile ¶
DeleteProfile deletes a profile
func (*Service) GetProfile ¶
GetProfile retrieves a profile by ID
func (*Service) GetUserProfiles ¶
GetUserProfiles retrieves all profiles for a specific user
func (*Service) MergeEnvironmentVariables ¶
func (s *Service) MergeEnvironmentVariables(profileID string, providedEnv map[string]string) (map[string]string, error)
MergeEnvironmentVariables merges profile environment variables with provided ones Provided variables take precedence over profile variables
func (*Service) UpdateLastUsed ¶
UpdateLastUsed updates the last used timestamp for a profile
func (*Service) UpdateProfile ¶
func (s *Service) UpdateProfile(profileID string, req *UpdateProfileRequest) (*Profile, error)
UpdateProfile updates an existing profile
type StartSessionWithProfileRequest ¶
type StartSessionWithProfileRequest struct {
ProfileID string `json:"profile_id,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Message string `json:"message,omitempty"`
}
StartSessionWithProfileRequest extends StartRequest with profile support
type Storage ¶
type Storage interface {
// Save persists a profile to storage
Save(profile *Profile) error
// Load retrieves a profile by ID
Load(profileID string) (*Profile, error)
// LoadByUserID retrieves all profiles for a specific user
LoadByUserID(userID string) ([]*Profile, error)
// LoadAll retrieves all profiles
LoadAll() ([]*Profile, error)
// Delete removes a profile from storage
Delete(profileID string) error
// Update updates an existing profile
Update(profile *Profile) error
// Close cleans up any resources
Close() error
}
Storage defines the interface for profile persistence
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
RepositoryHistory []RepositoryEntry `json:"repository_history,omitempty"`
SystemPrompt *string `json:"system_prompt,omitempty"`
MessageTemplates []MessageTemplate `json:"message_templates,omitempty"`
}
UpdateProfileRequest represents the request body for updating a profile