@a2a-js/sdk 0.3.7 → 0.3.9

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,1053 @@
1
+ import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
2
+ import * as grpc from '@grpc/grpc-js';
3
+ import { UntypedServiceImplementation, handleUnaryCall, handleServerStreamingCall } from '@grpc/grpc-js';
4
+ import { U as User, a as UnauthenticatedUser, A as A2ARequestHandler } from '../../a2a_request_handler-B3LxMq3P.cjs';
5
+ import '../../extensions-DvruCIzw.cjs';
6
+
7
+ /**
8
+ * A generic empty message that you can re-use to avoid defining duplicated
9
+ * empty messages in your APIs. A typical example is to use it as the request
10
+ * or the response type of an API method. For instance:
11
+ *
12
+ * service Foo {
13
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
14
+ * }
15
+ */
16
+ interface Empty {
17
+ }
18
+ declare const Empty: MessageFns$2<Empty>;
19
+ interface MessageFns$2<T> {
20
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
21
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
22
+ }
23
+
24
+ /** Older protoc compilers don't understand edition yet. */
25
+ /** The set of states a Task can be in. */
26
+ declare enum TaskState {
27
+ TASK_STATE_UNSPECIFIED = 0,
28
+ /** TASK_STATE_SUBMITTED - Represents the status that acknowledges a task is created */
29
+ TASK_STATE_SUBMITTED = 1,
30
+ /** TASK_STATE_WORKING - Represents the status that a task is actively being processed */
31
+ TASK_STATE_WORKING = 2,
32
+ /** TASK_STATE_COMPLETED - Represents the status a task is finished. This is a terminal state */
33
+ TASK_STATE_COMPLETED = 3,
34
+ /** TASK_STATE_FAILED - Represents the status a task is done but failed. This is a terminal state */
35
+ TASK_STATE_FAILED = 4,
36
+ /**
37
+ * TASK_STATE_CANCELLED - Represents the status a task was cancelled before it finished.
38
+ * This is a terminal state.
39
+ */
40
+ TASK_STATE_CANCELLED = 5,
41
+ /**
42
+ * TASK_STATE_INPUT_REQUIRED - Represents the status that the task requires information to complete.
43
+ * This is an interrupted state.
44
+ */
45
+ TASK_STATE_INPUT_REQUIRED = 6,
46
+ /**
47
+ * TASK_STATE_REJECTED - Represents the status that the agent has decided to not perform the task.
48
+ * This may be done during initial task creation or later once an agent
49
+ * has determined it can't or won't proceed. This is a terminal state.
50
+ */
51
+ TASK_STATE_REJECTED = 7,
52
+ /**
53
+ * TASK_STATE_AUTH_REQUIRED - Represents the state that some authentication is needed from the upstream
54
+ * client. Authentication is expected to come out-of-band thus this is not
55
+ * an interrupted or terminal state.
56
+ */
57
+ TASK_STATE_AUTH_REQUIRED = 8,
58
+ UNRECOGNIZED = -1
59
+ }
60
+ declare enum Role {
61
+ ROLE_UNSPECIFIED = 0,
62
+ /** ROLE_USER - USER role refers to communication from the client to the server. */
63
+ ROLE_USER = 1,
64
+ /** ROLE_AGENT - AGENT role refers to communication from the server to the client. */
65
+ ROLE_AGENT = 2,
66
+ UNRECOGNIZED = -1
67
+ }
68
+ /** Configuration of a send message request. */
69
+ interface SendMessageConfiguration {
70
+ /** The output modes that the agent is expected to respond with. */
71
+ acceptedOutputModes: string[];
72
+ /** A configuration of a webhook that can be used to receive updates */
73
+ pushNotification: PushNotificationConfig | undefined;
74
+ /**
75
+ * The maximum number of messages to include in the history. if 0, the
76
+ * history will be unlimited.
77
+ */
78
+ historyLength: number;
79
+ /**
80
+ * If true, the message will be blocking until the task is completed. If
81
+ * false, the message will be non-blocking and the task will be returned
82
+ * immediately. It is the caller's responsibility to check for any task
83
+ * updates.
84
+ */
85
+ blocking: boolean;
86
+ }
87
+ declare const SendMessageConfiguration: MessageFns$1<SendMessageConfiguration>;
88
+ /**
89
+ * Task is the core unit of action for A2A. It has a current status
90
+ * and when results are created for the task they are stored in the
91
+ * artifact. If there are multiple turns for a task, these are stored in
92
+ * history.
93
+ */
94
+ interface Task$1 {
95
+ /** Unique identifier for a task, created by the A2A server. */
96
+ id: string;
97
+ /**
98
+ * Unique identifier for the contextual collection of interactions (tasks
99
+ * and messages). Created by the A2A server.
100
+ */
101
+ contextId: string;
102
+ /** The current status of a Task, including state and a message. */
103
+ status: TaskStatus | undefined;
104
+ /** A set of output artifacts for a Task. */
105
+ artifacts: Artifact[];
106
+ /**
107
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
108
+ * The history of interactions from a task.
109
+ */
110
+ history: Message[];
111
+ /**
112
+ * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
113
+ * A key/value object to store custom metadata about a task.
114
+ */
115
+ metadata: {
116
+ [key: string]: any;
117
+ } | undefined;
118
+ }
119
+ declare const Task$1: MessageFns$1<Task$1>;
120
+ /** A container for the status of a task */
121
+ interface TaskStatus {
122
+ /** The current state of this task */
123
+ state: TaskState;
124
+ /** A message associated with the status. */
125
+ update: Message | undefined;
126
+ /**
127
+ * Timestamp when the status was recorded.
128
+ * Example: "2023-10-27T10:00:00Z"
129
+ */
130
+ timestamp: string | undefined;
131
+ }
132
+ declare const TaskStatus: MessageFns$1<TaskStatus>;
133
+ /**
134
+ * Part represents a container for a section of communication content.
135
+ * Parts can be purely textual, some sort of file (image, video, etc) or
136
+ * a structured data blob (i.e. JSON).
137
+ */
138
+ interface Part {
139
+ part?: {
140
+ $case: "text";
141
+ value: string;
142
+ } | {
143
+ $case: "file";
144
+ value: FilePart;
145
+ } | {
146
+ $case: "data";
147
+ value: DataPart;
148
+ } | undefined;
149
+ }
150
+ declare const Part: MessageFns$1<Part>;
151
+ /**
152
+ * FilePart represents the different ways files can be provided. If files are
153
+ * small, directly feeding the bytes is supported via file_with_bytes. If the
154
+ * file is large, the agent should read the content as appropriate directly
155
+ * from the file_with_uri source.
156
+ */
157
+ interface FilePart {
158
+ file?: {
159
+ $case: "fileWithUri";
160
+ value: string;
161
+ } | {
162
+ $case: "fileWithBytes";
163
+ value: Buffer;
164
+ } | undefined;
165
+ mimeType: string;
166
+ }
167
+ declare const FilePart: MessageFns$1<FilePart>;
168
+ /** DataPart represents a structured blob. This is most commonly a JSON payload. */
169
+ interface DataPart {
170
+ data: {
171
+ [key: string]: any;
172
+ } | undefined;
173
+ }
174
+ declare const DataPart: MessageFns$1<DataPart>;
175
+ /**
176
+ * Message is one unit of communication between client and server. It is
177
+ * associated with a context and optionally a task. Since the server is
178
+ * responsible for the context definition, it must always provide a context_id
179
+ * in its messages. The client can optionally provide the context_id if it
180
+ * knows the context to associate the message to. Similarly for task_id,
181
+ * except the server decides if a task is created and whether to include the
182
+ * task_id.
183
+ */
184
+ interface Message {
185
+ /**
186
+ * The message id of the message. This is required and created by the
187
+ * message creator.
188
+ */
189
+ messageId: string;
190
+ /**
191
+ * The context id of the message. This is optional and if set, the message
192
+ * will be associated with the given context.
193
+ */
194
+ contextId: string;
195
+ /**
196
+ * The task id of the message. This is optional and if set, the message
197
+ * will be associated with the given task.
198
+ */
199
+ taskId: string;
200
+ /** A role for the message. */
201
+ role: Role;
202
+ /**
203
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
204
+ * Content is the container of the message content.
205
+ */
206
+ content: Part[];
207
+ /**
208
+ * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
209
+ * Any optional metadata to provide along with the message.
210
+ */
211
+ metadata: {
212
+ [key: string]: any;
213
+ } | undefined;
214
+ /** The URIs of extensions that are present or contributed to this Message. */
215
+ extensions: string[];
216
+ }
217
+ declare const Message: MessageFns$1<Message>;
218
+ /**
219
+ * Artifacts are the container for task completed results. These are similar
220
+ * to Messages but are intended to be the product of a task, as opposed to
221
+ * point-to-point communication.
222
+ */
223
+ interface Artifact {
224
+ /** Unique id for the artifact. It must be at least unique within a task. */
225
+ artifactId: string;
226
+ /** A human readable name for the artifact. */
227
+ name: string;
228
+ /** A human readable description of the artifact, optional. */
229
+ description: string;
230
+ /** The content of the artifact. */
231
+ parts: Part[];
232
+ /** Optional metadata included with the artifact. */
233
+ metadata: {
234
+ [key: string]: any;
235
+ } | undefined;
236
+ /** The URIs of extensions that are present or contributed to this Artifact. */
237
+ extensions: string[];
238
+ }
239
+ declare const Artifact: MessageFns$1<Artifact>;
240
+ /**
241
+ * TaskStatusUpdateEvent is a delta even on a task indicating that a task
242
+ * has changed.
243
+ */
244
+ interface TaskStatusUpdateEvent {
245
+ /** The id of the task that is changed */
246
+ taskId: string;
247
+ /** The id of the context that the task belongs to */
248
+ contextId: string;
249
+ /** The new status of the task. */
250
+ status: TaskStatus | undefined;
251
+ /** Whether this is the last status update expected for this task. */
252
+ final: boolean;
253
+ /** Optional metadata to associate with the task update. */
254
+ metadata: {
255
+ [key: string]: any;
256
+ } | undefined;
257
+ }
258
+ declare const TaskStatusUpdateEvent: MessageFns$1<TaskStatusUpdateEvent>;
259
+ /**
260
+ * TaskArtifactUpdateEvent represents a task delta where an artifact has
261
+ * been generated.
262
+ */
263
+ interface TaskArtifactUpdateEvent {
264
+ /** The id of the task for this artifact */
265
+ taskId: string;
266
+ /** The id of the context that this task belongs too */
267
+ contextId: string;
268
+ /** The artifact itself */
269
+ artifact: Artifact | undefined;
270
+ /** Whether this should be appended to a prior one produced */
271
+ append: boolean;
272
+ /** Whether this represents the last part of an artifact */
273
+ lastChunk: boolean;
274
+ /** Optional metadata associated with the artifact update. */
275
+ metadata: {
276
+ [key: string]: any;
277
+ } | undefined;
278
+ }
279
+ declare const TaskArtifactUpdateEvent: MessageFns$1<TaskArtifactUpdateEvent>;
280
+ /** Configuration for setting up push notifications for task updates. */
281
+ interface PushNotificationConfig {
282
+ /** A unique id for this push notification. */
283
+ id: string;
284
+ /** Url to send the notification too */
285
+ url: string;
286
+ /** Token unique for this task/session */
287
+ token: string;
288
+ /** Information about the authentication to sent with the notification */
289
+ authentication: AuthenticationInfo | undefined;
290
+ }
291
+ declare const PushNotificationConfig: MessageFns$1<PushNotificationConfig>;
292
+ /** Defines authentication details, used for push notifications. */
293
+ interface AuthenticationInfo {
294
+ /** Supported authentication schemes - e.g. Basic, Bearer, etc */
295
+ schemes: string[];
296
+ /** Optional credentials */
297
+ credentials: string;
298
+ }
299
+ declare const AuthenticationInfo: MessageFns$1<AuthenticationInfo>;
300
+ /** Defines additional transport information for the agent. */
301
+ interface AgentInterface {
302
+ /** The url this interface is found at. */
303
+ url: string;
304
+ /**
305
+ * The transport supported this url. This is an open form string, to be
306
+ * easily extended for many transport protocols. The core ones officially
307
+ * supported are JSONRPC, GRPC and HTTP+JSON.
308
+ */
309
+ transport: string;
310
+ }
311
+ declare const AgentInterface: MessageFns$1<AgentInterface>;
312
+ /**
313
+ * AgentCard conveys key information:
314
+ * - Overall details (version, name, description, uses)
315
+ * - Skills; a set of actions/solutions the agent can perform
316
+ * - Default modalities/content types supported by the agent.
317
+ * - Authentication requirements
318
+ * Next ID: 18
319
+ */
320
+ interface AgentCard$1 {
321
+ /** The version of the A2A protocol this agent supports. */
322
+ protocolVersion: string;
323
+ /**
324
+ * A human readable name for the agent.
325
+ * Example: "Recipe Agent"
326
+ */
327
+ name: string;
328
+ /**
329
+ * A description of the agent's domain of action/solution space.
330
+ * Example: "Agent that helps users with recipes and cooking."
331
+ */
332
+ description: string;
333
+ /**
334
+ * A URL to the address the agent is hosted at. This represents the
335
+ * preferred endpoint as declared by the agent.
336
+ */
337
+ url: string;
338
+ /** The transport of the preferred endpoint. If empty, defaults to JSONRPC. */
339
+ preferredTransport: string;
340
+ /**
341
+ * Announcement of additional supported transports. Client can use any of
342
+ * the supported transports.
343
+ */
344
+ additionalInterfaces: AgentInterface[];
345
+ /** The service provider of the agent. */
346
+ provider: AgentProvider | undefined;
347
+ /**
348
+ * The version of the agent.
349
+ * Example: "1.0.0"
350
+ */
351
+ version: string;
352
+ /** A url to provide additional documentation about the agent. */
353
+ documentationUrl: string;
354
+ /** A2A Capability set supported by the agent. */
355
+ capabilities: AgentCapabilities | undefined;
356
+ /** The security scheme details used for authenticating with this agent. */
357
+ securitySchemes: {
358
+ [key: string]: SecurityScheme;
359
+ };
360
+ /**
361
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
362
+ * Security requirements for contacting the agent.
363
+ * This list can be seen as an OR of ANDs. Each object in the list describes
364
+ * one possible set of security requirements that must be present on a
365
+ * request. This allows specifying, for example, "callers must either use
366
+ * OAuth OR an API Key AND mTLS."
367
+ * Example:
368
+ * security {
369
+ * schemes { key: "oauth" value { list: ["read"] } }
370
+ * }
371
+ * security {
372
+ * schemes { key: "api-key" }
373
+ * schemes { key: "mtls" }
374
+ * }
375
+ */
376
+ security: Security[];
377
+ /**
378
+ * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
379
+ * The set of interaction modes that the agent supports across all skills.
380
+ * This can be overridden per skill. Defined as mime types.
381
+ */
382
+ defaultInputModes: string[];
383
+ /** The mime types supported as outputs from this agent. */
384
+ defaultOutputModes: string[];
385
+ /**
386
+ * Skills represent a unit of ability an agent can perform. This may
387
+ * somewhat abstract but represents a more focused set of actions that the
388
+ * agent is highly likely to succeed at.
389
+ */
390
+ skills: AgentSkill[];
391
+ /**
392
+ * Whether the agent supports providing an extended agent card when
393
+ * the user is authenticated, i.e. is the card from .well-known
394
+ * different than the card from GetAgentCard.
395
+ */
396
+ supportsAuthenticatedExtendedCard: boolean;
397
+ /** JSON Web Signatures computed for this AgentCard. */
398
+ signatures: AgentCardSignature[];
399
+ }
400
+ declare const AgentCard$1: MessageFns$1<AgentCard$1>;
401
+ /** Represents information about the service provider of an agent. */
402
+ interface AgentProvider {
403
+ /**
404
+ * The providers reference url
405
+ * Example: "https://ai.google.dev"
406
+ */
407
+ url: string;
408
+ /**
409
+ * The providers organization name
410
+ * Example: "Google"
411
+ */
412
+ organization: string;
413
+ }
414
+ declare const AgentProvider: MessageFns$1<AgentProvider>;
415
+ /** Defines the A2A feature set supported by the agent */
416
+ interface AgentCapabilities {
417
+ /** If the agent will support streaming responses */
418
+ streaming: boolean;
419
+ /** If the agent can send push notifications to the clients webhook */
420
+ pushNotifications: boolean;
421
+ /** Extensions supported by this agent. */
422
+ extensions: AgentExtension[];
423
+ }
424
+ declare const AgentCapabilities: MessageFns$1<AgentCapabilities>;
425
+ /** A declaration of an extension supported by an Agent. */
426
+ interface AgentExtension {
427
+ /**
428
+ * The URI of the extension.
429
+ * Example: "https://developers.google.com/identity/protocols/oauth2"
430
+ */
431
+ uri: string;
432
+ /**
433
+ * A description of how this agent uses this extension.
434
+ * Example: "Google OAuth 2.0 authentication"
435
+ */
436
+ description: string;
437
+ /**
438
+ * Whether the client must follow specific requirements of the extension.
439
+ * Example: false
440
+ */
441
+ required: boolean;
442
+ /** Optional configuration for the extension. */
443
+ params: {
444
+ [key: string]: any;
445
+ } | undefined;
446
+ }
447
+ declare const AgentExtension: MessageFns$1<AgentExtension>;
448
+ /**
449
+ * AgentSkill represents a unit of action/solution that the agent can perform.
450
+ * One can think of this as a type of highly reliable solution that an agent
451
+ * can be tasked to provide. Agents have the autonomy to choose how and when
452
+ * to use specific skills, but clients should have confidence that if the
453
+ * skill is defined that unit of action can be reliably performed.
454
+ */
455
+ interface AgentSkill {
456
+ /** Unique id of the skill within this agent. */
457
+ id: string;
458
+ /** A human readable name for the skill. */
459
+ name: string;
460
+ /**
461
+ * A human (or llm) readable description of the skill
462
+ * details and behaviors.
463
+ */
464
+ description: string;
465
+ /**
466
+ * A set of tags for the skill to enhance categorization/utilization.
467
+ * Example: ["cooking", "customer support", "billing"]
468
+ */
469
+ tags: string[];
470
+ /**
471
+ * A set of example queries that this skill is designed to address.
472
+ * These examples should help the caller to understand how to craft requests
473
+ * to the agent to achieve specific goals.
474
+ * Example: ["I need a recipe for bread"]
475
+ */
476
+ examples: string[];
477
+ /** Possible input modalities supported. */
478
+ inputModes: string[];
479
+ /** Possible output modalities produced */
480
+ outputModes: string[];
481
+ /**
482
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
483
+ * Security schemes necessary for the agent to leverage this skill.
484
+ * As in the overall AgentCard.security, this list represents a logical OR of
485
+ * security requirement objects. Each object is a set of security schemes
486
+ * that must be used together (a logical AND).
487
+ */
488
+ security: Security[];
489
+ }
490
+ declare const AgentSkill: MessageFns$1<AgentSkill>;
491
+ /**
492
+ * AgentCardSignature represents a JWS signature of an AgentCard.
493
+ * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
494
+ */
495
+ interface AgentCardSignature {
496
+ /**
497
+ * The protected JWS header for the signature. This is always a
498
+ * base64url-encoded JSON object. Required.
499
+ */
500
+ protected: string;
501
+ /** The computed signature, base64url-encoded. Required. */
502
+ signature: string;
503
+ /** The unprotected JWS header values. */
504
+ header: {
505
+ [key: string]: any;
506
+ } | undefined;
507
+ }
508
+ declare const AgentCardSignature: MessageFns$1<AgentCardSignature>;
509
+ interface TaskPushNotificationConfig$1 {
510
+ /** name=tasks/{id}/pushNotificationConfigs/{id} */
511
+ name: string;
512
+ pushNotificationConfig: PushNotificationConfig | undefined;
513
+ }
514
+ declare const TaskPushNotificationConfig$1: MessageFns$1<TaskPushNotificationConfig$1>;
515
+ /** protolint:disable REPEATED_FIELD_NAMES_PLURALIZED */
516
+ interface StringList {
517
+ list: string[];
518
+ }
519
+ declare const StringList: MessageFns$1<StringList>;
520
+ interface Security {
521
+ schemes: {
522
+ [key: string]: StringList;
523
+ };
524
+ }
525
+ declare const Security: MessageFns$1<Security>;
526
+ interface SecurityScheme {
527
+ scheme?: {
528
+ $case: "apiKeySecurityScheme";
529
+ value: APIKeySecurityScheme;
530
+ } | {
531
+ $case: "httpAuthSecurityScheme";
532
+ value: HTTPAuthSecurityScheme;
533
+ } | {
534
+ $case: "oauth2SecurityScheme";
535
+ value: OAuth2SecurityScheme;
536
+ } | {
537
+ $case: "openIdConnectSecurityScheme";
538
+ value: OpenIdConnectSecurityScheme;
539
+ } | {
540
+ $case: "mtlsSecurityScheme";
541
+ value: MutualTlsSecurityScheme;
542
+ } | undefined;
543
+ }
544
+ declare const SecurityScheme: MessageFns$1<SecurityScheme>;
545
+ interface APIKeySecurityScheme {
546
+ /** Description of this security scheme. */
547
+ description: string;
548
+ /** Location of the API key, valid values are "query", "header", or "cookie" */
549
+ location: string;
550
+ /** Name of the header, query or cookie parameter to be used. */
551
+ name: string;
552
+ }
553
+ declare const APIKeySecurityScheme: MessageFns$1<APIKeySecurityScheme>;
554
+ interface HTTPAuthSecurityScheme {
555
+ /** Description of this security scheme. */
556
+ description: string;
557
+ /**
558
+ * The name of the HTTP Authentication scheme to be used in the
559
+ * Authorization header as defined in RFC7235. The values used SHOULD be
560
+ * registered in the IANA Authentication Scheme registry.
561
+ * The value is case-insensitive, as defined in RFC7235.
562
+ */
563
+ scheme: string;
564
+ /**
565
+ * A hint to the client to identify how the bearer token is formatted.
566
+ * Bearer tokens are usually generated by an authorization server, so
567
+ * this information is primarily for documentation purposes.
568
+ */
569
+ bearerFormat: string;
570
+ }
571
+ declare const HTTPAuthSecurityScheme: MessageFns$1<HTTPAuthSecurityScheme>;
572
+ interface OAuth2SecurityScheme {
573
+ /** Description of this security scheme. */
574
+ description: string;
575
+ /** An object containing configuration information for the flow types supported */
576
+ flows: OAuthFlows | undefined;
577
+ /**
578
+ * URL to the oauth2 authorization server metadata
579
+ * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
580
+ */
581
+ oauth2MetadataUrl: string;
582
+ }
583
+ declare const OAuth2SecurityScheme: MessageFns$1<OAuth2SecurityScheme>;
584
+ interface OpenIdConnectSecurityScheme {
585
+ /** Description of this security scheme. */
586
+ description: string;
587
+ /**
588
+ * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
589
+ * metadata.
590
+ */
591
+ openIdConnectUrl: string;
592
+ }
593
+ declare const OpenIdConnectSecurityScheme: MessageFns$1<OpenIdConnectSecurityScheme>;
594
+ interface MutualTlsSecurityScheme {
595
+ /** Description of this security scheme. */
596
+ description: string;
597
+ }
598
+ declare const MutualTlsSecurityScheme: MessageFns$1<MutualTlsSecurityScheme>;
599
+ interface OAuthFlows {
600
+ flow?: {
601
+ $case: "authorizationCode";
602
+ value: AuthorizationCodeOAuthFlow;
603
+ } | {
604
+ $case: "clientCredentials";
605
+ value: ClientCredentialsOAuthFlow;
606
+ } | {
607
+ $case: "implicit";
608
+ value: ImplicitOAuthFlow;
609
+ } | {
610
+ $case: "password";
611
+ value: PasswordOAuthFlow;
612
+ } | undefined;
613
+ }
614
+ declare const OAuthFlows: MessageFns$1<OAuthFlows>;
615
+ interface AuthorizationCodeOAuthFlow {
616
+ /**
617
+ * The authorization URL to be used for this flow. This MUST be in the
618
+ * form of a URL. The OAuth2 standard requires the use of TLS
619
+ */
620
+ authorizationUrl: string;
621
+ /**
622
+ * The token URL to be used for this flow. This MUST be in the form of a URL.
623
+ * The OAuth2 standard requires the use of TLS.
624
+ */
625
+ tokenUrl: string;
626
+ /**
627
+ * The URL to be used for obtaining refresh tokens. This MUST be in the
628
+ * form of a URL. The OAuth2 standard requires the use of TLS.
629
+ */
630
+ refreshUrl: string;
631
+ /**
632
+ * The available scopes for the OAuth2 security scheme. A map between the
633
+ * scope name and a short description for it. The map MAY be empty.
634
+ */
635
+ scopes: {
636
+ [key: string]: string;
637
+ };
638
+ }
639
+ declare const AuthorizationCodeOAuthFlow: MessageFns$1<AuthorizationCodeOAuthFlow>;
640
+ interface ClientCredentialsOAuthFlow {
641
+ /**
642
+ * The token URL to be used for this flow. This MUST be in the form of a URL.
643
+ * The OAuth2 standard requires the use of TLS.
644
+ */
645
+ tokenUrl: string;
646
+ /**
647
+ * The URL to be used for obtaining refresh tokens. This MUST be in the
648
+ * form of a URL. The OAuth2 standard requires the use of TLS.
649
+ */
650
+ refreshUrl: string;
651
+ /**
652
+ * The available scopes for the OAuth2 security scheme. A map between the
653
+ * scope name and a short description for it. The map MAY be empty.
654
+ */
655
+ scopes: {
656
+ [key: string]: string;
657
+ };
658
+ }
659
+ declare const ClientCredentialsOAuthFlow: MessageFns$1<ClientCredentialsOAuthFlow>;
660
+ interface ImplicitOAuthFlow {
661
+ /**
662
+ * The authorization URL to be used for this flow. This MUST be in the
663
+ * form of a URL. The OAuth2 standard requires the use of TLS
664
+ */
665
+ authorizationUrl: string;
666
+ /**
667
+ * The URL to be used for obtaining refresh tokens. This MUST be in the
668
+ * form of a URL. The OAuth2 standard requires the use of TLS.
669
+ */
670
+ refreshUrl: string;
671
+ /**
672
+ * The available scopes for the OAuth2 security scheme. A map between the
673
+ * scope name and a short description for it. The map MAY be empty.
674
+ */
675
+ scopes: {
676
+ [key: string]: string;
677
+ };
678
+ }
679
+ declare const ImplicitOAuthFlow: MessageFns$1<ImplicitOAuthFlow>;
680
+ interface PasswordOAuthFlow {
681
+ /**
682
+ * The token URL to be used for this flow. This MUST be in the form of a URL.
683
+ * The OAuth2 standard requires the use of TLS.
684
+ */
685
+ tokenUrl: string;
686
+ /**
687
+ * The URL to be used for obtaining refresh tokens. This MUST be in the
688
+ * form of a URL. The OAuth2 standard requires the use of TLS.
689
+ */
690
+ refreshUrl: string;
691
+ /**
692
+ * The available scopes for the OAuth2 security scheme. A map between the
693
+ * scope name and a short description for it. The map MAY be empty.
694
+ */
695
+ scopes: {
696
+ [key: string]: string;
697
+ };
698
+ }
699
+ declare const PasswordOAuthFlow: MessageFns$1<PasswordOAuthFlow>;
700
+ /** /////////// Request Messages /////////// */
701
+ interface SendMessageRequest$1 {
702
+ request: Message | undefined;
703
+ configuration: SendMessageConfiguration | undefined;
704
+ metadata: {
705
+ [key: string]: any;
706
+ } | undefined;
707
+ }
708
+ declare const SendMessageRequest$1: MessageFns$1<SendMessageRequest$1>;
709
+ interface GetTaskRequest$1 {
710
+ /** name=tasks/{id} */
711
+ name: string;
712
+ historyLength: number;
713
+ }
714
+ declare const GetTaskRequest$1: MessageFns$1<GetTaskRequest$1>;
715
+ interface CancelTaskRequest$1 {
716
+ /** name=tasks/{id} */
717
+ name: string;
718
+ }
719
+ declare const CancelTaskRequest$1: MessageFns$1<CancelTaskRequest$1>;
720
+ interface GetTaskPushNotificationConfigRequest$1 {
721
+ /** name=tasks/{id}/pushNotificationConfigs/{push_id} */
722
+ name: string;
723
+ }
724
+ declare const GetTaskPushNotificationConfigRequest$1: MessageFns$1<GetTaskPushNotificationConfigRequest$1>;
725
+ interface DeleteTaskPushNotificationConfigRequest$1 {
726
+ /** name=tasks/{id}/pushNotificationConfigs/{push_id} */
727
+ name: string;
728
+ }
729
+ declare const DeleteTaskPushNotificationConfigRequest$1: MessageFns$1<DeleteTaskPushNotificationConfigRequest$1>;
730
+ interface CreateTaskPushNotificationConfigRequest$1 {
731
+ /**
732
+ * The task resource for this config.
733
+ * Format: tasks/{id}
734
+ */
735
+ parent: string;
736
+ configId: string;
737
+ config: TaskPushNotificationConfig$1 | undefined;
738
+ }
739
+ declare const CreateTaskPushNotificationConfigRequest$1: MessageFns$1<CreateTaskPushNotificationConfigRequest$1>;
740
+ interface TaskSubscriptionRequest$1 {
741
+ /** name=tasks/{id} */
742
+ name: string;
743
+ }
744
+ declare const TaskSubscriptionRequest$1: MessageFns$1<TaskSubscriptionRequest$1>;
745
+ interface ListTaskPushNotificationConfigRequest$1 {
746
+ /** parent=tasks/{id} */
747
+ parent: string;
748
+ /**
749
+ * For AIP-158 these fields are present. Usually not used/needed.
750
+ * The maximum number of configurations to return.
751
+ * If unspecified, all configs will be returned.
752
+ */
753
+ pageSize: number;
754
+ /**
755
+ * A page token received from a previous
756
+ * ListTaskPushNotificationConfigRequest call.
757
+ * Provide this to retrieve the subsequent page.
758
+ * When paginating, all other parameters provided to
759
+ * `ListTaskPushNotificationConfigRequest` must match the call that provided
760
+ * the page token.
761
+ */
762
+ pageToken: string;
763
+ }
764
+ declare const ListTaskPushNotificationConfigRequest$1: MessageFns$1<ListTaskPushNotificationConfigRequest$1>;
765
+ /** Empty. Added to fix linter violation. */
766
+ interface GetAgentCardRequest$1 {
767
+ }
768
+ declare const GetAgentCardRequest$1: MessageFns$1<GetAgentCardRequest$1>;
769
+ /** ////// Response Messages /////////// */
770
+ interface SendMessageResponse$1 {
771
+ payload?: {
772
+ $case: "task";
773
+ value: Task$1;
774
+ } | {
775
+ $case: "msg";
776
+ value: Message;
777
+ } | undefined;
778
+ }
779
+ declare const SendMessageResponse$1: MessageFns$1<SendMessageResponse$1>;
780
+ /**
781
+ * The stream response for a message. The stream should be one of the following
782
+ * sequences:
783
+ * If the response is a message, the stream should contain one, and only one,
784
+ * message and then close
785
+ * If the response is a task lifecycle, the first response should be a Task
786
+ * object followed by zero or more TaskStatusUpdateEvents and
787
+ * TaskArtifactUpdateEvents. The stream should complete when the Task
788
+ * if in an interrupted or terminal state. A stream that ends before these
789
+ * conditions are met are
790
+ */
791
+ interface StreamResponse$1 {
792
+ payload?: {
793
+ $case: "task";
794
+ value: Task$1;
795
+ } | {
796
+ $case: "msg";
797
+ value: Message;
798
+ } | {
799
+ $case: "statusUpdate";
800
+ value: TaskStatusUpdateEvent;
801
+ } | {
802
+ $case: "artifactUpdate";
803
+ value: TaskArtifactUpdateEvent;
804
+ } | undefined;
805
+ }
806
+ declare const StreamResponse$1: MessageFns$1<StreamResponse$1>;
807
+ interface ListTaskPushNotificationConfigResponse$1 {
808
+ configs: TaskPushNotificationConfig$1[];
809
+ /**
810
+ * A token, which can be sent as `page_token` to retrieve the next page.
811
+ * If this field is omitted, there are no subsequent pages.
812
+ */
813
+ nextPageToken: string;
814
+ }
815
+ declare const ListTaskPushNotificationConfigResponse$1: MessageFns$1<ListTaskPushNotificationConfigResponse$1>;
816
+ interface MessageFns$1<T> {
817
+ fromJSON(object: any): T;
818
+ toJSON(message: T): unknown;
819
+ }
820
+
821
+ type Task = Task$1;
822
+ declare const Task: MessageFns<Task>;
823
+ type AgentCard = AgentCard$1;
824
+ declare const AgentCard: MessageFns<AgentCard>;
825
+ type TaskPushNotificationConfig = TaskPushNotificationConfig$1;
826
+ declare const TaskPushNotificationConfig: MessageFns<TaskPushNotificationConfig>;
827
+ type SendMessageRequest = SendMessageRequest$1;
828
+ declare const SendMessageRequest: MessageFns<SendMessageRequest>;
829
+ type GetTaskRequest = GetTaskRequest$1;
830
+ declare const GetTaskRequest: MessageFns<GetTaskRequest>;
831
+ type CancelTaskRequest = CancelTaskRequest$1;
832
+ declare const CancelTaskRequest: MessageFns<CancelTaskRequest>;
833
+ type GetTaskPushNotificationConfigRequest = GetTaskPushNotificationConfigRequest$1;
834
+ declare const GetTaskPushNotificationConfigRequest: MessageFns<GetTaskPushNotificationConfigRequest>;
835
+ type DeleteTaskPushNotificationConfigRequest = DeleteTaskPushNotificationConfigRequest$1;
836
+ declare const DeleteTaskPushNotificationConfigRequest: MessageFns<DeleteTaskPushNotificationConfigRequest>;
837
+ type CreateTaskPushNotificationConfigRequest = CreateTaskPushNotificationConfigRequest$1;
838
+ declare const CreateTaskPushNotificationConfigRequest: MessageFns<CreateTaskPushNotificationConfigRequest>;
839
+ type TaskSubscriptionRequest = TaskSubscriptionRequest$1;
840
+ declare const TaskSubscriptionRequest: MessageFns<TaskSubscriptionRequest>;
841
+ type ListTaskPushNotificationConfigRequest = ListTaskPushNotificationConfigRequest$1;
842
+ declare const ListTaskPushNotificationConfigRequest: MessageFns<ListTaskPushNotificationConfigRequest>;
843
+ type GetAgentCardRequest = GetAgentCardRequest$1;
844
+ declare const GetAgentCardRequest: MessageFns<GetAgentCardRequest>;
845
+ type SendMessageResponse = SendMessageResponse$1;
846
+ declare const SendMessageResponse: MessageFns<SendMessageResponse>;
847
+ type StreamResponse = StreamResponse$1;
848
+ declare const StreamResponse: MessageFns<StreamResponse>;
849
+ type ListTaskPushNotificationConfigResponse = ListTaskPushNotificationConfigResponse$1;
850
+ declare const ListTaskPushNotificationConfigResponse: MessageFns<ListTaskPushNotificationConfigResponse>;
851
+ /**
852
+ * A2AService defines the gRPC version of the A2A protocol. This has a slightly
853
+ * different shape than the JSONRPC version to better conform to AIP-127,
854
+ * where appropriate. The nouns are AgentCard, Message, Task and
855
+ * TaskPushNotificationConfig.
856
+ * - Messages are not a standard resource so there is no get/delete/update/list
857
+ * interface, only a send and stream custom methods.
858
+ * - Tasks have a get interface and custom cancel and subscribe methods.
859
+ * - TaskPushNotificationConfig are a resource whose parent is a task.
860
+ * They have get, list and create methods.
861
+ * - AgentCard is a static resource with only a get method.
862
+ * fields are not present as they don't comply with AIP rules, and the
863
+ * optional history_length on the get task method is not present as it also
864
+ * violates AIP-127 and AIP-131.
865
+ */
866
+ type A2AServiceService = typeof A2AServiceService;
867
+ declare const A2AServiceService: {
868
+ /**
869
+ * Send a message to the agent. This is a blocking call that will return the
870
+ * task once it is completed, or a LRO if requested.
871
+ */
872
+ readonly sendMessage: {
873
+ readonly path: "/a2a.v1.A2AService/SendMessage";
874
+ readonly requestStream: false;
875
+ readonly responseStream: false;
876
+ readonly requestSerialize: (value: SendMessageRequest) => Buffer<ArrayBuffer>;
877
+ readonly requestDeserialize: (value: Buffer) => SendMessageRequest$1;
878
+ readonly responseSerialize: (value: SendMessageResponse) => Buffer<ArrayBuffer>;
879
+ readonly responseDeserialize: (value: Buffer) => SendMessageResponse$1;
880
+ };
881
+ /**
882
+ * SendStreamingMessage is a streaming call that will return a stream of
883
+ * task update events until the Task is in an interrupted or terminal state.
884
+ */
885
+ readonly sendStreamingMessage: {
886
+ readonly path: "/a2a.v1.A2AService/SendStreamingMessage";
887
+ readonly requestStream: false;
888
+ readonly responseStream: true;
889
+ readonly requestSerialize: (value: SendMessageRequest) => Buffer<ArrayBuffer>;
890
+ readonly requestDeserialize: (value: Buffer) => SendMessageRequest$1;
891
+ readonly responseSerialize: (value: StreamResponse) => Buffer<ArrayBuffer>;
892
+ readonly responseDeserialize: (value: Buffer) => StreamResponse$1;
893
+ };
894
+ /** Get the current state of a task from the agent. */
895
+ readonly getTask: {
896
+ readonly path: "/a2a.v1.A2AService/GetTask";
897
+ readonly requestStream: false;
898
+ readonly responseStream: false;
899
+ readonly requestSerialize: (value: GetTaskRequest) => Buffer<ArrayBuffer>;
900
+ readonly requestDeserialize: (value: Buffer) => GetTaskRequest$1;
901
+ readonly responseSerialize: (value: Task) => Buffer<ArrayBuffer>;
902
+ readonly responseDeserialize: (value: Buffer) => Task$1;
903
+ };
904
+ /**
905
+ * Cancel a task from the agent. If supported one should expect no
906
+ * more task updates for the task.
907
+ */
908
+ readonly cancelTask: {
909
+ readonly path: "/a2a.v1.A2AService/CancelTask";
910
+ readonly requestStream: false;
911
+ readonly responseStream: false;
912
+ readonly requestSerialize: (value: CancelTaskRequest) => Buffer<ArrayBuffer>;
913
+ readonly requestDeserialize: (value: Buffer) => CancelTaskRequest$1;
914
+ readonly responseSerialize: (value: Task) => Buffer<ArrayBuffer>;
915
+ readonly responseDeserialize: (value: Buffer) => Task$1;
916
+ };
917
+ /**
918
+ * TaskSubscription is a streaming call that will return a stream of task
919
+ * update events. This attaches the stream to an existing in process task.
920
+ * If the task is complete the stream will return the completed task (like
921
+ * GetTask) and close the stream.
922
+ */
923
+ readonly taskSubscription: {
924
+ readonly path: "/a2a.v1.A2AService/TaskSubscription";
925
+ readonly requestStream: false;
926
+ readonly responseStream: true;
927
+ readonly requestSerialize: (value: TaskSubscriptionRequest) => Buffer<ArrayBuffer>;
928
+ readonly requestDeserialize: (value: Buffer) => TaskSubscriptionRequest$1;
929
+ readonly responseSerialize: (value: StreamResponse) => Buffer<ArrayBuffer>;
930
+ readonly responseDeserialize: (value: Buffer) => StreamResponse$1;
931
+ };
932
+ /** Set a push notification config for a task. */
933
+ readonly createTaskPushNotificationConfig: {
934
+ readonly path: "/a2a.v1.A2AService/CreateTaskPushNotificationConfig";
935
+ readonly requestStream: false;
936
+ readonly responseStream: false;
937
+ readonly requestSerialize: (value: CreateTaskPushNotificationConfigRequest) => Buffer<ArrayBuffer>;
938
+ readonly requestDeserialize: (value: Buffer) => CreateTaskPushNotificationConfigRequest$1;
939
+ readonly responseSerialize: (value: TaskPushNotificationConfig) => Buffer<ArrayBuffer>;
940
+ readonly responseDeserialize: (value: Buffer) => TaskPushNotificationConfig$1;
941
+ };
942
+ /** Get a push notification config for a task. */
943
+ readonly getTaskPushNotificationConfig: {
944
+ readonly path: "/a2a.v1.A2AService/GetTaskPushNotificationConfig";
945
+ readonly requestStream: false;
946
+ readonly responseStream: false;
947
+ readonly requestSerialize: (value: GetTaskPushNotificationConfigRequest) => Buffer<ArrayBuffer>;
948
+ readonly requestDeserialize: (value: Buffer) => GetTaskPushNotificationConfigRequest$1;
949
+ readonly responseSerialize: (value: TaskPushNotificationConfig) => Buffer<ArrayBuffer>;
950
+ readonly responseDeserialize: (value: Buffer) => TaskPushNotificationConfig$1;
951
+ };
952
+ /** Get a list of push notifications configured for a task. */
953
+ readonly listTaskPushNotificationConfig: {
954
+ readonly path: "/a2a.v1.A2AService/ListTaskPushNotificationConfig";
955
+ readonly requestStream: false;
956
+ readonly responseStream: false;
957
+ readonly requestSerialize: (value: ListTaskPushNotificationConfigRequest) => Buffer<ArrayBuffer>;
958
+ readonly requestDeserialize: (value: Buffer) => ListTaskPushNotificationConfigRequest$1;
959
+ readonly responseSerialize: (value: ListTaskPushNotificationConfigResponse) => Buffer<ArrayBuffer>;
960
+ readonly responseDeserialize: (value: Buffer) => ListTaskPushNotificationConfigResponse$1;
961
+ };
962
+ /** GetAgentCard returns the agent card for the agent. */
963
+ readonly getAgentCard: {
964
+ readonly path: "/a2a.v1.A2AService/GetAgentCard";
965
+ readonly requestStream: false;
966
+ readonly responseStream: false;
967
+ readonly requestSerialize: (value: GetAgentCardRequest) => Buffer<ArrayBuffer>;
968
+ readonly requestDeserialize: (value: Buffer) => GetAgentCardRequest$1;
969
+ readonly responseSerialize: (value: AgentCard) => Buffer<ArrayBuffer>;
970
+ readonly responseDeserialize: (value: Buffer) => AgentCard$1;
971
+ };
972
+ /** Delete a push notification config for a task. */
973
+ readonly deleteTaskPushNotificationConfig: {
974
+ readonly path: "/a2a.v1.A2AService/DeleteTaskPushNotificationConfig";
975
+ readonly requestStream: false;
976
+ readonly responseStream: false;
977
+ readonly requestSerialize: (value: DeleteTaskPushNotificationConfigRequest) => Buffer<ArrayBuffer>;
978
+ readonly requestDeserialize: (value: Buffer) => DeleteTaskPushNotificationConfigRequest$1;
979
+ readonly responseSerialize: (value: Empty) => Buffer<ArrayBuffer>;
980
+ readonly responseDeserialize: (value: Buffer) => Empty;
981
+ };
982
+ };
983
+ interface A2AServiceServer extends UntypedServiceImplementation {
984
+ /**
985
+ * Send a message to the agent. This is a blocking call that will return the
986
+ * task once it is completed, or a LRO if requested.
987
+ */
988
+ sendMessage: handleUnaryCall<SendMessageRequest, SendMessageResponse>;
989
+ /**
990
+ * SendStreamingMessage is a streaming call that will return a stream of
991
+ * task update events until the Task is in an interrupted or terminal state.
992
+ */
993
+ sendStreamingMessage: handleServerStreamingCall<SendMessageRequest, StreamResponse>;
994
+ /** Get the current state of a task from the agent. */
995
+ getTask: handleUnaryCall<GetTaskRequest, Task>;
996
+ /**
997
+ * Cancel a task from the agent. If supported one should expect no
998
+ * more task updates for the task.
999
+ */
1000
+ cancelTask: handleUnaryCall<CancelTaskRequest, Task>;
1001
+ /**
1002
+ * TaskSubscription is a streaming call that will return a stream of task
1003
+ * update events. This attaches the stream to an existing in process task.
1004
+ * If the task is complete the stream will return the completed task (like
1005
+ * GetTask) and close the stream.
1006
+ */
1007
+ taskSubscription: handleServerStreamingCall<TaskSubscriptionRequest, StreamResponse>;
1008
+ /** Set a push notification config for a task. */
1009
+ createTaskPushNotificationConfig: handleUnaryCall<CreateTaskPushNotificationConfigRequest, TaskPushNotificationConfig>;
1010
+ /** Get a push notification config for a task. */
1011
+ getTaskPushNotificationConfig: handleUnaryCall<GetTaskPushNotificationConfigRequest, TaskPushNotificationConfig>;
1012
+ /** Get a list of push notifications configured for a task. */
1013
+ listTaskPushNotificationConfig: handleUnaryCall<ListTaskPushNotificationConfigRequest, ListTaskPushNotificationConfigResponse>;
1014
+ /** GetAgentCard returns the agent card for the agent. */
1015
+ getAgentCard: handleUnaryCall<GetAgentCardRequest, AgentCard>;
1016
+ /** Delete a push notification config for a task. */
1017
+ deleteTaskPushNotificationConfig: handleUnaryCall<DeleteTaskPushNotificationConfigRequest, Empty>;
1018
+ }
1019
+ interface MessageFns<T> {
1020
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1021
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1022
+ }
1023
+
1024
+ type UserBuilder = (call: grpc.ServerUnaryCall<unknown, unknown> | grpc.ServerWritableStream<unknown, unknown>) => Promise<User>;
1025
+ declare const UserBuilder: {
1026
+ noAuthentication: () => Promise<UnauthenticatedUser>;
1027
+ };
1028
+
1029
+ /**
1030
+ * Options for configuring the gRPC handler.
1031
+ */
1032
+ interface GrpcServiceOptions {
1033
+ requestHandler: A2ARequestHandler;
1034
+ userBuilder: UserBuilder;
1035
+ }
1036
+ /**
1037
+ * Creates a gRPC transport handler.
1038
+ * This handler implements the A2A gRPC service definition and acts as an
1039
+ * adapter between the gRPC transport layer and the core A2A request handler.
1040
+ *
1041
+ * @param requestHandler - The core A2A request handler for business logic.
1042
+ * @returns An object that implements the A2AServiceServer interface.
1043
+ *
1044
+ * @example
1045
+ * ```ts
1046
+ * const server = new grpc.Server();
1047
+ * const requestHandler = new DefaultRequestHandler(...);
1048
+ * server.addService(A2AService, grpcService({ requestHandler, userBuilder: UserBuilder.noAuthentication }));
1049
+ * ```
1050
+ */
1051
+ declare function grpcService(options: GrpcServiceOptions): A2AServiceServer;
1052
+
1053
+ export { A2AServiceService as A2AService, type GrpcServiceOptions, UserBuilder, grpcService };