feat(a2a): add gRPC V1 support and robust agent card normalization

This consolidated commit implements comprehensive gRPC V1 support for A2A agents while maintaining high standards for type safety and encapsulation:

- gRPC V1 Protocol Bridge: Implemented a direct gRPC implementation in 'v1-bridge.ts' to support the V1 protocol ('tenant' at Tag 1, 'Message' at Tag 2). Fixed request mapping to avoid nested object issues and correctly handle streaming responses.
- Robust Card Normalization: Refactored 'a2aUtils.ts' to preserve all original agent card fields (ensuring SDK compatibility) while safely normalizing 'protocolBinding' to 'transport' for gRPC discovery.
- Orchestration Clean-up: Refactored 'A2AClientManager' to use high-level delegation, extracting SDK and V1-specific logic into clean helper methods. Removed all 'eslint-disable' markers through robust type guards and explicit object construction.
- Registry Stability: Refined 'AgentRegistry' to use the canonical agent name as the storage key, ensuring consistency even when local overrides are applied.
- Infrastructure: Integrated UndiciAgent with 30-minute timeouts for remote agent tasks and improved agent card URL resolution.
- Validation: Added a real-world integration test against a local Go server. Verified with 75 tests passing project-wide.
This commit is contained in:
Alisa Novikova
2026-03-05 01:09:28 -08:00
parent 3d4956aa57
commit 22f7ec0227
12 changed files with 1111 additions and 227 deletions
+2
View File
@@ -109,6 +109,8 @@ export async function loadConfig(
interactive: !isHeadlessMode(),
enableInteractiveShell: !isHeadlessMode(),
ptyInfo: 'auto',
enableAgents: settings.experimental?.enableAgents ?? true,
agents: settings.agents,
};
const fileService = new FileDiscoveryService(workspaceDir, {
@@ -14,6 +14,7 @@ import {
getErrorMessage,
type TelemetrySettings,
homedir,
type AgentSettings,
} from '@google/gemini-cli-core';
import stripJsonComments from 'strip-json-comments';
@@ -45,6 +46,10 @@ export interface Settings {
enableRecursiveFileSearch?: boolean;
customIgnoreFilePaths?: string[];
};
experimental?: {
enableAgents?: boolean;
};
agents?: AgentSettings;
}
export interface SettingsError {