* Processes paths that need nested memory attachments and checks for nested CLAUDE.md files * Uses nestedMemoryAttachmentTriggers field from ToolUseContext
( toolUseContext: ToolUseContext, )
| 2165 | * Uses nestedMemoryAttachmentTriggers field from ToolUseContext |
| 2166 | */ |
| 2167 | async function getNestedMemoryAttachments( |
| 2168 | toolUseContext: ToolUseContext, |
| 2169 | ): Promise<Attachment[]> { |
| 2170 | // Check triggers first — getAppState() waits for a React render cycle, |
| 2171 | // and the common case is an empty trigger set. |
| 2172 | if ( |
| 2173 | !toolUseContext.nestedMemoryAttachmentTriggers || |
| 2174 | toolUseContext.nestedMemoryAttachmentTriggers.size === 0 |
| 2175 | ) { |
| 2176 | return [] |
| 2177 | } |
| 2178 | |
| 2179 | const appState = toolUseContext.getAppState() |
| 2180 | const attachments: Attachment[] = [] |
| 2181 | |
| 2182 | for (const filePath of toolUseContext.nestedMemoryAttachmentTriggers) { |
| 2183 | const nestedAttachments = await getNestedMemoryAttachmentsForFile( |
| 2184 | filePath, |
| 2185 | toolUseContext, |
| 2186 | appState, |
| 2187 | ) |
| 2188 | attachments.push(...nestedAttachments) |
| 2189 | } |
| 2190 | |
| 2191 | toolUseContext.nestedMemoryAttachmentTriggers.clear() |
| 2192 | |
| 2193 | return attachments |
| 2194 | } |
| 2195 | |
| 2196 | async function getRelevantMemoryAttachments( |
| 2197 | input: string, |
no test coverage detected