mirror of
https://github.com/syntrex-lab/gomcp.git
synced 2026-04-24 20:06:21 +02:00
feat: wire FFI to real 54-engine SentinelEngine pipeline (replaces toy regex)
This commit is contained in:
parent
a120aa2750
commit
f0c2b4133b
1 changed files with 11 additions and 8 deletions
|
|
@ -53,12 +53,15 @@ func NewNativeSentinelCore() (*NativeSentinelCore, error) {
|
|||
|
||||
// sentinelAnalyzeResult matches the JSON returned by sentinel_analyze().
|
||||
type sentinelAnalyzeResult struct {
|
||||
Confidence float64 `json:"confidence"`
|
||||
Categories []string `json:"categories"`
|
||||
IsThreat bool `json:"is_threat"`
|
||||
InputLength int `json:"input_length"`
|
||||
AnalyzeCount uint64 `json:"analyze_count"`
|
||||
Error string `json:"error,omitempty"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
Categories []string `json:"categories"`
|
||||
IsThreat bool `json:"is_threat"`
|
||||
InputLength int `json:"input_length"`
|
||||
AnalyzeCount uint64 `json:"analyze_count"`
|
||||
EnginesTriggered int `json:"engines_triggered"`
|
||||
ProcessingTimeUs uint64 `json:"processing_time_us"`
|
||||
Indicators []string `json:"indicators"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// analyze sends text through the Rust sentinel-core analysis pipeline.
|
||||
|
|
@ -112,8 +115,8 @@ func (n *NativeSentinelCore) ScanPrompt(_ context.Context, prompt string) (*Scan
|
|||
ThreatType: threatType,
|
||||
Severity: severity,
|
||||
Confidence: res.Confidence,
|
||||
Details: fmt.Sprintf("categories=%v", res.Categories),
|
||||
Indicators: res.Categories,
|
||||
Details: fmt.Sprintf("engines=%d categories=%v", res.EnginesTriggered, res.Categories),
|
||||
Indicators: res.Indicators,
|
||||
Duration: time.Since(start),
|
||||
Timestamp: time.Now(),
|
||||
}, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue