feat(cli): A2A Server Primary Agent Support

- Added a new `/agents use <name>` command to allow users to set a remote agent as the primary agent for the current session.
- Implemented `A2AStreamingAdapter` to seamlessly integrate A2A server task polling with the existing CLI streaming UX.
- Mapped A2A server task status updates to Gemini `Thought` events, providing native thinking visualization in the terminal.
- Updated `nonInteractiveCli` and `useGeminiStream` to dynamically route requests through the `A2AStreamingAdapter` when a session primary agent is configured.
- Ensured context history continuity by maintaining `contextId` and `taskId` across requests within the adapter.
This commit is contained in:
Taylor Mullen
2026-02-23 16:37:37 -08:00
parent 8b1dc15182
commit 38e99a4556
23 changed files with 1395 additions and 20 deletions
+4 -1
View File
@@ -122,7 +122,10 @@ export function extractIdsFromResponse(result: Message | Task): {
let taskId: string | undefined;
if (result.kind === 'message') {
taskId = result.taskId;
// We explicitly DO NOT return the taskId for a 'message' response.
// In the A2A SDK, when a server returns a final Message instead of a Task,
// the task is implicitly complete and should not be passed to subsequent requests,
// otherwise the server will throw a TaskNotFoundError.
contextId = result.contextId;
} else if (result.kind === 'task') {
taskId = result.id;