@a2a-js/sdk 0.3.0 → 0.3.2
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/README.md +2 -1
- package/dist/a2a_request_handler-B5t-IxgA.d.ts +17 -0
- package/dist/a2a_request_handler-DUvKWfix.d.cts +17 -0
- package/dist/chunk-67JNQ6TZ.js +6 -0
- package/dist/chunk-JA52GYRU.js +207 -0
- package/dist/client/index.cjs +90 -40
- package/dist/client/index.d.cts +88 -8
- package/dist/client/index.d.ts +88 -8
- package/dist/client/index.js +89 -39
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -0
- package/dist/server/express/index.cjs +342 -0
- package/dist/server/express/index.d.cts +20 -0
- package/dist/server/express/index.d.ts +20 -0
- package/dist/server/express/index.js +106 -0
- package/dist/server/index.d.cts +2 -15
- package/dist/server/index.d.ts +2 -15
- package/dist/server/index.js +5 -203
- package/package.json +5 -2
package/dist/client/index.d.ts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import { ac as AgentCard, w as MessageSendParams, S as SendMessageResponse, B as Message, aw as Task, aO as TaskStatusUpdateEvent, aQ as TaskArtifactUpdateEvent, Z as TaskPushNotificationConfig, b as SetTaskPushNotificationConfigResponse, X as TaskIdParams, c as GetTaskPushNotificationConfigResponse, V as TaskQueryParams, G as GetTaskResponse, C as CancelTaskResponse, i as JSONRPCResponse, J as JSONRPCErrorResponse } from '../types-DNKcmF0f.js';
|
|
2
2
|
|
|
3
3
|
type A2AStreamEventData = Message | Task | TaskStatusUpdateEvent | TaskArtifactUpdateEvent;
|
|
4
|
+
interface A2AClientOptions {
|
|
5
|
+
agentCardPath?: string;
|
|
6
|
+
fetchImpl?: typeof fetch;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* A2AClient is a TypeScript HTTP client for interacting with A2A-compliant agents.
|
|
6
10
|
*/
|
|
7
11
|
declare class A2AClient {
|
|
8
|
-
private agentBaseUrl;
|
|
9
|
-
private agentCardPath;
|
|
10
12
|
private agentCardPromise;
|
|
11
|
-
private static readonly DEFAULT_AGENT_CARD_PATH;
|
|
12
13
|
private requestIdCounter;
|
|
13
14
|
private serviceEndpointUrl?;
|
|
15
|
+
private fetchImpl;
|
|
14
16
|
/**
|
|
15
17
|
* Constructs an A2AClient instance.
|
|
16
18
|
* It initiates fetching the agent card from the provided agent baseUrl.
|
|
17
|
-
* The Agent Card is fetched from a path relative to the agentBaseUrl, which defaults to '.well-known/agent.json'.
|
|
19
|
+
* The Agent Card is fetched from a path relative to the agentBaseUrl, which defaults to '.well-known/agent-card.json'.
|
|
18
20
|
* The `url` field from the Agent Card will be used as the RPC service endpoint.
|
|
19
21
|
* @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com)
|
|
20
|
-
* @param
|
|
22
|
+
* @param options Optional. The options for the A2AClient including the fetch implementation, agent card path, and authentication handler.
|
|
21
23
|
*/
|
|
22
|
-
constructor(agentBaseUrl: string,
|
|
24
|
+
constructor(agentBaseUrl: string, options?: A2AClientOptions);
|
|
23
25
|
/**
|
|
24
26
|
* Fetches the Agent Card from the agent's well-known URI and caches its service endpoint URL.
|
|
25
27
|
* This method is called by the constructor.
|
|
28
|
+
* @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com)
|
|
29
|
+
* @param agentCardPath path to the agent card, defaults to .well-known/agent-card.json
|
|
26
30
|
* @returns A Promise that resolves to the AgentCard.
|
|
27
31
|
*/
|
|
28
32
|
private _fetchAndCacheAgentCard;
|
|
@@ -31,11 +35,17 @@ declare class A2AClient {
|
|
|
31
35
|
* If an `agentBaseUrl` is provided, it fetches the card from that specific URL.
|
|
32
36
|
* Otherwise, it returns the card fetched and cached during client construction.
|
|
33
37
|
* @param agentBaseUrl Optional. The base URL of the agent to fetch the card from.
|
|
34
|
-
* @param agentCardPath path to the agent card, defaults to .well-known/agent.json
|
|
38
|
+
* @param agentCardPath path to the agent card, defaults to .well-known/agent-card.json
|
|
35
39
|
* If provided, this will fetch a new card, not use the cached one from the constructor's URL.
|
|
36
40
|
* @returns A Promise that resolves to the AgentCard.
|
|
37
41
|
*/
|
|
38
42
|
getAgentCard(agentBaseUrl?: string, agentCardPath?: string): Promise<AgentCard>;
|
|
43
|
+
/**
|
|
44
|
+
* Determines the agent card URL based on the agent URL.
|
|
45
|
+
* @param agentBaseUrl The agent URL.
|
|
46
|
+
* @param agentCardPath Optional relative path to the agent card, defaults to .well-known/agent-card.json
|
|
47
|
+
*/
|
|
48
|
+
private resolveAgentCardUrl;
|
|
39
49
|
/**
|
|
40
50
|
* Gets the RPC service endpoint URL. Ensures the agent card has been fetched first.
|
|
41
51
|
* @returns A Promise that resolves to the service endpoint URL string.
|
|
@@ -48,6 +58,14 @@ declare class A2AClient {
|
|
|
48
58
|
* @returns A Promise that resolves to the RPC response.
|
|
49
59
|
*/
|
|
50
60
|
private _postRpcRequest;
|
|
61
|
+
/**
|
|
62
|
+
* Internal helper method to fetch the RPC service endpoint.
|
|
63
|
+
* @param url The URL to fetch.
|
|
64
|
+
* @param rpcRequest The JSON-RPC request to send.
|
|
65
|
+
* @param acceptHeader The Accept header to use. Defaults to "application/json".
|
|
66
|
+
* @returns A Promise that resolves to the fetch HTTP response.
|
|
67
|
+
*/
|
|
68
|
+
private _fetchRpc;
|
|
51
69
|
/**
|
|
52
70
|
* Sends a message to the agent.
|
|
53
71
|
* The behavior (blocking/non-blocking) and push notification configuration
|
|
@@ -121,4 +139,66 @@ declare class A2AClient {
|
|
|
121
139
|
isErrorResponse(response: JSONRPCResponse): response is JSONRPCErrorResponse;
|
|
122
140
|
}
|
|
123
141
|
|
|
124
|
-
|
|
142
|
+
interface HttpHeaders {
|
|
143
|
+
[key: string]: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Generic interface for handling authentication for HTTP requests.
|
|
147
|
+
*
|
|
148
|
+
* - For each HTTP request, this handler is called to provide additional headers to the request through
|
|
149
|
+
* the headers() function.
|
|
150
|
+
* - After the server returns a response, the shouldRetryWithHeaders() function is called. Usually this
|
|
151
|
+
* function responds to a 401 or 403 response or JSON-RPC codes, but can respond to any other signal -
|
|
152
|
+
* that is an implementation detail of the AuthenticationHandler.
|
|
153
|
+
* - If the shouldRetryWithHeaders() function returns new headers, then the request should retried with the provided
|
|
154
|
+
* revised headers. These provisional headers may, or may not, be optimistically stored for subsequent requests -
|
|
155
|
+
* that is an implementation detail of the AuthenticationHandler.
|
|
156
|
+
* - If the request is successful and the onSuccessfulRetry() is defined, then the onSuccessfulRetry() function is
|
|
157
|
+
* called with the headers that were used to successfully complete the request. This callback provides an
|
|
158
|
+
* opportunity to save the headers for subsequent requests if they were not already saved.
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
interface AuthenticationHandler {
|
|
162
|
+
/**
|
|
163
|
+
* Provides additional HTTP request headers.
|
|
164
|
+
* @returns HTTP headers which may include Authorization if available.
|
|
165
|
+
*/
|
|
166
|
+
headers: () => Promise<HttpHeaders>;
|
|
167
|
+
/**
|
|
168
|
+
* For every HTTP response (even 200s) the shouldRetryWithHeaders() method is called.
|
|
169
|
+
* This method is supposed to check if the request needs to be retried and if, yes,
|
|
170
|
+
* return a set of headers. An A2A server might indicate auth failures in its response
|
|
171
|
+
* by JSON-rpc codes, HTTP codes like 401, 403 or headers like WWW-Authenticate.
|
|
172
|
+
*
|
|
173
|
+
* @param req The RequestInit object used to invoke fetch()
|
|
174
|
+
* @param res The fetch Response object
|
|
175
|
+
* @returns If the HTTP request should be retried then returns the HTTP headers to use,
|
|
176
|
+
* or returns undefined if no retry should be made.
|
|
177
|
+
*/
|
|
178
|
+
shouldRetryWithHeaders: (req: RequestInit, res: Response) => Promise<HttpHeaders | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* If the last HTTP request using the headers from shouldRetryWithHeaders() was successful, and
|
|
181
|
+
* this function is implemented, then it will be called with the headers provided from
|
|
182
|
+
* shouldRetryWithHeaders().
|
|
183
|
+
*
|
|
184
|
+
* This callback allows transient headers to be saved for subsequent requests only when they
|
|
185
|
+
* are validated by the server.
|
|
186
|
+
*/
|
|
187
|
+
onSuccessfulRetry?: (headers: HttpHeaders) => Promise<void>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Higher-order function that wraps fetch with authentication handling logic.
|
|
191
|
+
* Returns a new fetch function that automatically handles authentication retries for 401/403 responses.
|
|
192
|
+
*
|
|
193
|
+
* @param fetchImpl The underlying fetch implementation to wrap
|
|
194
|
+
* @param authHandler Authentication handler for managing auth headers and retries
|
|
195
|
+
* @returns A new fetch function with authentication handling capabilities
|
|
196
|
+
*
|
|
197
|
+
* Usage examples:
|
|
198
|
+
* - const authFetch = createAuthHandlingFetch(fetch, authHandler);
|
|
199
|
+
* - const response = await authFetch(url, options);
|
|
200
|
+
* - const response = await authFetch(url); // Direct function call
|
|
201
|
+
*/
|
|
202
|
+
declare function createAuthenticatingFetchWithRetry(fetchImpl: typeof fetch, authHandler: AuthenticationHandler): typeof fetch;
|
|
203
|
+
|
|
204
|
+
export { A2AClient, type A2AClientOptions, type AuthenticationHandler, type HttpHeaders, createAuthenticatingFetchWithRetry };
|
package/dist/client/index.js
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AGENT_CARD_PATH
|
|
3
|
+
} from "../chunk-67JNQ6TZ.js";
|
|
4
|
+
|
|
1
5
|
// src/client/client.ts
|
|
2
|
-
var A2AClient = class
|
|
3
|
-
agentBaseUrl;
|
|
4
|
-
agentCardPath;
|
|
6
|
+
var A2AClient = class {
|
|
5
7
|
agentCardPromise;
|
|
6
|
-
static DEFAULT_AGENT_CARD_PATH = ".well-known/agent.json";
|
|
7
8
|
requestIdCounter = 1;
|
|
8
9
|
serviceEndpointUrl;
|
|
9
10
|
// To be populated from AgentCard after fetching
|
|
11
|
+
fetchImpl;
|
|
10
12
|
/**
|
|
11
13
|
* Constructs an A2AClient instance.
|
|
12
14
|
* It initiates fetching the agent card from the provided agent baseUrl.
|
|
13
|
-
* The Agent Card is fetched from a path relative to the agentBaseUrl, which defaults to '.well-known/agent.json'.
|
|
15
|
+
* The Agent Card is fetched from a path relative to the agentBaseUrl, which defaults to '.well-known/agent-card.json'.
|
|
14
16
|
* The `url` field from the Agent Card will be used as the RPC service endpoint.
|
|
15
17
|
* @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com)
|
|
16
|
-
* @param
|
|
18
|
+
* @param options Optional. The options for the A2AClient including the fetch implementation, agent card path, and authentication handler.
|
|
17
19
|
*/
|
|
18
|
-
constructor(agentBaseUrl,
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.agentCardPromise = this._fetchAndCacheAgentCard();
|
|
20
|
+
constructor(agentBaseUrl, options) {
|
|
21
|
+
this.fetchImpl = options?.fetchImpl ?? fetch;
|
|
22
|
+
this.agentCardPromise = this._fetchAndCacheAgentCard(agentBaseUrl, options?.agentCardPath);
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Fetches the Agent Card from the agent's well-known URI and caches its service endpoint URL.
|
|
25
26
|
* This method is called by the constructor.
|
|
27
|
+
* @param agentBaseUrl The base URL of the A2A agent (e.g., https://agent.example.com)
|
|
28
|
+
* @param agentCardPath path to the agent card, defaults to .well-known/agent-card.json
|
|
26
29
|
* @returns A Promise that resolves to the AgentCard.
|
|
27
30
|
*/
|
|
28
|
-
async _fetchAndCacheAgentCard() {
|
|
29
|
-
const agentCardUrl = `${this.agentBaseUrl}/${this.agentCardPath}`;
|
|
31
|
+
async _fetchAndCacheAgentCard(agentBaseUrl, agentCardPath) {
|
|
30
32
|
try {
|
|
31
|
-
const
|
|
33
|
+
const agentCardUrl = this.resolveAgentCardUrl(agentBaseUrl, agentCardPath);
|
|
34
|
+
const response = await this.fetchImpl(agentCardUrl, {
|
|
32
35
|
headers: { "Accept": "application/json" }
|
|
33
36
|
});
|
|
34
37
|
if (!response.ok) {
|
|
@@ -41,7 +44,7 @@ var A2AClient = class _A2AClient {
|
|
|
41
44
|
this.serviceEndpointUrl = agentCard.url;
|
|
42
45
|
return agentCard;
|
|
43
46
|
} catch (error) {
|
|
44
|
-
console.error("Error fetching or parsing Agent Card:");
|
|
47
|
+
console.error("Error fetching or parsing Agent Card:", error);
|
|
45
48
|
throw error;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -50,14 +53,14 @@ var A2AClient = class _A2AClient {
|
|
|
50
53
|
* If an `agentBaseUrl` is provided, it fetches the card from that specific URL.
|
|
51
54
|
* Otherwise, it returns the card fetched and cached during client construction.
|
|
52
55
|
* @param agentBaseUrl Optional. The base URL of the agent to fetch the card from.
|
|
53
|
-
* @param agentCardPath path to the agent card, defaults to .well-known/agent.json
|
|
56
|
+
* @param agentCardPath path to the agent card, defaults to .well-known/agent-card.json
|
|
54
57
|
* If provided, this will fetch a new card, not use the cached one from the constructor's URL.
|
|
55
58
|
* @returns A Promise that resolves to the AgentCard.
|
|
56
59
|
*/
|
|
57
|
-
async getAgentCard(agentBaseUrl, agentCardPath
|
|
60
|
+
async getAgentCard(agentBaseUrl, agentCardPath) {
|
|
58
61
|
if (agentBaseUrl) {
|
|
59
|
-
const agentCardUrl =
|
|
60
|
-
const response = await
|
|
62
|
+
const agentCardUrl = this.resolveAgentCardUrl(agentBaseUrl, agentCardPath);
|
|
63
|
+
const response = await this.fetchImpl(agentCardUrl, {
|
|
61
64
|
headers: { "Accept": "application/json" }
|
|
62
65
|
});
|
|
63
66
|
if (!response.ok) {
|
|
@@ -67,6 +70,14 @@ var A2AClient = class _A2AClient {
|
|
|
67
70
|
}
|
|
68
71
|
return this.agentCardPromise;
|
|
69
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Determines the agent card URL based on the agent URL.
|
|
75
|
+
* @param agentBaseUrl The agent URL.
|
|
76
|
+
* @param agentCardPath Optional relative path to the agent card, defaults to .well-known/agent-card.json
|
|
77
|
+
*/
|
|
78
|
+
resolveAgentCardUrl(agentBaseUrl, agentCardPath = AGENT_CARD_PATH) {
|
|
79
|
+
return `${agentBaseUrl.replace(/\/$/, "")}/${agentCardPath.replace(/^\//, "")}`;
|
|
80
|
+
}
|
|
70
81
|
/**
|
|
71
82
|
* Gets the RPC service endpoint URL. Ensures the agent card has been fetched first.
|
|
72
83
|
* @returns A Promise that resolves to the service endpoint URL string.
|
|
@@ -97,21 +108,15 @@ var A2AClient = class _A2AClient {
|
|
|
97
108
|
// Cast because TParams structure varies per method
|
|
98
109
|
id: requestId
|
|
99
110
|
};
|
|
100
|
-
const httpResponse = await
|
|
101
|
-
method: "POST",
|
|
102
|
-
headers: {
|
|
103
|
-
"Content-Type": "application/json",
|
|
104
|
-
"Accept": "application/json"
|
|
105
|
-
// Expect JSON response for non-streaming requests
|
|
106
|
-
},
|
|
107
|
-
body: JSON.stringify(rpcRequest)
|
|
108
|
-
});
|
|
111
|
+
const httpResponse = await this._fetchRpc(endpoint, rpcRequest);
|
|
109
112
|
if (!httpResponse.ok) {
|
|
110
113
|
let errorBodyText = "(empty or non-JSON response)";
|
|
111
114
|
try {
|
|
112
115
|
errorBodyText = await httpResponse.text();
|
|
113
116
|
const errorJson = JSON.parse(errorBodyText);
|
|
114
|
-
if (
|
|
117
|
+
if (errorJson.jsonrpc && errorJson.error) {
|
|
118
|
+
return errorJson;
|
|
119
|
+
} else if (!errorJson.jsonrpc && errorJson.error) {
|
|
115
120
|
throw new Error(`RPC error for ${method}: ${errorJson.error.message} (Code: ${errorJson.error.code}, HTTP Status: ${httpResponse.status}) Data: ${JSON.stringify(errorJson.error.data || {})}`);
|
|
116
121
|
} else if (!errorJson.jsonrpc) {
|
|
117
122
|
throw new Error(`HTTP error for ${method}! Status: ${httpResponse.status} ${httpResponse.statusText}. Response: ${errorBodyText}`);
|
|
@@ -127,6 +132,25 @@ var A2AClient = class _A2AClient {
|
|
|
127
132
|
}
|
|
128
133
|
return rpcResponse;
|
|
129
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Internal helper method to fetch the RPC service endpoint.
|
|
137
|
+
* @param url The URL to fetch.
|
|
138
|
+
* @param rpcRequest The JSON-RPC request to send.
|
|
139
|
+
* @param acceptHeader The Accept header to use. Defaults to "application/json".
|
|
140
|
+
* @returns A Promise that resolves to the fetch HTTP response.
|
|
141
|
+
*/
|
|
142
|
+
async _fetchRpc(url, rpcRequest, acceptHeader = "application/json") {
|
|
143
|
+
const requestInit = {
|
|
144
|
+
method: "POST",
|
|
145
|
+
headers: {
|
|
146
|
+
"Content-Type": "application/json",
|
|
147
|
+
"Accept": acceptHeader
|
|
148
|
+
// Expect JSON response for non-streaming requests
|
|
149
|
+
},
|
|
150
|
+
body: JSON.stringify(rpcRequest)
|
|
151
|
+
};
|
|
152
|
+
return this.fetchImpl(url, requestInit);
|
|
153
|
+
}
|
|
130
154
|
/**
|
|
131
155
|
* Sends a message to the agent.
|
|
132
156
|
* The behavior (blocking/non-blocking) and push notification configuration
|
|
@@ -161,15 +185,7 @@ var A2AClient = class _A2AClient {
|
|
|
161
185
|
params,
|
|
162
186
|
id: clientRequestId
|
|
163
187
|
};
|
|
164
|
-
const response = await
|
|
165
|
-
method: "POST",
|
|
166
|
-
headers: {
|
|
167
|
-
"Content-Type": "application/json",
|
|
168
|
-
"Accept": "text/event-stream"
|
|
169
|
-
// Crucial for SSE
|
|
170
|
-
},
|
|
171
|
-
body: JSON.stringify(rpcRequest)
|
|
172
|
-
});
|
|
188
|
+
const response = await this._fetchRpc(endpoint, rpcRequest, "text/event-stream");
|
|
173
189
|
if (!response.ok) {
|
|
174
190
|
let errorBody = "";
|
|
175
191
|
try {
|
|
@@ -253,7 +269,7 @@ var A2AClient = class _A2AClient {
|
|
|
253
269
|
params,
|
|
254
270
|
id: clientRequestId
|
|
255
271
|
};
|
|
256
|
-
const response = await
|
|
272
|
+
const response = await this.fetchImpl(endpoint, {
|
|
257
273
|
method: "POST",
|
|
258
274
|
headers: {
|
|
259
275
|
"Content-Type": "application/json",
|
|
@@ -369,6 +385,40 @@ var A2AClient = class _A2AClient {
|
|
|
369
385
|
return "error" in response;
|
|
370
386
|
}
|
|
371
387
|
};
|
|
388
|
+
|
|
389
|
+
// src/client/auth-handler.ts
|
|
390
|
+
function createAuthenticatingFetchWithRetry(fetchImpl, authHandler) {
|
|
391
|
+
async function authFetch(url, init) {
|
|
392
|
+
const authHeaders = await authHandler.headers() || {};
|
|
393
|
+
const mergedInit = {
|
|
394
|
+
...init || {},
|
|
395
|
+
headers: {
|
|
396
|
+
...authHeaders,
|
|
397
|
+
...init?.headers || {}
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
let response = await fetchImpl(url, mergedInit);
|
|
401
|
+
const updatedHeaders = await authHandler.shouldRetryWithHeaders(mergedInit, response);
|
|
402
|
+
if (updatedHeaders) {
|
|
403
|
+
const retryInit = {
|
|
404
|
+
...init || {},
|
|
405
|
+
headers: {
|
|
406
|
+
...updatedHeaders,
|
|
407
|
+
...init?.headers || {}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
response = await fetchImpl(url, retryInit);
|
|
411
|
+
if (response.ok && authHandler.onSuccessfulRetry) {
|
|
412
|
+
await authHandler.onSuccessfulRetry(updatedHeaders);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return response;
|
|
416
|
+
}
|
|
417
|
+
Object.setPrototypeOf(authFetch, Object.getPrototypeOf(fetchImpl));
|
|
418
|
+
Object.defineProperties(authFetch, Object.getOwnPropertyDescriptors(fetchImpl));
|
|
419
|
+
return authFetch;
|
|
420
|
+
}
|
|
372
421
|
export {
|
|
373
|
-
A2AClient
|
|
422
|
+
A2AClient,
|
|
423
|
+
createAuthenticatingFetchWithRetry
|
|
374
424
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
5
9
|
var __copyProps = (to, from, except, desc) => {
|
|
6
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -14,4 +18,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
14
18
|
|
|
15
19
|
// src/index.ts
|
|
16
20
|
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
AGENT_CARD_PATH: () => AGENT_CARD_PATH
|
|
23
|
+
});
|
|
17
24
|
module.exports = __toCommonJS(index_exports);
|
|
25
|
+
|
|
26
|
+
// src/constants.ts
|
|
27
|
+
var AGENT_CARD_PATH = ".well-known/agent-card.json";
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
AGENT_CARD_PATH
|
|
31
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -6,4 +6,12 @@ export { A as A2AError, e as A2ARequest, a9 as APIKeySecurityScheme, aa as Agent
|
|
|
6
6
|
*/
|
|
7
7
|
type A2AResponse = SendMessageResponse | SendStreamingMessageResponse | GetTaskResponse | CancelTaskResponse | SetTaskPushNotificationConfigResponse | GetTaskPushNotificationConfigResponse | ListTaskPushNotificationConfigSuccessResponse | DeleteTaskPushNotificationConfigSuccessResponse | GetAuthenticatedExtendedCardSuccessResponse | JSONRPCErrorResponse;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Shared constants for the A2A library
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The well-known path for the agent card
|
|
14
|
+
*/
|
|
15
|
+
declare const AGENT_CARD_PATH = ".well-known/agent-card.json";
|
|
16
|
+
|
|
17
|
+
export { type A2AResponse, AGENT_CARD_PATH, CancelTaskResponse, DeleteTaskPushNotificationConfigSuccessResponse, GetAuthenticatedExtendedCardSuccessResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, JSONRPCErrorResponse, ListTaskPushNotificationConfigSuccessResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,12 @@ export { A as A2AError, e as A2ARequest, a9 as APIKeySecurityScheme, aa as Agent
|
|
|
6
6
|
*/
|
|
7
7
|
type A2AResponse = SendMessageResponse | SendStreamingMessageResponse | GetTaskResponse | CancelTaskResponse | SetTaskPushNotificationConfigResponse | GetTaskPushNotificationConfigResponse | ListTaskPushNotificationConfigSuccessResponse | DeleteTaskPushNotificationConfigSuccessResponse | GetAuthenticatedExtendedCardSuccessResponse | JSONRPCErrorResponse;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Shared constants for the A2A library
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The well-known path for the agent card
|
|
14
|
+
*/
|
|
15
|
+
declare const AGENT_CARD_PATH = ".well-known/agent-card.json";
|
|
16
|
+
|
|
17
|
+
export { type A2AResponse, AGENT_CARD_PATH, CancelTaskResponse, DeleteTaskPushNotificationConfigSuccessResponse, GetAuthenticatedExtendedCardSuccessResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, JSONRPCErrorResponse, ListTaskPushNotificationConfigSuccessResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse };
|