@adcp/sdk 13.0.4 → 13.1.1
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/bin/adcp-grade.js +4 -3
- package/bin/adcp.js +18 -0
- package/dist/lib/conformance/invariants/uniformError.d.ts.map +1 -1
- package/dist/lib/conformance/invariants/uniformError.js +21 -0
- package/dist/lib/conformance/invariants/uniformError.js.map +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs +22 -1
- package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
- package/dist/lib/core/AgentClient.d.mts +1 -1
- package/dist/lib/core/AgentClient.d.ts +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/AgentClient.js +1 -1
- package/dist/lib/core/AgentClient.js.map +1 -1
- package/dist/lib/core/AgentClient.mjs +1 -1
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +88 -48
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +88 -48
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +8 -4
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +8 -4
- package/dist/lib/core/TaskExecutor.mjs.map +1 -1
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/net/agent-transport-fetch.d.mts +15 -0
- package/dist/lib/net/agent-transport-fetch.d.ts +15 -0
- package/dist/lib/net/agent-transport-fetch.d.ts.map +1 -1
- package/dist/lib/net/agent-transport-fetch.js +37 -2
- package/dist/lib/net/agent-transport-fetch.js.map +1 -1
- package/dist/lib/net/agent-transport-fetch.mjs +37 -2
- package/dist/lib/net/agent-transport-fetch.mjs.map +1 -1
- package/dist/lib/net/credential-headers.d.mts +1 -0
- package/dist/lib/net/credential-headers.d.ts +2 -0
- package/dist/lib/net/credential-headers.d.ts.map +1 -0
- package/dist/lib/net/credential-headers.js +34 -0
- package/dist/lib/net/credential-headers.js.map +1 -0
- package/dist/lib/net/credential-headers.mjs +10 -0
- package/dist/lib/net/credential-headers.mjs.map +1 -0
- package/dist/lib/protocols/a2a-native-v1.d.mts +18 -0
- package/dist/lib/protocols/a2a-native-v1.d.ts +19 -0
- package/dist/lib/protocols/a2a-native-v1.d.ts.map +1 -0
- package/dist/lib/protocols/a2a-native-v1.js +183 -0
- package/dist/lib/protocols/a2a-native-v1.js.map +1 -0
- package/dist/lib/protocols/a2a-native-v1.mjs +167 -0
- package/dist/lib/protocols/a2a-native-v1.mjs.map +1 -0
- package/dist/lib/protocols/a2a-push-notification.d.mts +13 -0
- package/dist/lib/protocols/a2a-push-notification.d.ts +14 -0
- package/dist/lib/protocols/a2a-push-notification.d.ts.map +1 -0
- package/dist/lib/protocols/a2a-push-notification.js +42 -0
- package/dist/lib/protocols/a2a-push-notification.js.map +1 -0
- package/dist/lib/protocols/a2a-push-notification.mjs +23 -0
- package/dist/lib/protocols/a2a-push-notification.mjs.map +1 -0
- package/dist/lib/protocols/a2a.d.mts +15 -5
- package/dist/lib/protocols/a2a.d.ts +15 -5
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +102 -13
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/a2a.mjs +90 -12
- package/dist/lib/protocols/a2a.mjs.map +1 -1
- package/dist/lib/protocols/index.d.mts +3 -0
- package/dist/lib/protocols/index.d.ts +3 -0
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +18 -6
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/index.mjs +18 -6
- package/dist/lib/protocols/index.mjs.map +1 -1
- package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-modern.js +3 -1
- package/dist/lib/protocols/mcp-modern.js.map +1 -1
- package/dist/lib/protocols/mcp-modern.mjs +3 -1
- package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
- package/dist/lib/protocols/mcp-tasks.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-tasks.js +2 -1
- package/dist/lib/protocols/mcp-tasks.js.map +1 -1
- package/dist/lib/protocols/mcp-tasks.mjs +2 -1
- package/dist/lib/protocols/mcp-tasks.mjs.map +1 -1
- package/dist/lib/protocols/mcp.d.mts +8 -5
- package/dist/lib/protocols/mcp.d.ts +8 -5
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +12 -4
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/protocols/mcp.mjs +12 -4
- package/dist/lib/protocols/mcp.mjs.map +1 -1
- package/dist/lib/protocols/rawResponseCapture.d.mts +9 -1
- package/dist/lib/protocols/rawResponseCapture.d.ts +9 -1
- package/dist/lib/protocols/rawResponseCapture.d.ts.map +1 -1
- package/dist/lib/protocols/rawResponseCapture.js +153 -10
- package/dist/lib/protocols/rawResponseCapture.js.map +1 -1
- package/dist/lib/protocols/rawResponseCapture.mjs +153 -10
- package/dist/lib/protocols/rawResponseCapture.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/signing/agent-fetch.d.mts +3 -1
- package/dist/lib/signing/agent-fetch.d.ts +3 -1
- package/dist/lib/signing/agent-fetch.d.ts.map +1 -1
- package/dist/lib/signing/agent-fetch.js +4 -2
- package/dist/lib/signing/agent-fetch.js.map +1 -1
- package/dist/lib/signing/agent-fetch.mjs +4 -2
- package/dist/lib/signing/agent-fetch.mjs.map +1 -1
- package/dist/lib/signing/protocol-methods.d.mts +24 -0
- package/dist/lib/signing/protocol-methods.d.ts +25 -0
- package/dist/lib/signing/protocol-methods.d.ts.map +1 -0
- package/dist/lib/signing/protocol-methods.js +51 -0
- package/dist/lib/signing/protocol-methods.js.map +1 -0
- package/dist/lib/signing/protocol-methods.mjs +25 -0
- package/dist/lib/signing/protocol-methods.mjs.map +1 -0
- package/dist/lib/signing/types.d.mts +2 -0
- package/dist/lib/signing/types.d.ts +2 -0
- package/dist/lib/signing/types.d.ts.map +1 -1
- package/dist/lib/signing/types.js.map +1 -1
- package/dist/lib/signing/types.mjs.map +1 -1
- package/dist/lib/signing/verifier.d.ts.map +1 -1
- package/dist/lib/signing/verifier.js +6 -2
- package/dist/lib/signing/verifier.js.map +1 -1
- package/dist/lib/signing/verifier.mjs +6 -2
- package/dist/lib/signing/verifier.mjs.map +1 -1
- package/dist/lib/testing/client.d.ts.map +1 -1
- package/dist/lib/testing/client.js +4 -1
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/client.mjs +4 -1
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +3 -0
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/comply.mjs +3 -0
- package/dist/lib/testing/compliance/comply.mjs.map +1 -1
- package/dist/lib/testing/storyboard/agent-routing.d.mts +3 -1
- package/dist/lib/testing/storyboard/agent-routing.d.ts +3 -1
- package/dist/lib/testing/storyboard/agent-routing.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/agent-routing.js +5 -2
- package/dist/lib/testing/storyboard/agent-routing.js.map +1 -1
- package/dist/lib/testing/storyboard/agent-routing.mjs +4 -2
- package/dist/lib/testing/storyboard/agent-routing.mjs.map +1 -1
- package/dist/lib/testing/storyboard/compliance.d.mts +1 -1
- package/dist/lib/testing/storyboard/compliance.d.ts +1 -1
- package/dist/lib/testing/storyboard/compliance.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/compliance.js +4 -1
- package/dist/lib/testing/storyboard/compliance.js.map +1 -1
- package/dist/lib/testing/storyboard/compliance.mjs +4 -1
- package/dist/lib/testing/storyboard/compliance.mjs.map +1 -1
- package/dist/lib/testing/storyboard/native-a2a-compliance.d.mts +7 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.d.ts +8 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.js +45 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.js.map +1 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.mjs +21 -0
- package/dist/lib/testing/storyboard/native-a2a-compliance.mjs.map +1 -0
- package/dist/lib/testing/storyboard/probes.d.mts +2 -0
- package/dist/lib/testing/storyboard/probes.d.ts +2 -0
- package/dist/lib/testing/storyboard/probes.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/probes.js +3 -2
- package/dist/lib/testing/storyboard/probes.js.map +1 -1
- package/dist/lib/testing/storyboard/probes.mjs +3 -2
- package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.d.mts +31 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.d.ts +32 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.js +279 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.js.map +1 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.mjs +244 -0
- package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.mjs.map +1 -0
- package/dist/lib/testing/storyboard/request-signing/builder.d.mts +4 -1
- package/dist/lib/testing/storyboard/request-signing/builder.d.ts +4 -1
- package/dist/lib/testing/storyboard/request-signing/builder.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/builder.js +19 -0
- package/dist/lib/testing/storyboard/request-signing/builder.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/builder.mjs +19 -0
- package/dist/lib/testing/storyboard/request-signing/builder.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/grader.d.mts +5 -6
- package/dist/lib/testing/storyboard/request-signing/grader.d.ts +5 -6
- package/dist/lib/testing/storyboard/request-signing/grader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/grader.js +82 -13
- package/dist/lib/testing/storyboard/request-signing/grader.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/grader.mjs +86 -13
- package/dist/lib/testing/storyboard/request-signing/grader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/index.d.mts +1 -0
- package/dist/lib/testing/storyboard/request-signing/index.d.ts +1 -0
- package/dist/lib/testing/storyboard/request-signing/index.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/index.js +7 -0
- package/dist/lib/testing/storyboard/request-signing/index.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/index.mjs +8 -0
- package/dist/lib/testing/storyboard/request-signing/index.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.mts +2 -2
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.ts +2 -2
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +6 -5
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +6 -5
- package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/types.d.mts +1 -0
- package/dist/lib/testing/storyboard/request-signing/types.d.ts +1 -0
- package/dist/lib/testing/storyboard/request-signing/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/types.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +1 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js.map +1 -1
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +1 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.mts +28 -1
- package/dist/lib/testing/storyboard/runner.d.ts +28 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +251 -55
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +255 -60
- package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
- package/dist/lib/testing/storyboard/types.d.mts +4 -2
- package/dist/lib/testing/storyboard/types.d.ts +4 -2
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/testing/storyboard/types.mjs +1 -0
- package/dist/lib/testing/storyboard/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +97 -22
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/testing/storyboard/validations.mjs +98 -22
- package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/docs/guides/BUILD-AN-AGENT.md +1 -1
- package/docs/llms.txt +5 -3
- package/package.json +2 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TaskPushNotificationConfig } from '@a2a-js/sdk-v1';
|
|
2
|
+
export interface A2APushNotificationConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
authentication?: {
|
|
6
|
+
schemes?: string[];
|
|
7
|
+
/** Legacy signing-vector spelling accepted at the conformance boundary. */
|
|
8
|
+
scheme?: string;
|
|
9
|
+
credentials?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Map AdCP push registration to the official A2A 1.0 transport shape. */
|
|
13
|
+
export declare function toA2ATaskPushNotificationConfig(config: A2APushNotificationConfig): TaskPushNotificationConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TaskPushNotificationConfig } from '@a2a-js/sdk-v1';
|
|
2
|
+
export interface A2APushNotificationConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
authentication?: {
|
|
6
|
+
schemes?: string[];
|
|
7
|
+
/** Legacy signing-vector spelling accepted at the conformance boundary. */
|
|
8
|
+
scheme?: string;
|
|
9
|
+
credentials?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Map AdCP push registration to the official A2A 1.0 transport shape. */
|
|
13
|
+
export declare function toA2ATaskPushNotificationConfig(config: A2APushNotificationConfig): TaskPushNotificationConfig;
|
|
14
|
+
//# sourceMappingURL=a2a-push-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a2a-push-notification.d.ts","sourceRoot":"","sources":["../../../src/lib/protocols/a2a-push-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,2EAA2E;QAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,yBAAyB,GAAG,0BAA0B,CAe7G"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var a2a_push_notification_exports = {};
|
|
20
|
+
__export(a2a_push_notification_exports, {
|
|
21
|
+
toA2ATaskPushNotificationConfig: () => toA2ATaskPushNotificationConfig
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(a2a_push_notification_exports);
|
|
24
|
+
function toA2ATaskPushNotificationConfig(config) {
|
|
25
|
+
const authentication = config.authentication;
|
|
26
|
+
return {
|
|
27
|
+
tenant: "",
|
|
28
|
+
id: "",
|
|
29
|
+
taskId: "",
|
|
30
|
+
url: config.url,
|
|
31
|
+
token: config.token ?? "",
|
|
32
|
+
authentication: authentication ? {
|
|
33
|
+
scheme: authentication.schemes?.[0] ?? authentication.scheme ?? "",
|
|
34
|
+
credentials: authentication.credentials ?? ""
|
|
35
|
+
} : void 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
toA2ATaskPushNotificationConfig
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=a2a-push-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/protocols/a2a-push-notification.ts"],"sourcesContent":["import type { TaskPushNotificationConfig } from '@a2a-js/sdk-v1';\n\nexport interface A2APushNotificationConfig {\n url: string;\n token?: string;\n authentication?: {\n schemes?: string[];\n /** Legacy signing-vector spelling accepted at the conformance boundary. */\n scheme?: string;\n credentials?: string;\n };\n}\n\n/** Map AdCP push registration to the official A2A 1.0 transport shape. */\nexport function toA2ATaskPushNotificationConfig(config: A2APushNotificationConfig): TaskPushNotificationConfig {\n const authentication = config.authentication;\n return {\n tenant: '',\n id: '',\n taskId: '',\n url: config.url,\n token: config.token ?? '',\n authentication: authentication\n ? {\n scheme: authentication.schemes?.[0] ?? authentication.scheme ?? '',\n credentials: authentication.credentials ?? '',\n }\n : undefined,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,gCAAgC,QAA+D;AAC7G,QAAM,iBAAiB,OAAO;AAC9B,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,KAAK,OAAO;AAAA,IACZ,OAAO,OAAO,SAAS;AAAA,IACvB,gBAAgB,iBACZ;AAAA,MACE,QAAQ,eAAe,UAAU,CAAC,KAAK,eAAe,UAAU;AAAA,MAChE,aAAa,eAAe,eAAe;AAAA,IAC7C,IACA;AAAA,EACN;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { fileURLToPath as __adcpFileURLToPath } from "node:url";
|
|
2
|
+
import { dirname as __adcpDirname } from "node:path";
|
|
3
|
+
import { createRequire as __adcpCreateRequire } from "node:module";
|
|
4
|
+
const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
|
|
5
|
+
const require2 = __adcpCreateRequire(import.meta.url);
|
|
6
|
+
function toA2ATaskPushNotificationConfig(config) {
|
|
7
|
+
const authentication = config.authentication;
|
|
8
|
+
return {
|
|
9
|
+
tenant: "",
|
|
10
|
+
id: "",
|
|
11
|
+
taskId: "",
|
|
12
|
+
url: config.url,
|
|
13
|
+
token: config.token ?? "",
|
|
14
|
+
authentication: authentication ? {
|
|
15
|
+
scheme: authentication.schemes?.[0] ?? authentication.scheme ?? "",
|
|
16
|
+
credentials: authentication.credentials ?? ""
|
|
17
|
+
} : void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
toA2ATaskPushNotificationConfig
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=a2a-push-notification.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/protocols/a2a-push-notification.ts"],"sourcesContent":["import { fileURLToPath as __adcpFileURLToPath } from 'node:url';\nimport { dirname as __adcpDirname } from 'node:path';\nimport { createRequire as __adcpCreateRequire } from 'node:module';\nconst __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));\nconst require = __adcpCreateRequire(import.meta.url);\nimport type { TaskPushNotificationConfig } from '@a2a-js/sdk-v1';\n\nexport interface A2APushNotificationConfig {\n url: string;\n token?: string;\n authentication?: {\n schemes?: string[];\n /** Legacy signing-vector spelling accepted at the conformance boundary. */\n scheme?: string;\n credentials?: string;\n };\n}\n\n/** Map AdCP push registration to the official A2A 1.0 transport shape. */\nexport function toA2ATaskPushNotificationConfig(config: A2APushNotificationConfig): TaskPushNotificationConfig {\n const authentication = config.authentication;\n return {\n tenant: '',\n id: '',\n taskId: '',\n url: config.url,\n token: config.token ?? '',\n authentication: authentication\n ? {\n scheme: authentication.schemes?.[0] ?? authentication.scheme ?? '',\n credentials: authentication.credentials ?? '',\n }\n : undefined,\n };\n}\n"],"mappings":"AAAA,SAAS,iBAAiB,2BAA2B;AACrD,SAAS,WAAW,qBAAqB;AACzC,SAAS,iBAAiB,2BAA2B;AACrD,MAAM,YAAY,cAAc,oBAAoB,YAAY,GAAG,CAAC;AACpE,MAAMA,WAAU,oBAAoB,YAAY,GAAG;AAe5C,SAAS,gCAAgC,QAA+D;AAC7G,QAAM,iBAAiB,OAAO;AAC9B,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,QAAQ;AAAA,IACR,KAAK,OAAO;AAAA,IACZ,OAAO,OAAO,SAAS;AAAA,IACvB,gBAAgB,iBACZ;AAAA,MACE,QAAQ,eAAe,UAAU,CAAC,KAAK,eAAe,UAAU;AAAA,MAChE,aAAa,eAAe,eAAe;AAAA,IAC7C,IACA;AAAA,EACN;AACF;","names":["require"]}
|
|
@@ -2,6 +2,10 @@ import type { PushNotificationConfig } from '../types/tools.generated.mjs';
|
|
|
2
2
|
import type { DebugLogEntry } from '../types/adcp.mjs';
|
|
3
3
|
import { type AgentSigningContext } from '../signing/client.mjs';
|
|
4
4
|
import type { AgentConfig } from '../types/adcp.mjs';
|
|
5
|
+
/** Controls whether A2A v0.3 compatibility is accepted. */
|
|
6
|
+
export interface A2ALegacyCompatOptions {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Clear all cached A2A clients. Called by closeConnections('a2a').
|
|
7
11
|
* A2A clients hold no persistent network resources (unlike MCP), so this
|
|
@@ -11,9 +15,9 @@ export declare function closeA2AConnections(): void;
|
|
|
11
15
|
/**
|
|
12
16
|
* Fire-and-forget A2A tasks/cancel for an in-flight task (A2A 0.3.0 §7.4).
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
18
|
+
* Uses the official A2A SDK cancel method with the same auth header shape as
|
|
19
|
+
* `callA2AToolImpl` (Bearer + x-adcp-auth). Does NOT enter
|
|
20
|
+
* `callContextStorage` — debug-log capture and 401-cache-eviction are
|
|
17
21
|
* intentionally skipped for best-effort cancellation.
|
|
18
22
|
*
|
|
19
23
|
* **Auth-code OAuth gap:** `authToken` is resolved by `getAuthToken(agent)`,
|
|
@@ -41,7 +45,13 @@ export declare function closeA2AConnections(): void;
|
|
|
41
45
|
* @param agent The agent config (used for URL, auth token, signing).
|
|
42
46
|
* @param taskId The server-assigned A2A Task.id to cancel.
|
|
43
47
|
*/
|
|
44
|
-
export declare function cancelA2ATask(agent: AgentConfig, taskId: string, fetchFn?: typeof fetch, allowPrivateIp?: boolean): Promise<void>;
|
|
48
|
+
export declare function cancelA2ATask(agent: AgentConfig, taskId: string, fetchFn?: typeof fetch, allowPrivateIp?: boolean, legacyCompat?: A2ALegacyCompatOptions): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Build an official A2A client from a card URL. Ordinary calls retain the
|
|
51
|
+
* stable SDK's v0.3 client; native-only compliance calls use the separately
|
|
52
|
+
* pinned official 1.0 client.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createA2AClientFromCardUrl(cardUrl: string, fetchImpl: typeof fetch, legacyCompat?: A2ALegacyCompatOptions): Promise<any>;
|
|
45
55
|
/**
|
|
46
56
|
* Protocol-level session identifiers that ride on the A2A Message envelope
|
|
47
57
|
* (not in the skill parameters). `contextId` binds sends to a server-side
|
|
@@ -54,4 +64,4 @@ export interface A2ASessionIds {
|
|
|
54
64
|
contextId?: string;
|
|
55
65
|
taskId?: string;
|
|
56
66
|
}
|
|
57
|
-
export declare function callA2ATool(agentUrl: string, toolName: string, parameters: Record<string, unknown>, authToken?: string, debugLogs?: DebugLogEntry[], pushNotificationConfig?: PushNotificationConfig, customHeaders?: Record<string, string>, signingContext?: AgentSigningContext, session?: A2ASessionIds, signal?: AbortSignal, requestTimeoutMs?: number, fetchFn?: typeof fetch, allowPrivateIp?: boolean): Promise<unknown>;
|
|
67
|
+
export declare function callA2ATool(agentUrl: string, toolName: string, parameters: Record<string, unknown>, authToken?: string, debugLogs?: DebugLogEntry[], pushNotificationConfig?: PushNotificationConfig, customHeaders?: Record<string, string>, signingContext?: AgentSigningContext, session?: A2ASessionIds, signal?: AbortSignal, requestTimeoutMs?: number, fetchFn?: typeof fetch, allowPrivateIp?: boolean, legacyCompat?: A2ALegacyCompatOptions): Promise<unknown>;
|
|
@@ -2,6 +2,10 @@ import type { PushNotificationConfig } from '../types/tools.generated';
|
|
|
2
2
|
import type { DebugLogEntry } from '../types/adcp';
|
|
3
3
|
import { type AgentSigningContext } from '../signing/client';
|
|
4
4
|
import type { AgentConfig } from '../types/adcp';
|
|
5
|
+
/** Controls whether A2A v0.3 compatibility is accepted. */
|
|
6
|
+
export interface A2ALegacyCompatOptions {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Clear all cached A2A clients. Called by closeConnections('a2a').
|
|
7
11
|
* A2A clients hold no persistent network resources (unlike MCP), so this
|
|
@@ -11,9 +15,9 @@ export declare function closeA2AConnections(): void;
|
|
|
11
15
|
/**
|
|
12
16
|
* Fire-and-forget A2A tasks/cancel for an in-flight task (A2A 0.3.0 §7.4).
|
|
13
17
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
18
|
+
* Uses the official A2A SDK cancel method with the same auth header shape as
|
|
19
|
+
* `callA2AToolImpl` (Bearer + x-adcp-auth). Does NOT enter
|
|
20
|
+
* `callContextStorage` — debug-log capture and 401-cache-eviction are
|
|
17
21
|
* intentionally skipped for best-effort cancellation.
|
|
18
22
|
*
|
|
19
23
|
* **Auth-code OAuth gap:** `authToken` is resolved by `getAuthToken(agent)`,
|
|
@@ -41,7 +45,13 @@ export declare function closeA2AConnections(): void;
|
|
|
41
45
|
* @param agent The agent config (used for URL, auth token, signing).
|
|
42
46
|
* @param taskId The server-assigned A2A Task.id to cancel.
|
|
43
47
|
*/
|
|
44
|
-
export declare function cancelA2ATask(agent: AgentConfig, taskId: string, fetchFn?: typeof fetch, allowPrivateIp?: boolean): Promise<void>;
|
|
48
|
+
export declare function cancelA2ATask(agent: AgentConfig, taskId: string, fetchFn?: typeof fetch, allowPrivateIp?: boolean, legacyCompat?: A2ALegacyCompatOptions): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Build an official A2A client from a card URL. Ordinary calls retain the
|
|
51
|
+
* stable SDK's v0.3 client; native-only compliance calls use the separately
|
|
52
|
+
* pinned official 1.0 client.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createA2AClientFromCardUrl(cardUrl: string, fetchImpl: typeof fetch, legacyCompat?: A2ALegacyCompatOptions): Promise<any>;
|
|
45
55
|
/**
|
|
46
56
|
* Protocol-level session identifiers that ride on the A2A Message envelope
|
|
47
57
|
* (not in the skill parameters). `contextId` binds sends to a server-side
|
|
@@ -54,5 +64,5 @@ export interface A2ASessionIds {
|
|
|
54
64
|
contextId?: string;
|
|
55
65
|
taskId?: string;
|
|
56
66
|
}
|
|
57
|
-
export declare function callA2ATool(agentUrl: string, toolName: string, parameters: Record<string, unknown>, authToken?: string, debugLogs?: DebugLogEntry[], pushNotificationConfig?: PushNotificationConfig, customHeaders?: Record<string, string>, signingContext?: AgentSigningContext, session?: A2ASessionIds, signal?: AbortSignal, requestTimeoutMs?: number, fetchFn?: typeof fetch, allowPrivateIp?: boolean): Promise<unknown>;
|
|
67
|
+
export declare function callA2ATool(agentUrl: string, toolName: string, parameters: Record<string, unknown>, authToken?: string, debugLogs?: DebugLogEntry[], pushNotificationConfig?: PushNotificationConfig, customHeaders?: Record<string, string>, signingContext?: AgentSigningContext, session?: A2ASessionIds, signal?: AbortSignal, requestTimeoutMs?: number, fetchFn?: typeof fetch, allowPrivateIp?: boolean, legacyCompat?: A2ALegacyCompatOptions): Promise<unknown>;
|
|
58
68
|
//# sourceMappingURL=a2a.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../../src/lib/protocols/a2a.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD,OAAO,EAAiD,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"a2a.d.ts","sourceRoot":"","sources":["../../../src/lib/protocols/a2a.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD,OAAO,EAAiD,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmCjD,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;CAClB;AA2GD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,KAAK,EACtB,cAAc,CAAC,EAAE,OAAO,EACxB,YAAY,GAAE,sBAAkD,GAC/D,OAAO,CAAC,IAAI,CAAC,CAuFf;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,OAAO,KAAK,EACvB,YAAY,GAAE,sBAAkD,GAC/D,OAAO,CAAC,GAAG,CAAC,CAMd;AAoOD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,GAAE,aAAa,EAAO,EAC/B,sBAAsB,CAAC,EAAE,sBAAsB,EAC/C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,cAAc,CAAC,EAAE,mBAAmB,EACpC,OAAO,CAAC,EAAE,aAAa,EACvB,MAAM,CAAC,EAAE,WAAW,EACpB,gBAAgB,CAAC,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,OAAO,KAAK,EACtB,cAAc,CAAC,EAAE,OAAO,EACxB,YAAY,CAAC,EAAE,sBAAsB,GACpC,OAAO,CAAC,OAAO,CAAC,CAkClB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,12 +17,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var a2a_exports = {};
|
|
20
30
|
__export(a2a_exports, {
|
|
21
31
|
callA2ATool: () => callA2ATool,
|
|
22
32
|
cancelA2ATask: () => cancelA2ATask,
|
|
23
|
-
closeA2AConnections: () => closeA2AConnections
|
|
33
|
+
closeA2AConnections: () => closeA2AConnections,
|
|
34
|
+
createA2AClientFromCardUrl: () => createA2AClientFromCardUrl
|
|
24
35
|
});
|
|
25
36
|
module.exports = __toCommonJS(a2a_exports);
|
|
26
37
|
var import_client = require("@a2a-js/sdk/client");
|
|
@@ -47,6 +58,7 @@ const A2AClient = import_client.A2AClient;
|
|
|
47
58
|
if (!A2AClient) {
|
|
48
59
|
throw new Error("A2A SDK client is required. Please install @a2a-js/sdk");
|
|
49
60
|
}
|
|
61
|
+
const DEFAULT_A2A_LEGACY_COMPAT = Object.freeze({ enabled: true });
|
|
50
62
|
const callContextStorage = new import_node_async_hooks.AsyncLocalStorage();
|
|
51
63
|
const a2aClientCache = /* @__PURE__ */ new Map();
|
|
52
64
|
const pendingA2AClients = /* @__PURE__ */ new Map();
|
|
@@ -96,12 +108,18 @@ function closeA2AConnections() {
|
|
|
96
108
|
pendingA2AClients.clear();
|
|
97
109
|
}
|
|
98
110
|
const CANCEL_TIMEOUT_MS = 5e3;
|
|
99
|
-
async function cancelA2ATask(agent, taskId, fetchFn, allowPrivateIp) {
|
|
111
|
+
async function cancelA2ATask(agent, taskId, fetchFn, allowPrivateIp, legacyCompat = DEFAULT_A2A_LEGACY_COMPAT) {
|
|
100
112
|
if (agent.protocol !== "a2a") {
|
|
101
113
|
return;
|
|
102
114
|
}
|
|
103
115
|
const agentUrl = agent.agent_uri;
|
|
104
|
-
const
|
|
116
|
+
const configuredHeaders = agent.headers ?? {};
|
|
117
|
+
const transportFetch = (0, import_agent_transport_fetch.createAgentTransportFetch)(agentUrl, {
|
|
118
|
+
trustedFetchFn: fetchFn,
|
|
119
|
+
allowPrivateIp,
|
|
120
|
+
originBoundHeaders: Object.keys(configuredHeaders),
|
|
121
|
+
crossOriginCredentialPolicy: legacyCompat.enabled === false ? "refuse" : "strip"
|
|
122
|
+
});
|
|
105
123
|
const authToken = agent.auth_token;
|
|
106
124
|
let requestFetch = (input, init) => transportFetch(input, init);
|
|
107
125
|
if (agent.request_signing && (0, import_agent_fetch.isInlineSigningConfig)(agent.request_signing)) {
|
|
@@ -112,10 +130,24 @@ async function cancelA2ATask(agent, taskId, fetchFn, allowPrivateIp) {
|
|
|
112
130
|
const timeoutSignal = AbortSignal.timeout(CANCEL_TIMEOUT_MS);
|
|
113
131
|
const fetchImpl = (input, init = {}) => {
|
|
114
132
|
const headers = new Headers(init.headers);
|
|
115
|
-
|
|
133
|
+
const requestUrl = new URL(input instanceof Request ? input.url : input.toString());
|
|
134
|
+
const nativeCrossOrigin = legacyCompat.enabled === false && requestUrl.origin !== new URL(agentUrl).origin;
|
|
135
|
+
if (nativeCrossOrigin && (authToken || agent.request_signing)) {
|
|
136
|
+
const credentialHeaderNames = [
|
|
137
|
+
...authToken ? ["authorization", "x-adcp-auth"] : [],
|
|
138
|
+
...agent.request_signing ? ["content-digest", "signature", "signature-input"] : []
|
|
139
|
+
];
|
|
140
|
+
throw new Error(
|
|
141
|
+
`A2A native cancel refused credentialed cross-origin dispatch to ${requestUrl.origin}; credential headers: ${credentialHeaderNames.join(", ")}`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if (authToken && !nativeCrossOrigin) {
|
|
116
145
|
headers.set("authorization", `Bearer ${authToken}`);
|
|
117
146
|
headers.set("x-adcp-auth", authToken);
|
|
118
147
|
}
|
|
148
|
+
if (!nativeCrossOrigin) {
|
|
149
|
+
for (const [name, value] of Object.entries(configuredHeaders)) headers.set(name, value);
|
|
150
|
+
}
|
|
119
151
|
const signal = init.signal ? AbortSignal.any([init.signal, timeoutSignal]) : timeoutSignal;
|
|
120
152
|
return requestFetch(input, { ...init, headers, signal });
|
|
121
153
|
};
|
|
@@ -123,14 +155,26 @@ async function cancelA2ATask(agent, taskId, fetchFn, allowPrivateIp) {
|
|
|
123
155
|
let lastError;
|
|
124
156
|
for (const cardUrl of (0, import_a2a_discovery.buildCardUrls)(agentUrl)) {
|
|
125
157
|
try {
|
|
126
|
-
client = await
|
|
158
|
+
client = await createA2AClientFromCardUrl(cardUrl, fetchImpl, legacyCompat);
|
|
127
159
|
break;
|
|
128
160
|
} catch (err) {
|
|
129
161
|
lastError = err;
|
|
130
162
|
}
|
|
131
163
|
}
|
|
132
164
|
if (!client) throw lastError instanceof Error ? lastError : new Error("A2A agent card discovery failed");
|
|
133
|
-
|
|
165
|
+
if (legacyCompat.enabled === false) {
|
|
166
|
+
const { createNativeCancelTaskRequest } = await import("./a2a-native-v1.js");
|
|
167
|
+
await client.cancelTask(createNativeCancelTaskRequest(taskId));
|
|
168
|
+
} else {
|
|
169
|
+
await client.cancelTask({ id: taskId });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async function createA2AClientFromCardUrl(cardUrl, fetchImpl, legacyCompat = DEFAULT_A2A_LEGACY_COMPAT) {
|
|
173
|
+
if (legacyCompat.enabled === false) {
|
|
174
|
+
const { createNativeA2AClientFromCardUrl } = await import("./a2a-native-v1.js");
|
|
175
|
+
return createNativeA2AClientFromCardUrl(cardUrl, fetchImpl);
|
|
176
|
+
}
|
|
177
|
+
return A2AClient.fromCardUrl(cardUrl, { fetchImpl });
|
|
134
178
|
}
|
|
135
179
|
async function getOrCreateA2AClient(agentUrl, authToken, customHeaders, bypassCache = false) {
|
|
136
180
|
const signingContext = import_client2.signingContextStorage.getStore();
|
|
@@ -177,9 +221,20 @@ async function createA2AClient(agentUrl, authToken) {
|
|
|
177
221
|
}
|
|
178
222
|
function buildFetchImpl(authToken, agentUrl) {
|
|
179
223
|
const signingContext = import_client2.signingContextStorage.getStore();
|
|
224
|
+
const creationContext = callContextStorage.getStore();
|
|
225
|
+
const originBoundCustomHeaderNames = Object.keys(creationContext?.customHeaders ?? {});
|
|
180
226
|
const pinnedFetch = (0, import_agent_transport_fetch.createAgentTransportFetch)(agentUrl, {
|
|
181
|
-
trustedFetchFn:
|
|
182
|
-
allowPrivateIp:
|
|
227
|
+
trustedFetchFn: creationContext?.fetchFn,
|
|
228
|
+
allowPrivateIp: creationContext?.allowPrivateIp,
|
|
229
|
+
originBoundHeaders: originBoundCustomHeaderNames,
|
|
230
|
+
crossOriginCredentialPolicy: creationContext?.legacyCompat?.enabled === false ? "refuse" : "strip",
|
|
231
|
+
onOriginBoundHeadersStripped: (headerNames, target) => {
|
|
232
|
+
callContextStorage.getStore()?.debugLogs.push({
|
|
233
|
+
type: "warning",
|
|
234
|
+
message: `A2A: Stripped configured origin-bound headers (${headerNames.join(", ")}) before cross-origin dispatch to ${target.origin}`,
|
|
235
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
236
|
+
});
|
|
237
|
+
}
|
|
183
238
|
});
|
|
184
239
|
const networkFetch = (0, import_transportDiagnostics.wrapFetchWithTransportDiagnostics)(
|
|
185
240
|
(0, import_responseSizeLimit.wrapFetchWithSizeLimit)((input, init) => pinnedFetch(input, init))
|
|
@@ -202,13 +257,32 @@ function buildFetchImpl(authToken, agentUrl) {
|
|
|
202
257
|
}
|
|
203
258
|
const urlString = typeof url === "string" ? url : url.toString();
|
|
204
259
|
const isDiscoveryRequest = (0, import_a2a_discovery.isAgentCardPath)(urlString);
|
|
260
|
+
const nativeCrossOrigin = context?.legacyCompat?.enabled === false && new URL(urlString).origin !== new URL(agentUrl).origin;
|
|
261
|
+
if (nativeCrossOrigin && (authToken || signingContext)) {
|
|
262
|
+
const targetOrigin = new URL(urlString).origin;
|
|
263
|
+
const credentialHeaderNames = [
|
|
264
|
+
...authToken ? ["authorization", "x-adcp-auth"] : [],
|
|
265
|
+
...signingContext ? ["content-digest", "signature", "signature-input"] : []
|
|
266
|
+
];
|
|
267
|
+
throw new Error(
|
|
268
|
+
`A2A native dispatch refused credentialed cross-origin endpoint ${targetOrigin}; credential headers: ${credentialHeaderNames.join(", ")}`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
const customHeaders = nativeCrossOrigin ? void 0 : context?.customHeaders;
|
|
272
|
+
if (nativeCrossOrigin && Object.keys(context?.customHeaders ?? {}).length > 0) {
|
|
273
|
+
context?.debugLogs.push({
|
|
274
|
+
type: "warning",
|
|
275
|
+
message: `A2A: Stripped configured origin-bound headers before cross-origin dispatch to ${new URL(urlString).origin}`,
|
|
276
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
277
|
+
});
|
|
278
|
+
}
|
|
205
279
|
const traceHeaders = isDiscoveryRequest ? {} : (0, import_tracing.injectTraceHeaders)();
|
|
206
280
|
const requestTimeoutMs = isDiscoveryRequest ? (0, import_abort.resolveRequestTimeoutMs)(context?.requestTimeoutMs, import_abort.DEFAULT_REQUEST_TIMEOUT_MS) : (0, import_abort.resolveRequestTimeoutMs)(context?.requestTimeoutMs);
|
|
207
281
|
const headers = {
|
|
208
282
|
...existingHeaders,
|
|
209
283
|
...traceHeaders,
|
|
210
|
-
...
|
|
211
|
-
...authToken && {
|
|
284
|
+
...customHeaders,
|
|
285
|
+
...authToken && !nativeCrossOrigin && {
|
|
212
286
|
Authorization: `Bearer ${authToken}`,
|
|
213
287
|
"x-adcp-auth": authToken
|
|
214
288
|
}
|
|
@@ -249,7 +323,7 @@ function hasTerminalTaskWithDataArtifact(response) {
|
|
|
249
323
|
if (typeof status?.state !== "string" || !TERMINAL_A2A_STATES.has(status.state)) return false;
|
|
250
324
|
return (0, import_a2a_artifacts.getLatestA2ADataPartFromResponse)(response) !== void 0;
|
|
251
325
|
}
|
|
252
|
-
async function callA2ATool(agentUrl, toolName, parameters, authToken, debugLogs = [], pushNotificationConfig, customHeaders, signingContext, session, signal, requestTimeoutMs, fetchFn, allowPrivateIp) {
|
|
326
|
+
async function callA2ATool(agentUrl, toolName, parameters, authToken, debugLogs = [], pushNotificationConfig, customHeaders, signingContext, session, signal, requestTimeoutMs, fetchFn, allowPrivateIp, legacyCompat) {
|
|
253
327
|
return (0, import_tracing.withSpan)(
|
|
254
328
|
"adcp.a2a.call_tool",
|
|
255
329
|
{
|
|
@@ -264,7 +338,8 @@ async function callA2ATool(agentUrl, toolName, parameters, authToken, debugLogs
|
|
|
264
338
|
signal,
|
|
265
339
|
requestTimeoutMs,
|
|
266
340
|
fetchFn,
|
|
267
|
-
allowPrivateIp
|
|
341
|
+
allowPrivateIp,
|
|
342
|
+
legacyCompat
|
|
268
343
|
};
|
|
269
344
|
return import_client2.signingContextStorage.run(
|
|
270
345
|
signingContext,
|
|
@@ -287,6 +362,19 @@ async function callA2ATool(agentUrl, toolName, parameters, authToken, debugLogs
|
|
|
287
362
|
}
|
|
288
363
|
async function callA2AToolImpl(agentUrl, toolName, parameters, authToken, debugLogs, pushNotificationConfig, context, session) {
|
|
289
364
|
try {
|
|
365
|
+
if (context.legacyCompat?.enabled === false) {
|
|
366
|
+
const { callNativeA2ATool } = await import("./a2a-native-v1.js");
|
|
367
|
+
return await callNativeA2ATool({
|
|
368
|
+
cardUrls: (0, import_a2a_discovery.buildCardUrls)(agentUrl),
|
|
369
|
+
fetchImpl: buildFetchImpl(authToken, agentUrl),
|
|
370
|
+
toolName,
|
|
371
|
+
parameters,
|
|
372
|
+
pushNotificationConfig,
|
|
373
|
+
contextId: session?.contextId,
|
|
374
|
+
taskId: session?.taskId,
|
|
375
|
+
signal: context.signal
|
|
376
|
+
});
|
|
377
|
+
}
|
|
290
378
|
const client = await getOrCreateA2AClient(
|
|
291
379
|
agentUrl,
|
|
292
380
|
authToken,
|
|
@@ -394,6 +482,7 @@ async function callA2AToolImpl(agentUrl, toolName, parameters, authToken, debugL
|
|
|
394
482
|
0 && (module.exports = {
|
|
395
483
|
callA2ATool,
|
|
396
484
|
cancelA2ATask,
|
|
397
|
-
closeA2AConnections
|
|
485
|
+
closeA2AConnections,
|
|
486
|
+
createA2AClientFromCardUrl
|
|
398
487
|
});
|
|
399
488
|
//# sourceMappingURL=a2a.js.map
|