Documentation
¶
Index ¶
- func HashToken(token string) string
- type AIRecipe
- type ApiKey
- type ChatMessage
- type ClaudeDoc
- type ClaudeDocStar
- type ClaudeDocTag
- type ClaudeSession
- type Container
- type ContainerSession
- type Content
- type ContentTag
- type Direction
- type DockerHost
- type Equipment
- type Feature
- type Food
- type FoodName
- type Group
- type GroupMembership
- type Identity
- type Ingredient
- type JSONField
- type Model
- type Page
- type PinnedFile
- type Prompt
- type PromptContext
- type PromptRun
- type Recipe
- type SessionKVStore
- type SlackFileUpload
- type SlackIdeationSession
- type SlackSession
- type SlackUserActivity
- type Tag
- type ThreadContext
- type User
- type UserSecret
- type WorkletKVEntry
- type WorkletKVStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AIRecipe ¶
type AIRecipe struct {
Name string `json:"name" description:"The name of the recipe."`
Ingredients []*Ingredient `json:"ingredients" description:"The ingredients used in the recipe."`
Directions []*Direction `json:"directions" description:"The steps to make the recipe."`
Equipment []*Equipment `json:"equipment" description:"The equipment used while making the recipe."`
}
type ApiKey ¶
type ApiKey struct {
Model
Name string `json:"name" gorm:"not null"` // Human-readable name for the key
Token string `json:"token,omitempty" gorm:"unique;not null"` // The actual API key token
TokenHash string `json:"-" gorm:"not null"` // Hashed version stored in DB
UserID string `json:"user_id" gorm:"index;not null"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
IsActive bool `json:"is_active" gorm:"default:true"`
Scopes string `json:"scopes" gorm:"default:'read,write'"` // Comma-separated permissions
User *User `gorm:"foreignKey:UserID"`
}
func (*ApiKey) UpdateLastUsed ¶
func (ak *ApiKey) UpdateLastUsed()
UpdateLastUsed updates the last used timestamp
func (*ApiKey) ValidateToken ¶
ValidateToken checks if the provided token matches this API key
type ChatMessage ¶
type ChatMessage struct {
Role string `json:"role"` // "user" or "assistant"
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"` // "initial", "expansion", "reaction", etc.
}
ChatMessage represents a message in the ideation chat history
type ClaudeDoc ¶
type ClaudeDoc struct {
Model
Title string `json:"title" gorm:"not null"`
Description string `json:"description"`
Content string `json:"content" gorm:"type:text"`
UserID string `json:"user_id" gorm:"index;not null"`
IsPublic bool `json:"is_public" gorm:"default:true"`
Downloads int `json:"downloads" gorm:"default:0"`
Stars int `json:"stars" gorm:"default:0"`
Views int `json:"views" gorm:"default:0"`
User *User `gorm:"foreignKey:UserID"`
Tags []*Tag `gorm:"many2many:claude_doc_tags;"`
}
type ClaudeDocStar ¶
type ClaudeDocTag ¶
type ClaudeSession ¶
type ClaudeSession struct {
Model
SessionID string `json:"session_id" gorm:"unique;not null;index"`
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
Title string `json:"title"`
Messages JSONField[interface{}] `json:"messages" gorm:"type:json"`
Metadata *JSONField[map[string]interface{}] `json:"metadata,omitempty"`
}
type Container ¶
type Container struct {
Model
ContainerID string `json:"container_id" gorm:"unique;not null"`
Name string `json:"name" gorm:"not null"`
Image string `json:"image" gorm:"not null"`
Status string `json:"status"`
Command string `json:"command"`
Ports *JSONField[map[string]string] `json:"ports"`
Environment *JSONField[map[string]string] `json:"environment"`
UserID string `json:"user_id" gorm:"index"`
DockerHostID string `json:"docker_host_id" gorm:"index"`
SessionID string `json:"session_id,omitempty" gorm:"index"`
User *User `gorm:"foreignKey:UserID"`
DockerHost *DockerHost `gorm:"foreignKey:DockerHostID"`
}
type ContainerSession ¶
type ContainerSession struct {
Model
ContainerID string `json:"container_id" gorm:"index"`
SessionID string `json:"session_id" gorm:"unique;not null"`
Command string `json:"command"`
UserID string `json:"user_id" gorm:"index"`
Container *Container `gorm:"foreignKey:ContainerID"`
User *User `gorm:"foreignKey:UserID"`
}
type Content ¶
type Content struct {
Model
Type string `json:"type" gorm:"not null"` // text, image, audio, clipboard
Data string `json:"data" gorm:"type:text"` // Text content or file path
MediaURL string `json:"media_url,omitempty"` // URL for media files
MimeType string `json:"mime_type,omitempty"` // MIME type for media
FileSize int64 `json:"file_size,omitempty"` // File size in bytes
GroupID string `json:"group_id" gorm:"index;not null"`
UserID string `json:"user_id" gorm:"index;not null"`
Group *Group `gorm:"foreignKey:GroupID"`
User *User `gorm:"foreignKey:UserID"`
Tags []*Tag `gorm:"many2many:content_tags;"`
Metadata *JSONField[map[string]interface{}] `json:"metadata,omitempty"` // Additional metadata
}
func NewContent ¶
func NewContent(contentType, data, groupID, userID string, metadata map[string]interface{}) *Content
NewContent creates a new Content instance with proper initialization
type ContentTag ¶
type Direction ¶
type Direction struct {
Model
Text string `json:"text" description:"The direction text."`
StartTime int `json:"start_time" description:"The time in seconds when direction starts in the transcript."`
EndTime int `json:"end_time" description:"The time in seconds when direction ends in the transcript."`
RecipeID string `json:"recipe_id" description:"The ID of the recipe."`
}
type DockerHost ¶
type DockerHost struct {
Model
Name string `json:"name" gorm:"unique;not null"`
Endpoint string `json:"endpoint" gorm:"not null"`
TLSCert string `json:"tls_cert,omitempty"`
TLSKey string `json:"tls_key,omitempty"`
TLSCA string `json:"tls_ca,omitempty"`
TLSVerify bool `json:"tls_verify"`
IsDefault bool `json:"is_default"`
UserID string `json:"user_id" gorm:"index"`
User *User `gorm:"foreignKey:UserID"`
}
type Feature ¶
type Feature struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Category string `json:"category"`
Priority string `json:"priority"`
Complexity string `json:"complexity"`
}
Feature represents a feature in ideation sessions
type Group ¶
type Group struct {
ID string `gorm:"primaryKey" json:"id"`
CreatedAt time.Time `json:"created_at"`
Name string `gorm:"unique;not null" json:"name"`
JoinCode string `gorm:"unique" json:"join_code"`
Members []*GroupMembership `gorm:"foreignKey:GroupID" json:"members,omitempty"`
Pages []*Page `gorm:"foreignKey:GroupID" json:"pages,omitempty"`
}
type GroupMembership ¶
type Ingredient ¶
type Ingredient struct {
Model
Name string `json:"name" description:"The name of the ingredient."`
Amount string `json:"amount" description:"The amount of the ingredient."`
Unit string `json:"unit" description:"The unit of the ingredient."`
Comment string `json:"comment" description:"The comment of the ingredient."`
RecipeID string `json:"recipe_id" description:"The ID of the recipe."`
}
type JSONField ¶
type JSONField[T any] struct { Data T }
func MakeJSONField ¶
func (JSONField[T]) MarshalJSON ¶
func (*JSONField[T]) UnmarshalJSON ¶
type PinnedFile ¶
type PromptContext ¶
type PromptContext struct {
Model
ID string `gorm:"primaryKey"`
ContextID string
Request *JSONField[openai.ChatCompletionRequest]
Response *JSONField[openai.ChatCompletionResponse]
}
type Recipe ¶
type Recipe struct {
Model
Domain string `json:"domain" description:"The domain of the recipe."`
URL string `json:"url" description:"The url of the recipe."`
Name string `json:"name"`
Ingredients []*Ingredient `json:"ingredients" gorm:"foreignKey:RecipeID"`
Directions []*Direction `json:"directions" gorm:"foreignKey:RecipeID"`
Equipment []*Equipment `json:"equipment" description:"The equipment used while making the recipe."`
Transcript *JSONField[youtube.VideoTranscript]
}
func AIRecipeToModel ¶
func AIRecipeToModel(ar AIRecipe, id, domain string, ts youtube.VideoTranscript) Recipe
type SessionKVStore ¶
type SessionKVStore struct {
Model
SessionID string `json:"session_id" gorm:"index;not null"`
Namespace string `json:"namespace" gorm:"not null;default:'default'"`
Key string `json:"key" gorm:"not null"`
Value *JSONField[map[string]interface{}] `json:"value" gorm:"type:jsonb;not null"`
}
SessionKVStore represents key-value data for session-based prototypes
func NewSessionKVStore ¶
func NewSessionKVStore(sessionID, namespace, key string, value map[string]interface{}) *SessionKVStore
NewSessionKVStore creates a new SessionKVStore entry
type SlackFileUpload ¶
type SlackFileUpload struct {
Model
ThreadTS string `json:"thread_ts" gorm:"index;not null"`
ChannelID string `json:"channel_id" gorm:"index;not null"`
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
SlackFileID string `json:"slack_file_id" gorm:"index;not null"` // Slack's file ID
FileName string `json:"file_name" gorm:"not null"`
OriginalName string `json:"original_name" gorm:"not null"`
MimeType string `json:"mime_type"`
Category string `json:"category" gorm:"index"` // File category: image, document, code, text, archive, etc.
FileSize int64 `json:"file_size"`
LocalPath string `json:"local_path" gorm:"not null"` // Path where file is stored locally
UploadedAt time.Time `json:"uploaded_at"`
Downloaded bool `json:"downloaded" gorm:"default:false"`
DownloadedAt *time.Time `json:"downloaded_at"`
SessionID string `json:"session_id" gorm:"index"` // Associated Claude session ID if any
}
SlackFileUpload represents a file uploaded to a Slack thread
type SlackIdeationSession ¶
type SlackIdeationSession struct {
Model
SessionID string `json:"session_id" gorm:"unique;not null;index"`
ThreadID string `json:"thread_id" gorm:"index;not null"`
ChannelID string `json:"channel_id" gorm:"index;not null"`
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
OriginalIdea string `json:"original_idea"`
Features JSONField[[]Feature] `json:"features" gorm:"type:json"`
Preferences JSONField[map[string]int] `json:"preferences" gorm:"type:json"` // emoji -> count
ChatHistory JSONField[[]ChatMessage] `json:"chat_history" gorm:"type:json"`
LastActivity time.Time `json:"last_activity"`
Active bool `json:"active" gorm:"default:true"`
MessageTS JSONField[map[string]string] `json:"message_ts" gorm:"type:json"` // feature_id -> message timestamp
}
SlackIdeationSession represents an ideation session tied to a Slack thread (database version)
type SlackSession ¶
type SlackSession struct {
Model
ThreadTS string `json:"thread_ts" gorm:"index;not null"`
ChannelID string `json:"channel_id" gorm:"index;not null"`
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
SessionID string `json:"session_id" gorm:"index"`
ProcessID string `json:"process_id"`
LastActivity time.Time `json:"last_activity"`
Context string `json:"context"` // Working directory context
Active bool `json:"active" gorm:"default:true"`
Resumed bool `json:"resumed" gorm:"default:false"`
}
SlackSession represents a Claude session tied to a Slack thread (database version)
type SlackUserActivity ¶
type SlackUserActivity struct {
Model
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
ThreadTS string `json:"thread_ts" gorm:"index;not null"`
LastSeen time.Time `json:"last_seen"`
MessageCount int `json:"message_count"`
SessionStart time.Time `json:"session_start"`
}
SlackUserActivity tracks user activity patterns in threads (database version)
type Tag ¶
type Tag struct {
Model
Name string `json:"name" gorm:"unique;not null;index"`
Color string `json:"color,omitempty"` // Hex color for display
UserID string `json:"user_id" gorm:"index;not null"` // Tag creator
User *User `gorm:"foreignKey:UserID"`
Contents []*Content `gorm:"many2many:content_tags;"`
}
type ThreadContext ¶
type ThreadContext struct {
Model
ThreadTS string `json:"thread_ts" gorm:"index;not null"`
ChannelID string `json:"channel_id" gorm:"index;not null"`
SessionType string `json:"session_type"` // "ideation", "claude", "worklet"
OriginalPrompt string `json:"original_prompt"`
LastActivity time.Time `json:"last_activity"`
Summary string `json:"summary"`
NextSteps JSONField[[]string] `json:"next_steps" gorm:"type:json"`
KeyMetrics JSONField[map[string]interface{}] `json:"key_metrics" gorm:"type:json"`
PinnedMessage string `json:"pinned_message"` // Timestamp of pinned context message
UserID string `json:"user_id" gorm:"index;not null"`
User *User `gorm:"foreignKey:UserID"`
Active bool `json:"active" gorm:"default:true"`
}
ThreadContext represents a context summary for a Slack thread (database version)
type User ¶
type User struct {
ID string `gorm:"primaryKey"`
CreatedAt time.Time
Username string `gorm:"unique"`
Identities []*Identity `gorm:"foreignKey:UserID"`
GroupMemberships []*GroupMembership `gorm:"foreignKey:UserID"`
Secrets []*UserSecret `gorm:"foreignKey:UserID"`
Password string
}
type UserSecret ¶
type WorkletKVEntry ¶
type WorkletKVEntry struct {
Key string `json:"key"`
Value map[string]interface{} `json:"value"`
Namespace string `json:"namespace"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkletKVEntry represents a single key-value entry for API responses
type WorkletKVStore ¶
type WorkletKVStore struct {
Model
WorkletID string `json:"worklet_id" gorm:"index;not null"`
Namespace string `json:"namespace" gorm:"not null;default:'default'"`
Key string `json:"key" gorm:"not null"`
Value *JSONField[map[string]interface{}] `json:"value" gorm:"type:jsonb;not null"`
}
WorkletKVStore represents key-value data for worklet prototypes DEPRECATED: Use SessionKVStore instead
func NewWorkletKVStore ¶
func NewWorkletKVStore(workletID, namespace, key string, value map[string]interface{}) *WorkletKVStore
NewWorkletKVStore creates a new WorkletKVStore entry DEPRECATED: Use NewSessionKVStore instead
func (*WorkletKVStore) ToEntry ¶
func (kv *WorkletKVStore) ToEntry() WorkletKVEntry
ToEntry converts a WorkletKVStore model to a WorkletKVEntry response