extractComm returns the executing process's short name (comm) from an event payload -- used to confirm that a time-window-attributed effect was actually produced by the process the tool call launched, not by a background harness thread that merely touched the same file in the same window.
(payload string)
| 139 | // produced by the process the tool call launched, not by a background harness |
| 140 | // thread that merely touched the same file in the same window. |
| 141 | func extractComm(payload string) string { |
| 142 | if payload == "" { |
| 143 | return "" |
| 144 | } |
| 145 | var top map[string]any |
| 146 | if err := json.Unmarshal([]byte(payload), &top); err != nil { |
| 147 | return "" |
| 148 | } |
| 149 | inner := top |
| 150 | if p, ok := top["payload"].(map[string]any); ok { |
| 151 | inner = p |
| 152 | } |
| 153 | raw := inner |
| 154 | if r, ok := inner["raw"].(map[string]any); ok { |
| 155 | raw = r |
| 156 | } |
| 157 | return firstString(inner["comm"], raw["comm"]) |
| 158 | } |
| 159 | |
| 160 | func argvToCommand(v any) string { |
| 161 | arr, ok := v.([]any) |
no test coverage detected