File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,28 +47,18 @@ def create_from(
4747
4848
4949def with_a2a_extensions (extensions : list [str ]) -> ServiceParametersUpdate :
50- """Create a ServiceParametersUpdate that adds A2A extensions .
50+ """Create a ServiceParametersUpdate that merges A2A extension URIs .
5151
52- Merges the supplied URIs with any extensions already present in the
53- A2A-Extensions service parameter, deduplicating and producing a stable
54- (sorted) order. Calling this multiple times in a chain accumulates the
55- requested extensions instead of overwriting prior values.
56-
57- Args:
58- extensions: List of extension URIs to advertise.
59-
60- Returns:
61- A function that updates ServiceParameters with the extensions header.
52+ Unions the supplied URIs with any already present in the A2A-Extensions
53+ parameter, deduplicating and emitting them in sorted order. Repeated
54+ calls accumulate rather than overwrite.
6255 """
6356
6457 def update (parameters : ServiceParameters ) -> None :
6558 if not extensions :
6659 return
67- existing = parameters .get (HTTP_EXTENSION_HEADER )
68- merged = sorted (
69- get_requested_extensions ([existing ] if existing else [])
70- | set (extensions )
71- )
60+ existing = parameters .get (HTTP_EXTENSION_HEADER , '' )
61+ merged = sorted (get_requested_extensions ([existing , * extensions ]))
7262 parameters [HTTP_EXTENSION_HEADER ] = ',' .join (merged )
7363
7464 return update
You can’t perform that action at this time.
0 commit comments