fix(agents-md): use `require.resolve()` to get the installed `next` version (#89166)
### Why?
When the package.json has Next.js version with a tag instead of a
specific version, e.g., `"next": "canary"`, it received an error:
```
Failed to pull docs: Could not find documentation for Next.js vcanary. This version may not exist on GitHub yet.
```
### How?
Modified logic to get version to use `require.resolve()`.
#### Before
https://github.com/user-attachments/assets/487d0404-ad81-4c5c-a341-cab9a0e03020
#### After
https://github.com/user-attachments/assets/4153873f-681f-4c46-8ee0-ee7913749b7b