apcore-a2a 0.4.4 → 0.6.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/README.md +1 -1
- package/dist/adapters/agent-card.d.ts.map +1 -1
- package/dist/adapters/agent-card.js +15 -0
- package/dist/adapters/agent-card.js.map +1 -1
- package/dist/adapters/card-visibility.d.ts +148 -0
- package/dist/adapters/card-visibility.d.ts.map +1 -0
- package/dist/adapters/card-visibility.js +237 -0
- package/dist/adapters/card-visibility.js.map +1 -0
- package/dist/adapters/errors.d.ts +82 -0
- package/dist/adapters/errors.d.ts.map +1 -1
- package/dist/adapters/errors.js +165 -8
- package/dist/adapters/errors.js.map +1 -1
- package/dist/adapters/skill-mapper.d.ts +27 -0
- package/dist/adapters/skill-mapper.d.ts.map +1 -1
- package/dist/adapters/skill-mapper.js +61 -0
- package/dist/adapters/skill-mapper.js.map +1 -1
- package/dist/client/client.d.ts +15 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +137 -14
- package/dist/client/client.js.map +1 -1
- package/dist/client/exceptions.d.ts +31 -0
- package/dist/client/exceptions.d.ts.map +1 -1
- package/dist/client/exceptions.js +40 -0
- package/dist/client/exceptions.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/serve.d.ts +12 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +1 -0
- package/dist/serve.js.map +1 -1
- package/dist/server/context.d.ts +68 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +80 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/executor.d.ts +8 -0
- package/dist/server/executor.d.ts.map +1 -1
- package/dist/server/executor.js +78 -1
- package/dist/server/executor.js.map +1 -1
- package/dist/server/factory.d.ts +24 -0
- package/dist/server/factory.d.ts.map +1 -1
- package/dist/server/factory.js +138 -19
- package/dist/server/factory.js.map +1 -1
- package/package.json +9 -5
package/dist/adapters/errors.js
CHANGED
|
@@ -2,8 +2,57 @@ import { ErrorCodes } from "apcore-js";
|
|
|
2
2
|
const CODE_METHOD_NOT_FOUND = -32601;
|
|
3
3
|
const CODE_INVALID_PARAMS = -32602;
|
|
4
4
|
const CODE_INTERNAL_ERROR = -32603;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A2A 1.0 `TaskNotFoundError`. Reserved for an unknown task id or one owned by
|
|
7
|
+
* another principal — deliberately indistinguishable from each other, and no
|
|
8
|
+
* longer produced for an authorization refusal (see {@link CODE_ACCESS_DENIED}).
|
|
9
|
+
*/
|
|
10
|
+
export const CODE_TASK_NOT_FOUND = -32001;
|
|
11
|
+
// Governance refusal codes (srs FR-ERR-003 / FR-ERR-009 / FR-ERR-010).
|
|
12
|
+
//
|
|
13
|
+
// A2A 1.0 reserves -32001..-32009; JSON-RPC 2.0 leaves -32000..-32099 to the
|
|
14
|
+
// implementation. These three sit above A2A's reserved block, with room for it
|
|
15
|
+
// to grow, and are the "JSON-RPC custom error" A2A §13.2 names as the example
|
|
16
|
+
// for this binding.
|
|
17
|
+
//
|
|
18
|
+
// apcore distinguishes these three refusals from each other and from every
|
|
19
|
+
// other failure. Collapsing them onto -32001 (which means "unknown or non-owned
|
|
20
|
+
// task id") or -32603 (which every agent reads as "retry me") told the caller a
|
|
21
|
+
// *different* failure had happened, one whose correct response is the opposite
|
|
22
|
+
// of the real one.
|
|
23
|
+
export const CODE_ACCESS_DENIED = -32040;
|
|
24
|
+
export const CODE_APPROVAL_DENIED = -32041;
|
|
25
|
+
export const CODE_APPROVAL_TIMEOUT = -32042;
|
|
26
|
+
/**
|
|
27
|
+
* The three governance refusal codes, each with its JSON-RPC code and the fixed
|
|
28
|
+
* message it reports by default.
|
|
29
|
+
*
|
|
30
|
+
* `APPROVAL_PENDING` is deliberately absent: it is a resumable pause carrying
|
|
31
|
+
* the `approvalId` the caller resumes with, handled by the executor before it
|
|
32
|
+
* ever reaches the mapper (srs FR-EXE-002). Sweeping it in here would turn that
|
|
33
|
+
* pause into a terminal failure.
|
|
34
|
+
*/
|
|
35
|
+
const GOVERNANCE_REFUSALS = new Map([
|
|
36
|
+
[ErrorCodes.ACL_DENIED, { code: CODE_ACCESS_DENIED, message: "Access denied" }],
|
|
37
|
+
[ErrorCodes.APPROVAL_DENIED, { code: CODE_APPROVAL_DENIED, message: "Approval denied" }],
|
|
38
|
+
[ErrorCodes.APPROVAL_TIMEOUT, { code: CODE_APPROVAL_TIMEOUT, message: "Approval timed out" }],
|
|
39
|
+
]);
|
|
40
|
+
/** Whether an apcore error code is one of the three governance refusals. */
|
|
41
|
+
export function isGovernanceRefusal(code) {
|
|
42
|
+
return code !== undefined && GOVERNANCE_REFUSALS.has(code);
|
|
43
|
+
}
|
|
6
44
|
export class ErrorMapper {
|
|
45
|
+
discloseRefusalReason;
|
|
46
|
+
/**
|
|
47
|
+
* @param discloseRefusalReason Forward apcore's own message for the three
|
|
48
|
+
* governance refusal codes instead of the fixed per-class string
|
|
49
|
+
* (srs FR-ERR-011). Off by default. The code never changes with the flag —
|
|
50
|
+
* what a refusal *is* does not depend on how much a deployment chooses to
|
|
51
|
+
* say about it.
|
|
52
|
+
*/
|
|
53
|
+
constructor(discloseRefusalReason = false) {
|
|
54
|
+
this.discloseRefusalReason = discloseRefusalReason;
|
|
55
|
+
}
|
|
7
56
|
/** ErrorFormatter interface for apcore ErrorFormatterRegistry. */
|
|
8
57
|
format(error, _context) {
|
|
9
58
|
const rpcError = this.toJsonRpcError(error);
|
|
@@ -25,12 +74,32 @@ export class ErrorMapper {
|
|
|
25
74
|
}
|
|
26
75
|
return { code: CODE_INTERNAL_ERROR, message: "Internal server error" };
|
|
27
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Caller-facing message for a governance refusal.
|
|
79
|
+
*
|
|
80
|
+
* Default: the fixed per-class string. With `discloseRefusalReason`
|
|
81
|
+
* (srs FR-ERR-011): apcore's own message, through the same sanitizer every
|
|
82
|
+
* other forwarded message goes through. An empty or whitespace-only apcore
|
|
83
|
+
* message falls back to the fixed string rather than sending the caller
|
|
84
|
+
* nothing.
|
|
85
|
+
*/
|
|
86
|
+
refusalMessage(fixed, error) {
|
|
87
|
+
if (!this.discloseRefusalReason)
|
|
88
|
+
return fixed;
|
|
89
|
+
const disclosed = this.sanitizeMessage(String(error.message ?? ""));
|
|
90
|
+
return disclosed.trim() ? disclosed : fixed;
|
|
91
|
+
}
|
|
28
92
|
handleApcoreError(error, errorCode) {
|
|
29
93
|
if (errorCode === ErrorCodes.MODULE_NOT_FOUND) {
|
|
30
94
|
const message = this.sanitizeMessage(error.message);
|
|
31
95
|
return { code: CODE_METHOD_NOT_FOUND, message };
|
|
32
96
|
}
|
|
33
97
|
if (errorCode === ErrorCodes.SCHEMA_VALIDATION_ERROR) {
|
|
98
|
+
// apcore raises the one code for output validation too, which the caller
|
|
99
|
+
// can do nothing about -- see isServerSideSchemaError.
|
|
100
|
+
if (isServerSideSchemaError(error.message)) {
|
|
101
|
+
return { code: CODE_INTERNAL_ERROR, message: "Internal server error" };
|
|
102
|
+
}
|
|
34
103
|
const message = this.sanitizeMessage(error.message);
|
|
35
104
|
return { code: CODE_INVALID_PARAMS, message };
|
|
36
105
|
}
|
|
@@ -38,8 +107,15 @@ export class ErrorMapper {
|
|
|
38
107
|
const description = this.sanitizeMessage(error.message);
|
|
39
108
|
return { code: CODE_INVALID_PARAMS, message: `Invalid input: ${description}` };
|
|
40
109
|
}
|
|
41
|
-
|
|
42
|
-
|
|
110
|
+
// The A2A spec §13.2 MUST NOT forbids revealing *the existence of a
|
|
111
|
+
// resource*, not the *class* of failure. A fixed "Access denied" /
|
|
112
|
+
// "Approval denied" / "Approval timed out" names no caller, target,
|
|
113
|
+
// approver or rule, so it discloses nothing — a caller that named a skill
|
|
114
|
+
// already held that id — while still telling an agent to stop rather than
|
|
115
|
+
// retry.
|
|
116
|
+
const refusal = GOVERNANCE_REFUSALS.get(errorCode);
|
|
117
|
+
if (refusal !== undefined) {
|
|
118
|
+
return { code: refusal.code, message: this.refusalMessage(refusal.message, error) };
|
|
43
119
|
}
|
|
44
120
|
if (errorCode === ErrorCodes.MODULE_TIMEOUT) {
|
|
45
121
|
return { code: CODE_INTERNAL_ERROR, message: "Execution timeout" };
|
|
@@ -66,11 +142,92 @@ export class ErrorMapper {
|
|
|
66
142
|
return { code: CODE_INTERNAL_ERROR, message: "Internal server error" };
|
|
67
143
|
}
|
|
68
144
|
sanitizeMessage(message) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
145
|
+
return sanitizeMessage(message);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Direction labels apcore puts at the front of a SCHEMA_VALIDATION_ERROR
|
|
150
|
+
* message. apcore-js raises the code for input and output validation
|
|
151
|
+
* (`builtin-steps.js`: ``validateSchema(schema, data, 'Input' | 'Output')``,
|
|
152
|
+
* whose message is `` `${direction} validation failed` ``). Config validation is
|
|
153
|
+
* not in this set: apcore-js raises `ConfigError` / `CONFIG_INVALID` for it,
|
|
154
|
+
* which `handleApcoreError` already sends to the fixed internal string through
|
|
155
|
+
* its catch-all.
|
|
156
|
+
*/
|
|
157
|
+
const SERVER_SIDE_SCHEMA_PREFIXES = ["Output validation failed"];
|
|
158
|
+
/**
|
|
159
|
+
* Whether a `SCHEMA_VALIDATION_ERROR` is about something the *server* produced
|
|
160
|
+
* rather than something the caller sent.
|
|
161
|
+
*
|
|
162
|
+
* Reporting an output-validation failure as `-32602 Invalid params` tells the
|
|
163
|
+
* caller to fix a request that was correct, and the default `aiGuidance` apcore
|
|
164
|
+
* attaches to `SchemaValidationError` says "Input validation failed" and points
|
|
165
|
+
* at a `details.errors` field an A2A caller never receives. Those are
|
|
166
|
+
* server-side defects and belong behind the fixed internal string.
|
|
167
|
+
*
|
|
168
|
+
* The direction label apcore puts at the front of the message is the only signal
|
|
169
|
+
* that exists, so this matches that prefix. Anything unrecognized keeps the
|
|
170
|
+
* caller-facing detail -- including a module that raises the code itself with
|
|
171
|
+
* its own wording, whose message srs FR-ERR-002 requires the caller to see.
|
|
172
|
+
* Failing to recognize a server-side error therefore preserves the previous
|
|
173
|
+
* behaviour; it never masks a caller-fixable one by mistake.
|
|
174
|
+
*/
|
|
175
|
+
export function isServerSideSchemaError(message) {
|
|
176
|
+
return SERVER_SIDE_SCHEMA_PREFIXES.some((prefix) => message.startsWith(prefix));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Whether {@link ErrorMapper.toJsonRpcError} forwards this error's own message
|
|
180
|
+
* to the caller (sanitized), or replaces it with a fixed per-class string.
|
|
181
|
+
*
|
|
182
|
+
* This is the partition that decides whether a message may be *widened* -- with
|
|
183
|
+
* `aiGuidance`, or anything else. It is deliberately not `userFixable`, which is
|
|
184
|
+
* a different partition: six apcore codes carry `userFixable === true` while
|
|
185
|
+
* falling into `handleApcoreError`'s catch-all (`VERSION_CONSTRAINT_INVALID`,
|
|
186
|
+
* `BINDING_SCHEMA_INFERENCE_FAILED`, `BINDING_SCHEMA_MODE_CONFLICT`,
|
|
187
|
+
* `BINDING_STRICT_SCHEMA_INCOMPATIBLE`, `DEPENDENCY_NOT_FOUND`,
|
|
188
|
+
* `DEPENDENCY_VERSION_MISMATCH`), and appending guidance to those would extend
|
|
189
|
+
* the fixed "Internal server error" string with internal detail that
|
|
190
|
+
* {@link sanitizeMessage} does not strip (module ids, versions, env-var names,
|
|
191
|
+
* hostnames). `userFixable` is also settable per-error by the module author,
|
|
192
|
+
* which would let any module widen any fixed per-class string at will,
|
|
193
|
+
* including the governance refusals.
|
|
194
|
+
*
|
|
195
|
+
* The three governance codes (`ACL_DENIED`, `APPROVAL_DENIED`,
|
|
196
|
+
* `APPROVAL_TIMEOUT`) are in this partition only when `discloseRefusalReason` is
|
|
197
|
+
* set — the same flag the mapper branches on, so the two surfaces agree under
|
|
198
|
+
* either setting.
|
|
199
|
+
*
|
|
200
|
+
* `errorMapper message policy matches toJsonRpcError` locks this to the
|
|
201
|
+
* branching in `ErrorMapper.handleApcoreError` across every apcore error code
|
|
202
|
+
* and both flag values, so the two cannot drift.
|
|
203
|
+
*/
|
|
204
|
+
export function carriesCallerDetail(error, discloseRefusalReason = false) {
|
|
205
|
+
const code = error?.code;
|
|
206
|
+
if (code === ErrorCodes.MODULE_NOT_FOUND || code === ErrorCodes.GENERAL_INVALID_INPUT) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
if (code === ErrorCodes.SCHEMA_VALIDATION_ERROR) {
|
|
210
|
+
return !isServerSideSchemaError(String(error.message ?? ""));
|
|
74
211
|
}
|
|
212
|
+
// The three governance codes move into and out of this partition with the
|
|
213
|
+
// flag, so the task-status surface forwards exactly what the JSON-RPC surface
|
|
214
|
+
// does under either setting (srs FR-ERR-011 criterion 4).
|
|
215
|
+
if (isGovernanceRefusal(code)) {
|
|
216
|
+
return discloseRefusalReason;
|
|
217
|
+
}
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Strip file paths, traceback lines and excess whitespace from text bound for a
|
|
222
|
+
* caller, then truncate to 500 characters. Module-level so the task-status
|
|
223
|
+
* surface (`server/executor.ts`) applies exactly the same redaction as the
|
|
224
|
+
* JSON-RPC surface.
|
|
225
|
+
*/
|
|
226
|
+
export function sanitizeMessage(message) {
|
|
227
|
+
// Strip file paths (Unix absolute paths and ~ paths)
|
|
228
|
+
let sanitized = message.replace(/~?\/\S*/g, "");
|
|
229
|
+
// Strip traceback lines (matching Python's behavior)
|
|
230
|
+
sanitized = sanitized.replace(/^.*(?:Traceback|File "|line \d+).*$/gm, "");
|
|
231
|
+
return sanitized.replace(/\s+/g, " ").trim().slice(0, 500);
|
|
75
232
|
}
|
|
76
233
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,qBAAqB,GAAG,CAAC,KAAK,CAAC;AACrC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/adapters/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,qBAAqB,GAAG,CAAC,KAAK,CAAC;AACrC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AACnC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AACnC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC;AAE1C,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,oBAAoB;AACpB,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,mBAAmB;AACnB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAK,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAA2D,IAAI,GAAG,CAAC;IAC1F,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;IAC/E,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,IAAI,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,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,qDAAqD;IACrD,IAAI,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChD,qDAAqD;IACrD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,uCAAuC,EAAE,EAAE,CAAC,CAAC;IAC3E,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -15,6 +15,33 @@ export interface ModuleDescriptor {
|
|
|
15
15
|
annotations?: Record<string, unknown>;
|
|
16
16
|
metadata?: Record<string, unknown>;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Append apcore's behavioral annotations to a skill's tags (srs FR-SKL-004).
|
|
20
|
+
*
|
|
21
|
+
* A2A 1.0 `AgentSkill` is `{id, name, description, tags, examples, inputModes,
|
|
22
|
+
* outputModes, securityRequirements}` — no `extensions`, no `metadata` — so
|
|
23
|
+
* `tags` is the only carrier that exists. The `apcore:` prefix keeps these out
|
|
24
|
+
* of the module's own flat tag namespace, where a user tag named `destructive`
|
|
25
|
+
* would otherwise be indistinguishable from the annotation.
|
|
26
|
+
*
|
|
27
|
+
* Without this the Agent Card carried enough for a caller to *construct* a call
|
|
28
|
+
* and not enough to judge whether making it is safe. It is also what makes retry
|
|
29
|
+
* semantics usable: `retryable` is a property of the error, but whether a retry
|
|
30
|
+
* is safe is a property of the operation, and a timeout is retryable for a read
|
|
31
|
+
* and dangerous for a non-idempotent mutation.
|
|
32
|
+
*
|
|
33
|
+
* Only truthy flags are emitted, matching how the apcore MCP binding maps the
|
|
34
|
+
* same annotations onto optional `readOnlyHint` / `destructiveHint` /
|
|
35
|
+
* `idempotentHint`. Absence means "not asserted", never "asserted false".
|
|
36
|
+
*/
|
|
37
|
+
export declare function appendAnnotationTags(tags: string[], descriptor: ModuleDescriptor): void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a module is gated behind human approval.
|
|
40
|
+
*
|
|
41
|
+
* Used by the Agent Card builder to withhold the skill from the public card
|
|
42
|
+
* (srs FR-AGC-003) and restore it on the extended one (srs FR-AGC-004).
|
|
43
|
+
*/
|
|
44
|
+
export declare function requiresApproval(descriptor: ModuleDescriptor | null | undefined): boolean;
|
|
18
45
|
export declare class SkillMapper {
|
|
19
46
|
private schemaConverter;
|
|
20
47
|
constructor(schemaConverter?: SchemaConverter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-mapper.d.ts","sourceRoot":"","sources":["../../src/adapters/skill-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ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ED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIzF;AAED,qBAAa,WAAW;IAGV,OAAO,CAAC,eAAe;gBAAf,eAAe,GAAE,eAAuC;IAE5E,OAAO,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IA4C3E,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAO1C,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;IAM1B,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,EAAE;CAQtD"}
|
|
@@ -1,4 +1,64 @@
|
|
|
1
1
|
import { SchemaConverter } from "./schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* The four behavioral annotations promoted onto the A2A wire, with the tag each
|
|
4
|
+
* becomes. Order is fixed so the card is byte-identical across the three
|
|
5
|
+
* bindings (srs FR-SKL-004 criterion 8).
|
|
6
|
+
*/
|
|
7
|
+
const ANNOTATION_TAGS = [
|
|
8
|
+
["readonly", "apcore:readonly"],
|
|
9
|
+
["destructive", "apcore:destructive"],
|
|
10
|
+
["idempotent", "apcore:idempotent"],
|
|
11
|
+
["requires_approval", "apcore:requires-approval"],
|
|
12
|
+
];
|
|
13
|
+
/** camelCase aliases, since a descriptor may arrive from either convention. */
|
|
14
|
+
const ANNOTATION_ALIASES = {
|
|
15
|
+
requires_approval: "requiresApproval",
|
|
16
|
+
};
|
|
17
|
+
function annotationFlag(annotations, field) {
|
|
18
|
+
const alias = ANNOTATION_ALIASES[field];
|
|
19
|
+
return Boolean(annotations[field] ?? (alias !== undefined ? annotations[alias] : undefined));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Append apcore's behavioral annotations to a skill's tags (srs FR-SKL-004).
|
|
23
|
+
*
|
|
24
|
+
* A2A 1.0 `AgentSkill` is `{id, name, description, tags, examples, inputModes,
|
|
25
|
+
* outputModes, securityRequirements}` — no `extensions`, no `metadata` — so
|
|
26
|
+
* `tags` is the only carrier that exists. The `apcore:` prefix keeps these out
|
|
27
|
+
* of the module's own flat tag namespace, where a user tag named `destructive`
|
|
28
|
+
* would otherwise be indistinguishable from the annotation.
|
|
29
|
+
*
|
|
30
|
+
* Without this the Agent Card carried enough for a caller to *construct* a call
|
|
31
|
+
* and not enough to judge whether making it is safe. It is also what makes retry
|
|
32
|
+
* semantics usable: `retryable` is a property of the error, but whether a retry
|
|
33
|
+
* is safe is a property of the operation, and a timeout is retryable for a read
|
|
34
|
+
* and dangerous for a non-idempotent mutation.
|
|
35
|
+
*
|
|
36
|
+
* Only truthy flags are emitted, matching how the apcore MCP binding maps the
|
|
37
|
+
* same annotations onto optional `readOnlyHint` / `destructiveHint` /
|
|
38
|
+
* `idempotentHint`. Absence means "not asserted", never "asserted false".
|
|
39
|
+
*/
|
|
40
|
+
export function appendAnnotationTags(tags, descriptor) {
|
|
41
|
+
const annotations = descriptor.annotations;
|
|
42
|
+
if (!annotations)
|
|
43
|
+
return;
|
|
44
|
+
for (const [field, tag] of ANNOTATION_TAGS) {
|
|
45
|
+
if (annotationFlag(annotations, field) && !tags.includes(tag)) {
|
|
46
|
+
tags.push(tag);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether a module is gated behind human approval.
|
|
52
|
+
*
|
|
53
|
+
* Used by the Agent Card builder to withhold the skill from the public card
|
|
54
|
+
* (srs FR-AGC-003) and restore it on the extended one (srs FR-AGC-004).
|
|
55
|
+
*/
|
|
56
|
+
export function requiresApproval(descriptor) {
|
|
57
|
+
const annotations = descriptor?.annotations;
|
|
58
|
+
if (!annotations)
|
|
59
|
+
return false;
|
|
60
|
+
return annotationFlag(annotations, "requires_approval");
|
|
61
|
+
}
|
|
2
62
|
export class SkillMapper {
|
|
3
63
|
schemaConverter;
|
|
4
64
|
// Share root-type detection with SchemaConverter so the "string root" rule
|
|
@@ -29,6 +89,7 @@ export class SkillMapper {
|
|
|
29
89
|
const resolvedTags = display.tags?.length
|
|
30
90
|
? [...display.tags]
|
|
31
91
|
: [...(descriptor.tags ?? [])];
|
|
92
|
+
appendAnnotationTags(resolvedTags, descriptor);
|
|
32
93
|
return {
|
|
33
94
|
id,
|
|
34
95
|
name: skillName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-mapper.js","sourceRoot":"","sources":["../../src/adapters/skill-mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAmB,MAAM,aAAa,CAAC;AAgB/D,MAAM,OAAO,WAAW;IAGF;IAFpB,2EAA2E;IAC3E,8BAA8B;IAC9B,YAAoB,kBAAmC,IAAI,eAAe,EAAE;QAAxD,oBAAe,GAAf,eAAe,CAAyC;IAAG,CAAC;IAEhF,OAAO,CAAC,UAA4B,EAAE,QAAiB;QACrD,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC;QAE9B,MAAM,EAAE,GAAG,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,QAAQ,IAAI,QAAQ,CAAC;QACnE,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAErB,yCAAyC;QACzC,MAAM,OAAO,GAAI,UAAU,CAAC,QAAQ,EAAE,OAAmC,IAAI,EAAE,CAAC;QAChF,MAAM,UAAU,GAAI,OAAO,CAAC,GAA+B,IAAI,EAAE,CAAC;QAElE,MAAM,SAAS,GACZ,UAAU,CAAC,KAAgB;YAC3B,OAAO,CAAC,KAAgB;YACzB,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAE5B,IAAI,gBAAgB,GACjB,UAAU,CAAC,WAAsB;YACjC,OAAO,CAAC,WAAsB;YAC/B,WAAW,CAAC;QAEd,MAAM,QAAQ,GAAI,UAAU,CAAC,QAAmB,IAAK,O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AC;YAC3E,OAAO,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC;IAEO,kBAAkB,CAAC,UAA4B;QACrD,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,IAAI,UAAU,CAAC,YAAY,CAAC;QACnE,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QACnC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC9B,CAAC;IAED,aAAa,CAAC,UAA4B;QACxC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,MAAM,EAAE,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YACvC,IAAI,EAAE,CAAC,KAAK;gBAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/dist/client/client.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export declare class A2AClient {
|
|
|
18
18
|
}): Promise<Record<string, unknown>>;
|
|
19
19
|
getTask(taskId: string): Promise<Record<string, unknown>>;
|
|
20
20
|
cancelTask(taskId: string): Promise<Record<string, unknown>>;
|
|
21
|
+
/**
|
|
22
|
+
* List tasks via `ListTasks`.
|
|
23
|
+
*
|
|
24
|
+
* A2A 1.0 names this method `ListTasks`; 0.3 had no task-listing method at
|
|
25
|
+
* all. The `tasks/list` spelling used here until 0.5.0 was neither, so it
|
|
26
|
+
* reached only this project's own Rust server.
|
|
27
|
+
*/
|
|
21
28
|
listTasks(opts?: {
|
|
22
29
|
contextId?: string;
|
|
23
30
|
limit?: number;
|
|
@@ -27,6 +34,14 @@ export declare class A2AClient {
|
|
|
27
34
|
contextId?: string;
|
|
28
35
|
}): AsyncGenerator<Record<string, unknown>>;
|
|
29
36
|
close(): void;
|
|
37
|
+
/**
|
|
38
|
+
* POST a JSON-RPC request, optionally declaring the A2A protocol version.
|
|
39
|
+
*
|
|
40
|
+
* Both upstream SDKs treat a request with no `A2A-Version` header as v0.3
|
|
41
|
+
* (spec section 3.6.2) and refuse 1.0 method names in that mode with
|
|
42
|
+
* `-32009`, so methods that exist only in 1.0 must declare `"1.0"`. Methods
|
|
43
|
+
* 0.3 also has stay unversioned, so a 0.3 server keeps working.
|
|
44
|
+
*/
|
|
30
45
|
private jsonrpcCall;
|
|
31
46
|
}
|
|
32
47
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AA4HA,qBAAa,SAAS;IACpB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAmB;gBAE1B,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAYrF,OAAO,CAAC,WAAW;IAWb,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIlD,0FAA0F;IAC1F,IAAI,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEhD;IAEK,WAAW,CACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAChE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAM7B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIzD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIlE;;;;;;OAMG;IACG,SAAS,CAAC,IAAI,CAAC,EAAE;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAU7B,aAAa,CAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAChE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAiE1C,KAAK,IAAI,IAAI;IAIb;;;;;;;OAOG;YACW,WAAW;CAqC1B"}
|
package/dist/client/client.js
CHANGED
|
@@ -1,18 +1,112 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from "uuid";
|
|
2
2
|
import { AgentCardFetcher } from "./card-fetcher.js";
|
|
3
|
-
import { A2AConnectionError, A2AServerError, TaskNotCancelableError, TaskNotFoundError, } from "./exceptions.js";
|
|
3
|
+
import { A2AConnectionError, A2AServerError, AccessDeniedError, ApprovalDeniedError, ApprovalTimeoutError, TaskNotCancelableError, TaskNotFoundError, } from "./exceptions.js";
|
|
4
|
+
/** Terminal A2A 1.0 task states; streaming stops when one is observed. */
|
|
5
|
+
const TERMINAL_STATES = new Set([
|
|
6
|
+
"TASK_STATE_COMPLETED",
|
|
7
|
+
"TASK_STATE_FAILED",
|
|
8
|
+
"TASK_STATE_CANCELED",
|
|
9
|
+
"TASK_STATE_REJECTED",
|
|
10
|
+
]);
|
|
11
|
+
/**
|
|
12
|
+
* Return the event carried by a JSON-RPC SSE frame.
|
|
13
|
+
*
|
|
14
|
+
* Every `data:` line is a full JSON-RPC response whose `result` is the event.
|
|
15
|
+
* Frames that are not enveloped pass through unchanged.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Throw if `frame` is a JSON-RPC error frame rather than an event.
|
|
19
|
+
*
|
|
20
|
+
* A mid-stream failure arrives as its own frame — upstream tags it
|
|
21
|
+
* `event: error` and puts a JSON-RPC error response in `data:`. Envelope
|
|
22
|
+
* unwrapping only looks for `result`, so without this the frame was yielded as
|
|
23
|
+
* though it were an event and the failure was lost, while the non-streaming
|
|
24
|
+
* path threw for a byte-identical payload. Routes through the same
|
|
25
|
+
* `raiseJsonRpcError`, so a caller gets `TaskNotFoundError` /
|
|
26
|
+
* `TaskNotCancelableError` on both paths.
|
|
27
|
+
*/
|
|
28
|
+
function raiseIfStreamError(frame) {
|
|
29
|
+
if ("jsonrpc" in frame && "error" in frame) {
|
|
30
|
+
raiseJsonRpcError(frame.error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function unwrapStreamEnvelope(frame) {
|
|
34
|
+
if ("jsonrpc" in frame && "result" in frame) {
|
|
35
|
+
const result = frame.result;
|
|
36
|
+
if (result && typeof result === "object")
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
return frame;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether `event` is a terminal `statusUpdate`.
|
|
43
|
+
*
|
|
44
|
+
* A2A 1.0 removed the `final` flag 0.3 used to mark the last event, so the
|
|
45
|
+
* terminal state itself is the signal.
|
|
46
|
+
*/
|
|
47
|
+
function isTerminalEvent(event) {
|
|
48
|
+
const statusUpdate = event.statusUpdate;
|
|
49
|
+
const state = statusUpdate?.status?.state;
|
|
50
|
+
return state !== undefined && TERMINAL_STATES.has(state);
|
|
51
|
+
}
|
|
4
52
|
const JSONRPC_ERRORS = {
|
|
5
53
|
[-32001]: TaskNotFoundError,
|
|
6
54
|
[-32002]: TaskNotCancelableError,
|
|
7
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Governance refusal codes (srs FR-ERR-003 / FR-ERR-009 / FR-ERR-010).
|
|
58
|
+
*
|
|
59
|
+
* Kept separate from {@link JSONRPC_ERRORS} because these classes take the
|
|
60
|
+
* server's message: with `discloseRefusalReason` enabled it carries the actual
|
|
61
|
+
* reason, which is the whole value of the opt-in.
|
|
62
|
+
*/
|
|
63
|
+
const GOVERNANCE_ERRORS = {
|
|
64
|
+
[-32040]: AccessDeniedError,
|
|
65
|
+
[-32041]: ApprovalDeniedError,
|
|
66
|
+
[-32042]: ApprovalTimeoutError,
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Message patterns that recover a typed error from a miscoded `-32603`.
|
|
70
|
+
*
|
|
71
|
+
* `@a2a-js/sdk` 1.0.1 bundles `toJsonRpcError` and the `A2AError` class
|
|
72
|
+
* separately into `dist/server/index.js` and `dist/server/express/index.js`, so
|
|
73
|
+
* an error thrown by `DefaultRequestHandler` fails both `instanceof` guards in
|
|
74
|
+
* the express copy and arrives as `-32603` — with its message intact. Every
|
|
75
|
+
* semantic A2A error on that path is affected (`-32001` through `-32006`);
|
|
76
|
+
* these two are the ones this client maps to a type, so without this a caller's
|
|
77
|
+
* `catch (e) { if (e instanceof TaskNotFoundError) ... }` silently stopped
|
|
78
|
+
* matching. The message is all that is left to recover the type from.
|
|
79
|
+
*
|
|
80
|
+
* Deliberately *not* mirrored on the server side: rewriting the wire code would
|
|
81
|
+
* mean intercepting responses and prefix-matching six message shapes, and would
|
|
82
|
+
* hide the upstream bug rather than work around it. A third-party client still
|
|
83
|
+
* sees `-32603`; only this one recovers.
|
|
84
|
+
*/
|
|
85
|
+
const SDK_BUNDLING_FALLBACK = [
|
|
86
|
+
[/^Task not found(:|$)/, TaskNotFoundError],
|
|
87
|
+
[/^(Task not cancelable:|Task cannot be canceled$)/, TaskNotCancelableError],
|
|
88
|
+
];
|
|
8
89
|
function raiseJsonRpcError(error) {
|
|
9
90
|
const code = error.code ?? -32603;
|
|
10
91
|
const message = error.message ?? "Server error";
|
|
92
|
+
const Governance = GOVERNANCE_ERRORS[code];
|
|
93
|
+
if (Governance !== undefined)
|
|
94
|
+
throw new Governance(message);
|
|
11
95
|
const ErrorClass = JSONRPC_ERRORS[code];
|
|
12
96
|
if (ErrorClass === TaskNotFoundError)
|
|
13
97
|
throw new TaskNotFoundError();
|
|
14
98
|
if (ErrorClass === TaskNotCancelableError)
|
|
15
99
|
throw new TaskNotCancelableError();
|
|
100
|
+
// Gated on -32603 so a server reporting the spec codes correctly — including
|
|
101
|
+
// this package's own ErrorMapper, and any SDK build with the bundling fixed —
|
|
102
|
+
// never reaches here. Once upstream is fixed the lookups above take over and
|
|
103
|
+
// this loop becomes unreachable.
|
|
104
|
+
if (code === -32603) {
|
|
105
|
+
for (const [pattern, Fallback] of SDK_BUNDLING_FALLBACK) {
|
|
106
|
+
if (pattern.test(message))
|
|
107
|
+
throw new Fallback();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
16
110
|
throw new A2AServerError(message, code);
|
|
17
111
|
}
|
|
18
112
|
export class A2AClient {
|
|
@@ -62,11 +156,22 @@ export class A2AClient {
|
|
|
62
156
|
async cancelTask(taskId) {
|
|
63
157
|
return this.jsonrpcCall("tasks/cancel", { id: taskId });
|
|
64
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* List tasks via `ListTasks`.
|
|
161
|
+
*
|
|
162
|
+
* A2A 1.0 names this method `ListTasks`; 0.3 had no task-listing method at
|
|
163
|
+
* all. The `tasks/list` spelling used here until 0.5.0 was neither, so it
|
|
164
|
+
* reached only this project's own Rust server.
|
|
165
|
+
*/
|
|
65
166
|
async listTasks(opts) {
|
|
66
|
-
|
|
167
|
+
// `limit` stays the friendly option name but goes on the wire as
|
|
168
|
+
// `pageSize`, which is what `ListTasksRequest` declares (alongside
|
|
169
|
+
// `pageToken`, `status`, `historyLength`, …). Sending `limit` earned an
|
|
170
|
+
// -32602 from both SDK-backed servers.
|
|
171
|
+
const params = { pageSize: opts?.limit ?? 50 };
|
|
67
172
|
if (opts?.contextId)
|
|
68
173
|
params.contextId = opts.contextId;
|
|
69
|
-
return this.jsonrpcCall("
|
|
174
|
+
return this.jsonrpcCall("ListTasks", params, "1.0");
|
|
70
175
|
}
|
|
71
176
|
async *streamMessage(message, opts) {
|
|
72
177
|
const params = { message, metadata: opts?.metadata ?? {} };
|
|
@@ -103,20 +208,27 @@ export class A2AClient {
|
|
|
103
208
|
break;
|
|
104
209
|
buffer += decoder.decode(value, { stream: true });
|
|
105
210
|
const lines = buffer.split("\n");
|
|
106
|
-
buffer = lines.pop();
|
|
107
|
-
for (const
|
|
108
|
-
|
|
211
|
+
buffer = lines.pop() ?? "";
|
|
212
|
+
for (const rawLine of lines) {
|
|
213
|
+
const line = rawLine.trimEnd();
|
|
214
|
+
// Skip keepalive comments (": ...") and blank separators.
|
|
215
|
+
if (line.startsWith("data:")) {
|
|
216
|
+
// The try covers parsing only: a malformed frame is skipped, but a
|
|
217
|
+
// JSON-RPC error frame must propagate to the caller, not be
|
|
218
|
+
// swallowed by the same catch.
|
|
219
|
+
let frame;
|
|
109
220
|
try {
|
|
110
|
-
|
|
111
|
-
yield data;
|
|
112
|
-
const final = data.final ||
|
|
113
|
-
data.result?.final;
|
|
114
|
-
if (final)
|
|
115
|
-
return;
|
|
221
|
+
frame = JSON.parse(line.slice(5).trimStart());
|
|
116
222
|
}
|
|
117
223
|
catch {
|
|
118
224
|
continue;
|
|
119
225
|
}
|
|
226
|
+
raiseIfStreamError(frame);
|
|
227
|
+
const event = unwrapStreamEnvelope(frame);
|
|
228
|
+
const terminal = isTerminalEvent(event);
|
|
229
|
+
yield event;
|
|
230
|
+
if (terminal)
|
|
231
|
+
return;
|
|
120
232
|
}
|
|
121
233
|
}
|
|
122
234
|
}
|
|
@@ -128,18 +240,29 @@ export class A2AClient {
|
|
|
128
240
|
close() {
|
|
129
241
|
// No persistent connection to close with native fetch
|
|
130
242
|
}
|
|
131
|
-
|
|
243
|
+
/**
|
|
244
|
+
* POST a JSON-RPC request, optionally declaring the A2A protocol version.
|
|
245
|
+
*
|
|
246
|
+
* Both upstream SDKs treat a request with no `A2A-Version` header as v0.3
|
|
247
|
+
* (spec section 3.6.2) and refuse 1.0 method names in that mode with
|
|
248
|
+
* `-32009`, so methods that exist only in 1.0 must declare `"1.0"`. Methods
|
|
249
|
+
* 0.3 also has stay unversioned, so a 0.3 server keeps working.
|
|
250
|
+
*/
|
|
251
|
+
async jsonrpcCall(method, params, a2aVersion) {
|
|
132
252
|
const body = {
|
|
133
253
|
jsonrpc: "2.0",
|
|
134
254
|
id: uuidv4(),
|
|
135
255
|
method,
|
|
136
256
|
params,
|
|
137
257
|
};
|
|
258
|
+
const headers = a2aVersion
|
|
259
|
+
? { ...this.headers, "A2A-Version": a2aVersion }
|
|
260
|
+
: this.headers;
|
|
138
261
|
let response;
|
|
139
262
|
try {
|
|
140
263
|
response = await fetch(`${this.url}/`, {
|
|
141
264
|
method: "POST",
|
|
142
|
-
headers
|
|
265
|
+
headers,
|
|
143
266
|
body: JSON.stringify(body),
|
|
144
267
|
signal: AbortSignal.timeout(this.timeout),
|
|
145
268
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,iBA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