feat(core): differentiate User-Agent for a2a-server and ACP clients (#22059)

This commit is contained in:
Bryan Morgan
2026-03-11 22:31:59 -04:00
committed by GitHub
parent f090736ebc
commit 949e85ca55
12 changed files with 277 additions and 4 deletions
+15
View File
@@ -140,6 +140,21 @@ describe('detectIde', () => {
expect(detectIde(ideProcessInfo)).toBe(IDE_DEFINITIONS.antigravity);
});
it('should detect Zed via ZED_SESSION_ID', () => {
vi.stubEnv('ZED_SESSION_ID', 'test-session-id');
expect(detectIde(ideProcessInfo)).toBe(IDE_DEFINITIONS.zed);
});
it('should detect Zed via TERM_PROGRAM', () => {
vi.stubEnv('TERM_PROGRAM', 'Zed');
expect(detectIde(ideProcessInfo)).toBe(IDE_DEFINITIONS.zed);
});
it('should detect XCode via XCODE_VERSION_ACTUAL', () => {
vi.stubEnv('XCODE_VERSION_ACTUAL', '1500');
expect(detectIde(ideProcessInfo)).toBe(IDE_DEFINITIONS.xcode);
});
it('should detect JetBrains IDE via TERMINAL_EMULATOR', () => {
vi.stubEnv('TERMINAL_EMULATOR', 'JetBrains-JediTerm');
expect(detectIde(ideProcessInfo)).toBe(IDE_DEFINITIONS.jetbrains);
+12 -1
View File
@@ -27,6 +27,8 @@ export const IDE_DEFINITIONS = {
rustrover: { name: 'rustrover', displayName: 'RustRover' },
datagrip: { name: 'datagrip', displayName: 'DataGrip' },
phpstorm: { name: 'phpstorm', displayName: 'PhpStorm' },
zed: { name: 'zed', displayName: 'Zed' },
xcode: { name: 'xcode', displayName: 'XCode' },
} as const;
export interface IdeInfo {
@@ -75,6 +77,12 @@ export function detectIdeFromEnv(): IdeInfo {
if (process.env['TERM_PROGRAM'] === 'sublime') {
return IDE_DEFINITIONS.sublimetext;
}
if (process.env['ZED_SESSION_ID'] || process.env['TERM_PROGRAM'] === 'Zed') {
return IDE_DEFINITIONS.zed;
}
if (process.env['XCODE_VERSION_ACTUAL']) {
return IDE_DEFINITIONS.xcode;
}
if (isJetBrains()) {
return IDE_DEFINITIONS.jetbrains;
}
@@ -147,10 +155,13 @@ export function detectIde(
};
}
// Only VS Code, Sublime Text and JetBrains integrations are currently supported.
// Only VS Code, Sublime Text, JetBrains, Zed, and XCode integrations are currently supported.
if (
process.env['TERM_PROGRAM'] !== 'vscode' &&
process.env['TERM_PROGRAM'] !== 'sublime' &&
process.env['TERM_PROGRAM'] !== 'Zed' &&
!process.env['ZED_SESSION_ID'] &&
!process.env['XCODE_VERSION_ACTUAL'] &&
!isJetBrains()
) {
return undefined;