mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-05-21 15:16:55 +02:00
30 lines
871 B
Go
30 lines
871 B
Go
package database
|
|
|
|
// ConversationCreateMeta describes how a conversation was created (for audit hooks).
|
|
type ConversationCreateMeta struct {
|
|
Source string
|
|
WebShellConnectionID string
|
|
ClientIP string
|
|
SessionHint string
|
|
}
|
|
|
|
// ConversationCreateHook is invoked after a conversation row is inserted.
|
|
type ConversationCreateHook func(conv *Conversation, meta ConversationCreateMeta)
|
|
|
|
var conversationCreateHook ConversationCreateHook
|
|
|
|
// SetConversationCreateHook registers a global hook (e.g. platform audit).
|
|
func SetConversationCreateHook(h ConversationCreateHook) {
|
|
conversationCreateHook = h
|
|
}
|
|
|
|
func notifyConversationCreated(conv *Conversation, meta ConversationCreateMeta) {
|
|
if conversationCreateHook == nil || conv == nil {
|
|
return
|
|
}
|
|
if meta.Source == "" {
|
|
meta.Source = "unknown"
|
|
}
|
|
conversationCreateHook(conv, meta)
|
|
}
|