mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
test(events): prefer runtime hook observation
Use RuntimeEventObserver for the normal in-process hook observer path and make the process-hook helper assert hook.runtime_event notifications. Validation: go test ./pkg/agent; make lint
This commit is contained in:
@@ -356,14 +356,11 @@ func runProcessHookHelper() error {
|
||||
}
|
||||
|
||||
if msg.ID == 0 {
|
||||
if (msg.Method == "hook.event" || msg.Method == "hook.runtime_event") && eventLog != "" {
|
||||
if msg.Method == "hook.runtime_event" && eventLog != "" {
|
||||
var evt map[string]any
|
||||
if err := json.Unmarshal(msg.Params, &evt); err == nil {
|
||||
if kind, ok := evt["kind"].(string); ok {
|
||||
_ = os.WriteFile(eventLog, []byte(kind+"\n"), 0o644)
|
||||
} else if rawKind, ok := evt["Kind"].(float64); ok {
|
||||
kind := EventKind(rawKind)
|
||||
_ = os.WriteFile(eventLog, []byte(kind.String()+"\n"), 0o644)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user