@a2a-js/sdk 0.2.1
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.
- package/LICENSE +202 -0
- package/README.md +422 -0
- package/build/src/a2a_response.d.ts +5 -0
- package/build/src/a2a_response.js +2 -0
- package/build/src/client/client.d.ts +118 -0
- package/build/src/client/client.js +409 -0
- package/build/src/index.d.ts +21 -0
- package/build/src/index.js +18 -0
- package/build/src/samples/agents/movie-agent/genkit.d.ts +2 -0
- package/build/src/samples/agents/movie-agent/genkit.js +11 -0
- package/build/src/samples/agents/movie-agent/index.d.ts +1 -0
- package/build/src/samples/agents/movie-agent/index.js +252 -0
- package/build/src/samples/agents/movie-agent/tmdb.d.ts +7 -0
- package/build/src/samples/agents/movie-agent/tmdb.js +32 -0
- package/build/src/samples/agents/movie-agent/tools.d.ts +15 -0
- package/build/src/samples/agents/movie-agent/tools.js +74 -0
- package/build/src/samples/cli.d.ts +2 -0
- package/build/src/samples/cli.js +289 -0
- package/build/src/server/a2a_express_app.d.ts +14 -0
- package/build/src/server/a2a_express_app.js +98 -0
- package/build/src/server/agent_execution/agent_executor.d.ts +18 -0
- package/build/src/server/agent_execution/agent_executor.js +2 -0
- package/build/src/server/agent_execution/request_context.d.ts +9 -0
- package/build/src/server/agent_execution/request_context.js +15 -0
- package/build/src/server/error.d.ts +23 -0
- package/build/src/server/error.js +57 -0
- package/build/src/server/events/execution_event_bus.d.ts +16 -0
- package/build/src/server/events/execution_event_bus.js +13 -0
- package/build/src/server/events/execution_event_bus_manager.d.ts +27 -0
- package/build/src/server/events/execution_event_bus_manager.js +36 -0
- package/build/src/server/events/execution_event_queue.d.ts +24 -0
- package/build/src/server/events/execution_event_queue.js +63 -0
- package/build/src/server/request_handler/a2a_request_handler.d.ts +11 -0
- package/build/src/server/request_handler/a2a_request_handler.js +2 -0
- package/build/src/server/request_handler/default_request_handler.d.ts +22 -0
- package/build/src/server/request_handler/default_request_handler.js +296 -0
- package/build/src/server/result_manager.d.ts +29 -0
- package/build/src/server/result_manager.js +149 -0
- package/build/src/server/store.d.ts +25 -0
- package/build/src/server/store.js +17 -0
- package/build/src/server/transports/jsonrpc_transport_handler.d.ts +15 -0
- package/build/src/server/transports/jsonrpc_transport_handler.js +114 -0
- package/build/src/server/utils.d.ts +22 -0
- package/build/src/server/utils.js +34 -0
- package/build/src/types-old.d.ts +832 -0
- package/build/src/types-old.js +20 -0
- package/build/src/types.d.ts +2046 -0
- package/build/src/types.js +8 -0
- package/package.json +52 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title A2A
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Represents the service provider of an agent.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentProvider {
|
|
8
|
+
/** Agent provider's organization name. */
|
|
9
|
+
organization: string;
|
|
10
|
+
/** Agent provider's URL. */
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Defines optional capabilities supported by an agent.
|
|
15
|
+
*/
|
|
16
|
+
export interface AgentCapabilities {
|
|
17
|
+
/** true if the agent supports SSE. */
|
|
18
|
+
streaming?: boolean;
|
|
19
|
+
/** true if the agent can notify updates to client. */
|
|
20
|
+
pushNotifications?: boolean;
|
|
21
|
+
/** true if the agent exposes status change history for tasks. */
|
|
22
|
+
stateTransitionHistory?: boolean;
|
|
23
|
+
/** extensions supported by this agent. */
|
|
24
|
+
extensions?: AgentExtension[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A declaration of an extension supported by an Agent.
|
|
28
|
+
*/
|
|
29
|
+
export interface AgentExtension {
|
|
30
|
+
/** The URI of the extension. */
|
|
31
|
+
uri: string;
|
|
32
|
+
/** A description of how this agent uses this extension. */
|
|
33
|
+
description?: string;
|
|
34
|
+
/** Whether the client must follow specific requirements of the extension. */
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Optional configuration for the extension. */
|
|
37
|
+
params?: {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents a unit of capability that an agent can perform.
|
|
43
|
+
*/
|
|
44
|
+
export interface AgentSkill {
|
|
45
|
+
/** Unique identifier for the agent's skill. */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Human readable name of the skill. */
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Description of the skill - will be used by the client or a human
|
|
51
|
+
* as a hint to understand what the skill does.
|
|
52
|
+
*/
|
|
53
|
+
description: string;
|
|
54
|
+
/**
|
|
55
|
+
* Set of tagwords describing classes of capabilities for this specific skill.
|
|
56
|
+
* @example ["cooking", "customer support", "billing"]
|
|
57
|
+
*/
|
|
58
|
+
tags: string[];
|
|
59
|
+
/**
|
|
60
|
+
* The set of example scenarios that the skill can perform.
|
|
61
|
+
* Will be used by the client as a hint to understand how the skill can be used.
|
|
62
|
+
* @example ["I need a recipe for bread"]
|
|
63
|
+
*/
|
|
64
|
+
examples?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* The set of interaction modes that the skill supports
|
|
67
|
+
* (if different than the default).
|
|
68
|
+
* Supported media types for input.
|
|
69
|
+
*/
|
|
70
|
+
inputModes?: string[];
|
|
71
|
+
/** Supported media types for output. */
|
|
72
|
+
outputModes?: string[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* An AgentCard conveys key information:
|
|
76
|
+
* - Overall details (version, name, description, uses)
|
|
77
|
+
* - Skills: A set of capabilities the agent can perform
|
|
78
|
+
* - Default modalities/content types supported by the agent.
|
|
79
|
+
* - Authentication requirements
|
|
80
|
+
*/
|
|
81
|
+
export interface AgentCard {
|
|
82
|
+
/**
|
|
83
|
+
* Human readable name of the agent.
|
|
84
|
+
* @example "Recipe Agent"
|
|
85
|
+
*/
|
|
86
|
+
name: string;
|
|
87
|
+
/**
|
|
88
|
+
* A human-readable description of the agent. Used to assist users and
|
|
89
|
+
* other agents in understanding what the agent can do.
|
|
90
|
+
* @example "Agent that helps users with recipes and cooking."
|
|
91
|
+
*/
|
|
92
|
+
description: string;
|
|
93
|
+
/** A URL to the address the agent is hosted at. */
|
|
94
|
+
url: string;
|
|
95
|
+
/** A URL to an icon for the agent. */
|
|
96
|
+
iconUrl?: string;
|
|
97
|
+
/** The service provider of the agent */
|
|
98
|
+
provider?: AgentProvider;
|
|
99
|
+
/**
|
|
100
|
+
* The version of the agent - format is up to the provider.
|
|
101
|
+
* @example "1.0.0"
|
|
102
|
+
*/
|
|
103
|
+
version: string;
|
|
104
|
+
/** A URL to documentation for the agent. */
|
|
105
|
+
documentationUrl?: string;
|
|
106
|
+
/** Optional capabilities supported by the agent. */
|
|
107
|
+
capabilities: AgentCapabilities;
|
|
108
|
+
/** Security scheme details used for authenticating with this agent. */
|
|
109
|
+
securitySchemes?: {
|
|
110
|
+
[scheme: string]: SecurityScheme;
|
|
111
|
+
};
|
|
112
|
+
/** Security requirements for contacting the agent. */
|
|
113
|
+
security?: {
|
|
114
|
+
[scheme: string]: string[];
|
|
115
|
+
}[];
|
|
116
|
+
/**
|
|
117
|
+
* The set of interaction modes that the agent supports across all skills. This can be overridden per-skill.
|
|
118
|
+
* Supported media types for input.
|
|
119
|
+
*/
|
|
120
|
+
defaultInputModes: string[];
|
|
121
|
+
/** Supported media types for output. */
|
|
122
|
+
defaultOutputModes: string[];
|
|
123
|
+
/** Skills are a unit of capability that an agent can perform. */
|
|
124
|
+
skills: AgentSkill[];
|
|
125
|
+
/**
|
|
126
|
+
* true if the agent supports providing an extended agent card when the user is authenticated.
|
|
127
|
+
* Defaults to false if not specified.
|
|
128
|
+
*/
|
|
129
|
+
supportsAuthenticatedExtendedCard?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface Task {
|
|
132
|
+
/** Unique identifier for the task */
|
|
133
|
+
id: string;
|
|
134
|
+
/** Server-generated id for contextual alignment across interactions */
|
|
135
|
+
contextId: string;
|
|
136
|
+
/** Current status of the task */
|
|
137
|
+
status: TaskStatus;
|
|
138
|
+
history?: Message[];
|
|
139
|
+
/** Collection of artifacts created by the agent. */
|
|
140
|
+
artifacts?: Artifact[];
|
|
141
|
+
/** Extension metadata. */
|
|
142
|
+
metadata?: {
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
};
|
|
145
|
+
/** Event type */
|
|
146
|
+
kind: "task";
|
|
147
|
+
}
|
|
148
|
+
/** TaskState and accompanying message. */
|
|
149
|
+
export interface TaskStatus {
|
|
150
|
+
state: TaskState;
|
|
151
|
+
/** Additional status updates for client */
|
|
152
|
+
message?: Message;
|
|
153
|
+
/**
|
|
154
|
+
* ISO 8601 datetime string when the status was recorded.
|
|
155
|
+
* @example "2023-10-27T10:00:00Z"
|
|
156
|
+
* */
|
|
157
|
+
timestamp?: string;
|
|
158
|
+
}
|
|
159
|
+
/** Sent by server during sendStream or subscribe requests */
|
|
160
|
+
export interface TaskStatusUpdateEvent {
|
|
161
|
+
/** Task id */
|
|
162
|
+
taskId: string;
|
|
163
|
+
/** The context the task is associated with */
|
|
164
|
+
contextId: string;
|
|
165
|
+
/** Event type */
|
|
166
|
+
kind: "status-update";
|
|
167
|
+
/** Current status of the task */
|
|
168
|
+
status: TaskStatus;
|
|
169
|
+
/** Indicates the end of the event stream */
|
|
170
|
+
final: boolean;
|
|
171
|
+
/** Extension metadata. */
|
|
172
|
+
metadata?: {
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** Sent by server during sendStream or subscribe requests */
|
|
177
|
+
export interface TaskArtifactUpdateEvent {
|
|
178
|
+
/** Task id */
|
|
179
|
+
taskId: string;
|
|
180
|
+
/** The context the task is associated with */
|
|
181
|
+
contextId: string;
|
|
182
|
+
/** Event type */
|
|
183
|
+
kind: "artifact-update";
|
|
184
|
+
/** Generated artifact */
|
|
185
|
+
artifact: Artifact;
|
|
186
|
+
/** Indicates if this artifact appends to a previous one */
|
|
187
|
+
append?: boolean;
|
|
188
|
+
/** Indicates if this is the last chunk of the artifact */
|
|
189
|
+
lastChunk?: boolean;
|
|
190
|
+
/** Extension metadata. */
|
|
191
|
+
metadata?: {
|
|
192
|
+
[key: string]: any;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/** Parameters containing only a task ID, used for simple task operations. */
|
|
196
|
+
export interface TaskIdParams {
|
|
197
|
+
/** Task id. */
|
|
198
|
+
id: string;
|
|
199
|
+
metadata?: {
|
|
200
|
+
[key: string]: any;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/** Parameters for querying a task, including optional history length. */
|
|
204
|
+
export interface TaskQueryParams extends TaskIdParams {
|
|
205
|
+
/** Number of recent messages to be retrieved. */
|
|
206
|
+
historyLength?: number;
|
|
207
|
+
}
|
|
208
|
+
/**Configuration for the send message request. */
|
|
209
|
+
export interface MessageSendConfiguration {
|
|
210
|
+
/** Accepted output modalities by the client. */
|
|
211
|
+
acceptedOutputModes: string[];
|
|
212
|
+
/** Number of recent messages to be retrieved. */
|
|
213
|
+
historyLength?: number;
|
|
214
|
+
/** Where the server should send notifications when disconnected. */
|
|
215
|
+
pushNotificationConfig?: PushNotificationConfig;
|
|
216
|
+
/** If the server should treat the client as a blocking request. */
|
|
217
|
+
blocking?: boolean;
|
|
218
|
+
}
|
|
219
|
+
/** Sent by the client to the agent as a request. May create, continue or restart a task. */
|
|
220
|
+
export interface MessageSendParams {
|
|
221
|
+
/** The message being sent to the server. */
|
|
222
|
+
message: Message;
|
|
223
|
+
/** Send message configuration. */
|
|
224
|
+
configuration?: MessageSendConfiguration;
|
|
225
|
+
/** Extension metadata. */
|
|
226
|
+
metadata?: {
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/** Represents the possible states of a Task. */
|
|
231
|
+
export declare enum TaskState {
|
|
232
|
+
Submitted = "submitted",
|
|
233
|
+
Working = "working",
|
|
234
|
+
InputRequired = "input-required",
|
|
235
|
+
Completed = "completed",
|
|
236
|
+
Canceled = "canceled",
|
|
237
|
+
Failed = "failed",
|
|
238
|
+
Rejected = "rejected",
|
|
239
|
+
AuthRequired = "auth-required",
|
|
240
|
+
Unknown = "unknown"
|
|
241
|
+
}
|
|
242
|
+
/** Represents an artifact generated for a task. */
|
|
243
|
+
export interface Artifact {
|
|
244
|
+
/** Unique identifier for the artifact. */
|
|
245
|
+
artifactId: string;
|
|
246
|
+
/** Optional name for the artifact. */
|
|
247
|
+
name?: string;
|
|
248
|
+
/** Optional description for the artifact. */
|
|
249
|
+
description?: string;
|
|
250
|
+
/** Artifact parts. */
|
|
251
|
+
parts: Part[];
|
|
252
|
+
/** Extension metadata. */
|
|
253
|
+
metadata?: {
|
|
254
|
+
[key: string]: any;
|
|
255
|
+
};
|
|
256
|
+
/** The URIs of extensions that are present or contributed to this Artifact. */
|
|
257
|
+
extensions?: string[];
|
|
258
|
+
}
|
|
259
|
+
/** Represents a single message exchanged between user and agent. */
|
|
260
|
+
export interface Message {
|
|
261
|
+
/** Message sender's role */
|
|
262
|
+
role: "user" | "agent";
|
|
263
|
+
/** Message content */
|
|
264
|
+
parts: Part[];
|
|
265
|
+
/** Extension metadata. */
|
|
266
|
+
metadata?: {
|
|
267
|
+
[key: string]: any;
|
|
268
|
+
};
|
|
269
|
+
/** The URIs of extensions that are present or contributed to this Message. */
|
|
270
|
+
extensions?: string[];
|
|
271
|
+
/** List of tasks referenced as context by this message.*/
|
|
272
|
+
referenceTaskIds?: string[];
|
|
273
|
+
/** Identifier created by the message creator*/
|
|
274
|
+
messageId: string;
|
|
275
|
+
/** Identifier of task the message is related to */
|
|
276
|
+
taskId?: string;
|
|
277
|
+
/** The context the message is associated with */
|
|
278
|
+
contextId?: string;
|
|
279
|
+
/** Event type */
|
|
280
|
+
kind: "message";
|
|
281
|
+
}
|
|
282
|
+
/** Base properties common to all message parts. */
|
|
283
|
+
export interface PartBase {
|
|
284
|
+
/** Optional metadata associated with the part. */
|
|
285
|
+
metadata?: {
|
|
286
|
+
[key: string]: any;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/** Represents a text segment within parts.*/
|
|
290
|
+
export interface TextPart extends PartBase {
|
|
291
|
+
/** Part type - text for TextParts*/
|
|
292
|
+
kind: "text";
|
|
293
|
+
/** Text content */
|
|
294
|
+
text: string;
|
|
295
|
+
}
|
|
296
|
+
/** Represents the base entity for FileParts */
|
|
297
|
+
export interface FileBase {
|
|
298
|
+
/** Optional name for the file */
|
|
299
|
+
name?: string;
|
|
300
|
+
/** Optional mimeType for the file */
|
|
301
|
+
mimeType?: string;
|
|
302
|
+
}
|
|
303
|
+
/** Define the variant where 'bytes' is present and 'uri' is absent */
|
|
304
|
+
export interface FileWithBytes extends FileBase {
|
|
305
|
+
/** base64 encoded content of the file*/
|
|
306
|
+
bytes: string;
|
|
307
|
+
uri?: never;
|
|
308
|
+
}
|
|
309
|
+
/** Define the variant where 'uri' is present and 'bytes' is absent */
|
|
310
|
+
export interface FileWithUri extends FileBase {
|
|
311
|
+
/** URL for the File content */
|
|
312
|
+
uri: string;
|
|
313
|
+
bytes?: never;
|
|
314
|
+
}
|
|
315
|
+
/** Represents a File segment within parts.*/
|
|
316
|
+
export interface FilePart extends PartBase {
|
|
317
|
+
/** Part type - file for FileParts */
|
|
318
|
+
kind: "file";
|
|
319
|
+
/** File content either as url or bytes */
|
|
320
|
+
file: FileWithBytes | FileWithUri;
|
|
321
|
+
}
|
|
322
|
+
/** Represents a structured data segment within a message part. */
|
|
323
|
+
export interface DataPart extends PartBase {
|
|
324
|
+
/** Part type - data for DataParts */
|
|
325
|
+
kind: "data";
|
|
326
|
+
/** Structured data content
|
|
327
|
+
*/
|
|
328
|
+
data: {
|
|
329
|
+
[key: string]: any;
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/** Represents a part of a message, which can be text, a file, or structured data. */
|
|
333
|
+
export type Part = TextPart | FilePart | DataPart;
|
|
334
|
+
/** Defines authentication details for push notifications. */
|
|
335
|
+
export interface PushNotificationAuthenticationInfo {
|
|
336
|
+
/** Supported authentication schemes - e.g. Basic, Bearer */
|
|
337
|
+
schemes: string[];
|
|
338
|
+
/** Optional credentials */
|
|
339
|
+
credentials?: string;
|
|
340
|
+
}
|
|
341
|
+
/**Configuration for setting up push notifications for task updates. */
|
|
342
|
+
export interface PushNotificationConfig {
|
|
343
|
+
/** Push Notification ID - created by server to support multiple callbacks */
|
|
344
|
+
id?: string;
|
|
345
|
+
/** URL for sending the push notifications. */
|
|
346
|
+
url: string;
|
|
347
|
+
/** Token unique to this task/session. */
|
|
348
|
+
token?: string;
|
|
349
|
+
authentication?: PushNotificationAuthenticationInfo;
|
|
350
|
+
}
|
|
351
|
+
/**Parameters for setting or getting push notification configuration for a task */
|
|
352
|
+
export interface TaskPushNotificationConfig {
|
|
353
|
+
/** Task id. */
|
|
354
|
+
taskId: string;
|
|
355
|
+
/** Push notification configuration. */
|
|
356
|
+
pushNotificationConfig: PushNotificationConfig;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Mirrors the OpenAPI Security Scheme Object
|
|
360
|
+
* (https://swagger.io/specification/#security-scheme-object)
|
|
361
|
+
*/
|
|
362
|
+
export type SecurityScheme = APIKeySecurityScheme | HTTPAuthSecurityScheme | OAuth2SecurityScheme | OpenIdConnectSecurityScheme;
|
|
363
|
+
/** Base properties shared by all security schemes. */
|
|
364
|
+
export interface SecuritySchemeBase {
|
|
365
|
+
/** Description of this security scheme. */
|
|
366
|
+
description?: string;
|
|
367
|
+
}
|
|
368
|
+
/** API Key security scheme. */
|
|
369
|
+
export interface APIKeySecurityScheme extends SecuritySchemeBase {
|
|
370
|
+
type: "apiKey";
|
|
371
|
+
/** The location of the API key. Valid values are "query", "header", or "cookie". */
|
|
372
|
+
in: "query" | "header" | "cookie";
|
|
373
|
+
/** The name of the header, query or cookie parameter to be used. */
|
|
374
|
+
name: string;
|
|
375
|
+
}
|
|
376
|
+
/** HTTP Authentication security scheme. */
|
|
377
|
+
export interface HTTPAuthSecurityScheme extends SecuritySchemeBase {
|
|
378
|
+
type: "http";
|
|
379
|
+
/**
|
|
380
|
+
* The name of the HTTP Authentication scheme to be used in the Authorization header as defined
|
|
381
|
+
* in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry.
|
|
382
|
+
* The value is case-insensitive, as defined in RFC7235.
|
|
383
|
+
*/
|
|
384
|
+
scheme: string;
|
|
385
|
+
/**
|
|
386
|
+
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually
|
|
387
|
+
* generated by an authorization server, so this information is primarily for documentation
|
|
388
|
+
* purposes.
|
|
389
|
+
*/
|
|
390
|
+
bearerFormat?: string;
|
|
391
|
+
}
|
|
392
|
+
/** OAuth2.0 security scheme configuration. */
|
|
393
|
+
export interface OAuth2SecurityScheme extends SecuritySchemeBase {
|
|
394
|
+
type: "oauth2";
|
|
395
|
+
/** An object containing configuration information for the flow types supported. */
|
|
396
|
+
flows: OAuthFlows;
|
|
397
|
+
}
|
|
398
|
+
/** OpenID Connect security scheme configuration. */
|
|
399
|
+
export interface OpenIdConnectSecurityScheme extends SecuritySchemeBase {
|
|
400
|
+
type: "openIdConnect";
|
|
401
|
+
/** Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata. */
|
|
402
|
+
openIdConnectUrl: string;
|
|
403
|
+
}
|
|
404
|
+
/** Allows configuration of the supported OAuth Flows */
|
|
405
|
+
export interface OAuthFlows {
|
|
406
|
+
/** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. */
|
|
407
|
+
authorizationCode?: AuthorizationCodeOAuthFlow;
|
|
408
|
+
/** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0 */
|
|
409
|
+
clientCredentials?: ClientCredentialsOAuthFlow;
|
|
410
|
+
/** Configuration for the OAuth Implicit flow */
|
|
411
|
+
implicit?: ImplicitOAuthFlow;
|
|
412
|
+
/** Configuration for the OAuth Resource Owner Password flow */
|
|
413
|
+
password?: PasswordOAuthFlow;
|
|
414
|
+
}
|
|
415
|
+
/** Configuration details for a supported OAuth Flow */
|
|
416
|
+
export interface AuthorizationCodeOAuthFlow {
|
|
417
|
+
/**
|
|
418
|
+
* The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2
|
|
419
|
+
* standard requires the use of TLS
|
|
420
|
+
*/
|
|
421
|
+
authorizationUrl: string;
|
|
422
|
+
/**
|
|
423
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
|
|
424
|
+
* requires the use of TLS.
|
|
425
|
+
*/
|
|
426
|
+
tokenUrl: string;
|
|
427
|
+
/**
|
|
428
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
|
|
429
|
+
* standard requires the use of TLS.
|
|
430
|
+
*/
|
|
431
|
+
refreshUrl?: string;
|
|
432
|
+
/**
|
|
433
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short
|
|
434
|
+
* description for it. The map MAY be empty.
|
|
435
|
+
*/
|
|
436
|
+
scopes: {
|
|
437
|
+
[name: string]: string;
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/** Configuration details for a supported OAuth Flow */
|
|
441
|
+
export interface ClientCredentialsOAuthFlow {
|
|
442
|
+
/**
|
|
443
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
|
|
444
|
+
* requires the use of TLS.
|
|
445
|
+
*/
|
|
446
|
+
tokenUrl: string;
|
|
447
|
+
/**
|
|
448
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
|
|
449
|
+
* standard requires the use of TLS.
|
|
450
|
+
*/
|
|
451
|
+
refreshUrl?: string;
|
|
452
|
+
/**
|
|
453
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short
|
|
454
|
+
* description for it. The map MAY be empty.
|
|
455
|
+
*/
|
|
456
|
+
scopes: {
|
|
457
|
+
[name: string]: string;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
/** Configuration details for a supported OAuth Flow */
|
|
461
|
+
export interface ImplicitOAuthFlow {
|
|
462
|
+
/**
|
|
463
|
+
* The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2
|
|
464
|
+
* standard requires the use of TLS
|
|
465
|
+
*/
|
|
466
|
+
authorizationUrl: string;
|
|
467
|
+
/**
|
|
468
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
|
|
469
|
+
* standard requires the use of TLS.
|
|
470
|
+
*/
|
|
471
|
+
refreshUrl?: string;
|
|
472
|
+
/**
|
|
473
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short
|
|
474
|
+
* description for it. The map MAY be empty.
|
|
475
|
+
*/
|
|
476
|
+
scopes: {
|
|
477
|
+
[name: string]: string;
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
/** Configuration details for a supported OAuth Flow */
|
|
481
|
+
export interface PasswordOAuthFlow {
|
|
482
|
+
/**
|
|
483
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
|
|
484
|
+
* requires the use of TLS.
|
|
485
|
+
*/
|
|
486
|
+
tokenUrl: string;
|
|
487
|
+
/**
|
|
488
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
|
|
489
|
+
* standard requires the use of TLS.
|
|
490
|
+
*/
|
|
491
|
+
refreshUrl?: string;
|
|
492
|
+
/**
|
|
493
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short
|
|
494
|
+
* description for it. The map MAY be empty.
|
|
495
|
+
*/
|
|
496
|
+
scopes: {
|
|
497
|
+
[name: string]: string;
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Base interface for any JSON-RPC 2.0 request or response.
|
|
502
|
+
*/
|
|
503
|
+
export interface JSONRPCMessage {
|
|
504
|
+
/**
|
|
505
|
+
* Specifies the version of the JSON-RPC protocol. MUST be exactly "2.0".
|
|
506
|
+
*/
|
|
507
|
+
readonly jsonrpc: "2.0";
|
|
508
|
+
/**
|
|
509
|
+
* An identifier established by the Client that MUST contain a String, Number.
|
|
510
|
+
* Numbers SHOULD NOT contain fractional parts.
|
|
511
|
+
* @nullable true
|
|
512
|
+
*/
|
|
513
|
+
id?: number | string | null;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Represents a JSON-RPC 2.0 Request object.
|
|
517
|
+
*/
|
|
518
|
+
export interface JSONRPCRequest extends JSONRPCMessage {
|
|
519
|
+
/**
|
|
520
|
+
* A String containing the name of the method to be invoked.
|
|
521
|
+
*/
|
|
522
|
+
method: string;
|
|
523
|
+
/**
|
|
524
|
+
* A Structured value that holds the parameter values to be used during the invocation of the method.
|
|
525
|
+
*/
|
|
526
|
+
params?: {
|
|
527
|
+
[key: string]: any;
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Represents a JSON-RPC 2.0 Error object.
|
|
532
|
+
* This is typically included in a JSONRPCErrorResponse when an error occurs.
|
|
533
|
+
*/
|
|
534
|
+
export interface JSONRPCError {
|
|
535
|
+
/**
|
|
536
|
+
* A Number that indicates the error type that occurred.
|
|
537
|
+
*/
|
|
538
|
+
code: number;
|
|
539
|
+
/**
|
|
540
|
+
* A String providing a short description of the error.
|
|
541
|
+
*/
|
|
542
|
+
message: string;
|
|
543
|
+
/**
|
|
544
|
+
* A Primitive or Structured value that contains additional information about the error.
|
|
545
|
+
* This may be omitted.
|
|
546
|
+
*/
|
|
547
|
+
data?: any;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Represents a JSON-RPC 2.0 Success Response object.
|
|
551
|
+
*/
|
|
552
|
+
export interface JSONRPCSuccessResponse extends JSONRPCMessage {
|
|
553
|
+
/**
|
|
554
|
+
* @nullable true
|
|
555
|
+
*/
|
|
556
|
+
id: number | string | null;
|
|
557
|
+
/**
|
|
558
|
+
* The result object on success
|
|
559
|
+
*/
|
|
560
|
+
result: any;
|
|
561
|
+
error?: never;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Represents a JSON-RPC 2.0 Error Response object.
|
|
565
|
+
*/
|
|
566
|
+
export interface JSONRPCErrorResponse extends JSONRPCMessage {
|
|
567
|
+
/**
|
|
568
|
+
* @nullable true
|
|
569
|
+
*/
|
|
570
|
+
id: number | string | null;
|
|
571
|
+
result?: never;
|
|
572
|
+
error: JSONRPCError | A2AError;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Represents a JSON-RPC 2.0 Response object.
|
|
576
|
+
*/
|
|
577
|
+
export type JSONRPCResponse = SendMessageResponse | SendStreamingMessageResponse | GetTaskResponse | CancelTaskResponse | SetTaskPushNotificationConfigResponse | GetTaskPushNotificationConfigResponse;
|
|
578
|
+
/**
|
|
579
|
+
* JSON-RPC request model for the 'message/send' method.
|
|
580
|
+
*/
|
|
581
|
+
export interface SendMessageRequest extends JSONRPCRequest {
|
|
582
|
+
id: number | string;
|
|
583
|
+
method: "message/send";
|
|
584
|
+
params: MessageSendParams;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* JSON-RPC success response model for the 'message/send' method.
|
|
588
|
+
*/
|
|
589
|
+
export interface SendMessageSuccessResponse extends JSONRPCSuccessResponse {
|
|
590
|
+
result: Message | Task;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* JSON-RPC response model for the 'message/send' method.
|
|
594
|
+
*/
|
|
595
|
+
export type SendMessageResponse = SendMessageSuccessResponse | JSONRPCErrorResponse;
|
|
596
|
+
/**
|
|
597
|
+
* JSON-RPC request model for the 'message/stream' method.
|
|
598
|
+
*/
|
|
599
|
+
export interface SendStreamingMessageRequest extends JSONRPCRequest {
|
|
600
|
+
id: number | string;
|
|
601
|
+
method: "message/stream";
|
|
602
|
+
params: MessageSendParams;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* JSON-RPC success response model for the 'message/stream' method.
|
|
606
|
+
*/
|
|
607
|
+
export interface SendStreamingMessageSuccessResponse extends JSONRPCSuccessResponse {
|
|
608
|
+
result: Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* JSON-RPC response model for the 'message/stream' method.
|
|
612
|
+
*/
|
|
613
|
+
export type SendStreamingMessageResponse = SendStreamingMessageSuccessResponse | JSONRPCErrorResponse;
|
|
614
|
+
/**
|
|
615
|
+
* JSON-RPC request model for the 'tasks/get' method.
|
|
616
|
+
*/
|
|
617
|
+
export interface GetTaskRequest extends JSONRPCRequest {
|
|
618
|
+
id: number | string;
|
|
619
|
+
/** A String containing the name of the method to be invoked. */
|
|
620
|
+
method: "tasks/get";
|
|
621
|
+
/** A Structured value that holds the parameter values to be used during the invocation of the method. */
|
|
622
|
+
params: TaskQueryParams;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* JSON-RPC success response for the 'tasks/get' method.
|
|
626
|
+
*/
|
|
627
|
+
export interface GetTaskSuccessResponse extends JSONRPCSuccessResponse {
|
|
628
|
+
/** The result object on success. */
|
|
629
|
+
result: Task;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* JSON-RPC response for the 'tasks/get' method.
|
|
633
|
+
*/
|
|
634
|
+
export type GetTaskResponse = GetTaskSuccessResponse | JSONRPCErrorResponse;
|
|
635
|
+
/**
|
|
636
|
+
* JSON-RPC request model for the 'tasks/cancel' method.
|
|
637
|
+
*/
|
|
638
|
+
export interface CancelTaskRequest extends JSONRPCRequest {
|
|
639
|
+
id: number | string;
|
|
640
|
+
/** A String containing the name of the method to be invoked. */
|
|
641
|
+
method: "tasks/cancel";
|
|
642
|
+
/** A Structured value that holds the parameter values to be used during the invocation of the method. */
|
|
643
|
+
params: TaskIdParams;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* JSON-RPC success response model for the 'tasks/cancel' method.
|
|
647
|
+
*/
|
|
648
|
+
export interface CancelTaskSuccessResponse extends JSONRPCSuccessResponse {
|
|
649
|
+
/** The result object on success. */
|
|
650
|
+
result: Task;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* JSON-RPC response for the 'tasks/cancel' method.
|
|
654
|
+
*/
|
|
655
|
+
export type CancelTaskResponse = CancelTaskSuccessResponse | JSONRPCErrorResponse;
|
|
656
|
+
/**
|
|
657
|
+
* JSON-RPC request model for the 'tasks/pushNotificationConfig/set' method.
|
|
658
|
+
*/
|
|
659
|
+
export interface SetTaskPushNotificationConfigRequest extends JSONRPCRequest {
|
|
660
|
+
id: number | string;
|
|
661
|
+
/** A String containing the name of the method to be invoked. */
|
|
662
|
+
method: "tasks/pushNotificationConfig/set";
|
|
663
|
+
/** A Structured value that holds the parameter values to be used during the invocation of the method. */
|
|
664
|
+
params: TaskPushNotificationConfig;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* JSON-RPC success response model for the 'tasks/pushNotificationConfig/set' method.
|
|
668
|
+
*/
|
|
669
|
+
export interface SetTaskPushNotificationConfigSuccessResponse extends JSONRPCSuccessResponse {
|
|
670
|
+
/** The result object on success. */
|
|
671
|
+
result: TaskPushNotificationConfig;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* JSON-RPC response for the 'tasks/pushNotificationConfig/set' method.
|
|
675
|
+
*/
|
|
676
|
+
export type SetTaskPushNotificationConfigResponse = SetTaskPushNotificationConfigSuccessResponse | JSONRPCErrorResponse;
|
|
677
|
+
/**
|
|
678
|
+
* JSON-RPC request model for the 'tasks/pushNotificationConfig/get' method.
|
|
679
|
+
*/
|
|
680
|
+
export interface GetTaskPushNotificationConfigRequest extends JSONRPCRequest {
|
|
681
|
+
id: number | string;
|
|
682
|
+
/** A String containing the name of the method to be invoked. */
|
|
683
|
+
method: "tasks/pushNotificationConfig/get";
|
|
684
|
+
/** A Structured value that holds the parameter values to be used during the invocation of the method. */
|
|
685
|
+
params: TaskIdParams;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* JSON-RPC success response model for the 'tasks/pushNotificationConfig/get' method.
|
|
689
|
+
*/
|
|
690
|
+
export interface GetTaskPushNotificationConfigSuccessResponse extends JSONRPCSuccessResponse {
|
|
691
|
+
/** The result object on success. */
|
|
692
|
+
result: TaskPushNotificationConfig;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* JSON-RPC response for the 'tasks/pushNotificationConfig/set' method.
|
|
696
|
+
*/
|
|
697
|
+
export type GetTaskPushNotificationConfigResponse = GetTaskPushNotificationConfigSuccessResponse | JSONRPCErrorResponse;
|
|
698
|
+
/**
|
|
699
|
+
* JSON-RPC request model for the 'tasks/resubscribe' method.
|
|
700
|
+
*/
|
|
701
|
+
export interface TaskResubscriptionRequest extends JSONRPCRequest {
|
|
702
|
+
id: number | string;
|
|
703
|
+
/** A String containing the name of the method to be invoked. */
|
|
704
|
+
method: "tasks/resubscribe";
|
|
705
|
+
/** A Structured value that holds the parameter values to be used during the invocation of the method. */
|
|
706
|
+
params: TaskIdParams;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* A2A supported request types
|
|
710
|
+
*/
|
|
711
|
+
export type A2ARequest = SendMessageRequest | SendStreamingMessageRequest | GetTaskRequest | CancelTaskRequest | SetTaskPushNotificationConfigRequest | GetTaskPushNotificationConfigRequest | TaskResubscriptionRequest;
|
|
712
|
+
/**
|
|
713
|
+
* JSON-RPC error indicating invalid JSON was received by the server.
|
|
714
|
+
*/
|
|
715
|
+
export interface JSONParseError extends JSONRPCError {
|
|
716
|
+
code: -32700;
|
|
717
|
+
/**
|
|
718
|
+
* @default Invalid JSON payload
|
|
719
|
+
*/
|
|
720
|
+
message: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* JSON-RPC error indicating the JSON sent is not a valid Request object.
|
|
724
|
+
*/
|
|
725
|
+
export interface InvalidRequestError extends JSONRPCError {
|
|
726
|
+
/** A Number that indicates the error type that occurred. */
|
|
727
|
+
code: -32600;
|
|
728
|
+
/**
|
|
729
|
+
* @default Request payload validation error
|
|
730
|
+
*/
|
|
731
|
+
message: string;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* JSON-RPC error indicating the method does not exist or is not available.
|
|
735
|
+
*/
|
|
736
|
+
export interface MethodNotFoundError extends JSONRPCError {
|
|
737
|
+
/** A Number that indicates the error type that occurred. */
|
|
738
|
+
code: -32601;
|
|
739
|
+
/**
|
|
740
|
+
* @default Method not found
|
|
741
|
+
*/
|
|
742
|
+
message: string;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* JSON-RPC error indicating invalid method parameter(s).
|
|
746
|
+
*/
|
|
747
|
+
export interface InvalidParamsError extends JSONRPCError {
|
|
748
|
+
/** A Number that indicates the error type that occurred. */
|
|
749
|
+
code: -32602;
|
|
750
|
+
/**
|
|
751
|
+
* @default Invalid parameters
|
|
752
|
+
*/
|
|
753
|
+
message: string;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* JSON-RPC error indicating an internal JSON-RPC error on the server.
|
|
757
|
+
*/
|
|
758
|
+
export interface InternalError extends JSONRPCError {
|
|
759
|
+
/** A Number that indicates the error type that occurred. */
|
|
760
|
+
code: -32603;
|
|
761
|
+
/**
|
|
762
|
+
* @default Internal error
|
|
763
|
+
*/
|
|
764
|
+
message: string;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* A2A specific error indicating the requested task ID was not found.
|
|
768
|
+
*/
|
|
769
|
+
export interface TaskNotFoundError extends JSONRPCError {
|
|
770
|
+
/** A Number that indicates the error type that occurred. */
|
|
771
|
+
code: -32001;
|
|
772
|
+
/**
|
|
773
|
+
* @default Task not found
|
|
774
|
+
*/
|
|
775
|
+
message: string;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* A2A specific error indicating the task is in a state where it cannot be canceled.
|
|
779
|
+
*/
|
|
780
|
+
export interface TaskNotCancelableError extends JSONRPCError {
|
|
781
|
+
/** A Number that indicates the error type that occurred. */
|
|
782
|
+
code: -32002;
|
|
783
|
+
/**
|
|
784
|
+
* @default Task cannot be canceled
|
|
785
|
+
*/
|
|
786
|
+
message: string;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* A2A specific error indicating the agent does not support push notifications.
|
|
790
|
+
*/
|
|
791
|
+
export interface PushNotificationNotSupportedError extends JSONRPCError {
|
|
792
|
+
/** A Number that indicates the error type that occurred. */
|
|
793
|
+
code: -32003;
|
|
794
|
+
/**
|
|
795
|
+
* @default Push Notification is not supported
|
|
796
|
+
*/
|
|
797
|
+
message: string;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* A2A specific error indicating the requested operation is not supported by the agent.
|
|
801
|
+
*/
|
|
802
|
+
export interface UnsupportedOperationError extends JSONRPCError {
|
|
803
|
+
/** A Number that indicates the error type that occurred. */
|
|
804
|
+
code: -32004;
|
|
805
|
+
/**
|
|
806
|
+
* @default This operation is not supported
|
|
807
|
+
*/
|
|
808
|
+
message: string;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* A2A specific error indicating incompatible content types between request and agent capabilities.
|
|
812
|
+
*/
|
|
813
|
+
export interface ContentTypeNotSupportedError extends JSONRPCError {
|
|
814
|
+
/** A Number that indicates the error type that occurred. */
|
|
815
|
+
code: -32005;
|
|
816
|
+
/**
|
|
817
|
+
* @default Incompatible content types
|
|
818
|
+
*/
|
|
819
|
+
message: string;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* A2A specific error indicating agent returned invalid response for the current method
|
|
823
|
+
*/
|
|
824
|
+
export interface InvalidAgentResponseError extends JSONRPCError {
|
|
825
|
+
/** A Number that indicates the error type that occurred. */
|
|
826
|
+
code: -32006;
|
|
827
|
+
/**
|
|
828
|
+
* @default Invalid agent response
|
|
829
|
+
*/
|
|
830
|
+
message: string;
|
|
831
|
+
}
|
|
832
|
+
export type A2AError = JSONParseError | InvalidRequestError | MethodNotFoundError | InvalidParamsError | InternalError | TaskNotFoundError | TaskNotCancelableError | PushNotificationNotSupportedError | UnsupportedOperationError | ContentTypeNotSupportedError | InvalidAgentResponseError;
|