@artinet/sdk 0.5.16 → 0.5.18

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.
Files changed (175) hide show
  1. package/README.md +108 -58
  2. package/dist/browser/browser.d.ts +9 -0
  3. package/dist/browser/browser.js +10 -0
  4. package/dist/browser/client/a2a-client.d.ts +126 -0
  5. package/dist/browser/client/a2a-client.js +221 -0
  6. package/dist/browser/client/index.d.ts +1 -0
  7. package/dist/browser/client/index.js +1 -0
  8. package/dist/browser/services/a2a/helpers/message-builder.d.ts +12 -0
  9. package/dist/browser/services/a2a/helpers/message-builder.js +61 -0
  10. package/dist/browser/transport/rpc/parser.d.ts +15 -0
  11. package/dist/browser/transport/rpc/parser.js +48 -0
  12. package/dist/browser/transport/rpc/rpc-client.d.ts +80 -0
  13. package/dist/browser/transport/rpc/rpc-client.js +189 -0
  14. package/dist/browser/transport/streaming/event-stream.d.ts +25 -0
  15. package/dist/browser/transport/streaming/event-stream.js +99 -0
  16. package/dist/browser/types/ext.d.ts +13 -0
  17. package/dist/browser/types/ext.js +10 -0
  18. package/dist/browser/types/index.d.ts +4 -0
  19. package/dist/browser/types/index.js +4 -0
  20. package/dist/browser/types/interfaces/client.d.ts +135 -0
  21. package/dist/browser/types/interfaces/client.js +5 -0
  22. package/dist/browser/types/interfaces/index.d.ts +3 -0
  23. package/dist/browser/types/interfaces/index.js +3 -0
  24. package/dist/browser/types/interfaces/services/a2a/builder.d.ts +37 -0
  25. package/dist/browser/types/interfaces/services/a2a/builder.js +5 -0
  26. package/dist/browser/types/interfaces/services/a2a/context.d.ts +162 -0
  27. package/dist/browser/types/interfaces/services/a2a/context.js +5 -0
  28. package/dist/browser/types/interfaces/services/a2a/engine.d.ts +7 -0
  29. package/dist/browser/types/interfaces/services/a2a/engine.js +5 -0
  30. package/dist/browser/types/interfaces/services/a2a/index.d.ts +5 -0
  31. package/dist/browser/types/interfaces/services/a2a/index.js +5 -0
  32. package/dist/browser/types/interfaces/services/a2a/legacy.d.ts +93 -0
  33. package/dist/browser/types/interfaces/services/a2a/legacy.js +5 -0
  34. package/dist/browser/types/interfaces/services/a2a/service.d.ts +413 -0
  35. package/dist/browser/types/interfaces/services/a2a/service.js +5 -0
  36. package/dist/browser/types/interfaces/services/core/context/command.d.ts +25 -0
  37. package/dist/browser/types/interfaces/services/core/context/command.js +5 -0
  38. package/dist/browser/types/interfaces/services/core/context/context.d.ts +207 -0
  39. package/dist/browser/types/interfaces/services/core/context/context.js +5 -0
  40. package/dist/browser/types/interfaces/services/core/context/index.d.ts +3 -0
  41. package/dist/browser/types/interfaces/services/core/context/index.js +3 -0
  42. package/dist/browser/types/interfaces/services/core/context/types.d.ts +11 -0
  43. package/dist/browser/types/interfaces/services/core/context/types.js +5 -0
  44. package/dist/browser/types/interfaces/services/core/execution/engine.d.ts +106 -0
  45. package/dist/browser/types/interfaces/services/core/execution/engine.js +5 -0
  46. package/dist/browser/types/interfaces/services/core/execution/environment.d.ts +11 -0
  47. package/dist/browser/types/interfaces/services/core/execution/environment.js +5 -0
  48. package/dist/browser/types/interfaces/services/core/execution/execute.d.ts +7 -0
  49. package/dist/browser/types/interfaces/services/core/execution/execute.js +5 -0
  50. package/dist/browser/types/interfaces/services/core/execution/index.d.ts +3 -0
  51. package/dist/browser/types/interfaces/services/core/execution/index.js +3 -0
  52. package/dist/browser/types/interfaces/services/core/index.d.ts +4 -0
  53. package/dist/browser/types/interfaces/services/core/index.js +4 -0
  54. package/dist/browser/types/interfaces/services/core/managers/cancellation.d.ts +9 -0
  55. package/dist/browser/types/interfaces/services/core/managers/cancellation.js +5 -0
  56. package/dist/browser/types/interfaces/services/core/managers/connection.d.ts +9 -0
  57. package/dist/browser/types/interfaces/services/core/managers/connection.js +5 -0
  58. package/dist/browser/types/interfaces/services/core/managers/context.d.ts +17 -0
  59. package/dist/browser/types/interfaces/services/core/managers/context.js +5 -0
  60. package/dist/browser/types/interfaces/services/core/managers/event.d.ts +328 -0
  61. package/dist/browser/types/interfaces/services/core/managers/event.js +5 -0
  62. package/dist/browser/types/interfaces/services/core/managers/index.d.ts +6 -0
  63. package/dist/browser/types/interfaces/services/core/managers/index.js +6 -0
  64. package/dist/browser/types/interfaces/services/core/managers/stream.d.ts +217 -0
  65. package/dist/browser/types/interfaces/services/core/managers/stream.js +5 -0
  66. package/dist/browser/types/interfaces/services/core/managers/task.d.ts +9 -0
  67. package/dist/browser/types/interfaces/services/core/managers/task.js +1 -0
  68. package/dist/browser/types/interfaces/services/core/service.d.ts +115 -0
  69. package/dist/browser/types/interfaces/services/core/service.js +5 -0
  70. package/dist/browser/types/interfaces/services/index.d.ts +4 -0
  71. package/dist/browser/types/interfaces/services/index.js +4 -0
  72. package/dist/browser/types/interfaces/services/mcp/index.d.ts +1 -0
  73. package/dist/browser/types/interfaces/services/mcp/index.js +1 -0
  74. package/dist/browser/types/interfaces/services/mcp/service.d.ts +49 -0
  75. package/dist/browser/types/interfaces/services/mcp/service.js +5 -0
  76. package/dist/browser/types/interfaces/services/protocol.d.ts +33 -0
  77. package/dist/browser/types/interfaces/services/protocol.js +34 -0
  78. package/dist/browser/types/interfaces/storage.d.ts +8 -0
  79. package/dist/browser/types/interfaces/storage.js +5 -0
  80. package/dist/browser/types/schemas/a2a/agent.d.ts +2583 -0
  81. package/dist/browser/types/schemas/a2a/agent.js +323 -0
  82. package/dist/browser/types/schemas/a2a/auth.d.ts +908 -0
  83. package/dist/browser/types/schemas/a2a/auth.js +283 -0
  84. package/dist/browser/types/schemas/a2a/error.d.ts +396 -0
  85. package/dist/browser/types/schemas/a2a/error.js +163 -0
  86. package/dist/browser/types/schemas/a2a/index.d.ts +11 -0
  87. package/dist/browser/types/schemas/a2a/index.js +11 -0
  88. package/dist/browser/types/schemas/a2a/kind.d.ts +11 -0
  89. package/dist/browser/types/schemas/a2a/kind.js +20 -0
  90. package/dist/browser/types/schemas/a2a/message.d.ts +10343 -0
  91. package/dist/browser/types/schemas/a2a/message.js +130 -0
  92. package/dist/browser/types/schemas/a2a/notification.d.ts +1517 -0
  93. package/dist/browser/types/schemas/a2a/notification.js +203 -0
  94. package/dist/browser/types/schemas/a2a/parameters.d.ts +956 -0
  95. package/dist/browser/types/schemas/a2a/parameters.js +241 -0
  96. package/dist/browser/types/schemas/a2a/protocol.d.ts +14363 -0
  97. package/dist/browser/types/schemas/a2a/protocol.js +59 -0
  98. package/dist/browser/types/schemas/a2a/rpc.d.ts +182 -0
  99. package/dist/browser/types/schemas/a2a/rpc.js +126 -0
  100. package/dist/browser/types/schemas/a2a/task.d.ts +5886 -0
  101. package/dist/browser/types/schemas/a2a/task.js +134 -0
  102. package/dist/browser/types/schemas/a2a/transport.d.ts +31 -0
  103. package/dist/browser/types/schemas/a2a/transport.js +28 -0
  104. package/dist/browser/types/schemas/index.d.ts +1 -0
  105. package/dist/browser/types/schemas/index.js +1 -0
  106. package/dist/browser/types/utils/index.d.ts +1 -0
  107. package/dist/browser/types/utils/index.js +1 -0
  108. package/dist/browser/types/utils/transform.d.ts +64 -0
  109. package/dist/browser/types/utils/transform.js +35 -0
  110. package/dist/browser/utils/common/constants.d.ts +11 -0
  111. package/dist/browser/utils/common/constants.js +38 -0
  112. package/dist/browser/utils/common/errors.d.ts +24 -0
  113. package/dist/browser/utils/common/errors.js +42 -0
  114. package/dist/browser/utils/common/utils.d.ts +9 -0
  115. package/dist/browser/utils/common/utils.js +11 -0
  116. package/dist/browser/utils/logging/index.d.ts +2 -0
  117. package/dist/browser/utils/logging/index.js +2 -0
  118. package/dist/browser/utils/logging/log.d.ts +33 -0
  119. package/dist/browser/utils/logging/log.js +75 -0
  120. package/dist/browser/utils/logging/logger.d.ts +18 -0
  121. package/dist/browser/utils/logging/logger.js +18 -0
  122. package/dist/client/a2a-client.d.ts +2 -1
  123. package/dist/client/a2a-client.js +13 -4
  124. package/dist/server/express/errors.js +1 -1
  125. package/dist/server/express/middeware.d.ts +2 -2
  126. package/dist/server/express/middeware.js +26 -6
  127. package/dist/server/express/server.d.ts +26 -25
  128. package/dist/server/express/server.js +32 -6
  129. package/dist/services/a2a/factory/builder.d.ts +24 -24
  130. package/dist/services/a2a/factory/builder.js +6 -1
  131. package/dist/services/a2a/factory/service.js +2 -1
  132. package/dist/services/a2a/helpers/agentcard-builder.d.ts +7 -0
  133. package/dist/services/a2a/helpers/agentcard-builder.js +23 -0
  134. package/dist/services/a2a/helpers/history.d.ts +2 -0
  135. package/dist/services/a2a/helpers/history.js +3 -0
  136. package/dist/services/a2a/helpers/index.d.ts +3 -0
  137. package/dist/services/a2a/helpers/index.js +3 -0
  138. package/dist/services/a2a/methods/get-task.d.ts +46 -46
  139. package/dist/services/a2a/methods/get-task.js +2 -0
  140. package/dist/services/a2a/methods/send-message.js +18 -1
  141. package/dist/services/a2a/service.d.ts +154 -153
  142. package/dist/services/a2a/service.js +20 -6
  143. package/dist/services/mcp/service.js +0 -1
  144. package/dist/transport/rpc/parser.js +2 -2
  145. package/dist/transport/rpc/rpc-client.js +2 -2
  146. package/dist/transport/trpc/a2a/factory/router.d.ts +1084 -1084
  147. package/dist/transport/trpc/a2a/routes/info.d.ts +36 -36
  148. package/dist/transport/trpc/a2a/routes/message/route.d.ts +225 -225
  149. package/dist/transport/trpc/a2a/routes/tasks/route.d.ts +257 -257
  150. package/dist/transport/trpc/a2a/trpc.d.ts +120 -120
  151. package/dist/types/interfaces/services/a2a/service.d.ts +6 -1
  152. package/dist/types/schemas/a2a/agent.d.ts +818 -818
  153. package/dist/types/schemas/a2a/agent.js +1 -23
  154. package/dist/types/schemas/a2a/auth.d.ts +197 -197
  155. package/dist/types/schemas/a2a/auth.js +4 -19
  156. package/dist/types/schemas/a2a/error.d.ts +24 -24
  157. package/dist/types/schemas/a2a/message.d.ts +4499 -4499
  158. package/dist/types/schemas/a2a/message.js +2 -10
  159. package/dist/types/schemas/a2a/notification.d.ts +403 -403
  160. package/dist/types/schemas/a2a/notification.js +3 -7
  161. package/dist/types/schemas/a2a/parameters.d.ts +264 -264
  162. package/dist/types/schemas/a2a/parameters.js +1 -14
  163. package/dist/types/schemas/a2a/protocol.d.ts +5988 -5988
  164. package/dist/types/schemas/a2a/rpc.d.ts +20 -20
  165. package/dist/types/schemas/a2a/rpc.js +0 -5
  166. package/dist/types/schemas/a2a/task.d.ts +2513 -2513
  167. package/dist/types/schemas/a2a/task.js +10 -11
  168. package/dist/utils/common/constants.js +1 -1
  169. package/dist/utils/common/errors.d.ts +2 -1
  170. package/dist/utils/common/errors.js +2 -1
  171. package/dist/utils/common/schema-validation.d.ts +2 -0
  172. package/dist/utils/common/schema-validation.js +12 -0
  173. package/dist/utils/index.d.ts +1 -0
  174. package/dist/utils/index.js +1 -0
  175. package/package.json +20 -17
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { z } from "zod";
6
+ /**
7
+ * @description Type of a security scheme.
8
+ */
9
+ export const SecuritySchemeTypeSchema = z
10
+ .enum(["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"])
11
+ .describe("Type of a security scheme.");
12
+ export const SecuritySchemeType = SecuritySchemeTypeSchema.enum;
13
+ /**
14
+ * @description Base properties shared by all security schemes.
15
+ */
16
+ export const SecuritySchemeBaseSchema = z
17
+ .object({
18
+ /**
19
+ * @required Type of the security scheme.
20
+ */
21
+ type: SecuritySchemeTypeSchema.describe("Type of the security scheme."),
22
+ /**
23
+ * @optional Description of this security scheme.
24
+ */
25
+ description: z
26
+ .string()
27
+ .optional()
28
+ .describe("Description of this security scheme."),
29
+ })
30
+ .describe("Base properties shared by all security schemes.");
31
+ /**
32
+ * @description Defines a security scheme using an API key.
33
+ */
34
+ export const APIKeySecuritySchemeSchema = SecuritySchemeBaseSchema.extend({
35
+ /**
36
+ * @required API Key Type of the security scheme.
37
+ */
38
+ type: SecuritySchemeTypeSchema.refine((type) => type === "apiKey").describe("API Key Type of the security scheme."),
39
+ /**
40
+ * @required The location of the API key. Valid values are "query", "header", or "cookie".
41
+ */
42
+ in: z
43
+ .enum(["query", "header", "cookie"])
44
+ .describe("The location of the API key. Valid values are 'query', 'header', or 'cookie'."),
45
+ /**
46
+ * @required The name of the header, query or cookie parameter to be used.
47
+ */
48
+ name: z
49
+ .string()
50
+ .describe("The name of the header, query or cookie parameter to be used."),
51
+ }).describe("Defines a security scheme using an API key.");
52
+ /**
53
+ * @description HTTP Authentication security scheme.
54
+ */
55
+ export const HTTPAuthSecuritySchemeSchema = SecuritySchemeBaseSchema.extend({
56
+ /**
57
+ * @required HTTP Type of the security scheme.
58
+ */
59
+ type: SecuritySchemeTypeSchema.refine((type) => type === "http").describe("HTTP Type of the security scheme."),
60
+ /**
61
+ * @required The name of the HTTP Authentication scheme to be used in the Authorization header as defined
62
+ * in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry.
63
+ * The value is case-insensitive, as defined in RFC7235.
64
+ */
65
+ scheme: z
66
+ .string()
67
+ .describe("The name of the HTTP Authentication scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. The value is case-insensitive, as defined in RFC7235."),
68
+ /**
69
+ * @optional A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually
70
+ * generated by an authorization server, so this information is primarily for documentation
71
+ * purposes.
72
+ */
73
+ bearerFormat: z
74
+ .string()
75
+ .optional()
76
+ .describe("A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes."),
77
+ });
78
+ /**
79
+ * @description Configuration details for a supported Authorization Code OAuth Flow
80
+ */
81
+ export const AuthorizationCodeOAuthFlowSchema = z
82
+ .object({
83
+ /**
84
+ * @required The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2
85
+ * standard requires the use of TLS
86
+ */
87
+ authorizationUrl: z
88
+ .string()
89
+ .url()
90
+ .describe("The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS"),
91
+ /**
92
+ * @required The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
93
+ * requires the use of TLS.
94
+ */
95
+ tokenUrl: z
96
+ .string()
97
+ .url()
98
+ .describe("The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
99
+ /**
100
+ * @optional The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
101
+ * standard requires the use of TLS.
102
+ */
103
+ refreshUrl: z
104
+ .string()
105
+ .url()
106
+ .optional()
107
+ .describe("The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
108
+ /**
109
+ * @required The available scopes for the OAuth2 security scheme. A map between the scope name and a short
110
+ * description for it. The map MAY be empty.
111
+ */
112
+ scopes: z
113
+ .record(z.string(), z.string())
114
+ .describe("The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty."),
115
+ })
116
+ .describe("Configuration details for a supported Authorization Code OAuth Flow");
117
+ /**
118
+ * @description Configuration details for a supported Client Credentials OAuth Flow
119
+ */
120
+ export const ClientCredentialsOAuthFlowSchema = z
121
+ .object({
122
+ /**
123
+ * @required The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
124
+ * requires the use of TLS.
125
+ */
126
+ tokenUrl: z
127
+ .string()
128
+ .url()
129
+ .describe("The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
130
+ /**
131
+ * @optional The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
132
+ * standard requires the use of TLS.
133
+ */
134
+ refreshUrl: z
135
+ .string()
136
+ .url()
137
+ .optional()
138
+ .describe("The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
139
+ /**
140
+ * @required The available scopes for the OAuth2 security scheme. A map between the scope name and a short
141
+ * description for it. The map MAY be empty.
142
+ */
143
+ scopes: z
144
+ .record(z.string(), z.string())
145
+ .describe("The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty."),
146
+ })
147
+ .describe("Configuration details for a supported Client Credentials OAuth Flow");
148
+ /**
149
+ * @description Configuration details for a supported Implicit OAuth Flow
150
+ */
151
+ export const ImplicitOAuthFlowSchema = z
152
+ .object({
153
+ /**
154
+ * @required The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2
155
+ * standard requires the use of TLS
156
+ */
157
+ authorizationUrl: z
158
+ .string()
159
+ .url()
160
+ .describe("The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS"),
161
+ /**
162
+ * @optional The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
163
+ * standard requires the use of TLS.
164
+ */
165
+ refreshUrl: z
166
+ .string()
167
+ .url()
168
+ .optional()
169
+ .describe("The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
170
+ /**
171
+ * @required The available scopes for the OAuth2 security scheme. A map between the scope name and a short
172
+ * description for it. The map MAY be empty.
173
+ */
174
+ scopes: z
175
+ .record(z.string(), z.string())
176
+ .describe("The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty."),
177
+ })
178
+ .describe("Configuration details for a supported Implicit OAuth Flow");
179
+ /**
180
+ * @description Configuration details for a supported Password OAuth Flow
181
+ */
182
+ export const PasswordOAuthFlowSchema = z
183
+ .object({
184
+ /**
185
+ * @required The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard
186
+ * requires the use of TLS.
187
+ */
188
+ tokenUrl: z
189
+ .string()
190
+ .url()
191
+ .describe("The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
192
+ /**
193
+ * @optional The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2
194
+ * standard requires the use of TLS.
195
+ */
196
+ refreshUrl: z
197
+ .string()
198
+ .url()
199
+ .optional()
200
+ .describe("The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS."),
201
+ /**
202
+ * @required The available scopes for the OAuth2 security scheme. A map between the scope name and a short
203
+ * description for it. The map MAY be empty.
204
+ */
205
+ scopes: z
206
+ .record(z.string(), z.string())
207
+ .describe("The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty."),
208
+ })
209
+ .describe("Configuration details for a supported Password OAuth Flow");
210
+ /**
211
+ * @description The configuration of supported OAuth Flows
212
+ */
213
+ export const OAuthFlowsSchema = z
214
+ .object({
215
+ /**
216
+ * @optional Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
217
+ */
218
+ authorizationCode: AuthorizationCodeOAuthFlowSchema.optional().describe("Configuration for the OAuth Authorization Code flow"),
219
+ /**
220
+ * @optional Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0
221
+ */
222
+ clientCredentials: ClientCredentialsOAuthFlowSchema.optional().describe("Configuration for the OAuth Client Credentials flow"),
223
+ /**
224
+ * @optional Configuration for the OAuth Implicit flow
225
+ */
226
+ implicit: ImplicitOAuthFlowSchema.optional().describe("Configuration for the OAuth Implicit flow"),
227
+ /**
228
+ * @optional Configuration for the OAuth Resource Owner Password flow
229
+ */
230
+ password: PasswordOAuthFlowSchema.optional().describe("Configuration for the OAuth Resource Owner Password flow"),
231
+ })
232
+ .describe("The configuration of supported OAuth Flows");
233
+ /**
234
+ * @description OAuth2 security scheme configuration.
235
+ */
236
+ export const OAuth2SecuritySchemeSchema = SecuritySchemeBaseSchema.extend({
237
+ /**
238
+ * @required OAuth2 Type of the security scheme.
239
+ */
240
+ type: SecuritySchemeTypeSchema.refine((type) => type === "oauth2").describe("OAuth2 Type of the security scheme."),
241
+ /**
242
+ * @required An object containing configuration information for the flow types supported.
243
+ */
244
+ flows: OAuthFlowsSchema.describe("An object containing configuration information for the flow types supported."),
245
+ /**
246
+ * @optional URL to the oauth2 authorization server metadata
247
+ * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
248
+ */
249
+ oauth2MetadataUrl: z
250
+ .string()
251
+ .url()
252
+ .optional()
253
+ .describe("URL to the oauth2 authorization server metadata"),
254
+ }).describe("OAuth2 security scheme configuration.");
255
+ /**
256
+ * @description OpenID Connect security scheme.
257
+ */
258
+ export const OpenIdConnectSecuritySchemeSchema = SecuritySchemeBaseSchema.extend({
259
+ /**
260
+ * @required Type of the security scheme.
261
+ */
262
+ type: SecuritySchemeTypeSchema.refine((type) => type === "openIdConnect"),
263
+ /**
264
+ * @required Well-known URL to discover the [[OpenID-Connect-Discovery]] provider metadata.
265
+ */
266
+ openIdConnectUrl: z.string().url(),
267
+ });
268
+ /**
269
+ * @description Mutual TLS (mTLS) security scheme.
270
+ */
271
+ export const MutualTLSSecuritySchemeSchema = SecuritySchemeBaseSchema.extend({
272
+ /**
273
+ * @required Type of the security scheme.
274
+ */
275
+ type: SecuritySchemeTypeSchema.refine((type) => type === "mutualTLS"),
276
+ });
277
+ export const SecuritySchemeSchema = z.union([
278
+ APIKeySecuritySchemeSchema,
279
+ HTTPAuthSecuritySchemeSchema,
280
+ OAuth2SecuritySchemeSchema,
281
+ OpenIdConnectSecuritySchemeSchema,
282
+ MutualTLSSecuritySchemeSchema,
283
+ ]);
@@ -0,0 +1,396 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { z } from "zod";
6
+ /**
7
+ * @description Error code for JSON Parse Error (-32700). Invalid JSON was received by the server.
8
+ */
9
+ export declare const ErrorCodeParseError = -32700;
10
+ export declare const JSONParseErrorSchema: z.ZodObject<{
11
+ data: z.ZodOptional<z.ZodUnknown>;
12
+ } & {
13
+ code: z.ZodLiteral<-32700>;
14
+ message: z.ZodDefault<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ message: string;
17
+ code: -32700;
18
+ data?: unknown;
19
+ }, {
20
+ code: -32700;
21
+ data?: unknown;
22
+ message?: string | undefined;
23
+ }>;
24
+ export type JSONParseError = z.infer<typeof JSONParseErrorSchema>;
25
+ /**
26
+ * @description Error code for Invalid Request (-32600). The JSON sent is not a valid Request object.
27
+ */
28
+ export declare const ErrorCodeInvalidRequest = -32600;
29
+ export declare const InvalidRequestErrorSchema: z.ZodObject<{
30
+ data: z.ZodOptional<z.ZodUnknown>;
31
+ } & {
32
+ code: z.ZodLiteral<-32600>;
33
+ message: z.ZodDefault<z.ZodString>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ message: string;
36
+ code: -32600;
37
+ data?: unknown;
38
+ }, {
39
+ code: -32600;
40
+ data?: unknown;
41
+ message?: string | undefined;
42
+ }>;
43
+ export type InvalidRequestError = z.infer<typeof InvalidRequestErrorSchema>;
44
+ /**
45
+ * @description Error code for Method Not Found (-32601). The method does not exist / is not available.
46
+ */
47
+ export declare const ErrorCodeMethodNotFound = -32601;
48
+ export declare const MethodNotFoundErrorSchema: z.ZodObject<{
49
+ data: z.ZodOptional<z.ZodUnknown>;
50
+ } & {
51
+ code: z.ZodLiteral<-32601>;
52
+ message: z.ZodDefault<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ message: string;
55
+ code: -32601;
56
+ data?: unknown;
57
+ }, {
58
+ code: -32601;
59
+ data?: unknown;
60
+ message?: string | undefined;
61
+ }>;
62
+ export type MethodNotFoundError = z.infer<typeof MethodNotFoundErrorSchema>;
63
+ /**
64
+ * @description Error code for Invalid Params (-32602). Invalid method parameter(s).
65
+ */
66
+ export declare const ErrorCodeInvalidParams = -32602;
67
+ export declare const InvalidParamsErrorSchema: z.ZodObject<{
68
+ data: z.ZodOptional<z.ZodUnknown>;
69
+ } & {
70
+ code: z.ZodLiteral<-32602>;
71
+ message: z.ZodDefault<z.ZodString>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ message: string;
74
+ code: -32602;
75
+ data?: unknown;
76
+ }, {
77
+ code: -32602;
78
+ data?: unknown;
79
+ message?: string | undefined;
80
+ }>;
81
+ export type InvalidParamsError = z.infer<typeof InvalidParamsErrorSchema>;
82
+ /**
83
+ * @description Error code for Internal Error (-32603). Internal JSON-RPC error.
84
+ */
85
+ export declare const ErrorCodeInternalError = -32603;
86
+ export declare const InternalErrorSchema: z.ZodObject<{
87
+ data: z.ZodOptional<z.ZodUnknown>;
88
+ } & {
89
+ code: z.ZodLiteral<-32603>;
90
+ message: z.ZodDefault<z.ZodString>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ message: string;
93
+ code: -32603;
94
+ data?: unknown;
95
+ }, {
96
+ code: -32603;
97
+ data?: unknown;
98
+ message?: string | undefined;
99
+ }>;
100
+ export type InternalError = z.infer<typeof InternalErrorSchema>;
101
+ /**
102
+ * @description Error code for Task Not Found (-32001). The specified task was not found.
103
+ */
104
+ export declare const ErrorCodeTaskNotFound = -32001;
105
+ export declare const TaskNotFoundErrorSchema: z.ZodObject<{
106
+ data: z.ZodOptional<z.ZodUnknown>;
107
+ } & {
108
+ code: z.ZodLiteral<-32001>;
109
+ message: z.ZodDefault<z.ZodString>;
110
+ }, "strip", z.ZodTypeAny, {
111
+ message: string;
112
+ code: -32001;
113
+ data?: unknown;
114
+ }, {
115
+ code: -32001;
116
+ data?: unknown;
117
+ message?: string | undefined;
118
+ }>;
119
+ export type TaskNotFoundError = z.infer<typeof TaskNotFoundErrorSchema>;
120
+ /**
121
+ * @description Error code for Task Not Cancelable (-32002). The specified task cannot be canceled.
122
+ */
123
+ export declare const ErrorCodeTaskNotCancelable = -32002;
124
+ export declare const TaskNotCancelableErrorSchema: z.ZodObject<{
125
+ data: z.ZodOptional<z.ZodUnknown>;
126
+ } & {
127
+ code: z.ZodLiteral<-32002>;
128
+ message: z.ZodDefault<z.ZodString>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ message: string;
131
+ code: -32002;
132
+ data?: unknown;
133
+ }, {
134
+ code: -32002;
135
+ data?: unknown;
136
+ message?: string | undefined;
137
+ }>;
138
+ export type TaskNotCancelableError = z.infer<typeof TaskNotCancelableErrorSchema>;
139
+ /**
140
+ * @description Error code for Push Notification Not Supported (-32003). Push Notifications are not supported for this operation or agent.
141
+ */
142
+ export declare const ErrorCodePushNotificationNotSupported = -32003;
143
+ export declare const PushNotificationNotSupportedErrorSchema: z.ZodObject<{
144
+ data: z.ZodOptional<z.ZodUnknown>;
145
+ } & {
146
+ code: z.ZodLiteral<-32003>;
147
+ message: z.ZodDefault<z.ZodString>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ message: string;
150
+ code: -32003;
151
+ data?: unknown;
152
+ }, {
153
+ code: -32003;
154
+ data?: unknown;
155
+ message?: string | undefined;
156
+ }>;
157
+ export type PushNotificationNotSupportedError = z.infer<typeof PushNotificationNotSupportedErrorSchema>;
158
+ /**
159
+ * @description Error code for Unsupported Operation (-32004). The requested operation is not supported by the agent.
160
+ */
161
+ export declare const ErrorCodeUnsupportedOperation = -32004;
162
+ export declare const UnsupportedOperationErrorSchema: z.ZodObject<{
163
+ data: z.ZodOptional<z.ZodUnknown>;
164
+ } & {
165
+ code: z.ZodLiteral<-32004>;
166
+ message: z.ZodDefault<z.ZodString>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ message: string;
169
+ code: -32004;
170
+ data?: unknown;
171
+ }, {
172
+ code: -32004;
173
+ data?: unknown;
174
+ message?: string | undefined;
175
+ }>;
176
+ export type UnsupportedOperationError = z.infer<typeof UnsupportedOperationErrorSchema>;
177
+ /**
178
+ * @description Error code for Content Type Not Supported (-32005). The requested content type is not supported by the agent.
179
+ */
180
+ export declare const ErrorCodeContentTypeNotSupported = -32005;
181
+ export declare const ContentTypeNotSupportedErrorSchema: z.ZodObject<{
182
+ data: z.ZodOptional<z.ZodUnknown>;
183
+ } & {
184
+ code: z.ZodLiteral<-32005>;
185
+ message: z.ZodDefault<z.ZodString>;
186
+ }, "strip", z.ZodTypeAny, {
187
+ message: string;
188
+ code: -32005;
189
+ data?: unknown;
190
+ }, {
191
+ code: -32005;
192
+ data?: unknown;
193
+ message?: string | undefined;
194
+ }>;
195
+ export type ContentTypeNotSupportedError = z.infer<typeof ContentTypeNotSupportedErrorSchema>;
196
+ /**
197
+ * @description Error code for Invalid Agent Response (-32006). The agent returned an invalid response for the current method.
198
+ */
199
+ export declare const ErrorCodeInvalidAgentResponse = -32006;
200
+ export declare const InvalidAgentResponseErrorSchema: z.ZodObject<{
201
+ data: z.ZodOptional<z.ZodUnknown>;
202
+ } & {
203
+ code: z.ZodLiteral<-32006>;
204
+ message: z.ZodDefault<z.ZodString>;
205
+ }, "strip", z.ZodTypeAny, {
206
+ message: string;
207
+ code: -32006;
208
+ data?: unknown;
209
+ }, {
210
+ code: -32006;
211
+ data?: unknown;
212
+ message?: string | undefined;
213
+ }>;
214
+ export type InvalidAgentResponseError = z.infer<typeof InvalidAgentResponseErrorSchema>;
215
+ /**
216
+ * An A2A-specific error indicating that the agent does not have an Authenticated Extended Card configured
217
+ */
218
+ export declare const ErrorCodeAuthenticatedExtendedCardNotConfigured = -32007;
219
+ export declare const AuthenticatedExtendedCardNotConfiguredErrorSchema: z.ZodObject<{
220
+ data: z.ZodOptional<z.ZodUnknown>;
221
+ } & {
222
+ code: z.ZodLiteral<-32007>;
223
+ message: z.ZodDefault<z.ZodString>;
224
+ }, "strip", z.ZodTypeAny, {
225
+ message: string;
226
+ code: -32007;
227
+ data?: unknown;
228
+ }, {
229
+ code: -32007;
230
+ data?: unknown;
231
+ message?: string | undefined;
232
+ }>;
233
+ export type AuthenticatedExtendedCardNotConfiguredError = z.infer<typeof AuthenticatedExtendedCardNotConfiguredErrorSchema>;
234
+ /**
235
+ * Union of all well-known A2A and standard JSON-RPC error codes defined in this schema.
236
+ */
237
+ export declare const KnownErrorCodeSchema: z.ZodUnion<[z.ZodLiteral<-32700>, z.ZodLiteral<-32600>, z.ZodLiteral<-32601>, z.ZodLiteral<-32602>, z.ZodLiteral<-32603>, z.ZodLiteral<-32001>, z.ZodLiteral<-32002>, z.ZodLiteral<-32003>, z.ZodLiteral<-32004>, z.ZodLiteral<-32005>, z.ZodLiteral<-32006>, z.ZodLiteral<-32007>]>;
238
+ export type KnownErrorCode = z.infer<typeof KnownErrorCodeSchema>;
239
+ export declare const A2AErrorSchema: z.ZodUnion<[z.ZodObject<{
240
+ data: z.ZodOptional<z.ZodUnknown>;
241
+ } & {
242
+ code: z.ZodLiteral<-32700>;
243
+ message: z.ZodDefault<z.ZodString>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ message: string;
246
+ code: -32700;
247
+ data?: unknown;
248
+ }, {
249
+ code: -32700;
250
+ data?: unknown;
251
+ message?: string | undefined;
252
+ }>, z.ZodObject<{
253
+ data: z.ZodOptional<z.ZodUnknown>;
254
+ } & {
255
+ code: z.ZodLiteral<-32600>;
256
+ message: z.ZodDefault<z.ZodString>;
257
+ }, "strip", z.ZodTypeAny, {
258
+ message: string;
259
+ code: -32600;
260
+ data?: unknown;
261
+ }, {
262
+ code: -32600;
263
+ data?: unknown;
264
+ message?: string | undefined;
265
+ }>, z.ZodObject<{
266
+ data: z.ZodOptional<z.ZodUnknown>;
267
+ } & {
268
+ code: z.ZodLiteral<-32601>;
269
+ message: z.ZodDefault<z.ZodString>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ message: string;
272
+ code: -32601;
273
+ data?: unknown;
274
+ }, {
275
+ code: -32601;
276
+ data?: unknown;
277
+ message?: string | undefined;
278
+ }>, z.ZodObject<{
279
+ data: z.ZodOptional<z.ZodUnknown>;
280
+ } & {
281
+ code: z.ZodLiteral<-32602>;
282
+ message: z.ZodDefault<z.ZodString>;
283
+ }, "strip", z.ZodTypeAny, {
284
+ message: string;
285
+ code: -32602;
286
+ data?: unknown;
287
+ }, {
288
+ code: -32602;
289
+ data?: unknown;
290
+ message?: string | undefined;
291
+ }>, z.ZodObject<{
292
+ data: z.ZodOptional<z.ZodUnknown>;
293
+ } & {
294
+ code: z.ZodLiteral<-32603>;
295
+ message: z.ZodDefault<z.ZodString>;
296
+ }, "strip", z.ZodTypeAny, {
297
+ message: string;
298
+ code: -32603;
299
+ data?: unknown;
300
+ }, {
301
+ code: -32603;
302
+ data?: unknown;
303
+ message?: string | undefined;
304
+ }>, z.ZodObject<{
305
+ data: z.ZodOptional<z.ZodUnknown>;
306
+ } & {
307
+ code: z.ZodLiteral<-32001>;
308
+ message: z.ZodDefault<z.ZodString>;
309
+ }, "strip", z.ZodTypeAny, {
310
+ message: string;
311
+ code: -32001;
312
+ data?: unknown;
313
+ }, {
314
+ code: -32001;
315
+ data?: unknown;
316
+ message?: string | undefined;
317
+ }>, z.ZodObject<{
318
+ data: z.ZodOptional<z.ZodUnknown>;
319
+ } & {
320
+ code: z.ZodLiteral<-32002>;
321
+ message: z.ZodDefault<z.ZodString>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ message: string;
324
+ code: -32002;
325
+ data?: unknown;
326
+ }, {
327
+ code: -32002;
328
+ data?: unknown;
329
+ message?: string | undefined;
330
+ }>, z.ZodObject<{
331
+ data: z.ZodOptional<z.ZodUnknown>;
332
+ } & {
333
+ code: z.ZodLiteral<-32003>;
334
+ message: z.ZodDefault<z.ZodString>;
335
+ }, "strip", z.ZodTypeAny, {
336
+ message: string;
337
+ code: -32003;
338
+ data?: unknown;
339
+ }, {
340
+ code: -32003;
341
+ data?: unknown;
342
+ message?: string | undefined;
343
+ }>, z.ZodObject<{
344
+ data: z.ZodOptional<z.ZodUnknown>;
345
+ } & {
346
+ code: z.ZodLiteral<-32004>;
347
+ message: z.ZodDefault<z.ZodString>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ message: string;
350
+ code: -32004;
351
+ data?: unknown;
352
+ }, {
353
+ code: -32004;
354
+ data?: unknown;
355
+ message?: string | undefined;
356
+ }>, z.ZodObject<{
357
+ data: z.ZodOptional<z.ZodUnknown>;
358
+ } & {
359
+ code: z.ZodLiteral<-32005>;
360
+ message: z.ZodDefault<z.ZodString>;
361
+ }, "strip", z.ZodTypeAny, {
362
+ message: string;
363
+ code: -32005;
364
+ data?: unknown;
365
+ }, {
366
+ code: -32005;
367
+ data?: unknown;
368
+ message?: string | undefined;
369
+ }>, z.ZodObject<{
370
+ data: z.ZodOptional<z.ZodUnknown>;
371
+ } & {
372
+ code: z.ZodLiteral<-32006>;
373
+ message: z.ZodDefault<z.ZodString>;
374
+ }, "strip", z.ZodTypeAny, {
375
+ message: string;
376
+ code: -32006;
377
+ data?: unknown;
378
+ }, {
379
+ code: -32006;
380
+ data?: unknown;
381
+ message?: string | undefined;
382
+ }>, z.ZodObject<{
383
+ data: z.ZodOptional<z.ZodUnknown>;
384
+ } & {
385
+ code: z.ZodLiteral<-32007>;
386
+ message: z.ZodDefault<z.ZodString>;
387
+ }, "strip", z.ZodTypeAny, {
388
+ message: string;
389
+ code: -32007;
390
+ data?: unknown;
391
+ }, {
392
+ code: -32007;
393
+ data?: unknown;
394
+ message?: string | undefined;
395
+ }>]>;
396
+ export type A2AError = z.infer<typeof A2AErrorSchema>;