(event)
| 106 | } |
| 107 | |
| 108 | function extractToolName(event) { |
| 109 | if (!event || typeof event !== "object") { |
| 110 | return null; |
| 111 | } |
| 112 | |
| 113 | const candidates = [ |
| 114 | event.tool_name, |
| 115 | event.tool?.name, |
| 116 | event.name, |
| 117 | event.recipient_name, |
| 118 | event.payload?.tool_name, |
| 119 | ]; |
| 120 | |
| 121 | for (const candidate of candidates) { |
| 122 | if (typeof candidate === "string" && candidate.trim()) { |
| 123 | return candidate.trim(); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if (typeof event.type === "string" && event.type.includes("tool")) { |
| 128 | return event.type; |
| 129 | } |
| 130 | |
| 131 | return null; |
| 132 | } |
| 133 | |
| 134 | function isShellEvent(event) { |
| 135 | const type = typeof event?.type === "string" ? event.type : ""; |
no outgoing calls
no test coverage detected