Documentation
¶
Index ¶
- func GenerateConversationID() string
- func GenerateMessageID() string
- type ConversationStorage
- type MCPServerConfig
- type MCPStorage
- type MemoryConversationStorage
- func (s *MemoryConversationStorage) AddItems(ctx context.Context, conversationID string, items []openai.ConversationItem) error
- func (s *MemoryConversationStorage) Delete(ctx context.Context, id string) error
- func (s *MemoryConversationStorage) DeleteItem(ctx context.Context, conversationID string, itemID string) error
- func (s *MemoryConversationStorage) Get(ctx context.Context, id string) (*StoredConversation, error)
- func (s *MemoryConversationStorage) GetItem(ctx context.Context, conversationID string, itemID string) (*openai.ConversationItem, error)
- func (s *MemoryConversationStorage) GetItems(ctx context.Context, conversationID string, after string, limit int, ...) ([]openai.ConversationItem, bool, error)
- func (s *MemoryConversationStorage) ListConversations() []string
- func (s *MemoryConversationStorage) Store(ctx context.Context, conversation *StoredConversation) error
- func (s *MemoryConversationStorage) Update(ctx context.Context, id string, metadata map[string]interface{}) error
- type MemoryMCPStorage
- func (s *MemoryMCPStorage) Create(ctx context.Context, server *MCPServerConfig) error
- func (s *MemoryMCPStorage) Delete(ctx context.Context, namespace string) error
- func (s *MemoryMCPStorage) Get(ctx context.Context, namespace string) (*MCPServerConfig, error)
- func (s *MemoryMCPStorage) List(ctx context.Context) ([]*MCPServerConfig, error)
- func (s *MemoryMCPStorage) ToggleTool(ctx context.Context, namespace, toolName string, enabled bool) error
- func (s *MemoryMCPStorage) Update(ctx context.Context, server *MCPServerConfig) error
- type SnapshotConversationStorage
- func (s *SnapshotConversationStorage) AddItems(ctx context.Context, conversationID string, items []openai.ConversationItem) error
- func (s *SnapshotConversationStorage) Delete(ctx context.Context, id string) error
- func (s *SnapshotConversationStorage) DeleteItem(ctx context.Context, conversationID string, itemID string) error
- func (s *SnapshotConversationStorage) Get(ctx context.Context, id string) (*StoredConversation, error)
- func (s *SnapshotConversationStorage) GetItem(ctx context.Context, conversationID string, itemID string) (*openai.ConversationItem, error)
- func (s *SnapshotConversationStorage) GetItems(ctx context.Context, conversationID string, after string, limit int, ...) ([]openai.ConversationItem, bool, error)
- func (s *SnapshotConversationStorage) ListConversations() []string
- func (s *SnapshotConversationStorage) Store(ctx context.Context, conversation *StoredConversation) error
- func (s *SnapshotConversationStorage) Update(ctx context.Context, id string, metadata map[string]interface{}) error
- type SnapshotMCPStorage
- func (s *SnapshotMCPStorage) Create(ctx context.Context, server *MCPServerConfig) error
- func (s *SnapshotMCPStorage) Delete(ctx context.Context, namespace string) error
- func (s *SnapshotMCPStorage) Get(ctx context.Context, namespace string) (*MCPServerConfig, error)
- func (s *SnapshotMCPStorage) List(ctx context.Context) ([]*MCPServerConfig, error)
- func (s *SnapshotMCPStorage) ToggleTool(ctx context.Context, namespace, toolName string, enabled bool) error
- func (s *SnapshotMCPStorage) Update(ctx context.Context, server *MCPServerConfig) error
- type Store
- type StoredConversation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateConversationID ¶
func GenerateConversationID() string
func GenerateMessageID ¶
func GenerateMessageID() string
Types ¶
type ConversationStorage ¶
type ConversationStorage interface {
Store(ctx context.Context, conversation *StoredConversation) error
Get(ctx context.Context, id string) (*StoredConversation, error)
Delete(ctx context.Context, id string) error
Update(ctx context.Context, id string, metadata map[string]interface{}) error
AddItems(ctx context.Context, conversationID string, items []openai.ConversationItem) error
GetItems(ctx context.Context, conversationID string, after string, limit int, order string) ([]openai.ConversationItem, bool, error)
GetItem(ctx context.Context, conversationID string, itemID string) (*openai.ConversationItem, error)
DeleteItem(ctx context.Context, conversationID string, itemID string) error
}
ConversationStorage defines the interface for conversation storage
type MCPServerConfig ¶
type MCPServerConfig struct {
Namespace string `json:"namespace"`
URL string `json:"url"`
AuthType string `json:"auth_type,omitempty"` // "bearer" (default) or "oauth2"
Token string `json:"token,omitempty"`
OAuthClientID string `json:"oauth_client_id,omitempty"`
OAuthTokenURL string `json:"oauth_token_url,omitempty"`
OAuthAccessToken string `json:"oauth_access_token,omitempty"`
OAuthRefreshToken string `json:"oauth_refresh_token,omitempty"`
Enabled bool `json:"enabled"` // Server is active (default true)
ToolVisibility string `json:"tool_visibility"` // "native" (default) or "ondemand"
ToolAllowlist []string `json:"tool_allowlist,omitempty"`
ToolDenylist []string `json:"tool_denylist,omitempty"`
DisabledTools []string `json:"disabled_tools,omitempty"` // Tools disabled via UI toggle
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
MCPServerConfig represents a stored MCP server configuration
func (*MCPServerConfig) IsToolEnabled ¶
func (c *MCPServerConfig) IsToolEnabled(toolName string) bool
IsToolEnabled checks if a tool is enabled based on allowlist, denylist, and disabled_tools
func (*MCPServerConfig) MarshalJSON ¶
func (c *MCPServerConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for MCPServerConfig
type MCPStorage ¶
type MCPStorage interface {
Create(ctx context.Context, server *MCPServerConfig) error
Get(ctx context.Context, namespace string) (*MCPServerConfig, error)
List(ctx context.Context) ([]*MCPServerConfig, error)
Update(ctx context.Context, server *MCPServerConfig) error
Delete(ctx context.Context, namespace string) error
ToggleTool(ctx context.Context, namespace, toolName string, enabled bool) error
}
MCPStorage defines the interface for MCP server storage
type MemoryConversationStorage ¶
type MemoryConversationStorage struct {
// contains filtered or unexported fields
}
MemoryConversationStorage implements ConversationStorage using in-memory storage
func NewMemoryConversationStorage ¶
func NewMemoryConversationStorage() *MemoryConversationStorage
NewMemoryConversationStorage creates a new memory-based conversation storage
func (*MemoryConversationStorage) AddItems ¶
func (s *MemoryConversationStorage) AddItems(ctx context.Context, conversationID string, items []openai.ConversationItem) error
func (*MemoryConversationStorage) Delete ¶
func (s *MemoryConversationStorage) Delete(ctx context.Context, id string) error
func (*MemoryConversationStorage) DeleteItem ¶
func (*MemoryConversationStorage) Get ¶
func (s *MemoryConversationStorage) Get(ctx context.Context, id string) (*StoredConversation, error)
func (*MemoryConversationStorage) GetItem ¶
func (s *MemoryConversationStorage) GetItem(ctx context.Context, conversationID string, itemID string) (*openai.ConversationItem, error)
func (*MemoryConversationStorage) ListConversations ¶
func (s *MemoryConversationStorage) ListConversations() []string
ListConversations returns all conversation IDs (for admin/debug purposes)
func (*MemoryConversationStorage) Store ¶
func (s *MemoryConversationStorage) Store(ctx context.Context, conversation *StoredConversation) error
type MemoryMCPStorage ¶
type MemoryMCPStorage struct {
// contains filtered or unexported fields
}
MemoryMCPStorage implements MCPStorage using in-memory storage
func NewMemoryMCPStorage ¶
func NewMemoryMCPStorage() *MemoryMCPStorage
NewMemoryMCPStorage creates a new in-memory MCP storage
func (*MemoryMCPStorage) Create ¶
func (s *MemoryMCPStorage) Create(ctx context.Context, server *MCPServerConfig) error
func (*MemoryMCPStorage) Delete ¶
func (s *MemoryMCPStorage) Delete(ctx context.Context, namespace string) error
func (*MemoryMCPStorage) Get ¶
func (s *MemoryMCPStorage) Get(ctx context.Context, namespace string) (*MCPServerConfig, error)
func (*MemoryMCPStorage) List ¶
func (s *MemoryMCPStorage) List(ctx context.Context) ([]*MCPServerConfig, error)
func (*MemoryMCPStorage) ToggleTool ¶
func (*MemoryMCPStorage) Update ¶
func (s *MemoryMCPStorage) Update(ctx context.Context, server *MCPServerConfig) error
type SnapshotConversationStorage ¶
type SnapshotConversationStorage struct {
// contains filtered or unexported fields
}
SnapshotConversationStorage implements ConversationStorage using snapshotkv
func NewSnapshotConversationStorage ¶
func NewSnapshotConversationStorage(db *snapshotkv.DB, ttl time.Duration) *SnapshotConversationStorage
NewSnapshotConversationStorage creates a new snapshotkv-based conversation storage
func (*SnapshotConversationStorage) AddItems ¶
func (s *SnapshotConversationStorage) AddItems(ctx context.Context, conversationID string, items []openai.ConversationItem) error
func (*SnapshotConversationStorage) Delete ¶
func (s *SnapshotConversationStorage) Delete(ctx context.Context, id string) error
func (*SnapshotConversationStorage) DeleteItem ¶
func (*SnapshotConversationStorage) Get ¶
func (s *SnapshotConversationStorage) Get(ctx context.Context, id string) (*StoredConversation, error)
func (*SnapshotConversationStorage) GetItem ¶
func (s *SnapshotConversationStorage) GetItem(ctx context.Context, conversationID string, itemID string) (*openai.ConversationItem, error)
func (*SnapshotConversationStorage) ListConversations ¶
func (s *SnapshotConversationStorage) ListConversations() []string
ListConversations returns all conversation IDs (for admin/debug purposes)
func (*SnapshotConversationStorage) Store ¶
func (s *SnapshotConversationStorage) Store(ctx context.Context, conversation *StoredConversation) error
type SnapshotMCPStorage ¶
type SnapshotMCPStorage struct {
// contains filtered or unexported fields
}
SnapshotMCPStorage implements MCPStorage using snapshotkv
func NewSnapshotMCPStorage ¶
func NewSnapshotMCPStorage(db *snapshotkv.DB) *SnapshotMCPStorage
NewSnapshotMCPStorage creates a new snapshotkv-backed MCP storage
func (*SnapshotMCPStorage) Create ¶
func (s *SnapshotMCPStorage) Create(ctx context.Context, server *MCPServerConfig) error
func (*SnapshotMCPStorage) Delete ¶
func (s *SnapshotMCPStorage) Delete(ctx context.Context, namespace string) error
func (*SnapshotMCPStorage) Get ¶
func (s *SnapshotMCPStorage) Get(ctx context.Context, namespace string) (*MCPServerConfig, error)
func (*SnapshotMCPStorage) List ¶
func (s *SnapshotMCPStorage) List(ctx context.Context) ([]*MCPServerConfig, error)
func (*SnapshotMCPStorage) ToggleTool ¶
func (s *SnapshotMCPStorage) ToggleTool(ctx context.Context, namespace, toolName string, enabled bool) error
ToggleTool enables or disables a specific tool for an MCP server This is a lazy write - it only updates the disabled_tools list
func (*SnapshotMCPStorage) Update ¶
func (s *SnapshotMCPStorage) Update(ctx context.Context, server *MCPServerConfig) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) NewConversationStorage ¶
func (s *Store) NewConversationStorage() ConversationStorage
func (*Store) NewMCPStorage ¶
func (s *Store) NewMCPStorage() MCPStorage
type StoredConversation ¶
type StoredConversation struct {
ID string
CreatedAt time.Time
Metadata map[string]interface{}
Items []openai.ConversationItem
}
StoredConversation represents a conversation stored in the database