@a2a-js/sdk 0.3.7 → 0.3.8
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 +10 -0
- package/dist/chunk-DHC2REQH.js +2145 -0
- package/dist/{chunk-LTPINR5K.js → chunk-NUQQPJNY.js} +3 -60
- package/dist/chunk-UHZEIZLS.js +62 -0
- package/dist/client/index.cjs +2157 -26
- package/dist/client/index.js +99 -27
- package/dist/server/express/index.cjs +2067 -14
- package/dist/server/express/index.js +71 -17
- package/dist/server/index.js +4 -2
- package/package.json +14 -1
- package/dist/chunk-SJNAG4AL.js +0 -122
|
@@ -1,66 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
A2AError
|
|
3
|
+
} from "./chunk-UHZEIZLS.js";
|
|
1
4
|
import {
|
|
2
5
|
Extensions
|
|
3
6
|
} from "./chunk-ZX6KNMCP.js";
|
|
4
7
|
|
|
5
|
-
// src/server/error.ts
|
|
6
|
-
var A2AError = class _A2AError extends Error {
|
|
7
|
-
code;
|
|
8
|
-
data;
|
|
9
|
-
taskId;
|
|
10
|
-
// Optional task ID context
|
|
11
|
-
constructor(code, message, data, taskId) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = "A2AError";
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.data = data;
|
|
16
|
-
this.taskId = taskId;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Formats the error into a standard JSON-RPC error object structure.
|
|
20
|
-
*/
|
|
21
|
-
toJSONRPCError() {
|
|
22
|
-
const errorObject = {
|
|
23
|
-
code: this.code,
|
|
24
|
-
message: this.message
|
|
25
|
-
};
|
|
26
|
-
if (this.data !== void 0) {
|
|
27
|
-
errorObject.data = this.data;
|
|
28
|
-
}
|
|
29
|
-
return errorObject;
|
|
30
|
-
}
|
|
31
|
-
// Static factory methods for common errors
|
|
32
|
-
static parseError(message, data) {
|
|
33
|
-
return new _A2AError(-32700, message, data);
|
|
34
|
-
}
|
|
35
|
-
static invalidRequest(message, data) {
|
|
36
|
-
return new _A2AError(-32600, message, data);
|
|
37
|
-
}
|
|
38
|
-
static methodNotFound(method) {
|
|
39
|
-
return new _A2AError(-32601, `Method not found: ${method}`);
|
|
40
|
-
}
|
|
41
|
-
static invalidParams(message, data) {
|
|
42
|
-
return new _A2AError(-32602, message, data);
|
|
43
|
-
}
|
|
44
|
-
static internalError(message, data) {
|
|
45
|
-
return new _A2AError(-32603, message, data);
|
|
46
|
-
}
|
|
47
|
-
static taskNotFound(taskId) {
|
|
48
|
-
return new _A2AError(-32001, `Task not found: ${taskId}`, void 0, taskId);
|
|
49
|
-
}
|
|
50
|
-
static taskNotCancelable(taskId) {
|
|
51
|
-
return new _A2AError(-32002, `Task not cancelable: ${taskId}`, void 0, taskId);
|
|
52
|
-
}
|
|
53
|
-
static pushNotificationNotSupported() {
|
|
54
|
-
return new _A2AError(-32003, "Push Notification is not supported");
|
|
55
|
-
}
|
|
56
|
-
static unsupportedOperation(operation) {
|
|
57
|
-
return new _A2AError(-32004, `Unsupported operation: ${operation}`);
|
|
58
|
-
}
|
|
59
|
-
static authenticatedExtendedCardNotConfigured() {
|
|
60
|
-
return new _A2AError(-32007, `Extended card not configured.`);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
8
|
// src/server/context.ts
|
|
65
9
|
var ServerCallContext = class {
|
|
66
10
|
_requestedExtensions;
|
|
@@ -254,7 +198,6 @@ var UnauthenticatedUser = class {
|
|
|
254
198
|
};
|
|
255
199
|
|
|
256
200
|
export {
|
|
257
|
-
A2AError,
|
|
258
201
|
ServerCallContext,
|
|
259
202
|
JsonRpcTransportHandler,
|
|
260
203
|
UnauthenticatedUser
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/server/error.ts
|
|
2
|
+
var A2AError = class _A2AError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
data;
|
|
5
|
+
taskId;
|
|
6
|
+
// Optional task ID context
|
|
7
|
+
constructor(code, message, data, taskId) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "A2AError";
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.data = data;
|
|
12
|
+
this.taskId = taskId;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Formats the error into a standard JSON-RPC error object structure.
|
|
16
|
+
*/
|
|
17
|
+
toJSONRPCError() {
|
|
18
|
+
const errorObject = {
|
|
19
|
+
code: this.code,
|
|
20
|
+
message: this.message
|
|
21
|
+
};
|
|
22
|
+
if (this.data !== void 0) {
|
|
23
|
+
errorObject.data = this.data;
|
|
24
|
+
}
|
|
25
|
+
return errorObject;
|
|
26
|
+
}
|
|
27
|
+
// Static factory methods for common errors
|
|
28
|
+
static parseError(message, data) {
|
|
29
|
+
return new _A2AError(-32700, message, data);
|
|
30
|
+
}
|
|
31
|
+
static invalidRequest(message, data) {
|
|
32
|
+
return new _A2AError(-32600, message, data);
|
|
33
|
+
}
|
|
34
|
+
static methodNotFound(method) {
|
|
35
|
+
return new _A2AError(-32601, `Method not found: ${method}`);
|
|
36
|
+
}
|
|
37
|
+
static invalidParams(message, data) {
|
|
38
|
+
return new _A2AError(-32602, message, data);
|
|
39
|
+
}
|
|
40
|
+
static internalError(message, data) {
|
|
41
|
+
return new _A2AError(-32603, message, data);
|
|
42
|
+
}
|
|
43
|
+
static taskNotFound(taskId) {
|
|
44
|
+
return new _A2AError(-32001, `Task not found: ${taskId}`, void 0, taskId);
|
|
45
|
+
}
|
|
46
|
+
static taskNotCancelable(taskId) {
|
|
47
|
+
return new _A2AError(-32002, `Task not cancelable: ${taskId}`, void 0, taskId);
|
|
48
|
+
}
|
|
49
|
+
static pushNotificationNotSupported() {
|
|
50
|
+
return new _A2AError(-32003, "Push Notification is not supported");
|
|
51
|
+
}
|
|
52
|
+
static unsupportedOperation(operation) {
|
|
53
|
+
return new _A2AError(-32004, `Unsupported operation: ${operation}`);
|
|
54
|
+
}
|
|
55
|
+
static authenticatedExtendedCardNotConfigured() {
|
|
56
|
+
return new _A2AError(-32007, `Extended card not configured.`);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
A2AError
|
|
62
|
+
};
|