@a2a-js/sdk 0.3.5 → 0.3.7

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.
@@ -1,29 +1,91 @@
1
- import { EventEmitter } from 'events';
2
- import { B as Message, aw as Task, aO as TaskStatusUpdateEvent, aQ as TaskArtifactUpdateEvent, y as PushNotificationConfig, ac as AgentCard, w as MessageSendParams, V as TaskQueryParams, X as TaskIdParams, Z as TaskPushNotificationConfig, a1 as GetTaskPushNotificationConfigParams, a5 as ListTaskPushNotificationConfigParams, a7 as DeleteTaskPushNotificationConfigParams, i as JSONRPCResponse, au as JSONRPCError } from '../types-DNKcmF0f.cjs';
3
- import { A as A2ARequestHandler } from '../a2a_request_handler-DUvKWfix.cjs';
1
+ import { F as Message, ay as Task, aQ as TaskStatusUpdateEvent, aS as TaskArtifactUpdateEvent, z as PushNotificationConfig, ae as AgentCard, x as MessageSendParams, X as TaskQueryParams, Z as TaskIdParams, $ as TaskPushNotificationConfig, a3 as GetTaskPushNotificationConfigParams, a7 as ListTaskPushNotificationConfigParams, a9 as DeleteTaskPushNotificationConfigParams, j as JSONRPCResponse, aw as JSONRPCError } from '../extensions-DvruCIzw.cjs';
2
+ import { S as ServerCallContext, A as A2ARequestHandler } from '../a2a_request_handler-B3LxMq3P.cjs';
3
+ export { a as UnauthenticatedUser, U as User } from '../a2a_request_handler-B3LxMq3P.cjs';
4
4
 
5
5
  type AgentExecutionEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
6
+ /**
7
+ * Event names supported by ExecutionEventBus.
8
+ */
9
+ type ExecutionEventName = 'event' | 'finished';
6
10
  interface ExecutionEventBus {
7
11
  publish(event: AgentExecutionEvent): void;
8
- on(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
9
- off(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
10
- once(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
11
- removeAllListeners(eventName?: 'event' | 'finished'): this;
12
+ on(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
13
+ off(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
14
+ once(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
15
+ removeAllListeners(eventName?: ExecutionEventName): this;
12
16
  finished(): void;
13
17
  }
14
- declare class DefaultExecutionEventBus extends EventEmitter implements ExecutionEventBus {
15
- constructor();
18
+ /**
19
+ * Web-compatible ExecutionEventBus using EventTarget.
20
+ * Works across all modern runtimes: Node.js 15+, browsers, Cloudflare Workers, Deno, Bun.
21
+ *
22
+ * This implementation provides the subset of EventEmitter methods defined in the
23
+ * ExecutionEventBus interface. Users extending DefaultExecutionEventBus should note
24
+ * that other EventEmitter methods (e.g., listenerCount, rawListeners) are not available.
25
+ */
26
+ declare class DefaultExecutionEventBus extends EventTarget implements ExecutionEventBus {
27
+ private readonly eventListeners;
28
+ private readonly finishedListeners;
16
29
  publish(event: AgentExecutionEvent): void;
17
30
  finished(): void;
31
+ /**
32
+ * EventEmitter-compatible 'on' method.
33
+ * Wraps the listener to extract event detail from CustomEvent.
34
+ * Supports multiple registrations of the same listener (like EventEmitter).
35
+ * @param eventName The event name to listen for.
36
+ * @param listener The callback function to invoke when the event is emitted.
37
+ * @returns This instance for method chaining.
38
+ */
39
+ on(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
40
+ /**
41
+ * EventEmitter-compatible 'off' method.
42
+ * Uses the stored wrapped listener for proper removal.
43
+ * Removes at most one instance of a listener per call (like EventEmitter).
44
+ * @param eventName The event name to stop listening for.
45
+ * @param listener The callback function to remove.
46
+ * @returns This instance for method chaining.
47
+ */
48
+ off(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
49
+ /**
50
+ * EventEmitter-compatible 'once' method.
51
+ * Listener is automatically removed after first invocation.
52
+ * Supports multiple registrations of the same listener (like EventEmitter).
53
+ * @param eventName The event name to listen for once.
54
+ * @param listener The callback function to invoke when the event is emitted.
55
+ * @returns This instance for method chaining.
56
+ */
57
+ once(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
58
+ /**
59
+ * EventEmitter-compatible 'removeAllListeners' method.
60
+ * Removes all listeners for a specific event or all events.
61
+ * @param eventName Optional event name to remove listeners for. If omitted, removes all.
62
+ * @returns This instance for method chaining.
63
+ */
64
+ removeAllListeners(eventName?: ExecutionEventName): this;
65
+ /**
66
+ * Adds a wrapped listener to the tracking map.
67
+ */
68
+ private trackListener;
69
+ /**
70
+ * Removes a wrapped listener from the tracking map (for once cleanup).
71
+ */
72
+ private untrackWrappedListener;
73
+ private addEventListenerInternal;
74
+ private removeEventListenerInternal;
75
+ private addEventListenerOnceInternal;
76
+ private addFinishedListenerInternal;
77
+ private removeFinishedListenerInternal;
78
+ private addFinishedListenerOnceInternal;
18
79
  }
19
80
 
20
81
  declare class RequestContext {
21
82
  readonly userMessage: Message;
22
- readonly task?: Task;
23
- readonly referenceTasks?: Task[];
24
83
  readonly taskId: string;
25
84
  readonly contextId: string;
26
- constructor(userMessage: Message, taskId: string, contextId: string, task?: Task, referenceTasks?: Task[]);
85
+ readonly task?: Task;
86
+ readonly referenceTasks?: Task[];
87
+ readonly context?: ServerCallContext;
88
+ constructor(userMessage: Message, taskId: string, contextId: string, task?: Task, referenceTasks?: Task[], context?: ServerCallContext);
27
89
  }
28
90
 
29
91
  interface AgentExecutor {
@@ -53,13 +115,13 @@ declare class DefaultExecutionEventBusManager implements ExecutionEventBusManage
53
115
  /**
54
116
  * Creates or retrieves an existing ExecutionEventBus based on the taskId.
55
117
  * @param taskId The ID of the task.
56
- * @returns An instance of IExecutionEventBus.
118
+ * @returns An instance of ExecutionEventBus.
57
119
  */
58
120
  createOrGetByTaskId(taskId: string): ExecutionEventBus;
59
121
  /**
60
122
  * Retrieves an existing ExecutionEventBus based on the taskId.
61
123
  * @param taskId The ID of the task.
62
- * @returns An instance of IExecutionEventBus or undefined if not found.
124
+ * @returns An instance of ExecutionEventBus or undefined if not found.
63
125
  */
64
126
  getByTaskId(taskId: string): ExecutionEventBus | undefined;
65
127
  /**
@@ -102,16 +164,18 @@ interface TaskStore {
102
164
  /**
103
165
  * Saves a task.
104
166
  * Overwrites existing data if the task ID exists.
105
- * @param data An object containing the task.
167
+ * @param task The task to save.
168
+ * @param context The context of the current call.
106
169
  * @returns A promise resolving when the save operation is complete.
107
170
  */
108
- save(task: Task): Promise<void>;
171
+ save(task: Task, context?: ServerCallContext): Promise<void>;
109
172
  /**
110
173
  * Loads a task by task ID.
111
174
  * @param taskId The ID of the task to load.
175
+ * @param context The context of the current call.
112
176
  * @returns A promise resolving to an object containing the Task, or undefined if not found.
113
177
  */
114
- load(taskId: string): Promise<Task | undefined>;
178
+ load(taskId: string, context?: ServerCallContext): Promise<Task | undefined>;
115
179
  }
116
180
  declare class InMemoryTaskStore implements TaskStore {
117
181
  private store;
@@ -137,35 +201,38 @@ interface PushNotificationSender {
137
201
 
138
202
  declare class DefaultRequestHandler implements A2ARequestHandler {
139
203
  private readonly agentCard;
140
- private readonly extendedAgentCard?;
141
204
  private readonly taskStore;
142
205
  private readonly agentExecutor;
143
206
  private readonly eventBusManager;
144
207
  private readonly pushNotificationStore?;
145
208
  private readonly pushNotificationSender?;
146
- constructor(agentCard: AgentCard, taskStore: TaskStore, agentExecutor: AgentExecutor, eventBusManager?: ExecutionEventBusManager, pushNotificationStore?: PushNotificationStore, pushNotificationSender?: PushNotificationSender, extendedAgentCard?: AgentCard);
209
+ private readonly extendedAgentCardProvider?;
210
+ constructor(agentCard: AgentCard, taskStore: TaskStore, agentExecutor: AgentExecutor, eventBusManager?: ExecutionEventBusManager, pushNotificationStore?: PushNotificationStore, pushNotificationSender?: PushNotificationSender, extendedAgentCardProvider?: AgentCard | ExtendedAgentCardProvider);
147
211
  getAgentCard(): Promise<AgentCard>;
148
- getAuthenticatedExtendedAgentCard(): Promise<AgentCard>;
212
+ getAuthenticatedExtendedAgentCard(context?: ServerCallContext): Promise<AgentCard>;
149
213
  private _createRequestContext;
150
214
  private _processEvents;
151
- sendMessage(params: MessageSendParams): Promise<Message | Task>;
152
- sendMessageStream(params: MessageSendParams): AsyncGenerator<Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
153
- getTask(params: TaskQueryParams): Promise<Task>;
154
- cancelTask(params: TaskIdParams): Promise<Task>;
155
- setTaskPushNotificationConfig(params: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig>;
156
- getTaskPushNotificationConfig(params: TaskIdParams | GetTaskPushNotificationConfigParams): Promise<TaskPushNotificationConfig>;
157
- listTaskPushNotificationConfigs(params: ListTaskPushNotificationConfigParams): Promise<TaskPushNotificationConfig[]>;
158
- deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams): Promise<void>;
159
- resubscribe(params: TaskIdParams): AsyncGenerator<Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
215
+ sendMessage(params: MessageSendParams, context?: ServerCallContext): Promise<Message | Task>;
216
+ sendMessageStream(params: MessageSendParams, context?: ServerCallContext): AsyncGenerator<Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
217
+ getTask(params: TaskQueryParams, context?: ServerCallContext): Promise<Task>;
218
+ cancelTask(params: TaskIdParams, context?: ServerCallContext): Promise<Task>;
219
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, context?: ServerCallContext): Promise<TaskPushNotificationConfig>;
220
+ getTaskPushNotificationConfig(params: TaskIdParams | GetTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<TaskPushNotificationConfig>;
221
+ listTaskPushNotificationConfigs(params: ListTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<TaskPushNotificationConfig[]>;
222
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<void>;
223
+ resubscribe(params: TaskIdParams, context?: ServerCallContext): AsyncGenerator<Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
160
224
  private _sendPushNotificationIfNeeded;
225
+ private _handleProcessingError;
161
226
  }
227
+ type ExtendedAgentCardProvider = (context?: ServerCallContext) => Promise<AgentCard>;
162
228
 
163
229
  declare class ResultManager {
164
- private taskStore;
230
+ private readonly taskStore;
231
+ private readonly serverCallContext?;
165
232
  private currentTask?;
166
233
  private latestUserMessage?;
167
234
  private finalMessageResult?;
168
- constructor(taskStore: TaskStore);
235
+ constructor(taskStore: TaskStore, serverCallContext?: ServerCallContext);
169
236
  setContext(latestUserMessage: Message): void;
170
237
  /**
171
238
  * Processes an agent execution event and updates the task store.
@@ -198,7 +265,7 @@ declare class JsonRpcTransportHandler {
198
265
  * For streaming methods, it returns an AsyncGenerator of JSONRPCResult.
199
266
  * For non-streaming methods, it returns a Promise of a single JSONRPCMessage (Result or ErrorResponse).
200
267
  */
201
- handle(requestBody: any): Promise<JSONRPCResponse | AsyncGenerator<JSONRPCResponse, void, undefined>>;
268
+ handle(requestBody: any, context?: ServerCallContext): Promise<JSONRPCResponse | AsyncGenerator<JSONRPCResponse, void, undefined>>;
202
269
  private isRequestValid;
203
270
  private paramsAreValid;
204
271
  }
@@ -246,4 +313,4 @@ declare class DefaultPushNotificationSender implements PushNotificationSender {
246
313
  private _dispatchNotification;
247
314
  }
248
315
 
249
- export { A2AError, A2ARequestHandler, type AgentExecutionEvent, type AgentExecutor, DefaultExecutionEventBus, DefaultExecutionEventBusManager, DefaultPushNotificationSender, type DefaultPushNotificationSenderOptions, DefaultRequestHandler, type ExecutionEventBus, type ExecutionEventBusManager, ExecutionEventQueue, InMemoryPushNotificationStore, InMemoryTaskStore, JsonRpcTransportHandler, type PushNotificationSender, type PushNotificationStore, RequestContext, ResultManager, type TaskStore };
316
+ export { A2AError, A2ARequestHandler, type AgentExecutionEvent, type AgentExecutor, DefaultExecutionEventBus, DefaultExecutionEventBusManager, DefaultPushNotificationSender, type DefaultPushNotificationSenderOptions, DefaultRequestHandler, type ExecutionEventBus, type ExecutionEventBusManager, type ExecutionEventName, ExecutionEventQueue, type ExtendedAgentCardProvider, InMemoryPushNotificationStore, InMemoryTaskStore, JsonRpcTransportHandler, type PushNotificationSender, type PushNotificationStore, RequestContext, ResultManager, ServerCallContext, type TaskStore };
@@ -1,29 +1,91 @@
1
- import { EventEmitter } from 'events';
2
- import { B as Message, aw as Task, aO as TaskStatusUpdateEvent, aQ as TaskArtifactUpdateEvent, y as PushNotificationConfig, ac as AgentCard, w as MessageSendParams, V as TaskQueryParams, X as TaskIdParams, Z as TaskPushNotificationConfig, a1 as GetTaskPushNotificationConfigParams, a5 as ListTaskPushNotificationConfigParams, a7 as DeleteTaskPushNotificationConfigParams, i as JSONRPCResponse, au as JSONRPCError } from '../types-DNKcmF0f.js';
3
- import { A as A2ARequestHandler } from '../a2a_request_handler-B5t-IxgA.js';
1
+ import { F as Message, ay as Task, aQ as TaskStatusUpdateEvent, aS as TaskArtifactUpdateEvent, z as PushNotificationConfig, ae as AgentCard, x as MessageSendParams, X as TaskQueryParams, Z as TaskIdParams, $ as TaskPushNotificationConfig, a3 as GetTaskPushNotificationConfigParams, a7 as ListTaskPushNotificationConfigParams, a9 as DeleteTaskPushNotificationConfigParams, j as JSONRPCResponse, aw as JSONRPCError } from '../extensions-DvruCIzw.js';
2
+ import { S as ServerCallContext, A as A2ARequestHandler } from '../a2a_request_handler-BuP9LgXH.js';
3
+ export { a as UnauthenticatedUser, U as User } from '../a2a_request_handler-BuP9LgXH.js';
4
4
 
5
5
  type AgentExecutionEvent = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
6
+ /**
7
+ * Event names supported by ExecutionEventBus.
8
+ */
9
+ type ExecutionEventName = 'event' | 'finished';
6
10
  interface ExecutionEventBus {
7
11
  publish(event: AgentExecutionEvent): void;
8
- on(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
9
- off(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
10
- once(eventName: 'event' | 'finished', listener: (event: AgentExecutionEvent) => void): this;
11
- removeAllListeners(eventName?: 'event' | 'finished'): this;
12
+ on(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
13
+ off(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
14
+ once(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
15
+ removeAllListeners(eventName?: ExecutionEventName): this;
12
16
  finished(): void;
13
17
  }
14
- declare class DefaultExecutionEventBus extends EventEmitter implements ExecutionEventBus {
15
- constructor();
18
+ /**
19
+ * Web-compatible ExecutionEventBus using EventTarget.
20
+ * Works across all modern runtimes: Node.js 15+, browsers, Cloudflare Workers, Deno, Bun.
21
+ *
22
+ * This implementation provides the subset of EventEmitter methods defined in the
23
+ * ExecutionEventBus interface. Users extending DefaultExecutionEventBus should note
24
+ * that other EventEmitter methods (e.g., listenerCount, rawListeners) are not available.
25
+ */
26
+ declare class DefaultExecutionEventBus extends EventTarget implements ExecutionEventBus {
27
+ private readonly eventListeners;
28
+ private readonly finishedListeners;
16
29
  publish(event: AgentExecutionEvent): void;
17
30
  finished(): void;
31
+ /**
32
+ * EventEmitter-compatible 'on' method.
33
+ * Wraps the listener to extract event detail from CustomEvent.
34
+ * Supports multiple registrations of the same listener (like EventEmitter).
35
+ * @param eventName The event name to listen for.
36
+ * @param listener The callback function to invoke when the event is emitted.
37
+ * @returns This instance for method chaining.
38
+ */
39
+ on(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
40
+ /**
41
+ * EventEmitter-compatible 'off' method.
42
+ * Uses the stored wrapped listener for proper removal.
43
+ * Removes at most one instance of a listener per call (like EventEmitter).
44
+ * @param eventName The event name to stop listening for.
45
+ * @param listener The callback function to remove.
46
+ * @returns This instance for method chaining.
47
+ */
48
+ off(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
49
+ /**
50
+ * EventEmitter-compatible 'once' method.
51
+ * Listener is automatically removed after first invocation.
52
+ * Supports multiple registrations of the same listener (like EventEmitter).
53
+ * @param eventName The event name to listen for once.
54
+ * @param listener The callback function to invoke when the event is emitted.
55
+ * @returns This instance for method chaining.
56
+ */
57
+ once(eventName: ExecutionEventName, listener: (event: AgentExecutionEvent) => void): this;
58
+ /**
59
+ * EventEmitter-compatible 'removeAllListeners' method.
60
+ * Removes all listeners for a specific event or all events.
61
+ * @param eventName Optional event name to remove listeners for. If omitted, removes all.
62
+ * @returns This instance for method chaining.
63
+ */
64
+ removeAllListeners(eventName?: ExecutionEventName): this;
65
+ /**
66
+ * Adds a wrapped listener to the tracking map.
67
+ */
68
+ private trackListener;
69
+ /**
70
+ * Removes a wrapped listener from the tracking map (for once cleanup).
71
+ */
72
+ private untrackWrappedListener;
73
+ private addEventListenerInternal;
74
+ private removeEventListenerInternal;
75
+ private addEventListenerOnceInternal;
76
+ private addFinishedListenerInternal;
77
+ private removeFinishedListenerInternal;
78
+ private addFinishedListenerOnceInternal;
18
79
  }
19
80
 
20
81
  declare class RequestContext {
21
82
  readonly userMessage: Message;
22
- readonly task?: Task;
23
- readonly referenceTasks?: Task[];
24
83
  readonly taskId: string;
25
84
  readonly contextId: string;
26
- constructor(userMessage: Message, taskId: string, contextId: string, task?: Task, referenceTasks?: Task[]);
85
+ readonly task?: Task;
86
+ readonly referenceTasks?: Task[];
87
+ readonly context?: ServerCallContext;
88
+ constructor(userMessage: Message, taskId: string, contextId: string, task?: Task, referenceTasks?: Task[], context?: ServerCallContext);
27
89
  }
28
90
 
29
91
  interface AgentExecutor {
@@ -53,13 +115,13 @@ declare class DefaultExecutionEventBusManager implements ExecutionEventBusManage
53
115
  /**
54
116
  * Creates or retrieves an existing ExecutionEventBus based on the taskId.
55
117
  * @param taskId The ID of the task.
56
- * @returns An instance of IExecutionEventBus.
118
+ * @returns An instance of ExecutionEventBus.
57
119
  */
58
120
  createOrGetByTaskId(taskId: string): ExecutionEventBus;
59
121
  /**
60
122
  * Retrieves an existing ExecutionEventBus based on the taskId.
61
123
  * @param taskId The ID of the task.
62
- * @returns An instance of IExecutionEventBus or undefined if not found.
124
+ * @returns An instance of ExecutionEventBus or undefined if not found.
63
125
  */
64
126
  getByTaskId(taskId: string): ExecutionEventBus | undefined;
65
127
  /**
@@ -102,16 +164,18 @@ interface TaskStore {
102
164
  /**
103
165
  * Saves a task.
104
166
  * Overwrites existing data if the task ID exists.
105
- * @param data An object containing the task.
167
+ * @param task The task to save.
168
+ * @param context The context of the current call.
106
169
  * @returns A promise resolving when the save operation is complete.
107
170
  */
108
- save(task: Task): Promise<void>;
171
+ save(task: Task, context?: ServerCallContext): Promise<void>;
109
172
  /**
110
173
  * Loads a task by task ID.
111
174
  * @param taskId The ID of the task to load.
175
+ * @param context The context of the current call.
112
176
  * @returns A promise resolving to an object containing the Task, or undefined if not found.
113
177
  */
114
- load(taskId: string): Promise<Task | undefined>;
178
+ load(taskId: string, context?: ServerCallContext): Promise<Task | undefined>;
115
179
  }
116
180
  declare class InMemoryTaskStore implements TaskStore {
117
181
  private store;
@@ -137,35 +201,38 @@ interface PushNotificationSender {
137
201
 
138
202
  declare class DefaultRequestHandler implements A2ARequestHandler {
139
203
  private readonly agentCard;
140
- private readonly extendedAgentCard?;
141
204
  private readonly taskStore;
142
205
  private readonly agentExecutor;
143
206
  private readonly eventBusManager;
144
207
  private readonly pushNotificationStore?;
145
208
  private readonly pushNotificationSender?;
146
- constructor(agentCard: AgentCard, taskStore: TaskStore, agentExecutor: AgentExecutor, eventBusManager?: ExecutionEventBusManager, pushNotificationStore?: PushNotificationStore, pushNotificationSender?: PushNotificationSender, extendedAgentCard?: AgentCard);
209
+ private readonly extendedAgentCardProvider?;
210
+ constructor(agentCard: AgentCard, taskStore: TaskStore, agentExecutor: AgentExecutor, eventBusManager?: ExecutionEventBusManager, pushNotificationStore?: PushNotificationStore, pushNotificationSender?: PushNotificationSender, extendedAgentCardProvider?: AgentCard | ExtendedAgentCardProvider);
147
211
  getAgentCard(): Promise<AgentCard>;
148
- getAuthenticatedExtendedAgentCard(): Promise<AgentCard>;
212
+ getAuthenticatedExtendedAgentCard(context?: ServerCallContext): Promise<AgentCard>;
149
213
  private _createRequestContext;
150
214
  private _processEvents;
151
- sendMessage(params: MessageSendParams): Promise<Message | Task>;
152
- sendMessageStream(params: MessageSendParams): AsyncGenerator<Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
153
- getTask(params: TaskQueryParams): Promise<Task>;
154
- cancelTask(params: TaskIdParams): Promise<Task>;
155
- setTaskPushNotificationConfig(params: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig>;
156
- getTaskPushNotificationConfig(params: TaskIdParams | GetTaskPushNotificationConfigParams): Promise<TaskPushNotificationConfig>;
157
- listTaskPushNotificationConfigs(params: ListTaskPushNotificationConfigParams): Promise<TaskPushNotificationConfig[]>;
158
- deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams): Promise<void>;
159
- resubscribe(params: TaskIdParams): AsyncGenerator<Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
215
+ sendMessage(params: MessageSendParams, context?: ServerCallContext): Promise<Message | Task>;
216
+ sendMessageStream(params: MessageSendParams, context?: ServerCallContext): AsyncGenerator<Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
217
+ getTask(params: TaskQueryParams, context?: ServerCallContext): Promise<Task>;
218
+ cancelTask(params: TaskIdParams, context?: ServerCallContext): Promise<Task>;
219
+ setTaskPushNotificationConfig(params: TaskPushNotificationConfig, context?: ServerCallContext): Promise<TaskPushNotificationConfig>;
220
+ getTaskPushNotificationConfig(params: TaskIdParams | GetTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<TaskPushNotificationConfig>;
221
+ listTaskPushNotificationConfigs(params: ListTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<TaskPushNotificationConfig[]>;
222
+ deleteTaskPushNotificationConfig(params: DeleteTaskPushNotificationConfigParams, context?: ServerCallContext): Promise<void>;
223
+ resubscribe(params: TaskIdParams, context?: ServerCallContext): AsyncGenerator<Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent, void, undefined>;
160
224
  private _sendPushNotificationIfNeeded;
225
+ private _handleProcessingError;
161
226
  }
227
+ type ExtendedAgentCardProvider = (context?: ServerCallContext) => Promise<AgentCard>;
162
228
 
163
229
  declare class ResultManager {
164
- private taskStore;
230
+ private readonly taskStore;
231
+ private readonly serverCallContext?;
165
232
  private currentTask?;
166
233
  private latestUserMessage?;
167
234
  private finalMessageResult?;
168
- constructor(taskStore: TaskStore);
235
+ constructor(taskStore: TaskStore, serverCallContext?: ServerCallContext);
169
236
  setContext(latestUserMessage: Message): void;
170
237
  /**
171
238
  * Processes an agent execution event and updates the task store.
@@ -198,7 +265,7 @@ declare class JsonRpcTransportHandler {
198
265
  * For streaming methods, it returns an AsyncGenerator of JSONRPCResult.
199
266
  * For non-streaming methods, it returns a Promise of a single JSONRPCMessage (Result or ErrorResponse).
200
267
  */
201
- handle(requestBody: any): Promise<JSONRPCResponse | AsyncGenerator<JSONRPCResponse, void, undefined>>;
268
+ handle(requestBody: any, context?: ServerCallContext): Promise<JSONRPCResponse | AsyncGenerator<JSONRPCResponse, void, undefined>>;
202
269
  private isRequestValid;
203
270
  private paramsAreValid;
204
271
  }
@@ -246,4 +313,4 @@ declare class DefaultPushNotificationSender implements PushNotificationSender {
246
313
  private _dispatchNotification;
247
314
  }
248
315
 
249
- export { A2AError, A2ARequestHandler, type AgentExecutionEvent, type AgentExecutor, DefaultExecutionEventBus, DefaultExecutionEventBusManager, DefaultPushNotificationSender, type DefaultPushNotificationSenderOptions, DefaultRequestHandler, type ExecutionEventBus, type ExecutionEventBusManager, ExecutionEventQueue, InMemoryPushNotificationStore, InMemoryTaskStore, JsonRpcTransportHandler, type PushNotificationSender, type PushNotificationStore, RequestContext, ResultManager, type TaskStore };
316
+ export { A2AError, A2ARequestHandler, type AgentExecutionEvent, type AgentExecutor, DefaultExecutionEventBus, DefaultExecutionEventBusManager, DefaultPushNotificationSender, type DefaultPushNotificationSenderOptions, DefaultRequestHandler, type ExecutionEventBus, type ExecutionEventBusManager, type ExecutionEventName, ExecutionEventQueue, type ExtendedAgentCardProvider, InMemoryPushNotificationStore, InMemoryTaskStore, JsonRpcTransportHandler, type PushNotificationSender, type PushNotificationStore, RequestContext, ResultManager, ServerCallContext, type TaskStore };