@a2a-js/sdk 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,374 @@
1
+ // src/client/client.ts
2
+ var A2AClient = class _A2AClient {
3
+ agentBaseUrl;
4
+ agentCardPath;
5
+ agentCardPromise;
6
+ static DEFAULT_AGENT_CARD_PATH = ".well-known/agent.json";
7
+ requestIdCounter = 1;
8
+ serviceEndpointUrl;
9
+ // To be populated from AgentCard after fetching
10
+ /**
11
+ * Constructs an A2AClient instance.
12
+ * It initiates fetching the agent card from the provided agent baseUrl.
13
+ * The Agent Card is fetched from a path relative to the agentBaseUrl, which defaults to '.well-known/agent.json'.
14
+ * The `url` field from the Agent Card will be used as the RPC service endpoint.
15
+ * @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com)
16
+ * @param agentCardPath path to the agent card, defaults to .well-known/agent.json
17
+ */
18
+ constructor(agentBaseUrl, agentCardPath = _A2AClient.DEFAULT_AGENT_CARD_PATH) {
19
+ this.agentBaseUrl = agentBaseUrl.replace(/\/$/, "");
20
+ this.agentCardPath = agentCardPath.replace(/^\//, "");
21
+ this.agentCardPromise = this._fetchAndCacheAgentCard();
22
+ }
23
+ /**
24
+ * Fetches the Agent Card from the agent's well-known URI and caches its service endpoint URL.
25
+ * This method is called by the constructor.
26
+ * @returns A Promise that resolves to the AgentCard.
27
+ */
28
+ async _fetchAndCacheAgentCard() {
29
+ const agentCardUrl = `${this.agentBaseUrl}/${this.agentCardPath}`;
30
+ try {
31
+ const response = await fetch(agentCardUrl, {
32
+ headers: { "Accept": "application/json" }
33
+ });
34
+ if (!response.ok) {
35
+ throw new Error(`Failed to fetch Agent Card from ${agentCardUrl}: ${response.status} ${response.statusText}`);
36
+ }
37
+ const agentCard = await response.json();
38
+ if (!agentCard.url) {
39
+ throw new Error("Fetched Agent Card does not contain a valid 'url' for the service endpoint.");
40
+ }
41
+ this.serviceEndpointUrl = agentCard.url;
42
+ return agentCard;
43
+ } catch (error) {
44
+ console.error("Error fetching or parsing Agent Card:");
45
+ throw error;
46
+ }
47
+ }
48
+ /**
49
+ * Retrieves the Agent Card.
50
+ * If an `agentBaseUrl` is provided, it fetches the card from that specific URL.
51
+ * Otherwise, it returns the card fetched and cached during client construction.
52
+ * @param agentBaseUrl Optional. The base URL of the agent to fetch the card from.
53
+ * @param agentCardPath path to the agent card, defaults to .well-known/agent.json
54
+ * If provided, this will fetch a new card, not use the cached one from the constructor's URL.
55
+ * @returns A Promise that resolves to the AgentCard.
56
+ */
57
+ async getAgentCard(agentBaseUrl, agentCardPath = _A2AClient.DEFAULT_AGENT_CARD_PATH) {
58
+ if (agentBaseUrl) {
59
+ const agentCardUrl = `${agentBaseUrl.replace(/\/$/, "")}/${agentCardPath.replace(/^\//, "")}`;
60
+ const response = await fetch(agentCardUrl, {
61
+ headers: { "Accept": "application/json" }
62
+ });
63
+ if (!response.ok) {
64
+ throw new Error(`Failed to fetch Agent Card from ${agentCardUrl}: ${response.status} ${response.statusText}`);
65
+ }
66
+ return await response.json();
67
+ }
68
+ return this.agentCardPromise;
69
+ }
70
+ /**
71
+ * Gets the RPC service endpoint URL. Ensures the agent card has been fetched first.
72
+ * @returns A Promise that resolves to the service endpoint URL string.
73
+ */
74
+ async _getServiceEndpoint() {
75
+ if (this.serviceEndpointUrl) {
76
+ return this.serviceEndpointUrl;
77
+ }
78
+ await this.agentCardPromise;
79
+ if (!this.serviceEndpointUrl) {
80
+ throw new Error("Agent Card URL for RPC endpoint is not available. Fetching might have failed.");
81
+ }
82
+ return this.serviceEndpointUrl;
83
+ }
84
+ /**
85
+ * Helper method to make a generic JSON-RPC POST request.
86
+ * @param method The RPC method name.
87
+ * @param params The parameters for the RPC method.
88
+ * @returns A Promise that resolves to the RPC response.
89
+ */
90
+ async _postRpcRequest(method, params) {
91
+ const endpoint = await this._getServiceEndpoint();
92
+ const requestId = this.requestIdCounter++;
93
+ const rpcRequest = {
94
+ jsonrpc: "2.0",
95
+ method,
96
+ params,
97
+ // Cast because TParams structure varies per method
98
+ id: requestId
99
+ };
100
+ const httpResponse = await fetch(endpoint, {
101
+ method: "POST",
102
+ headers: {
103
+ "Content-Type": "application/json",
104
+ "Accept": "application/json"
105
+ // Expect JSON response for non-streaming requests
106
+ },
107
+ body: JSON.stringify(rpcRequest)
108
+ });
109
+ if (!httpResponse.ok) {
110
+ let errorBodyText = "(empty or non-JSON response)";
111
+ try {
112
+ errorBodyText = await httpResponse.text();
113
+ const errorJson = JSON.parse(errorBodyText);
114
+ if (!errorJson.jsonrpc && errorJson.error) {
115
+ throw new Error(`RPC error for ${method}: ${errorJson.error.message} (Code: ${errorJson.error.code}, HTTP Status: ${httpResponse.status}) Data: ${JSON.stringify(errorJson.error.data || {})}`);
116
+ } else if (!errorJson.jsonrpc) {
117
+ throw new Error(`HTTP error for ${method}! Status: ${httpResponse.status} ${httpResponse.statusText}. Response: ${errorBodyText}`);
118
+ }
119
+ } catch (e) {
120
+ if (e.message.startsWith("RPC error for") || e.message.startsWith("HTTP error for")) throw e;
121
+ throw new Error(`HTTP error for ${method}! Status: ${httpResponse.status} ${httpResponse.statusText}. Response: ${errorBodyText}`);
122
+ }
123
+ }
124
+ const rpcResponse = await httpResponse.json();
125
+ if (rpcResponse.id !== requestId) {
126
+ console.error(`CRITICAL: RPC response ID mismatch for method ${method}. Expected ${requestId}, got ${rpcResponse.id}. This may lead to incorrect response handling.`);
127
+ }
128
+ return rpcResponse;
129
+ }
130
+ /**
131
+ * Sends a message to the agent.
132
+ * The behavior (blocking/non-blocking) and push notification configuration
133
+ * are specified within the `params.configuration` object.
134
+ * Optionally, `params.message.contextId` or `params.message.taskId` can be provided.
135
+ * @param params The parameters for sending the message, including the message content and configuration.
136
+ * @returns A Promise resolving to SendMessageResponse, which can be a Message, Task, or an error.
137
+ */
138
+ async sendMessage(params) {
139
+ return this._postRpcRequest("message/send", params);
140
+ }
141
+ /**
142
+ * Sends a message to the agent and streams back responses using Server-Sent Events (SSE).
143
+ * Push notification configuration can be specified in `params.configuration`.
144
+ * Optionally, `params.message.contextId` or `params.message.taskId` can be provided.
145
+ * Requires the agent to support streaming (`capabilities.streaming: true` in AgentCard).
146
+ * @param params The parameters for sending the message.
147
+ * @returns An AsyncGenerator yielding A2AStreamEventData (Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent).
148
+ * The generator throws an error if streaming is not supported or if an HTTP/SSE error occurs.
149
+ */
150
+ async *sendMessageStream(params) {
151
+ const agentCard = await this.agentCardPromise;
152
+ if (!agentCard.capabilities?.streaming) {
153
+ throw new Error("Agent does not support streaming (AgentCard.capabilities.streaming is not true).");
154
+ }
155
+ const endpoint = await this._getServiceEndpoint();
156
+ const clientRequestId = this.requestIdCounter++;
157
+ const rpcRequest = {
158
+ // This is the initial JSON-RPC request to establish the stream
159
+ jsonrpc: "2.0",
160
+ method: "message/stream",
161
+ params,
162
+ id: clientRequestId
163
+ };
164
+ const response = await fetch(endpoint, {
165
+ method: "POST",
166
+ headers: {
167
+ "Content-Type": "application/json",
168
+ "Accept": "text/event-stream"
169
+ // Crucial for SSE
170
+ },
171
+ body: JSON.stringify(rpcRequest)
172
+ });
173
+ if (!response.ok) {
174
+ let errorBody = "";
175
+ try {
176
+ errorBody = await response.text();
177
+ const errorJson = JSON.parse(errorBody);
178
+ if (errorJson.error) {
179
+ throw new Error(`HTTP error establishing stream for message/stream: ${response.status} ${response.statusText}. RPC Error: ${errorJson.error.message} (Code: ${errorJson.error.code})`);
180
+ }
181
+ } catch (e) {
182
+ if (e.message.startsWith("HTTP error establishing stream")) throw e;
183
+ throw new Error(`HTTP error establishing stream for message/stream: ${response.status} ${response.statusText}. Response: ${errorBody || "(empty)"}`);
184
+ }
185
+ throw new Error(`HTTP error establishing stream for message/stream: ${response.status} ${response.statusText}`);
186
+ }
187
+ if (!response.headers.get("Content-Type")?.startsWith("text/event-stream")) {
188
+ throw new Error("Invalid response Content-Type for SSE stream. Expected 'text/event-stream'.");
189
+ }
190
+ yield* this._parseA2ASseStream(response, clientRequestId);
191
+ }
192
+ /**
193
+ * Sets or updates the push notification configuration for a given task.
194
+ * Requires the agent to support push notifications (`capabilities.pushNotifications: true` in AgentCard).
195
+ * @param params Parameters containing the taskId and the TaskPushNotificationConfig.
196
+ * @returns A Promise resolving to SetTaskPushNotificationConfigResponse.
197
+ */
198
+ async setTaskPushNotificationConfig(params) {
199
+ const agentCard = await this.agentCardPromise;
200
+ if (!agentCard.capabilities?.pushNotifications) {
201
+ throw new Error("Agent does not support push notifications (AgentCard.capabilities.pushNotifications is not true).");
202
+ }
203
+ return this._postRpcRequest(
204
+ "tasks/pushNotificationConfig/set",
205
+ params
206
+ );
207
+ }
208
+ /**
209
+ * Gets the push notification configuration for a given task.
210
+ * @param params Parameters containing the taskId.
211
+ * @returns A Promise resolving to GetTaskPushNotificationConfigResponse.
212
+ */
213
+ async getTaskPushNotificationConfig(params) {
214
+ return this._postRpcRequest(
215
+ "tasks/pushNotificationConfig/get",
216
+ params
217
+ );
218
+ }
219
+ /**
220
+ * Retrieves a task by its ID.
221
+ * @param params Parameters containing the taskId and optional historyLength.
222
+ * @returns A Promise resolving to GetTaskResponse, which contains the Task object or an error.
223
+ */
224
+ async getTask(params) {
225
+ return this._postRpcRequest("tasks/get", params);
226
+ }
227
+ /**
228
+ * Cancels a task by its ID.
229
+ * @param params Parameters containing the taskId.
230
+ * @returns A Promise resolving to CancelTaskResponse, which contains the updated Task object or an error.
231
+ */
232
+ async cancelTask(params) {
233
+ return this._postRpcRequest("tasks/cancel", params);
234
+ }
235
+ /**
236
+ * Resubscribes to a task's event stream using Server-Sent Events (SSE).
237
+ * This is used if a previous SSE connection for an active task was broken.
238
+ * Requires the agent to support streaming (`capabilities.streaming: true` in AgentCard).
239
+ * @param params Parameters containing the taskId.
240
+ * @returns An AsyncGenerator yielding A2AStreamEventData (Message, Task, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent).
241
+ */
242
+ async *resubscribeTask(params) {
243
+ const agentCard = await this.agentCardPromise;
244
+ if (!agentCard.capabilities?.streaming) {
245
+ throw new Error("Agent does not support streaming (required for tasks/resubscribe).");
246
+ }
247
+ const endpoint = await this._getServiceEndpoint();
248
+ const clientRequestId = this.requestIdCounter++;
249
+ const rpcRequest = {
250
+ // Initial JSON-RPC request to establish the stream
251
+ jsonrpc: "2.0",
252
+ method: "tasks/resubscribe",
253
+ params,
254
+ id: clientRequestId
255
+ };
256
+ const response = await fetch(endpoint, {
257
+ method: "POST",
258
+ headers: {
259
+ "Content-Type": "application/json",
260
+ "Accept": "text/event-stream"
261
+ },
262
+ body: JSON.stringify(rpcRequest)
263
+ });
264
+ if (!response.ok) {
265
+ let errorBody = "";
266
+ try {
267
+ errorBody = await response.text();
268
+ const errorJson = JSON.parse(errorBody);
269
+ if (errorJson.error) {
270
+ throw new Error(`HTTP error establishing stream for tasks/resubscribe: ${response.status} ${response.statusText}. RPC Error: ${errorJson.error.message} (Code: ${errorJson.error.code})`);
271
+ }
272
+ } catch (e) {
273
+ if (e.message.startsWith("HTTP error establishing stream")) throw e;
274
+ throw new Error(`HTTP error establishing stream for tasks/resubscribe: ${response.status} ${response.statusText}. Response: ${errorBody || "(empty)"}`);
275
+ }
276
+ throw new Error(`HTTP error establishing stream for tasks/resubscribe: ${response.status} ${response.statusText}`);
277
+ }
278
+ if (!response.headers.get("Content-Type")?.startsWith("text/event-stream")) {
279
+ throw new Error("Invalid response Content-Type for SSE stream on resubscribe. Expected 'text/event-stream'.");
280
+ }
281
+ yield* this._parseA2ASseStream(response, clientRequestId);
282
+ }
283
+ /**
284
+ * Parses an HTTP response body as an A2A Server-Sent Event stream.
285
+ * Each 'data' field of an SSE event is expected to be a JSON-RPC 2.0 Response object,
286
+ * specifically a SendStreamingMessageResponse (or similar structure for resubscribe).
287
+ * @param response The HTTP Response object whose body is the SSE stream.
288
+ * @param originalRequestId The ID of the client's JSON-RPC request that initiated this stream.
289
+ * Used to validate the `id` in the streamed JSON-RPC responses.
290
+ * @returns An AsyncGenerator yielding the `result` field of each valid JSON-RPC success response from the stream.
291
+ */
292
+ async *_parseA2ASseStream(response, originalRequestId) {
293
+ if (!response.body) {
294
+ throw new Error("SSE response body is undefined. Cannot read stream.");
295
+ }
296
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
297
+ let buffer = "";
298
+ let eventDataBuffer = "";
299
+ try {
300
+ while (true) {
301
+ const { done, value } = await reader.read();
302
+ if (done) {
303
+ if (eventDataBuffer.trim()) {
304
+ const result = this._processSseEventData(eventDataBuffer, originalRequestId);
305
+ yield result;
306
+ }
307
+ break;
308
+ }
309
+ buffer += value;
310
+ let lineEndIndex;
311
+ while ((lineEndIndex = buffer.indexOf("\n")) >= 0) {
312
+ const line = buffer.substring(0, lineEndIndex).trim();
313
+ buffer = buffer.substring(lineEndIndex + 1);
314
+ if (line === "") {
315
+ if (eventDataBuffer) {
316
+ const result = this._processSseEventData(eventDataBuffer, originalRequestId);
317
+ yield result;
318
+ eventDataBuffer = "";
319
+ }
320
+ } else if (line.startsWith("data:")) {
321
+ eventDataBuffer += line.substring(5).trimStart() + "\n";
322
+ } else if (line.startsWith(":")) {
323
+ } else if (line.includes(":")) {
324
+ }
325
+ }
326
+ }
327
+ } catch (error) {
328
+ console.error("Error reading or parsing SSE stream:", error.message);
329
+ throw error;
330
+ } finally {
331
+ reader.releaseLock();
332
+ }
333
+ }
334
+ /**
335
+ * Processes a single SSE event's data string, expecting it to be a JSON-RPC response.
336
+ * @param jsonData The string content from one or more 'data:' lines of an SSE event.
337
+ * @param originalRequestId The ID of the client's request that initiated the stream.
338
+ * @returns The `result` field of the parsed JSON-RPC success response.
339
+ * @throws Error if data is not valid JSON, not a valid JSON-RPC response, an error response, or ID mismatch.
340
+ */
341
+ _processSseEventData(jsonData, originalRequestId) {
342
+ if (!jsonData.trim()) {
343
+ throw new Error("Attempted to process empty SSE event data.");
344
+ }
345
+ try {
346
+ const sseJsonRpcResponse = JSON.parse(jsonData.replace(/\n$/, ""));
347
+ const a2aStreamResponse = sseJsonRpcResponse;
348
+ if (a2aStreamResponse.id !== originalRequestId) {
349
+ console.warn(`SSE Event's JSON-RPC response ID mismatch. Client request ID: ${originalRequestId}, event response ID: ${a2aStreamResponse.id}.`);
350
+ }
351
+ if (this.isErrorResponse(a2aStreamResponse)) {
352
+ const err = a2aStreamResponse.error;
353
+ throw new Error(`SSE event contained an error: ${err.message} (Code: ${err.code}) Data: ${JSON.stringify(err.data || {})}`);
354
+ }
355
+ if (!("result" in a2aStreamResponse) || typeof a2aStreamResponse.result === "undefined") {
356
+ throw new Error(`SSE event JSON-RPC response is missing 'result' field. Data: ${jsonData}`);
357
+ }
358
+ const successResponse = a2aStreamResponse;
359
+ return successResponse.result;
360
+ } catch (e) {
361
+ if (e.message.startsWith("SSE event contained an error") || e.message.startsWith("SSE event JSON-RPC response is missing 'result' field")) {
362
+ throw e;
363
+ }
364
+ console.error("Failed to parse SSE event data string or unexpected JSON-RPC structure:", jsonData, e);
365
+ throw new Error(`Failed to parse SSE event data: "${jsonData.substring(0, 100)}...". Original error: ${e.message}`);
366
+ }
367
+ }
368
+ isErrorResponse(response) {
369
+ return "error" in response;
370
+ }
371
+ };
372
+ export {
373
+ A2AClient
374
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/index.ts
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
@@ -0,0 +1,9 @@
1
+ import { S as SendMessageResponse, k as SendStreamingMessageResponse, h as GetTaskResponse, C as CancelTaskResponse, e as SetTaskPushNotificationConfigResponse, G as GetTaskPushNotificationConfigResponse, i as JSONRPCErrorResponse } from './types-CcBgkR2G.cjs';
2
+ export { l as A2AError, m as A2ARequest, a0 as APIKeySecurityScheme, a1 as AgentCapabilities, a3 as AgentCapabilities1, A as AgentCard, a2 as AgentExtension, a4 as AgentProvider, ae as AgentProvider1, ad as AgentSkill, af as Artifact, ay as Artifact1, a8 as AuthorizationCodeOAuthFlow, ag as AuthorizationCodeOAuthFlow1, V as CancelTaskRequest, ah as CancelTaskSuccessResponse, a9 as ClientCredentialsOAuthFlow, al as ClientCredentialsOAuthFlow1, x as ContentTypeNotSupportedError, N as DataPart, am as FileBase, H as FilePart, K as FileWithBytes, L as FileWithUri, Y as GetTaskPushNotificationConfigRequest, an as GetTaskPushNotificationConfigSuccessResponse, R as GetTaskRequest, ap as GetTaskSuccessResponse, a5 as HTTPAuthSecurityScheme, aa as ImplicitOAuthFlow, ar as ImplicitOAuthFlow1, t as InternalError, y as InvalidAgentResponseError, s as InvalidParamsError, I as InvalidRequestError, q as JSONParseError, j as JSONRPCError, as as JSONRPCMessage, at as JSONRPCRequest, J as JSONRPCResponse, aB as JSONRPCSuccessResponse, a as Message, ai as Message1, ak as Message2, B as MessageSendConfiguration, aC as MessageSendConfiguration1, M as MessageSendParams, Q as MessageSendParams1, aD as MessageSendParams2, r as MethodNotFoundError, p as MySchema, a6 as OAuth2SecurityScheme, a7 as OAuthFlows, aE as OAuthFlows1, ac as OpenIdConnectSecurityScheme, P as Part, aF as PartBase, ab as PasswordOAuthFlow, aG as PasswordOAuthFlow1, E as PushNotificationAuthenticationInfo, D as PushNotificationConfig, X as PushNotificationConfig1, aH as PushNotificationConfig2, w as PushNotificationNotSupportedError, n as SecurityScheme, aI as SecuritySchemeBase, z as SendMessageRequest, au as SendMessageSuccessResponse, O as SendStreamingMessageRequest, aw as SendStreamingMessageSuccessResponse, W as SetTaskPushNotificationConfigRequest, az as SetTaskPushNotificationConfigSuccessResponse, T as Task, aq as Task1, av as Task2, c as TaskArtifactUpdateEvent, f as TaskIdParams, Z as TaskIdParams1, $ as TaskIdParams2, aJ as TaskIdParams3, v as TaskNotCancelableError, u as TaskNotFoundError, d as TaskPushNotificationConfig, ao as TaskPushNotificationConfig1, aA as TaskPushNotificationConfig2, aK as TaskPushNotificationConfig3, g as TaskQueryParams, aL as TaskQueryParams1, _ as TaskResubscriptionRequest, o as TaskState, aj as TaskStatus, ax as TaskStatus1, aM as TaskStatus2, b as TaskStatusUpdateEvent, F as TextPart, U as UnsupportedOperationError } from './types-CcBgkR2G.cjs';
3
+
4
+ /**
5
+ * Represents any valid JSON-RPC response defined in the A2A protocol.
6
+ */
7
+ type A2AResponse = SendMessageResponse | SendStreamingMessageResponse | GetTaskResponse | CancelTaskResponse | SetTaskPushNotificationConfigResponse | GetTaskPushNotificationConfigResponse | JSONRPCErrorResponse;
8
+
9
+ export { type A2AResponse, CancelTaskResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, JSONRPCErrorResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse };
@@ -0,0 +1,9 @@
1
+ import { S as SendMessageResponse, k as SendStreamingMessageResponse, h as GetTaskResponse, C as CancelTaskResponse, e as SetTaskPushNotificationConfigResponse, G as GetTaskPushNotificationConfigResponse, i as JSONRPCErrorResponse } from './types-CcBgkR2G.js';
2
+ export { l as A2AError, m as A2ARequest, a0 as APIKeySecurityScheme, a1 as AgentCapabilities, a3 as AgentCapabilities1, A as AgentCard, a2 as AgentExtension, a4 as AgentProvider, ae as AgentProvider1, ad as AgentSkill, af as Artifact, ay as Artifact1, a8 as AuthorizationCodeOAuthFlow, ag as AuthorizationCodeOAuthFlow1, V as CancelTaskRequest, ah as CancelTaskSuccessResponse, a9 as ClientCredentialsOAuthFlow, al as ClientCredentialsOAuthFlow1, x as ContentTypeNotSupportedError, N as DataPart, am as FileBase, H as FilePart, K as FileWithBytes, L as FileWithUri, Y as GetTaskPushNotificationConfigRequest, an as GetTaskPushNotificationConfigSuccessResponse, R as GetTaskRequest, ap as GetTaskSuccessResponse, a5 as HTTPAuthSecurityScheme, aa as ImplicitOAuthFlow, ar as ImplicitOAuthFlow1, t as InternalError, y as InvalidAgentResponseError, s as InvalidParamsError, I as InvalidRequestError, q as JSONParseError, j as JSONRPCError, as as JSONRPCMessage, at as JSONRPCRequest, J as JSONRPCResponse, aB as JSONRPCSuccessResponse, a as Message, ai as Message1, ak as Message2, B as MessageSendConfiguration, aC as MessageSendConfiguration1, M as MessageSendParams, Q as MessageSendParams1, aD as MessageSendParams2, r as MethodNotFoundError, p as MySchema, a6 as OAuth2SecurityScheme, a7 as OAuthFlows, aE as OAuthFlows1, ac as OpenIdConnectSecurityScheme, P as Part, aF as PartBase, ab as PasswordOAuthFlow, aG as PasswordOAuthFlow1, E as PushNotificationAuthenticationInfo, D as PushNotificationConfig, X as PushNotificationConfig1, aH as PushNotificationConfig2, w as PushNotificationNotSupportedError, n as SecurityScheme, aI as SecuritySchemeBase, z as SendMessageRequest, au as SendMessageSuccessResponse, O as SendStreamingMessageRequest, aw as SendStreamingMessageSuccessResponse, W as SetTaskPushNotificationConfigRequest, az as SetTaskPushNotificationConfigSuccessResponse, T as Task, aq as Task1, av as Task2, c as TaskArtifactUpdateEvent, f as TaskIdParams, Z as TaskIdParams1, $ as TaskIdParams2, aJ as TaskIdParams3, v as TaskNotCancelableError, u as TaskNotFoundError, d as TaskPushNotificationConfig, ao as TaskPushNotificationConfig1, aA as TaskPushNotificationConfig2, aK as TaskPushNotificationConfig3, g as TaskQueryParams, aL as TaskQueryParams1, _ as TaskResubscriptionRequest, o as TaskState, aj as TaskStatus, ax as TaskStatus1, aM as TaskStatus2, b as TaskStatusUpdateEvent, F as TextPart, U as UnsupportedOperationError } from './types-CcBgkR2G.js';
3
+
4
+ /**
5
+ * Represents any valid JSON-RPC response defined in the A2A protocol.
6
+ */
7
+ type A2AResponse = SendMessageResponse | SendStreamingMessageResponse | GetTaskResponse | CancelTaskResponse | SetTaskPushNotificationConfigResponse | GetTaskPushNotificationConfigResponse | JSONRPCErrorResponse;
8
+
9
+ export { type A2AResponse, CancelTaskResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, JSONRPCErrorResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse };
package/dist/index.js ADDED
File without changes