* Processes paths that need nested memory attachments and checks for nested CLAUDE.md files * Uses nestedMemoryAttachmentTriggers field from ToolUseContext
( toolUseContext: ToolUseContext, )
| 2217 | * Uses nestedMemoryAttachmentTriggers field from ToolUseContext |
| 2218 | */ |
| 2219 | async function getNestedMemoryAttachments( |
| 2220 | toolUseContext: ToolUseContext, |
| 2221 | ): Promise<Attachment[]> { |
| 2222 | // Check triggers first — getAppState() waits for a React render cycle, |
| 2223 | // and the common case is an empty trigger set. |
| 2224 | if ( |
| 2225 | !toolUseContext.nestedMemoryAttachmentTriggers || |
| 2226 | toolUseContext.nestedMemoryAttachmentTriggers.size === 0 |
| 2227 | ) { |
| 2228 | return [] |
| 2229 | } |
| 2230 | |
| 2231 | const appState = toolUseContext.getAppState() |
| 2232 | const attachments: Attachment[] = [] |
| 2233 | |
| 2234 | for (const filePath of toolUseContext.nestedMemoryAttachmentTriggers) { |
| 2235 | const nestedAttachments = await getNestedMemoryAttachmentsForFile( |
| 2236 | filePath, |
| 2237 | toolUseContext, |
| 2238 | appState, |
| 2239 | ) |
| 2240 | attachments.push(...nestedAttachments) |
| 2241 | } |
| 2242 | |
| 2243 | toolUseContext.nestedMemoryAttachmentTriggers.clear() |
| 2244 | |
| 2245 | return attachments |
| 2246 | } |
| 2247 | |
| 2248 | async function getRelevantMemoryAttachments( |
| 2249 | input: string, |
no test coverage detected