Documentation
¶
Index ¶
- Variables
- type ActionContext
- type CalibrationConfig
- type DynamicResource
- type Engine
- func (e *Engine) GetEventBus() *eventbus.EventBus
- func (e *Engine) GetKnowledgeStore() knowledge.Store
- func (e *Engine) ProcessEvent(ctx context.Context, event *events.Event)
- func (e *Engine) PublishEvent(ctx context.Context, eventType eventbus.EventType, source string, ...) error
- func (e *Engine) Start(ctx context.Context)
- func (e *Engine) Stop()
- type ErrorContext
- type MCPServer
- type Pattern
- type PatternDetector
- func (pd *PatternDetector) DetectEmergingPatterns(ctx context.Context, projectID string) ([]*Pattern, error)
- func (pd *PatternDetector) GetHighConfidencePatterns(minConfidence float64) []*Pattern
- func (pd *PatternDetector) GetPattern(patternID string) *Pattern
- func (pd *PatternDetector) GetSuggestedFix(ctx context.Context, errorMsg string, projectID string) (*Pattern, error)
- func (pd *PatternDetector) GetTopPatterns(n int) []*Pattern
- func (pd *PatternDetector) RecordErrorSolution(ctx context.Context, errorMsg, solution string, success bool, ...) error
- func (pd *PatternDetector) UpdatePatternSuccess(patternID string, success bool)
- type ProactiveSuggestionEngine
- func (pse *ProactiveSuggestionEngine) GetSuggestions() []*Suggestion
- func (pse *ProactiveSuggestionEngine) ProcessEvent(ctx context.Context, event *events.Event)
- func (pse *ProactiveSuggestionEngine) RecordAction(action, target string, success bool)
- func (pse *ProactiveSuggestionEngine) RecordError(errorMsg string, file string, line int)
- func (pse *ProactiveSuggestionEngine) SetResourceProvider(rp ResourceProvider)
- func (pse *ProactiveSuggestionEngine) SetServer(server MCPServer)
- func (pse *ProactiveSuggestionEngine) UpdateContext(ctx WorkContext)
- type ResourceProvider
- type Scheduler
- type Suggestion
- type ToolHandler
- type ToolResult
- type WorkContext
Constants ¶
This section is empty.
Variables ¶
var NewScheduler = calibration.NewScheduler
Re-export functions for convenience
Functions ¶
This section is empty.
Types ¶
type ActionContext ¶
ActionContext tracks recent user actions
type CalibrationConfig ¶
type CalibrationConfig = calibration.CalibrationConfig
Type aliases for calibration package to simplify imports
type DynamicResource ¶
type DynamicResource struct {
URI string `json:"uri"`
Name string `json:"name"`
Description string `json:"description"`
MimeType string `json:"mimeType"`
Content interface{} `json:"content"`
}
DynamicResource represents a dynamically generated resource
type Engine ¶
type Engine struct {
Detector *PatternDetector
ProactiveEngine *ProactiveSuggestionEngine
Calibrator *Scheduler
// contains filtered or unexported fields
}
Engine is the central "brain" of MCPBee, encapsulating all intelligence.
func NewEngine ¶
func NewEngine(knowledge knowledge.Store, calibConfig CalibrationConfig) (*Engine, error)
NewEngine creates a new intelligence engine with event bus for decoupling.
func (*Engine) GetEventBus ¶
GetEventBus returns the event bus for external components to publish events
func (*Engine) GetKnowledgeStore ¶
GetKnowledgeStore returns the underlying knowledge store for direct access when needed.
func (*Engine) ProcessEvent ¶
ProcessEvent is the single entry point for all external events.
func (*Engine) PublishEvent ¶
func (e *Engine) PublishEvent(ctx context.Context, eventType eventbus.EventType, source string, data map[string]interface{}) error
PublishEvent publishes an event to the internal event bus
type ErrorContext ¶
ErrorContext tracks recent errors for pattern matching
type MCPServer ¶
type MCPServer interface {
RegisterSessionTool(sessionID string, name string) error
RegisterDynamicTool(name string, description string, handler ToolHandler) error
GetProjectID() string
GetSessionID() string
}
MCPServer interface defines the contract for MCP server interactions
type Pattern ¶
type Pattern struct {
ID string `json:"id"`
ErrorType string `json:"error_type"`
ErrorSignature string `json:"error_signature"`
Solution string `json:"solution"`
Context map[string]interface{} `json:"context"`
Occurrences int `json:"occurrences"`
Confidence float64 `json:"confidence"`
SuccessRate float64 `json:"success_rate"`
LastSeen time.Time `json:"last_seen"`
FirstSeen time.Time `json:"first_seen"`
ProjectIDs []string `json:"project_ids"`
SessionIDs []string `json:"session_ids"`
}
Pattern represents an identified Error→Solution pattern
type PatternDetector ¶
type PatternDetector struct {
// contains filtered or unexported fields
}
PatternDetector identifies and tracks Error→Solution patterns with confidence scoring
func NewPatternDetector ¶
func NewPatternDetector(knowledge knowledge.Store) *PatternDetector
NewPatternDetector creates a new pattern detector
func (*PatternDetector) DetectEmergingPatterns ¶
func (pd *PatternDetector) DetectEmergingPatterns(ctx context.Context, projectID string) ([]*Pattern, error)
DetectEmergingPatterns identifies new patterns from recent activity
func (*PatternDetector) GetHighConfidencePatterns ¶
func (pd *PatternDetector) GetHighConfidencePatterns(minConfidence float64) []*Pattern
GetHighConfidencePatterns returns patterns with high confidence
func (*PatternDetector) GetPattern ¶
func (pd *PatternDetector) GetPattern(patternID string) *Pattern
GetPattern returns a specific pattern by ID
func (*PatternDetector) GetSuggestedFix ¶
func (pd *PatternDetector) GetSuggestedFix(ctx context.Context, errorMsg string, projectID string) (*Pattern, error)
GetSuggestedFix returns the best fix for an error based on patterns
func (*PatternDetector) GetTopPatterns ¶
func (pd *PatternDetector) GetTopPatterns(n int) []*Pattern
GetTopPatterns returns the top N patterns by confidence
func (*PatternDetector) RecordErrorSolution ¶
func (pd *PatternDetector) RecordErrorSolution(ctx context.Context, errorMsg, solution string, success bool, metadata map[string]interface{}) error
RecordErrorSolution records an error and its solution
func (*PatternDetector) UpdatePatternSuccess ¶
func (pd *PatternDetector) UpdatePatternSuccess(patternID string, success bool)
UpdatePatternSuccess updates a pattern's success rate after application
type ProactiveSuggestionEngine ¶
type ProactiveSuggestionEngine struct {
// contains filtered or unexported fields
}
ProactiveSuggestionEngine anticipates user needs and surfaces relevant knowledge
func NewProactiveSuggestionEngine ¶
func NewProactiveSuggestionEngine(knowledge knowledge.Store) *ProactiveSuggestionEngine
NewProactiveSuggestionEngine creates a new proactive suggestion engine
func (*ProactiveSuggestionEngine) GetSuggestions ¶
func (pse *ProactiveSuggestionEngine) GetSuggestions() []*Suggestion
GetSuggestions returns current relevant suggestions
func (*ProactiveSuggestionEngine) ProcessEvent ¶
func (pse *ProactiveSuggestionEngine) ProcessEvent(ctx context.Context, event *events.Event)
ProcessEvent processes an event from the stream consumer (single source of truth)
func (*ProactiveSuggestionEngine) RecordAction ¶
func (pse *ProactiveSuggestionEngine) RecordAction(action, target string, success bool)
RecordAction records a user action for context tracking
func (*ProactiveSuggestionEngine) RecordError ¶
func (pse *ProactiveSuggestionEngine) RecordError(errorMsg string, file string, line int)
RecordError records an error for pattern analysis
func (*ProactiveSuggestionEngine) SetResourceProvider ¶
func (pse *ProactiveSuggestionEngine) SetResourceProvider(rp ResourceProvider)
SetResourceProvider sets the resource provider for the engine
func (*ProactiveSuggestionEngine) SetServer ¶
func (pse *ProactiveSuggestionEngine) SetServer(server MCPServer)
SetServer sets the MCP server reference for the engine
func (*ProactiveSuggestionEngine) UpdateContext ¶
func (pse *ProactiveSuggestionEngine) UpdateContext(ctx WorkContext)
UpdateContext updates the current working context
type ResourceProvider ¶
type ResourceProvider interface {
GetResources() map[string]*DynamicResource
GetResource(uri string) (*DynamicResource, error)
UpdateSessionID(sessionID string)
}
ResourceProvider interface defines the contract for resource providers
type Scheduler ¶
type Scheduler = calibration.Scheduler
Type aliases for calibration package to simplify imports
type Suggestion ¶
type Suggestion struct {
ID string `json:"id"`
Type string `json:"type"` // "tool", "resource", "pattern", "tip"
Priority float64 `json:"priority"`
Title string `json:"title"`
Description string `json:"description"`
Action interface{} `json:"action"` // Tool to create, resource to surface, etc.
Reason string `json:"reason"`
Confidence float64 `json:"confidence"`
Context map[string]interface{} `json:"context"`
ExpiresAt time.Time `json:"expires_at"`
}
Suggestion represents a proactive suggestion
type ToolHandler ¶
type ToolHandler func(ctx context.Context, args map[string]interface{}) (*ToolResult, error)
ToolHandler is a function that handles tool execution
type ToolResult ¶
type ToolResult struct {
Content interface{} `json:"content"`
IsError bool `json:"isError,omitempty"`
Annotations []string `json:"annotations,omitempty"`
}
ToolResult represents the result of a tool execution