MCPcopy Create free account
hub / github.com/ByteYellow/AgentProvenance / extractComm

Function extractComm

internal/intent/effect.go:141–158  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
141func 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
160func argvToCommand(v any) string {
161 arr, ok := v.([]any)

Callers 1

normalizeEffectsFunction · 0.85

Calls 1

firstStringFunction · 0.70

Tested by

no test coverage detected