a2a-mesh 1.0.0
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 +171 -0
- package/README.md +22 -0
- package/dist/auth/index.cjs +8 -0
- package/dist/auth/index.d.cts +2 -0
- package/dist/auth/index.d.mts +2 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.mjs +2 -0
- package/dist/index.cjs +1428 -0
- package/dist/index.d.cts +1589 -0
- package/dist/index.d.mts +1589 -0
- package/dist/index.d.ts +1589 -0
- package/dist/index.mjs +1392 -0
- package/dist/middleware/index.cjs +9 -0
- package/dist/middleware/index.d.cts +46 -0
- package/dist/middleware/index.d.mts +46 -0
- package/dist/middleware/index.d.ts +46 -0
- package/dist/middleware/index.mjs +1 -0
- package/dist/shared/a2a-mesh.B8CFEj_l.cjs +101 -0
- package/dist/shared/a2a-mesh.CDuHtAfx.d.cts +70 -0
- package/dist/shared/a2a-mesh.CDuHtAfx.d.mts +70 -0
- package/dist/shared/a2a-mesh.CDuHtAfx.d.ts +70 -0
- package/dist/shared/a2a-mesh.CpP0sKxA.mjs +95 -0
- package/dist/shared/a2a-mesh.DMPwsFk8.cjs +121 -0
- package/dist/shared/a2a-mesh.DOHcVRN8.mjs +119 -0
- package/dist/telemetry/index.cjs +27 -0
- package/dist/telemetry/index.d.cts +7 -0
- package/dist/telemetry/index.d.mts +7 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.mjs +24 -0
- package/package.json +90 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1589 @@
|
|
|
1
|
+
import { A as AuthScheme, J as JwtAuthMiddleware, a as JwtAuthMiddlewareOptions } from './shared/a2a-mesh.CDuHtAfx.js';
|
|
2
|
+
export { b as ApiKeyAuthScheme, c as ApiKeyCredentialSource, d as AuthValidationResult, B as BaseAuthScheme, H as HttpAuthScheme, O as OpenIdConnectAuthScheme } from './shared/a2a-mesh.CDuHtAfx.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import * as node_http from 'node:http';
|
|
5
|
+
import { Response as Response$1, Express, Request } from 'express';
|
|
6
|
+
import { EventEmitter } from 'node:events';
|
|
7
|
+
import { RateLimitConfig, RateLimitStore } from './middleware/index.js';
|
|
8
|
+
export { InMemoryRateLimitStore, RateLimitState, RedisRateLimitClient, RedisRateLimitStore, createRateLimiter } from './middleware/index.js';
|
|
9
|
+
import EventSource from 'eventsource';
|
|
10
|
+
export { SpanStatusCode } from '@opentelemetry/api';
|
|
11
|
+
export { a2aMeshTracer, withA2ABaggage } from './telemetry/index.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @file extensions.ts
|
|
15
|
+
* Extension metadata shared across A2A runtime objects.
|
|
16
|
+
*/
|
|
17
|
+
interface A2AExtension {
|
|
18
|
+
/**
|
|
19
|
+
* Globally unique URI for the extension.
|
|
20
|
+
*/
|
|
21
|
+
uri: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional semantic version string for the extension contract.
|
|
24
|
+
*/
|
|
25
|
+
version?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the extension is required for successful request handling.
|
|
28
|
+
*/
|
|
29
|
+
required?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @file agent-card.ts
|
|
34
|
+
* Types defining the Agent Card structure.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
type ProtocolVersion = '0.3' | '1.0';
|
|
38
|
+
/**
|
|
39
|
+
* Agent capabilities.
|
|
40
|
+
*/
|
|
41
|
+
interface AgentCapabilities {
|
|
42
|
+
streaming?: boolean;
|
|
43
|
+
pushNotifications?: boolean;
|
|
44
|
+
stateTransitionHistory?: boolean;
|
|
45
|
+
extendedAgentCard?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Definition of an agent skill.
|
|
49
|
+
*/
|
|
50
|
+
interface AgentSkill {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
tags?: string[];
|
|
55
|
+
examples?: string[];
|
|
56
|
+
inputModes?: string[];
|
|
57
|
+
outputModes?: string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Legacy v0.3 Agent Card structure.
|
|
61
|
+
*/
|
|
62
|
+
interface AgentCardV03 {
|
|
63
|
+
protocolVersion: '0.3';
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
url: string;
|
|
67
|
+
iconUrl?: string;
|
|
68
|
+
provider?: {
|
|
69
|
+
name: string;
|
|
70
|
+
url: string;
|
|
71
|
+
};
|
|
72
|
+
version: string;
|
|
73
|
+
capabilities?: AgentCapabilities;
|
|
74
|
+
skills?: AgentSkill[];
|
|
75
|
+
defaultInputMode?: string;
|
|
76
|
+
defaultOutputMode?: string;
|
|
77
|
+
authentication?: AuthScheme[];
|
|
78
|
+
supportsAuthenticatedExtendedCard?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The Canonical v1.0 Agent Card structure.
|
|
82
|
+
*/
|
|
83
|
+
interface AgentCard {
|
|
84
|
+
protocolVersion: '1.0';
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
url: string;
|
|
88
|
+
iconUrl?: string;
|
|
89
|
+
documentationUrl?: string;
|
|
90
|
+
provider?: {
|
|
91
|
+
name: string;
|
|
92
|
+
url: string;
|
|
93
|
+
};
|
|
94
|
+
version: string;
|
|
95
|
+
capabilities?: AgentCapabilities;
|
|
96
|
+
supportedInterfaces?: string[];
|
|
97
|
+
protocolBinding?: string;
|
|
98
|
+
defaultInputModes?: string[];
|
|
99
|
+
defaultOutputModes?: string[];
|
|
100
|
+
skills?: AgentSkill[];
|
|
101
|
+
securitySchemes?: AuthScheme[];
|
|
102
|
+
security?: Record<string, string[]>[];
|
|
103
|
+
signatures?: string[];
|
|
104
|
+
extensions?: A2AExtension[];
|
|
105
|
+
}
|
|
106
|
+
type AnyAgentCard = AgentCard | AgentCardV03;
|
|
107
|
+
declare function normalizeAgentCard(card: AnyAgentCard): AgentCard;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @file jsonrpc.ts
|
|
111
|
+
* JSON-RPC 2.0 request/response helpers for A2A endpoints.
|
|
112
|
+
*/
|
|
113
|
+
type JsonRpcId = string | number | null;
|
|
114
|
+
interface JsonRpcRequest {
|
|
115
|
+
jsonrpc: '2.0';
|
|
116
|
+
method: string;
|
|
117
|
+
params?: Record<string, unknown> | unknown[];
|
|
118
|
+
id?: JsonRpcId;
|
|
119
|
+
}
|
|
120
|
+
interface JsonRpcSuccessResponse<T = unknown> {
|
|
121
|
+
jsonrpc: '2.0';
|
|
122
|
+
result: T;
|
|
123
|
+
id: JsonRpcId;
|
|
124
|
+
}
|
|
125
|
+
interface JsonRpcFailureResponse {
|
|
126
|
+
jsonrpc: '2.0';
|
|
127
|
+
error: {
|
|
128
|
+
code: number;
|
|
129
|
+
message: string;
|
|
130
|
+
data?: unknown;
|
|
131
|
+
};
|
|
132
|
+
id: JsonRpcId;
|
|
133
|
+
}
|
|
134
|
+
type JsonRpcResponse<T = unknown> = JsonRpcSuccessResponse<T> | JsonRpcFailureResponse;
|
|
135
|
+
declare const ErrorCodes: {
|
|
136
|
+
readonly ParseError: -32700;
|
|
137
|
+
readonly InvalidRequest: -32600;
|
|
138
|
+
readonly MethodNotFound: -32601;
|
|
139
|
+
readonly InvalidParams: -32602;
|
|
140
|
+
readonly InternalError: -32603;
|
|
141
|
+
readonly TaskNotFound: -32004;
|
|
142
|
+
readonly PushNotificationNotSupported: -32010;
|
|
143
|
+
readonly UnsupportedOperation: -32011;
|
|
144
|
+
readonly RateLimitExceeded: -32029;
|
|
145
|
+
readonly Unauthorized: -32040;
|
|
146
|
+
readonly ExtensionRequired: -32041;
|
|
147
|
+
};
|
|
148
|
+
declare class JsonRpcError extends Error {
|
|
149
|
+
readonly code: number;
|
|
150
|
+
readonly data?: unknown;
|
|
151
|
+
constructor(code: number, message: string, data?: unknown);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @file task.ts
|
|
156
|
+
* Core task, message and artifact types used by the A2A runtime.
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
interface TextPart {
|
|
160
|
+
type: 'text';
|
|
161
|
+
text: string;
|
|
162
|
+
}
|
|
163
|
+
interface FilePart {
|
|
164
|
+
type: 'file';
|
|
165
|
+
file: {
|
|
166
|
+
name?: string;
|
|
167
|
+
mimeType: string;
|
|
168
|
+
bytes?: string;
|
|
169
|
+
uri?: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
interface DataPart {
|
|
173
|
+
type: 'data';
|
|
174
|
+
data: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
type Part = TextPart | FilePart | DataPart;
|
|
177
|
+
interface Message {
|
|
178
|
+
kind?: 'message';
|
|
179
|
+
role: 'user' | 'agent';
|
|
180
|
+
parts: Part[];
|
|
181
|
+
messageId: string;
|
|
182
|
+
timestamp: string;
|
|
183
|
+
contextId?: string;
|
|
184
|
+
}
|
|
185
|
+
interface PushNotificationConfig {
|
|
186
|
+
id?: string;
|
|
187
|
+
url: string;
|
|
188
|
+
token?: string;
|
|
189
|
+
authentication?: AuthScheme;
|
|
190
|
+
}
|
|
191
|
+
interface Artifact {
|
|
192
|
+
artifactId: string;
|
|
193
|
+
name?: string;
|
|
194
|
+
description?: string;
|
|
195
|
+
parts: Part[];
|
|
196
|
+
index: number;
|
|
197
|
+
lastChunk?: boolean;
|
|
198
|
+
}
|
|
199
|
+
interface ExtensibleArtifact extends Artifact {
|
|
200
|
+
extensions?: string[];
|
|
201
|
+
metadata?: Record<string, unknown>;
|
|
202
|
+
}
|
|
203
|
+
interface TaskStatus {
|
|
204
|
+
state: 'submitted' | 'working' | 'input-required' | 'completed' | 'failed' | 'canceled';
|
|
205
|
+
timestamp: string;
|
|
206
|
+
message?: string;
|
|
207
|
+
}
|
|
208
|
+
interface Task {
|
|
209
|
+
kind?: 'task';
|
|
210
|
+
id: string;
|
|
211
|
+
sessionId?: string;
|
|
212
|
+
contextId?: string;
|
|
213
|
+
status: TaskStatus;
|
|
214
|
+
history: Message[];
|
|
215
|
+
artifacts?: ExtensibleArtifact[];
|
|
216
|
+
metadata?: Record<string, unknown>;
|
|
217
|
+
extensions?: string[];
|
|
218
|
+
}
|
|
219
|
+
interface TaskListParams {
|
|
220
|
+
contextId?: string;
|
|
221
|
+
limit?: number;
|
|
222
|
+
offset?: number;
|
|
223
|
+
}
|
|
224
|
+
interface TaskListResult {
|
|
225
|
+
tasks: Task[];
|
|
226
|
+
total: number;
|
|
227
|
+
}
|
|
228
|
+
interface TaskCounts {
|
|
229
|
+
total: number;
|
|
230
|
+
active: number;
|
|
231
|
+
completed: number;
|
|
232
|
+
failed: number;
|
|
233
|
+
canceled: number;
|
|
234
|
+
submitted: number;
|
|
235
|
+
inputRequired: number;
|
|
236
|
+
working: number;
|
|
237
|
+
}
|
|
238
|
+
interface MessageRequestConfiguration {
|
|
239
|
+
blocking?: boolean;
|
|
240
|
+
acceptedOutputModes?: string[];
|
|
241
|
+
pushNotificationConfig?: PushNotificationConfig;
|
|
242
|
+
extensions?: A2AExtension[];
|
|
243
|
+
}
|
|
244
|
+
interface MessageSendParams {
|
|
245
|
+
message: Message;
|
|
246
|
+
taskId?: string;
|
|
247
|
+
sessionId?: string;
|
|
248
|
+
contextId?: string;
|
|
249
|
+
configuration?: MessageRequestConfiguration;
|
|
250
|
+
}
|
|
251
|
+
interface A2AHealthResponse {
|
|
252
|
+
status: 'healthy';
|
|
253
|
+
version: string;
|
|
254
|
+
protocol: 'A2A/1.0';
|
|
255
|
+
uptime: number;
|
|
256
|
+
tasks: Pick<TaskCounts, 'active' | 'completed' | 'failed' | 'total'>;
|
|
257
|
+
memory: {
|
|
258
|
+
heapUsedMb: number;
|
|
259
|
+
heapTotalMb: number;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @file logger.ts
|
|
265
|
+
* Small structured logger with request/task/context correlation support.
|
|
266
|
+
*/
|
|
267
|
+
interface LogContext {
|
|
268
|
+
requestId?: string;
|
|
269
|
+
taskId?: string;
|
|
270
|
+
contextId?: string;
|
|
271
|
+
method?: string;
|
|
272
|
+
agentName?: string;
|
|
273
|
+
durationMs?: number;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
}
|
|
276
|
+
declare const logger: {
|
|
277
|
+
debug(message: string, context?: LogContext): void;
|
|
278
|
+
info(message: string, context?: LogContext): void;
|
|
279
|
+
warn(message: string, context?: LogContext): void;
|
|
280
|
+
error(message: string, context?: LogContext): void;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @file schema-validator.ts
|
|
285
|
+
* Zod-based validation for A2A messages and configurations.
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
declare const JsonRpcRequestSchema: z.ZodObject<{
|
|
289
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
290
|
+
method: z.ZodString;
|
|
291
|
+
params: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>>;
|
|
292
|
+
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
jsonrpc: "2.0";
|
|
295
|
+
method: string;
|
|
296
|
+
params?: unknown[] | Record<string, unknown> | undefined;
|
|
297
|
+
id?: string | number | null | undefined;
|
|
298
|
+
}, {
|
|
299
|
+
jsonrpc: "2.0";
|
|
300
|
+
method: string;
|
|
301
|
+
params?: unknown[] | Record<string, unknown> | undefined;
|
|
302
|
+
id?: string | number | null | undefined;
|
|
303
|
+
}>;
|
|
304
|
+
declare const PartSchema: z.ZodUnion<[z.ZodObject<{
|
|
305
|
+
type: z.ZodLiteral<"text">;
|
|
306
|
+
text: z.ZodString;
|
|
307
|
+
}, "strip", z.ZodTypeAny, {
|
|
308
|
+
type: "text";
|
|
309
|
+
text: string;
|
|
310
|
+
}, {
|
|
311
|
+
type: "text";
|
|
312
|
+
text: string;
|
|
313
|
+
}>, z.ZodObject<{
|
|
314
|
+
type: z.ZodLiteral<"file">;
|
|
315
|
+
file: z.ZodObject<{
|
|
316
|
+
name: z.ZodOptional<z.ZodString>;
|
|
317
|
+
mimeType: z.ZodString;
|
|
318
|
+
bytes: z.ZodOptional<z.ZodString>;
|
|
319
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
320
|
+
}, "strip", z.ZodTypeAny, {
|
|
321
|
+
mimeType: string;
|
|
322
|
+
name?: string | undefined;
|
|
323
|
+
bytes?: string | undefined;
|
|
324
|
+
uri?: string | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
mimeType: string;
|
|
327
|
+
name?: string | undefined;
|
|
328
|
+
bytes?: string | undefined;
|
|
329
|
+
uri?: string | undefined;
|
|
330
|
+
}>;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
type: "file";
|
|
333
|
+
file: {
|
|
334
|
+
mimeType: string;
|
|
335
|
+
name?: string | undefined;
|
|
336
|
+
bytes?: string | undefined;
|
|
337
|
+
uri?: string | undefined;
|
|
338
|
+
};
|
|
339
|
+
}, {
|
|
340
|
+
type: "file";
|
|
341
|
+
file: {
|
|
342
|
+
mimeType: string;
|
|
343
|
+
name?: string | undefined;
|
|
344
|
+
bytes?: string | undefined;
|
|
345
|
+
uri?: string | undefined;
|
|
346
|
+
};
|
|
347
|
+
}>, z.ZodObject<{
|
|
348
|
+
type: z.ZodLiteral<"data">;
|
|
349
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
350
|
+
}, "strip", z.ZodTypeAny, {
|
|
351
|
+
type: "data";
|
|
352
|
+
data: Record<string, unknown>;
|
|
353
|
+
}, {
|
|
354
|
+
type: "data";
|
|
355
|
+
data: Record<string, unknown>;
|
|
356
|
+
}>]>;
|
|
357
|
+
declare const MessageSchema: z.ZodObject<{
|
|
358
|
+
kind: z.ZodOptional<z.ZodLiteral<"message">>;
|
|
359
|
+
role: z.ZodEnum<["user", "agent"]>;
|
|
360
|
+
parts: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
361
|
+
type: z.ZodLiteral<"text">;
|
|
362
|
+
text: z.ZodString;
|
|
363
|
+
}, "strip", z.ZodTypeAny, {
|
|
364
|
+
type: "text";
|
|
365
|
+
text: string;
|
|
366
|
+
}, {
|
|
367
|
+
type: "text";
|
|
368
|
+
text: string;
|
|
369
|
+
}>, z.ZodObject<{
|
|
370
|
+
type: z.ZodLiteral<"file">;
|
|
371
|
+
file: z.ZodObject<{
|
|
372
|
+
name: z.ZodOptional<z.ZodString>;
|
|
373
|
+
mimeType: z.ZodString;
|
|
374
|
+
bytes: z.ZodOptional<z.ZodString>;
|
|
375
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
376
|
+
}, "strip", z.ZodTypeAny, {
|
|
377
|
+
mimeType: string;
|
|
378
|
+
name?: string | undefined;
|
|
379
|
+
bytes?: string | undefined;
|
|
380
|
+
uri?: string | undefined;
|
|
381
|
+
}, {
|
|
382
|
+
mimeType: string;
|
|
383
|
+
name?: string | undefined;
|
|
384
|
+
bytes?: string | undefined;
|
|
385
|
+
uri?: string | undefined;
|
|
386
|
+
}>;
|
|
387
|
+
}, "strip", z.ZodTypeAny, {
|
|
388
|
+
type: "file";
|
|
389
|
+
file: {
|
|
390
|
+
mimeType: string;
|
|
391
|
+
name?: string | undefined;
|
|
392
|
+
bytes?: string | undefined;
|
|
393
|
+
uri?: string | undefined;
|
|
394
|
+
};
|
|
395
|
+
}, {
|
|
396
|
+
type: "file";
|
|
397
|
+
file: {
|
|
398
|
+
mimeType: string;
|
|
399
|
+
name?: string | undefined;
|
|
400
|
+
bytes?: string | undefined;
|
|
401
|
+
uri?: string | undefined;
|
|
402
|
+
};
|
|
403
|
+
}>, z.ZodObject<{
|
|
404
|
+
type: z.ZodLiteral<"data">;
|
|
405
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
406
|
+
}, "strip", z.ZodTypeAny, {
|
|
407
|
+
type: "data";
|
|
408
|
+
data: Record<string, unknown>;
|
|
409
|
+
}, {
|
|
410
|
+
type: "data";
|
|
411
|
+
data: Record<string, unknown>;
|
|
412
|
+
}>]>, "many">;
|
|
413
|
+
messageId: z.ZodString;
|
|
414
|
+
timestamp: z.ZodString;
|
|
415
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, "strip", z.ZodTypeAny, {
|
|
417
|
+
role: "user" | "agent";
|
|
418
|
+
parts: ({
|
|
419
|
+
type: "text";
|
|
420
|
+
text: string;
|
|
421
|
+
} | {
|
|
422
|
+
type: "file";
|
|
423
|
+
file: {
|
|
424
|
+
mimeType: string;
|
|
425
|
+
name?: string | undefined;
|
|
426
|
+
bytes?: string | undefined;
|
|
427
|
+
uri?: string | undefined;
|
|
428
|
+
};
|
|
429
|
+
} | {
|
|
430
|
+
type: "data";
|
|
431
|
+
data: Record<string, unknown>;
|
|
432
|
+
})[];
|
|
433
|
+
messageId: string;
|
|
434
|
+
timestamp: string;
|
|
435
|
+
kind?: "message" | undefined;
|
|
436
|
+
contextId?: string | undefined;
|
|
437
|
+
}, {
|
|
438
|
+
role: "user" | "agent";
|
|
439
|
+
parts: ({
|
|
440
|
+
type: "text";
|
|
441
|
+
text: string;
|
|
442
|
+
} | {
|
|
443
|
+
type: "file";
|
|
444
|
+
file: {
|
|
445
|
+
mimeType: string;
|
|
446
|
+
name?: string | undefined;
|
|
447
|
+
bytes?: string | undefined;
|
|
448
|
+
uri?: string | undefined;
|
|
449
|
+
};
|
|
450
|
+
} | {
|
|
451
|
+
type: "data";
|
|
452
|
+
data: Record<string, unknown>;
|
|
453
|
+
})[];
|
|
454
|
+
messageId: string;
|
|
455
|
+
timestamp: string;
|
|
456
|
+
kind?: "message" | undefined;
|
|
457
|
+
contextId?: string | undefined;
|
|
458
|
+
}>;
|
|
459
|
+
declare const PushNotificationConfigSchema: z.ZodObject<{
|
|
460
|
+
id: z.ZodOptional<z.ZodString>;
|
|
461
|
+
url: z.ZodString;
|
|
462
|
+
token: z.ZodOptional<z.ZodString>;
|
|
463
|
+
authentication: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
464
|
+
type: z.ZodLiteral<"apiKey">;
|
|
465
|
+
id: z.ZodString;
|
|
466
|
+
in: z.ZodEnum<["header", "query"]>;
|
|
467
|
+
name: z.ZodString;
|
|
468
|
+
description: z.ZodOptional<z.ZodString>;
|
|
469
|
+
}, "strip", z.ZodTypeAny, {
|
|
470
|
+
type: "apiKey";
|
|
471
|
+
id: string;
|
|
472
|
+
name: string;
|
|
473
|
+
in: "header" | "query";
|
|
474
|
+
description?: string | undefined;
|
|
475
|
+
}, {
|
|
476
|
+
type: "apiKey";
|
|
477
|
+
id: string;
|
|
478
|
+
name: string;
|
|
479
|
+
in: "header" | "query";
|
|
480
|
+
description?: string | undefined;
|
|
481
|
+
}>, z.ZodObject<{
|
|
482
|
+
type: z.ZodLiteral<"http">;
|
|
483
|
+
id: z.ZodString;
|
|
484
|
+
scheme: z.ZodLiteral<"bearer">;
|
|
485
|
+
bearerFormat: z.ZodOptional<z.ZodString>;
|
|
486
|
+
description: z.ZodOptional<z.ZodString>;
|
|
487
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
|
+
type: "http";
|
|
489
|
+
id: string;
|
|
490
|
+
scheme: "bearer";
|
|
491
|
+
description?: string | undefined;
|
|
492
|
+
bearerFormat?: string | undefined;
|
|
493
|
+
}, {
|
|
494
|
+
type: "http";
|
|
495
|
+
id: string;
|
|
496
|
+
scheme: "bearer";
|
|
497
|
+
description?: string | undefined;
|
|
498
|
+
bearerFormat?: string | undefined;
|
|
499
|
+
}>, z.ZodObject<{
|
|
500
|
+
type: z.ZodLiteral<"openIdConnect">;
|
|
501
|
+
id: z.ZodString;
|
|
502
|
+
openIdConnectUrl: z.ZodString;
|
|
503
|
+
audience: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
504
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
505
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
506
|
+
algorithms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
507
|
+
description: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, "strip", z.ZodTypeAny, {
|
|
509
|
+
type: "openIdConnect";
|
|
510
|
+
id: string;
|
|
511
|
+
openIdConnectUrl: string;
|
|
512
|
+
description?: string | undefined;
|
|
513
|
+
audience?: string | string[] | undefined;
|
|
514
|
+
issuer?: string | undefined;
|
|
515
|
+
jwksUri?: string | undefined;
|
|
516
|
+
algorithms?: string[] | undefined;
|
|
517
|
+
}, {
|
|
518
|
+
type: "openIdConnect";
|
|
519
|
+
id: string;
|
|
520
|
+
openIdConnectUrl: string;
|
|
521
|
+
description?: string | undefined;
|
|
522
|
+
audience?: string | string[] | undefined;
|
|
523
|
+
issuer?: string | undefined;
|
|
524
|
+
jwksUri?: string | undefined;
|
|
525
|
+
algorithms?: string[] | undefined;
|
|
526
|
+
}>]>>;
|
|
527
|
+
}, "strip", z.ZodTypeAny, {
|
|
528
|
+
url: string;
|
|
529
|
+
id?: string | undefined;
|
|
530
|
+
token?: string | undefined;
|
|
531
|
+
authentication?: {
|
|
532
|
+
type: "apiKey";
|
|
533
|
+
id: string;
|
|
534
|
+
name: string;
|
|
535
|
+
in: "header" | "query";
|
|
536
|
+
description?: string | undefined;
|
|
537
|
+
} | {
|
|
538
|
+
type: "http";
|
|
539
|
+
id: string;
|
|
540
|
+
scheme: "bearer";
|
|
541
|
+
description?: string | undefined;
|
|
542
|
+
bearerFormat?: string | undefined;
|
|
543
|
+
} | {
|
|
544
|
+
type: "openIdConnect";
|
|
545
|
+
id: string;
|
|
546
|
+
openIdConnectUrl: string;
|
|
547
|
+
description?: string | undefined;
|
|
548
|
+
audience?: string | string[] | undefined;
|
|
549
|
+
issuer?: string | undefined;
|
|
550
|
+
jwksUri?: string | undefined;
|
|
551
|
+
algorithms?: string[] | undefined;
|
|
552
|
+
} | undefined;
|
|
553
|
+
}, {
|
|
554
|
+
url: string;
|
|
555
|
+
id?: string | undefined;
|
|
556
|
+
token?: string | undefined;
|
|
557
|
+
authentication?: {
|
|
558
|
+
type: "apiKey";
|
|
559
|
+
id: string;
|
|
560
|
+
name: string;
|
|
561
|
+
in: "header" | "query";
|
|
562
|
+
description?: string | undefined;
|
|
563
|
+
} | {
|
|
564
|
+
type: "http";
|
|
565
|
+
id: string;
|
|
566
|
+
scheme: "bearer";
|
|
567
|
+
description?: string | undefined;
|
|
568
|
+
bearerFormat?: string | undefined;
|
|
569
|
+
} | {
|
|
570
|
+
type: "openIdConnect";
|
|
571
|
+
id: string;
|
|
572
|
+
openIdConnectUrl: string;
|
|
573
|
+
description?: string | undefined;
|
|
574
|
+
audience?: string | string[] | undefined;
|
|
575
|
+
issuer?: string | undefined;
|
|
576
|
+
jwksUri?: string | undefined;
|
|
577
|
+
algorithms?: string[] | undefined;
|
|
578
|
+
} | undefined;
|
|
579
|
+
}>;
|
|
580
|
+
declare const MessageRequestConfigurationSchema: z.ZodObject<{
|
|
581
|
+
blocking: z.ZodOptional<z.ZodBoolean>;
|
|
582
|
+
acceptedOutputModes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
583
|
+
pushNotificationConfig: z.ZodOptional<z.ZodObject<{
|
|
584
|
+
id: z.ZodOptional<z.ZodString>;
|
|
585
|
+
url: z.ZodString;
|
|
586
|
+
token: z.ZodOptional<z.ZodString>;
|
|
587
|
+
authentication: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
588
|
+
type: z.ZodLiteral<"apiKey">;
|
|
589
|
+
id: z.ZodString;
|
|
590
|
+
in: z.ZodEnum<["header", "query"]>;
|
|
591
|
+
name: z.ZodString;
|
|
592
|
+
description: z.ZodOptional<z.ZodString>;
|
|
593
|
+
}, "strip", z.ZodTypeAny, {
|
|
594
|
+
type: "apiKey";
|
|
595
|
+
id: string;
|
|
596
|
+
name: string;
|
|
597
|
+
in: "header" | "query";
|
|
598
|
+
description?: string | undefined;
|
|
599
|
+
}, {
|
|
600
|
+
type: "apiKey";
|
|
601
|
+
id: string;
|
|
602
|
+
name: string;
|
|
603
|
+
in: "header" | "query";
|
|
604
|
+
description?: string | undefined;
|
|
605
|
+
}>, z.ZodObject<{
|
|
606
|
+
type: z.ZodLiteral<"http">;
|
|
607
|
+
id: z.ZodString;
|
|
608
|
+
scheme: z.ZodLiteral<"bearer">;
|
|
609
|
+
bearerFormat: z.ZodOptional<z.ZodString>;
|
|
610
|
+
description: z.ZodOptional<z.ZodString>;
|
|
611
|
+
}, "strip", z.ZodTypeAny, {
|
|
612
|
+
type: "http";
|
|
613
|
+
id: string;
|
|
614
|
+
scheme: "bearer";
|
|
615
|
+
description?: string | undefined;
|
|
616
|
+
bearerFormat?: string | undefined;
|
|
617
|
+
}, {
|
|
618
|
+
type: "http";
|
|
619
|
+
id: string;
|
|
620
|
+
scheme: "bearer";
|
|
621
|
+
description?: string | undefined;
|
|
622
|
+
bearerFormat?: string | undefined;
|
|
623
|
+
}>, z.ZodObject<{
|
|
624
|
+
type: z.ZodLiteral<"openIdConnect">;
|
|
625
|
+
id: z.ZodString;
|
|
626
|
+
openIdConnectUrl: z.ZodString;
|
|
627
|
+
audience: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
628
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
629
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
630
|
+
algorithms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
631
|
+
description: z.ZodOptional<z.ZodString>;
|
|
632
|
+
}, "strip", z.ZodTypeAny, {
|
|
633
|
+
type: "openIdConnect";
|
|
634
|
+
id: string;
|
|
635
|
+
openIdConnectUrl: string;
|
|
636
|
+
description?: string | undefined;
|
|
637
|
+
audience?: string | string[] | undefined;
|
|
638
|
+
issuer?: string | undefined;
|
|
639
|
+
jwksUri?: string | undefined;
|
|
640
|
+
algorithms?: string[] | undefined;
|
|
641
|
+
}, {
|
|
642
|
+
type: "openIdConnect";
|
|
643
|
+
id: string;
|
|
644
|
+
openIdConnectUrl: string;
|
|
645
|
+
description?: string | undefined;
|
|
646
|
+
audience?: string | string[] | undefined;
|
|
647
|
+
issuer?: string | undefined;
|
|
648
|
+
jwksUri?: string | undefined;
|
|
649
|
+
algorithms?: string[] | undefined;
|
|
650
|
+
}>]>>;
|
|
651
|
+
}, "strip", z.ZodTypeAny, {
|
|
652
|
+
url: string;
|
|
653
|
+
id?: string | undefined;
|
|
654
|
+
token?: string | undefined;
|
|
655
|
+
authentication?: {
|
|
656
|
+
type: "apiKey";
|
|
657
|
+
id: string;
|
|
658
|
+
name: string;
|
|
659
|
+
in: "header" | "query";
|
|
660
|
+
description?: string | undefined;
|
|
661
|
+
} | {
|
|
662
|
+
type: "http";
|
|
663
|
+
id: string;
|
|
664
|
+
scheme: "bearer";
|
|
665
|
+
description?: string | undefined;
|
|
666
|
+
bearerFormat?: string | undefined;
|
|
667
|
+
} | {
|
|
668
|
+
type: "openIdConnect";
|
|
669
|
+
id: string;
|
|
670
|
+
openIdConnectUrl: string;
|
|
671
|
+
description?: string | undefined;
|
|
672
|
+
audience?: string | string[] | undefined;
|
|
673
|
+
issuer?: string | undefined;
|
|
674
|
+
jwksUri?: string | undefined;
|
|
675
|
+
algorithms?: string[] | undefined;
|
|
676
|
+
} | undefined;
|
|
677
|
+
}, {
|
|
678
|
+
url: string;
|
|
679
|
+
id?: string | undefined;
|
|
680
|
+
token?: string | undefined;
|
|
681
|
+
authentication?: {
|
|
682
|
+
type: "apiKey";
|
|
683
|
+
id: string;
|
|
684
|
+
name: string;
|
|
685
|
+
in: "header" | "query";
|
|
686
|
+
description?: string | undefined;
|
|
687
|
+
} | {
|
|
688
|
+
type: "http";
|
|
689
|
+
id: string;
|
|
690
|
+
scheme: "bearer";
|
|
691
|
+
description?: string | undefined;
|
|
692
|
+
bearerFormat?: string | undefined;
|
|
693
|
+
} | {
|
|
694
|
+
type: "openIdConnect";
|
|
695
|
+
id: string;
|
|
696
|
+
openIdConnectUrl: string;
|
|
697
|
+
description?: string | undefined;
|
|
698
|
+
audience?: string | string[] | undefined;
|
|
699
|
+
issuer?: string | undefined;
|
|
700
|
+
jwksUri?: string | undefined;
|
|
701
|
+
algorithms?: string[] | undefined;
|
|
702
|
+
} | undefined;
|
|
703
|
+
}>>;
|
|
704
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
705
|
+
uri: z.ZodString;
|
|
706
|
+
version: z.ZodOptional<z.ZodString>;
|
|
707
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
708
|
+
}, "strip", z.ZodTypeAny, {
|
|
709
|
+
uri: string;
|
|
710
|
+
version?: string | undefined;
|
|
711
|
+
required?: boolean | undefined;
|
|
712
|
+
}, {
|
|
713
|
+
uri: string;
|
|
714
|
+
version?: string | undefined;
|
|
715
|
+
required?: boolean | undefined;
|
|
716
|
+
}>, "many">>;
|
|
717
|
+
}, "strip", z.ZodTypeAny, {
|
|
718
|
+
blocking?: boolean | undefined;
|
|
719
|
+
acceptedOutputModes?: string[] | undefined;
|
|
720
|
+
pushNotificationConfig?: {
|
|
721
|
+
url: string;
|
|
722
|
+
id?: string | undefined;
|
|
723
|
+
token?: string | undefined;
|
|
724
|
+
authentication?: {
|
|
725
|
+
type: "apiKey";
|
|
726
|
+
id: string;
|
|
727
|
+
name: string;
|
|
728
|
+
in: "header" | "query";
|
|
729
|
+
description?: string | undefined;
|
|
730
|
+
} | {
|
|
731
|
+
type: "http";
|
|
732
|
+
id: string;
|
|
733
|
+
scheme: "bearer";
|
|
734
|
+
description?: string | undefined;
|
|
735
|
+
bearerFormat?: string | undefined;
|
|
736
|
+
} | {
|
|
737
|
+
type: "openIdConnect";
|
|
738
|
+
id: string;
|
|
739
|
+
openIdConnectUrl: string;
|
|
740
|
+
description?: string | undefined;
|
|
741
|
+
audience?: string | string[] | undefined;
|
|
742
|
+
issuer?: string | undefined;
|
|
743
|
+
jwksUri?: string | undefined;
|
|
744
|
+
algorithms?: string[] | undefined;
|
|
745
|
+
} | undefined;
|
|
746
|
+
} | undefined;
|
|
747
|
+
extensions?: {
|
|
748
|
+
uri: string;
|
|
749
|
+
version?: string | undefined;
|
|
750
|
+
required?: boolean | undefined;
|
|
751
|
+
}[] | undefined;
|
|
752
|
+
}, {
|
|
753
|
+
blocking?: boolean | undefined;
|
|
754
|
+
acceptedOutputModes?: string[] | undefined;
|
|
755
|
+
pushNotificationConfig?: {
|
|
756
|
+
url: string;
|
|
757
|
+
id?: string | undefined;
|
|
758
|
+
token?: string | undefined;
|
|
759
|
+
authentication?: {
|
|
760
|
+
type: "apiKey";
|
|
761
|
+
id: string;
|
|
762
|
+
name: string;
|
|
763
|
+
in: "header" | "query";
|
|
764
|
+
description?: string | undefined;
|
|
765
|
+
} | {
|
|
766
|
+
type: "http";
|
|
767
|
+
id: string;
|
|
768
|
+
scheme: "bearer";
|
|
769
|
+
description?: string | undefined;
|
|
770
|
+
bearerFormat?: string | undefined;
|
|
771
|
+
} | {
|
|
772
|
+
type: "openIdConnect";
|
|
773
|
+
id: string;
|
|
774
|
+
openIdConnectUrl: string;
|
|
775
|
+
description?: string | undefined;
|
|
776
|
+
audience?: string | string[] | undefined;
|
|
777
|
+
issuer?: string | undefined;
|
|
778
|
+
jwksUri?: string | undefined;
|
|
779
|
+
algorithms?: string[] | undefined;
|
|
780
|
+
} | undefined;
|
|
781
|
+
} | undefined;
|
|
782
|
+
extensions?: {
|
|
783
|
+
uri: string;
|
|
784
|
+
version?: string | undefined;
|
|
785
|
+
required?: boolean | undefined;
|
|
786
|
+
}[] | undefined;
|
|
787
|
+
}>;
|
|
788
|
+
declare const MessageSendParamsSchema: z.ZodObject<{
|
|
789
|
+
message: z.ZodObject<{
|
|
790
|
+
kind: z.ZodOptional<z.ZodLiteral<"message">>;
|
|
791
|
+
role: z.ZodEnum<["user", "agent"]>;
|
|
792
|
+
parts: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
793
|
+
type: z.ZodLiteral<"text">;
|
|
794
|
+
text: z.ZodString;
|
|
795
|
+
}, "strip", z.ZodTypeAny, {
|
|
796
|
+
type: "text";
|
|
797
|
+
text: string;
|
|
798
|
+
}, {
|
|
799
|
+
type: "text";
|
|
800
|
+
text: string;
|
|
801
|
+
}>, z.ZodObject<{
|
|
802
|
+
type: z.ZodLiteral<"file">;
|
|
803
|
+
file: z.ZodObject<{
|
|
804
|
+
name: z.ZodOptional<z.ZodString>;
|
|
805
|
+
mimeType: z.ZodString;
|
|
806
|
+
bytes: z.ZodOptional<z.ZodString>;
|
|
807
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
808
|
+
}, "strip", z.ZodTypeAny, {
|
|
809
|
+
mimeType: string;
|
|
810
|
+
name?: string | undefined;
|
|
811
|
+
bytes?: string | undefined;
|
|
812
|
+
uri?: string | undefined;
|
|
813
|
+
}, {
|
|
814
|
+
mimeType: string;
|
|
815
|
+
name?: string | undefined;
|
|
816
|
+
bytes?: string | undefined;
|
|
817
|
+
uri?: string | undefined;
|
|
818
|
+
}>;
|
|
819
|
+
}, "strip", z.ZodTypeAny, {
|
|
820
|
+
type: "file";
|
|
821
|
+
file: {
|
|
822
|
+
mimeType: string;
|
|
823
|
+
name?: string | undefined;
|
|
824
|
+
bytes?: string | undefined;
|
|
825
|
+
uri?: string | undefined;
|
|
826
|
+
};
|
|
827
|
+
}, {
|
|
828
|
+
type: "file";
|
|
829
|
+
file: {
|
|
830
|
+
mimeType: string;
|
|
831
|
+
name?: string | undefined;
|
|
832
|
+
bytes?: string | undefined;
|
|
833
|
+
uri?: string | undefined;
|
|
834
|
+
};
|
|
835
|
+
}>, z.ZodObject<{
|
|
836
|
+
type: z.ZodLiteral<"data">;
|
|
837
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
838
|
+
}, "strip", z.ZodTypeAny, {
|
|
839
|
+
type: "data";
|
|
840
|
+
data: Record<string, unknown>;
|
|
841
|
+
}, {
|
|
842
|
+
type: "data";
|
|
843
|
+
data: Record<string, unknown>;
|
|
844
|
+
}>]>, "many">;
|
|
845
|
+
messageId: z.ZodString;
|
|
846
|
+
timestamp: z.ZodString;
|
|
847
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
848
|
+
}, "strip", z.ZodTypeAny, {
|
|
849
|
+
role: "user" | "agent";
|
|
850
|
+
parts: ({
|
|
851
|
+
type: "text";
|
|
852
|
+
text: string;
|
|
853
|
+
} | {
|
|
854
|
+
type: "file";
|
|
855
|
+
file: {
|
|
856
|
+
mimeType: string;
|
|
857
|
+
name?: string | undefined;
|
|
858
|
+
bytes?: string | undefined;
|
|
859
|
+
uri?: string | undefined;
|
|
860
|
+
};
|
|
861
|
+
} | {
|
|
862
|
+
type: "data";
|
|
863
|
+
data: Record<string, unknown>;
|
|
864
|
+
})[];
|
|
865
|
+
messageId: string;
|
|
866
|
+
timestamp: string;
|
|
867
|
+
kind?: "message" | undefined;
|
|
868
|
+
contextId?: string | undefined;
|
|
869
|
+
}, {
|
|
870
|
+
role: "user" | "agent";
|
|
871
|
+
parts: ({
|
|
872
|
+
type: "text";
|
|
873
|
+
text: string;
|
|
874
|
+
} | {
|
|
875
|
+
type: "file";
|
|
876
|
+
file: {
|
|
877
|
+
mimeType: string;
|
|
878
|
+
name?: string | undefined;
|
|
879
|
+
bytes?: string | undefined;
|
|
880
|
+
uri?: string | undefined;
|
|
881
|
+
};
|
|
882
|
+
} | {
|
|
883
|
+
type: "data";
|
|
884
|
+
data: Record<string, unknown>;
|
|
885
|
+
})[];
|
|
886
|
+
messageId: string;
|
|
887
|
+
timestamp: string;
|
|
888
|
+
kind?: "message" | undefined;
|
|
889
|
+
contextId?: string | undefined;
|
|
890
|
+
}>;
|
|
891
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
892
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
893
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
894
|
+
configuration: z.ZodOptional<z.ZodObject<{
|
|
895
|
+
blocking: z.ZodOptional<z.ZodBoolean>;
|
|
896
|
+
acceptedOutputModes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
897
|
+
pushNotificationConfig: z.ZodOptional<z.ZodObject<{
|
|
898
|
+
id: z.ZodOptional<z.ZodString>;
|
|
899
|
+
url: z.ZodString;
|
|
900
|
+
token: z.ZodOptional<z.ZodString>;
|
|
901
|
+
authentication: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
902
|
+
type: z.ZodLiteral<"apiKey">;
|
|
903
|
+
id: z.ZodString;
|
|
904
|
+
in: z.ZodEnum<["header", "query"]>;
|
|
905
|
+
name: z.ZodString;
|
|
906
|
+
description: z.ZodOptional<z.ZodString>;
|
|
907
|
+
}, "strip", z.ZodTypeAny, {
|
|
908
|
+
type: "apiKey";
|
|
909
|
+
id: string;
|
|
910
|
+
name: string;
|
|
911
|
+
in: "header" | "query";
|
|
912
|
+
description?: string | undefined;
|
|
913
|
+
}, {
|
|
914
|
+
type: "apiKey";
|
|
915
|
+
id: string;
|
|
916
|
+
name: string;
|
|
917
|
+
in: "header" | "query";
|
|
918
|
+
description?: string | undefined;
|
|
919
|
+
}>, z.ZodObject<{
|
|
920
|
+
type: z.ZodLiteral<"http">;
|
|
921
|
+
id: z.ZodString;
|
|
922
|
+
scheme: z.ZodLiteral<"bearer">;
|
|
923
|
+
bearerFormat: z.ZodOptional<z.ZodString>;
|
|
924
|
+
description: z.ZodOptional<z.ZodString>;
|
|
925
|
+
}, "strip", z.ZodTypeAny, {
|
|
926
|
+
type: "http";
|
|
927
|
+
id: string;
|
|
928
|
+
scheme: "bearer";
|
|
929
|
+
description?: string | undefined;
|
|
930
|
+
bearerFormat?: string | undefined;
|
|
931
|
+
}, {
|
|
932
|
+
type: "http";
|
|
933
|
+
id: string;
|
|
934
|
+
scheme: "bearer";
|
|
935
|
+
description?: string | undefined;
|
|
936
|
+
bearerFormat?: string | undefined;
|
|
937
|
+
}>, z.ZodObject<{
|
|
938
|
+
type: z.ZodLiteral<"openIdConnect">;
|
|
939
|
+
id: z.ZodString;
|
|
940
|
+
openIdConnectUrl: z.ZodString;
|
|
941
|
+
audience: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
942
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
943
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
944
|
+
algorithms: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
945
|
+
description: z.ZodOptional<z.ZodString>;
|
|
946
|
+
}, "strip", z.ZodTypeAny, {
|
|
947
|
+
type: "openIdConnect";
|
|
948
|
+
id: string;
|
|
949
|
+
openIdConnectUrl: string;
|
|
950
|
+
description?: string | undefined;
|
|
951
|
+
audience?: string | string[] | undefined;
|
|
952
|
+
issuer?: string | undefined;
|
|
953
|
+
jwksUri?: string | undefined;
|
|
954
|
+
algorithms?: string[] | undefined;
|
|
955
|
+
}, {
|
|
956
|
+
type: "openIdConnect";
|
|
957
|
+
id: string;
|
|
958
|
+
openIdConnectUrl: string;
|
|
959
|
+
description?: string | undefined;
|
|
960
|
+
audience?: string | string[] | undefined;
|
|
961
|
+
issuer?: string | undefined;
|
|
962
|
+
jwksUri?: string | undefined;
|
|
963
|
+
algorithms?: string[] | undefined;
|
|
964
|
+
}>]>>;
|
|
965
|
+
}, "strip", z.ZodTypeAny, {
|
|
966
|
+
url: string;
|
|
967
|
+
id?: string | undefined;
|
|
968
|
+
token?: string | undefined;
|
|
969
|
+
authentication?: {
|
|
970
|
+
type: "apiKey";
|
|
971
|
+
id: string;
|
|
972
|
+
name: string;
|
|
973
|
+
in: "header" | "query";
|
|
974
|
+
description?: string | undefined;
|
|
975
|
+
} | {
|
|
976
|
+
type: "http";
|
|
977
|
+
id: string;
|
|
978
|
+
scheme: "bearer";
|
|
979
|
+
description?: string | undefined;
|
|
980
|
+
bearerFormat?: string | undefined;
|
|
981
|
+
} | {
|
|
982
|
+
type: "openIdConnect";
|
|
983
|
+
id: string;
|
|
984
|
+
openIdConnectUrl: string;
|
|
985
|
+
description?: string | undefined;
|
|
986
|
+
audience?: string | string[] | undefined;
|
|
987
|
+
issuer?: string | undefined;
|
|
988
|
+
jwksUri?: string | undefined;
|
|
989
|
+
algorithms?: string[] | undefined;
|
|
990
|
+
} | undefined;
|
|
991
|
+
}, {
|
|
992
|
+
url: string;
|
|
993
|
+
id?: string | undefined;
|
|
994
|
+
token?: string | undefined;
|
|
995
|
+
authentication?: {
|
|
996
|
+
type: "apiKey";
|
|
997
|
+
id: string;
|
|
998
|
+
name: string;
|
|
999
|
+
in: "header" | "query";
|
|
1000
|
+
description?: string | undefined;
|
|
1001
|
+
} | {
|
|
1002
|
+
type: "http";
|
|
1003
|
+
id: string;
|
|
1004
|
+
scheme: "bearer";
|
|
1005
|
+
description?: string | undefined;
|
|
1006
|
+
bearerFormat?: string | undefined;
|
|
1007
|
+
} | {
|
|
1008
|
+
type: "openIdConnect";
|
|
1009
|
+
id: string;
|
|
1010
|
+
openIdConnectUrl: string;
|
|
1011
|
+
description?: string | undefined;
|
|
1012
|
+
audience?: string | string[] | undefined;
|
|
1013
|
+
issuer?: string | undefined;
|
|
1014
|
+
jwksUri?: string | undefined;
|
|
1015
|
+
algorithms?: string[] | undefined;
|
|
1016
|
+
} | undefined;
|
|
1017
|
+
}>>;
|
|
1018
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1019
|
+
uri: z.ZodString;
|
|
1020
|
+
version: z.ZodOptional<z.ZodString>;
|
|
1021
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
1022
|
+
}, "strip", z.ZodTypeAny, {
|
|
1023
|
+
uri: string;
|
|
1024
|
+
version?: string | undefined;
|
|
1025
|
+
required?: boolean | undefined;
|
|
1026
|
+
}, {
|
|
1027
|
+
uri: string;
|
|
1028
|
+
version?: string | undefined;
|
|
1029
|
+
required?: boolean | undefined;
|
|
1030
|
+
}>, "many">>;
|
|
1031
|
+
}, "strip", z.ZodTypeAny, {
|
|
1032
|
+
blocking?: boolean | undefined;
|
|
1033
|
+
acceptedOutputModes?: string[] | undefined;
|
|
1034
|
+
pushNotificationConfig?: {
|
|
1035
|
+
url: string;
|
|
1036
|
+
id?: string | undefined;
|
|
1037
|
+
token?: string | undefined;
|
|
1038
|
+
authentication?: {
|
|
1039
|
+
type: "apiKey";
|
|
1040
|
+
id: string;
|
|
1041
|
+
name: string;
|
|
1042
|
+
in: "header" | "query";
|
|
1043
|
+
description?: string | undefined;
|
|
1044
|
+
} | {
|
|
1045
|
+
type: "http";
|
|
1046
|
+
id: string;
|
|
1047
|
+
scheme: "bearer";
|
|
1048
|
+
description?: string | undefined;
|
|
1049
|
+
bearerFormat?: string | undefined;
|
|
1050
|
+
} | {
|
|
1051
|
+
type: "openIdConnect";
|
|
1052
|
+
id: string;
|
|
1053
|
+
openIdConnectUrl: string;
|
|
1054
|
+
description?: string | undefined;
|
|
1055
|
+
audience?: string | string[] | undefined;
|
|
1056
|
+
issuer?: string | undefined;
|
|
1057
|
+
jwksUri?: string | undefined;
|
|
1058
|
+
algorithms?: string[] | undefined;
|
|
1059
|
+
} | undefined;
|
|
1060
|
+
} | undefined;
|
|
1061
|
+
extensions?: {
|
|
1062
|
+
uri: string;
|
|
1063
|
+
version?: string | undefined;
|
|
1064
|
+
required?: boolean | undefined;
|
|
1065
|
+
}[] | undefined;
|
|
1066
|
+
}, {
|
|
1067
|
+
blocking?: boolean | undefined;
|
|
1068
|
+
acceptedOutputModes?: string[] | undefined;
|
|
1069
|
+
pushNotificationConfig?: {
|
|
1070
|
+
url: string;
|
|
1071
|
+
id?: string | undefined;
|
|
1072
|
+
token?: string | undefined;
|
|
1073
|
+
authentication?: {
|
|
1074
|
+
type: "apiKey";
|
|
1075
|
+
id: string;
|
|
1076
|
+
name: string;
|
|
1077
|
+
in: "header" | "query";
|
|
1078
|
+
description?: string | undefined;
|
|
1079
|
+
} | {
|
|
1080
|
+
type: "http";
|
|
1081
|
+
id: string;
|
|
1082
|
+
scheme: "bearer";
|
|
1083
|
+
description?: string | undefined;
|
|
1084
|
+
bearerFormat?: string | undefined;
|
|
1085
|
+
} | {
|
|
1086
|
+
type: "openIdConnect";
|
|
1087
|
+
id: string;
|
|
1088
|
+
openIdConnectUrl: string;
|
|
1089
|
+
description?: string | undefined;
|
|
1090
|
+
audience?: string | string[] | undefined;
|
|
1091
|
+
issuer?: string | undefined;
|
|
1092
|
+
jwksUri?: string | undefined;
|
|
1093
|
+
algorithms?: string[] | undefined;
|
|
1094
|
+
} | undefined;
|
|
1095
|
+
} | undefined;
|
|
1096
|
+
extensions?: {
|
|
1097
|
+
uri: string;
|
|
1098
|
+
version?: string | undefined;
|
|
1099
|
+
required?: boolean | undefined;
|
|
1100
|
+
}[] | undefined;
|
|
1101
|
+
}>>;
|
|
1102
|
+
}, "strip", z.ZodTypeAny, {
|
|
1103
|
+
message: {
|
|
1104
|
+
role: "user" | "agent";
|
|
1105
|
+
parts: ({
|
|
1106
|
+
type: "text";
|
|
1107
|
+
text: string;
|
|
1108
|
+
} | {
|
|
1109
|
+
type: "file";
|
|
1110
|
+
file: {
|
|
1111
|
+
mimeType: string;
|
|
1112
|
+
name?: string | undefined;
|
|
1113
|
+
bytes?: string | undefined;
|
|
1114
|
+
uri?: string | undefined;
|
|
1115
|
+
};
|
|
1116
|
+
} | {
|
|
1117
|
+
type: "data";
|
|
1118
|
+
data: Record<string, unknown>;
|
|
1119
|
+
})[];
|
|
1120
|
+
messageId: string;
|
|
1121
|
+
timestamp: string;
|
|
1122
|
+
kind?: "message" | undefined;
|
|
1123
|
+
contextId?: string | undefined;
|
|
1124
|
+
};
|
|
1125
|
+
contextId?: string | undefined;
|
|
1126
|
+
taskId?: string | undefined;
|
|
1127
|
+
sessionId?: string | undefined;
|
|
1128
|
+
configuration?: {
|
|
1129
|
+
blocking?: boolean | undefined;
|
|
1130
|
+
acceptedOutputModes?: string[] | undefined;
|
|
1131
|
+
pushNotificationConfig?: {
|
|
1132
|
+
url: string;
|
|
1133
|
+
id?: string | undefined;
|
|
1134
|
+
token?: string | undefined;
|
|
1135
|
+
authentication?: {
|
|
1136
|
+
type: "apiKey";
|
|
1137
|
+
id: string;
|
|
1138
|
+
name: string;
|
|
1139
|
+
in: "header" | "query";
|
|
1140
|
+
description?: string | undefined;
|
|
1141
|
+
} | {
|
|
1142
|
+
type: "http";
|
|
1143
|
+
id: string;
|
|
1144
|
+
scheme: "bearer";
|
|
1145
|
+
description?: string | undefined;
|
|
1146
|
+
bearerFormat?: string | undefined;
|
|
1147
|
+
} | {
|
|
1148
|
+
type: "openIdConnect";
|
|
1149
|
+
id: string;
|
|
1150
|
+
openIdConnectUrl: string;
|
|
1151
|
+
description?: string | undefined;
|
|
1152
|
+
audience?: string | string[] | undefined;
|
|
1153
|
+
issuer?: string | undefined;
|
|
1154
|
+
jwksUri?: string | undefined;
|
|
1155
|
+
algorithms?: string[] | undefined;
|
|
1156
|
+
} | undefined;
|
|
1157
|
+
} | undefined;
|
|
1158
|
+
extensions?: {
|
|
1159
|
+
uri: string;
|
|
1160
|
+
version?: string | undefined;
|
|
1161
|
+
required?: boolean | undefined;
|
|
1162
|
+
}[] | undefined;
|
|
1163
|
+
} | undefined;
|
|
1164
|
+
}, {
|
|
1165
|
+
message: {
|
|
1166
|
+
role: "user" | "agent";
|
|
1167
|
+
parts: ({
|
|
1168
|
+
type: "text";
|
|
1169
|
+
text: string;
|
|
1170
|
+
} | {
|
|
1171
|
+
type: "file";
|
|
1172
|
+
file: {
|
|
1173
|
+
mimeType: string;
|
|
1174
|
+
name?: string | undefined;
|
|
1175
|
+
bytes?: string | undefined;
|
|
1176
|
+
uri?: string | undefined;
|
|
1177
|
+
};
|
|
1178
|
+
} | {
|
|
1179
|
+
type: "data";
|
|
1180
|
+
data: Record<string, unknown>;
|
|
1181
|
+
})[];
|
|
1182
|
+
messageId: string;
|
|
1183
|
+
timestamp: string;
|
|
1184
|
+
kind?: "message" | undefined;
|
|
1185
|
+
contextId?: string | undefined;
|
|
1186
|
+
};
|
|
1187
|
+
contextId?: string | undefined;
|
|
1188
|
+
taskId?: string | undefined;
|
|
1189
|
+
sessionId?: string | undefined;
|
|
1190
|
+
configuration?: {
|
|
1191
|
+
blocking?: boolean | undefined;
|
|
1192
|
+
acceptedOutputModes?: string[] | undefined;
|
|
1193
|
+
pushNotificationConfig?: {
|
|
1194
|
+
url: string;
|
|
1195
|
+
id?: string | undefined;
|
|
1196
|
+
token?: string | undefined;
|
|
1197
|
+
authentication?: {
|
|
1198
|
+
type: "apiKey";
|
|
1199
|
+
id: string;
|
|
1200
|
+
name: string;
|
|
1201
|
+
in: "header" | "query";
|
|
1202
|
+
description?: string | undefined;
|
|
1203
|
+
} | {
|
|
1204
|
+
type: "http";
|
|
1205
|
+
id: string;
|
|
1206
|
+
scheme: "bearer";
|
|
1207
|
+
description?: string | undefined;
|
|
1208
|
+
bearerFormat?: string | undefined;
|
|
1209
|
+
} | {
|
|
1210
|
+
type: "openIdConnect";
|
|
1211
|
+
id: string;
|
|
1212
|
+
openIdConnectUrl: string;
|
|
1213
|
+
description?: string | undefined;
|
|
1214
|
+
audience?: string | string[] | undefined;
|
|
1215
|
+
issuer?: string | undefined;
|
|
1216
|
+
jwksUri?: string | undefined;
|
|
1217
|
+
algorithms?: string[] | undefined;
|
|
1218
|
+
} | undefined;
|
|
1219
|
+
} | undefined;
|
|
1220
|
+
extensions?: {
|
|
1221
|
+
uri: string;
|
|
1222
|
+
version?: string | undefined;
|
|
1223
|
+
required?: boolean | undefined;
|
|
1224
|
+
}[] | undefined;
|
|
1225
|
+
} | undefined;
|
|
1226
|
+
}>;
|
|
1227
|
+
declare const TaskListParamsSchema: z.ZodObject<{
|
|
1228
|
+
contextId: z.ZodOptional<z.ZodString>;
|
|
1229
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
1230
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
1231
|
+
}, "strip", z.ZodTypeAny, {
|
|
1232
|
+
contextId?: string | undefined;
|
|
1233
|
+
limit?: number | undefined;
|
|
1234
|
+
offset?: number | undefined;
|
|
1235
|
+
}, {
|
|
1236
|
+
contextId?: string | undefined;
|
|
1237
|
+
limit?: number | undefined;
|
|
1238
|
+
offset?: number | undefined;
|
|
1239
|
+
}>;
|
|
1240
|
+
/**
|
|
1241
|
+
* Validates a payload against a zod schema.
|
|
1242
|
+
* Throws a JsonRpcError if validation fails.
|
|
1243
|
+
* @param schema The zod schema to validate against.
|
|
1244
|
+
* @param data The payload to validate.
|
|
1245
|
+
* @returns The validated data.
|
|
1246
|
+
*/
|
|
1247
|
+
declare function validateRequest<T>(schema: z.ZodType<T>, data: unknown): T;
|
|
1248
|
+
declare function validateMessageSendParams(data: unknown): MessageSendParams;
|
|
1249
|
+
declare function validateTaskListParams(data: unknown): TaskListParams;
|
|
1250
|
+
|
|
1251
|
+
interface ITaskStorage {
|
|
1252
|
+
insertTask(task: Task): Task;
|
|
1253
|
+
getTask(taskId: string): Task | undefined;
|
|
1254
|
+
saveTask(task: Task): void;
|
|
1255
|
+
getAllTasks(): Task[];
|
|
1256
|
+
getTasksByContextId(contextId: string): Task[];
|
|
1257
|
+
setPushNotification(taskId: string, config: PushNotificationConfig): PushNotificationConfig | undefined;
|
|
1258
|
+
getPushNotification(taskId: string): PushNotificationConfig | undefined;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* @file TaskManager.ts
|
|
1263
|
+
* Task lifecycle manager backed by a pluggable storage engine.
|
|
1264
|
+
*/
|
|
1265
|
+
|
|
1266
|
+
type TaskUpdateReason = 'created' | 'message' | 'artifact' | 'state' | 'push-config';
|
|
1267
|
+
interface TaskUpdatedEvent {
|
|
1268
|
+
task: Task;
|
|
1269
|
+
reason: TaskUpdateReason;
|
|
1270
|
+
}
|
|
1271
|
+
declare class TaskManager extends EventEmitter {
|
|
1272
|
+
private readonly storage;
|
|
1273
|
+
constructor(storage?: ITaskStorage);
|
|
1274
|
+
/**
|
|
1275
|
+
* Creates a new task and stores it in memory.
|
|
1276
|
+
*
|
|
1277
|
+
* @param sessionId Optional session identifier.
|
|
1278
|
+
* @param contextId Optional conversation context identifier.
|
|
1279
|
+
* @returns Newly created task.
|
|
1280
|
+
*/
|
|
1281
|
+
createTask(sessionId?: string, contextId?: string): Task;
|
|
1282
|
+
getTask(taskId: string): Task | undefined;
|
|
1283
|
+
getAllTasks(): Task[];
|
|
1284
|
+
getTasksByContext(contextId: string): Task[];
|
|
1285
|
+
getTasksByContextId(contextId: string): Task[];
|
|
1286
|
+
addHistoryMessage(taskId: string, message: Message): Task | undefined;
|
|
1287
|
+
addArtifact(taskId: string, artifact: ExtensibleArtifact): Task | undefined;
|
|
1288
|
+
updateTaskState(taskId: string, state: TaskStatus['state'], historyMessage?: Message, metadata?: Record<string, unknown>): Task | undefined;
|
|
1289
|
+
cancelTask(taskId: string): Task | undefined;
|
|
1290
|
+
setPushNotification(taskId: string, config: PushNotificationConfig): PushNotificationConfig | undefined;
|
|
1291
|
+
getPushNotification(taskId: string): PushNotificationConfig | undefined;
|
|
1292
|
+
setTaskExtensions(taskId: string, extensions: string[]): Task | undefined;
|
|
1293
|
+
getTaskCounts(): TaskCounts;
|
|
1294
|
+
private emitTaskUpdated;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* @file SSEStreamer.ts
|
|
1299
|
+
* Server-Sent Events handler for task progress streaming.
|
|
1300
|
+
*/
|
|
1301
|
+
|
|
1302
|
+
declare class SSEStreamer {
|
|
1303
|
+
private clients;
|
|
1304
|
+
/**
|
|
1305
|
+
* Add a client to the stream map (allows multiple subscribers per task).
|
|
1306
|
+
* @param taskId The task ID associated with the stream.
|
|
1307
|
+
* @param res The Express Response object.
|
|
1308
|
+
*/
|
|
1309
|
+
addClient(taskId: string, res: Response$1): void;
|
|
1310
|
+
/**
|
|
1311
|
+
* Broadcast an event to all subscribers of a specific task.
|
|
1312
|
+
* @param taskId The task ID.
|
|
1313
|
+
* @param event The SSE event type (e.g. 'task_updated').
|
|
1314
|
+
* @param data The JSON data payload.
|
|
1315
|
+
*/
|
|
1316
|
+
sendEvent(taskId: string, event: string, data: unknown): void;
|
|
1317
|
+
/**
|
|
1318
|
+
* Send a task update and complete the streams if terminal state reached.
|
|
1319
|
+
* @param taskId The task ID.
|
|
1320
|
+
* @param task The updated task object.
|
|
1321
|
+
*/
|
|
1322
|
+
sendTaskUpdate(taskId: string, task: Task): void;
|
|
1323
|
+
/**
|
|
1324
|
+
* Close all streams for a specific task.
|
|
1325
|
+
* @param taskId The task ID.
|
|
1326
|
+
*/
|
|
1327
|
+
closeStream(taskId: string): void;
|
|
1328
|
+
/**
|
|
1329
|
+
* Remove a specific client from the map.
|
|
1330
|
+
* @param taskId The task ID.
|
|
1331
|
+
* @param res The specific Response object.
|
|
1332
|
+
*/
|
|
1333
|
+
removeClient(taskId: string, res: Response$1): void;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* @file CircuitBreaker.ts
|
|
1338
|
+
* Simple circuit breaker for non-critical downstream integrations.
|
|
1339
|
+
*/
|
|
1340
|
+
type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';
|
|
1341
|
+
interface CircuitBreakerOptions {
|
|
1342
|
+
failureThreshold?: number;
|
|
1343
|
+
recoveryTimeoutMs?: number;
|
|
1344
|
+
successThreshold?: number;
|
|
1345
|
+
}
|
|
1346
|
+
declare class CircuitOpenError extends Error {
|
|
1347
|
+
constructor(message: string);
|
|
1348
|
+
}
|
|
1349
|
+
declare class CircuitBreaker {
|
|
1350
|
+
private readonly name;
|
|
1351
|
+
private state;
|
|
1352
|
+
private failureCount;
|
|
1353
|
+
private successCount;
|
|
1354
|
+
private nextAttemptAt;
|
|
1355
|
+
private readonly failureThreshold;
|
|
1356
|
+
private readonly recoveryTimeoutMs;
|
|
1357
|
+
private readonly successThreshold;
|
|
1358
|
+
constructor(name: string, options?: CircuitBreakerOptions);
|
|
1359
|
+
getState(): CircuitState;
|
|
1360
|
+
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
1361
|
+
private onSuccess;
|
|
1362
|
+
private onFailure;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* @file PushNotificationService.ts
|
|
1367
|
+
* Delivery of A2A task updates to client webhooks.
|
|
1368
|
+
*/
|
|
1369
|
+
|
|
1370
|
+
interface PushNotificationServiceOptions {
|
|
1371
|
+
circuitBreaker?: CircuitBreakerOptions;
|
|
1372
|
+
}
|
|
1373
|
+
declare class PushNotificationService {
|
|
1374
|
+
private readonly options;
|
|
1375
|
+
private readonly breakers;
|
|
1376
|
+
constructor(options?: PushNotificationServiceOptions);
|
|
1377
|
+
private getBreakerFor;
|
|
1378
|
+
/**
|
|
1379
|
+
* Sends a task snapshot to the configured webhook endpoint.
|
|
1380
|
+
*
|
|
1381
|
+
* @param config Webhook delivery configuration.
|
|
1382
|
+
* @param task Current task snapshot to deliver.
|
|
1383
|
+
* @returns Resolves when delivery succeeds.
|
|
1384
|
+
* @throws When the endpoint responds with a non-2xx status.
|
|
1385
|
+
*/
|
|
1386
|
+
sendNotification(config: PushNotificationConfig, task: Task): Promise<void>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Executes an async action with exponential backoff.
|
|
1389
|
+
*
|
|
1390
|
+
* @param fn Async operation to retry.
|
|
1391
|
+
* @param maxRetries Maximum number of retry attempts.
|
|
1392
|
+
* @returns Resolves when the operation succeeds.
|
|
1393
|
+
* @throws Re-throws the last failure when retries are exhausted.
|
|
1394
|
+
*/
|
|
1395
|
+
retryWithBackoff(fn: () => Promise<void>, maxRetries?: number): Promise<void>;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
interface A2AServerOptions {
|
|
1399
|
+
rateLimit?: Partial<RateLimitConfig>;
|
|
1400
|
+
rateLimitStore?: RateLimitStore;
|
|
1401
|
+
auth?: JwtAuthMiddlewareOptions;
|
|
1402
|
+
taskStorage?: ITaskStorage;
|
|
1403
|
+
}
|
|
1404
|
+
interface RequestContext {
|
|
1405
|
+
req: Request;
|
|
1406
|
+
}
|
|
1407
|
+
declare abstract class A2AServer {
|
|
1408
|
+
private readonly options;
|
|
1409
|
+
protected app: Express;
|
|
1410
|
+
protected agentCard: AgentCard;
|
|
1411
|
+
protected taskManager: TaskManager;
|
|
1412
|
+
protected streamer: SSEStreamer;
|
|
1413
|
+
protected pushNotificationService: PushNotificationService;
|
|
1414
|
+
protected authMiddleware: JwtAuthMiddleware | undefined;
|
|
1415
|
+
private readonly startedAt;
|
|
1416
|
+
constructor(agentCard: AgentCard, options?: A2AServerOptions);
|
|
1417
|
+
private setupMiddleware;
|
|
1418
|
+
private setupRoutes;
|
|
1419
|
+
private bindTaskObservers;
|
|
1420
|
+
protected handleRpc(req: JsonRpcRequest, context: RequestContext): Promise<unknown>;
|
|
1421
|
+
private handleMessageRequest;
|
|
1422
|
+
private negotiateExtensions;
|
|
1423
|
+
protected normalizeArtifacts(task: Task, artifacts: Artifact[]): ExtensibleArtifact[];
|
|
1424
|
+
getExpressApp(): Express;
|
|
1425
|
+
getAgentCard(): AgentCard;
|
|
1426
|
+
getTaskManager(): TaskManager;
|
|
1427
|
+
static fromCard(card: AnyAgentCard): AgentCard;
|
|
1428
|
+
protected processTaskInternal(task: Task, message: Message): Promise<void>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Adapter implementation entry point. Must be implemented by specific adapters.
|
|
1431
|
+
*/
|
|
1432
|
+
abstract handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
1433
|
+
start(port: number): node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
declare class InMemoryTaskStorage implements ITaskStorage {
|
|
1437
|
+
private readonly tasks;
|
|
1438
|
+
private readonly contextIndex;
|
|
1439
|
+
private readonly pushNotifications;
|
|
1440
|
+
insertTask(task: Task): Task;
|
|
1441
|
+
getTask(taskId: string): Task | undefined;
|
|
1442
|
+
saveTask(task: Task): void;
|
|
1443
|
+
getAllTasks(): Task[];
|
|
1444
|
+
getTasksByContextId(contextId: string): Task[];
|
|
1445
|
+
setPushNotification(taskId: string, config: PushNotificationConfig): PushNotificationConfig | undefined;
|
|
1446
|
+
getPushNotification(taskId: string): PushNotificationConfig | undefined;
|
|
1447
|
+
private syncContextIndex;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
declare class SqliteTaskStorage implements ITaskStorage {
|
|
1451
|
+
private readonly db;
|
|
1452
|
+
constructor(path: string);
|
|
1453
|
+
insertTask(task: Task): Task;
|
|
1454
|
+
getTask(taskId: string): Task | undefined;
|
|
1455
|
+
saveTask(task: Task): void;
|
|
1456
|
+
getAllTasks(): Task[];
|
|
1457
|
+
getTasksByContextId(contextId: string): Task[];
|
|
1458
|
+
setPushNotification(taskId: string, config: PushNotificationConfig): PushNotificationConfig | undefined;
|
|
1459
|
+
getPushNotification(taskId: string): PushNotificationConfig | undefined;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* @file interceptors.ts
|
|
1464
|
+
* Transport-agnostic request interception helpers for client calls.
|
|
1465
|
+
*/
|
|
1466
|
+
interface ClientCallOptions {
|
|
1467
|
+
headers?: Record<string, string>;
|
|
1468
|
+
serviceParameters?: Record<string, string>;
|
|
1469
|
+
signal?: AbortSignal;
|
|
1470
|
+
}
|
|
1471
|
+
interface BeforeArgs {
|
|
1472
|
+
method: string;
|
|
1473
|
+
body?: unknown;
|
|
1474
|
+
options: ClientCallOptions;
|
|
1475
|
+
}
|
|
1476
|
+
interface AfterArgs<T = unknown> {
|
|
1477
|
+
method: string;
|
|
1478
|
+
response: T;
|
|
1479
|
+
}
|
|
1480
|
+
interface CallInterceptor {
|
|
1481
|
+
before(args: BeforeArgs): Promise<void> | void;
|
|
1482
|
+
after?(args: AfterArgs): Promise<void> | void;
|
|
1483
|
+
}
|
|
1484
|
+
interface AuthenticationHandler {
|
|
1485
|
+
headers(): Promise<Record<string, string>>;
|
|
1486
|
+
shouldRetryWithHeaders?(requestInit: RequestInit, response: Response): Promise<Record<string, string> | undefined>;
|
|
1487
|
+
}
|
|
1488
|
+
declare function createAuthenticatingFetchWithRetry(baseFetch: typeof fetch, handler: AuthenticationHandler): typeof fetch;
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* @file A2AClient.ts
|
|
1492
|
+
* Basic HTTP + SSE client for A2A-compatible agents.
|
|
1493
|
+
*/
|
|
1494
|
+
|
|
1495
|
+
interface A2AClientOptions {
|
|
1496
|
+
fetchImplementation?: typeof fetch;
|
|
1497
|
+
cardPath?: string;
|
|
1498
|
+
rpcPath?: string;
|
|
1499
|
+
streamPath?: string;
|
|
1500
|
+
eventSourceImplementation?: typeof EventSource;
|
|
1501
|
+
interceptors?: CallInterceptor[];
|
|
1502
|
+
headers?: Record<string, string>;
|
|
1503
|
+
retry?: {
|
|
1504
|
+
maxAttempts?: number;
|
|
1505
|
+
backoffMs?: number;
|
|
1506
|
+
retryOn?: number[];
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* HTTP and SSE client for interacting with A2A-compatible agents.
|
|
1511
|
+
*
|
|
1512
|
+
* @example
|
|
1513
|
+
* ```ts
|
|
1514
|
+
* const client = new A2AClient('http://localhost:3000');
|
|
1515
|
+
* const task = await client.sendMessage({
|
|
1516
|
+
* role: 'user',
|
|
1517
|
+
* parts: [{ type: 'text', text: 'Summarize this' }],
|
|
1518
|
+
* messageId: crypto.randomUUID(),
|
|
1519
|
+
* timestamp: new Date().toISOString(),
|
|
1520
|
+
* });
|
|
1521
|
+
* ```
|
|
1522
|
+
* @since 1.0.0
|
|
1523
|
+
*/
|
|
1524
|
+
declare class A2AClient {
|
|
1525
|
+
readonly baseUrl: string;
|
|
1526
|
+
private readonly fetchImplementation;
|
|
1527
|
+
private readonly cardPath;
|
|
1528
|
+
private readonly rpcPath;
|
|
1529
|
+
private readonly streamPath;
|
|
1530
|
+
private readonly eventSourceImplementation;
|
|
1531
|
+
private readonly interceptors;
|
|
1532
|
+
private readonly headers;
|
|
1533
|
+
private readonly retry;
|
|
1534
|
+
constructor(baseUrl: string, options?: A2AClientOptions);
|
|
1535
|
+
resolveCard(): Promise<AgentCard>;
|
|
1536
|
+
sendMessage(params: Message | MessageSendParams): Promise<Task>;
|
|
1537
|
+
sendMessageStream(params: Message | MessageSendParams): Promise<AsyncGenerator<unknown>>;
|
|
1538
|
+
getTask(taskId: string): Promise<Task>;
|
|
1539
|
+
listTasks(params?: TaskListParams): Promise<TaskListResult>;
|
|
1540
|
+
cancelTask(taskId: string): Promise<Task>;
|
|
1541
|
+
setPushNotification(taskId: string, pushNotificationConfig: PushNotificationConfig): Promise<PushNotificationConfig>;
|
|
1542
|
+
getPushNotification(taskId: string): Promise<PushNotificationConfig | null>;
|
|
1543
|
+
health(): Promise<A2AHealthResponse>;
|
|
1544
|
+
private rpc;
|
|
1545
|
+
private normalizeParams;
|
|
1546
|
+
private subscribeToTask;
|
|
1547
|
+
private fetchWithRetry;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* @file AgentRegistryClient.ts
|
|
1552
|
+
* Client for the local registry REST/SSE endpoints.
|
|
1553
|
+
*/
|
|
1554
|
+
|
|
1555
|
+
interface RegisteredAgent {
|
|
1556
|
+
id: string;
|
|
1557
|
+
url: string;
|
|
1558
|
+
card: AgentCard;
|
|
1559
|
+
status: 'healthy' | 'unhealthy' | 'unknown';
|
|
1560
|
+
tags: string[];
|
|
1561
|
+
skills: string[];
|
|
1562
|
+
registeredAt: string;
|
|
1563
|
+
lastHeartbeatAt?: string;
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Client for the registry REST and SSE endpoints.
|
|
1567
|
+
*
|
|
1568
|
+
* @example
|
|
1569
|
+
* ```ts
|
|
1570
|
+
* const registry = new AgentRegistryClient('http://localhost:3099');
|
|
1571
|
+
* const agents = await registry.listAgents();
|
|
1572
|
+
* ```
|
|
1573
|
+
* @since 1.0.0
|
|
1574
|
+
*/
|
|
1575
|
+
declare class AgentRegistryClient {
|
|
1576
|
+
private readonly baseUrl;
|
|
1577
|
+
private readonly fetchImplementation;
|
|
1578
|
+
constructor(baseUrl: string, fetchImplementation?: typeof fetch);
|
|
1579
|
+
register(agentUrl: string, agentCard: AgentCard): Promise<RegisteredAgent>;
|
|
1580
|
+
listAgents(): Promise<RegisteredAgent[]>;
|
|
1581
|
+
getAgent(id: string): Promise<RegisteredAgent>;
|
|
1582
|
+
searchAgents(query: string, filters?: Record<string, string>): Promise<RegisteredAgent[]>;
|
|
1583
|
+
sendHeartbeat(id: string): Promise<RegisteredAgent>;
|
|
1584
|
+
health(): Promise<Record<string, unknown>>;
|
|
1585
|
+
events(): AsyncGenerator<unknown>;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
export { A2AClient, A2AServer, AgentRegistryClient, AuthScheme, CircuitBreaker, CircuitOpenError, ErrorCodes, InMemoryTaskStorage, JsonRpcError, JsonRpcRequestSchema, JwtAuthMiddleware, JwtAuthMiddlewareOptions, MessageRequestConfigurationSchema, MessageSchema, MessageSendParamsSchema, PartSchema, PushNotificationConfigSchema, PushNotificationService, RateLimitConfig, RateLimitStore, SSEStreamer, SqliteTaskStorage, TaskListParamsSchema, TaskManager, createAuthenticatingFetchWithRetry, logger, normalizeAgentCard, validateMessageSendParams, validateRequest, validateTaskListParams };
|
|
1589
|
+
export type { A2AClientOptions, A2AExtension, A2AHealthResponse, A2AServerOptions, AfterArgs, AgentCapabilities, AgentCard, AgentCardV03, AgentSkill, AnyAgentCard, Artifact, AuthenticationHandler, BeforeArgs, CallInterceptor, CircuitBreakerOptions, CircuitState, ClientCallOptions, DataPart, ExtensibleArtifact, FilePart, ITaskStorage, JsonRpcFailureResponse, JsonRpcId, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccessResponse, LogContext, Message, MessageRequestConfiguration, MessageSendParams, Part, ProtocolVersion, PushNotificationConfig, PushNotificationServiceOptions, RegisteredAgent, Task, TaskCounts, TaskListParams, TaskListResult, TaskStatus, TaskUpdateReason, TaskUpdatedEvent, TextPart };
|