@adcp/sdk 17.0.0-beta.18 → 17.0.0-beta.19

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.
@@ -5761,7 +5761,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5761
5761
  "sync_creatives",
5762
5762
  taskOptions,
5763
5763
  true,
5764
- () => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, options)
5764
+ () => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, {
5765
+ ...options,
5766
+ legacyFormatConverter: effectiveLegacyFormatConverter,
5767
+ canonicalFormatLegacyResolver: effectiveCanonicalFormatLegacyResolver
5768
+ })
5765
5769
  );
5766
5770
  const wireParams = this.projectUndeclaredFormatOptions(
5767
5771
  (0, import_creative_delivery.projectSyncCreativesForDelivery)(
@@ -5930,21 +5934,56 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5930
5934
  if (!Array.isArray(request.creatives) || request.creatives.length === 0) return false;
5931
5935
  const creatives = request.creatives;
5932
5936
  const assignments = Array.isArray(request.assignments) ? request.assignments : [];
5933
- if (!assignments.every(
5937
+ const operations = Array.isArray(request.assignment_operations) ? request.assignment_operations : [];
5938
+ if (request.assignments !== void 0 && !Array.isArray(request.assignments) || request.assignment_operations !== void 0 && !Array.isArray(request.assignment_operations) || operations.some(
5939
+ (value) => !isPlainRecord(value) || typeof value.operation !== "string" || !["assign", "unassign", "replace", "merge"].includes(value.operation) || typeof value.creative_id !== "string" || typeof value.package_id !== "string"
5940
+ ))
5941
+ return false;
5942
+ const targets = [
5943
+ ...assignments,
5944
+ ...operations.filter((value) => isPlainRecord(value) && value.operation !== "unassign")
5945
+ ];
5946
+ if (!targets.every(
5934
5947
  (value) => isPlainRecord(value) && typeof value.package_id === "string" && typeof value.creative_id === "string" && creatives.some((creative) => isPlainRecord(creative) && creative.creative_id === value.creative_id)
5935
5948
  ))
5936
5949
  return false;
5937
5950
  return creatives.every((creative) => {
5938
5951
  if (!isPlainRecord(creative)) return false;
5939
5952
  const assigned = new Set(
5940
- assignments.flatMap(
5953
+ targets.flatMap(
5941
5954
  (value) => isPlainRecord(value) && value.creative_id === creative.creative_id && typeof value.package_id === "string" ? [value.package_id] : []
5942
5955
  )
5943
5956
  );
5944
5957
  const relevant = assigned.size === 0 ? selectorContainers : selectorContainers.filter(
5945
5958
  (container) => typeof container.package_id === "string" && assigned.has(container.package_id)
5946
5959
  );
5947
- return relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative));
5960
+ if (relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative)))
5961
+ return true;
5962
+ if (assigned.size === 0) {
5963
+ const groups = /* @__PURE__ */ new Map();
5964
+ for (const container of relevant) {
5965
+ if (typeof container.package_id !== "string") continue;
5966
+ const group = groups.get(container.package_id) ?? [];
5967
+ group.push(container);
5968
+ groups.set(container.package_id, group);
5969
+ }
5970
+ if (groups.size > 0) {
5971
+ const fitting = new Set(
5972
+ (0, import_creative_delivery.fitCreativeToPackages)(creative, relevant, {
5973
+ adcpVersion: this.config.wireAdcpVersion ?? this.resolvedAdcpVersion,
5974
+ wireMode: "canonical",
5975
+ legacyFormatConverter: options?.legacyFormatConverter,
5976
+ canonicalFormatLegacyResolver: options?.canonicalFormatLegacyResolver,
5977
+ legacyFormatDefinitions: options?.creativeFormatProjection?.legacyFormatDefinitions,
5978
+ ...options?.creativeFormatProjection?.creativeFacts?.[String(creative.creative_id)]
5979
+ }).perPackage.filter((entry) => entry.verdict === "fits").map((entry) => entry.package_id)
5980
+ );
5981
+ return relevant.filter((container) => typeof container.package_id !== "string").every((container) => accepts(container, creative)) && [...groups].some(
5982
+ ([id, group]) => fitting.has(id) && group.every((container) => accepts(container, creative))
5983
+ );
5984
+ }
5985
+ }
5986
+ return false;
5948
5987
  });
5949
5988
  }
5950
5989
  const packages = ["packages", "new_packages"].flatMap((key) => Array.isArray(request[key]) ? request[key] : []);
@@ -209,6 +209,7 @@ import {
209
209
  CreativeFormatCapabilityError,
210
210
  CreativeFormatProjectionError,
211
211
  canUseProductOptionsForCreativeWire,
212
+ fitCreativeToPackages,
212
213
  projectMediaBuyCreativesForDelivery,
213
214
  projectCreativeForDelivery,
214
215
  projectSyncCreativesForDelivery,
@@ -5879,7 +5880,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5879
5880
  "sync_creatives",
5880
5881
  taskOptions,
5881
5882
  true,
5882
- () => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, options)
5883
+ () => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, {
5884
+ ...options,
5885
+ legacyFormatConverter: effectiveLegacyFormatConverter,
5886
+ canonicalFormatLegacyResolver: effectiveCanonicalFormatLegacyResolver
5887
+ })
5883
5888
  );
5884
5889
  const wireParams = this.projectUndeclaredFormatOptions(
5885
5890
  projectSyncCreativesForDelivery(
@@ -6048,21 +6053,56 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6048
6053
  if (!Array.isArray(request.creatives) || request.creatives.length === 0) return false;
6049
6054
  const creatives = request.creatives;
6050
6055
  const assignments = Array.isArray(request.assignments) ? request.assignments : [];
6051
- if (!assignments.every(
6056
+ const operations = Array.isArray(request.assignment_operations) ? request.assignment_operations : [];
6057
+ if (request.assignments !== void 0 && !Array.isArray(request.assignments) || request.assignment_operations !== void 0 && !Array.isArray(request.assignment_operations) || operations.some(
6058
+ (value) => !isPlainRecord(value) || typeof value.operation !== "string" || !["assign", "unassign", "replace", "merge"].includes(value.operation) || typeof value.creative_id !== "string" || typeof value.package_id !== "string"
6059
+ ))
6060
+ return false;
6061
+ const targets = [
6062
+ ...assignments,
6063
+ ...operations.filter((value) => isPlainRecord(value) && value.operation !== "unassign")
6064
+ ];
6065
+ if (!targets.every(
6052
6066
  (value) => isPlainRecord(value) && typeof value.package_id === "string" && typeof value.creative_id === "string" && creatives.some((creative) => isPlainRecord(creative) && creative.creative_id === value.creative_id)
6053
6067
  ))
6054
6068
  return false;
6055
6069
  return creatives.every((creative) => {
6056
6070
  if (!isPlainRecord(creative)) return false;
6057
6071
  const assigned = new Set(
6058
- assignments.flatMap(
6072
+ targets.flatMap(
6059
6073
  (value) => isPlainRecord(value) && value.creative_id === creative.creative_id && typeof value.package_id === "string" ? [value.package_id] : []
6060
6074
  )
6061
6075
  );
6062
6076
  const relevant = assigned.size === 0 ? selectorContainers : selectorContainers.filter(
6063
6077
  (container) => typeof container.package_id === "string" && assigned.has(container.package_id)
6064
6078
  );
6065
- return relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative));
6079
+ if (relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative)))
6080
+ return true;
6081
+ if (assigned.size === 0) {
6082
+ const groups = /* @__PURE__ */ new Map();
6083
+ for (const container of relevant) {
6084
+ if (typeof container.package_id !== "string") continue;
6085
+ const group = groups.get(container.package_id) ?? [];
6086
+ group.push(container);
6087
+ groups.set(container.package_id, group);
6088
+ }
6089
+ if (groups.size > 0) {
6090
+ const fitting = new Set(
6091
+ fitCreativeToPackages(creative, relevant, {
6092
+ adcpVersion: this.config.wireAdcpVersion ?? this.resolvedAdcpVersion,
6093
+ wireMode: "canonical",
6094
+ legacyFormatConverter: options?.legacyFormatConverter,
6095
+ canonicalFormatLegacyResolver: options?.canonicalFormatLegacyResolver,
6096
+ legacyFormatDefinitions: options?.creativeFormatProjection?.legacyFormatDefinitions,
6097
+ ...options?.creativeFormatProjection?.creativeFacts?.[String(creative.creative_id)]
6098
+ }).perPackage.filter((entry) => entry.verdict === "fits").map((entry) => entry.package_id)
6099
+ );
6100
+ return relevant.filter((container) => typeof container.package_id !== "string").every((container) => accepts(container, creative)) && [...groups].some(
6101
+ ([id, group]) => fitting.has(id) && group.every((container) => accepts(container, creative))
6102
+ );
6103
+ }
6104
+ }
6105
+ return false;
6066
6106
  });
6067
6107
  }
6068
6108
  const packages = ["packages", "new_packages"].flatMap((key) => Array.isArray(request[key]) ? request[key] : []);
@@ -119,7 +119,7 @@ export interface paths {
119
119
  };
120
120
  /**
121
121
  * List brands
122
- * @description List all brands in the registry with optional search, pagination, and source filter.
122
+ * @description List all brands in the registry with optional search, pagination, source and house filters.
123
123
  */
124
124
  get: operations["listBrands"];
125
125
  put?: never;
@@ -2413,6 +2413,11 @@ export interface components {
2413
2413
  relationship_verified_at?: string;
2414
2414
  /** @description Unilateral parent claim from the brand's own document. Not trust-extending. Present for `leaf_only` and `unverifiable`. */
2415
2415
  claimed_house_domain?: string;
2416
+ /**
2417
+ * @description Present when the list is filtered by `house_domain`: how this brand is known to belong to that house. `confirmed` means both sides publish the link or the brand redirects to the house, and is the only value that extends trust. `house_declared` means the house's own manifest lists the brand and the house has shown it controls its domain. `brand_declared` means the brand's own brand.json names the house. `inferred` means an enrichment or community record links them.
2418
+ * @enum {string}
2419
+ */
2420
+ house_link?: "confirmed" | "house_declared" | "brand_declared" | "inferred";
2416
2421
  };
2417
2422
  BrandActivity: {
2418
2423
  /** @example acmecorp.com */
@@ -5431,6 +5436,8 @@ export interface operations {
5431
5436
  parameters: {
5432
5437
  query?: {
5433
5438
  search?: string;
5439
+ /** @description List the brands linked to this house by any evidence, each with a `house_link` saying how the link is known: `confirmed` (both sides, or the brand redirects to the house), `house_declared` (the house lists the brand in its own manifest and has shown it controls its domain), `brand_declared` (the brand names the house in its own brand.json) or `inferred` (an enrichment or community record). Only `confirmed` extends trust. `stats` honours the filter, and the response adds the house's own record as `house`. */
5440
+ house_domain?: string;
5434
5441
  limit?: number;
5435
5442
  offset?: number;
5436
5443
  /** @description Filter by source. Values match the per-brand source field in the response: hosted = registered by domain owner via /api/brands; brand_json = crawler-discovered with a live /.well-known/brand.json; enriched = Brandfetch-sourced; community = manually contributed; stub = organization-derived placeholder awaiting stronger evidence. */
@@ -5461,10 +5468,19 @@ export interface operations {
5461
5468
  sub_brands: number;
5462
5469
  with_manifest: number;
5463
5470
  };
5471
+ /** @description Present when `house_domain` is set: the house's own registry record, or null when the registry has no public record for it. */
5472
+ house?: {
5473
+ /** @example pg.com */
5474
+ domain: string;
5475
+ /** @example Procter & Gamble */
5476
+ brand_name: string;
5477
+ /** @description The house has shown it controls its domain. Only a verified house's manifest produces `house_declared` links. */
5478
+ verified: boolean;
5479
+ } | null;
5464
5480
  };
5465
5481
  };
5466
5482
  };
5467
- /** @description Invalid source filter value */
5483
+ /** @description Invalid source filter, a house_domain that is not a domain, or a parameter given more than once */
5468
5484
  400: {
5469
5485
  headers: {
5470
5486
  [name: string]: unknown;
@@ -24,7 +24,115 @@ __export(creative_assets_exports, {
24
24
  findUnresolvedCreativeAssetDirectives: () => findUnresolvedCreativeAssetDirectives
25
25
  });
26
26
  module.exports = __toCommonJS(creative_assets_exports);
27
+ var import_node_util = require("node:util");
28
+ var import_resolve_agent_properties = require('../../discovery/resolve-agent-properties.js');
29
+ var import_schema_loader = require('../../validation/schema-loader.js');
27
30
  const BUILD_ASSETS_FROM_FORMAT_DIRECTIVE = "$build_assets_from_format";
31
+ function resolveTestKitFormat(value, testKit) {
32
+ const malformed = (constraint) => ({
33
+ ok: false,
34
+ failure: { reason: "malformed_directive", constraint }
35
+ });
36
+ const unavailable = (constraint) => ({
37
+ ok: false,
38
+ failure: { reason: "fixture_unavailable", slotId: "format declaration", assetType: "format", constraint }
39
+ });
40
+ if (value.catalog !== "test_kit" || Object.keys(value).length !== 2 || !Object.hasOwn(value, "format_id")) {
41
+ return malformed("offline catalog directive must contain only format_id and catalog: test_kit");
42
+ }
43
+ const normalizeReference = (reference) => {
44
+ const validate = (0, import_schema_loader.getSchemaValidatorByRef)("core/format-id.json");
45
+ if (!validate) throw new Error("Missing bundled core/format-id.json schema");
46
+ if (!validate(reference) || !isObject(reference) || typeof reference.agent_url !== "string") return void 0;
47
+ const agentUrl = (0, import_resolve_agent_properties.canonicalizeAgentUrl)(reference.agent_url);
48
+ return agentUrl ? { ...reference, agent_url: agentUrl } : void 0;
49
+ };
50
+ const requested = normalizeReference(value.format_id);
51
+ if (!requested) return malformed("offline catalog directive requires a complete valid FormatId");
52
+ const catalog = isObject(testKit) ? testKit.creative_formats : void 0;
53
+ if (catalog === void 0) return unavailable("test_kit.creative_formats was not supplied");
54
+ if (!Array.isArray(catalog)) return malformed("test_kit.creative_formats must be an array of Format declarations");
55
+ let match;
56
+ const validateFormat = (0, import_schema_loader.getSchemaValidatorByRef)("core/format.json");
57
+ if (!validateFormat) throw new Error("Missing bundled core/format.json schema");
58
+ for (const [index, candidate] of catalog.entries()) {
59
+ if (!validateFormat(candidate) || !isObject(candidate) || !Array.isArray(candidate.assets)) {
60
+ return malformed(`test_kit.creative_formats[${index}] must be a valid Format with an explicit assets array`);
61
+ }
62
+ const reference = normalizeReference(candidate.format_id);
63
+ if (!reference) return malformed(`test_kit.creative_formats[${index}].format_id is invalid`);
64
+ const slotIds = /* @__PURE__ */ new Set();
65
+ for (const slot of candidate.assets) {
66
+ if (!isObject(slot)) return malformed(`test_kit.creative_formats[${index}].assets contains an invalid slot`);
67
+ const slotId = slot.item_type === "repeatable_group" ? slot.asset_group_id : slot.asset_id;
68
+ if (typeof slotId !== "string" || slotIds.has(slotId)) {
69
+ return malformed(`test_kit.creative_formats[${index}].assets must have unique string slot identifiers`);
70
+ }
71
+ slotIds.add(slotId);
72
+ if (slot.item_type === "repeatable_group" && Array.isArray(slot.assets)) {
73
+ const childIds = slot.assets.map((child) => isObject(child) ? child.asset_id : void 0);
74
+ if (new Set(childIds).size !== childIds.length) {
75
+ return malformed(`test_kit.creative_formats[${index}].assets contains duplicate group asset identifiers`);
76
+ }
77
+ }
78
+ }
79
+ if (!(0, import_node_util.isDeepStrictEqual)(reference, requested)) continue;
80
+ if (match) return malformed("test_kit.creative_formats contains duplicate exact FormatId matches");
81
+ match = candidate;
82
+ }
83
+ if (!match) return unavailable("test_kit.creative_formats has no exact match for the captured FormatId");
84
+ if (isObject(match.accessibility) && match.accessibility.requires_accessible_assets === true) {
85
+ return unavailable("cannot synthesize the declared accessible asset metadata");
86
+ }
87
+ if (isObject(match.delivery) && Object.keys(match.delivery).length > 0) {
88
+ return unavailable("cannot verify the declared delivery constraints");
89
+ }
90
+ for (const slot of match.assets) {
91
+ if (slot.required !== true || !isObject(slot.requirements)) continue;
92
+ const requirements = slot.requirements;
93
+ if (requirements.parameters_from_format_id === true && requested.width === void 0) {
94
+ return unavailable("required slot needs logical dimensions from a parameterized FormatId");
95
+ }
96
+ if (requirements.parameters_from_format_id === true && [requirements, requirements.dimensions].filter(isObject).some(
97
+ (dimensions) => ["width", "height"].some((axis) => {
98
+ const logical = asNumber(requested[axis]);
99
+ return dimensions[axis] !== void 0 && logical !== void 0 && dimensions[axis] !== logical * (asNumber(requested.pixel_ratio) ?? 1);
100
+ })
101
+ )) {
102
+ return unavailable("required slot dimensions contradict the parameterized FormatId");
103
+ }
104
+ if (isObject(requirements.dimensions) && Object.keys(requirements.dimensions).some((key) => !["width", "height"].includes(key))) {
105
+ return unavailable("cannot verify nested slot dimension constraints");
106
+ }
107
+ }
108
+ const unsupported = Object.keys(requested).find(
109
+ (key) => !["agent_url", "id", "width", "height", "pixel_ratio"].includes(key)
110
+ );
111
+ if (unsupported || requested.pixel_ratio !== void 0 && requested.pixel_ratio !== 1) {
112
+ return unavailable(`cannot synthesize format parameter "${unsupported ?? "pixel_ratio"}"`);
113
+ }
114
+ const renders = Array.isArray(match.renders) ? match.renders : [];
115
+ if (renders.length > 1) return unavailable("cannot synthesize multiple format renders");
116
+ for (const render of renders) {
117
+ if (!isObject(render)) return malformed("format render must be an object");
118
+ const dimensions = isObject(render.dimensions) ? render.dimensions : {};
119
+ if (Object.keys(dimensions).some((key) => !["width", "height", "unit"].includes(key)) || dimensions.unit !== void 0 && dimensions.unit !== "px" || render.parameters_from_format_id === true && requested.width === void 0 || ["width", "height"].some(
120
+ (key) => requested[key] !== void 0 && dimensions[key] !== void 0 && requested[key] !== dimensions[key]
121
+ )) {
122
+ return unavailable("cannot synthesize the declared render constraints");
123
+ }
124
+ }
125
+ const assets = match.assets.map((slot) => {
126
+ const legacySlot = { ...slot };
127
+ delete legacySlot.width;
128
+ delete legacySlot.height;
129
+ return legacySlot;
130
+ });
131
+ return {
132
+ ok: true,
133
+ format: { format_id: match.format_id, assets, ...match.renders ? { renders: match.renders } : {} }
134
+ };
135
+ }
28
136
  function isObject(value) {
29
137
  return value !== null && typeof value === "object" && !Array.isArray(value);
30
138
  }
@@ -84,7 +192,7 @@ function dimensionsFromId(format) {
84
192
  const match = typeof formatId === "string" ? formatId.match(/(?:^|_)(\d{2,4})x(\d{2,4})(?:_|$)/i) : null;
85
193
  return match ? { width: Number(match[1]), height: Number(match[2]) } : {};
86
194
  }
87
- function formatDimensions(format) {
195
+ function formatDimensions(format, inferFromId = true) {
88
196
  const nestedFormatId = isObject(format.format_id) ? format.format_id : {};
89
197
  const direct = {
90
198
  width: asNumber(format.width) ?? asNumber(nestedFormatId.width),
@@ -99,7 +207,7 @@ function formatDimensions(format) {
99
207
  const height = asNumber(dimensions.height);
100
208
  if (width !== void 0 || height !== void 0) return { width, height };
101
209
  }
102
- return dimensionsFromId(format);
210
+ return inferFromId ? dimensionsFromId(format) : {};
103
211
  }
104
212
  function slotDimensions(slot, fallback) {
105
213
  const requirements = isObject(slot.requirements) ? slot.requirements : {};
@@ -109,12 +217,12 @@ function slotDimensions(slot, fallback) {
109
217
  height: asNumber(slot.height) ?? asNumber(nested.height) ?? fallback.height
110
218
  };
111
219
  }
112
- function requiredSlots(format) {
220
+ function requiredSlots(format, inferFromId = true) {
113
221
  const canonicalSlots = Array.isArray(format.slots) ? format.slots : void 0;
114
222
  const legacySlots = Array.isArray(format.assets) ? format.assets : Array.isArray(format.assets_required) ? format.assets_required : void 0;
115
223
  const usesAssetsRequired = canonicalSlots === void 0 && !Array.isArray(format.assets) && legacySlots !== void 0;
116
224
  const slots = canonicalSlots ?? legacySlots ?? [];
117
- const fallback = formatDimensions(format);
225
+ const fallback = formatDimensions(format, inferFromId);
118
226
  const container = canonicalSlots !== void 0 ? "slots" : usesAssetsRequired ? "assets_required" : "assets";
119
227
  const required = [];
120
228
  for (let index = 0; index < slots.length; index += 1) {
@@ -357,11 +465,28 @@ function buildAsset(slot, testKit) {
357
465
  return { ok: false, constraint: `asset type "${slot.assetType}" is not supported by the selected test kit` };
358
466
  }
359
467
  function buildAssets(value, context, testKit) {
468
+ const offlineCatalog = isObject(value) && Object.hasOwn(value, "catalog");
469
+ if (offlineCatalog && isObject(value)) {
470
+ const resolved2 = resolveTestKitFormat(value, testKit);
471
+ if (!resolved2.ok) return resolved2;
472
+ value = resolved2.format;
473
+ if (isObject(testKit) && isObject(testKit.assets) && Array.isArray(testKit.assets.images)) {
474
+ testKit = {
475
+ ...testKit,
476
+ assets: {
477
+ ...testKit.assets,
478
+ images: testKit.assets.images.filter(
479
+ (image) => isObject(image) && (image.pixel_ratio === void 0 || image.pixel_ratio === 1)
480
+ )
481
+ }
482
+ };
483
+ }
484
+ }
360
485
  const resolved = resolveFormat(value, context);
361
486
  if (!resolved.ok) {
362
487
  return { ok: false, failure: { reason: resolved.reason, constraint: resolved.constraint } };
363
488
  }
364
- const required = requiredSlots(resolved.format);
489
+ const required = requiredSlots(resolved.format, !offlineCatalog);
365
490
  if (!required.ok) {
366
491
  return { ok: false, failure: { reason: "malformed_directive", constraint: required.constraint } };
367
492
  }
@@ -379,7 +504,12 @@ function buildAssets(value, context, testKit) {
379
504
  }
380
505
  };
381
506
  }
382
- built[slot.id] = result.asset;
507
+ Object.defineProperty(built, slot.id, {
508
+ value: result.asset,
509
+ enumerable: true,
510
+ configurable: true,
511
+ writable: true
512
+ });
383
513
  }
384
514
  return { ok: true, assets: built };
385
515
  }
@@ -1,4 +1,112 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { canonicalizeAgentUrl } from "../../discovery/resolve-agent-properties.mjs";
3
+ import { getSchemaValidatorByRef } from "../../validation/schema-loader.mjs";
1
4
  const BUILD_ASSETS_FROM_FORMAT_DIRECTIVE = "$build_assets_from_format";
5
+ function resolveTestKitFormat(value, testKit) {
6
+ const malformed = (constraint) => ({
7
+ ok: false,
8
+ failure: { reason: "malformed_directive", constraint }
9
+ });
10
+ const unavailable = (constraint) => ({
11
+ ok: false,
12
+ failure: { reason: "fixture_unavailable", slotId: "format declaration", assetType: "format", constraint }
13
+ });
14
+ if (value.catalog !== "test_kit" || Object.keys(value).length !== 2 || !Object.hasOwn(value, "format_id")) {
15
+ return malformed("offline catalog directive must contain only format_id and catalog: test_kit");
16
+ }
17
+ const normalizeReference = (reference) => {
18
+ const validate = getSchemaValidatorByRef("core/format-id.json");
19
+ if (!validate) throw new Error("Missing bundled core/format-id.json schema");
20
+ if (!validate(reference) || !isObject(reference) || typeof reference.agent_url !== "string") return void 0;
21
+ const agentUrl = canonicalizeAgentUrl(reference.agent_url);
22
+ return agentUrl ? { ...reference, agent_url: agentUrl } : void 0;
23
+ };
24
+ const requested = normalizeReference(value.format_id);
25
+ if (!requested) return malformed("offline catalog directive requires a complete valid FormatId");
26
+ const catalog = isObject(testKit) ? testKit.creative_formats : void 0;
27
+ if (catalog === void 0) return unavailable("test_kit.creative_formats was not supplied");
28
+ if (!Array.isArray(catalog)) return malformed("test_kit.creative_formats must be an array of Format declarations");
29
+ let match;
30
+ const validateFormat = getSchemaValidatorByRef("core/format.json");
31
+ if (!validateFormat) throw new Error("Missing bundled core/format.json schema");
32
+ for (const [index, candidate] of catalog.entries()) {
33
+ if (!validateFormat(candidate) || !isObject(candidate) || !Array.isArray(candidate.assets)) {
34
+ return malformed(`test_kit.creative_formats[${index}] must be a valid Format with an explicit assets array`);
35
+ }
36
+ const reference = normalizeReference(candidate.format_id);
37
+ if (!reference) return malformed(`test_kit.creative_formats[${index}].format_id is invalid`);
38
+ const slotIds = /* @__PURE__ */ new Set();
39
+ for (const slot of candidate.assets) {
40
+ if (!isObject(slot)) return malformed(`test_kit.creative_formats[${index}].assets contains an invalid slot`);
41
+ const slotId = slot.item_type === "repeatable_group" ? slot.asset_group_id : slot.asset_id;
42
+ if (typeof slotId !== "string" || slotIds.has(slotId)) {
43
+ return malformed(`test_kit.creative_formats[${index}].assets must have unique string slot identifiers`);
44
+ }
45
+ slotIds.add(slotId);
46
+ if (slot.item_type === "repeatable_group" && Array.isArray(slot.assets)) {
47
+ const childIds = slot.assets.map((child) => isObject(child) ? child.asset_id : void 0);
48
+ if (new Set(childIds).size !== childIds.length) {
49
+ return malformed(`test_kit.creative_formats[${index}].assets contains duplicate group asset identifiers`);
50
+ }
51
+ }
52
+ }
53
+ if (!isDeepStrictEqual(reference, requested)) continue;
54
+ if (match) return malformed("test_kit.creative_formats contains duplicate exact FormatId matches");
55
+ match = candidate;
56
+ }
57
+ if (!match) return unavailable("test_kit.creative_formats has no exact match for the captured FormatId");
58
+ if (isObject(match.accessibility) && match.accessibility.requires_accessible_assets === true) {
59
+ return unavailable("cannot synthesize the declared accessible asset metadata");
60
+ }
61
+ if (isObject(match.delivery) && Object.keys(match.delivery).length > 0) {
62
+ return unavailable("cannot verify the declared delivery constraints");
63
+ }
64
+ for (const slot of match.assets) {
65
+ if (slot.required !== true || !isObject(slot.requirements)) continue;
66
+ const requirements = slot.requirements;
67
+ if (requirements.parameters_from_format_id === true && requested.width === void 0) {
68
+ return unavailable("required slot needs logical dimensions from a parameterized FormatId");
69
+ }
70
+ if (requirements.parameters_from_format_id === true && [requirements, requirements.dimensions].filter(isObject).some(
71
+ (dimensions) => ["width", "height"].some((axis) => {
72
+ const logical = asNumber(requested[axis]);
73
+ return dimensions[axis] !== void 0 && logical !== void 0 && dimensions[axis] !== logical * (asNumber(requested.pixel_ratio) ?? 1);
74
+ })
75
+ )) {
76
+ return unavailable("required slot dimensions contradict the parameterized FormatId");
77
+ }
78
+ if (isObject(requirements.dimensions) && Object.keys(requirements.dimensions).some((key) => !["width", "height"].includes(key))) {
79
+ return unavailable("cannot verify nested slot dimension constraints");
80
+ }
81
+ }
82
+ const unsupported = Object.keys(requested).find(
83
+ (key) => !["agent_url", "id", "width", "height", "pixel_ratio"].includes(key)
84
+ );
85
+ if (unsupported || requested.pixel_ratio !== void 0 && requested.pixel_ratio !== 1) {
86
+ return unavailable(`cannot synthesize format parameter "${unsupported ?? "pixel_ratio"}"`);
87
+ }
88
+ const renders = Array.isArray(match.renders) ? match.renders : [];
89
+ if (renders.length > 1) return unavailable("cannot synthesize multiple format renders");
90
+ for (const render of renders) {
91
+ if (!isObject(render)) return malformed("format render must be an object");
92
+ const dimensions = isObject(render.dimensions) ? render.dimensions : {};
93
+ if (Object.keys(dimensions).some((key) => !["width", "height", "unit"].includes(key)) || dimensions.unit !== void 0 && dimensions.unit !== "px" || render.parameters_from_format_id === true && requested.width === void 0 || ["width", "height"].some(
94
+ (key) => requested[key] !== void 0 && dimensions[key] !== void 0 && requested[key] !== dimensions[key]
95
+ )) {
96
+ return unavailable("cannot synthesize the declared render constraints");
97
+ }
98
+ }
99
+ const assets = match.assets.map((slot) => {
100
+ const legacySlot = { ...slot };
101
+ delete legacySlot.width;
102
+ delete legacySlot.height;
103
+ return legacySlot;
104
+ });
105
+ return {
106
+ ok: true,
107
+ format: { format_id: match.format_id, assets, ...match.renders ? { renders: match.renders } : {} }
108
+ };
109
+ }
2
110
  function isObject(value) {
3
111
  return value !== null && typeof value === "object" && !Array.isArray(value);
4
112
  }
@@ -58,7 +166,7 @@ function dimensionsFromId(format) {
58
166
  const match = typeof formatId === "string" ? formatId.match(/(?:^|_)(\d{2,4})x(\d{2,4})(?:_|$)/i) : null;
59
167
  return match ? { width: Number(match[1]), height: Number(match[2]) } : {};
60
168
  }
61
- function formatDimensions(format) {
169
+ function formatDimensions(format, inferFromId = true) {
62
170
  const nestedFormatId = isObject(format.format_id) ? format.format_id : {};
63
171
  const direct = {
64
172
  width: asNumber(format.width) ?? asNumber(nestedFormatId.width),
@@ -73,7 +181,7 @@ function formatDimensions(format) {
73
181
  const height = asNumber(dimensions.height);
74
182
  if (width !== void 0 || height !== void 0) return { width, height };
75
183
  }
76
- return dimensionsFromId(format);
184
+ return inferFromId ? dimensionsFromId(format) : {};
77
185
  }
78
186
  function slotDimensions(slot, fallback) {
79
187
  const requirements = isObject(slot.requirements) ? slot.requirements : {};
@@ -83,12 +191,12 @@ function slotDimensions(slot, fallback) {
83
191
  height: asNumber(slot.height) ?? asNumber(nested.height) ?? fallback.height
84
192
  };
85
193
  }
86
- function requiredSlots(format) {
194
+ function requiredSlots(format, inferFromId = true) {
87
195
  const canonicalSlots = Array.isArray(format.slots) ? format.slots : void 0;
88
196
  const legacySlots = Array.isArray(format.assets) ? format.assets : Array.isArray(format.assets_required) ? format.assets_required : void 0;
89
197
  const usesAssetsRequired = canonicalSlots === void 0 && !Array.isArray(format.assets) && legacySlots !== void 0;
90
198
  const slots = canonicalSlots ?? legacySlots ?? [];
91
- const fallback = formatDimensions(format);
199
+ const fallback = formatDimensions(format, inferFromId);
92
200
  const container = canonicalSlots !== void 0 ? "slots" : usesAssetsRequired ? "assets_required" : "assets";
93
201
  const required = [];
94
202
  for (let index = 0; index < slots.length; index += 1) {
@@ -331,11 +439,28 @@ function buildAsset(slot, testKit) {
331
439
  return { ok: false, constraint: `asset type "${slot.assetType}" is not supported by the selected test kit` };
332
440
  }
333
441
  function buildAssets(value, context, testKit) {
442
+ const offlineCatalog = isObject(value) && Object.hasOwn(value, "catalog");
443
+ if (offlineCatalog && isObject(value)) {
444
+ const resolved2 = resolveTestKitFormat(value, testKit);
445
+ if (!resolved2.ok) return resolved2;
446
+ value = resolved2.format;
447
+ if (isObject(testKit) && isObject(testKit.assets) && Array.isArray(testKit.assets.images)) {
448
+ testKit = {
449
+ ...testKit,
450
+ assets: {
451
+ ...testKit.assets,
452
+ images: testKit.assets.images.filter(
453
+ (image) => isObject(image) && (image.pixel_ratio === void 0 || image.pixel_ratio === 1)
454
+ )
455
+ }
456
+ };
457
+ }
458
+ }
334
459
  const resolved = resolveFormat(value, context);
335
460
  if (!resolved.ok) {
336
461
  return { ok: false, failure: { reason: resolved.reason, constraint: resolved.constraint } };
337
462
  }
338
- const required = requiredSlots(resolved.format);
463
+ const required = requiredSlots(resolved.format, !offlineCatalog);
339
464
  if (!required.ok) {
340
465
  return { ok: false, failure: { reason: "malformed_directive", constraint: required.constraint } };
341
466
  }
@@ -353,7 +478,12 @@ function buildAssets(value, context, testKit) {
353
478
  }
354
479
  };
355
480
  }
356
- built[slot.id] = result.asset;
481
+ Object.defineProperty(built, slot.id, {
482
+ value: result.asset,
483
+ enumerable: true,
484
+ configurable: true,
485
+ writable: true
486
+ });
357
487
  }
358
488
  return { ok: true, assets: built };
359
489
  }
@@ -38,6 +38,14 @@ const VALIDATION_ONLY_TASK = "__validation_only__";
38
38
  const IDENTIFIER_PATH_SEGMENT = String.raw`[A-Za-z_][A-Za-z0-9_-]*(?:\[\*\])*`;
39
39
  const IDENTIFIER_PATH_PATTERN = new RegExp(`^${IDENTIFIER_PATH_SEGMENT}(?:\\.${IDENTIFIER_PATH_SEGMENT})*$`);
40
40
  const CAPABILITY_PATH_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(?:\.[A-Za-z_][A-Za-z0-9_-]*)*$/;
41
+ function hasOfflineFormatDirective(value) {
42
+ if (Array.isArray(value)) return value.some(hasOfflineFormatDirective);
43
+ if (!value || typeof value !== "object") return false;
44
+ const object = value;
45
+ const directive = object.$build_assets_from_format;
46
+ if (directive && typeof directive === "object" && Object.hasOwn(directive, "catalog")) return true;
47
+ return Object.values(object).some(hasOfflineFormatDirective);
48
+ }
41
49
  function parseStoryboard(yamlContent) {
42
50
  const parsed = (0, import_yaml.parse)(yamlContent);
43
51
  if (!parsed?.id || !parsed?.phases) {
@@ -96,6 +104,11 @@ function validateStoryboardShape(storyboard) {
96
104
  validateBranchSet(storyboard.id, phase);
97
105
  if (!phase.steps) continue;
98
106
  for (const step of phase.steps) {
107
+ if ((hasOfflineFormatDirective(step.sample_request) || hasOfflineFormatDirective(step.rate_limit_trip?.trip_target_sample_request)) && !(Array.isArray(storyboard.requires) && storyboard.requires.includes("test_kit_format_catalog_runner"))) {
108
+ throw new Error(
109
+ `[${storyboard.id}] ${step.id}: offline format fixtures require test_kit_format_catalog_runner`
110
+ );
111
+ }
99
112
  if (step.collect_product_pages !== void 0) {
100
113
  if (step.collect_product_pages !== true || step.task !== "get_products" || step.sample_request?.buying_mode !== "wholesale") {
101
114
  throw new Error(
@@ -10,6 +10,14 @@ const VALIDATION_ONLY_TASK = "__validation_only__";
10
10
  const IDENTIFIER_PATH_SEGMENT = String.raw`[A-Za-z_][A-Za-z0-9_-]*(?:\[\*\])*`;
11
11
  const IDENTIFIER_PATH_PATTERN = new RegExp(`^${IDENTIFIER_PATH_SEGMENT}(?:\\.${IDENTIFIER_PATH_SEGMENT})*$`);
12
12
  const CAPABILITY_PATH_PATTERN = /^[A-Za-z_][A-Za-z0-9_-]*(?:\.[A-Za-z_][A-Za-z0-9_-]*)*$/;
13
+ function hasOfflineFormatDirective(value) {
14
+ if (Array.isArray(value)) return value.some(hasOfflineFormatDirective);
15
+ if (!value || typeof value !== "object") return false;
16
+ const object = value;
17
+ const directive = object.$build_assets_from_format;
18
+ if (directive && typeof directive === "object" && Object.hasOwn(directive, "catalog")) return true;
19
+ return Object.values(object).some(hasOfflineFormatDirective);
20
+ }
13
21
  function parseStoryboard(yamlContent) {
14
22
  const parsed = parse(yamlContent);
15
23
  if (!parsed?.id || !parsed?.phases) {
@@ -68,6 +76,11 @@ function validateStoryboardShape(storyboard) {
68
76
  validateBranchSet(storyboard.id, phase);
69
77
  if (!phase.steps) continue;
70
78
  for (const step of phase.steps) {
79
+ if ((hasOfflineFormatDirective(step.sample_request) || hasOfflineFormatDirective(step.rate_limit_trip?.trip_target_sample_request)) && !(Array.isArray(storyboard.requires) && storyboard.requires.includes("test_kit_format_catalog_runner"))) {
80
+ throw new Error(
81
+ `[${storyboard.id}] ${step.id}: offline format fixtures require test_kit_format_catalog_runner`
82
+ );
83
+ }
71
84
  if (step.collect_product_pages !== void 0) {
72
85
  if (step.collect_product_pages !== true || step.task !== "get_products" || step.sample_request?.buying_mode !== "wholesale") {
73
86
  throw new Error(
@@ -1147,6 +1147,7 @@ const REQUIREMENT_TO_SKIP_REASON = {
1147
1147
  controller: "missing_test_controller",
1148
1148
  collect_product_pages_runner: "requirement_unmet",
1149
1149
  field_excludes_runner: "requirement_unmet",
1150
+ test_kit_format_catalog_runner: "requirement_unmet",
1150
1151
  seeded_state: "requirement_unmet",
1151
1152
  real_wire: "requirement_unmet",
1152
1153
  webhook_receiver: "requirement_unmet",
@@ -1282,6 +1283,7 @@ async function checkRequires(requires, storyboard, options, profile, precomputed
1282
1283
  switch (requirement) {
1283
1284
  case "field_excludes_runner":
1284
1285
  case "collect_product_pages_runner":
1286
+ case "test_kit_format_catalog_runner":
1285
1287
  break;
1286
1288
  case "controller": {
1287
1289
  if (!options.agentTools) continue;
@@ -1189,6 +1189,7 @@ const REQUIREMENT_TO_SKIP_REASON = {
1189
1189
  controller: "missing_test_controller",
1190
1190
  collect_product_pages_runner: "requirement_unmet",
1191
1191
  field_excludes_runner: "requirement_unmet",
1192
+ test_kit_format_catalog_runner: "requirement_unmet",
1192
1193
  seeded_state: "requirement_unmet",
1193
1194
  real_wire: "requirement_unmet",
1194
1195
  webhook_receiver: "requirement_unmet",
@@ -1324,6 +1325,7 @@ async function checkRequires(requires, storyboard, options, profile, precomputed
1324
1325
  switch (requirement) {
1325
1326
  case "field_excludes_runner":
1326
1327
  case "collect_product_pages_runner":
1328
+ case "test_kit_format_catalog_runner":
1327
1329
  break;
1328
1330
  case "controller": {
1329
1331
  if (!options.agentTools) continue;
@@ -92,6 +92,8 @@ export interface Storyboard {
92
92
  * all-page steps; unavailable on older runners that ignore this metadata.
93
93
  * - `field_excludes_runner` — intrinsic full-response negative membership support;
94
94
  * older runners skip before seeding instead of ignoring an unknown check.
95
+ * - `test_kit_format_catalog_runner` — intrinsic support for explicitly
96
+ * selecting offline legacy declarations from `test_kit.creative_formats`.
95
97
  * - `real_wire` — always available. Tag scenarios that observe
96
98
  * production behavior with this when you want them excluded from
97
99
  * a future `--mock-only` mode; today the tag is a no-op gate.
@@ -2417,7 +2419,7 @@ export interface RunnerSelectionResult {
2417
2419
  *
2418
2420
  * Spec: adcp-client#1626, adcp-client#2281, adcp-client#2356.
2419
2421
  */
2420
- export type RequirementName = 'controller' | 'collect_product_pages_runner' | 'field_excludes_runner' | 'seeded_state' | 'real_wire' | 'webhook_receiver' | 'webhook_replay_receiver' | 'trusted_match_context_router_runner' | 'trusted_match_publisher_auth_runner' | 'property_list_reference_runner' | 'request_signer' | 'multi_agent';
2422
+ export type RequirementName = 'controller' | 'collect_product_pages_runner' | 'field_excludes_runner' | 'test_kit_format_catalog_runner' | 'seeded_state' | 'real_wire' | 'webhook_receiver' | 'webhook_replay_receiver' | 'trusted_match_context_router_runner' | 'trusted_match_publisher_auth_runner' | 'property_list_reference_runner' | 'request_signer' | 'multi_agent';
2421
2423
  /**
2422
2424
  * Enumeration of every requirement this SDK knows how to satisfy. The loader
2423
2425
  * accepts other non-empty strings for forward compatibility; the runner treats
@@ -92,6 +92,8 @@ export interface Storyboard {
92
92
  * all-page steps; unavailable on older runners that ignore this metadata.
93
93
  * - `field_excludes_runner` — intrinsic full-response negative membership support;
94
94
  * older runners skip before seeding instead of ignoring an unknown check.
95
+ * - `test_kit_format_catalog_runner` — intrinsic support for explicitly
96
+ * selecting offline legacy declarations from `test_kit.creative_formats`.
95
97
  * - `real_wire` — always available. Tag scenarios that observe
96
98
  * production behavior with this when you want them excluded from
97
99
  * a future `--mock-only` mode; today the tag is a no-op gate.
@@ -2417,7 +2419,7 @@ export interface RunnerSelectionResult {
2417
2419
  *
2418
2420
  * Spec: adcp-client#1626, adcp-client#2281, adcp-client#2356.
2419
2421
  */
2420
- export type RequirementName = 'controller' | 'collect_product_pages_runner' | 'field_excludes_runner' | 'seeded_state' | 'real_wire' | 'webhook_receiver' | 'webhook_replay_receiver' | 'trusted_match_context_router_runner' | 'trusted_match_publisher_auth_runner' | 'property_list_reference_runner' | 'request_signer' | 'multi_agent';
2422
+ export type RequirementName = 'controller' | 'collect_product_pages_runner' | 'field_excludes_runner' | 'test_kit_format_catalog_runner' | 'seeded_state' | 'real_wire' | 'webhook_receiver' | 'webhook_replay_receiver' | 'trusted_match_context_router_runner' | 'trusted_match_publisher_auth_runner' | 'property_list_reference_runner' | 'request_signer' | 'multi_agent';
2421
2423
  /**
2422
2424
  * Enumeration of every requirement this SDK knows how to satisfy. The loader
2423
2425
  * accepts other non-empty strings for forward compatibility; the runner treats
@@ -64,6 +64,7 @@ const KNOWN_REQUIREMENTS = /* @__PURE__ */ new Set([
64
64
  "controller",
65
65
  "collect_product_pages_runner",
66
66
  "field_excludes_runner",
67
+ "test_kit_format_catalog_runner",
67
68
  "seeded_state",
68
69
  "real_wire",
69
70
  "webhook_receiver",
@@ -38,6 +38,7 @@ const KNOWN_REQUIREMENTS = /* @__PURE__ */ new Set([
38
38
  "controller",
39
39
  "collect_product_pages_runner",
40
40
  "field_excludes_runner",
41
+ "test_kit_format_catalog_runner",
41
42
  "seeded_state",
42
43
  "real_wire",
43
44
  "webhook_receiver",
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.18";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.19";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.18";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.19";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -90,6 +90,8 @@ function stripLegacyCreativeIdentity(value) {
90
90
  }
91
91
  return !/(^|_)(?:creative|format|legacy|offending|target|input|output)($|_)/.test(key);
92
92
  };
93
+ const platformExtensionContext = (key) => key === "format_schema" || key === "platform_extensions";
94
+ const platformExtensionUri = (key, owner, ownerKey) => key === "uri" && platformExtensionContext(ownerKey) && typeof ownDataValue(owner, "uri") === "string";
93
95
  const legacyKey = (key, owner, ownerKey) => {
94
96
  if (creativeIdentityKey(key)) return true;
95
97
  if (!/(^|_)agent_url($|_)/.test(key)) return false;
@@ -171,7 +173,8 @@ function stripLegacyCreativeIdentity(value) {
171
173
  };
172
174
  const seenByContext = {
173
175
  default: /* @__PURE__ */ new WeakMap(),
174
- nonCreativeAgent: /* @__PURE__ */ new WeakMap()
176
+ nonCreativeAgent: /* @__PURE__ */ new WeakMap(),
177
+ platformExtension: /* @__PURE__ */ new WeakMap()
175
178
  };
176
179
  const hasCustomToJSON = (candidate) => {
177
180
  let cursor = candidate;
@@ -185,7 +188,7 @@ function stripLegacyCreativeIdentity(value) {
185
188
  const strip = (current, ownerKey) => {
186
189
  if (typeof current === "string") return sanitizeText(current, ownerKey);
187
190
  if (current === null || typeof current !== "object") return current;
188
- const seen = explicitNonCreativeContextKey(ownerKey) ? seenByContext.nonCreativeAgent : seenByContext.default;
191
+ const seen = platformExtensionContext(ownerKey) ? seenByContext.platformExtension : explicitNonCreativeContextKey(ownerKey) ? seenByContext.nonCreativeAgent : seenByContext.default;
189
192
  const cached = seen.get(current);
190
193
  if (cached !== void 0) return cached;
191
194
  if (Array.isArray(current)) {
@@ -264,7 +267,7 @@ function stripLegacyCreativeIdentity(value) {
264
267
  changed = true;
265
268
  continue;
266
269
  }
267
- const safe = preservesNonCreativeAgentUrl(key, owner, ownerKey) ? child : strip(child, key);
270
+ const safe = preservesNonCreativeAgentUrl(key, owner, ownerKey) || platformExtensionUri(key, owner, ownerKey) ? child : strip(child, key);
268
271
  if (safe !== child) changed = true;
269
272
  if (plain && typeof key === "string" && descriptor.enumerable) result[key] = safe;
270
273
  else Object.defineProperty(result, key, { ...descriptor, value: safe });
@@ -78,6 +78,8 @@ function stripLegacyCreativeIdentity(value) {
78
78
  }
79
79
  return !/(^|_)(?:creative|format|legacy|offending|target|input|output)($|_)/.test(key);
80
80
  };
81
+ const platformExtensionContext = (key) => key === "format_schema" || key === "platform_extensions";
82
+ const platformExtensionUri = (key, owner, ownerKey) => key === "uri" && platformExtensionContext(ownerKey) && typeof ownDataValue(owner, "uri") === "string";
81
83
  const legacyKey = (key, owner, ownerKey) => {
82
84
  if (creativeIdentityKey(key)) return true;
83
85
  if (!/(^|_)agent_url($|_)/.test(key)) return false;
@@ -159,7 +161,8 @@ function stripLegacyCreativeIdentity(value) {
159
161
  };
160
162
  const seenByContext = {
161
163
  default: /* @__PURE__ */ new WeakMap(),
162
- nonCreativeAgent: /* @__PURE__ */ new WeakMap()
164
+ nonCreativeAgent: /* @__PURE__ */ new WeakMap(),
165
+ platformExtension: /* @__PURE__ */ new WeakMap()
163
166
  };
164
167
  const hasCustomToJSON = (candidate) => {
165
168
  let cursor = candidate;
@@ -173,7 +176,7 @@ function stripLegacyCreativeIdentity(value) {
173
176
  const strip = (current, ownerKey) => {
174
177
  if (typeof current === "string") return sanitizeText(current, ownerKey);
175
178
  if (current === null || typeof current !== "object") return current;
176
- const seen = explicitNonCreativeContextKey(ownerKey) ? seenByContext.nonCreativeAgent : seenByContext.default;
179
+ const seen = platformExtensionContext(ownerKey) ? seenByContext.platformExtension : explicitNonCreativeContextKey(ownerKey) ? seenByContext.nonCreativeAgent : seenByContext.default;
177
180
  const cached = seen.get(current);
178
181
  if (cached !== void 0) return cached;
179
182
  if (Array.isArray(current)) {
@@ -252,7 +255,7 @@ function stripLegacyCreativeIdentity(value) {
252
255
  changed = true;
253
256
  continue;
254
257
  }
255
- const safe = preservesNonCreativeAgentUrl(key, owner, ownerKey) ? child : strip(child, key);
258
+ const safe = preservesNonCreativeAgentUrl(key, owner, ownerKey) || platformExtensionUri(key, owner, ownerKey) ? child : strip(child, key);
256
259
  if (safe !== child) changed = true;
257
260
  if (plain && typeof key === "string" && descriptor.enumerable) result[key] = safe;
258
261
  else Object.defineProperty(result, key, { ...descriptor, value: safe });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AdCP SDK library version
3
3
  */
4
- export declare const LIBRARY_VERSION = "17.0.0-beta.18";
4
+ export declare const LIBRARY_VERSION = "17.0.0-beta.19";
5
5
  /**
6
6
  * AdCP specification version this library is built for
7
7
  */
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
33
33
  * Full version information
34
34
  */
35
35
  export declare const VERSION_INFO: {
36
- readonly library: "17.0.0-beta.18";
36
+ readonly library: "17.0.0-beta.19";
37
37
  readonly adcp: "3.3.0-beta.4";
38
38
  readonly compatibleVersions: readonly ["v3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.0.13", "3.0.14", "3.0.15", "3.0.16", "3.0.17", "3.0.18", "3.0.19", "3.0.20", "3.0.21", "3.0.22", "3.0.23", "3.0.24", "3.0.25", "3.1.0", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.1.5", "3.1.6", "3.1.7", "3.1.8", "3.1.9", "3.1.10", "3.1.11", "3.1.12", "3.1.13", "3.1.14", "3.1.15", "3.1.16", "3.1.17", "3.1.18", "3.1.19", "3.1.20", "3.1.21", "3.1.22", "3.1.23", "3.1.24", "3.1.25", "3.1.26", "3.1.27", "3.1.28", "3.1.29", "3.1.30", "3.1.31", "3.2.1", "3.2", "3.2.2", "3.2.3", "3.2.4", "3.2.5", "3.2.6", "3.2.7", "3.2.8", "3.3.0-beta.4", "3.3-beta.4"];
39
- readonly generatedAt: "2026-11-05T11:07:33.682Z";
39
+ readonly generatedAt: "2026-11-06T14:29:13.999Z";
40
40
  };
41
41
  /**
42
42
  * Get the AdCP specification version this library is built for
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AdCP SDK library version
3
3
  */
4
- export declare const LIBRARY_VERSION = "17.0.0-beta.18";
4
+ export declare const LIBRARY_VERSION = "17.0.0-beta.19";
5
5
  /**
6
6
  * AdCP specification version this library is built for
7
7
  */
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
33
33
  * Full version information
34
34
  */
35
35
  export declare const VERSION_INFO: {
36
- readonly library: "17.0.0-beta.18";
36
+ readonly library: "17.0.0-beta.19";
37
37
  readonly adcp: "3.3.0-beta.4";
38
38
  readonly compatibleVersions: readonly ["v3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.0.13", "3.0.14", "3.0.15", "3.0.16", "3.0.17", "3.0.18", "3.0.19", "3.0.20", "3.0.21", "3.0.22", "3.0.23", "3.0.24", "3.0.25", "3.1.0", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.1.5", "3.1.6", "3.1.7", "3.1.8", "3.1.9", "3.1.10", "3.1.11", "3.1.12", "3.1.13", "3.1.14", "3.1.15", "3.1.16", "3.1.17", "3.1.18", "3.1.19", "3.1.20", "3.1.21", "3.1.22", "3.1.23", "3.1.24", "3.1.25", "3.1.26", "3.1.27", "3.1.28", "3.1.29", "3.1.30", "3.1.31", "3.2.1", "3.2", "3.2.2", "3.2.3", "3.2.4", "3.2.5", "3.2.6", "3.2.7", "3.2.8", "3.3.0-beta.4", "3.3-beta.4"];
39
- readonly generatedAt: "2026-11-05T11:07:33.682Z";
39
+ readonly generatedAt: "2026-11-06T14:29:13.999Z";
40
40
  };
41
41
  /**
42
42
  * Get the AdCP specification version this library is built for
@@ -31,7 +31,7 @@ __export(version_exports, {
31
31
  toReleasePrecisionVersion: () => toReleasePrecisionVersion
32
32
  });
33
33
  module.exports = __toCommonJS(version_exports);
34
- const LIBRARY_VERSION = "17.0.0-beta.18";
34
+ const LIBRARY_VERSION = "17.0.0-beta.19";
35
35
  const ADCP_VERSION = "3.3.0-beta.4";
36
36
  const ADCP_MAJOR_VERSION = 3;
37
37
  const COMPATIBLE_ADCP_VERSIONS = [
@@ -109,10 +109,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
109
109
  "3.3-beta.4"
110
110
  ];
111
111
  const VERSION_INFO = {
112
- library: "17.0.0-beta.18",
112
+ library: "17.0.0-beta.19",
113
113
  adcp: "3.3.0-beta.4",
114
114
  compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
115
- generatedAt: "2026-11-05T11:07:33.682Z"
115
+ generatedAt: "2026-11-06T14:29:13.999Z"
116
116
  };
117
117
  function getAdcpVersion() {
118
118
  return ADCP_VERSION;
@@ -1,4 +1,4 @@
1
- const LIBRARY_VERSION = "17.0.0-beta.18";
1
+ const LIBRARY_VERSION = "17.0.0-beta.19";
2
2
  const ADCP_VERSION = "3.3.0-beta.4";
3
3
  const ADCP_MAJOR_VERSION = 3;
4
4
  const COMPATIBLE_ADCP_VERSIONS = [
@@ -76,10 +76,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
76
76
  "3.3-beta.4"
77
77
  ];
78
78
  const VERSION_INFO = {
79
- library: "17.0.0-beta.18",
79
+ library: "17.0.0-beta.19",
80
80
  adcp: "3.3.0-beta.4",
81
81
  compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
82
- generatedAt: "2026-11-05T11:07:33.682Z"
82
+ generatedAt: "2026-11-06T14:29:13.999Z"
83
83
  };
84
84
  function getAdcpVersion() {
85
85
  return ADCP_VERSION;
@@ -1,7 +1,7 @@
1
1
  # AdCP Type Summary
2
2
 
3
- > Generated at: 2026-11-05
4
- > @adcp/sdk v17.0.0-beta.18
3
+ > Generated at: 2026-11-06
4
+ > @adcp/sdk v17.0.0-beta.19
5
5
 
6
6
  Curated reference of the types that matter for using the AdCP client. For full generated types see `src/lib/types/tools.generated.ts` and `src/lib/types/core.generated.ts`.
7
7
 
@@ -54,3 +54,5 @@ For resolved VAST, `vastInlineCreatives` supplies linear creative groups and the
54
54
  The optional `legacyFormatConverter`, `canonicalFormatLegacyResolver`, and `legacyFormatDefinitions` use existing exact-owner migration contracts. Callback exceptions propagate to the caller; invalid callback answers remain projection refusals. No network lookup is added. Pass JSON-compatible immutable inputs. The function does not mutate them. It does not establish seller ownership, catalog authenticity, or renderer behavior.
55
55
 
56
56
  The broader fit-vector corpus proposed in adcontextprotocol/adcp#8644 and cross-SDK parity remain separate work. This API does not claim those implementations exist.
57
+
58
+ On a 3.1 peer, mixed library hints can establish canonical wire support through a positively fitting package with native seller declarations. This fallback uses the same measurements, routing callbacks and applicable layers as projection; a rejected native package cannot lend evidence to a fitting legacy-only route. Existing full-scope native evidence retains its seller-validation behavior, and product evidence stays scoped to the current request.
@@ -0,0 +1,66 @@
1
+ # Offline legacy creative fixtures
2
+
3
+ A media-buy seller accepting inline creatives does not need to expose
4
+ `list_creative_formats` or `sync_creatives`. To build legacy manifests from the
5
+ declaring agent's exact slot IDs, supply declarations you obtained from that
6
+ agent in the operator's test-kit override:
7
+
8
+ ```yaml
9
+ creative_formats:
10
+ - format_id:
11
+ agent_url: https://creative.example/formats
12
+ id: display_custom
13
+ width: 300
14
+ height: 250
15
+ name: Acme display
16
+ assets:
17
+ - item_type: individual
18
+ asset_id: banner_image
19
+ asset_type: image
20
+ required: true
21
+ - item_type: individual
22
+ asset_id: landing_page
23
+ asset_type: url
24
+ required: true
25
+ ```
26
+
27
+ Keep the usual `assets.images`, `assets.click_url`, and other fixture ingredients
28
+ in the same kit. These declarations are operator inputs: the runner does not
29
+ fetch their URLs, forward credentials, seed formats, replace captured discovery
30
+ data, or call the seller's Creative Protocol tools.
31
+
32
+ The storyboard must declare `requires: [test_kit_format_catalog_runner]` and use:
33
+
34
+ ```yaml
35
+ assets:
36
+ $build_assets_from_format:
37
+ format_id: "$context.legacy_format_id"
38
+ catalog: test_kit
39
+ ```
40
+
41
+ Only this exact wrapper selects the offline catalog. The existing direct-format
42
+ and context-catalog forms retain their behavior. Older runners treat the new
43
+ requirement as unmet before fixture mutation.
44
+
45
+ Matching uses the entire reference after standard agent-URL canonicalization,
46
+ including variant parameters and extension fields. A template is not an exact
47
+ match for a parameterized reference. Supply an explicit `assets` array; an empty
48
+ array declares no required slots, while a missing array is malformed. Invalid
49
+ declarations, duplicate slot IDs, duplicate exact references, and malformed
50
+ captured references are authoring errors. Missing catalogs or exact references
51
+ are `fixture_unavailable`, as are unsupported required slots or constraints.
52
+ The current fixture builder conservatively declines duration, density other
53
+ than 1, and extension parameters even when the catalog contains an exact match.
54
+ It also declines required accessibility metadata, nonempty delivery contracts,
55
+ multiple or ranged renders, unsupported nested dimension constraints, and
56
+ templates missing the logical dimensions required by their slots. Legacy
57
+ `assets` remains the slot authority; canonical/helper extension fields cannot
58
+ override it or the captured reference's dimensions. Size-looking IDs do not
59
+ supply missing dimensions.
60
+
61
+ Preflight checks every remaining manifest in an eligible phase before its first
62
+ mutation. Put legacy discovery and the whole legacy execution phase before any
63
+ canonical purchases when a later legacy fixture gap must prevent all buys. A
64
+ context-gated future phase is not eligible until its gate is evaluated. A missing
65
+ legacy representation closes its gate, so canonical-only catalogs need no legacy
66
+ preparation. A seller refusing a valid prepared manifest remains a test failure.
package/docs/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # Ad Context Protocol (AdCP)
2
2
 
3
- > Generated at: 2026-11-05
4
- > Library: @adcp/sdk v17.0.0-beta.18
3
+ > Generated at: 2026-11-06
4
+ > Library: @adcp/sdk v17.0.0-beta.19
5
5
  > AdCP major version: 3
6
6
  > Canonical URL: https://adcontextprotocol.github.io/adcp-client/llms.txt
7
7
  > Note: the `Library` stamp reflects the package.json version at doc-generation time. The narrative below describes the surface that lands on the next-published minor — including any 6.7 helpers documented here ahead of the release tag.
@@ -16,8 +16,8 @@ pin using `ADCP_VERSION` inside that tarball.
16
16
 
17
17
  | Fact | Value |
18
18
  | --- | --- |
19
- | Checkout `package.json` version | `@adcp/sdk@17.0.0-beta.18` |
20
- | npm integrity | registry-derived after publication; run `npm view @adcp/sdk@17.0.0-beta.18 dist.integrity` |
19
+ | Checkout `package.json` version | `@adcp/sdk@17.0.0-beta.19` |
20
+ | npm integrity | registry-derived after publication; run `npm view @adcp/sdk@17.0.0-beta.19 dist.integrity` |
21
21
  | Node.js runtime | `^20.19.0 || >=22.12.0` |
22
22
  | Default AdCP wire release | `3.3.0-beta.4` |
23
23
  | Maintained wire releases | `v3`, `3.0.0`, `3.0`, `3.0.1`, `3.0.2`, `3.0.3`, `3.0.4`, `3.0.5`, `3.0.6`, `3.0.7`, `3.0.8`, `3.0.9`, `3.0.10`, `3.0.11`, `3.0.12`, `3.0.13`, `3.0.14`, `3.0.15`, `3.0.16`, `3.0.17`, `3.0.18`, `3.0.19`, `3.0.20`, `3.0.21`, `3.0.22`, `3.0.23`, `3.0.24`, `3.0.25`, `3.1.0`, `3.1`, `3.1.1`, `3.1.2`, `3.1.3`, `3.1.4`, `3.1.5`, `3.1.6`, `3.1.7`, `3.1.8`, `3.1.9`, `3.1.10`, `3.1.11`, `3.1.12`, `3.1.13`, `3.1.14`, `3.1.15`, `3.1.16`, `3.1.17`, `3.1.18`, `3.1.19`, `3.1.20`, `3.1.21`, `3.1.22`, `3.1.23`, `3.1.24`, `3.1.25`, `3.1.26`, `3.1.27`, `3.1.28`, `3.1.29`, `3.1.30`, `3.1.31`, `3.2.1`, `3.2`, `3.2.2`, `3.2.3`, `3.2.4`, `3.2.5`, `3.2.6`, `3.2.7`, `3.2.8`, `3.3.0-beta.4`, `3.3-beta.4` |
@@ -26,8 +26,8 @@ pin using `ADCP_VERSION` inside that tarball.
26
26
  For a checkout at the published release commit, install the exact package version:
27
27
 
28
28
  ```bash
29
- npm install --save-exact '@adcp/sdk@17.0.0-beta.18'
30
- npm view '@adcp/sdk@17.0.0-beta.18' dist.integrity
29
+ npm install --save-exact '@adcp/sdk@17.0.0-beta.19'
30
+ npm view '@adcp/sdk@17.0.0-beta.19' dist.integrity
31
31
  ```
32
32
 
33
33
  ### Required and optional peers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adcp/sdk",
3
- "version": "17.0.0-beta.18",
3
+ "version": "17.0.0-beta.19",
4
4
  "description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
5
5
  "workspaces": [
6
6
  ".",