tabby icon indicating copy to clipboard operation
tabby copied to clipboard

feat: Add general IDE info to User-Agent for Tabby clients

Open Sma1lboy opened this issue 1 year ago • 5 comments

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

Sma1lboy avatar Aug 03 '24 10:08 Sma1lboy

Should I do another PR for intellij? or I can put them together

This PR is waiting for #2766

Sma1lboy avatar Aug 03 '24 11:08 Sma1lboy

@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

  1. Node/Browser
    • For Node.js: Node.js/${nodejsVersion} (${osType} ${osRelease}; ${osPlatform} ${osArch})
    • For Browser, use value of: navigator.userAgent
  2. tabby-agent: TabbyAgent/${tabbyAgentVersion}, like TabbyAgent/1.8.0-dev
  3. IDE: ${ideName}/${ideVersion}, replace spaces with -, like Visual-Studio-Code/1.92.0
  4. Tabby IDE extension/plugin: ${pluginName}/${pluginVersion}, like TabbyML.vscode-tabby/1.8.2

@wsxiaoys for review.

icycodes avatar Aug 05 '24 05:08 icycodes

Sure, I'll take a look tonight

Sma1lboy avatar Aug 06 '24 06:08 Sma1lboy

@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.

Sma1lboy avatar Aug 07 '24 08:08 Sma1lboy

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.

icycodes avatar Aug 07 '24 08:08 icycodes