@adcp/client 3.1.0 → 3.2.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/README.md +3 -0
- package/dist/lib/agents/index.generated.d.ts +27 -50
- package/dist/lib/agents/index.generated.d.ts.map +1 -1
- package/dist/lib/agents/index.generated.js +12 -24
- package/dist/lib/agents/index.generated.js.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.d.ts +150 -41
- package/dist/lib/core/ADCPMultiAgentClient.d.ts.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.js +150 -41
- package/dist/lib/core/ADCPMultiAgentClient.js.map +1 -1
- package/dist/lib/core/CreativeAgentClient.d.ts.map +1 -1
- package/dist/lib/core/CreativeAgentClient.js +6 -1
- package/dist/lib/core/CreativeAgentClient.js.map +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts.map +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +9 -1
- package/dist/lib/core/ProtocolResponseParser.js.map +1 -1
- package/dist/lib/core/ResponseValidator.d.ts.map +1 -1
- package/dist/lib/core/ResponseValidator.js +5 -6
- package/dist/lib/core/ResponseValidator.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +3 -8
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +1 -1
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +60 -61
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/index.d.ts +30 -15
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +86 -26
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/a2a.d.ts +2 -1
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +10 -2
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/index.d.ts +12 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +29 -14
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/types/core.generated.d.ts +185 -163
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js +2 -2
- package/dist/lib/types/schemas.generated.d.ts +3536 -3236
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +440 -365
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/tools.generated.d.ts +590 -565
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/utils/index.d.ts +3 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +10 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/response-unwrapper.d.ts +36 -0
- package/dist/lib/utils/response-unwrapper.d.ts.map +1 -0
- package/dist/lib/utils/response-unwrapper.js +331 -0
- package/dist/lib/utils/response-unwrapper.js.map +1 -0
- package/dist/lib/version.d.ts +13 -5
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +19 -5
- package/dist/lib/version.js.map +1 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# @adcp/client
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/@adcp%2Fclient)
|
|
4
|
+
[](https://www.npmjs.com/package/@adcp/client)
|
|
4
5
|
[](https://opensource.org/licenses/MIT)
|
|
5
6
|
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://adcontextprotocol.github.io/adcp-client/api/)
|
|
8
|
+
[](https://github.com/adcontextprotocol/adcp-client/actions)
|
|
6
9
|
|
|
7
10
|
Official TypeScript/JavaScript client for the **Ad Context Protocol (AdCP)**. Build distributed advertising operations that work synchronously OR asynchronously with the same code.
|
|
8
11
|
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
import type { AgentConfig } from '../types';
|
|
2
2
|
import type { GetProductsRequest, GetProductsResponse, ListCreativeFormatsRequest, ListCreativeFormatsResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, ListAuthorizedPropertiesRequest, ListAuthorizedPropertiesResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, BuildCreativeRequest, BuildCreativeResponse, PreviewCreativeRequest, PreviewCreativeResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse } from '../types/tools.generated';
|
|
3
|
-
interface ToolResponse<T> {
|
|
4
|
-
success: true;
|
|
5
|
-
data: T;
|
|
6
|
-
agent: {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
protocol: 'mcp' | 'a2a';
|
|
10
|
-
};
|
|
11
|
-
responseTimeMs: number;
|
|
12
|
-
timestamp: string;
|
|
13
|
-
debugLogs?: any[];
|
|
14
|
-
}
|
|
15
|
-
interface ToolError {
|
|
16
|
-
success: false;
|
|
17
|
-
error: string;
|
|
18
|
-
agent: {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
protocol: 'mcp' | 'a2a';
|
|
22
|
-
};
|
|
23
|
-
responseTimeMs: number;
|
|
24
|
-
timestamp: string;
|
|
25
|
-
debugLogs?: any[];
|
|
26
|
-
}
|
|
27
|
-
type ToolResult<T> = ToolResponse<T> | ToolError;
|
|
28
3
|
/**
|
|
29
4
|
* Single agent operations with full type safety
|
|
5
|
+
*
|
|
6
|
+
* Returns raw AdCP responses matching schema exactly.
|
|
7
|
+
* No SDK wrapping - responses follow AdCP discriminated union patterns.
|
|
30
8
|
*/
|
|
31
9
|
export declare class Agent {
|
|
32
10
|
private config;
|
|
@@ -37,67 +15,67 @@ export declare class Agent {
|
|
|
37
15
|
* Official AdCP get_products tool schema
|
|
38
16
|
* Official AdCP get_products tool schema
|
|
39
17
|
*/
|
|
40
|
-
getProducts(params: GetProductsRequest): Promise<
|
|
18
|
+
getProducts(params: GetProductsRequest): Promise<GetProductsResponse>;
|
|
41
19
|
/**
|
|
42
20
|
* Official AdCP list_creative_formats tool schema
|
|
43
21
|
* Official AdCP list_creative_formats tool schema
|
|
44
22
|
*/
|
|
45
|
-
listCreativeFormats(params: ListCreativeFormatsRequest): Promise<
|
|
23
|
+
listCreativeFormats(params: ListCreativeFormatsRequest): Promise<ListCreativeFormatsResponse>;
|
|
46
24
|
/**
|
|
47
25
|
* Official AdCP create_media_buy tool schema
|
|
48
26
|
* Official AdCP create_media_buy tool schema
|
|
49
27
|
*/
|
|
50
|
-
createMediaBuy(params: CreateMediaBuyRequest): Promise<
|
|
28
|
+
createMediaBuy(params: CreateMediaBuyRequest): Promise<CreateMediaBuyResponse>;
|
|
51
29
|
/**
|
|
52
30
|
* Official AdCP sync_creatives tool schema
|
|
53
31
|
* Official AdCP sync_creatives tool schema
|
|
54
32
|
*/
|
|
55
|
-
syncCreatives(params: SyncCreativesRequest): Promise<
|
|
33
|
+
syncCreatives(params: SyncCreativesRequest): Promise<SyncCreativesResponse>;
|
|
56
34
|
/**
|
|
57
35
|
* Official AdCP list_creatives tool schema
|
|
58
36
|
* Official AdCP list_creatives tool schema
|
|
59
37
|
*/
|
|
60
|
-
listCreatives(params: ListCreativesRequest): Promise<
|
|
38
|
+
listCreatives(params: ListCreativesRequest): Promise<ListCreativesResponse>;
|
|
61
39
|
/**
|
|
62
40
|
* Official AdCP update_media_buy tool schema
|
|
63
41
|
* Official AdCP update_media_buy tool schema
|
|
64
42
|
*/
|
|
65
|
-
updateMediaBuy(params: UpdateMediaBuyRequest): Promise<
|
|
43
|
+
updateMediaBuy(params: UpdateMediaBuyRequest): Promise<UpdateMediaBuyResponse>;
|
|
66
44
|
/**
|
|
67
45
|
* Official AdCP get_media_buy_delivery tool schema
|
|
68
46
|
* Official AdCP get_media_buy_delivery tool schema
|
|
69
47
|
*/
|
|
70
|
-
getMediaBuyDelivery(params: GetMediaBuyDeliveryRequest): Promise<
|
|
48
|
+
getMediaBuyDelivery(params: GetMediaBuyDeliveryRequest): Promise<GetMediaBuyDeliveryResponse>;
|
|
71
49
|
/**
|
|
72
50
|
* Official AdCP list_authorized_properties tool schema
|
|
73
51
|
* Official AdCP list_authorized_properties tool schema
|
|
74
52
|
*/
|
|
75
|
-
listAuthorizedProperties(params: ListAuthorizedPropertiesRequest): Promise<
|
|
53
|
+
listAuthorizedProperties(params: ListAuthorizedPropertiesRequest): Promise<ListAuthorizedPropertiesResponse>;
|
|
76
54
|
/**
|
|
77
55
|
* Official AdCP provide_performance_feedback tool schema
|
|
78
56
|
* Official AdCP provide_performance_feedback tool schema
|
|
79
57
|
*/
|
|
80
|
-
providePerformanceFeedback(params: ProvidePerformanceFeedbackRequest): Promise<
|
|
58
|
+
providePerformanceFeedback(params: ProvidePerformanceFeedbackRequest): Promise<ProvidePerformanceFeedbackResponse>;
|
|
81
59
|
/**
|
|
82
60
|
* Official AdCP build_creative tool schema
|
|
83
61
|
* Official AdCP build_creative tool schema
|
|
84
62
|
*/
|
|
85
|
-
buildCreative(params: BuildCreativeRequest): Promise<
|
|
63
|
+
buildCreative(params: BuildCreativeRequest): Promise<BuildCreativeResponse>;
|
|
86
64
|
/**
|
|
87
65
|
* Official AdCP preview_creative tool schema
|
|
88
66
|
* Official AdCP preview_creative tool schema
|
|
89
67
|
*/
|
|
90
|
-
previewCreative(params: PreviewCreativeRequest): Promise<
|
|
68
|
+
previewCreative(params: PreviewCreativeRequest): Promise<PreviewCreativeResponse>;
|
|
91
69
|
/**
|
|
92
70
|
* Official AdCP get_signals tool schema
|
|
93
71
|
* Official AdCP get_signals tool schema
|
|
94
72
|
*/
|
|
95
|
-
getSignals(params: GetSignalsRequest): Promise<
|
|
73
|
+
getSignals(params: GetSignalsRequest): Promise<GetSignalsResponse>;
|
|
96
74
|
/**
|
|
97
75
|
* Official AdCP activate_signal tool schema
|
|
98
76
|
* Official AdCP activate_signal tool schema
|
|
99
77
|
*/
|
|
100
|
-
activateSignal(params: ActivateSignalRequest): Promise<
|
|
78
|
+
activateSignal(params: ActivateSignalRequest): Promise<ActivateSignalResponse>;
|
|
101
79
|
}
|
|
102
80
|
/**
|
|
103
81
|
* Multi-agent operations with full type safety
|
|
@@ -111,57 +89,56 @@ export declare class AgentCollection {
|
|
|
111
89
|
* Official AdCP get_products tool schema (across multiple agents)
|
|
112
90
|
* Official AdCP get_products tool schema
|
|
113
91
|
*/
|
|
114
|
-
getProducts(params: GetProductsRequest): Promise<
|
|
92
|
+
getProducts(params: GetProductsRequest): Promise<GetProductsResponse[]>;
|
|
115
93
|
/**
|
|
116
94
|
* Official AdCP list_creative_formats tool schema (across multiple agents)
|
|
117
95
|
* Official AdCP list_creative_formats tool schema
|
|
118
96
|
*/
|
|
119
|
-
listCreativeFormats(params: ListCreativeFormatsRequest): Promise<
|
|
97
|
+
listCreativeFormats(params: ListCreativeFormatsRequest): Promise<ListCreativeFormatsResponse[]>;
|
|
120
98
|
/**
|
|
121
99
|
* Official AdCP sync_creatives tool schema (across multiple agents)
|
|
122
100
|
* Official AdCP sync_creatives tool schema
|
|
123
101
|
*/
|
|
124
|
-
syncCreatives(params: SyncCreativesRequest): Promise<
|
|
102
|
+
syncCreatives(params: SyncCreativesRequest): Promise<SyncCreativesResponse[]>;
|
|
125
103
|
/**
|
|
126
104
|
* Official AdCP list_creatives tool schema (across multiple agents)
|
|
127
105
|
* Official AdCP list_creatives tool schema
|
|
128
106
|
*/
|
|
129
|
-
listCreatives(params: ListCreativesRequest): Promise<
|
|
107
|
+
listCreatives(params: ListCreativesRequest): Promise<ListCreativesResponse[]>;
|
|
130
108
|
/**
|
|
131
109
|
* Official AdCP get_media_buy_delivery tool schema (across multiple agents)
|
|
132
110
|
* Official AdCP get_media_buy_delivery tool schema
|
|
133
111
|
*/
|
|
134
|
-
getMediaBuyDelivery(params: GetMediaBuyDeliveryRequest): Promise<
|
|
112
|
+
getMediaBuyDelivery(params: GetMediaBuyDeliveryRequest): Promise<GetMediaBuyDeliveryResponse[]>;
|
|
135
113
|
/**
|
|
136
114
|
* Official AdCP list_authorized_properties tool schema (across multiple agents)
|
|
137
115
|
* Official AdCP list_authorized_properties tool schema
|
|
138
116
|
*/
|
|
139
|
-
listAuthorizedProperties(params: ListAuthorizedPropertiesRequest): Promise<
|
|
117
|
+
listAuthorizedProperties(params: ListAuthorizedPropertiesRequest): Promise<ListAuthorizedPropertiesResponse[]>;
|
|
140
118
|
/**
|
|
141
119
|
* Official AdCP provide_performance_feedback tool schema (across multiple agents)
|
|
142
120
|
* Official AdCP provide_performance_feedback tool schema
|
|
143
121
|
*/
|
|
144
|
-
providePerformanceFeedback(params: ProvidePerformanceFeedbackRequest): Promise<
|
|
122
|
+
providePerformanceFeedback(params: ProvidePerformanceFeedbackRequest): Promise<ProvidePerformanceFeedbackResponse[]>;
|
|
145
123
|
/**
|
|
146
124
|
* Official AdCP build_creative tool schema (across multiple agents)
|
|
147
125
|
* Official AdCP build_creative tool schema
|
|
148
126
|
*/
|
|
149
|
-
buildCreative(params: BuildCreativeRequest): Promise<
|
|
127
|
+
buildCreative(params: BuildCreativeRequest): Promise<BuildCreativeResponse[]>;
|
|
150
128
|
/**
|
|
151
129
|
* Official AdCP preview_creative tool schema (across multiple agents)
|
|
152
130
|
* Official AdCP preview_creative tool schema
|
|
153
131
|
*/
|
|
154
|
-
previewCreative(params: PreviewCreativeRequest): Promise<
|
|
132
|
+
previewCreative(params: PreviewCreativeRequest): Promise<PreviewCreativeResponse[]>;
|
|
155
133
|
/**
|
|
156
134
|
* Official AdCP get_signals tool schema (across multiple agents)
|
|
157
135
|
* Official AdCP get_signals tool schema
|
|
158
136
|
*/
|
|
159
|
-
getSignals(params: GetSignalsRequest): Promise<
|
|
137
|
+
getSignals(params: GetSignalsRequest): Promise<GetSignalsResponse[]>;
|
|
160
138
|
/**
|
|
161
139
|
* Official AdCP activate_signal tool schema (across multiple agents)
|
|
162
140
|
* Official AdCP activate_signal tool schema
|
|
163
141
|
*/
|
|
164
|
-
activateSignal(params: ActivateSignalRequest): Promise<
|
|
142
|
+
activateSignal(params: ActivateSignalRequest): Promise<ActivateSignalResponse[]>;
|
|
165
143
|
}
|
|
166
|
-
export {};
|
|
167
144
|
//# sourceMappingURL=index.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.generated.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/index.generated.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,gCAAgC,EAChC,iCAAiC,EACjC,kCAAkC,EAClC,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.generated.d.ts","sourceRoot":"","sources":["../../../src/lib/agents/index.generated.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,E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,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAI1E;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAIvF"}
|
|
@@ -8,6 +8,9 @@ const validation_1 = require("../validation");
|
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
/**
|
|
10
10
|
* Single agent operations with full type safety
|
|
11
|
+
*
|
|
12
|
+
* Returns raw AdCP responses matching schema exactly.
|
|
13
|
+
* No SDK wrapping - responses follow AdCP discriminated union patterns.
|
|
11
14
|
*/
|
|
12
15
|
class Agent {
|
|
13
16
|
config;
|
|
@@ -18,40 +21,25 @@ class Agent {
|
|
|
18
21
|
this.client = client;
|
|
19
22
|
}
|
|
20
23
|
async callTool(toolName, params) {
|
|
21
|
-
const startTime = Date.now();
|
|
22
24
|
const debugLogs = [];
|
|
23
25
|
try {
|
|
24
26
|
(0, validation_1.validateAgentUrl)(this.config.agent_uri);
|
|
25
27
|
const circuitBreaker = (0, utils_1.getCircuitBreaker)(this.config.id);
|
|
26
|
-
const
|
|
28
|
+
const protocolResponse = await circuitBreaker.call(async () => {
|
|
27
29
|
return await protocols_1.ProtocolClient.callTool(this.config, toolName, params, debugLogs);
|
|
28
30
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
agent: {
|
|
33
|
-
id: this.config.id,
|
|
34
|
-
name: this.config.name,
|
|
35
|
-
protocol: this.config.protocol
|
|
36
|
-
},
|
|
37
|
-
responseTimeMs: Date.now() - startTime,
|
|
38
|
-
timestamp: new Date().toISOString(),
|
|
39
|
-
debugLogs
|
|
40
|
-
};
|
|
31
|
+
// Unwrap and validate protocol response using tool-specific Zod schema
|
|
32
|
+
const adcpResponse = (0, utils_1.unwrapProtocolResponse)(protocolResponse, toolName, this.config.protocol);
|
|
33
|
+
return adcpResponse;
|
|
41
34
|
}
|
|
42
35
|
catch (error) {
|
|
36
|
+
// Convert exceptions to AdCP error format
|
|
43
37
|
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
44
38
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
name: this.config.name,
|
|
50
|
-
protocol: this.config.protocol
|
|
51
|
-
},
|
|
52
|
-
responseTimeMs: Date.now() - startTime,
|
|
53
|
-
timestamp: new Date().toISOString(),
|
|
54
|
-
debugLogs
|
|
39
|
+
errors: [{
|
|
40
|
+
code: 'client_error',
|
|
41
|
+
message: errorMessage
|
|
42
|
+
}]
|
|
55
43
|
};
|
|
56
44
|
}
|
|
57
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.generated.js","sourceRoot":"","sources":["../../../src/lib/agents/index.generated.ts"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,4CAA4C;;;AAG5C,4CAA8C;AAC9C,8CAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.generated.js","sourceRoot":"","sources":["../../../src/lib/agents/index.generated.ts"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,4CAA4C;;;AAG5C,4CAA8C;AAC9C,8CAAiD;AACjD,oCAAqE;AA8BrE;;;;;GAKG;AACH,MAAa,KAAK;IAEN;IACA;IAFV,YACU,MAAmB,EACnB,MAAW,CAAC,qBAAqB;;QADjC,WAAM,GAAN,MAAM,CAAa;QACnB,WAAM,GAAN,MAAM,CAAK;IAClB,CAAC;IAEI,KAAK,CAAC,QAAQ,CAAI,QAAgB,EAAE,MAAW;QACrD,MAAM,SAAS,GAAU,EAAE,CAAC;QAE5B,IAAI,CAAC;YACH,IAAA,6BAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAExC,MAAM,cAAc,GAAG,IAAA,yBAAiB,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzD,MAAM,gBAAgB,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,KAAK,IA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AE,MAAM,CAAC,CAAC;IACpG,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,0BAA0B,CAAC,MAAyC;QACxE,OAAO,IAAI,CAAC,aAAa,CAAqC,8BAA8B,EAAE,MAAM,CAAC,CAAC;IACxG,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,MAA4B;QAC9C,OAAO,IAAI,CAAC,aAAa,CAAwB,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe,CAAC,MAA8B;QAClD,OAAO,IAAI,CAAC,aAAa,CAA0B,kBAAkB,EAAE,MAAM,CAAC,CAAC;IACjF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,MAAyB;QACxC,OAAO,IAAI,CAAC,aAAa,CAAqB,aAAa,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,MAA6B;QAChD,OAAO,IAAI,CAAC,aAAa,CAAyB,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;CAEF;AApGD,0CAoGC"}
|
|
@@ -6,7 +6,26 @@ import type { CreativeFormat } from './CreativeAgentClient';
|
|
|
6
6
|
import type { InputHandler, TaskOptions, TaskResult, TaskInfo } from './ConversationTypes';
|
|
7
7
|
import type { GetProductsRequest, GetProductsResponse, ListCreativeFormatsRequest, ListCreativeFormatsResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, ListAuthorizedPropertiesRequest, ListAuthorizedPropertiesResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse } from '../types/tools.generated';
|
|
8
8
|
/**
|
|
9
|
-
* Collection of agent clients for parallel operations
|
|
9
|
+
* Collection of agent clients for parallel operations across multiple AdCP agents.
|
|
10
|
+
*
|
|
11
|
+
* Provides methods to execute AdCP operations (get_products, create_media_buy, etc.)
|
|
12
|
+
* across multiple agents simultaneously using Promise.all().
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const collection = new AgentCollection([
|
|
17
|
+
* { id: 'agent1', agent_uri: 'https://agent1.com', protocol: 'a2a' },
|
|
18
|
+
* { id: 'agent2', agent_uri: 'https://agent2.com/mcp/', protocol: 'mcp' }
|
|
19
|
+
* ]);
|
|
20
|
+
*
|
|
21
|
+
* // Execute getProducts across all agents
|
|
22
|
+
* const results = await collection.getProducts({ brief: 'Coffee brands' });
|
|
23
|
+
* results.forEach((result, i) => {
|
|
24
|
+
* console.log(`Agent ${i}: ${result.status}`);
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
10
29
|
*/
|
|
11
30
|
export declare class AgentCollection {
|
|
12
31
|
private agents;
|
|
@@ -88,30 +107,92 @@ export declare class AgentCollection {
|
|
|
88
107
|
execute<T>(executor: (agent: AgentClient) => Promise<T>): Promise<T[]>;
|
|
89
108
|
}
|
|
90
109
|
/**
|
|
91
|
-
* Main multi-agent
|
|
110
|
+
* Main multi-agent AdCP client providing unified access to multiple advertising protocol agents.
|
|
111
|
+
*
|
|
112
|
+
* This is the **primary entry point** for the @adcp/client library. It provides flexible
|
|
113
|
+
* access patterns for working with one or multiple AdCP agents (MCP or A2A protocols).
|
|
114
|
+
*
|
|
115
|
+
* ## Key Features
|
|
92
116
|
*
|
|
93
|
-
*
|
|
94
|
-
* -
|
|
95
|
-
* -
|
|
96
|
-
* -
|
|
97
|
-
* -
|
|
117
|
+
* - **Single agent access** via `agent(id)` - for individual operations
|
|
118
|
+
* - **Multi-agent access** via `agents([ids])` - for parallel execution across specific agents
|
|
119
|
+
* - **Broadcast access** via `allAgents()` - for parallel execution across all configured agents
|
|
120
|
+
* - **Auto-configuration** via static factory methods (`fromConfig()`, `fromEnv()`, `fromFile()`)
|
|
121
|
+
* - **Full type safety** - all AdCP request/response types are strongly typed
|
|
122
|
+
* - **Protocol agnostic** - works seamlessly with both MCP and A2A agents
|
|
98
123
|
*
|
|
99
|
-
*
|
|
124
|
+
* ## Basic Usage
|
|
125
|
+
*
|
|
126
|
+
* @example Single agent operation
|
|
100
127
|
* ```typescript
|
|
101
128
|
* const client = new ADCPMultiAgentClient([
|
|
102
|
-
* { id: 'agent1',
|
|
103
|
-
* { id: 'agent2',
|
|
129
|
+
* { id: 'agent1', agent_uri: 'https://agent1.com', protocol: 'mcp' },
|
|
130
|
+
* { id: 'agent2', agent_uri: 'https://agent2.com', protocol: 'a2a' }
|
|
104
131
|
* ]);
|
|
105
132
|
*
|
|
106
|
-
* //
|
|
107
|
-
* const result = await client.agent('agent1').getProducts(
|
|
133
|
+
* // Execute operation on single agent
|
|
134
|
+
* const result = await client.agent('agent1').getProducts({
|
|
135
|
+
* brief: 'Coffee brands for premium audience'
|
|
136
|
+
* });
|
|
137
|
+
*
|
|
138
|
+
* if (result.status === 'completed') {
|
|
139
|
+
* console.log('Products:', result.data.products);
|
|
140
|
+
* }
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @example Multi-agent parallel execution
|
|
144
|
+
* ```typescript
|
|
145
|
+
* // Execute across specific agents
|
|
146
|
+
* const results = await client.agents(['agent1', 'agent2']).getProducts({
|
|
147
|
+
* brief: 'Coffee brands'
|
|
148
|
+
* });
|
|
108
149
|
*
|
|
109
|
-
* //
|
|
110
|
-
* const
|
|
150
|
+
* // Execute across all agents
|
|
151
|
+
* const allResults = await client.allAgents().getProducts({
|
|
152
|
+
* brief: 'Coffee brands'
|
|
153
|
+
* });
|
|
111
154
|
*
|
|
112
|
-
* //
|
|
113
|
-
*
|
|
155
|
+
* // Process results from all agents
|
|
156
|
+
* allResults.forEach((result, i) => {
|
|
157
|
+
* console.log(`Agent ${client.agentIds[i]}: ${result.status}`);
|
|
158
|
+
* if (result.status === 'completed') {
|
|
159
|
+
* console.log(` Products: ${result.data.products.length}`);
|
|
160
|
+
* }
|
|
161
|
+
* });
|
|
114
162
|
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example Auto-configuration from environment
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Load agents from environment variables or config files
|
|
167
|
+
* const client = ADCPMultiAgentClient.fromConfig();
|
|
168
|
+
*
|
|
169
|
+
* // Or from environment only
|
|
170
|
+
* const client = ADCPMultiAgentClient.fromEnv();
|
|
171
|
+
*
|
|
172
|
+
* // Or from specific file
|
|
173
|
+
* const client = ADCPMultiAgentClient.fromFile('./my-agents.json');
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* ## Available Operations
|
|
177
|
+
*
|
|
178
|
+
* All standard AdCP operations are available:
|
|
179
|
+
* - `getProducts()` - Discover advertising products
|
|
180
|
+
* - `listCreativeFormats()` - Get supported creative formats
|
|
181
|
+
* - `createMediaBuy()` - Create new media buy
|
|
182
|
+
* - `updateMediaBuy()` - Update existing media buy
|
|
183
|
+
* - `syncCreatives()` - Upload/sync creative assets
|
|
184
|
+
* - `listCreatives()` - List creative assets
|
|
185
|
+
* - `getMediaBuyDelivery()` - Get delivery performance
|
|
186
|
+
* - `listAuthorizedProperties()` - Get authorized properties
|
|
187
|
+
* - `getSignals()` - Get audience signals
|
|
188
|
+
* - `activateSignal()` - Activate audience signals
|
|
189
|
+
* - `providePerformanceFeedback()` - Send performance feedback
|
|
190
|
+
*
|
|
191
|
+
* @see {@link AgentClient} for single-agent operations
|
|
192
|
+
* @see {@link AgentCollection} for multi-agent parallel operations
|
|
193
|
+
* @see {@link SingleAgentClientConfig} for configuration options
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
115
196
|
*/
|
|
116
197
|
export declare class ADCPMultiAgentClient {
|
|
117
198
|
private config;
|
|
@@ -201,58 +282,86 @@ export declare class ADCPMultiAgentClient {
|
|
|
201
282
|
timeout?: number;
|
|
202
283
|
}): ADCPMultiAgentClient;
|
|
203
284
|
/**
|
|
204
|
-
* Get a single agent for operations
|
|
285
|
+
* Get a single agent client for individual operations.
|
|
205
286
|
*
|
|
206
|
-
*
|
|
207
|
-
* @
|
|
208
|
-
*
|
|
287
|
+
* This is the primary method for executing operations on a specific agent.
|
|
288
|
+
* Returns an {@link AgentClient} instance that provides all AdCP operations.
|
|
289
|
+
*
|
|
290
|
+
* @param agentId - The unique identifier of the agent to retrieve
|
|
291
|
+
* @returns Agent client instance for the specified agent
|
|
292
|
+
* @throws {Error} If agent ID is not found in configuration
|
|
209
293
|
*
|
|
210
294
|
* @example
|
|
211
295
|
* ```typescript
|
|
212
|
-
* const
|
|
213
|
-
*
|
|
214
|
-
*
|
|
296
|
+
* const client = new ADCPMultiAgentClient([
|
|
297
|
+
* { id: 'sales_agent', agent_uri: 'https://sales.example.com', protocol: 'a2a' }
|
|
298
|
+
* ]);
|
|
299
|
+
*
|
|
300
|
+
* // Get specific agent and execute operation
|
|
301
|
+
* const agent = client.agent('sales_agent');
|
|
302
|
+
* const result = await agent.getProducts({ brief: 'Premium coffee brands' });
|
|
215
303
|
* ```
|
|
304
|
+
*
|
|
305
|
+
* @see {@link AgentClient} for available operations
|
|
216
306
|
*/
|
|
217
307
|
agent(agentId: string): AgentClient;
|
|
218
308
|
/**
|
|
219
|
-
* Get multiple specific agents for parallel operations
|
|
309
|
+
* Get multiple specific agents for parallel operations.
|
|
220
310
|
*
|
|
221
|
-
* @
|
|
222
|
-
*
|
|
223
|
-
*
|
|
311
|
+
* Returns an {@link AgentCollection} that executes operations across the specified
|
|
312
|
+
* agents in parallel using Promise.all(). Useful when you want to query specific
|
|
313
|
+
* agents simultaneously and compare results.
|
|
314
|
+
*
|
|
315
|
+
* @param agentIds - Array of agent IDs to include in the collection
|
|
316
|
+
* @returns Agent collection for parallel operations across specified agents
|
|
317
|
+
* @throws {Error} If any agent ID is not found in configuration
|
|
224
318
|
*
|
|
225
319
|
* @example
|
|
226
320
|
* ```typescript
|
|
227
|
-
*
|
|
228
|
-
* const results = await agents
|
|
321
|
+
* // Execute across specific agents
|
|
322
|
+
* const results = await client.agents(['sales_agent_1', 'sales_agent_2']).getProducts({
|
|
323
|
+
* brief: 'Premium coffee brands'
|
|
324
|
+
* });
|
|
229
325
|
*
|
|
230
|
-
* // Process results
|
|
231
|
-
* results.forEach(result => {
|
|
232
|
-
* if (result.
|
|
233
|
-
* console.log(
|
|
326
|
+
* // Process parallel results
|
|
327
|
+
* results.forEach((result, i) => {
|
|
328
|
+
* if (result.status === 'completed') {
|
|
329
|
+
* console.log(`Agent ${i + 1}: ${result.data.products.length} products`);
|
|
234
330
|
* }
|
|
235
331
|
* });
|
|
236
332
|
* ```
|
|
333
|
+
*
|
|
334
|
+
* @see {@link AgentCollection} for available parallel operations
|
|
237
335
|
*/
|
|
238
336
|
agents(agentIds: string[]): AgentCollection;
|
|
239
337
|
/**
|
|
240
|
-
* Get all configured agents for broadcast operations
|
|
338
|
+
* Get all configured agents for broadcast operations.
|
|
241
339
|
*
|
|
242
|
-
* @
|
|
340
|
+
* Returns an {@link AgentCollection} containing all agents in the client configuration.
|
|
341
|
+
* Executes operations across all agents in parallel, useful for market research,
|
|
342
|
+
* price comparison, or discovering capabilities across your entire agent network.
|
|
343
|
+
*
|
|
344
|
+
* @returns Agent collection for parallel operations across all configured agents
|
|
243
345
|
*
|
|
244
346
|
* @example
|
|
245
347
|
* ```typescript
|
|
348
|
+
* const client = new ADCPMultiAgentClient([
|
|
349
|
+
* { id: 'agent1', agent_uri: 'https://agent1.com', protocol: 'a2a' },
|
|
350
|
+
* { id: 'agent2', agent_uri: 'https://agent2.com', protocol: 'mcp' },
|
|
351
|
+
* { id: 'agent3', agent_uri: 'https://agent3.com', protocol: 'a2a' }
|
|
352
|
+
* ]);
|
|
353
|
+
*
|
|
354
|
+
* // Query all agents simultaneously
|
|
246
355
|
* const allResults = await client.allAgents().getProducts({
|
|
247
356
|
* brief: 'Premium coffee brands'
|
|
248
|
-
* }
|
|
357
|
+
* });
|
|
249
358
|
*
|
|
250
|
-
* // Find best
|
|
251
|
-
* const
|
|
252
|
-
*
|
|
253
|
-
* b.data.products.length - a.data.products.length
|
|
254
|
-
* )[0];
|
|
359
|
+
* // Find best options across all agents
|
|
360
|
+
* const successfulResults = allResults.filter(r => r.status === 'completed');
|
|
361
|
+
* console.log(`Got products from ${successfulResults.length} agents`);
|
|
255
362
|
* ```
|
|
363
|
+
*
|
|
364
|
+
* @see {@link AgentCollection} for available parallel operations
|
|
256
365
|
*/
|
|
257
366
|
allAgents(): AgentCollection;
|
|
258
367
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ADCPMultiAgentClient.d.ts","sourceRoot":"","sources":["../../../src/lib/core/ADCPMultiAgentClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAA4B,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,gCAAgC,EAChC,iCAAiC,EACjC,kCAAkC,EAClC,iBAAiB,EACjB,kB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