@aramisfa/openclaw-a2a-outbound 0.1.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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/ajv-validator.d.ts +6 -0
- package/dist/ajv-validator.d.ts.map +1 -0
- package/dist/ajv-validator.js +28 -0
- package/dist/ajv-validator.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +204 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +111 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/logging.d.ts +19 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +19 -0
- package/dist/logging.js.map +1 -0
- package/dist/plugin-config.d.ts +5 -0
- package/dist/plugin-config.d.ts.map +1 -0
- package/dist/plugin-config.js +89 -0
- package/dist/plugin-config.js.map +1 -0
- package/dist/result-shape.d.ts +36 -0
- package/dist/result-shape.d.ts.map +1 -0
- package/dist/result-shape.js +83 -0
- package/dist/result-shape.js.map +1 -0
- package/dist/schemas.d.ts +665 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +247 -0
- package/dist/schemas.js.map +1 -0
- package/dist/sdk-client-pool.d.ts +34 -0
- package/dist/sdk-client-pool.d.ts.map +1 -0
- package/dist/sdk-client-pool.js +120 -0
- package/dist/sdk-client-pool.js.map +1 -0
- package/dist/service.d.ts +21 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +143 -0
- package/dist/service.js.map +1 -0
- package/openclaw.plugin.json +61 -0
- package/package.json +68 -0
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { ALL_TRANSPORTS } from "./constants.js";
|
|
2
|
+
import { createA2AOutboundAjv, toValidationError } from "./ajv-validator.js";
|
|
3
|
+
const MESSAGE_ROLES = ["user", "agent"];
|
|
4
|
+
const TARGET_SCHEMA = {
|
|
5
|
+
type: "object",
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
properties: {
|
|
8
|
+
baseUrl: {
|
|
9
|
+
type: "string",
|
|
10
|
+
minLength: 1,
|
|
11
|
+
format: "uri",
|
|
12
|
+
pattern: "^https?://",
|
|
13
|
+
description: "Target agent base URL.",
|
|
14
|
+
},
|
|
15
|
+
cardPath: {
|
|
16
|
+
type: "string",
|
|
17
|
+
minLength: 1,
|
|
18
|
+
description: "Optional override for the target agent-card path. Defaults from plugin config when omitted.",
|
|
19
|
+
},
|
|
20
|
+
preferredTransports: {
|
|
21
|
+
type: "array",
|
|
22
|
+
items: {
|
|
23
|
+
type: "string",
|
|
24
|
+
enum: ALL_TRANSPORTS,
|
|
25
|
+
},
|
|
26
|
+
description: "Optional transport preference override for this call. Defaults from plugin config when omitted.",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ["baseUrl"],
|
|
30
|
+
};
|
|
31
|
+
const MESSAGE_PART_METADATA_SCHEMA = {
|
|
32
|
+
type: "object",
|
|
33
|
+
additionalProperties: true,
|
|
34
|
+
};
|
|
35
|
+
const TEXT_PART_SCHEMA = {
|
|
36
|
+
type: "object",
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
properties: {
|
|
39
|
+
kind: { type: "string", enum: ["text"] },
|
|
40
|
+
text: { type: "string" },
|
|
41
|
+
metadata: MESSAGE_PART_METADATA_SCHEMA,
|
|
42
|
+
},
|
|
43
|
+
required: ["kind", "text"],
|
|
44
|
+
};
|
|
45
|
+
const FILE_PART_FILE_SCHEMA = {
|
|
46
|
+
type: "object",
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
properties: {
|
|
49
|
+
uri: { type: "string", minLength: 1 },
|
|
50
|
+
bytes: { type: "string", minLength: 1 },
|
|
51
|
+
name: { type: "string" },
|
|
52
|
+
mimeType: { type: "string" },
|
|
53
|
+
},
|
|
54
|
+
anyOf: [{ required: ["uri"] }, { required: ["bytes"] }],
|
|
55
|
+
};
|
|
56
|
+
const FILE_PART_SCHEMA = {
|
|
57
|
+
type: "object",
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
properties: {
|
|
60
|
+
kind: { type: "string", enum: ["file"] },
|
|
61
|
+
file: FILE_PART_FILE_SCHEMA,
|
|
62
|
+
metadata: MESSAGE_PART_METADATA_SCHEMA,
|
|
63
|
+
},
|
|
64
|
+
required: ["kind", "file"],
|
|
65
|
+
};
|
|
66
|
+
const DATA_PART_SCHEMA = {
|
|
67
|
+
type: "object",
|
|
68
|
+
additionalProperties: false,
|
|
69
|
+
properties: {
|
|
70
|
+
kind: { type: "string", enum: ["data"] },
|
|
71
|
+
data: { type: "object", additionalProperties: true },
|
|
72
|
+
metadata: MESSAGE_PART_METADATA_SCHEMA,
|
|
73
|
+
},
|
|
74
|
+
required: ["kind", "data"],
|
|
75
|
+
};
|
|
76
|
+
const MESSAGE_SCHEMA = {
|
|
77
|
+
type: "object",
|
|
78
|
+
additionalProperties: false,
|
|
79
|
+
properties: {
|
|
80
|
+
kind: { type: "string", enum: ["message"] },
|
|
81
|
+
messageId: { type: "string", minLength: 1 },
|
|
82
|
+
role: { type: "string", enum: MESSAGE_ROLES },
|
|
83
|
+
parts: {
|
|
84
|
+
type: "array",
|
|
85
|
+
items: {
|
|
86
|
+
oneOf: [TEXT_PART_SCHEMA, FILE_PART_SCHEMA, DATA_PART_SCHEMA],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
contextId: { type: "string", minLength: 1 },
|
|
90
|
+
taskId: { type: "string", minLength: 1 },
|
|
91
|
+
extensions: {
|
|
92
|
+
type: "array",
|
|
93
|
+
items: { type: "string" },
|
|
94
|
+
},
|
|
95
|
+
referenceTaskIds: {
|
|
96
|
+
type: "array",
|
|
97
|
+
items: { type: "string" },
|
|
98
|
+
},
|
|
99
|
+
metadata: {
|
|
100
|
+
type: "object",
|
|
101
|
+
additionalProperties: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
required: ["kind", "messageId", "role", "parts"],
|
|
105
|
+
};
|
|
106
|
+
export const DELEGATE_INPUT_SCHEMA = {
|
|
107
|
+
type: "object",
|
|
108
|
+
additionalProperties: false,
|
|
109
|
+
properties: {
|
|
110
|
+
target: TARGET_SCHEMA,
|
|
111
|
+
request: {
|
|
112
|
+
type: "object",
|
|
113
|
+
additionalProperties: false,
|
|
114
|
+
properties: {
|
|
115
|
+
message: {
|
|
116
|
+
...MESSAGE_SCHEMA,
|
|
117
|
+
description: "A2A message payload passed as MessageSendParams.message.",
|
|
118
|
+
},
|
|
119
|
+
timeoutMs: {
|
|
120
|
+
type: "integer",
|
|
121
|
+
minimum: 1,
|
|
122
|
+
description: "Optional timeout override for this operation.",
|
|
123
|
+
},
|
|
124
|
+
serviceParameters: {
|
|
125
|
+
type: "object",
|
|
126
|
+
additionalProperties: { type: "string" },
|
|
127
|
+
description: "Optional service parameters for this operation.",
|
|
128
|
+
},
|
|
129
|
+
metadata: {
|
|
130
|
+
type: "object",
|
|
131
|
+
additionalProperties: true,
|
|
132
|
+
description: "Optional MessageSendParams.metadata payload.",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
required: ["message"],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
required: ["target", "request"],
|
|
139
|
+
};
|
|
140
|
+
export const STATUS_INPUT_SCHEMA = {
|
|
141
|
+
type: "object",
|
|
142
|
+
additionalProperties: false,
|
|
143
|
+
properties: {
|
|
144
|
+
target: TARGET_SCHEMA,
|
|
145
|
+
request: {
|
|
146
|
+
type: "object",
|
|
147
|
+
additionalProperties: false,
|
|
148
|
+
properties: {
|
|
149
|
+
taskId: {
|
|
150
|
+
type: "string",
|
|
151
|
+
minLength: 1,
|
|
152
|
+
description: "Remote task id to query.",
|
|
153
|
+
},
|
|
154
|
+
historyLength: {
|
|
155
|
+
type: "integer",
|
|
156
|
+
minimum: 0,
|
|
157
|
+
description: "Optional history window length.",
|
|
158
|
+
},
|
|
159
|
+
timeoutMs: {
|
|
160
|
+
type: "integer",
|
|
161
|
+
minimum: 1,
|
|
162
|
+
description: "Optional timeout override for this operation.",
|
|
163
|
+
},
|
|
164
|
+
serviceParameters: {
|
|
165
|
+
type: "object",
|
|
166
|
+
additionalProperties: { type: "string" },
|
|
167
|
+
description: "Optional service parameters for this operation.",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
required: ["taskId"],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
required: ["target", "request"],
|
|
174
|
+
};
|
|
175
|
+
export const CANCEL_INPUT_SCHEMA = {
|
|
176
|
+
type: "object",
|
|
177
|
+
additionalProperties: false,
|
|
178
|
+
properties: {
|
|
179
|
+
target: TARGET_SCHEMA,
|
|
180
|
+
request: {
|
|
181
|
+
type: "object",
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
properties: {
|
|
184
|
+
taskId: {
|
|
185
|
+
type: "string",
|
|
186
|
+
minLength: 1,
|
|
187
|
+
description: "Remote task id to cancel.",
|
|
188
|
+
},
|
|
189
|
+
timeoutMs: {
|
|
190
|
+
type: "integer",
|
|
191
|
+
minimum: 1,
|
|
192
|
+
description: "Optional timeout override for this operation.",
|
|
193
|
+
},
|
|
194
|
+
serviceParameters: {
|
|
195
|
+
type: "object",
|
|
196
|
+
additionalProperties: { type: "string" },
|
|
197
|
+
description: "Optional service parameters for this operation.",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
required: ["taskId"],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
required: ["target", "request"],
|
|
204
|
+
};
|
|
205
|
+
export const TOOL_DEFINITIONS = {
|
|
206
|
+
a2a_delegate: {
|
|
207
|
+
name: "a2a_delegate",
|
|
208
|
+
label: "A2A Delegate",
|
|
209
|
+
description: "Delegate a request to an external A2A agent.",
|
|
210
|
+
parameters: DELEGATE_INPUT_SCHEMA,
|
|
211
|
+
},
|
|
212
|
+
a2a_task_status: {
|
|
213
|
+
name: "a2a_task_status",
|
|
214
|
+
label: "A2A Task Status",
|
|
215
|
+
description: "Fetch status for an external A2A task.",
|
|
216
|
+
parameters: STATUS_INPUT_SCHEMA,
|
|
217
|
+
},
|
|
218
|
+
a2a_task_cancel: {
|
|
219
|
+
name: "a2a_task_cancel",
|
|
220
|
+
label: "A2A Task Cancel",
|
|
221
|
+
description: "Request cancellation for an external A2A task.",
|
|
222
|
+
parameters: CANCEL_INPUT_SCHEMA,
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
const ajv = createA2AOutboundAjv();
|
|
226
|
+
const validateDelegateSchema = ajv.compile(DELEGATE_INPUT_SCHEMA);
|
|
227
|
+
const validateStatusSchema = ajv.compile(STATUS_INPUT_SCHEMA);
|
|
228
|
+
const validateCancelSchema = ajv.compile(CANCEL_INPUT_SCHEMA);
|
|
229
|
+
export function validateDelegateInput(input) {
|
|
230
|
+
if (!validateDelegateSchema(input)) {
|
|
231
|
+
toValidationError("a2a_delegate", [...validateDelegateSchema.errors]);
|
|
232
|
+
}
|
|
233
|
+
return input;
|
|
234
|
+
}
|
|
235
|
+
export function validateStatusInput(input) {
|
|
236
|
+
if (!validateStatusSchema(input)) {
|
|
237
|
+
toValidationError("a2a_task_status", [...validateStatusSchema.errors]);
|
|
238
|
+
}
|
|
239
|
+
return input;
|
|
240
|
+
}
|
|
241
|
+
export function validateCancelInput(input) {
|
|
242
|
+
if (!validateCancelSchema(input)) {
|
|
243
|
+
toValidationError("a2a_task_cancel", [...validateCancelSchema.errors]);
|
|
244
|
+
}
|
|
245
|
+
return input;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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mB,CAAC,CAAC;AAE9D,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,iBAAiB,CAAC,cAAc,EAAE,CAAC,GAAG,sBAAsB,CAAC,MAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,KAAqC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAmC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,GAAG,oBAAoB,CAAC,MAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAmC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ClientFactoryOptions, type Client } from "@a2a-js/sdk/client";
|
|
2
|
+
import { type A2ATransport } from "./constants.js";
|
|
3
|
+
import type { A2ATargetInput } from "./schemas.js";
|
|
4
|
+
export interface SDKClientPoolOptions {
|
|
5
|
+
defaultCardPath?: string;
|
|
6
|
+
preferredTransports?: A2ATransport[];
|
|
7
|
+
acceptedOutputModes?: string[];
|
|
8
|
+
normalizeBaseUrl?: boolean;
|
|
9
|
+
enforceSupportedTransports?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ResolvedTarget {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
cardPath: string;
|
|
14
|
+
preferredTransports: A2ATransport[];
|
|
15
|
+
}
|
|
16
|
+
type ClientEntry = {
|
|
17
|
+
client: Client;
|
|
18
|
+
target: ResolvedTarget;
|
|
19
|
+
};
|
|
20
|
+
export declare class SDKClientPool {
|
|
21
|
+
private readonly cache;
|
|
22
|
+
private readonly defaultCardPath;
|
|
23
|
+
private readonly defaultPreferredTransports;
|
|
24
|
+
private readonly acceptedOutputModes;
|
|
25
|
+
private readonly shouldNormalizeBaseUrl;
|
|
26
|
+
private readonly shouldEnforceSupportedTransports;
|
|
27
|
+
constructor(options?: SDKClientPoolOptions);
|
|
28
|
+
normalizeTarget(target: A2ATargetInput): ResolvedTarget;
|
|
29
|
+
buildFactoryOptions(preferredTransports: A2ATransport[]): ClientFactoryOptions;
|
|
30
|
+
get(target: A2ATargetInput): Promise<ClientEntry>;
|
|
31
|
+
}
|
|
32
|
+
export declare function createClientPool(options?: SDKClientPoolOptions): SDKClientPool;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=sdk-client-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-client-pool.d.ts","sourceRoot":"","sources":["../src/sdk-client-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,KAAK,MAAM,EACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,YAAY,EAAE,CAAC;IACrC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,YAAY,EAAE,CAAC;CACrC;AAED,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AA2EF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAExD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAiB;IAE5D,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAW;IAE/C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAU;IAEjD,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAU;gBAE/C,OAAO,GAAE,oBAAyB;IAyB9C,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc;IAkBvD,mBAAmB,CACjB,mBAAmB,EAAE,YAAY,EAAE,GAClC,oBAAoB;IAiBjB,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;CA2BxD;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAEf"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ClientFactory, ClientFactoryOptions, } from "@a2a-js/sdk/client";
|
|
2
|
+
import { ALL_TRANSPORTS, SUPPORTED_TRANSPORTS, } from "./constants.js";
|
|
3
|
+
import { A2A_OUTBOUND_DEFAULT_CONFIG } from "./config.js";
|
|
4
|
+
import { A2AOutboundError, ERROR_CODES } from "./errors.js";
|
|
5
|
+
function mergeUniqueTransports(values) {
|
|
6
|
+
const deduped = [];
|
|
7
|
+
for (const value of values) {
|
|
8
|
+
if (typeof value !== "string" ||
|
|
9
|
+
!ALL_TRANSPORTS.includes(value)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (!deduped.includes(value)) {
|
|
13
|
+
deduped.push(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return deduped;
|
|
17
|
+
}
|
|
18
|
+
function mergeUniqueStrings(values) {
|
|
19
|
+
const deduped = [];
|
|
20
|
+
for (const value of values) {
|
|
21
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!deduped.includes(value)) {
|
|
25
|
+
deduped.push(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return deduped;
|
|
29
|
+
}
|
|
30
|
+
function assertSupportedPreferredTransports(preferredTransports) {
|
|
31
|
+
const unsupported = preferredTransports.filter((transport) => !SUPPORTED_TRANSPORTS.includes(transport));
|
|
32
|
+
if (unsupported.length > 0) {
|
|
33
|
+
throw new A2AOutboundError(ERROR_CODES.A2A_SDK_ERROR, `unsupported preferred transport(s) in this build: ${unsupported.join(", ")}`, {
|
|
34
|
+
unsupported,
|
|
35
|
+
supported: SUPPORTED_TRANSPORTS,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function clientKey(target) {
|
|
40
|
+
return JSON.stringify([
|
|
41
|
+
target.baseUrl,
|
|
42
|
+
target.cardPath,
|
|
43
|
+
...target.preferredTransports,
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
function normalizeBaseUrl(baseUrl, normalize) {
|
|
47
|
+
if (!normalize) {
|
|
48
|
+
return baseUrl.trim();
|
|
49
|
+
}
|
|
50
|
+
return new URL(baseUrl).toString();
|
|
51
|
+
}
|
|
52
|
+
export class SDKClientPool {
|
|
53
|
+
cache = new Map();
|
|
54
|
+
defaultCardPath;
|
|
55
|
+
defaultPreferredTransports;
|
|
56
|
+
acceptedOutputModes;
|
|
57
|
+
shouldNormalizeBaseUrl;
|
|
58
|
+
shouldEnforceSupportedTransports;
|
|
59
|
+
constructor(options = {}) {
|
|
60
|
+
this.defaultCardPath =
|
|
61
|
+
options.defaultCardPath ?? A2A_OUTBOUND_DEFAULT_CONFIG.defaults.cardPath;
|
|
62
|
+
const normalizedPreferredTransports = mergeUniqueTransports(options.preferredTransports ??
|
|
63
|
+
A2A_OUTBOUND_DEFAULT_CONFIG.defaults.preferredTransports);
|
|
64
|
+
this.defaultPreferredTransports =
|
|
65
|
+
normalizedPreferredTransports.length > 0
|
|
66
|
+
? normalizedPreferredTransports
|
|
67
|
+
: [...A2A_OUTBOUND_DEFAULT_CONFIG.defaults.preferredTransports];
|
|
68
|
+
this.acceptedOutputModes = mergeUniqueStrings(options.acceptedOutputModes ?? []);
|
|
69
|
+
this.shouldNormalizeBaseUrl =
|
|
70
|
+
options.normalizeBaseUrl ??
|
|
71
|
+
A2A_OUTBOUND_DEFAULT_CONFIG.policy.normalizeBaseUrl;
|
|
72
|
+
this.shouldEnforceSupportedTransports =
|
|
73
|
+
options.enforceSupportedTransports ??
|
|
74
|
+
A2A_OUTBOUND_DEFAULT_CONFIG.policy.enforceSupportedTransports;
|
|
75
|
+
}
|
|
76
|
+
normalizeTarget(target) {
|
|
77
|
+
const preferredTransports = mergeUniqueTransports(target.preferredTransports && target.preferredTransports.length > 0
|
|
78
|
+
? target.preferredTransports
|
|
79
|
+
: this.defaultPreferredTransports);
|
|
80
|
+
if (this.shouldEnforceSupportedTransports) {
|
|
81
|
+
assertSupportedPreferredTransports(preferredTransports);
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
baseUrl: normalizeBaseUrl(target.baseUrl, this.shouldNormalizeBaseUrl),
|
|
85
|
+
cardPath: target.cardPath ?? this.defaultCardPath,
|
|
86
|
+
preferredTransports,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
buildFactoryOptions(preferredTransports) {
|
|
90
|
+
const overrides = {
|
|
91
|
+
preferredTransports,
|
|
92
|
+
};
|
|
93
|
+
if (this.acceptedOutputModes.length > 0) {
|
|
94
|
+
overrides.clientConfig = {
|
|
95
|
+
acceptedOutputModes: this.acceptedOutputModes,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return ClientFactoryOptions.createFrom(ClientFactoryOptions.default, overrides);
|
|
99
|
+
}
|
|
100
|
+
async get(target) {
|
|
101
|
+
const normalized = this.normalizeTarget(target);
|
|
102
|
+
const key = clientKey(normalized);
|
|
103
|
+
const existing = this.cache.get(key);
|
|
104
|
+
if (existing) {
|
|
105
|
+
return existing;
|
|
106
|
+
}
|
|
107
|
+
const factory = new ClientFactory(this.buildFactoryOptions(normalized.preferredTransports));
|
|
108
|
+
const client = await factory.createFromUrl(normalized.baseUrl, normalized.cardPath);
|
|
109
|
+
const entry = {
|
|
110
|
+
client,
|
|
111
|
+
target: normalized,
|
|
112
|
+
};
|
|
113
|
+
this.cache.set(key, entry);
|
|
114
|
+
return entry;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export function createClientPool(options = {}) {
|
|
118
|
+
return new SDKClientPool(options);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=sdk-client-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-client-pool.js","sourceRoot":"","sources":["../src/sdk-client-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,oBAAoB,GAErB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsB5D,SAAS,qBAAqB,CAAC,MAA0B;IACvD,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAqB,CAAC,EAC/C,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAqB,CAAC,EAAE,CAAC;YAC7C,OAAO,CAAC,IAAI,CAAC,KAAqB,CAAC,CAAC;QACtC,CAAC;I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KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAC9B,UAAgC,EAAE;IAElC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type LoggerLike, type TracerLike } from "./logging.js";
|
|
2
|
+
import { type A2AToolResult } from "./result-shape.js";
|
|
3
|
+
import { type SDKClientPool } from "./sdk-client-pool.js";
|
|
4
|
+
export interface A2AOutboundServiceOptions {
|
|
5
|
+
config?: unknown;
|
|
6
|
+
logger?: LoggerLike;
|
|
7
|
+
tracer?: TracerLike;
|
|
8
|
+
clientPool?: SDKClientPool;
|
|
9
|
+
}
|
|
10
|
+
export declare class A2AOutboundService {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private readonly tracer;
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly clientPool;
|
|
15
|
+
constructor(options?: A2AOutboundServiceOptions);
|
|
16
|
+
delegate(input: unknown): Promise<A2AToolResult>;
|
|
17
|
+
status(input: unknown): Promise<A2AToolResult>;
|
|
18
|
+
cancel(input: unknown): Promise<A2AToolResult>;
|
|
19
|
+
}
|
|
20
|
+
export declare function buildService(options?: A2AOutboundServiceOptions): A2AOutboundService;
|
|
21
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAmD5E,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;gBAE/B,OAAO,GAAE,yBAA8B;IAiB7C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAyChD,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IA4C9C,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;CAwCrD;AAED,wBAAgB,YAAY,CAC1B,OAAO,GAAE,yBAA8B,GACtC,kBAAkB,CAEpB"}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { parseA2AOutboundPluginConfig, } from "./config.js";
|
|
2
|
+
import { A2AOutboundError, ERROR_CODES, toToolError, } from "./errors.js";
|
|
3
|
+
import { log, startSpan } from "./logging.js";
|
|
4
|
+
import { delegateFailure, delegateSuccess, taskCancelFailure, taskCancelSuccess, taskStatusFailure, taskStatusSuccess, } from "./result-shape.js";
|
|
5
|
+
import { createClientPool } from "./sdk-client-pool.js";
|
|
6
|
+
import { validateCancelInput, validateDelegateInput, validateStatusInput, } from "./schemas.js";
|
|
7
|
+
function mergeServiceParameters(base, override) {
|
|
8
|
+
const merged = {
|
|
9
|
+
...base,
|
|
10
|
+
...(override ?? {}),
|
|
11
|
+
};
|
|
12
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
13
|
+
}
|
|
14
|
+
function requestOptions(timeoutMs, defaultTimeoutMs, defaultServiceParameters, serviceParameters) {
|
|
15
|
+
const effectiveTimeoutMs = timeoutMs ?? defaultTimeoutMs;
|
|
16
|
+
const mergedServiceParameters = mergeServiceParameters(defaultServiceParameters, serviceParameters);
|
|
17
|
+
return {
|
|
18
|
+
signal: AbortSignal.timeout(effectiveTimeoutMs),
|
|
19
|
+
...(mergedServiceParameters
|
|
20
|
+
? { serviceParameters: mergedServiceParameters }
|
|
21
|
+
: {}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function fallbackErrorCode(error) {
|
|
25
|
+
if (error instanceof A2AOutboundError) {
|
|
26
|
+
return error.code;
|
|
27
|
+
}
|
|
28
|
+
if (error instanceof Error) {
|
|
29
|
+
return ERROR_CODES.A2A_SDK_ERROR;
|
|
30
|
+
}
|
|
31
|
+
return ERROR_CODES.INTERNAL_ERROR;
|
|
32
|
+
}
|
|
33
|
+
export class A2AOutboundService {
|
|
34
|
+
logger;
|
|
35
|
+
tracer;
|
|
36
|
+
config;
|
|
37
|
+
clientPool;
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.logger = options.logger;
|
|
40
|
+
this.tracer = options.tracer;
|
|
41
|
+
this.config = parseA2AOutboundPluginConfig(options.config);
|
|
42
|
+
this.clientPool =
|
|
43
|
+
options.clientPool ??
|
|
44
|
+
createClientPool({
|
|
45
|
+
defaultCardPath: this.config.defaults.cardPath,
|
|
46
|
+
preferredTransports: this.config.defaults.preferredTransports,
|
|
47
|
+
acceptedOutputModes: this.config.policy.acceptedOutputModes,
|
|
48
|
+
normalizeBaseUrl: this.config.policy.normalizeBaseUrl,
|
|
49
|
+
enforceSupportedTransports: this.config.policy.enforceSupportedTransports,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async delegate(input) {
|
|
53
|
+
const span = startSpan(this.tracer, "a2a.delegate");
|
|
54
|
+
let target;
|
|
55
|
+
try {
|
|
56
|
+
const validated = validateDelegateInput(input);
|
|
57
|
+
const resolved = await this.clientPool.get(validated.target);
|
|
58
|
+
target = resolved.target;
|
|
59
|
+
const messagePayload = {
|
|
60
|
+
message: validated.request.message,
|
|
61
|
+
...(validated.request.metadata !== undefined
|
|
62
|
+
? { metadata: validated.request.metadata }
|
|
63
|
+
: {}),
|
|
64
|
+
};
|
|
65
|
+
const raw = await resolved.client.sendMessage(messagePayload, requestOptions(validated.request.timeoutMs, this.config.defaults.timeoutMs, this.config.defaults.serviceParameters, validated.request.serviceParameters));
|
|
66
|
+
return delegateSuccess(target, raw);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const toolError = toToolError(error, fallbackErrorCode(error));
|
|
70
|
+
log(this.logger, "error", "a2a.delegate.error", {
|
|
71
|
+
target,
|
|
72
|
+
error: toolError,
|
|
73
|
+
});
|
|
74
|
+
return delegateFailure(target, toolError);
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
span.end?.();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async status(input) {
|
|
81
|
+
const span = startSpan(this.tracer, "a2a.status");
|
|
82
|
+
let target;
|
|
83
|
+
let taskId;
|
|
84
|
+
try {
|
|
85
|
+
const validated = validateStatusInput(input);
|
|
86
|
+
taskId = validated.request.taskId;
|
|
87
|
+
const resolved = await this.clientPool.get(validated.target);
|
|
88
|
+
target = resolved.target;
|
|
89
|
+
const params = {
|
|
90
|
+
id: validated.request.taskId,
|
|
91
|
+
...(validated.request.historyLength !== undefined
|
|
92
|
+
? { historyLength: validated.request.historyLength }
|
|
93
|
+
: {}),
|
|
94
|
+
};
|
|
95
|
+
const raw = await resolved.client.getTask(params, requestOptions(validated.request.timeoutMs, this.config.defaults.timeoutMs, this.config.defaults.serviceParameters, validated.request.serviceParameters));
|
|
96
|
+
return taskStatusSuccess(target, validated.request.taskId, raw);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const toolError = toToolError(error, fallbackErrorCode(error));
|
|
100
|
+
log(this.logger, "error", "a2a.status.error", {
|
|
101
|
+
target,
|
|
102
|
+
taskId,
|
|
103
|
+
error: toolError,
|
|
104
|
+
});
|
|
105
|
+
return taskStatusFailure(target, toolError);
|
|
106
|
+
}
|
|
107
|
+
finally {
|
|
108
|
+
span.end?.();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async cancel(input) {
|
|
112
|
+
const span = startSpan(this.tracer, "a2a.cancel");
|
|
113
|
+
let target;
|
|
114
|
+
let taskId;
|
|
115
|
+
try {
|
|
116
|
+
const validated = validateCancelInput(input);
|
|
117
|
+
taskId = validated.request.taskId;
|
|
118
|
+
const resolved = await this.clientPool.get(validated.target);
|
|
119
|
+
target = resolved.target;
|
|
120
|
+
const params = {
|
|
121
|
+
id: validated.request.taskId,
|
|
122
|
+
};
|
|
123
|
+
const raw = await resolved.client.cancelTask(params, requestOptions(validated.request.timeoutMs, this.config.defaults.timeoutMs, this.config.defaults.serviceParameters, validated.request.serviceParameters));
|
|
124
|
+
return taskCancelSuccess(target, validated.request.taskId, raw);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
const toolError = toToolError(error, fallbackErrorCode(error));
|
|
128
|
+
log(this.logger, "error", "a2a.cancel.error", {
|
|
129
|
+
target,
|
|
130
|
+
taskId,
|
|
131
|
+
error: toolError,
|
|
132
|
+
});
|
|
133
|
+
return taskCancelFailure(target, toolError);
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
span.end?.();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export function buildService(options = {}) {
|
|
141
|
+
return new A2AOutboundService(options);
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,4BAA4B,GAE7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,gBAAgB,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAoC,MAAM,cAAc,CAAC;AAChF,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,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "a2a-outbound",
|
|
3
|
+
"name": "External A2A Delegation",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"entry": "./dist/index.js",
|
|
6
|
+
"description": "Delegate requests to external A2A agents and manage delegated tasks.",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"enabled": { "type": "boolean", "default": false },
|
|
12
|
+
"defaults": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"properties": {
|
|
16
|
+
"timeoutMs": {
|
|
17
|
+
"type": "integer",
|
|
18
|
+
"minimum": 1,
|
|
19
|
+
"default": 120000
|
|
20
|
+
},
|
|
21
|
+
"cardPath": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "/.well-known/agent-card.json"
|
|
24
|
+
},
|
|
25
|
+
"preferredTransports": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["JSONRPC", "HTTP+JSON", "GRPC"]
|
|
30
|
+
},
|
|
31
|
+
"default": ["JSONRPC", "HTTP+JSON"]
|
|
32
|
+
},
|
|
33
|
+
"serviceParameters": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": { "type": "string" },
|
|
36
|
+
"default": {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"policy": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"properties": {
|
|
44
|
+
"acceptedOutputModes": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": { "type": "string" },
|
|
47
|
+
"default": []
|
|
48
|
+
},
|
|
49
|
+
"normalizeBaseUrl": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"default": true
|
|
52
|
+
},
|
|
53
|
+
"enforceSupportedTransports": {
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"default": true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|