@mailmodo/a2a 0.3.3 → 0.3.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,312 @@
1
+ import { d as A2AStreamEventData, S as SendMessageResult } from '../auth-handler-DVLcl8yj.mjs';
2
+ export { A as A2AClient, a as A2AClientOptions, b as AuthenticationHandler, H as HttpHeaders, c as createAuthenticatingFetchWithRetry } from '../auth-handler-DVLcl8yj.mjs';
3
+ import { A as AgentCard, M as MessageSendParams, d as TaskPushNotificationConfig, a8 as GetTaskPushNotificationConfigParams, L as ListTaskPushNotificationConfigParams, D as DeleteTaskPushNotificationConfigParams, i as TaskQueryParams, T as Task, f as TaskIdParams, V as PushNotificationConfig, J as JSONRPCResponse } from '../types-Due_Cv6t.mjs';
4
+
5
+ interface AgentCardResolverOptions {
6
+ path?: string;
7
+ fetchImpl?: typeof fetch;
8
+ }
9
+ declare class DefaultAgentCardResolver implements AgentCardResolver {
10
+ readonly options?: AgentCardResolverOptions;
11
+ constructor(options?: AgentCardResolverOptions);
12
+ /**
13
+ * Fetches the agent card based on provided base URL and path.
14
+ * Path is selected in the following order:
15
+ * 1) path parameter
16
+ * 2) path from options
17
+ * 3) .well-known/agent-card.json
18
+ */
19
+ resolve(baseUrl: string, path?: string): Promise<AgentCard>;
20
+ private fetchImpl;
21
+ }
22
+ interface AgentCardResolver {
23
+ /**
24
+ * Fetches the agent card based on provided base URL and path,
25
+ */
26
+ resolve(baseUrl: string, path?: string): Promise<AgentCard>;
27
+ }
28
+ declare const AgentCardResolver: {
29
+ Default: DefaultAgentCardResolver;
30
+ };
31
+
32
+ interface CallInterceptor {
33
+ /**
34
+ * Invoked before transport method.
35
+ */
36
+ before(args: BeforeArgs): Promise<void>;
37
+ /**
38
+ * Invoked after transport method.
39
+ */
40
+ after(args: AfterArgs): Promise<void>;
41
+ }
42
+ interface BeforeArgs<K extends keyof Client = keyof Client> {
43
+ /**
44
+ * Identifies the client method invoked and its payload.
45
+ * Payload inside the input object can be modified.
46
+ */
47
+ readonly input: ClientCallInput<K>;
48
+ /**
49
+ * If set by the interceptor, stops execution, invokes "after"
50
+ * for executed interceptors and returns the result. Transport is not called.
51
+ */
52
+ earlyReturn?: ClientCallResult<K>;
53
+ /**
54
+ * Options passed to the client.
55
+ */
56
+ options?: RequestOptions;
57
+ }
58
+ interface AfterArgs<K extends keyof Client = keyof Client> {
59
+ /**
60
+ * Identifies the client method invoked and its result.
61
+ * Payload inside the result object can be modified.
62
+ */
63
+ readonly result: ClientCallResult<K>;
64
+ /**
65
+ * If set by the interceptor, stops execution and returns result value,
66
+ * remaining interceptors are not executed.
67
+ */
68
+ earlyReturn?: boolean;
69
+ /**
70
+ * Options passed to the client.
71
+ */
72
+ options?: RequestOptions;
73
+ }
74
+ type ClientCallInput<K extends keyof Client = keyof Client> = MethodInput<Client, K>;
75
+ type ClientCallResult<K extends keyof Client = keyof Client> = MethodResult<Client, K, ResultsOverrides>;
76
+ /**
77
+ * For
78
+ *
79
+ * interface Foo {
80
+ * f1(arg: string): Promise<Result1>;
81
+ * f2(arg: number): Promise<Result2>;
82
+ * }
83
+ *
84
+ * MethodInputs<Foo> resolves to
85
+ *
86
+ * {
87
+ * readonly method: "f1";
88
+ * value: string;
89
+ * } | {
90
+ * readonly method: "f2";
91
+ * value: number;
92
+ * }
93
+ */
94
+ type MethodInput<T, TMembers extends keyof T = keyof T> = {
95
+ [M in TMembers]: T[M] extends (payload: infer P) => unknown ? {
96
+ readonly method: M;
97
+ value: P;
98
+ } : never;
99
+ }[TMembers];
100
+ /**
101
+ * For
102
+ *
103
+ * interface Foo {
104
+ * f1(): Promise<Result1>;
105
+ * f2(): Promise<Result2>;
106
+ * }
107
+ *
108
+ * MethodsResults<Foo> resolves to
109
+ *
110
+ * {
111
+ * readonly method: "f1";
112
+ * value: Result1;
113
+ * } | {
114
+ * readonly method: "f2";
115
+ * value: Result2;
116
+ * }
117
+ */
118
+ type MethodResult<T, TMembers extends keyof T = keyof T, TOverrides = object> = {
119
+ [M in TMembers]: M extends keyof TOverrides ? {
120
+ readonly method: M;
121
+ value: TOverrides[M];
122
+ } : T[M] extends (payload: unknown) => infer R ? {
123
+ readonly method: M;
124
+ value: Awaited<R>;
125
+ } : never;
126
+ }[TMembers];
127
+ interface ResultsOverrides {
128
+ sendMessageStream: A2AStreamEventData;
129
+ resubscribeTask: A2AStreamEventData;
130
+ }
131
+
132
+ interface Transport {
133
+ sendMessage(params: MessageSendParams, options?: RequestOptions): Promise<SendMessageResult>;
134
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
135
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
136
+ getTaskPushNotificationConfig(params: GetTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
137
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig[]>;
138
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions): Promise<void>;
139
+ getTask(params: TaskQueryParams, options?: RequestOptions): Promise<Task>;
140
+ cancelTask(params: TaskIdParams, options?: RequestOptions): Promise<Task>;
141
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
142
+ }
143
+ interface TransportFactory {
144
+ get protocolName(): string;
145
+ create(url: string, agentCard: AgentCard): Promise<Transport>;
146
+ }
147
+
148
+ interface ClientConfig {
149
+ /**
150
+ * Whether client prefers to poll for task updates instead of blocking until a terminal state is reached.
151
+ * If set to true, non-streaming send message result might be a Message or a Task in any (including non-terminal) state.
152
+ * Callers are responsible for running the polling loop. This configuration does not apply to streaming requests.
153
+ */
154
+ polling?: boolean;
155
+ /**
156
+ * Specifies the default list of accepted media types to apply for all "send message" calls.
157
+ */
158
+ acceptedOutputModes?: string[];
159
+ /**
160
+ * Specifies the default push notification configuration to apply for every Task.
161
+ */
162
+ pushNotificationConfig?: PushNotificationConfig;
163
+ /**
164
+ * Interceptors invoked for each request.
165
+ */
166
+ interceptors?: CallInterceptor[];
167
+ }
168
+ interface RequestOptions {
169
+ /**
170
+ * Signal to abort request execution.
171
+ */
172
+ signal?: AbortSignal;
173
+ /**
174
+ * Arbitrary data available to interceptors and transport implementation.
175
+ */
176
+ context?: Map<string, unknown>;
177
+ }
178
+ declare class Client {
179
+ readonly transport: Transport;
180
+ readonly agentCard: AgentCard;
181
+ readonly config?: ClientConfig;
182
+ constructor(transport: Transport, agentCard: AgentCard, config?: ClientConfig);
183
+ /**
184
+ * Sends a message to an agent to initiate a new interaction or to continue an existing one.
185
+ * Uses blocking mode by default.
186
+ */
187
+ sendMessage(params: MessageSendParams, options?: RequestOptions): Promise<SendMessageResult>;
188
+ /**
189
+ * Sends a message to an agent to initiate/continue a task AND subscribes the client to real-time updates for that task.
190
+ * Performs fallback to non-streaming if not supported by the agent.
191
+ */
192
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
193
+ /**
194
+ * Sets or updates the push notification configuration for a specified task.
195
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
196
+ */
197
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
198
+ /**
199
+ * Retrieves the current push notification configuration for a specified task.
200
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
201
+ */
202
+ getTaskPushNotificationConfig(params: TaskIdParams, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
203
+ /**
204
+ * Retrieves the associated push notification configurations for a specified task.
205
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
206
+ */
207
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig[]>;
208
+ /**
209
+ * Deletes an associated push notification configuration for a task.
210
+ */
211
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions): Promise<void>;
212
+ /**
213
+ * Retrieves the current state (including status, artifacts, and optionally history) of a previously initiated task.
214
+ */
215
+ getTask(params: TaskQueryParams, options?: RequestOptions): Promise<Task>;
216
+ /**
217
+ * Requests the cancellation of an ongoing task. The server will attempt to cancel the task,
218
+ * but success is not guaranteed (e.g., the task might have already completed or failed, or cancellation might not be supported at its current stage).
219
+ */
220
+ cancelTask(params: TaskIdParams, options?: RequestOptions): Promise<Task>;
221
+ /**
222
+ * Allows a client to reconnect to an updates stream for an ongoing task after a previous connection was interrupted.
223
+ */
224
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
225
+ private applyClientConfig;
226
+ private executeWithInterceptors;
227
+ private interceptBefore;
228
+ private interceptAfter;
229
+ }
230
+
231
+ type TransportProtocolName = 'JSONRPC' | 'HTTP+JSON' | 'GRPC' | (string & {});
232
+
233
+ interface JsonRpcTransportOptions {
234
+ endpoint: string;
235
+ fetchImpl?: typeof fetch;
236
+ }
237
+ declare class JsonRpcTransport implements Transport {
238
+ private readonly customFetchImpl?;
239
+ private readonly endpoint;
240
+ private requestIdCounter;
241
+ constructor(options: JsonRpcTransportOptions);
242
+ sendMessage(params: MessageSendParams, options?: RequestOptions, idOverride?: number): Promise<SendMessageResult>;
243
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
244
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig>;
245
+ getTaskPushNotificationConfig(params: GetTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig>;
246
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig[]>;
247
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<void>;
248
+ getTask(params: TaskQueryParams, options?: RequestOptions, idOverride?: number): Promise<Task>;
249
+ cancelTask(params: TaskIdParams, options?: RequestOptions, idOverride?: number): Promise<Task>;
250
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
251
+ callExtensionMethod<TExtensionParams, TExtensionResponse extends JSONRPCResponse>(method: string, params: TExtensionParams, idOverride: number, options?: RequestOptions): Promise<TExtensionResponse>;
252
+ private _fetch;
253
+ private _sendRpcRequest;
254
+ private _fetchRpc;
255
+ private _sendStreamingRequest;
256
+ private _parseA2ASseStream;
257
+ private _processSseEventData;
258
+ private static mapToError;
259
+ }
260
+ declare class JsonRpcTransportFactoryOptions {
261
+ fetchImpl?: typeof fetch;
262
+ }
263
+ declare class JsonRpcTransportFactory implements TransportFactory {
264
+ private readonly options?;
265
+ static readonly name: TransportProtocolName;
266
+ constructor(options?: JsonRpcTransportFactoryOptions);
267
+ get protocolName(): string;
268
+ create(url: string, _agentCard: AgentCard): Promise<Transport>;
269
+ }
270
+
271
+ interface ClientFactoryOptions {
272
+ /**
273
+ * Transport factories to use.
274
+ * Effectively defines transports supported by this client factory.
275
+ */
276
+ transports: ReadonlyArray<TransportFactory>;
277
+ /**
278
+ * Client config to be used for clients created by this factory.
279
+ */
280
+ clientConfig?: ClientConfig;
281
+ /**
282
+ * Transport preferences to override ones defined by the agent card.
283
+ * If no matches are found among preferred transports, agent card values are used next.
284
+ */
285
+ preferredTransports?: TransportProtocolName[];
286
+ /**
287
+ * Used for createFromAgentCardUrl to download agent card.
288
+ */
289
+ cardResolver?: AgentCardResolver;
290
+ }
291
+ declare const ClientFactoryOptions: {
292
+ Default: {
293
+ transports: JsonRpcTransportFactory[];
294
+ };
295
+ };
296
+ declare class ClientFactory {
297
+ readonly options: ClientFactoryOptions;
298
+ private readonly transportsByName;
299
+ private readonly agentCardResolver;
300
+ constructor(options?: ClientFactoryOptions);
301
+ /**
302
+ * Creates a new client from the provided agent card.
303
+ */
304
+ createFromAgentCard(agentCard: AgentCard): Promise<Client>;
305
+ /**
306
+ * Downloads agent card using AgentCardResolver from options
307
+ * and creates a new client from the downloaded card.
308
+ */
309
+ createFromAgentCardUrl(baseUrl: string, path?: string): Promise<Client>;
310
+ }
311
+
312
+ export { type AfterArgs, AgentCardResolver, type AgentCardResolverOptions, type BeforeArgs, type CallInterceptor, Client, type ClientCallInput, type ClientCallResult, type ClientConfig, ClientFactory, ClientFactoryOptions, DefaultAgentCardResolver, JsonRpcTransport, JsonRpcTransportFactory, type JsonRpcTransportOptions, type RequestOptions, type Transport, type TransportFactory };
@@ -0,0 +1,312 @@
1
+ import { d as A2AStreamEventData, S as SendMessageResult } from '../auth-handler-Gzpf3xHC.js';
2
+ export { A as A2AClient, a as A2AClientOptions, b as AuthenticationHandler, H as HttpHeaders, c as createAuthenticatingFetchWithRetry } from '../auth-handler-Gzpf3xHC.js';
3
+ import { A as AgentCard, M as MessageSendParams, d as TaskPushNotificationConfig, a8 as GetTaskPushNotificationConfigParams, L as ListTaskPushNotificationConfigParams, D as DeleteTaskPushNotificationConfigParams, i as TaskQueryParams, T as Task, f as TaskIdParams, V as PushNotificationConfig, J as JSONRPCResponse } from '../types-Due_Cv6t.js';
4
+
5
+ interface AgentCardResolverOptions {
6
+ path?: string;
7
+ fetchImpl?: typeof fetch;
8
+ }
9
+ declare class DefaultAgentCardResolver implements AgentCardResolver {
10
+ readonly options?: AgentCardResolverOptions;
11
+ constructor(options?: AgentCardResolverOptions);
12
+ /**
13
+ * Fetches the agent card based on provided base URL and path.
14
+ * Path is selected in the following order:
15
+ * 1) path parameter
16
+ * 2) path from options
17
+ * 3) .well-known/agent-card.json
18
+ */
19
+ resolve(baseUrl: string, path?: string): Promise<AgentCard>;
20
+ private fetchImpl;
21
+ }
22
+ interface AgentCardResolver {
23
+ /**
24
+ * Fetches the agent card based on provided base URL and path,
25
+ */
26
+ resolve(baseUrl: string, path?: string): Promise<AgentCard>;
27
+ }
28
+ declare const AgentCardResolver: {
29
+ Default: DefaultAgentCardResolver;
30
+ };
31
+
32
+ interface CallInterceptor {
33
+ /**
34
+ * Invoked before transport method.
35
+ */
36
+ before(args: BeforeArgs): Promise<void>;
37
+ /**
38
+ * Invoked after transport method.
39
+ */
40
+ after(args: AfterArgs): Promise<void>;
41
+ }
42
+ interface BeforeArgs<K extends keyof Client = keyof Client> {
43
+ /**
44
+ * Identifies the client method invoked and its payload.
45
+ * Payload inside the input object can be modified.
46
+ */
47
+ readonly input: ClientCallInput<K>;
48
+ /**
49
+ * If set by the interceptor, stops execution, invokes "after"
50
+ * for executed interceptors and returns the result. Transport is not called.
51
+ */
52
+ earlyReturn?: ClientCallResult<K>;
53
+ /**
54
+ * Options passed to the client.
55
+ */
56
+ options?: RequestOptions;
57
+ }
58
+ interface AfterArgs<K extends keyof Client = keyof Client> {
59
+ /**
60
+ * Identifies the client method invoked and its result.
61
+ * Payload inside the result object can be modified.
62
+ */
63
+ readonly result: ClientCallResult<K>;
64
+ /**
65
+ * If set by the interceptor, stops execution and returns result value,
66
+ * remaining interceptors are not executed.
67
+ */
68
+ earlyReturn?: boolean;
69
+ /**
70
+ * Options passed to the client.
71
+ */
72
+ options?: RequestOptions;
73
+ }
74
+ type ClientCallInput<K extends keyof Client = keyof Client> = MethodInput<Client, K>;
75
+ type ClientCallResult<K extends keyof Client = keyof Client> = MethodResult<Client, K, ResultsOverrides>;
76
+ /**
77
+ * For
78
+ *
79
+ * interface Foo {
80
+ * f1(arg: string): Promise<Result1>;
81
+ * f2(arg: number): Promise<Result2>;
82
+ * }
83
+ *
84
+ * MethodInputs<Foo> resolves to
85
+ *
86
+ * {
87
+ * readonly method: "f1";
88
+ * value: string;
89
+ * } | {
90
+ * readonly method: "f2";
91
+ * value: number;
92
+ * }
93
+ */
94
+ type MethodInput<T, TMembers extends keyof T = keyof T> = {
95
+ [M in TMembers]: T[M] extends (payload: infer P) => unknown ? {
96
+ readonly method: M;
97
+ value: P;
98
+ } : never;
99
+ }[TMembers];
100
+ /**
101
+ * For
102
+ *
103
+ * interface Foo {
104
+ * f1(): Promise<Result1>;
105
+ * f2(): Promise<Result2>;
106
+ * }
107
+ *
108
+ * MethodsResults<Foo> resolves to
109
+ *
110
+ * {
111
+ * readonly method: "f1";
112
+ * value: Result1;
113
+ * } | {
114
+ * readonly method: "f2";
115
+ * value: Result2;
116
+ * }
117
+ */
118
+ type MethodResult<T, TMembers extends keyof T = keyof T, TOverrides = object> = {
119
+ [M in TMembers]: M extends keyof TOverrides ? {
120
+ readonly method: M;
121
+ value: TOverrides[M];
122
+ } : T[M] extends (payload: unknown) => infer R ? {
123
+ readonly method: M;
124
+ value: Awaited<R>;
125
+ } : never;
126
+ }[TMembers];
127
+ interface ResultsOverrides {
128
+ sendMessageStream: A2AStreamEventData;
129
+ resubscribeTask: A2AStreamEventData;
130
+ }
131
+
132
+ interface Transport {
133
+ sendMessage(params: MessageSendParams, options?: RequestOptions): Promise<SendMessageResult>;
134
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
135
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
136
+ getTaskPushNotificationConfig(params: GetTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
137
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig[]>;
138
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions): Promise<void>;
139
+ getTask(params: TaskQueryParams, options?: RequestOptions): Promise<Task>;
140
+ cancelTask(params: TaskIdParams, options?: RequestOptions): Promise<Task>;
141
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
142
+ }
143
+ interface TransportFactory {
144
+ get protocolName(): string;
145
+ create(url: string, agentCard: AgentCard): Promise<Transport>;
146
+ }
147
+
148
+ interface ClientConfig {
149
+ /**
150
+ * Whether client prefers to poll for task updates instead of blocking until a terminal state is reached.
151
+ * If set to true, non-streaming send message result might be a Message or a Task in any (including non-terminal) state.
152
+ * Callers are responsible for running the polling loop. This configuration does not apply to streaming requests.
153
+ */
154
+ polling?: boolean;
155
+ /**
156
+ * Specifies the default list of accepted media types to apply for all "send message" calls.
157
+ */
158
+ acceptedOutputModes?: string[];
159
+ /**
160
+ * Specifies the default push notification configuration to apply for every Task.
161
+ */
162
+ pushNotificationConfig?: PushNotificationConfig;
163
+ /**
164
+ * Interceptors invoked for each request.
165
+ */
166
+ interceptors?: CallInterceptor[];
167
+ }
168
+ interface RequestOptions {
169
+ /**
170
+ * Signal to abort request execution.
171
+ */
172
+ signal?: AbortSignal;
173
+ /**
174
+ * Arbitrary data available to interceptors and transport implementation.
175
+ */
176
+ context?: Map<string, unknown>;
177
+ }
178
+ declare class Client {
179
+ readonly transport: Transport;
180
+ readonly agentCard: AgentCard;
181
+ readonly config?: ClientConfig;
182
+ constructor(transport: Transport, agentCard: AgentCard, config?: ClientConfig);
183
+ /**
184
+ * Sends a message to an agent to initiate a new interaction or to continue an existing one.
185
+ * Uses blocking mode by default.
186
+ */
187
+ sendMessage(params: MessageSendParams, options?: RequestOptions): Promise<SendMessageResult>;
188
+ /**
189
+ * Sends a message to an agent to initiate/continue a task AND subscribes the client to real-time updates for that task.
190
+ * Performs fallback to non-streaming if not supported by the agent.
191
+ */
192
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
193
+ /**
194
+ * Sets or updates the push notification configuration for a specified task.
195
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
196
+ */
197
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
198
+ /**
199
+ * Retrieves the current push notification configuration for a specified task.
200
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
201
+ */
202
+ getTaskPushNotificationConfig(params: TaskIdParams, options?: RequestOptions): Promise<TaskPushNotificationConfig>;
203
+ /**
204
+ * Retrieves the associated push notification configurations for a specified task.
205
+ * Requires the server to have AgentCard.capabilities.pushNotifications: true.
206
+ */
207
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions): Promise<TaskPushNotificationConfig[]>;
208
+ /**
209
+ * Deletes an associated push notification configuration for a task.
210
+ */
211
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions): Promise<void>;
212
+ /**
213
+ * Retrieves the current state (including status, artifacts, and optionally history) of a previously initiated task.
214
+ */
215
+ getTask(params: TaskQueryParams, options?: RequestOptions): Promise<Task>;
216
+ /**
217
+ * Requests the cancellation of an ongoing task. The server will attempt to cancel the task,
218
+ * but success is not guaranteed (e.g., the task might have already completed or failed, or cancellation might not be supported at its current stage).
219
+ */
220
+ cancelTask(params: TaskIdParams, options?: RequestOptions): Promise<Task>;
221
+ /**
222
+ * Allows a client to reconnect to an updates stream for an ongoing task after a previous connection was interrupted.
223
+ */
224
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
225
+ private applyClientConfig;
226
+ private executeWithInterceptors;
227
+ private interceptBefore;
228
+ private interceptAfter;
229
+ }
230
+
231
+ type TransportProtocolName = 'JSONRPC' | 'HTTP+JSON' | 'GRPC' | (string & {});
232
+
233
+ interface JsonRpcTransportOptions {
234
+ endpoint: string;
235
+ fetchImpl?: typeof fetch;
236
+ }
237
+ declare class JsonRpcTransport implements Transport {
238
+ private readonly customFetchImpl?;
239
+ private readonly endpoint;
240
+ private requestIdCounter;
241
+ constructor(options: JsonRpcTransportOptions);
242
+ sendMessage(params: MessageSendParams, options?: RequestOptions, idOverride?: number): Promise<SendMessageResult>;
243
+ sendMessageStream(params: MessageSendParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
244
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig>;
245
+ getTaskPushNotificationConfig(params: GetTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig>;
246
+ listTaskPushNotificationConfig(params: ListTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<TaskPushNotificationConfig[]>;
247
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, options?: RequestOptions, idOverride?: number): Promise<void>;
248
+ getTask(params: TaskQueryParams, options?: RequestOptions, idOverride?: number): Promise<Task>;
249
+ cancelTask(params: TaskIdParams, options?: RequestOptions, idOverride?: number): Promise<Task>;
250
+ resubscribeTask(params: TaskIdParams, options?: RequestOptions): AsyncGenerator<A2AStreamEventData, void, undefined>;
251
+ callExtensionMethod<TExtensionParams, TExtensionResponse extends JSONRPCResponse>(method: string, params: TExtensionParams, idOverride: number, options?: RequestOptions): Promise<TExtensionResponse>;
252
+ private _fetch;
253
+ private _sendRpcRequest;
254
+ private _fetchRpc;
255
+ private _sendStreamingRequest;
256
+ private _parseA2ASseStream;
257
+ private _processSseEventData;
258
+ private static mapToError;
259
+ }
260
+ declare class JsonRpcTransportFactoryOptions {
261
+ fetchImpl?: typeof fetch;
262
+ }
263
+ declare class JsonRpcTransportFactory implements TransportFactory {
264
+ private readonly options?;
265
+ static readonly name: TransportProtocolName;
266
+ constructor(options?: JsonRpcTransportFactoryOptions);
267
+ get protocolName(): string;
268
+ create(url: string, _agentCard: AgentCard): Promise<Transport>;
269
+ }
270
+
271
+ interface ClientFactoryOptions {
272
+ /**
273
+ * Transport factories to use.
274
+ * Effectively defines transports supported by this client factory.
275
+ */
276
+ transports: ReadonlyArray<TransportFactory>;
277
+ /**
278
+ * Client config to be used for clients created by this factory.
279
+ */
280
+ clientConfig?: ClientConfig;
281
+ /**
282
+ * Transport preferences to override ones defined by the agent card.
283
+ * If no matches are found among preferred transports, agent card values are used next.
284
+ */
285
+ preferredTransports?: TransportProtocolName[];
286
+ /**
287
+ * Used for createFromAgentCardUrl to download agent card.
288
+ */
289
+ cardResolver?: AgentCardResolver;
290
+ }
291
+ declare const ClientFactoryOptions: {
292
+ Default: {
293
+ transports: JsonRpcTransportFactory[];
294
+ };
295
+ };
296
+ declare class ClientFactory {
297
+ readonly options: ClientFactoryOptions;
298
+ private readonly transportsByName;
299
+ private readonly agentCardResolver;
300
+ constructor(options?: ClientFactoryOptions);
301
+ /**
302
+ * Creates a new client from the provided agent card.
303
+ */
304
+ createFromAgentCard(agentCard: AgentCard): Promise<Client>;
305
+ /**
306
+ * Downloads agent card using AgentCardResolver from options
307
+ * and creates a new client from the downloaded card.
308
+ */
309
+ createFromAgentCardUrl(baseUrl: string, path?: string): Promise<Client>;
310
+ }
311
+
312
+ export { type AfterArgs, AgentCardResolver, type AgentCardResolverOptions, type BeforeArgs, type CallInterceptor, Client, type ClientCallInput, type ClientCallResult, type ClientConfig, ClientFactory, ClientFactoryOptions, DefaultAgentCardResolver, JsonRpcTransport, JsonRpcTransportFactory, type JsonRpcTransportOptions, type RequestOptions, type Transport, type TransportFactory };