Documentation
¶
Index ¶
- Constants
- func AdaptSystemPrompt(baseline string, profile ClientProfile) string
- func DecodeCursor(cursor string) (offset int, limit int, err error)
- func EncodeCursor(offset int, limit int) string
- type ASTRulesEngine
- type Analyzer
- type CallersParams
- type ChronosEngine
- type ClientProfile
- type CommitParams
- type CriticalParams
- type DefinitionParams
- type DiagnoseParams
- type Diagnoser
- type DiffParams
- type DreamParams
- type EvolutionaryEngine
- type EvolveParams
- type HealerEngine
- type ImpactAssessor
- type ImpactParams
- type IndexParams
- type Indexer
- type LintArchitectureParams
- type MCPMessenger
- type MapParams
- type NeighborhoodParams
- type ObsidianExportParams
- type Options
- type PointerResolver
- type PredictParams
- type ProvenanceParams
- type PureSignalParams
- type ReadParams
- type RippleRefactorParams
- type RollbackParams
- type SaveAnchorParams
- type SearchParams
- type Searcher
- type SelfHealParams
- type SemanticDiffParams
- type Server
- func (s *Server) AppendSessionMessage(msg memory.Message)
- func (s *Server) Close() error
- func (s *Server) GetTranscript(req *mcp.CallToolRequest) []memory.Message
- func (s *Server) GotoDefinition(ctx context.Context, path string, pos lsp.Position) ([]lsp.Location, error)
- func (s *Server) Hover(ctx context.Context, path string, pos lsp.Position) (*lsp.Hover, error)
- func (s *Server) Start(ctx context.Context, transport mcp.Transport) error
- type SnapshotASTParams
- type StructuralSearchParams
- type TypeInfoParams
- type UnlockArsenalParams
- type VerifyASTParams
Constants ¶
const ( DefaultPaginationLimit = 50 MaxPaginationLimit = 100 )
const CompactContextSystemPrompt = `` /* 677-byte string literal not displayed */
const GEPSystemPrompt = `` /* 377-byte string literal not displayed */
const JudgeSystemPrompt = `` /* 641-byte string literal not displayed */
const MaxSessionHistory = 100
const MaxSnapshots = 20
const ScouterServerInstructions = `` /* 1076-byte string literal not displayed */
const SelfHealSystemPrompt = `You are Scouter's Atomic Self-Healing engine.
A test has failed. Review the provided error log and source code.
If historical fixes are provided, carefully consider past patterns to generate your fix.
MANDATES:
1. Fix the specific logic causing the failure.
2. DO NOT output Markdown code blocks (e.g., ` + "```go" + `).
3. DO NOT include explanations, comments, or apologies.
4. Return ONLY the raw code replacement for the target block.
5. Adhere to Go 1.24+ idioms.`
Variables ¶
This section is empty.
Functions ¶
func AdaptSystemPrompt ¶ added in v1.2.0
func AdaptSystemPrompt(baseline string, profile ClientProfile) string
AdaptSystemPrompt modifies a baseline prompt according to the client profile.
func DecodeCursor ¶ added in v1.4.0
DecodeCursor decodes a base64 cursor string into offset and limit.
func EncodeCursor ¶ added in v1.4.0
EncodeCursor creates a base64 encoded cursor from offset and limit.
Types ¶
type ASTRulesEngine ¶ added in v1.4.0
type ASTRulesEngine interface {
Audit(ctx context.Context, targetPath string) ([]types.ASTRuleMatch, error)
}
ASTRulesEngine defines the interface for the AST rules engine.
type Analyzer ¶ added in v1.4.0
type Analyzer interface {
GetCriticalSymbols(ctx context.Context, limit int) ([]store.CriticalSymbol, error)
GetNeighborhood(ctx context.Context, filePath string) (string, error)
}
Analyzer defines the interface for the analysis engine.
type CallersParams ¶
type CallersParams struct {
CalleeName string `json:"calleeName" jsonschema:"REQUIRED. The name of the function or method to find callers for"`
Limit int `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
Cursor string `json:"cursor,omitempty" jsonschema:"Optional: Base64 encoded cursor for pagination"`
Format string `json:"format,omitempty" jsonschema:"Optional: Response format ('text' or 'hakai')"`
}
type ChronosEngine ¶ added in v1.4.0
type ChronosEngine interface {
TakeSnapshot(ctx context.Context, filePath string) (*engine.ChronosSnapshot, error)
CompareSnapshot(ctx context.Context, snapshot *engine.ChronosSnapshot, currentFilePath string) (*engine.ChronosDiff, error)
SemanticDiff(ctx context.Context, target string) (string, error)
}
ChronosEngine defines the interface for the chronos engine.
type ClientProfile ¶ added in v1.2.0
type ClientProfile string
ClientProfile categorizes the connected MCP client to adapt behaviors and prompts.
const ( ClientAntigravity ClientProfile = "antigravity" ClientOpenCode ClientProfile = "opencode" ClientCodex ClientProfile = "codex" ClientGeneric ClientProfile = "generic" )
func IdentifyClient ¶ added in v1.2.0
func IdentifyClient(session *mcp.ServerSession) ClientProfile
IdentifyClient inspects the MCP session to determine the client profile.
type CommitParams ¶
type CommitParams struct{}
type CriticalParams ¶
type DefinitionParams ¶
type DiagnoseParams ¶
type DiagnoseParams struct {
ErrorLog string `json:"errorLog" jsonschema:"REQUIRED. The error log output containing the file and line number of the failure"`
}
type Diagnoser ¶ added in v1.4.0
type Diagnoser interface {
AssessRisk(ctx context.Context, symbol, path string) (*engine.RiskAssessment, error)
Diagnose(ctx context.Context, errorLog string) (*engine.DiagnosticReport, error)
DiagnoseHUD(ctx context.Context, errorLog string) (*engine.DiagnosticHUD, error)
}
Diagnoser defines the interface for the diagnostic engine.
type DiffParams ¶
type DiffParams struct{}
type DreamParams ¶
type EvolutionaryEngine ¶ added in v1.4.0
type EvolutionaryEngine interface {
Propagate(ctx context.Context, symbol, transformation string, messenger engine.Messenger) (string, error)
CommitLedger(ctx context.Context) (string, error)
RollbackLedger(ctx context.Context) (string, error)
GetLedgerDiff(ctx context.Context) (string, error)
GetLedgerSummary(ctx context.Context) string
ProposeEvolution(ctx context.Context, proposal string, force bool, messenger engine.Messenger) (string, error)
}
EvolutionaryEngine defines the interface for the evolution engine.
type EvolveParams ¶
type HealerEngine ¶ added in v1.4.0
type HealerEngine interface {
SetFixRequestHook(hook func(ctx context.Context, prompt string) (string, error))
Fix(ctx context.Context, errorLog string) (*types.HealResult, error)
}
HealerEngine defines the interface for the healer engine.
type ImpactAssessor ¶ added in v1.4.0
type ImpactAssessor interface {
Analyze(ctx context.Context, symbol string, path string, maxDepth int, opts ...engine.AnalyzeOption) (*types.ImpactResult, error)
PredictTests(ctx context.Context, diff string) ([]types.TestTarget, error)
}
ImpactAssessor defines the interface for the impact engine.
type ImpactParams ¶
type ImpactParams struct {
SymbolName string `json:"symbolName" jsonschema:"REQUIRED. The name of the symbol to analyze"`
FilePath string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
MaxDepth int `json:"maxDepth,omitempty" jsonschema:"Optional: Maximum recursion depth for impact analysis"`
Verbose bool `json:"verbose,omitempty" jsonschema:"Optional: Include detailed metrics and Mermaid graph"`
}
type IndexParams ¶
type IndexParams struct {
FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file or directory to index"`
}
type LintArchitectureParams ¶ added in v1.2.0
type LintArchitectureParams struct {
TargetPath string `json:"target_path" jsonschema:"REQUIRED. The target path to lint"`
}
type MCPMessenger ¶
type MCPMessenger struct {
// contains filtered or unexported fields
}
MCPMessenger adapts the MCP Sampling protocol to the engine.Messenger interface.
func NewMCPMessenger ¶
func NewMCPMessenger(session *mcp.ServerSession) *MCPMessenger
NewMCPMessenger creates a new messenger for the given MCP session.
type MapParams ¶
type MapParams struct {
Path string `json:"path" jsonschema:"REQUIRED. The absolute or relative path to the file or directory to map (skeleton only)"`
}
type NeighborhoodParams ¶
type NeighborhoodParams struct {
FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file to extract the neighborhood from"`
}
type ObsidianExportParams ¶
type ObsidianExportParams struct {
SymbolName string `json:"symbolName" jsonschema:"REQUIRED. The name of the symbol to export"`
FilePath string `json:"filePath" jsonschema:"REQUIRED. Path to the file containing the symbol"`
VaultPath string `json:"vaultPath,omitempty" jsonschema:"Optional: Custom path for the Obsidian vault export"`
}
type Options ¶
type Options struct {
Store store.Store
Logger *slog.Logger
LspMgr *lsp.Manager
Indexer Indexer
Search Searcher
Analyzer Analyzer
Impact ImpactAssessor
Diagnostic Diagnoser
ASTRules ASTRulesEngine
Evolution EvolutionaryEngine
Healer HealerEngine
Memory memory.MemoryProvider
ChronosEngine ChronosEngine
AppService *memory.AppService
}
Options contains the dependencies required to initialize the MCP Server.
type PointerResolver ¶
type PointerResolver struct {
// contains filtered or unexported fields
}
PointerResolver handles the resolution of MCP pointers to physical file ranges.
func NewPointerResolver ¶
func NewPointerResolver(st store.SymbolRegistry) *PointerResolver
type PredictParams ¶
type PredictParams struct {
Diff string `json:"diff,omitempty" jsonschema:"Optional: Git diff to analyze (defaults to uncommitted changes)"`
}
type ProvenanceParams ¶ added in v1.4.0
type PureSignalParams ¶
type PureSignalParams struct {
Text string `json:"text" jsonschema:"REQUIRED. The raw text to filter and extract pure signal from"`
Mode string `json:"mode,omitempty" jsonschema:"Optional: Filtering mode (e.g., 'compact', 'verbose')"`
Level string `json:"level,omitempty" jsonschema:"Optional: Filtering aggressiveness (e.g., 'aggressive', 'balanced')"`
}
type ReadParams ¶
type RippleRefactorParams ¶
type RollbackParams ¶
type RollbackParams struct{}
type SaveAnchorParams ¶
type SaveAnchorParams struct {
Summary string `json:"summary" jsonschema:"REQUIRED. The technical summary of the session to anchor in Engram"`
}
type SearchParams ¶
type SearchParams struct {
Query string `json:"query" jsonschema:"REQUIRED. The search query (supports semantic or text search)"`
Type string `json:"type,omitempty" jsonschema:"Optional: Filter by symbol type (e.g., function, method, struct)"`
Limit int `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
Cursor string `json:"cursor,omitempty" jsonschema:"Optional: Base64 encoded cursor for pagination"`
Format string `json:"format,omitempty" jsonschema:"Optional: Response format ('text' or 'hakai')"`
}
type Searcher ¶ added in v1.4.0
type Searcher interface {
HybridSearch(ctx context.Context, query string, limit, offset int, pathPrefix string) (*types.HybridSearchResult, error)
FindLogicalTwins(ctx context.Context, symbolName, path string) ([]types.Symbol, error)
}
Searcher defines the interface for the search engine.
type SelfHealParams ¶
type SelfHealParams struct {
ErrorLog string `json:"errorLog" jsonschema:"REQUIRED. The raw error log or test failure output containing the failure context"`
}
type SemanticDiffParams ¶ added in v1.2.0
type SemanticDiffParams struct {
DiffTarget string `json:"diff_target,omitempty" jsonschema:"Optional. The git target to diff against (e.g., HEAD, main). Defaults to HEAD."`
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps the official MCP SDK server to provide Scouter-specific domain logic.
func (*Server) AppendSessionMessage ¶
AppendSessionMessage adds a message to the session history with a fixed capacity.
func (*Server) GetTranscript ¶
func (s *Server) GetTranscript(req *mcp.CallToolRequest) []memory.Message
GetTranscript attempts to retrieve the current session transcript.
func (*Server) GotoDefinition ¶
func (s *Server) GotoDefinition(ctx context.Context, path string, pos lsp.Position) ([]lsp.Location, error)
GotoDefinition performs an LSP definition request.
type SnapshotASTParams ¶
type SnapshotASTParams struct {
FilePath string `json:"filePath" jsonschema:"REQUIRED. The absolute or relative path to the file to snapshot"`
}
type StructuralSearchParams ¶
type StructuralSearchParams struct {
Pattern string `json:"pattern,omitempty" jsonschema:"Optional: The structural search pattern (supports $VAR and $$$ wildcards)"`
TargetSymbol string `json:"targetSymbol,omitempty" jsonschema:"Optional: An existing symbol to use as the template pattern (Find Logical Twins)"`
Ext string `json:"ext,omitempty" jsonschema:"Optional: The file extension to search in (e.g., '.go', '.ts')"`
Path string `json:"path,omitempty" jsonschema:"Optional: Root path for the search (defaults to '.')"`
Limit int `json:"limit,omitempty" jsonschema:"Optional: Max results to return (default: 50, max: 100)"`
Cursor string `json:"cursor,omitempty" jsonschema:"Optional: Base64 encoded cursor for pagination"`
}
type TypeInfoParams ¶
type UnlockArsenalParams ¶
type UnlockArsenalParams struct{}