* Check if a search tool use targets memory files by examining its path, pattern, and glob.
(toolInput: unknown)
| 99 | * Check if a search tool use targets memory files by examining its path, pattern, and glob. |
| 100 | */ |
| 101 | function isMemorySearch(toolInput: unknown): boolean { |
| 102 | const input = toolInput as |
| 103 | | { path?: string; pattern?: string; glob?: string; command?: string } |
| 104 | | undefined |
| 105 | if (!input) { |
| 106 | return false |
| 107 | } |
| 108 | // Check if the search path targets a memory file or directory (Grep/Glob tools) |
| 109 | if (input.path) { |
| 110 | if (isAutoManagedMemoryFile(input.path) || isMemoryDirectory(input.path)) { |
| 111 | return true |
| 112 | } |
| 113 | } |
| 114 | // Check glob patterns that indicate memory file access |
| 115 | if (input.glob && isAutoManagedMemoryPattern(input.glob)) { |
| 116 | return true |
| 117 | } |
| 118 | // For shell commands (bash grep/rg, PowerShell Select-String, etc.), |
| 119 | // check if the command targets memory paths |
| 120 | if (input.command && isShellCommandTargetingMemory(input.command)) { |
| 121 | return true |
| 122 | } |
| 123 | return false |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Check if a Write or Edit tool use targets a memory file and should be collapsed. |
no test coverage detected