@adcp/sdk 15.7.1 → 15.8.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/dist/lib/core/SingleAgentClient.d.mts +14 -0
- package/dist/lib/core/SingleAgentClient.d.ts +14 -0
- package/dist/lib/core/SingleAgentClient.js +138 -54
- package/dist/lib/core/SingleAgentClient.mjs +141 -54
- package/dist/lib/core/agent-discovery-cache.d.mts +2 -0
- package/dist/lib/core/agent-discovery-cache.d.ts +2 -0
- package/dist/lib/core/creative-schema-support.d.mts +3 -0
- package/dist/lib/core/creative-schema-support.d.ts +3 -0
- package/dist/lib/core/creative-schema-support.js +113 -0
- package/dist/lib/core/creative-schema-support.mjs +89 -0
- package/dist/lib/core/product-cache.js +4 -3
- package/dist/lib/core/product-cache.mjs +4 -3
- package/dist/lib/reporting/ledger/handler.d.mts +10 -3
- package/dist/lib/reporting/ledger/handler.d.ts +10 -3
- package/dist/lib/reporting/ledger/handler.js +17 -4
- package/dist/lib/reporting/ledger/handler.mjs +17 -4
- package/dist/lib/reporting/ledger/managed.d.mts +3 -1
- package/dist/lib/reporting/ledger/managed.d.ts +3 -1
- package/dist/lib/reporting/ledger/managed.js +4 -1
- package/dist/lib/reporting/ledger/managed.mjs +4 -1
- package/dist/lib/reporting/ledger/postgres.d.mts +87 -0
- package/dist/lib/reporting/ledger/postgres.d.ts +87 -0
- package/dist/lib/reporting/ledger/postgres.js +316 -15
- package/dist/lib/reporting/ledger/postgres.mjs +316 -15
- package/dist/lib/reporting/ledger/row-storage.d.mts +23 -0
- package/dist/lib/reporting/ledger/row-storage.d.ts +23 -0
- package/dist/lib/reporting/ledger/row-storage.js +56 -0
- package/dist/lib/reporting/ledger/row-storage.mjs +56 -0
- package/dist/lib/reporting/ledger/types.d.mts +26 -0
- package/dist/lib/reporting/ledger/types.d.ts +26 -0
- package/dist/lib/reporting/service/index.d.mts +33 -3
- package/dist/lib/reporting/service/index.d.ts +33 -3
- package/dist/lib/reporting/service/index.js +20 -2
- package/dist/lib/reporting/service/index.mjs +20 -2
- package/dist/lib/reporting/service/maintenance.d.mts +20 -1
- package/dist/lib/reporting/service/maintenance.d.ts +20 -1
- package/dist/lib/reporting/service/maintenance.js +25 -2
- package/dist/lib/reporting/service/maintenance.mjs +25 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/request-builder.js +14 -16
- package/dist/lib/testing/storyboard/request-builder.mjs +14 -16
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +22 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts +22 -0
- package/dist/lib/v2/projection/creative-delivery.js +92 -0
- package/dist/lib/v2/projection/creative-delivery.mjs +91 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +6 -3
- package/dist/lib/v2/projection/legacy-metadata.d.ts +6 -3
- package/dist/lib/v2/projection/legacy-metadata.js +17 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +15 -0
- 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.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/CREATIVE-DELIVERY.md +16 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +405 -0
- package/docs/guides/REPORTING-LEDGER.md +130 -0
- package/docs/guides/REPORTING-OPERATIONS.md +12 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
|
@@ -595,6 +595,19 @@ export declare class SingleAgentClient {
|
|
|
595
595
|
private rememberCanonicalLegacyRoute;
|
|
596
596
|
private invalidateCanonicalProductRoutes;
|
|
597
597
|
private rememberCanonicalProductRoutes;
|
|
598
|
+
/**
|
|
599
|
+
* Option refs each product declared in the seller's own response. A product
|
|
600
|
+
* absent from the response yields no entry, so its options are treated as
|
|
601
|
+
* declared rather than guessed undeclared.
|
|
602
|
+
*/
|
|
603
|
+
private sellerDeclaredFormatOptions;
|
|
604
|
+
/**
|
|
605
|
+
* The direct selector for an option this client derived from the seller's
|
|
606
|
+
* legacy `format_ids`. Without a product id, every remembered route for the
|
|
607
|
+
* option must agree that the seller did not declare it.
|
|
608
|
+
*/
|
|
609
|
+
private undeclaredFormatOptionSelector;
|
|
610
|
+
private projectUndeclaredFormatOptions;
|
|
598
611
|
private rememberCanonicalProductRoutesForCompletion;
|
|
599
612
|
private routeForOption;
|
|
600
613
|
private routeForPackage;
|
|
@@ -995,6 +1008,7 @@ export declare class SingleAgentClient {
|
|
|
995
1008
|
* `CreativeFormatCapabilityError`, just as they do during a write.
|
|
996
1009
|
*/
|
|
997
1010
|
resolveCreativeFormatWireMode(taskType: 'sync_creatives' | 'create_media_buy' | 'update_media_buy', options?: ReadRequestOptions): Promise<CreativeFormatWireMode>;
|
|
1011
|
+
private resolveCreativeWireMode;
|
|
998
1012
|
/** Validate malformed creative payloads before capability discovery can perform I/O. */
|
|
999
1013
|
private validateBeforeCreativeCapabilityProbe;
|
|
1000
1014
|
/**
|
|
@@ -595,6 +595,19 @@ export declare class SingleAgentClient {
|
|
|
595
595
|
private rememberCanonicalLegacyRoute;
|
|
596
596
|
private invalidateCanonicalProductRoutes;
|
|
597
597
|
private rememberCanonicalProductRoutes;
|
|
598
|
+
/**
|
|
599
|
+
* Option refs each product declared in the seller's own response. A product
|
|
600
|
+
* absent from the response yields no entry, so its options are treated as
|
|
601
|
+
* declared rather than guessed undeclared.
|
|
602
|
+
*/
|
|
603
|
+
private sellerDeclaredFormatOptions;
|
|
604
|
+
/**
|
|
605
|
+
* The direct selector for an option this client derived from the seller's
|
|
606
|
+
* legacy `format_ids`. Without a product id, every remembered route for the
|
|
607
|
+
* option must agree that the seller did not declare it.
|
|
608
|
+
*/
|
|
609
|
+
private undeclaredFormatOptionSelector;
|
|
610
|
+
private projectUndeclaredFormatOptions;
|
|
598
611
|
private rememberCanonicalProductRoutesForCompletion;
|
|
599
612
|
private routeForOption;
|
|
600
613
|
private routeForPackage;
|
|
@@ -995,6 +1008,7 @@ export declare class SingleAgentClient {
|
|
|
995
1008
|
* `CreativeFormatCapabilityError`, just as they do during a write.
|
|
996
1009
|
*/
|
|
997
1010
|
resolveCreativeFormatWireMode(taskType: 'sync_creatives' | 'create_media_buy' | 'update_media_buy', options?: ReadRequestOptions): Promise<CreativeFormatWireMode>;
|
|
1011
|
+
private resolveCreativeWireMode;
|
|
998
1012
|
/** Validate malformed creative payloads before capability discovery can perform I/O. */
|
|
999
1013
|
private validateBeforeCreativeCapabilityProbe;
|
|
1000
1014
|
/**
|
|
@@ -97,6 +97,7 @@ function presentedStaticTransportCredential(authToken, headers, authProvider) {
|
|
|
97
97
|
return normalized === "authorization" || normalized === "x-adcp-auth";
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
const toolInputSchemasByProperties = /* @__PURE__ */ new WeakMap();
|
|
100
101
|
const CAPABILITY_DISCOVERY_CONTEXT = /* @__PURE__ */ Symbol("capabilityDiscoveryContext");
|
|
101
102
|
function a2aUrlString(input) {
|
|
102
103
|
return typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -143,32 +144,6 @@ function selectA2AJsonRpcUrl(agentCard, protocolVersion, configuredAgentUrl) {
|
|
|
143
144
|
}
|
|
144
145
|
return resolved.toString();
|
|
145
146
|
}
|
|
146
|
-
function creativeSchemaSupport(value, depth = 0) {
|
|
147
|
-
if (depth > 24 || value === null || typeof value !== "object") return "unknown";
|
|
148
|
-
if (Array.isArray(value)) {
|
|
149
|
-
let legacy2 = false;
|
|
150
|
-
for (const item of value) {
|
|
151
|
-
const support = creativeSchemaSupport(item, depth + 1);
|
|
152
|
-
if (support === "canonical") return support;
|
|
153
|
-
if (support === "legacy") legacy2 = true;
|
|
154
|
-
}
|
|
155
|
-
return legacy2 ? "legacy" : "unknown";
|
|
156
|
-
}
|
|
157
|
-
const object = value;
|
|
158
|
-
const properties = object.properties;
|
|
159
|
-
if (properties !== null && typeof properties === "object" && !Array.isArray(properties)) {
|
|
160
|
-
const keys = properties;
|
|
161
|
-
if ("creative_id" in keys && "format_kind" in keys) return "canonical";
|
|
162
|
-
if ("creative_id" in keys && "format_id" in keys) return "legacy";
|
|
163
|
-
}
|
|
164
|
-
let legacy = false;
|
|
165
|
-
for (const child of Object.values(object)) {
|
|
166
|
-
const support = creativeSchemaSupport(child, depth + 1);
|
|
167
|
-
if (support === "canonical") return support;
|
|
168
|
-
if (support === "legacy") legacy = true;
|
|
169
|
-
}
|
|
170
|
-
return legacy ? "legacy" : "unknown";
|
|
171
|
-
}
|
|
172
147
|
function hasMediaBuyCreativeFormatData(request) {
|
|
173
148
|
if (request === null || typeof request !== "object" || Array.isArray(request)) return false;
|
|
174
149
|
const record = request;
|
|
@@ -1329,9 +1304,10 @@ class SingleAgentClient {
|
|
|
1329
1304
|
}
|
|
1330
1305
|
}
|
|
1331
1306
|
}
|
|
1332
|
-
rememberCanonicalProductRoutes(products, account, authoritativeProducts
|
|
1333
|
-
this.invalidateCanonicalProductRoutes(authoritativeProducts, account);
|
|
1307
|
+
rememberCanonicalProductRoutes(products, account, authoritativeProducts) {
|
|
1308
|
+
this.invalidateCanonicalProductRoutes(authoritativeProducts ?? products, account);
|
|
1334
1309
|
const accountScope = this.canonicalAccountScope(account);
|
|
1310
|
+
const declaredOptions = authoritativeProducts ? this.sellerDeclaredFormatOptions(authoritativeProducts) : void 0;
|
|
1335
1311
|
for (const value of products) {
|
|
1336
1312
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
1337
1313
|
const product = value;
|
|
@@ -1347,16 +1323,78 @@ class SingleAgentClient {
|
|
|
1347
1323
|
} : { scope: "product", format_option_id: option.format_option_id };
|
|
1348
1324
|
const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
|
|
1349
1325
|
if (refs.length === 0) continue;
|
|
1326
|
+
const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
|
|
1327
|
+
if (declared !== void 0) (0, import_legacy_metadata.rememberSellerDeclaredFormatOption)(option, declared);
|
|
1350
1328
|
this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
|
|
1351
1329
|
kind: "product",
|
|
1352
1330
|
accountScope,
|
|
1353
1331
|
productId: product.product_id,
|
|
1354
1332
|
optionRef: ref,
|
|
1355
|
-
refs
|
|
1333
|
+
refs,
|
|
1334
|
+
...declared === false ? {
|
|
1335
|
+
undeclaredSelector: {
|
|
1336
|
+
format_kind: typeof option.format_kind === "string" ? option.format_kind : "",
|
|
1337
|
+
...option.params !== void 0 && { params: structuredClone(option.params) },
|
|
1338
|
+
...(typeof option.format_kind !== "string" || option.format_kind === "custom" || option.format_shape !== void 0 || option.format_schema !== void 0) && { unrepresentable: true }
|
|
1339
|
+
}
|
|
1340
|
+
} : {}
|
|
1356
1341
|
});
|
|
1357
1342
|
}
|
|
1358
1343
|
}
|
|
1359
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Option refs each product declared in the seller's own response. A product
|
|
1347
|
+
* absent from the response yields no entry, so its options are treated as
|
|
1348
|
+
* declared rather than guessed undeclared.
|
|
1349
|
+
*/
|
|
1350
|
+
sellerDeclaredFormatOptions(authoritativeProducts) {
|
|
1351
|
+
const declared = /* @__PURE__ */ new Map();
|
|
1352
|
+
for (const value of authoritativeProducts) {
|
|
1353
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
1354
|
+
const product = value;
|
|
1355
|
+
if (typeof product.product_id !== "string") continue;
|
|
1356
|
+
const refs = [];
|
|
1357
|
+
for (const optionValue of Array.isArray(product.format_options) ? product.format_options : []) {
|
|
1358
|
+
if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
|
|
1359
|
+
const option = optionValue;
|
|
1360
|
+
if (typeof option.format_option_id !== "string") continue;
|
|
1361
|
+
refs.push(
|
|
1362
|
+
typeof option.publisher_domain === "string" ? {
|
|
1363
|
+
scope: "publisher",
|
|
1364
|
+
publisher_domain: option.publisher_domain,
|
|
1365
|
+
format_option_id: option.format_option_id
|
|
1366
|
+
} : { scope: "product", format_option_id: option.format_option_id }
|
|
1367
|
+
);
|
|
1368
|
+
}
|
|
1369
|
+
declared.set(product.product_id, refs);
|
|
1370
|
+
}
|
|
1371
|
+
return declared;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* The direct selector for an option this client derived from the seller's
|
|
1375
|
+
* legacy `format_ids`. Without a product id, every remembered route for the
|
|
1376
|
+
* option must agree that the seller did not declare it.
|
|
1377
|
+
*/
|
|
1378
|
+
undeclaredFormatOptionSelector(account, ref, productId) {
|
|
1379
|
+
if (productId !== void 0) {
|
|
1380
|
+
const route = this.routeForOption(account, productId, ref);
|
|
1381
|
+
return route?.kind === "product" ? route.undeclaredSelector : void 0;
|
|
1382
|
+
}
|
|
1383
|
+
const accountScope = this.canonicalAccountScope(account);
|
|
1384
|
+
const routes = [...this.canonicalLegacyRoutes.values()].filter(
|
|
1385
|
+
(route) => route.kind === "product" && (route.accountScope === accountScope || route.accountScope === "none") && this.sameCanonicalOptionRef(route.optionRef, ref)
|
|
1386
|
+
);
|
|
1387
|
+
if (routes.length === 0 || routes.some((route) => route.undeclaredSelector === void 0)) return void 0;
|
|
1388
|
+
return routes[0].undeclaredSelector;
|
|
1389
|
+
}
|
|
1390
|
+
projectUndeclaredFormatOptions(request, operation, wireMode, account) {
|
|
1391
|
+
if (wireMode !== "canonical") return request;
|
|
1392
|
+
return (0, import_creative_delivery.projectUndeclaredFormatOptionSelectors)(
|
|
1393
|
+
request,
|
|
1394
|
+
operation,
|
|
1395
|
+
(ref, productId) => this.undeclaredFormatOptionSelector(account, ref, productId)
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1360
1398
|
rememberCanonicalProductRoutesForCompletion(taskType, data, legacyFormatConverter, account) {
|
|
1361
1399
|
if (taskType !== "get_products" || !data || typeof data !== "object" || Array.isArray(data)) return;
|
|
1362
1400
|
const authoritativeProducts = Array.isArray(data.products) ? data.products : [];
|
|
@@ -4485,7 +4523,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4485
4523
|
if (hit) {
|
|
4486
4524
|
(0, import_abort2.throwIfAborted)(effectiveOptions.signal);
|
|
4487
4525
|
if (hit.success && hit.status === "completed")
|
|
4488
|
-
this.rememberCanonicalProductRoutes(hit.data.products ?? [], account
|
|
4526
|
+
this.rememberCanonicalProductRoutes(hit.data.products ?? [], account);
|
|
4489
4527
|
return (0, import_match.attachMatch)(
|
|
4490
4528
|
await this.applyProductPropertyPolicy(
|
|
4491
4529
|
hit,
|
|
@@ -4529,11 +4567,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4529
4567
|
[SKIP_PRODUCT_CACHE]: true
|
|
4530
4568
|
});
|
|
4531
4569
|
}
|
|
4532
|
-
this.rememberCanonicalProductRoutes(
|
|
4533
|
-
cachedResult.data.products ?? [],
|
|
4534
|
-
account,
|
|
4535
|
-
cachedResult.data.products ?? []
|
|
4536
|
-
);
|
|
4570
|
+
this.rememberCanonicalProductRoutes(cachedResult.data.products ?? [], account);
|
|
4537
4571
|
}
|
|
4538
4572
|
if (cachedResult.submitted) {
|
|
4539
4573
|
const submitted = cachedResult.submitted;
|
|
@@ -4689,12 +4723,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4689
4723
|
const result = await this.executeAndHandle(
|
|
4690
4724
|
"create_media_buy",
|
|
4691
4725
|
"onCreateMediaBuyStatusChange",
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4726
|
+
this.projectUndeclaredFormatOptions(
|
|
4727
|
+
(0, import_creative_delivery.projectMediaBuyCreativesForDelivery)(
|
|
4728
|
+
wireParams,
|
|
4729
|
+
wireMode,
|
|
4730
|
+
"create_media_buy",
|
|
4731
|
+
effectiveLegacyFormatConverter,
|
|
4732
|
+
effectiveCanonicalFormatLegacyResolver
|
|
4733
|
+
),
|
|
4695
4734
|
"create_media_buy",
|
|
4696
|
-
|
|
4697
|
-
|
|
4735
|
+
wireMode,
|
|
4736
|
+
wireParams.account
|
|
4698
4737
|
),
|
|
4699
4738
|
inputHandler,
|
|
4700
4739
|
taskOptions,
|
|
@@ -4770,12 +4809,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4770
4809
|
const result = await this.executeAndHandle(
|
|
4771
4810
|
"update_media_buy",
|
|
4772
4811
|
"onUpdateMediaBuyStatusChange",
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4812
|
+
this.projectUndeclaredFormatOptions(
|
|
4813
|
+
(0, import_creative_delivery.projectMediaBuyCreativesForDelivery)(
|
|
4814
|
+
params,
|
|
4815
|
+
wireMode,
|
|
4816
|
+
"update_media_buy",
|
|
4817
|
+
effectiveLegacyFormatConverter,
|
|
4818
|
+
effectiveCanonicalFormatLegacyResolver
|
|
4819
|
+
),
|
|
4776
4820
|
"update_media_buy",
|
|
4777
|
-
|
|
4778
|
-
|
|
4821
|
+
wireMode,
|
|
4822
|
+
params.account
|
|
4779
4823
|
),
|
|
4780
4824
|
inputHandler,
|
|
4781
4825
|
taskOptions,
|
|
@@ -4861,12 +4905,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4861
4905
|
const assignmentPackageContainers = Array.isArray(params.assignments) ? params.assignments.flatMap(
|
|
4862
4906
|
(assignment) => typeof assignment.package_id === "string" && !configuredPackageIds.has(assignment.package_id) ? [{ package_id: assignment.package_id }] : []
|
|
4863
4907
|
) : [];
|
|
4864
|
-
const wireParams =
|
|
4865
|
-
|
|
4866
|
-
|
|
4908
|
+
const wireParams = this.projectUndeclaredFormatOptions(
|
|
4909
|
+
(0, import_creative_delivery.projectSyncCreativesForDelivery)(
|
|
4910
|
+
params,
|
|
4911
|
+
[...configuredSelectorContainers, ...assignmentPackageContainers],
|
|
4912
|
+
wireMode,
|
|
4913
|
+
effectiveLegacyFormatConverter,
|
|
4914
|
+
effectiveCanonicalFormatLegacyResolver
|
|
4915
|
+
),
|
|
4916
|
+
"sync_creatives",
|
|
4867
4917
|
wireMode,
|
|
4868
|
-
|
|
4869
|
-
effectiveCanonicalFormatLegacyResolver
|
|
4918
|
+
params.account
|
|
4870
4919
|
);
|
|
4871
4920
|
return this.executeAndHandle(
|
|
4872
4921
|
"sync_creatives",
|
|
@@ -4905,6 +4954,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4905
4954
|
* `CreativeFormatCapabilityError`, just as they do during a write.
|
|
4906
4955
|
*/
|
|
4907
4956
|
async resolveCreativeFormatWireMode(taskType, options) {
|
|
4957
|
+
return this.resolveCreativeWireMode(taskType, options, true);
|
|
4958
|
+
}
|
|
4959
|
+
async resolveCreativeWireMode(taskType, options, canRediscover) {
|
|
4908
4960
|
const discoveryContext = {};
|
|
4909
4961
|
const capabilities = await this.getCapabilities({
|
|
4910
4962
|
...options,
|
|
@@ -4914,7 +4966,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4914
4966
|
const toolSchemas = discoveryContext.toolSchemas ?? (usesScopedFetch ? void 0 : this.cachedToolSchemas);
|
|
4915
4967
|
const wireRelease = this.config.wireAdcpVersion ?? this.resolvedAdcpVersion;
|
|
4916
4968
|
const declared = (0, import_creative_delivery.resolveCreativeFormatWireMode)(capabilities, wireRelease);
|
|
4917
|
-
const
|
|
4969
|
+
const document = toolSchemas && toolInputSchemasByProperties.get(toolSchemas)?.get(taskType);
|
|
4970
|
+
const { creativeSchemaSupport } = await import("./creative-schema-support.js");
|
|
4971
|
+
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
4972
|
+
const schema = creativeSchemaSupport(document ?? { properties: toolSchemas?.get(taskType) });
|
|
4918
4973
|
if (declared !== "unknown" && schema !== "unknown" && declared !== schema) {
|
|
4919
4974
|
throw new import_creative_delivery.CreativeFormatCapabilityError(
|
|
4920
4975
|
`Seller capability and ${taskType} input schema disagree about canonical creative support`
|
|
@@ -4924,6 +4979,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4924
4979
|
const release = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(wireRelease.trim());
|
|
4925
4980
|
const canonicalRequiredByBuyerPin = release !== null && (Number(release[1]) > 3 || Number(release[1]) === 3 && Number(release[2]) >= 2);
|
|
4926
4981
|
if (resolved === "unknown" && canonicalRequiredByBuyerPin) {
|
|
4982
|
+
if (canRediscover && !usesScopedFetch && this.normalizedAgent.protocol === "mcp" && this.capabilitiesFromSharedCache && toolSchemas?.has(taskType) && !toolInputSchemasByProperties.has(toolSchemas)) {
|
|
4983
|
+
await this.invalidateDiscoveryCache(options);
|
|
4984
|
+
return this.resolveCreativeWireMode(taskType, options, false);
|
|
4985
|
+
}
|
|
4927
4986
|
throw new import_creative_delivery.CreativeFormatCapabilityError(
|
|
4928
4987
|
`Cannot prove which AdCP release the seller serves for ${taskType}; a 3.2+ client will not guess a legacy creative wire shape`
|
|
4929
4988
|
);
|
|
@@ -6583,11 +6642,20 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6583
6642
|
if (toolSchemas !== void 0 && !isToolSchemaRecord(toolSchemas)) {
|
|
6584
6643
|
return void 0;
|
|
6585
6644
|
}
|
|
6645
|
+
if (entry.toolInputSchemas !== void 0 && (!toolSchemas || !isToolSchemaRecord(entry.toolInputSchemas))) {
|
|
6646
|
+
return void 0;
|
|
6647
|
+
}
|
|
6586
6648
|
let installed;
|
|
6587
6649
|
let schemas;
|
|
6588
6650
|
try {
|
|
6589
6651
|
installed = structuredClone(capabilities);
|
|
6590
6652
|
schemas = toolSchemas ? new Map(Object.entries(toolSchemas).map(([tool, properties]) => [tool, structuredClone(properties)])) : void 0;
|
|
6653
|
+
if (schemas && entry.toolInputSchemas) {
|
|
6654
|
+
toolInputSchemasByProperties.set(
|
|
6655
|
+
schemas,
|
|
6656
|
+
new Map(Object.entries(entry.toolInputSchemas).map(([tool, schema]) => [tool, structuredClone(schema)]))
|
|
6657
|
+
);
|
|
6658
|
+
}
|
|
6591
6659
|
} catch {
|
|
6592
6660
|
return void 0;
|
|
6593
6661
|
}
|
|
@@ -6608,9 +6676,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6608
6676
|
name: t.name,
|
|
6609
6677
|
description: t.description
|
|
6610
6678
|
}));
|
|
6679
|
+
const discoveredInputSchemas = new Map(
|
|
6680
|
+
agentInfo.tools.filter((t) => t.inputSchema).map((t) => [t.name, t.inputSchema])
|
|
6681
|
+
);
|
|
6611
6682
|
const discoveredToolSchemas = new Map(
|
|
6612
|
-
|
|
6683
|
+
[...discoveredInputSchemas].map(([name, schema]) => [name, schema.properties ?? {}])
|
|
6613
6684
|
);
|
|
6685
|
+
toolInputSchemasByProperties.set(discoveredToolSchemas, discoveredInputSchemas);
|
|
6614
6686
|
if (discoveryContext) discoveryContext.toolSchemas = discoveredToolSchemas;
|
|
6615
6687
|
if (!usesScopedFetch && !superseded()) this.cachedToolSchemas = discoveredToolSchemas;
|
|
6616
6688
|
const advertisesCapabilitiesTool = tools.some((t) => t.name === "get_adcp_capabilities");
|
|
@@ -6653,7 +6725,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6653
6725
|
options,
|
|
6654
6726
|
{
|
|
6655
6727
|
capabilities: structuredClone(capabilities2),
|
|
6656
|
-
toolSchemas: Object.fromEntries(discoveredToolSchemas)
|
|
6728
|
+
toolSchemas: Object.fromEntries(discoveredToolSchemas),
|
|
6729
|
+
toolInputSchemas: Object.fromEntries(discoveredInputSchemas)
|
|
6657
6730
|
},
|
|
6658
6731
|
false,
|
|
6659
6732
|
startedAtEpoch
|
|
@@ -7051,7 +7124,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7051
7124
|
const key = this.sharedDiscoveryKey(options);
|
|
7052
7125
|
if (!key) return void 0;
|
|
7053
7126
|
if (patch.endpoint && !this.isDiscoverableEndpoint(patch.endpoint.agentUri)) {
|
|
7054
|
-
patch = {
|
|
7127
|
+
patch = {
|
|
7128
|
+
capabilities: patch.capabilities,
|
|
7129
|
+
toolSchemas: patch.toolSchemas,
|
|
7130
|
+
toolInputSchemas: patch.toolInputSchemas
|
|
7131
|
+
};
|
|
7055
7132
|
if (!patch.capabilities && !patch.toolSchemas) return void 0;
|
|
7056
7133
|
}
|
|
7057
7134
|
const config = this.config.discoveryCache;
|
|
@@ -7079,10 +7156,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7079
7156
|
const entry = {
|
|
7080
7157
|
...existing?.capabilities && { capabilities: existing.capabilities },
|
|
7081
7158
|
...existing?.toolSchemas && { toolSchemas: existing.toolSchemas },
|
|
7159
|
+
// Endpoint-only writes retain schema documents. Fresh tool evidence
|
|
7160
|
+
// replaces them together, including clearing older full documents
|
|
7161
|
+
// when the caller supplies only a property map.
|
|
7162
|
+
...patch.toolSchemas === void 0 && existing?.toolInputSchemas && {
|
|
7163
|
+
toolInputSchemas: existing.toolInputSchemas
|
|
7164
|
+
},
|
|
7082
7165
|
...existing?.endpoint && { endpoint: existing.endpoint },
|
|
7083
7166
|
...patch.endpoint && { endpoint: { ...patch.endpoint, observedAt: now } },
|
|
7084
7167
|
...patch.capabilities && { capabilities: patch.capabilities },
|
|
7085
7168
|
...patch.toolSchemas && { toolSchemas: patch.toolSchemas },
|
|
7169
|
+
...patch.toolInputSchemas && { toolInputSchemas: patch.toolInputSchemas },
|
|
7086
7170
|
observedAt: restartsClock || !existing ? now : Math.min(existing.observedAt, now),
|
|
7087
7171
|
expiresAt: restartsClock || !existing ? now + ttl : Math.min(existing.expiresAt, now + ttl)
|
|
7088
7172
|
};
|