@adcp/sdk 16.0.0-beta.7 → 16.0.0-beta.9

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.
Files changed (408) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +20 -0
  3. package/bin/adcp.js +10 -13
  4. package/dist/lib/conformance/index.d.mts +2 -0
  5. package/dist/lib/conformance/index.d.ts +2 -0
  6. package/dist/lib/conformance/index.js +3 -0
  7. package/dist/lib/conformance/index.mjs +2 -0
  8. package/dist/lib/conformance/property-lists.d.mts +14 -0
  9. package/dist/lib/conformance/property-lists.d.ts +14 -0
  10. package/dist/lib/conformance/property-lists.js +45 -0
  11. package/dist/lib/conformance/property-lists.mjs +21 -0
  12. package/dist/lib/conformance/runConformance.js +20 -1
  13. package/dist/lib/conformance/runConformance.mjs +20 -1
  14. package/dist/lib/conformance/types.d.mts +3 -0
  15. package/dist/lib/conformance/types.d.ts +3 -0
  16. package/dist/lib/core/AgentClient.d.mts +8 -5
  17. package/dist/lib/core/AgentClient.d.ts +8 -5
  18. package/dist/lib/core/AgentClient.js +9 -4
  19. package/dist/lib/core/AgentClient.mjs +9 -4
  20. package/dist/lib/core/SingleAgentClient.d.mts +32 -115
  21. package/dist/lib/core/SingleAgentClient.d.ts +32 -115
  22. package/dist/lib/core/SingleAgentClient.js +379 -273
  23. package/dist/lib/core/SingleAgentClient.mjs +387 -275
  24. package/dist/lib/core/TaskExecutor.d.mts +1 -16
  25. package/dist/lib/core/TaskExecutor.d.ts +1 -16
  26. package/dist/lib/core/TaskExecutor.js +34 -51
  27. package/dist/lib/core/TaskExecutor.mjs +12 -29
  28. package/dist/lib/core/product-cache.d.mts +3 -1
  29. package/dist/lib/core/product-cache.d.ts +3 -1
  30. package/dist/lib/core/product-cache.js +2 -1
  31. package/dist/lib/core/product-cache.mjs +2 -1
  32. package/dist/lib/errors/index.d.mts +2 -8
  33. package/dist/lib/errors/index.d.ts +2 -8
  34. package/dist/lib/errors/index.js +4 -4
  35. package/dist/lib/errors/index.mjs +4 -4
  36. package/dist/lib/identifiers.d.mts +53 -0
  37. package/dist/lib/identifiers.d.ts +53 -0
  38. package/dist/lib/identifiers.js +212 -0
  39. package/dist/lib/identifiers.mjs +163 -0
  40. package/dist/lib/index.d.mts +7 -5
  41. package/dist/lib/index.d.ts +7 -5
  42. package/dist/lib/index.js +2 -14
  43. package/dist/lib/index.mjs +1 -14
  44. package/dist/lib/media-buy/compatibility.d.mts +1 -1
  45. package/dist/lib/media-buy/compatibility.d.ts +1 -1
  46. package/dist/lib/media-buy/compatibility.js +26 -45
  47. package/dist/lib/media-buy/compatibility.mjs +26 -45
  48. package/dist/lib/media-buy/index.d.mts +1 -1
  49. package/dist/lib/media-buy/index.d.ts +1 -1
  50. package/dist/lib/media-buy/legacy-purchase-continuation.d.mts +2 -2
  51. package/dist/lib/media-buy/legacy-purchase-continuation.d.ts +2 -2
  52. package/dist/lib/media-buy/property-policy.d.mts +15 -1
  53. package/dist/lib/media-buy/property-policy.d.ts +15 -1
  54. package/dist/lib/media-buy/property-policy.js +135 -3
  55. package/dist/lib/media-buy/property-policy.mjs +134 -3
  56. package/dist/lib/protocols/index.js +14 -22
  57. package/dist/lib/protocols/index.mjs +5 -13
  58. package/dist/lib/registry/index.d.mts +12 -0
  59. package/dist/lib/registry/index.d.ts +12 -0
  60. package/dist/lib/registry/index.js +159 -5
  61. package/dist/lib/registry/index.mjs +156 -4
  62. package/dist/lib/registry/types.d.mts +26 -2
  63. package/dist/lib/registry/types.d.ts +26 -2
  64. package/dist/lib/registry/types.generated.d.mts +51 -11
  65. package/dist/lib/registry/types.generated.d.ts +51 -11
  66. package/dist/lib/reporting/source/conformance.d.mts +8 -8
  67. package/dist/lib/reporting/source/conformance.d.ts +8 -8
  68. package/dist/lib/reporting/source/manifest.d.mts +27 -27
  69. package/dist/lib/reporting/source/manifest.d.ts +27 -27
  70. package/dist/lib/server/create-adcp-server.js +6 -0
  71. package/dist/lib/server/create-adcp-server.mjs +6 -0
  72. package/dist/lib/server/decisioning/specialisms/lists.d.mts +4 -4
  73. package/dist/lib/server/decisioning/specialisms/lists.d.ts +4 -4
  74. package/dist/lib/server/index.d.mts +3 -0
  75. package/dist/lib/server/index.d.ts +3 -0
  76. package/dist/lib/server/index.js +8 -1
  77. package/dist/lib/server/index.mjs +4 -0
  78. package/dist/lib/server/property-lists.d.mts +36 -0
  79. package/dist/lib/server/property-lists.d.ts +36 -0
  80. package/dist/lib/server/property-lists.js +154 -0
  81. package/dist/lib/server/property-lists.mjs +129 -0
  82. package/dist/lib/server/targeting-helpers.d.mts +2 -0
  83. package/dist/lib/server/targeting-helpers.d.ts +2 -0
  84. package/dist/lib/server/targeting-helpers.js +28 -1
  85. package/dist/lib/server/targeting-helpers.mjs +18 -1
  86. package/dist/lib/signing/parser.js +2 -2
  87. package/dist/lib/signing/parser.mjs +2 -2
  88. package/dist/lib/signing/server.d.mts +1 -1
  89. package/dist/lib/signing/server.d.ts +1 -1
  90. package/dist/lib/signing/server.mjs +5 -1
  91. package/dist/lib/signing/webhook-verifier.d.mts +11 -0
  92. package/dist/lib/signing/webhook-verifier.d.ts +11 -0
  93. package/dist/lib/signing/webhook-verifier.js +11 -3
  94. package/dist/lib/signing/webhook-verifier.mjs +11 -3
  95. package/dist/lib/supply-path/verify.js +12 -2
  96. package/dist/lib/supply-path/verify.mjs +2 -2
  97. package/dist/lib/testing/compliance/comply.js +0 -8
  98. package/dist/lib/testing/compliance/comply.mjs +0 -8
  99. package/dist/lib/testing/compliance/storyboard-tracks.js +11 -0
  100. package/dist/lib/testing/compliance/storyboard-tracks.mjs +11 -0
  101. package/dist/lib/testing/index.d.mts +2 -0
  102. package/dist/lib/testing/index.d.ts +2 -0
  103. package/dist/lib/testing/index.js +5 -0
  104. package/dist/lib/testing/index.mjs +3 -0
  105. package/dist/lib/testing/scenarios/capabilities.d.mts +2 -2
  106. package/dist/lib/testing/scenarios/capabilities.d.ts +2 -2
  107. package/dist/lib/testing/scenarios/capabilities.js +8 -41
  108. package/dist/lib/testing/scenarios/capabilities.mjs +9 -42
  109. package/dist/lib/testing/storyboard/creative-build-probe.d.mts +34 -0
  110. package/dist/lib/testing/storyboard/creative-build-probe.d.ts +34 -0
  111. package/dist/lib/testing/storyboard/creative-build-probe.js +395 -0
  112. package/dist/lib/testing/storyboard/creative-build-probe.mjs +373 -0
  113. package/dist/lib/testing/storyboard/index.d.mts +2 -0
  114. package/dist/lib/testing/storyboard/index.d.ts +2 -0
  115. package/dist/lib/testing/storyboard/index.js +5 -0
  116. package/dist/lib/testing/storyboard/index.mjs +3 -0
  117. package/dist/lib/testing/storyboard/loader.js +12 -0
  118. package/dist/lib/testing/storyboard/loader.mjs +12 -0
  119. package/dist/lib/testing/storyboard/property-list-reference.d.mts +15 -0
  120. package/dist/lib/testing/storyboard/property-list-reference.d.ts +15 -0
  121. package/dist/lib/testing/storyboard/property-list-reference.js +514 -0
  122. package/dist/lib/testing/storyboard/property-list-reference.mjs +487 -0
  123. package/dist/lib/testing/storyboard/runner.js +318 -58
  124. package/dist/lib/testing/storyboard/runner.mjs +322 -58
  125. package/dist/lib/testing/storyboard/types.d.mts +38 -16
  126. package/dist/lib/testing/storyboard/types.d.ts +38 -16
  127. package/dist/lib/testing/storyboard/types.js +1 -0
  128. package/dist/lib/testing/storyboard/types.mjs +1 -0
  129. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  130. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  131. package/dist/lib/testing/storyboard/validations.js +64 -0
  132. package/dist/lib/testing/storyboard/validations.mjs +67 -1
  133. package/dist/lib/testing/types.d.mts +15 -1
  134. package/dist/lib/testing/types.d.ts +15 -1
  135. package/dist/lib/types/schemas.generated.d.ts +65 -65
  136. package/dist/lib/types/wellknown-schemas.generated.d.mts +21 -21
  137. package/dist/lib/types/wellknown-schemas.generated.d.ts +21 -21
  138. package/dist/lib/utils/adcp-version-config.js +6 -0
  139. package/dist/lib/utils/adcp-version-config.mjs +6 -0
  140. package/dist/lib/utils/capabilities.d.mts +7 -9
  141. package/dist/lib/utils/capabilities.d.ts +7 -9
  142. package/dist/lib/utils/capabilities.js +14 -28
  143. package/dist/lib/utils/capabilities.mjs +14 -27
  144. package/dist/lib/utils/creative-adapter.d.mts +15 -113
  145. package/dist/lib/utils/creative-adapter.d.ts +15 -113
  146. package/dist/lib/utils/creative-adapter.js +7 -106
  147. package/dist/lib/utils/creative-adapter.mjs +7 -102
  148. package/dist/lib/utils/format-renders.d.mts +20 -80
  149. package/dist/lib/utils/format-renders.d.ts +20 -80
  150. package/dist/lib/utils/format-renders.js +7 -67
  151. package/dist/lib/utils/format-renders.mjs +7 -66
  152. package/dist/lib/utils/index.d.mts +1 -2
  153. package/dist/lib/utils/index.d.ts +1 -2
  154. package/dist/lib/utils/index.js +0 -7
  155. package/dist/lib/utils/index.mjs +0 -6
  156. package/dist/lib/utils/preview-normalizer.d.mts +31 -80
  157. package/dist/lib/utils/preview-normalizer.d.ts +31 -80
  158. package/dist/lib/utils/preview-normalizer.js +5 -50
  159. package/dist/lib/utils/preview-normalizer.mjs +5 -49
  160. package/dist/lib/utils/pricing-adapter.d.mts +2 -36
  161. package/dist/lib/utils/pricing-adapter.d.ts +2 -36
  162. package/dist/lib/utils/pricing-adapter.js +0 -105
  163. package/dist/lib/utils/pricing-adapter.mjs +0 -100
  164. package/dist/lib/utils/request-normalizer.d.mts +1 -2
  165. package/dist/lib/utils/request-normalizer.d.ts +1 -2
  166. package/dist/lib/v2/projection/creative-delivery.d.mts +2 -0
  167. package/dist/lib/v2/projection/creative-delivery.d.ts +2 -0
  168. package/dist/lib/v2/projection/creative-delivery.js +7 -0
  169. package/dist/lib/v2/projection/creative-delivery.mjs +6 -0
  170. package/dist/lib/v2/projection/legacy-metadata.d.mts +12 -0
  171. package/dist/lib/v2/projection/legacy-metadata.d.ts +12 -0
  172. package/dist/lib/v2/projection/legacy-metadata.js +41 -1
  173. package/dist/lib/v2/projection/legacy-metadata.mjs +37 -1
  174. package/dist/lib/v2/projection/legacy-normalization.d.mts +1 -1
  175. package/dist/lib/v2/projection/legacy-normalization.d.ts +1 -1
  176. package/dist/lib/v2/projection/v1-to-v2.js +13 -0
  177. package/dist/lib/v2/projection/v1-to-v2.mjs +14 -0
  178. package/dist/lib/validation/client-hooks.d.mts +1 -4
  179. package/dist/lib/validation/client-hooks.d.ts +1 -4
  180. package/dist/lib/validation/get-products-request.d.mts +1 -1
  181. package/dist/lib/validation/get-products-request.d.ts +1 -1
  182. package/dist/lib/validation/schema-loader.js +6 -0
  183. package/dist/lib/validation/schema-loader.mjs +6 -0
  184. package/dist/lib/validation/schema-validator.js +1 -26
  185. package/dist/lib/validation/schema-validator.mjs +1 -26
  186. package/dist/lib/version.d.mts +5 -5
  187. package/dist/lib/version.d.ts +5 -5
  188. package/dist/lib/version.js +3 -5
  189. package/dist/lib/version.mjs +3 -5
  190. package/docs/TYPE-SUMMARY.md +2 -2
  191. package/docs/development/PROTOCOL_DIFFERENCES.md +1 -1
  192. package/docs/guides/CONFORMANCE.md +25 -0
  193. package/docs/guides/CREATIVE-BUILD-PROBE.md +156 -0
  194. package/docs/guides/CREATIVE-DELIVERY.md +45 -6
  195. package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +15 -18
  196. package/docs/guides/PROPERTY-LISTS.md +264 -0
  197. package/docs/guides/SIGNING-GUIDE.md +25 -0
  198. package/docs/guides/VALIDATE-YOUR-AGENT.md +5 -0
  199. package/docs/llms.txt +2 -2
  200. package/docs/migration-13-to-14.md +20 -16
  201. package/docs/migration-14.x-rc-worksheet.md +5 -5
  202. package/docs/migration-4.x-to-5.x.md +12 -7
  203. package/docs/migration-drop-adcp-2.md +25 -0
  204. package/package.json +3 -18
  205. package/skills/call-adcp-agent/SKILL.md +23 -25
  206. package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.mts +0 -3
  207. package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts +0 -3
  208. package/dist/lib/adapters/legacy/v2-5/create_media_buy.js +0 -33
  209. package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs +0 -9
  210. package/dist/lib/adapters/legacy/v2-5/get_products.d.mts +0 -8
  211. package/dist/lib/adapters/legacy/v2-5/get_products.d.ts +0 -8
  212. package/dist/lib/adapters/legacy/v2-5/get_products.js +0 -33
  213. package/dist/lib/adapters/legacy/v2-5/get_products.mjs +0 -9
  214. package/dist/lib/adapters/legacy/v2-5/index.d.mts +0 -34
  215. package/dist/lib/adapters/legacy/v2-5/index.d.ts +0 -34
  216. package/dist/lib/adapters/legacy/v2-5/index.js +0 -50
  217. package/dist/lib/adapters/legacy/v2-5/index.mjs +0 -25
  218. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.mts +0 -8
  219. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts +0 -8
  220. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js +0 -33
  221. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs +0 -9
  222. package/dist/lib/adapters/legacy/v2-5/preview_creative.d.mts +0 -3
  223. package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts +0 -3
  224. package/dist/lib/adapters/legacy/v2-5/preview_creative.js +0 -33
  225. package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs +0 -9
  226. package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.mts +0 -11
  227. package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +0 -11
  228. package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +0 -32
  229. package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs +0 -8
  230. package/dist/lib/adapters/legacy/v2-5/types.d.mts +0 -39
  231. package/dist/lib/adapters/legacy/v2-5/types.d.ts +0 -39
  232. package/dist/lib/adapters/legacy/v2-5/types.js +0 -16
  233. package/dist/lib/adapters/legacy/v2-5/types.mjs +0 -0
  234. package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.mts +0 -3
  235. package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts +0 -3
  236. package/dist/lib/adapters/legacy/v2-5/update_media_buy.js +0 -35
  237. package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs +0 -11
  238. package/dist/lib/schemas-data/v2.5/_provenance.json +0 -8
  239. package/dist/lib/schemas-data/v2.5/adagents.json +0 -494
  240. package/dist/lib/schemas-data/v2.5/core/activation-key.json +0 -50
  241. package/dist/lib/schemas-data/v2.5/core/assets/audio-asset.json +0 -32
  242. package/dist/lib/schemas-data/v2.5/core/assets/css-asset.json +0 -21
  243. package/dist/lib/schemas-data/v2.5/core/assets/daast-asset.json +0 -87
  244. package/dist/lib/schemas-data/v2.5/core/assets/html-asset.json +0 -21
  245. package/dist/lib/schemas-data/v2.5/core/assets/image-asset.json +0 -38
  246. package/dist/lib/schemas-data/v2.5/core/assets/javascript-asset.json +0 -21
  247. package/dist/lib/schemas-data/v2.5/core/assets/markdown-asset.json +0 -31
  248. package/dist/lib/schemas-data/v2.5/core/assets/text-asset.json +0 -21
  249. package/dist/lib/schemas-data/v2.5/core/assets/url-asset.json +0 -26
  250. package/dist/lib/schemas-data/v2.5/core/assets/vast-asset.json +0 -87
  251. package/dist/lib/schemas-data/v2.5/core/assets/video-asset.json +0 -44
  252. package/dist/lib/schemas-data/v2.5/core/assets/webhook-asset.json +0 -71
  253. package/dist/lib/schemas-data/v2.5/core/async-response-data.json +0 -88
  254. package/dist/lib/schemas-data/v2.5/core/brand-manifest-ref.json +0 -33
  255. package/dist/lib/schemas-data/v2.5/core/brand-manifest.json +0 -409
  256. package/dist/lib/schemas-data/v2.5/core/context.json +0 -8
  257. package/dist/lib/schemas-data/v2.5/core/creative-asset.json +0 -125
  258. package/dist/lib/schemas-data/v2.5/core/creative-assignment.json +0 -31
  259. package/dist/lib/schemas-data/v2.5/core/creative-filters.json +0 -111
  260. package/dist/lib/schemas-data/v2.5/core/creative-manifest.json +0 -72
  261. package/dist/lib/schemas-data/v2.5/core/creative-policy.json +0 -27
  262. package/dist/lib/schemas-data/v2.5/core/delivery-metrics.json +0 -171
  263. package/dist/lib/schemas-data/v2.5/core/deployment.json +0 -93
  264. package/dist/lib/schemas-data/v2.5/core/destination.json +0 -53
  265. package/dist/lib/schemas-data/v2.5/core/error.json +0 -40
  266. package/dist/lib/schemas-data/v2.5/core/ext.json +0 -8
  267. package/dist/lib/schemas-data/v2.5/core/format-id.json +0 -47
  268. package/dist/lib/schemas-data/v2.5/core/format.json +0 -324
  269. package/dist/lib/schemas-data/v2.5/core/frequency-cap.json +0 -18
  270. package/dist/lib/schemas-data/v2.5/core/mcp-webhook-payload.json +0 -152
  271. package/dist/lib/schemas-data/v2.5/core/measurement.json +0 -48
  272. package/dist/lib/schemas-data/v2.5/core/media-buy.json +0 -62
  273. package/dist/lib/schemas-data/v2.5/core/package.json +0 -72
  274. package/dist/lib/schemas-data/v2.5/core/performance-feedback.json +0 -90
  275. package/dist/lib/schemas-data/v2.5/core/placement.json +0 -34
  276. package/dist/lib/schemas-data/v2.5/core/pricing-option.json +0 -35
  277. package/dist/lib/schemas-data/v2.5/core/product-filters.json +0 -102
  278. package/dist/lib/schemas-data/v2.5/core/product.json +0 -153
  279. package/dist/lib/schemas-data/v2.5/core/promoted-offerings.json +0 -115
  280. package/dist/lib/schemas-data/v2.5/core/promoted-products.json +0 -67
  281. package/dist/lib/schemas-data/v2.5/core/property-id.json +0 -14
  282. package/dist/lib/schemas-data/v2.5/core/property-tag.json +0 -16
  283. package/dist/lib/schemas-data/v2.5/core/property.json +0 -62
  284. package/dist/lib/schemas-data/v2.5/core/protocol-envelope.json +0 -146
  285. package/dist/lib/schemas-data/v2.5/core/publisher-property-selector.json +0 -92
  286. package/dist/lib/schemas-data/v2.5/core/push-notification-config.json +0 -48
  287. package/dist/lib/schemas-data/v2.5/core/reporting-capabilities.json +0 -71
  288. package/dist/lib/schemas-data/v2.5/core/response.json +0 -24
  289. package/dist/lib/schemas-data/v2.5/core/signal-filters.json +0 -35
  290. package/dist/lib/schemas-data/v2.5/core/start-timing.json +0 -18
  291. package/dist/lib/schemas-data/v2.5/core/sub-asset.json +0 -79
  292. package/dist/lib/schemas-data/v2.5/core/targeting.json +0 -50
  293. package/dist/lib/schemas-data/v2.5/core/tasks-get-request.json +0 -43
  294. package/dist/lib/schemas-data/v2.5/core/tasks-get-response.json +0 -166
  295. package/dist/lib/schemas-data/v2.5/core/tasks-list-request.json +0 -192
  296. package/dist/lib/schemas-data/v2.5/core/tasks-list-response.json +0 -183
  297. package/dist/lib/schemas-data/v2.5/creative/asset-types/index.json +0 -101
  298. package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-request.json +0 -73
  299. package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-response.json +0 -61
  300. package/dist/lib/schemas-data/v2.5/creative/preview-creative-request.json +0 -164
  301. package/dist/lib/schemas-data/v2.5/creative/preview-creative-response.json +0 -245
  302. package/dist/lib/schemas-data/v2.5/creative/preview-render.json +0 -225
  303. package/dist/lib/schemas-data/v2.5/enums/adcp-domain.json +0 -11
  304. package/dist/lib/schemas-data/v2.5/enums/asset-content-type.json +0 -22
  305. package/dist/lib/schemas-data/v2.5/enums/auth-scheme.json +0 -11
  306. package/dist/lib/schemas-data/v2.5/enums/available-metric.json +0 -18
  307. package/dist/lib/schemas-data/v2.5/enums/channels.json +0 -18
  308. package/dist/lib/schemas-data/v2.5/enums/co-branding-requirement.json +0 -12
  309. package/dist/lib/schemas-data/v2.5/enums/creative-action.json +0 -14
  310. package/dist/lib/schemas-data/v2.5/enums/creative-agent-capability.json +0 -13
  311. package/dist/lib/schemas-data/v2.5/enums/creative-sort-field.json +0 -15
  312. package/dist/lib/schemas-data/v2.5/enums/creative-status.json +0 -19
  313. package/dist/lib/schemas-data/v2.5/enums/daast-tracking-event.json +0 -20
  314. package/dist/lib/schemas-data/v2.5/enums/daast-version.json +0 -11
  315. package/dist/lib/schemas-data/v2.5/enums/delivery-type.json +0 -15
  316. package/dist/lib/schemas-data/v2.5/enums/dimension-unit.json +0 -13
  317. package/dist/lib/schemas-data/v2.5/enums/feed-format.json +0 -12
  318. package/dist/lib/schemas-data/v2.5/enums/feedback-source.json +0 -13
  319. package/dist/lib/schemas-data/v2.5/enums/format-category.json +0 -16
  320. package/dist/lib/schemas-data/v2.5/enums/format-id-parameter.json +0 -11
  321. package/dist/lib/schemas-data/v2.5/enums/frequency-cap-scope.json +0 -13
  322. package/dist/lib/schemas-data/v2.5/enums/history-entry-type.json +0 -11
  323. package/dist/lib/schemas-data/v2.5/enums/http-method.json +0 -11
  324. package/dist/lib/schemas-data/v2.5/enums/identifier-types.json +0 -34
  325. package/dist/lib/schemas-data/v2.5/enums/javascript-module-type.json +0 -12
  326. package/dist/lib/schemas-data/v2.5/enums/landing-page-requirement.json +0 -12
  327. package/dist/lib/schemas-data/v2.5/enums/markdown-flavor.json +0 -11
  328. package/dist/lib/schemas-data/v2.5/enums/media-buy-status.json +0 -19
  329. package/dist/lib/schemas-data/v2.5/enums/metric-type.json +0 -17
  330. package/dist/lib/schemas-data/v2.5/enums/notification-type.json +0 -13
  331. package/dist/lib/schemas-data/v2.5/enums/pacing.json +0 -17
  332. package/dist/lib/schemas-data/v2.5/enums/preview-output-format.json +0 -11
  333. package/dist/lib/schemas-data/v2.5/enums/pricing-model.json +0 -25
  334. package/dist/lib/schemas-data/v2.5/enums/property-type.json +0 -16
  335. package/dist/lib/schemas-data/v2.5/enums/publisher-identifier-types.json +0 -19
  336. package/dist/lib/schemas-data/v2.5/enums/reporting-frequency.json +0 -12
  337. package/dist/lib/schemas-data/v2.5/enums/signal-catalog-type.json +0 -12
  338. package/dist/lib/schemas-data/v2.5/enums/sort-direction.json +0 -11
  339. package/dist/lib/schemas-data/v2.5/enums/standard-format-ids.json +0 -103
  340. package/dist/lib/schemas-data/v2.5/enums/task-status.json +0 -29
  341. package/dist/lib/schemas-data/v2.5/enums/task-type.json +0 -27
  342. package/dist/lib/schemas-data/v2.5/enums/update-frequency.json +0 -13
  343. package/dist/lib/schemas-data/v2.5/enums/url-asset-type.json +0 -12
  344. package/dist/lib/schemas-data/v2.5/enums/validation-mode.json +0 -11
  345. package/dist/lib/schemas-data/v2.5/enums/vast-tracking-event.json +0 -25
  346. package/dist/lib/schemas-data/v2.5/enums/vast-version.json +0 -14
  347. package/dist/lib/schemas-data/v2.5/enums/webhook-response-type.json +0 -13
  348. package/dist/lib/schemas-data/v2.5/enums/webhook-security-method.json +0 -12
  349. package/dist/lib/schemas-data/v2.5/index.json +0 -604
  350. package/dist/lib/schemas-data/v2.5/media-buy/build-creative-request.json +0 -31
  351. package/dist/lib/schemas-data/v2.5/media-buy/build-creative-response.json +0 -65
  352. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-input-required.json +0 -31
  353. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-submitted.json +0 -16
  354. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-working.json +0 -36
  355. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-request.json +0 -126
  356. package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-response.json +0 -97
  357. package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-request.json +0 -54
  358. package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-response.json +0 -285
  359. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-input-required.json +0 -38
  360. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-submitted.json +0 -21
  361. package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-working.json +0 -34
  362. package/dist/lib/schemas-data/v2.5/media-buy/get-products-request.json +0 -28
  363. package/dist/lib/schemas-data/v2.5/media-buy/get-products-response.json +0 -33
  364. package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-request.json +0 -26
  365. package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-response.json +0 -70
  366. package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-request.json +0 -58
  367. package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-response.json +0 -61
  368. package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-request.json +0 -137
  369. package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-response.json +0 -437
  370. package/dist/lib/schemas-data/v2.5/media-buy/package-request.json +0 -80
  371. package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-request.json +0 -88
  372. package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-response.json +0 -66
  373. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-input-required.json +0 -25
  374. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-submitted.json +0 -16
  375. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-working.json +0 -46
  376. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-request.json +0 -178
  377. package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-response.json +0 -149
  378. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-input-required.json +0 -24
  379. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-submitted.json +0 -16
  380. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-working.json +0 -36
  381. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-request.json +0 -129
  382. package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-response.json +0 -99
  383. package/dist/lib/schemas-data/v2.5/pricing-options/cpc-option.json +0 -52
  384. package/dist/lib/schemas-data/v2.5/pricing-options/cpcv-option.json +0 -52
  385. package/dist/lib/schemas-data/v2.5/pricing-options/cpm-auction-option.json +0 -81
  386. package/dist/lib/schemas-data/v2.5/pricing-options/cpm-fixed-option.json +0 -52
  387. package/dist/lib/schemas-data/v2.5/pricing-options/cpp-option.json +0 -73
  388. package/dist/lib/schemas-data/v2.5/pricing-options/cpv-option.json +0 -88
  389. package/dist/lib/schemas-data/v2.5/pricing-options/flat-rate-option.json +0 -93
  390. package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-auction-option.json +0 -81
  391. package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-fixed-option.json +0 -52
  392. package/dist/lib/schemas-data/v2.5/protocols/adcp-extension.json +0 -33
  393. package/dist/lib/schemas-data/v2.5/signals/activate-signal-request.json +0 -32
  394. package/dist/lib/schemas-data/v2.5/signals/activate-signal-response.json +0 -68
  395. package/dist/lib/schemas-data/v2.5/signals/get-signals-request.json +0 -59
  396. package/dist/lib/schemas-data/v2.5/signals/get-signals-response.json +0 -100
  397. package/dist/lib/types/v2-5/index.d.mts +0 -1
  398. package/dist/lib/types/v2-5/index.d.ts +0 -1
  399. package/dist/lib/types/v2-5/index.js +0 -22
  400. package/dist/lib/types/v2-5/index.mjs +0 -1
  401. package/dist/lib/types/v2-5/tools.generated.d.mts +0 -3568
  402. package/dist/lib/types/v2-5/tools.generated.d.ts +0 -3568
  403. package/dist/lib/types/v2-5/tools.generated.js +0 -16
  404. package/dist/lib/types/v2-5/tools.generated.mjs +0 -0
  405. package/dist/lib/utils/sync-creatives-adapter.d.mts +0 -33
  406. package/dist/lib/utils/sync-creatives-adapter.d.ts +0 -33
  407. package/dist/lib/utils/sync-creatives-adapter.js +0 -83
  408. package/dist/lib/utils/sync-creatives-adapter.mjs +0 -59
@@ -34,6 +34,9 @@ __export(SingleAgentClient_exports, {
34
34
  createSingleAgentClient: () => createSingleAgentClient
35
35
  });
36
36
  module.exports = __toCommonJS(SingleAgentClient_exports);
37
+ var import_pricing_adapter = require('../utils/pricing-adapter.js');
38
+ var import_creative_adapter = require('../utils/creative-adapter.js');
39
+ var import_format_renders = require('../utils/format-renders.js');
37
40
  var import_schema_loader = require('../validation/schema-loader.js');
38
41
  var import_canonicalize = require('../signing/agent-resolver/canonicalize.js');
39
42
  var import_products = require('../supply-path/products.js');
@@ -80,7 +83,6 @@ var import_request_normalizer = require('../utils/request-normalizer.js');
80
83
  var import_global_async_local_storage = require('../utils/global-async-local-storage.js');
81
84
  var import_validate_user_agent = require('../utils/validate-user-agent.js');
82
85
  var import_webhook_url = require('./webhook-url.js');
83
- var import_v2_5 = require('../adapters/legacy/v2-5/index.js');
84
86
  var import_property_policy = require('../media-buy/property-policy.js');
85
87
  var import_targeting_helpers = require('../server/targeting-helpers.js');
86
88
  var import_creative_delivery = require('../v2/projection/creative-delivery.js');
@@ -220,6 +222,56 @@ const RECORDLESS_HMAC_READ_ONLY_TASKS = /* @__PURE__ */ new Set([
220
222
  ]);
221
223
  const TASK_SCOPED_STATE_LIMIT = 1e4;
222
224
  const WEBHOOK_JWKS_RESOLVER_LIMIT = 1024;
225
+ function creativeMatchesProductOption(creative, declaration) {
226
+ const params = isPlainRecord(declaration.params) ? declaration.params : {};
227
+ const assets = isPlainRecord(creative.assets) ? creative.assets : {};
228
+ const slots = Array.isArray(params.slots) ? params.slots : [];
229
+ if (!slots.every((slot) => {
230
+ if (!isPlainRecord(slot) || typeof slot.asset_group_id !== "string") return false;
231
+ const value = assets[slot.asset_group_id];
232
+ const entries = value === void 0 ? [] : Array.isArray(value) ? value : [value];
233
+ const minimum = Math.max(typeof slot.min === "number" ? slot.min : 0, slot.required === true ? 1 : 0);
234
+ if (entries.length < minimum || typeof slot.max === "number" && entries.length > slot.max) return false;
235
+ return entries.every(
236
+ (asset) => isPlainRecord(asset) && (typeof slot.asset_type !== "string" || asset.asset_type === slot.asset_type)
237
+ );
238
+ }))
239
+ return false;
240
+ const formatParams = isPlainRecord(creative.format_parameters) ? creative.format_parameters : {};
241
+ const kind = String(creative.format_kind);
242
+ const mediaType = kind.startsWith("image") ? "image" : kind.startsWith("video") ? "video" : kind.startsWith("audio") ? "audio" : kind === "html5" ? "html" : void 0;
243
+ const assetTypes = mediaType === "video" ? ["video", "vast"] : mediaType === "audio" ? ["audio", "vast", "daast"] : mediaType === "html" ? ["html", "zip"] : mediaType ? [mediaType] : ["image", "video", "audio", "html", "zip", "vast", "daast"];
244
+ const requiredMediaSlots = slots.filter(
245
+ (slot) => isPlainRecord(slot) && (slot.required === true || typeof slot.min === "number" && slot.min > 0) && assetTypes.includes(String(slot.asset_type))
246
+ );
247
+ const preferredGroups = mediaType ? [`${mediaType}_main`, mediaType, kind, ...assetTypes] : [];
248
+ const primaryGroup = (requiredMediaSlots.length === 1 ? String(requiredMediaSlots[0].asset_group_id) : void 0) ?? preferredGroups.find((group) => assets[group] !== void 0);
249
+ const sourceAssets = primaryGroup ? [assets[primaryGroup]] : Object.values(assets);
250
+ const dimensionalAssets = sourceAssets.flatMap((value) => Array.isArray(value) ? value : [value]).filter(
251
+ (value) => isPlainRecord(value) && assetTypes.includes(String(value.asset_type))
252
+ );
253
+ return (dimensionalAssets.length > 0 ? dimensionalAssets : [{}]).every((asset) => {
254
+ const actual = { ...asset, ...formatParams };
255
+ for (const key of ["width", "height"]) {
256
+ if (typeof params[key] === "number" && actual[key] !== params[key]) return false;
257
+ const min = params[`min_${key}`];
258
+ const max = params[`max_${key}`];
259
+ if (typeof min === "number" && (typeof actual[key] !== "number" || actual[key] < min)) return false;
260
+ if (typeof max === "number" && (typeof actual[key] !== "number" || actual[key] > max)) return false;
261
+ }
262
+ if (Array.isArray(params.sizes) && !params.sizes.some((size) => isPlainRecord(size) && size.width === actual.width && size.height === actual.height))
263
+ return false;
264
+ const duration = actual.duration_ms ?? actual.duration_ms_exact;
265
+ const exact = params.duration_ms_exact ?? params.duration_ms;
266
+ if (typeof exact === "number" && duration !== exact) return false;
267
+ if (typeof exact !== "number" && Array.isArray(params.duration_ms_range)) {
268
+ const [min, max] = params.duration_ms_range;
269
+ if (typeof duration !== "number" || typeof min === "number" && duration < min || typeof max === "number" && duration > max)
270
+ return false;
271
+ }
272
+ return true;
273
+ });
274
+ }
223
275
  function isDeferredClientFinalizationContext(value) {
224
276
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
225
277
  const context = value;
@@ -666,24 +718,7 @@ function isToolSchemaRecord(value) {
666
718
  function isCapabilityEvidence(value) {
667
719
  if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
668
720
  const candidate = value;
669
- return (candidate.version === "v2" || candidate.version === "v3") && Array.isArray(candidate.majorVersions) && candidate.majorVersions.length > 0 && candidate.majorVersions.every((version) => version === 2 || version === 3) && Array.isArray(candidate.protocols) && candidate.protocols.every((protocol) => typeof protocol === "string") && typeof candidate.features === "object" && candidate.features !== null && !Array.isArray(candidate.features) && Array.isArray(candidate.extensions) && candidate.extensions.every((extension) => typeof extension === "string") && typeof candidate._synthetic === "boolean";
670
- }
671
- function valueMatchesSchemaType(value, propSchema) {
672
- if (!propSchema || typeof propSchema !== "object") return false;
673
- const schema = propSchema;
674
- if (schema.$ref) return true;
675
- const valueType = Array.isArray(value) ? "array" : value === null ? "null" : typeof value === "object" ? "object" : typeof value;
676
- for (const key of ["anyOf", "oneOf"]) {
677
- const variants = schema[key];
678
- if (Array.isArray(variants)) {
679
- return variants.some((v) => valueMatchesSchemaType(value, v));
680
- }
681
- }
682
- const declared = schema.type;
683
- if (declared === void 0) return false;
684
- if (typeof declared === "string") return declared === valueType;
685
- if (Array.isArray(declared)) return declared.includes(valueType);
686
- return false;
721
+ return candidate.version === "v3" && Array.isArray(candidate.majorVersions) && candidate.majorVersions.includes(3) && candidate.majorVersions.every((version) => Number.isSafeInteger(version) && version > 0) && Array.isArray(candidate.protocols) && candidate.protocols.every((protocol) => typeof protocol === "string") && typeof candidate.features === "object" && candidate.features !== null && !Array.isArray(candidate.features) && Array.isArray(candidate.extensions) && candidate.extensions.every((extension) => typeof extension === "string") && typeof candidate._synthetic === "boolean";
687
722
  }
688
723
  function productHasPricingOptions(product) {
689
724
  if (!product || typeof product !== "object") return false;
@@ -696,7 +731,9 @@ function productIdForPricingDiagnostics(product) {
696
731
  return typeof id === "string" ? id : void 0;
697
732
  }
698
733
  function propertyListReferenceFromRequest(params) {
699
- const value = params.property_list;
734
+ const filters = params.filters;
735
+ const nested = filters && typeof filters === "object" && !Array.isArray(filters) && Object.hasOwn(filters, "property_list") && filters.property_list !== void 0;
736
+ const value = nested ? filters.property_list : params.property_list;
700
737
  if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
701
738
  const ref = value;
702
739
  if (typeof ref.agent_url !== "string" || typeof ref.list_id !== "string") return void 0;
@@ -709,21 +746,37 @@ function propertyListReferenceFromRequest(params) {
709
746
  function productPolicyRequestSnapshot(requestParams) {
710
747
  const account = canonicalAccountRoutingSnapshot(requestParams.account);
711
748
  const propertyList = propertyListReferenceFromRequest(requestParams);
749
+ const referenceError = propertyListReferenceError(requestParams);
712
750
  return Object.freeze({
713
751
  ...account ? { account } : {},
714
- ...propertyList ? { property_list: Object.freeze(propertyList) } : {}
752
+ ...propertyList ? { property_list: Object.freeze(propertyList) } : {},
753
+ ...referenceError ? { property_list_error: referenceError } : {}
715
754
  });
716
755
  }
756
+ function propertyListReferenceError(params) {
757
+ if (typeof params.property_list_error === "string") return params.property_list_error;
758
+ const filters = params.filters;
759
+ if (params.property_list !== void 0 && !propertyListReferenceFromRequest({ property_list: params.property_list }))
760
+ return "property_list_invalid_reference";
761
+ if (!filters || typeof filters !== "object" || Array.isArray(filters) || !Object.hasOwn(filters, "property_list") || filters.property_list === void 0)
762
+ return void 0;
763
+ const nested = propertyListReferenceFromRequest(params);
764
+ if (!nested) return "property_list_invalid_reference";
765
+ if (params.property_list !== void 0) {
766
+ const legacy = propertyListReferenceFromRequest({ property_list: params.property_list });
767
+ if (!legacy || nested.agent_url !== legacy.agent_url || nested.list_id !== legacy.list_id || nested.auth_token !== legacy.auth_token) {
768
+ return "property_list_conflicting_references";
769
+ }
770
+ }
771
+ return void 0;
772
+ }
717
773
  function hasProductPropertyPolicyRules(policy) {
718
774
  return Boolean(
719
775
  policy.allowedDomains?.length || policy.allowedPropertyIdentifiers?.length || policy.requireAllowedPropertyMatch || policy.excludedDomains?.length || policy.excludedPropertyIds?.length || policy.strict || policy.unknownSelectorBehavior || policy.missingPublisherPropertiesBehavior
720
776
  );
721
777
  }
722
- function comparablePropertyIdentifiers(identifiers) {
723
- return identifiers.filter((identifier) => identifier.type === "domain" || identifier.type === "subdomain").map((identifier) => ({ type: identifier.type, value: identifier.value }));
724
- }
725
778
  function unsupportedPropertyIdentifiers(identifiers) {
726
- return identifiers.filter((identifier) => identifier.type !== "domain" && identifier.type !== "subdomain").map((identifier) => ({ type: identifier.type }));
779
+ return identifiers.filter((identifier) => !(0, import_property_policy.isSupportedPropertyIdentifierType)(identifier.type)).map((identifier) => ({ type: identifier.type }));
727
780
  }
728
781
  function sanitizeDiagnosticUrl(value) {
729
782
  try {
@@ -1107,12 +1160,8 @@ class SingleAgentClient {
1107
1160
  // shared invalidation epoch of that key when the evidence was obtained
1108
1161
  sharedEvidenceKey;
1109
1162
  // discoveryCache key the local capability cache was obtained under
1110
- _v2WarningFired = false;
1111
- // Gate: emit the v2-sunset warning once per client instance
1112
1163
  _syntheticV3WarningFired = false;
1113
1164
  // Gate: emit the synthetic-v3 warning once per client instance
1114
- _syntheticV2WarningFired = false;
1115
- // Gate: emit the synthetic-v2 warning once per client instance
1116
1165
  productPolicyRequestParamsByTask = /* @__PURE__ */ new Map();
1117
1166
  canonicalCreativeTaskAssociations = /* @__PURE__ */ new Map();
1118
1167
  previewCreativeHandlersByTask = /* @__PURE__ */ new Map();
@@ -1320,8 +1369,17 @@ class SingleAgentClient {
1320
1369
  }
1321
1370
  assertDurablePropertyListCredentialSupported(taskType, requestParams) {
1322
1371
  if (!this.config.deferredStorage || taskType !== "get_products") return;
1323
- const propertyList = propertyListReferenceFromRequest(requestParams);
1324
- if (!propertyList?.auth_token) return;
1372
+ const filters = requestParams.filters;
1373
+ const references = [
1374
+ requestParams.property_list,
1375
+ filters && typeof filters === "object" ? filters.property_list : void 0
1376
+ ];
1377
+ const hasCredential = references.some((reference) => {
1378
+ if (!reference || typeof reference !== "object") return false;
1379
+ const token = reference.auth_token;
1380
+ return token !== void 0 && token !== null && token !== "";
1381
+ });
1382
+ if (!hasCredential) return;
1325
1383
  const policyConfig = this.config.validation?.productPropertyPolicy;
1326
1384
  if (policyConfig === false || policyConfig?.enforceRequestPropertyList === false) return;
1327
1385
  throw new import_errors.ConfigurationError(
@@ -1374,7 +1432,7 @@ class SingleAgentClient {
1374
1432
  }
1375
1433
  }
1376
1434
  }
1377
- rememberCanonicalProductRoutes(products, account, authoritativeProducts) {
1435
+ rememberCanonicalProductRoutes(products, account, authoritativeProducts, evidence) {
1378
1436
  this.invalidateCanonicalProductRoutes(authoritativeProducts ?? products, account);
1379
1437
  const accountScope = this.canonicalAccountScope(account);
1380
1438
  const declaredOptions = authoritativeProducts ? this.sellerDeclaredFormatOptions(authoritativeProducts) : void 0;
@@ -1394,12 +1452,15 @@ class SingleAgentClient {
1394
1452
  const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
1395
1453
  const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
1396
1454
  if (declared !== void 0) (0, import_legacy_metadata.rememberSellerDeclaredFormatOption)(option, declared);
1455
+ if (declared === true && evidence)
1456
+ (0, import_legacy_metadata.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
1397
1457
  this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
1398
1458
  kind: "product",
1399
1459
  accountScope,
1400
1460
  productId: product.product_id,
1401
1461
  optionRef: ref,
1402
1462
  refs,
1463
+ ...declared === true && (0, import_legacy_metadata.sellerFormatEvidence)(option) ? { declaration: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(option) } : {},
1403
1464
  ...declared === false ? { undeclaredSelector: (0, import_legacy_routes.undeclaredFormatOptionSelector)(option) } : {}
1404
1465
  });
1405
1466
  }
@@ -3381,7 +3442,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3381
3442
  /**
3382
3443
  * Execute task and call appropriate handler on completion
3383
3444
  *
3384
- * Automatically adapts requests for v2 servers and normalizes responses.
3445
+ * Adapts requests for maintained AdCP 3 releases and normalizes product responses.
3385
3446
  */
3386
3447
  async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3387
3448
  const requestParamsSnapshot = structuredClone(params);
@@ -3426,11 +3487,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3426
3487
  await this.requireSupportedMajor(taskType, options);
3427
3488
  (0, import_abort2.throwIfAborted)(options?.signal);
3428
3489
  }
3429
- const earlyResult = await this.getEarlyResultForUnsupportedFeatures(taskType, normalizedParams, options);
3430
- (0, import_abort2.throwIfAborted)(options?.signal);
3431
- if (earlyResult) {
3432
- return (0, import_match.attachMatch)(earlyResult);
3433
- }
3434
3490
  const agent = await this.ensureEndpointDiscovered(options);
3435
3491
  (0, import_abort2.throwIfAborted)(options?.signal);
3436
3492
  if (!options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation && !options?.preserveGovernedPayload) {
@@ -3469,11 +3525,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3469
3525
  capabilityDiscoveryContext.toolSchemas,
3470
3526
  capabilityDiscoveryContext.capabilities
3471
3527
  );
3472
- const v25DriftLogs = [...adaptDriftLogs];
3473
- if (webhookDriftLog) v25DriftLogs.push(webhookDriftLog);
3474
- if (serverVersion === "v2") {
3475
- this.executor.validateAdaptedRequestAgainstV2(taskType, adaptedParams, v25DriftLogs);
3476
- }
3528
+ const adaptationLogs = [...adaptDriftLogs];
3529
+ if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
3477
3530
  const canonicalInputHandler = this.canonicalCreativeInputHandler(
3478
3531
  taskType,
3479
3532
  inputHandler,
@@ -3520,7 +3573,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3520
3573
  );
3521
3574
  (0, import_abort2.throwIfAborted)(effectiveOptions?.signal);
3522
3575
  if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
3523
- const postAdapterLogs = [...inputSchemaStripLogs, ...v25DriftLogs];
3576
+ const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
3524
3577
  if (postAdapterLogs.length > 0) {
3525
3578
  result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
3526
3579
  }
@@ -3616,7 +3669,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3616
3669
  const rawSubmittedWaitForCompletion = result.submitted?.waitForCompletion;
3617
3670
  const finalizerLegacyFormatConverter = legacyFormatConverter ?? this.resolveLegacyFormatConverter(void 0, context.projectionCatalogs);
3618
3671
  if (result.success && result.data) {
3619
- result.data = this.normalizeResponseToV3(taskType, result.data);
3672
+ result.data = this.normalizeEstablishedResponse(taskType, result.data);
3620
3673
  }
3621
3674
  result = this.wrapProductPolicySubmittedContinuation(
3622
3675
  result,
@@ -3762,7 +3815,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3762
3815
  };
3763
3816
  }
3764
3817
  projectCanonicalCreativeData(taskType, data, transform, legacyFormatConverter) {
3765
- let projected = this.normalizeResponseToV3(taskType, data);
3818
+ let projected = this.normalizeEstablishedResponse(taskType, data);
3766
3819
  const record = projected && typeof projected === "object" ? projected : void 0;
3767
3820
  const canProjectRead = taskType === "get_products" ? Array.isArray(record?.products) : taskType === "list_creatives" ? Array.isArray(record?.creatives) : true;
3768
3821
  if (transform && canProjectRead) {
@@ -4132,39 +4185,40 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4132
4185
  message = "Property list not adhered to",
4133
4186
  enforceRequestPropertyList = true,
4134
4187
  propertyListResolveOptions,
4188
+ resolvePublisherProperties,
4189
+ maxPublisherLookups = 100,
4190
+ publisherLookupTimeoutMs = 1e4,
4191
+ publisherLookupBudgetMs = 1e4,
4135
4192
  ...explicitPolicy
4136
4193
  } = policyConfig || {};
4137
4194
  const policy = {
4138
4195
  ...explicitPolicy
4139
4196
  };
4140
4197
  let resolvedRequestPropertyList;
4141
- if (requestPropertyList && enforceRequestPropertyList) {
4198
+ const referenceError = propertyListReferenceError(requestParams);
4199
+ if ((requestPropertyList || referenceError) && enforceRequestPropertyList) {
4142
4200
  try {
4201
+ if (referenceError) throw new Error(referenceError);
4143
4202
  const resolved = await (0, import_targeting_helpers.resolvePropertyList)(requestPropertyList, propertyListResolveOptions);
4144
- const comparableIdentifiers = comparablePropertyIdentifiers(resolved.identifiers);
4145
4203
  const unsupportedIdentifiers = unsupportedPropertyIdentifiers(resolved.identifiers);
4146
- if (unsupportedIdentifiers.length > 0) {
4147
- throw new Error("property_list_unsupported_identifier_types");
4148
- }
4149
- if (comparableIdentifiers.length > 0 || resolved.identifiers.length === 0) {
4150
- policy.allowedPropertyIdentifiers = [...policy.allowedPropertyIdentifiers ?? [], ...comparableIdentifiers];
4151
- policy.requireAllowedPropertyMatch = true;
4152
- }
4204
+ policy.allowedPropertyIdentifiers = [...policy.allowedPropertyIdentifiers ?? [], ...resolved.identifiers];
4205
+ policy.requireAllowedPropertyMatch = true;
4153
4206
  policy.strict = policy.strict ?? true;
4154
4207
  resolvedRequestPropertyList = {
4155
4208
  listId: resolved.listId,
4156
4209
  agentUrl: resolved.agentUrl,
4157
4210
  identifierCount: resolved.identifiers.length,
4211
+ unsupportedIdentifierTypes: [...new Set(unsupportedIdentifiers.map((identifier) => identifier.type))],
4158
4212
  ...resolved.cacheValidUntil ? { cacheValidUntil: resolved.cacheValidUntil } : {}
4159
4213
  };
4160
4214
  } catch (err) {
4161
4215
  const errorCode = propertyListResolutionErrorCode(err);
4162
- const diagnosticAgentUrl = sanitizeDiagnosticUrl(requestPropertyList.agent_url);
4216
+ const diagnosticAgentUrl = requestPropertyList ? sanitizeDiagnosticUrl(requestPropertyList.agent_url) : "invalid_url";
4163
4217
  return (0, import_match.attachMatch)({
4164
4218
  success: false,
4165
4219
  status: "failed",
4166
4220
  data: response,
4167
- error: `${message}: could not resolve property_list ${requestPropertyList.list_id}`,
4221
+ error: `${message}: could not resolve property_list`,
4168
4222
  metadata: {
4169
4223
  ...result.metadata,
4170
4224
  status: "failed",
@@ -4177,7 +4231,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4177
4231
  message,
4178
4232
  diagnostics: [],
4179
4233
  request_property_list: {
4180
- list_id: requestPropertyList.list_id,
4234
+ list_id: requestPropertyList?.list_id ?? "invalid_reference",
4181
4235
  agent_url: diagnosticAgentUrl,
4182
4236
  resolution_error: errorCode
4183
4237
  }
@@ -4192,7 +4246,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4192
4246
  mode,
4193
4247
  ok: false,
4194
4248
  request_property_list: {
4195
- list_id: requestPropertyList.list_id,
4249
+ list_id: requestPropertyList?.list_id,
4196
4250
  agent_url: diagnosticAgentUrl,
4197
4251
  resolution_error: errorCode
4198
4252
  }
@@ -4202,6 +4256,65 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4202
4256
  }
4203
4257
  }
4204
4258
  if (!hasProductPropertyPolicyRules(policy)) return result;
4259
+ if (resolvePublisherProperties && policy.allowedPropertyIdentifiers?.some(
4260
+ (identifier) => identifier.type !== "domain" && identifier.type !== "subdomain"
4261
+ )) {
4262
+ if (!Number.isSafeInteger(maxPublisherLookups) || maxPublisherLookups < 1 || !Number.isSafeInteger(publisherLookupTimeoutMs) || publisherLookupTimeoutMs < 1 || publisherLookupTimeoutMs > 2147483647 || !Number.isSafeInteger(publisherLookupBudgetMs) || publisherLookupBudgetMs < 1 || publisherLookupBudgetMs > 2147483647) {
4263
+ throw new import_errors.ConfigurationError("Publisher lookup limits must be positive bounded integers");
4264
+ }
4265
+ const { validatePublisherDomain } = await import("../identifiers.js");
4266
+ const catalogs = Object.assign(
4267
+ /* @__PURE__ */ Object.create(null),
4268
+ policy.publisherProperties
4269
+ );
4270
+ const domains = new Set(
4271
+ response.products.flatMap(
4272
+ (product) => Array.isArray(product.publisher_properties) ? product.publisher_properties.flatMap(
4273
+ (selector) => selector && typeof selector === "object" && "publisher_domain" in selector ? [selector.publisher_domain] : []
4274
+ ) : []
4275
+ )
4276
+ );
4277
+ const hosts = [
4278
+ ...new Set(
4279
+ [...domains].flatMap(
4280
+ (domain) => typeof domain === "string" ? [(0, import_property_policy.normalizeDomainForPropertyPolicy)(domain)?.host] : []
4281
+ )
4282
+ )
4283
+ ].filter((host) => typeof host === "string" && !Object.hasOwn(catalogs, host));
4284
+ for (const host of hosts) catalogs[host] = void 0;
4285
+ const lookupStartedAt = performance.now();
4286
+ for (const host of hosts.slice(0, maxPublisherLookups)) {
4287
+ (0, import_abort2.throwIfAborted)(taskSignal);
4288
+ const remainingBudgetMs = publisherLookupBudgetMs - (performance.now() - lookupStartedAt);
4289
+ if (remainingBudgetMs <= 0) break;
4290
+ if (!validatePublisherDomain(host).ok || (0, import_net.isLikelyPrivateUrl)(`https://${host}`)) continue;
4291
+ const controller = new AbortController();
4292
+ const signal = taskSignal ? AbortSignal.any([taskSignal, controller.signal]) : controller.signal;
4293
+ let timeout;
4294
+ let budgetExpired = false;
4295
+ try {
4296
+ catalogs[host] = await Promise.race([
4297
+ resolvePublisherProperties(host, { signal }),
4298
+ new Promise((_, reject) => {
4299
+ timeout = setTimeout(
4300
+ () => {
4301
+ if (remainingBudgetMs <= publisherLookupTimeoutMs) budgetExpired = true;
4302
+ controller.abort();
4303
+ reject(new Error("publisher_catalog_timeout"));
4304
+ },
4305
+ Math.min(publisherLookupTimeoutMs, remainingBudgetMs)
4306
+ );
4307
+ })
4308
+ ]);
4309
+ } catch {
4310
+ catalogs[host] = void 0;
4311
+ } finally {
4312
+ if (timeout) clearTimeout(timeout);
4313
+ }
4314
+ if (budgetExpired) break;
4315
+ }
4316
+ policy.publisherProperties = catalogs;
4317
+ }
4205
4318
  let validation;
4206
4319
  try {
4207
4320
  validation = (0, import_property_policy.validateProductsAgainstPropertyPolicy)({
@@ -4225,6 +4338,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4225
4338
  list_id: resolvedRequestPropertyList.listId,
4226
4339
  agent_url: sanitizeDiagnosticUrl(resolvedRequestPropertyList.agentUrl),
4227
4340
  identifier_count: resolvedRequestPropertyList.identifierCount,
4341
+ unsupported_identifier_types: resolvedRequestPropertyList.unsupportedIdentifierTypes,
4228
4342
  ...resolvedRequestPropertyList.cacheValidUntil ? { cache_valid_until: resolvedRequestPropertyList.cacheValidUntil } : {}
4229
4343
  }
4230
4344
  } : {},
@@ -4374,7 +4488,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4374
4488
  waitForCompletion: async (pollInterval, signal) => {
4375
4489
  let completed = await submitted.waitForCompletion(pollInterval, signal);
4376
4490
  if (completed.success && completed.data) {
4377
- completed.data = this.normalizeResponseToV3(taskType, completed.data);
4491
+ completed.data = this.normalizeEstablishedResponse(taskType, completed.data);
4378
4492
  }
4379
4493
  const terminal = completed.status === "completed" || completed.status === "failed";
4380
4494
  try {
@@ -4405,7 +4519,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4405
4519
  (0, import_match.attachMatch)({
4406
4520
  success: true,
4407
4521
  status: "completed",
4408
- data: this.normalizeResponseToV3(taskType, taskInfo.result),
4522
+ data: this.normalizeEstablishedResponse(taskType, taskInfo.result),
4409
4523
  metadata: {
4410
4524
  taskId: taskInfo.taskId,
4411
4525
  taskName: taskInfo.taskType,
@@ -4481,8 +4595,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4481
4595
  }
4482
4596
  /**
4483
4597
  * Adapt a request for the detected server wire version and the seller's
4484
- * AdCP protocol version. Applies wire-format adapters (v2.5) when talking
4485
- * to a v2 server, then applies protocol-version adapters (e.g. stripping
4598
+ * AdCP protocol version. Applies protocol-version adapters (e.g. stripping
4486
4599
  * 3.1-only fields for a 3.0 seller). Returns the adapted params and any
4487
4600
  * drift log entries describing what was changed.
4488
4601
  *
@@ -4490,22 +4603,14 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4490
4603
  * current call's tool schemas can be supplied without cross-tenant caching.
4491
4604
  */
4492
4605
  adaptRequest(taskType, params, serverVersion, debugLogs, perCallToolSchemas, perCallCapabilities) {
4493
- const driftLogs = [];
4494
- let adapted = params;
4495
4606
  if (serverVersion !== "v3") {
4496
- const pair = (0, import_v2_5.getV25Adapter)(taskType);
4497
- if (pair) adapted = pair.adaptRequest(adapted);
4607
+ throw new import_errors.VersionUnsupportedError(taskType, "version", "v2", this.agent.agent_uri);
4498
4608
  }
4609
+ const driftLogs = [];
4610
+ let adapted = params;
4499
4611
  const toolSchema = (perCallToolSchemas ?? this.cachedToolSchemas)?.get(taskType);
4500
4612
  if (toolSchema && Object.keys(toolSchema).length > 0) {
4501
4613
  const declaredFields = new Set(Object.keys(toolSchema));
4502
- const adapterAliases = [["brand_manifest", "brand"]];
4503
- for (const [adapterField, schemaField] of adapterAliases) {
4504
- if (adapted[adapterField] !== void 0 && !declaredFields.has(adapterField) && declaredFields.has(schemaField) && adapted[schemaField] === void 0 && valueMatchesSchemaType(adapted[adapterField], toolSchema[schemaField])) {
4505
- adapted[schemaField] = adapted[adapterField];
4506
- delete adapted[adapterField];
4507
- }
4508
- }
4509
4614
  const envelopeFields = import_adcp.ADCP_ENVELOPE_FIELDS;
4510
4615
  const filtered = {};
4511
4616
  const schemaStripped = [];
@@ -4553,67 +4658,19 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4553
4658
  }
4554
4659
  return { params: adapted, driftLogs };
4555
4660
  }
4556
- /**
4557
- * Normalize response to v3 format
4558
- *
4559
- * Converts v2 responses to v3 structure for consistent API surface.
4560
- */
4561
- normalizeResponseToV3(taskType, data) {
4562
- const pair = (0, import_v2_5.getV25Adapter)(taskType);
4563
- if (pair?.normalizeResponse) return pair.normalizeResponse(data);
4564
- return data;
4565
- }
4566
- /**
4567
- * Check if request uses v3 features that the server doesn't support
4568
- *
4569
- * Returns an early empty result if the request requires v3 features
4570
- * that the server doesn't support. This treats "products matching unsupported
4571
- * capability" as an empty result set rather than an error.
4572
- *
4573
- * @returns TaskResult with empty data if v3 features are unsupported, null to proceed normally
4574
- */
4575
- async getEarlyResultForUnsupportedFeatures(taskType, params, options) {
4576
- if (taskType !== "get_products") {
4577
- return null;
4578
- }
4579
- const capabilities = await this.getCapabilities(options);
4580
- if (capabilities.version === "v3") {
4581
- return null;
4582
- }
4583
- const usesUnsupportedFeature = (
4584
- // required_features: content_standards requires contentStandards
4585
- params.filters?.required_features?.includes("content_standards") && !capabilities.features.contentStandards
4586
- );
4587
- if (!usesUnsupportedFeature) {
4588
- return null;
4661
+ normalizeEstablishedResponse(taskType, data) {
4662
+ if (!data) return data;
4663
+ switch (taskType) {
4664
+ case "get_products":
4665
+ return (0, import_pricing_adapter.normalizeGetProductsResponse)(data);
4666
+ case "create_media_buy":
4667
+ case "update_media_buy":
4668
+ return (0, import_creative_adapter.normalizeMediaBuyResponse)(data);
4669
+ case "list_creative_formats":
4670
+ return (0, import_format_renders.normalizeFormatsResponse)(data);
4671
+ default:
4672
+ return data;
4589
4673
  }
4590
- console.warn(
4591
- `[AdCP] v3-only features not supported by server "${this.agent.id}" (${capabilities.version}). Returning empty results.`
4592
- );
4593
- const emptyResponse = {
4594
- products: [],
4595
- property_list_applied: false
4596
- };
4597
- return {
4598
- success: true,
4599
- status: "completed",
4600
- data: emptyResponse,
4601
- metadata: {
4602
- taskId: `early_${Date.now()}`,
4603
- taskName: taskType,
4604
- agent: {
4605
- id: this.agent.id,
4606
- name: this.agent.name,
4607
- protocol: this.normalizedAgent.protocol
4608
- },
4609
- responseTimeMs: 0,
4610
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4611
- clarificationRounds: 0,
4612
- status: "completed",
4613
- serverVersion: capabilities.version,
4614
- serverVersionSynthetic: capabilities._synthetic
4615
- }
4616
- };
4617
4674
  }
4618
4675
  // ====== MEDIA BUY TASKS ======
4619
4676
  /**
@@ -4713,6 +4770,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4713
4770
  }
4714
4771
  }
4715
4772
  const conditionalSnapshot = skipCacheRead ? void 0 : cache?.read(cacheScope, cacheParams, true);
4773
+ const productEvidence = this.usesScopedDiscoveryTransport(
4774
+ effectiveOptions
4775
+ ) ? void 0 : {
4776
+ scopeKey: this.getCapabilityEvidenceScope().scopeKey,
4777
+ accountScope: this.canonicalAccountScope(account),
4778
+ expiresAt: Date.now() + (0, import_agent_discovery_cache.resolveAgentDiscoveryTtlMs)(this.config.discoveryCache?.ttlMs)
4779
+ };
4716
4780
  const result = await this.executeAndHandle(
4717
4781
  "get_products",
4718
4782
  "onGetProductsStatusChange",
@@ -4725,7 +4789,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4725
4789
  projectionCatalogs: projectionCatalogs ?? this.config.projectionCatalogs
4726
4790
  });
4727
4791
  const authoritativeProducts = Array.isArray(data.products) ? data.products : response.products;
4728
- this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts);
4792
+ this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts, productEvidence);
4729
4793
  const { _message: _dropLegacyMessage, ...canonical } = response;
4730
4794
  void _dropLegacyMessage;
4731
4795
  return { ...canonical, projection: { diagnostics } };
@@ -4736,7 +4800,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4736
4800
  );
4737
4801
  const finishCache = async (completed) => {
4738
4802
  if (!cache) return completed;
4739
- const cachedResult = cache.write(cacheScope, cacheParams, completed, conditionalSnapshot);
4803
+ const cachedResult = cache.write(cacheScope, cacheParams, completed, conditionalSnapshot, (materialized) => {
4804
+ this.rememberCanonicalProductRoutes(materialized.data?.products ?? [], account, void 0, productEvidence);
4805
+ });
4740
4806
  if (cachedResult.success && cachedResult.status === "completed") {
4741
4807
  if (!skipCacheRead && cacheParams.if_wholesale_feed_version === void 0 && cacheParams.if_pricing_version === void 0 && cachedResult.data.unchanged === true) {
4742
4808
  return this.getProducts(params, inputHandler, {
@@ -4914,7 +4980,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4914
4980
  if (hasCreativeFormatData) {
4915
4981
  this.validateBeforeCreativeCapabilityProbe("create_media_buy", params, taskOptions);
4916
4982
  }
4917
- const wireMode = hasCreativeFormatData ? await this.resolveCreativeFormatWireMode("create_media_buy", taskOptions) : "canonical";
4983
+ const wireMode = hasCreativeFormatData ? await this.resolveCreativeWireMode(
4984
+ "create_media_buy",
4985
+ taskOptions,
4986
+ true,
4987
+ () => this.productOptionsSupportCanonicalWire("create_media_buy", params, [], options)
4988
+ ) : "canonical";
4918
4989
  const wireParams = params;
4919
4990
  const result = await this.executeAndHandle(
4920
4991
  "create_media_buy",
@@ -5002,7 +5073,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5002
5073
  if (hasCreativeFormatData) {
5003
5074
  this.validateBeforeCreativeCapabilityProbe("update_media_buy", params, taskOptions);
5004
5075
  }
5005
- const wireMode = hasCreativeFormatData ? await this.resolveCreativeFormatWireMode("update_media_buy", taskOptions) : "canonical";
5076
+ const wireMode = hasCreativeFormatData ? await this.resolveCreativeWireMode(
5077
+ "update_media_buy",
5078
+ taskOptions,
5079
+ true,
5080
+ () => this.productOptionsSupportCanonicalWire("update_media_buy", params, [], options)
5081
+ ) : "canonical";
5006
5082
  const result = await this.executeAndHandle(
5007
5083
  "update_media_buy",
5008
5084
  "onUpdateMediaBuyStatusChange",
@@ -5091,7 +5167,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5091
5167
  projectionCatalogs ?? this.config.projectionCatalogs
5092
5168
  );
5093
5169
  this.validateBeforeCreativeCapabilityProbe("sync_creatives", params, taskOptions);
5094
- const wireMode = await this.resolveCreativeFormatWireMode("sync_creatives", taskOptions);
5095
5170
  const configuredSelectorContainers = [
5096
5171
  ...creativeFormatProjection?.selectorContainers ?? []
5097
5172
  ];
@@ -5103,10 +5178,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5103
5178
  const assignmentPackageContainers = Array.isArray(params.assignments) ? params.assignments.flatMap(
5104
5179
  (assignment) => typeof assignment.package_id === "string" && !configuredPackageIds.has(assignment.package_id) ? [{ package_id: assignment.package_id }] : []
5105
5180
  ) : [];
5181
+ const selectorContainers = [...configuredSelectorContainers, ...assignmentPackageContainers];
5182
+ const wireMode = await this.resolveCreativeWireMode(
5183
+ "sync_creatives",
5184
+ taskOptions,
5185
+ true,
5186
+ () => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, options)
5187
+ );
5106
5188
  const wireParams = this.projectUndeclaredFormatOptions(
5107
5189
  (0, import_creative_delivery.projectSyncCreativesForDelivery)(
5108
5190
  params,
5109
- [...configuredSelectorContainers, ...assignmentPackageContainers],
5191
+ selectorContainers,
5110
5192
  wireMode,
5111
5193
  effectiveLegacyFormatConverter,
5112
5194
  effectiveCanonicalFormatLegacyResolver
@@ -5146,16 +5228,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5146
5228
  * sending a mutation. Discovers capabilities and the current tool's input
5147
5229
  * schema, or reuses fresh cached/primed evidence, with this client's wire pin.
5148
5230
  *
5149
- * `unknown` preserves the conservative legacy projection for older peers
5150
- * whose capabilities and schema do not establish support. Projection still
5151
- * requires an unambiguous legacy reference for each creative in that case.
5231
+ * This context-free check returns `unknown` when capabilities and schema do
5232
+ * not establish support. A write to a proven 3.1 seller can still select
5233
+ * canonical delivery from matching seller-advertised product options;
5234
+ * otherwise projection requires an unambiguous legacy reference.
5152
5235
  * Conflicting evidence and unproven support with a 3.2+ buyer pin throw
5153
5236
  * `CreativeFormatCapabilityError`, just as they do during a write.
5154
5237
  */
5155
5238
  async resolveCreativeFormatWireMode(taskType, options) {
5156
5239
  return this.resolveCreativeWireMode(taskType, options, true);
5157
5240
  }
5158
- async resolveCreativeWireMode(taskType, options, canRediscover) {
5241
+ async resolveCreativeWireMode(taskType, options, canRediscover, matchingProductOptions) {
5159
5242
  const discoveryContext = {};
5160
5243
  const capabilities = await this.getCapabilities({
5161
5244
  ...options,
@@ -5174,13 +5257,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5174
5257
  `Seller capability and ${taskType} input schema disagree about canonical creative support`
5175
5258
  );
5176
5259
  }
5177
- const resolved = declared !== "unknown" ? declared : schema;
5260
+ let resolved = declared !== "unknown" ? declared : schema;
5261
+ if (resolved === "unknown" && (0, import_creative_delivery.canUseProductOptionsForCreativeWire)(capabilities, wireRelease) && matchingProductOptions?.()) {
5262
+ resolved = "canonical";
5263
+ }
5178
5264
  const release = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(wireRelease.trim());
5179
5265
  const canonicalRequiredByBuyerPin = release !== null && (Number(release[1]) > 3 || Number(release[1]) === 3 && Number(release[2]) >= 2);
5180
5266
  if (resolved === "unknown" && canonicalRequiredByBuyerPin) {
5181
5267
  if (canRediscover && !usesScopedFetch && this.normalizedAgent.protocol === "mcp" && this.capabilitiesFromSharedCache && toolSchemas?.has(taskType) && !toolInputSchemasByProperties.has(toolSchemas)) {
5182
5268
  await this.invalidateDiscoveryCache(options);
5183
- return this.resolveCreativeWireMode(taskType, options, false);
5269
+ return this.resolveCreativeWireMode(taskType, options, false, matchingProductOptions);
5184
5270
  }
5185
5271
  throw new import_creative_delivery.CreativeFormatCapabilityError(
5186
5272
  `Cannot prove which AdCP release the seller serves for ${taskType}; a 3.2+ client will not guess a legacy creative wire shape`
@@ -5188,6 +5274,112 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5188
5274
  }
5189
5275
  return resolved;
5190
5276
  }
5277
+ /** Product evidence applies to this request only; it must never prime a tool-wide capability. */
5278
+ productOptionsSupportCanonicalWire(taskType, request, selectorContainers = [], options) {
5279
+ if (!isPlainRecord(request) || this.usesScopedDiscoveryTransport(options)) return false;
5280
+ const scopeKey = this.getCapabilityEvidenceScope().scopeKey;
5281
+ const accountScope = this.canonicalAccountScope(request.account);
5282
+ const optionRef = (value) => {
5283
+ if (!isPlainRecord(value) || typeof value.format_option_id !== "string" || !value.format_option_id) {
5284
+ return void 0;
5285
+ }
5286
+ if (typeof value.publisher_domain === "string") {
5287
+ return {
5288
+ scope: "publisher",
5289
+ publisher_domain: value.publisher_domain,
5290
+ format_option_id: value.format_option_id
5291
+ };
5292
+ }
5293
+ if (value.scope !== void 0 && value.scope !== "product") return void 0;
5294
+ return { scope: "product", format_option_id: value.format_option_id };
5295
+ };
5296
+ const accepts = (container, creative, depth = 0) => {
5297
+ if (depth > 32) return false;
5298
+ if (Array.isArray(container.selector_containers)) {
5299
+ return container.selector_containers.length > 0 && container.selector_containers.every((nested) => accepts(nested, creative, depth + 1));
5300
+ }
5301
+ const refs = Array.isArray(container.format_option_refs) ? container.format_option_refs.map(optionRef) : [];
5302
+ if (refs.some((ref) => ref === void 0)) return false;
5303
+ const creativeRef = isPlainRecord(creative) ? optionRef(creative.format_option_ref) : void 0;
5304
+ if (isPlainRecord(creative) && creative.format_option_ref !== void 0 && !creativeRef) return false;
5305
+ const isSellerDeclaration = (value) => {
5306
+ if (!isPlainRecord(value) || (0, import_legacy_metadata.sellerDeclaredFormatOption)(value) !== true || (0, import_legacy_metadata.isSynthesizedFormatOption)(value)) {
5307
+ return false;
5308
+ }
5309
+ const evidence2 = (0, import_legacy_metadata.sellerFormatEvidence)(value);
5310
+ if (!evidence2 || evidence2.scopeKey !== scopeKey || typeof container.product_id === "string" && evidence2.productId !== container.product_id || evidence2.expiresAt <= Date.now() || evidence2.accountScope !== accountScope && evidence2.accountScope !== "none")
5311
+ return false;
5312
+ const ref = optionRef(value);
5313
+ if (ref && (0, import_legacy_routes.formatOptionOriginFromRoutes)(
5314
+ options?.canonicalFormatLegacyResolver,
5315
+ ref,
5316
+ typeof container.product_id === "string" ? container.product_id : void 0
5317
+ )?.seller_declared === false)
5318
+ return false;
5319
+ return !ref || typeof container.product_id !== "string" || this.cachedFormatOptionOrigin(request.account, ref, container.product_id)?.seller_declared !== false;
5320
+ };
5321
+ const declarations = [
5322
+ ...(Array.isArray(container.format_options) ? container.format_options : []).filter(isSellerDeclaration),
5323
+ ...(0, import_legacy_metadata.selectedFormatOptions)(container).filter(isSellerDeclaration)
5324
+ ];
5325
+ if (typeof container.product_id === "string") {
5326
+ for (const ref of [...refs, ...creativeRef ? [creativeRef] : []]) {
5327
+ if (!ref) continue;
5328
+ const route = this.routeForOption(request.account, container.product_id, ref);
5329
+ if (route?.kind === "product" && route.declaration && isSellerDeclaration(route.declaration))
5330
+ declarations.push(route.declaration);
5331
+ }
5332
+ }
5333
+ const available = declarations.filter((declaration) => declaration.experimental !== true);
5334
+ const matchesRef = (declaration, ref) => {
5335
+ const declaredRef = optionRef(declaration);
5336
+ return declaredRef !== void 0 && (0, import_legacy_routes.sameFormatOptionRef)(declaredRef, ref);
5337
+ };
5338
+ if (!refs.every((ref) => available.some((declaration) => matchesRef(declaration, ref)))) return false;
5339
+ const selected = available.filter(
5340
+ (declaration) => refs.length === 0 || refs.some((ref) => matchesRef(declaration, ref))
5341
+ );
5342
+ if (creative === void 0) return refs.length > 0 && selected.length > 0;
5343
+ if (!isPlainRecord(creative) || typeof creative.format_kind !== "string" || creative.format_id !== void 0)
5344
+ return false;
5345
+ return selected.some(
5346
+ (declaration) => declaration.format_kind === creative.format_kind && (!creativeRef || matchesRef(declaration, creativeRef)) && creativeMatchesProductOption(creative, declaration)
5347
+ );
5348
+ };
5349
+ if (taskType === "sync_creatives") {
5350
+ if (!Array.isArray(request.creatives) || request.creatives.length === 0) return false;
5351
+ const creatives = request.creatives;
5352
+ const assignments = Array.isArray(request.assignments) ? request.assignments : [];
5353
+ if (!assignments.every(
5354
+ (value) => isPlainRecord(value) && typeof value.package_id === "string" && typeof value.creative_id === "string" && creatives.some((creative) => isPlainRecord(creative) && creative.creative_id === value.creative_id)
5355
+ ))
5356
+ return false;
5357
+ return creatives.every((creative) => {
5358
+ if (!isPlainRecord(creative)) return false;
5359
+ const assigned = new Set(
5360
+ assignments.flatMap(
5361
+ (value) => isPlainRecord(value) && value.creative_id === creative.creative_id && typeof value.package_id === "string" ? [value.package_id] : []
5362
+ )
5363
+ );
5364
+ const relevant = assigned.size === 0 ? selectorContainers : selectorContainers.filter(
5365
+ (container) => typeof container.package_id === "string" && assigned.has(container.package_id)
5366
+ );
5367
+ return relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative));
5368
+ });
5369
+ }
5370
+ const packages = ["packages", "new_packages"].flatMap((key) => Array.isArray(request[key]) ? request[key] : []);
5371
+ let evidence = false;
5372
+ return packages.length > 0 && packages.every((pkg) => {
5373
+ if (!isPlainRecord(pkg)) return false;
5374
+ const creatives = Array.isArray(pkg.creatives) ? pkg.creatives : [];
5375
+ const hasSelectors = Array.isArray(pkg.format_option_refs) && pkg.format_option_refs.length > 0;
5376
+ if (!hasSelectors && creatives.length === 0) {
5377
+ return pkg.format_kind === void 0 && pkg.format_ids === void 0;
5378
+ }
5379
+ evidence = true;
5380
+ return (!hasSelectors || accepts(pkg)) && creatives.every((creative) => accepts(pkg, creative));
5381
+ }) && evidence;
5382
+ }
5191
5383
  /** Validate malformed creative payloads before capability discovery can perform I/O. */
5192
5384
  validateBeforeCreativeCapabilityProbe(taskType, params, options) {
5193
5385
  if (options.skipIdempotencyAutoInject || options.skipAccountValidation || options.skipRequestValidation) return;
@@ -6096,11 +6288,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6096
6288
  capabilityDiscoveryContext.toolSchemas,
6097
6289
  capabilityDiscoveryContext.capabilities
6098
6290
  );
6099
- const v25DriftLogs = [...adaptDriftLogs];
6100
- if (webhookDriftLog) v25DriftLogs.push(webhookDriftLog);
6101
- if (serverVersion === "v2") {
6102
- this.executor.validateAdaptedRequestAgainstV2(taskName, adaptedParams, v25DriftLogs);
6103
- }
6291
+ const adaptationLogs = [...adaptDriftLogs];
6292
+ if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
6104
6293
  const deferredClientContext = {
6105
6294
  kind: "single-agent",
6106
6295
  taskType: taskName,
@@ -6130,7 +6319,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6130
6319
  deferredClientContext
6131
6320
  );
6132
6321
  if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
6133
- const postAdapterLogs = [...inputSchemaStripLogs, ...v25DriftLogs];
6322
+ const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
6134
6323
  if (postAdapterLogs.length > 0) {
6135
6324
  result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
6136
6325
  }
@@ -6320,6 +6509,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6320
6509
  getProtocol() {
6321
6510
  return this.normalizedAgent.protocol;
6322
6511
  }
6512
+ /** Resolved MCP endpoint already used by this client; never performs discovery. */
6513
+ getDiscoveredMcpEndpoint() {
6514
+ return this.discoveredEndpoint;
6515
+ }
6323
6516
  /**
6324
6517
  * Get the canonical base URL for this agent
6325
6518
  *
@@ -6821,7 +7014,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6821
7014
  * Get agent capabilities, including AdCP version support
6822
7015
  *
6823
7016
  * For v3 servers, calls get_adcp_capabilities tool.
6824
- * For v2 servers, builds synthetic capabilities from available tools.
7017
+ * Requires AdCP 3 capability discovery; retired AdCP 2 agents are rejected.
6825
7018
  *
6826
7019
  * @returns Promise resolving to normalized capabilities object
6827
7020
  *
@@ -6858,7 +7051,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6858
7051
  }
6859
7052
  if (!usesScopedFetch && this.cachedCapabilities) {
6860
7053
  if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
6861
- this.maybeWarnV2Sunset(this.cachedCapabilities);
7054
+ this.assertSupportedServer(this.cachedCapabilities);
6862
7055
  return this.cachedCapabilities;
6863
7056
  }
6864
7057
  if (!usesScopedFetch && this.config.discoveryCache) {
@@ -6942,7 +7135,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6942
7135
  this.capabilitiesFromSharedCache = true;
6943
7136
  this.recordSharedEvidence(key);
6944
7137
  if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
6945
- this.maybeWarnV2Sunset(installed);
7138
+ this.assertSupportedServer(installed);
6946
7139
  return installed;
6947
7140
  }
6948
7141
  async discoverCapabilitiesLive(options, usesScopedFetch, discoveryContext) {
@@ -6992,16 +7185,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6992
7185
  throw (0, import_abort2.createTimeoutError)(requestTimeoutMs);
6993
7186
  }
6994
7187
  if (result.success && result.data) {
6995
- const capabilities2 = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
7188
+ const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
7189
+ this.assertSupportedServer(capabilities);
6996
7190
  if (!usesScopedFetch && !superseded()) {
6997
- this.cachedCapabilities = capabilities2;
7191
+ this.cachedCapabilities = capabilities;
6998
7192
  this.capabilitiesFromSharedCache = false;
6999
- if (!capabilities2._synthetic && this.config.discoveryCache) {
7193
+ if (!capabilities._synthetic && this.config.discoveryCache) {
7000
7194
  this.recordSharedEvidence(this.sharedDiscoveryKey(options));
7001
7195
  const stored = await this.writeSharedDiscovery(
7002
7196
  options,
7003
7197
  {
7004
- capabilities: structuredClone(capabilities2),
7198
+ capabilities: structuredClone(capabilities),
7005
7199
  toolSchemas: Object.fromEntries(discoveredToolSchemas),
7006
7200
  toolInputSchemas: Object.fromEntries(discoveredInputSchemas)
7007
7201
  },
@@ -7009,7 +7203,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7009
7203
  startedAtEpoch
7010
7204
  );
7011
7205
  if (superseded()) {
7012
- if (this.cachedCapabilities === capabilities2) {
7206
+ if (this.cachedCapabilities === capabilities) {
7013
7207
  this.cachedCapabilities = void 0;
7014
7208
  this.cachedToolSchemas = void 0;
7015
7209
  this.primedCapabilitiesExpiresAt = void 0;
@@ -7019,31 +7213,26 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7019
7213
  }
7020
7214
  }
7021
7215
  }
7022
- this.maybeWarnV2Sunset(capabilities2);
7023
- return capabilities2;
7216
+ this.assertSupportedServer(capabilities);
7217
+ return capabilities;
7024
7218
  }
7025
7219
  if (!advertisesCapabilitiesTool) {
7026
7220
  throw new Error("unadvertised official A2A capability probe was not supported");
7027
7221
  }
7028
7222
  if (result.data && (0, import_capabilities.looksLikeV3Capabilities)(result.data)) {
7223
+ const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
7224
+ this.assertSupportedServer(capabilities);
7029
7225
  console.warn(
7030
7226
  `[AdCP] Agent "${this.agent.id}" returned a get_adcp_capabilities response that failed validation, but the response is structurally v3-shaped. Treating as v3 (the agent has a wire-shape bug \u2014 that's the thing to fix).`,
7031
7227
  { hasError: !!result.error, hasData: !!result.data }
7032
7228
  );
7033
- const parsed = (0, import_capabilities.parseCapabilitiesResponse)(result.data);
7034
- const v3Capabilities = {
7035
- ...parsed,
7036
- version: "v3",
7037
- majorVersions: parsed.majorVersions.includes(3) ? parsed.majorVersions : [3]
7038
- };
7039
- const capabilities2 = (0, import_capabilities.augmentCapabilitiesFromTools)(v3Capabilities, tools);
7040
7229
  if (!usesScopedFetch && !superseded()) {
7041
- this.cachedCapabilities = capabilities2;
7230
+ this.cachedCapabilities = capabilities;
7042
7231
  this.capabilitiesFromSharedCache = false;
7043
7232
  this.recordSharedEvidence(this.sharedDiscoveryKey(options));
7044
7233
  }
7045
- this.maybeWarnV2Sunset(capabilities2);
7046
- return capabilities2;
7234
+ this.assertSupportedServer(capabilities);
7235
+ return capabilities;
7047
7236
  }
7048
7237
  console.warn(
7049
7238
  `[AdCP] Agent "${this.agent.id}" advertises get_adcp_capabilities but the call returned non-success and the response is not v3-shaped \u2014 treating as v3 (synthetic) since the agent has the v3-only discovery tool. This client routes to v3 adapters, but calls reading capability details (idempotency TTL, supported_versions, feature flags) will fail until the agent operator fixes the capabilities endpoint.`,
@@ -7054,7 +7243,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7054
7243
  }
7055
7244
  );
7056
7245
  } catch (error) {
7057
- if (error instanceof import_errors.AuthenticationRequiredError || error instanceof import_errors.ConfigurationError || error instanceof import_errors.TaskTimeoutError || (0, import_abort.isAbortOrTimeoutError)(error)) {
7246
+ if (error instanceof import_errors.AuthenticationRequiredError || error instanceof import_errors.VersionUnsupportedError || error instanceof import_errors.ConfigurationError || error instanceof import_errors.TaskTimeoutError || (0, import_abort.isAbortOrTimeoutError)(error)) {
7058
7247
  throw error;
7059
7248
  }
7060
7249
  if (advertisesCapabilitiesTool) {
@@ -7064,26 +7253,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7064
7253
  }
7065
7254
  }
7066
7255
  if (advertisesCapabilitiesTool) {
7067
- const capabilities2 = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.buildSyntheticV3Capabilities)(tools), tools);
7256
+ const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.buildSyntheticV3Capabilities)(tools), tools);
7068
7257
  if (!usesScopedFetch && !superseded()) {
7069
- this.cachedCapabilities = capabilities2;
7258
+ this.cachedCapabilities = capabilities;
7070
7259
  this.capabilitiesFromSharedCache = false;
7071
7260
  this.recordSharedEvidence(this.sharedDiscoveryKey(options));
7072
7261
  }
7073
- this.maybeWarnV2Sunset(capabilities2);
7074
- return capabilities2;
7262
+ this.assertSupportedServer(capabilities);
7263
+ return capabilities;
7075
7264
  }
7076
7265
  }
7077
- console.warn(
7078
- `[AdCP] Agent "${this.agent.id}" detected as v2 (no get_adcp_capabilities tool). Tools: [${tools.map((t) => t.name).join(", ")}]`
7079
- );
7080
- const capabilities = (0, import_capabilities.buildSyntheticCapabilities)(tools);
7081
- if (!usesScopedFetch && !superseded()) {
7082
- this.cachedCapabilities = capabilities;
7083
- this.capabilitiesFromSharedCache = false;
7084
- this.recordSharedEvidence(this.sharedDiscoveryKey(options));
7085
- }
7086
- return capabilities;
7266
+ throw new import_errors.VersionUnsupportedError("get_adcp_capabilities", "synthetic", "v2", this.agent.agent_uri);
7087
7267
  }
7088
7268
  /**
7089
7269
  * Return the client-bound scope required by {@link primeCapabilities}.
@@ -7598,28 +7778,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7598
7778
  if (!this.config.discoveryCache || !code || !CAPABILITY_STALE_ERROR_CODES.has(code)) return;
7599
7779
  await this.invalidateDiscoveryCache(options);
7600
7780
  }
7601
- /**
7602
- * Emit a one-time warning when the agent reports v2 capabilities.
7603
- *
7604
- * v2 went unsupported on 2026-04-20 (AdCP 3.0 GA — adcp#2220). We still
7605
- * execute v2 code paths (no behaviour change), but clients integrating
7606
- * against an unsupported agent should hear about it loudly.
7607
- *
7608
- * Synthetic capabilities (no `get_adcp_capabilities` tool available) don't
7609
- * trigger the warning — we don't actually know the agent's version, and
7610
- * shouting at legitimately-unversioned agents would be noise.
7611
- *
7612
- * Suppression: `process.env.ADCP_ALLOW_V2 === '1'`.
7613
- */
7614
- maybeWarnV2Sunset(capabilities) {
7615
- if (this._v2WarningFired) return;
7616
- if (capabilities.version === "v3") return;
7617
- if (capabilities._synthetic) return;
7618
- if (process.env.ADCP_ALLOW_V2 === "1") return;
7619
- this._v2WarningFired = true;
7620
- console.warn(
7621
- `[adcp] Warning: agent ${this.agent.agent_uri} reports v2 capabilities. v2 went unsupported on 2026-04-20 (AdCP 3.0 GA). Upgrade the agent to v3 or set ADCP_ALLOW_V2=1 to suppress this warning. See https://github.com/adcontextprotocol/adcp/issues/2220`
7622
- );
7781
+ /** Reject retired protocol generations before caching or dispatching. */
7782
+ assertSupportedServer(capabilities) {
7783
+ if (capabilities.version !== "v3" || !capabilities.majorVersions.includes(3)) {
7784
+ throw new import_errors.VersionUnsupportedError("get_adcp_capabilities", "version", capabilities.version, this.agent.agent_uri);
7785
+ }
7623
7786
  }
7624
7787
  /**
7625
7788
  * Warn once per client when `requireSupportedMajor` accepts synthetic v3
@@ -7640,24 +7803,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7640
7803
  `[adcp] Warning: agent ${this.agent.agent_uri} advertises get_adcp_capabilities (v3-only) but the call failed. Treating as v3 (synthetic) \u2014 version + idempotency-TTL checks skipped. Calls to getIdempotencyReplayTtlSeconds() will throw until the agent's capabilities endpoint is fixed. Report the wire-shape bug to the agent operator at ${this.agent.agent_uri}.`
7641
7804
  );
7642
7805
  }
7643
- /**
7644
- * Warn once per client when `requireSupportedMajor` routes a synthetic-v2
7645
- * seller through the v2 adapter — the agent did not expose
7646
- * `get_adcp_capabilities`, so the version was inferred from `tools/list`.
7647
- * A compliant v3 seller would declare itself; absence of a declaration is
7648
- * read as v2. Idempotency-TTL guarantees are unknown for these sellers,
7649
- * so BYOK retry callers should treat them as such.
7650
- *
7651
- * One-shot via `_syntheticV2WarningFired` (matches `maybeWarnV2Sunset`
7652
- * cadence).
7653
- */
7654
- maybeWarnSyntheticV2() {
7655
- if (this._syntheticV2WarningFired) return;
7656
- this._syntheticV2WarningFired = true;
7657
- console.warn(
7658
- `[adcp] Warning: agent ${this.agent.agent_uri} does not expose get_adcp_capabilities. Routing as v2 (synthetic) \u2014 idempotency-TTL guarantee is unknown. Ask the agent operator to declare v3 via get_adcp_capabilities if v3 routing is intended. Branch on client.isSyntheticV2() to tighten retry policies for these sellers.`
7659
- );
7660
- }
7661
7806
  /**
7662
7807
  * Detect server AdCP version
7663
7808
  *
@@ -7667,36 +7812,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7667
7812
  const capabilities = await this.getCapabilities(options);
7668
7813
  const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
7669
7814
  if (discoveryContext) discoveryContext.capabilities = capabilities;
7815
+ this.assertSupportedServer(capabilities);
7670
7816
  return capabilities.version;
7671
7817
  }
7672
- /**
7673
- * Whether the seller's capabilities are synthesized from `tools/list`
7674
- * with no authoritative `get_adcp_capabilities` response — i.e. the
7675
- * dispatcher routes through the v2 adapter and idempotency-TTL is
7676
- * unknown. Use this to gate retry behavior for sellers whose retry
7677
- * safety can't be derived from declared capabilities (lower attempt
7678
- * caps, longer backoff, or fall back to natural-key recovery).
7679
- *
7680
- * Returns `false` for declared v2 sellers, declared v3 sellers, and
7681
- * synthetic v3 sellers (which advertise the v3 discovery tool even
7682
- * when the call itself failed).
7683
- *
7684
- * Caveat for synthetic v3: the predicate returns `false`, but TTL is
7685
- * still unknown for those sellers — `getIdempotencyReplayTtlSeconds()`
7686
- * throws until the agent's capabilities endpoint is fixed (issue
7687
- * #1217). Retry-policy consumers that need a complete "TTL unknown"
7688
- * gate should additionally check `getCapabilities()._synthetic`.
7689
- */
7690
- async isSyntheticV2() {
7691
- const capabilities = await this.getCapabilities();
7692
- return capabilities._synthetic === true && capabilities.version === "v2";
7693
- }
7694
7818
  /**
7695
7819
  * Check if server supports a specific AdCP major version
7696
7820
  */
7697
7821
  async supportsVersion(version) {
7698
7822
  const capabilities = await this.getCapabilities();
7699
- return capabilities.majorVersions.includes(version);
7823
+ return version === 3 && capabilities.majorVersions.includes(3);
7700
7824
  }
7701
7825
  /**
7702
7826
  * Return the seller's declared `adcp.idempotency.replay_ttl_seconds`.
@@ -7707,8 +7831,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7707
7831
  *
7708
7832
  * Fails closed when the seller is v3 but does not declare the field: the
7709
7833
  * spec makes the declaration REQUIRED, and silently defaulting to 24h
7710
- * would mislead buyers about retry safety. Callers on v2 servers get
7711
- * `undefined` instead of a throw — v2 pre-dates the idempotency envelope.
7834
+ * would mislead buyers about retry safety.
7712
7835
  */
7713
7836
  async getIdempotencyReplayTtlSeconds() {
7714
7837
  const capabilities = await this.getCapabilities();
@@ -7717,7 +7840,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7717
7840
  (0, import_capabilities.assertValidIdempotencyReplayTtlSeconds)(capabilities.idempotency.replayTtlSeconds);
7718
7841
  return capabilities.idempotency.replayTtlSeconds;
7719
7842
  }
7720
- if (capabilities.version !== "v3") return void 0;
7721
7843
  throw new import_errors.ConfigurationError(
7722
7844
  `Agent "${this.agent.id}" is v3 but does not declare adcp.idempotency.replay_ttl_seconds. The spec requires this for v3 sellers \u2014 treating the agent as non-compliant rather than defaulting to 24h, which would silently mislead retry-sensitive flows.`,
7723
7845
  "adcp.idempotency.replay_ttl_seconds"
@@ -8028,28 +8150,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
8028
8150
  * 2. `capabilities.idempotency.replayTtlSeconds` present (spec-required
8029
8151
  * for real major-3+ sellers)
8030
8152
  *
8031
- * Sellers whose capabilities are synthesized from `tools/list` (no
8032
- * authoritative `get_adcp_capabilities` response) are treated as v2: a
8033
- * compliant v3 seller would declare itself, so absence of a declaration
8034
- * is taken as evidence of v2. The dispatcher routes the request through
8035
- * the v2 wire-shape adapter. A one-time warning surfaces the routing
8036
- * decision so adopters can audit it; retry-safety (idempotency TTL) is
8037
- * unknown for these sellers and BYOK callers should treat them as such.
8038
- *
8039
- * Per-client `allowV2: true` or, when that's undefined,
8040
- * `ADCP_ALLOW_V2=1` in the environment bypasses the guard entirely.
8153
+ * Synthetic v3 evidence is accepted only when the agent advertises discovery.
8154
+ * Agents without discovery and AdCP 2-only agents are rejected.
8041
8155
  *
8042
8156
  * Throws `VersionUnsupportedError` with the specific reason on failure.
8043
8157
  */
8044
8158
  async requireSupportedMajor(taskType = "request", options) {
8045
- if (this.isV2Allowed()) return;
8046
8159
  const capabilities = await this.getCapabilities(options);
8160
+ this.assertSupportedServer(capabilities);
8047
8161
  if (capabilities._synthetic) {
8048
- if (capabilities.version === "v3") {
8049
- this.maybeWarnSyntheticV3();
8050
- } else {
8051
- this.maybeWarnSyntheticV2();
8052
- }
8162
+ this.maybeWarnSyntheticV3();
8053
8163
  return;
8054
8164
  }
8055
8165
  const supportedVersions = capabilities.supportedVersions;
@@ -8080,10 +8190,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
8080
8190
  async requireV3(taskType = "request") {
8081
8191
  return this.requireSupportedMajor(taskType);
8082
8192
  }
8083
- isV2Allowed() {
8084
- if (this.config.allowV2 !== void 0) return this.config.allowV2 === true;
8085
- return process.env.ADCP_ALLOW_V2 === "1";
8086
- }
8087
8193
  // ====== STATIC HELPER METHODS ======
8088
8194
  /**
8089
8195
  * Query a legacy creative-agent named-format catalog.