feat: Add general IDE info to User-Agent for Tabby clients
This addresses the remaining part of the issue mentioned in #2581.
- Retrieve client info based on the client configuration during client initialization.
Example User-Agent format:
Node.js/v20.9.0 Visual-Studio-Code-desktop/1.91.1 TabbyML.vscode-tabby/1.8.0-dev
Should I do another PR for intellij? or I can put them together
This PR is waiting for #2766
@Sma1lboy Thanks for your PR!
As we are using the standard user-agent header, it would be better to follow this format, so that we can extend a standard user-agent parser to parse it on the server-side.
My suggestions:
Node.js/v18.18.2 (Linux 5.15.0-117-generic; linux x64) TabbyAgent/1.8.0-dev Visual-Studio-Code/1.92.0 TabbyML.vscode-tabby/1.8.2
- Node/Browser
- For Node.js:
Node.js/${nodejsVersion} (${osType} ${osRelease}; ${osPlatform} ${osArch}) - For Browser, use value of:
navigator.userAgent
- For Node.js:
- tabby-agent:
TabbyAgent/${tabbyAgentVersion}, likeTabbyAgent/1.8.0-dev - IDE:
${ideName}/${ideVersion}, replace spaces with-, likeVisual-Studio-Code/1.92.0 - Tabby IDE extension/plugin:
${pluginName}/${pluginVersion}, likeTabbyML.vscode-tabby/1.8.2
@wsxiaoys for review.
Sure, I'll take a look tonight
@icycodes Thanks for your suggestions. I've realized that most of my previous code was focused on creating a parameter for ideInfo that could be transmitted by the client. It wasn't until I read the section of the code about lifecycle that I discovered this process had already been written there. :( I deleted the unnecessary code and cleaned up the user agent format. By the way, if I want to get the current version of the user agent, do I need to read the package.json? I haven't found any code that stores "packagejson" context.
if I want to get the current version of the user agent, do I need to read the package.json? I haven't found any code that stores "packagejson" context.
Simply import the "package.json" should be ok. Here is an example.