diff --git a/.changes/unreleased/Fixed and Improvements-20260428-092408.yaml b/.changes/unreleased/Fixed and Improvements-20260428-092408.yaml new file mode 100644 index 000000000000..dc5f0eccf8e0 --- /dev/null +++ b/.changes/unreleased/Fixed and Improvements-20260428-092408.yaml @@ -0,0 +1,3 @@ +kind: Fixed and Improvements +body: Do not send tabby/chat LSP Feature to clients that cannot support it +time: 2026-04-28T09:24:08.662286918-04:00 diff --git a/clients/tabby-agent/src/chat/index.ts b/clients/tabby-agent/src/chat/index.ts index 40356e141cef..4933b798094d 100644 --- a/clients/tabby-agent/src/chat/index.ts +++ b/clients/tabby-agent/src/chat/index.ts @@ -4,6 +4,7 @@ import type { ServerCapabilities } from "../protocol"; import type { Feature } from "../feature"; import type { TabbyApiClient } from "../http/tabbyApiClient"; import { ChatFeatures } from "../protocol"; +import { getClientType } from "../utils/clientType"; export class ChatFeature extends EventEmitter implements Feature { private isApiAvailable = false; @@ -41,7 +42,7 @@ export class ChatFeature extends EventEmitter implements Feature { } private async syncFeatureRegistration(connection: Connection) { - if (this.isApiAvailable) { + if (this.isApiAvailable && getClientType(this.tabbyApiClient.getClientInfo()) === "vscode") { if (!this.featureRegistration) { try { this.featureRegistration = await connection.client.register(ChatFeatures.type); diff --git a/clients/tabby-agent/src/http/tabbyApiClient.ts b/clients/tabby-agent/src/http/tabbyApiClient.ts index 921f1d9338f0..e98d4f685d69 100644 --- a/clients/tabby-agent/src/http/tabbyApiClient.ts +++ b/clients/tabby-agent/src/http/tabbyApiClient.ts @@ -37,6 +37,7 @@ export class TabbyApiClient extends EventEmitter { private readonly logger = getLogger("TabbyApiClient"); private userAgentString: string | undefined = undefined; + private clientInfo: ClientInfo | undefined = undefined; private api: ReturnType> | undefined; private endpoint: string | undefined = undefined; @@ -60,6 +61,7 @@ export class TabbyApiClient extends EventEmitter { async initialize(clientInfo: ClientInfo | undefined) { this.userAgentString = this.buildUserAgentString(clientInfo); + this.clientInfo = clientInfo; this.connect(); // no await this.configurations.on("updated", (config: ConfigData, oldConfig: ConfigData) => { @@ -155,6 +157,10 @@ export class TabbyApiClient extends EventEmitter { return this.serverHealth; } + getClientInfo(): ClientInfo | undefined { + return this.clientInfo; + } + async connect(options: { skipReset?: boolean } = {}): Promise { if (!options.skipReset) { this.connectionErrorMessage = undefined; diff --git a/clients/tabby-agent/src/telemetry.ts b/clients/tabby-agent/src/telemetry.ts index 85619a5b86b4..c6f15a82565f 100644 --- a/clients/tabby-agent/src/telemetry.ts +++ b/clients/tabby-agent/src/telemetry.ts @@ -13,6 +13,7 @@ import { isBrowser } from "./env"; import { ProxyConfig, createProxyForUrl } from "./http/proxy"; import { getLogger } from "./logger"; import { isBlank } from "./utils/string"; +import { getClientType } from "./utils/clientType"; export class AnonymousUsageLogger { private readonly logger = getLogger("Telemetry"); @@ -121,7 +122,7 @@ export class AnonymousUsageLogger { } private updateUserProperties(clientInfo: ClientInfo | undefined, clientProvidedConfig: ClientProvidedConfig) { - const clientType = this.getClientType(clientInfo); + const clientType = getClientType(clientInfo); const properties = { [clientType]: { triggerMode: clientProvidedConfig?.inlineCompletion?.triggerMode, @@ -150,18 +151,4 @@ export class AnonymousUsageLogger { this.clientInfoProperties = properties; } } - - private getClientType(clientInfo: ClientInfo | undefined): string { - if (!clientInfo) { - return "unknown"; - } - if (clientInfo.tabbyPlugin?.name.includes("vscode")) { - return "vscode"; - } else if (clientInfo.tabbyPlugin?.name.includes("intellij")) { - return "intellij"; - } else if (clientInfo.tabbyPlugin?.name.includes("vim")) { - return "vim"; - } - return clientInfo.name; - } } diff --git a/clients/tabby-agent/src/utils/clientType.ts b/clients/tabby-agent/src/utils/clientType.ts new file mode 100644 index 000000000000..2dfe5ae2417c --- /dev/null +++ b/clients/tabby-agent/src/utils/clientType.ts @@ -0,0 +1,17 @@ +import type { ClientInfo } from "../protocol"; + +export type ClientType = "vscode" | "intellij" | "vim" | "unknown"; + +export function getClientType(clientInfo: ClientInfo | undefined): ClientType { + const pluginName = clientInfo?.tabbyPlugin?.name ?? ""; + if (pluginName.includes("vscode")) { + return "vscode"; + } + if (pluginName.includes("intellij")) { + return "intellij"; + } + if (pluginName.includes("vim")) { + return "vim"; + } + return "unknown"; +}