Skip to content

refactor: define and export helper API for Extensions#251

Merged
ishymko merged 2 commits intomainfrom
ishymko/extensions-api
Dec 10, 2025
Merged

refactor: define and export helper API for Extensions#251
ishymko merged 2 commits intomainfrom
ishymko/extensions-api

Conversation

@ishymko
Copy link
Member

@ishymko ishymko commented Dec 10, 2025

Description

Define types and utility functions for extensions to export for external usage and share between client and server.

Re #218 #219

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ishymko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the management of A2A protocol extensions by introducing explicit ExtensionId and ExtensionIds types, along with a set of utility functions. This change aims to provide a more robust and consistent way to handle extension identifiers across both client and server components, improving type safety and simplifying the logic for processing extension-related service parameters.

Highlights

  • New Extension Types: Introduced ExtensionId (a string alias) and ExtensionIds (an array of ExtensionId) to standardize how A2A protocol extensions are represented.
  • Extension Utility Functions: Added a new ExtensionIds object with static methods for creating, parsing from service parameters, and converting ExtensionIds to service parameter strings.
  • Refactored Extension Handling: Updated client-side withA2AExtensions and server-side ServerCallContext to leverage the new ExtensionIds types and utility functions, replacing previous Set<string> usage.
  • Improved Service Parameter Parsing: The server-side handlers (JSON-RPC and REST) now use ExtensionIds.parseServiceParameter to correctly interpret the HTTP_EXTENSION_HEADER.
  • Dedicated Test Coverage: A new test file test/extensions.spec.ts has been added to ensure the correctness of the new ExtensionIds utility functions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ishymko ishymko force-pushed the ishymko/extensions-api branch from cd98511 to b52fe04 Compare December 10, 2025 14:32
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the handling of A2A protocol extension identifiers by introducing dedicated types (ExtensionId, ExtensionIds) and a set of utility functions. This improves type safety and centralizes the logic for parsing and formatting extension headers. The changes are applied consistently across client and server-side code, including service parameter creation, context management, and request handlers. The tests are also updated and expanded to cover the new utilities.

My review focuses on a couple of critical runtime errors due to unhandled undefined values from request headers, and some suggestions to improve code clarity and maintainability.

@ishymko ishymko force-pushed the ishymko/extensions-api branch 2 times, most recently from a79f8de to dfb41df Compare December 10, 2025 14:36
@ishymko
Copy link
Member Author

ishymko commented Dec 10, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a dedicated ExtensionId type and an ExtensionIds utility object to manage A2A protocol extensions. This refactoring centralizes the logic for parsing, serializing, and managing extension identifiers, improving type safety and code organization. The changes are consistently applied across the client and server components, and new unit tests have been added to ensure the correctness of the ExtensionIds utility. The removal of the getRequestedExtensions utility from src/server/utils.ts and its replacement with the new ExtensionIds.parseServiceParameter is a good cleanup.

@ishymko ishymko force-pushed the ishymko/extensions-api branch from dfb41df to 1655f24 Compare December 10, 2025 14:43
@ishymko ishymko force-pushed the ishymko/extensions-api branch from 1655f24 to d002f97 Compare December 10, 2025 14:48
@ishymko ishymko changed the title refactor: define ExtensionId(s) refactor: define helper API for Extensions Dec 10, 2025
@ishymko ishymko changed the title refactor: define helper API for Extensions refactor: define and export helper API for Extensions Dec 10, 2025
@ishymko ishymko force-pushed the ishymko/extensions-api branch from 342309e to d2545ba Compare December 10, 2025 15:38
@ishymko ishymko force-pushed the ishymko/extensions-api branch from d2545ba to 907dcf8 Compare December 10, 2025 15:47
@ishymko ishymko enabled auto-merge (squash) December 10, 2025 15:48
@ishymko ishymko merged commit 6a3bc0b into main Dec 10, 2025
6 checks passed
@ishymko ishymko deleted the ishymko/extensions-api branch December 10, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants