(path, prefix)
| 821 | function reactionOf(action, returned, mentioned, earlier = []) { |
| 822 | const { name, input } = action; |
| 823 | const readOf = (path, prefix) => { |
| 824 | const base = normPath(path).split('/').pop() || String(path ?? ''); |
| 825 | if (returned.some((r) => samePath(path, r))) return { bucket: 'read_returned', next: `${prefix}Read ${base}` }; |
| 826 | if (earlier.some((r) => samePath(path, r))) return { bucket: 'read_returned', next: `${prefix}Read ${base} (returned by an earlier explore)` }; |
| 827 | const named = mentioned.some((m) => samePath(path, m)); |
| 828 | return { bucket: 'read_missed', next: `${prefix}Read ${base}${named ? ' (named, not returned)' : ''}`, named }; |
| 829 | }; |
| 830 | if (/codegraph/.test(name)) return { bucket: 'explore_again', next: name.replace(/^mcp__[^_]*__/, '') }; |
| 831 | if (name === 'Read' || name === 'NotebookRead') return readOf(input.file_path ?? input.notebook_path, ''); |
| 832 | if (name === 'Grep' || name === 'Glob') return { bucket: 'search', next: name }; |
no test coverage detected