@adcp/sdk 15.9.0 → 16.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +16 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +16 -2
  13. package/dist/lib/core/SingleAgentClient.js +259 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +261 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/index.d.mts +10 -0
  28. package/dist/lib/identity-3.3/index.d.ts +10 -0
  29. package/dist/lib/identity-3.3/index.js +75 -0
  30. package/dist/lib/identity-3.3/index.mjs +46 -0
  31. package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
  32. package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
  33. package/dist/lib/identity-3.3/lifecycle.js +267 -0
  34. package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
  35. package/dist/lib/identity-3.3/revocation.d.mts +50 -0
  36. package/dist/lib/identity-3.3/revocation.d.ts +50 -0
  37. package/dist/lib/identity-3.3/revocation.js +238 -0
  38. package/dist/lib/identity-3.3/revocation.mjs +216 -0
  39. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  40. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  41. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  42. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  43. package/dist/lib/identity-3.3/server.d.mts +34 -0
  44. package/dist/lib/identity-3.3/server.d.ts +34 -0
  45. package/dist/lib/identity-3.3/server.js +219 -0
  46. package/dist/lib/identity-3.3/server.mjs +194 -0
  47. package/dist/lib/identity-3.3/store.d.mts +24 -0
  48. package/dist/lib/identity-3.3/store.d.ts +24 -0
  49. package/dist/lib/identity-3.3/store.js +191 -0
  50. package/dist/lib/identity-3.3/store.mjs +169 -0
  51. package/dist/lib/identity-3.3/trust.d.mts +94 -0
  52. package/dist/lib/identity-3.3/trust.d.ts +94 -0
  53. package/dist/lib/identity-3.3/trust.js +278 -0
  54. package/dist/lib/identity-3.3/trust.mjs +239 -0
  55. package/dist/lib/identity-3.3/types.d.mts +127 -0
  56. package/dist/lib/identity-3.3/types.d.ts +127 -0
  57. package/dist/lib/identity-3.3/types.js +16 -0
  58. package/dist/lib/identity-3.3/types.mjs +0 -0
  59. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  60. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  61. package/dist/lib/identity-3.3/validation.js +125 -0
  62. package/dist/lib/identity-3.3/validation.mjs +91 -0
  63. package/dist/lib/index.d.mts +1 -1
  64. package/dist/lib/index.d.ts +1 -1
  65. package/dist/lib/reporting/azure/index.d.mts +5 -0
  66. package/dist/lib/reporting/azure/index.d.ts +5 -0
  67. package/dist/lib/reporting/azure/index.js +26 -7
  68. package/dist/lib/reporting/azure/index.mjs +26 -7
  69. package/dist/lib/reporting/bigquery/index.d.mts +80 -25
  70. package/dist/lib/reporting/bigquery/index.d.ts +80 -25
  71. package/dist/lib/reporting/bigquery/index.js +184 -81
  72. package/dist/lib/reporting/bigquery/index.mjs +182 -80
  73. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  74. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  75. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  76. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  77. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  78. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  79. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  80. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  81. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  82. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  83. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  84. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  85. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  86. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  87. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  88. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  89. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  90. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  91. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  92. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  93. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  94. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  95. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  96. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  97. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  98. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  99. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  100. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  101. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  102. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  103. package/dist/lib/reporting/ledger/postgres.js +43 -27
  104. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  105. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  106. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  107. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  108. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  109. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  110. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  111. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  112. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  113. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  114. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  115. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  116. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  117. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  118. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  119. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  120. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  121. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  122. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  123. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  124. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  125. package/dist/lib/reporting/ledger/schedule.js +24 -0
  126. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  127. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  128. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  129. package/dist/lib/reporting/s3/index.d.mts +5 -0
  130. package/dist/lib/reporting/s3/index.d.ts +5 -0
  131. package/dist/lib/reporting/s3/index.js +37 -14
  132. package/dist/lib/reporting/s3/index.mjs +37 -14
  133. package/dist/lib/reporting/service/index.d.mts +10 -0
  134. package/dist/lib/reporting/service/index.d.ts +10 -0
  135. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  136. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  137. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  138. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  139. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  140. package/dist/lib/server/account-sync-contract.js +225 -0
  141. package/dist/lib/server/account-sync-contract.mjs +197 -0
  142. package/dist/lib/server/adcp-server.js +5 -0
  143. package/dist/lib/server/adcp-server.mjs +10 -0
  144. package/dist/lib/server/auth-signature.d.mts +10 -0
  145. package/dist/lib/server/auth-signature.d.ts +10 -0
  146. package/dist/lib/server/auth-signature.js +61 -2
  147. package/dist/lib/server/auth-signature.mjs +65 -2
  148. package/dist/lib/server/auth.d.mts +6 -0
  149. package/dist/lib/server/auth.d.ts +6 -0
  150. package/dist/lib/server/auth.js +6 -0
  151. package/dist/lib/server/auth.mjs +6 -0
  152. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  153. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  154. package/dist/lib/server/create-adcp-server.js +238 -19
  155. package/dist/lib/server/create-adcp-server.mjs +240 -10
  156. package/dist/lib/server/decisioning/account.d.mts +24 -1
  157. package/dist/lib/server/decisioning/account.d.ts +24 -1
  158. package/dist/lib/server/decisioning/index.d.mts +1 -1
  159. package/dist/lib/server/decisioning/index.d.ts +1 -1
  160. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  161. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  162. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  163. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  164. package/dist/lib/server/index.d.mts +2 -0
  165. package/dist/lib/server/index.d.ts +2 -0
  166. package/dist/lib/server/index.js +12 -0
  167. package/dist/lib/server/index.mjs +12 -0
  168. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  169. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  170. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  171. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  172. package/dist/lib/server/principal/types.d.mts +1 -1
  173. package/dist/lib/server/principal/types.d.ts +1 -1
  174. package/dist/lib/server/serve.js +5 -0
  175. package/dist/lib/server/serve.mjs +5 -0
  176. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  177. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  178. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  179. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  180. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  181. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  182. package/dist/lib/server/webhook-emitter.js +22 -0
  183. package/dist/lib/server/webhook-emitter.mjs +22 -0
  184. package/dist/lib/signing/agent-context.d.mts +0 -5
  185. package/dist/lib/signing/agent-context.d.ts +0 -5
  186. package/dist/lib/signing/agent-context.js +9 -1
  187. package/dist/lib/signing/agent-context.mjs +9 -1
  188. package/dist/lib/signing/agent-fetch.js +27 -2
  189. package/dist/lib/signing/agent-fetch.mjs +32 -2
  190. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  191. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  192. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  193. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  194. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  195. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  196. package/dist/lib/signing/agent-resolver/index.js +5 -0
  197. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  198. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  199. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  200. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  201. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  202. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  203. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  204. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  205. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  206. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  207. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  208. package/dist/lib/signing/brand-jwks.js +4 -4
  209. package/dist/lib/signing/brand-jwks.mjs +4 -4
  210. package/dist/lib/signing/client.d.mts +1 -0
  211. package/dist/lib/signing/client.d.ts +1 -0
  212. package/dist/lib/signing/client.js +5 -0
  213. package/dist/lib/signing/client.mjs +3 -0
  214. package/dist/lib/signing/jwks-https.d.mts +1 -1
  215. package/dist/lib/signing/jwks-https.d.ts +1 -1
  216. package/dist/lib/signing/jwks-https.js +1 -1
  217. package/dist/lib/signing/jwks-https.mjs +1 -1
  218. package/dist/lib/signing/jwks.d.mts +11 -3
  219. package/dist/lib/signing/jwks.d.ts +11 -3
  220. package/dist/lib/signing/jwks.js +1 -1
  221. package/dist/lib/signing/jwks.mjs +1 -1
  222. package/dist/lib/signing/parser.d.mts +1 -1
  223. package/dist/lib/signing/parser.d.ts +1 -1
  224. package/dist/lib/signing/parser.js +5 -3
  225. package/dist/lib/signing/parser.mjs +6 -4
  226. package/dist/lib/signing/revocation.d.mts +4 -1
  227. package/dist/lib/signing/revocation.d.ts +4 -1
  228. package/dist/lib/signing/revocation.js +33 -3
  229. package/dist/lib/signing/revocation.mjs +31 -2
  230. package/dist/lib/signing/server.d.mts +1 -1
  231. package/dist/lib/signing/server.d.ts +1 -1
  232. package/dist/lib/signing/server.js +4 -0
  233. package/dist/lib/signing/server.mjs +4 -0
  234. package/dist/lib/signing/types.d.mts +3 -0
  235. package/dist/lib/signing/types.d.ts +3 -0
  236. package/dist/lib/signing/web-bot-auth.d.mts +117 -0
  237. package/dist/lib/signing/web-bot-auth.d.ts +117 -0
  238. package/dist/lib/signing/web-bot-auth.js +660 -0
  239. package/dist/lib/signing/web-bot-auth.mjs +624 -0
  240. package/dist/lib/testing/client.d.mts +1 -4
  241. package/dist/lib/testing/client.d.ts +1 -4
  242. package/dist/lib/testing/client.js +141 -20
  243. package/dist/lib/testing/client.mjs +137 -19
  244. package/dist/lib/testing/compliance/comply.js +29 -10
  245. package/dist/lib/testing/compliance/comply.mjs +37 -11
  246. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  247. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  248. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  249. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  250. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  251. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  252. package/dist/lib/testing/storyboard/runner.js +23 -8
  253. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  254. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  255. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  256. package/dist/lib/types/adcp.d.mts +4 -0
  257. package/dist/lib/types/adcp.d.ts +4 -0
  258. package/dist/lib/types/schemas.generated.d.ts +6 -6
  259. package/dist/lib/utils/capabilities.d.mts +1 -0
  260. package/dist/lib/utils/capabilities.d.ts +1 -0
  261. package/dist/lib/utils/capabilities.js +5 -0
  262. package/dist/lib/utils/capabilities.mjs +5 -0
  263. package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
  264. package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
  265. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  266. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  267. package/dist/lib/v2/projection/index.d.mts +1 -1
  268. package/dist/lib/v2/projection/index.d.ts +1 -1
  269. package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
  270. package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
  271. package/dist/lib/v2/projection/legacy-routes.js +28 -2
  272. package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
  273. package/dist/lib/validation/schema-loader.d.mts +2 -0
  274. package/dist/lib/validation/schema-loader.d.ts +2 -0
  275. package/dist/lib/validation/schema-loader.js +43 -4
  276. package/dist/lib/validation/schema-loader.mjs +39 -3
  277. package/dist/lib/version.d.mts +3 -3
  278. package/dist/lib/version.d.ts +3 -3
  279. package/dist/lib/version.js +3 -3
  280. package/dist/lib/version.mjs +3 -3
  281. package/docs/TYPE-SUMMARY.md +2 -2
  282. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  283. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  284. package/docs/guides/REPORTING-LEDGER.md +132 -46
  285. package/docs/guides/REPORTING-OPERATIONS.md +25 -4
  286. package/docs/guides/REPORTING-STABILITY.md +76 -0
  287. package/docs/guides/account-resolution.md +101 -0
  288. package/docs/llms.txt +3 -2
  289. package/docs/migration-12-to-13.md +7 -0
  290. package/docs/migration-14.x-rc-worksheet.md +4 -4
  291. package/docs/migration-agent-identity-3.3.md +355 -0
  292. package/docs/migration-agent-resolution-3.3.md +5 -0
  293. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  294. package/examples/storyboards/account-sync-contract.yaml +57 -0
  295. package/package.json +15 -1
@@ -34,6 +34,8 @@ __export(SingleAgentClient_exports, {
34
34
  createSingleAgentClient: () => createSingleAgentClient
35
35
  });
36
36
  module.exports = __toCommonJS(SingleAgentClient_exports);
37
+ var import_schema_loader = require('../validation/schema-loader.js');
38
+ var import_canonicalize = require('../signing/agent-resolver/canonicalize.js');
37
39
  var import_products = require('../supply-path/products.js');
38
40
  var import_node_crypto = require("node:crypto");
39
41
  var import_adcp = require('../types/adcp.js');
@@ -41,7 +43,7 @@ var import_version = require('../version.js');
41
43
  var import_adcp_version_config = require('../utils/adcp-version-config.js');
42
44
  var import_reporting_version = require('../media-buy/reporting-version.js');
43
45
  var import_version2 = require('../adapters/version/index.js');
44
- var import_schema_loader = require('../validation/schema-loader.js');
46
+ var import_schema_loader2 = require('../validation/schema-loader.js');
45
47
  var import_idempotency = require('../utils/idempotency.js');
46
48
  var import_a2a = require('../protocols/a2a.js');
47
49
  var import_TaskExecutor = require('./TaskExecutor.js');
@@ -88,6 +90,9 @@ var import_augment_response = require('../v2/projection/augment-response.js');
88
90
  var import_legacy_metadata = require('../v2/projection/legacy-metadata.js');
89
91
  var import_types = require('../v2/projection/types.js');
90
92
  var import_jcs = require('../utils/jcs.js');
93
+ function loadWebBotAuth() {
94
+ return require('../signing/web-bot-auth.js');
95
+ }
91
96
  const SKIP_PRODUCT_CACHE = /* @__PURE__ */ Symbol("adcp.skipProductCache");
92
97
  const SKIP_ACCOUNT_REGISTRY_OBSERVATION = /* @__PURE__ */ Symbol("adcp.skipAccountRegistryObservation");
93
98
  function presentedStaticTransportCredential(authToken, headers, authProvider) {
@@ -742,6 +747,11 @@ class SingleAgentClient {
742
747
  constructor(agent, config = {}) {
743
748
  this.agent = agent;
744
749
  this.config = config;
750
+ if (config.experimentalIdentity33 === true !== (0, import_schema_loader.isIdentity33SchemaScope)())
751
+ return (0, import_schema_loader.withIdentity33SchemaScope)(() => {
752
+ const instance = Reflect.construct(SingleAgentClient, [agent, config], new.target);
753
+ return config.experimentalIdentity33 ? (0, import_schema_loader.bindIdentity33SchemaScope)(instance) : instance;
754
+ }, config.experimentalIdentity33 === true);
745
755
  const configuredTransport = config.transport === void 0 ? void 0 : { ...config.transport };
746
756
  const configuredWebhookVerification = config.webhookVerification === void 0 ? void 0 : {
747
757
  ...config.webhookVerification,
@@ -756,7 +766,9 @@ class SingleAgentClient {
756
766
  };
757
767
  config = this.config;
758
768
  (0, import_agent_discovery_cache.validateAgentDiscoveryCacheConfig)(config.discoveryCache);
759
- this.resolvedAdcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(config.adcpVersion);
769
+ this.resolvedAdcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(
770
+ config.adcpVersion ?? (config.experimentalIdentity33 ? "3.3" : void 0)
771
+ );
760
772
  this.webhookRegistrationStore = config.webhookRegistrationStore ?? new import_webhook_registration.InMemoryWebhookRegistrationStore();
761
773
  this.webhookReplayStore = config.webhookVerification?.replayStore ?? new import_server.InMemoryReplayStore();
762
774
  this.webhookRevocationStore = config.webhookVerification?.revocationStore ?? new import_server.InMemoryRevocationStore();
@@ -815,6 +827,10 @@ class SingleAgentClient {
815
827
  webhookUrlTemplate: config.webhookUrlTemplate,
816
828
  agentId: agent.id,
817
829
  webhookSecret: config.webhookSecret,
830
+ identity33SchemaExperiment: config.experimentalIdentity33,
831
+ experimentalIdentity33: () => this.config.experimentalIdentity33 === true && this.usesIdentity33Schemas(),
832
+ signedIdentity33Webhooks: () => this.usesSigned33Webhooks(),
833
+ webhookSigningProfile: () => this.selectedWebhookSigningProfile(),
818
834
  onWebhookRegistration: (registration) => this.persistWebhookRegistration(registration),
819
835
  onDurableSettlementRequired: (operationId) => this.markWebhookDurableSettlementRequired(operationId),
820
836
  externalTaskSettlementRetentionMs: registrationTtl * 1e3,
@@ -1050,7 +1066,7 @@ class SingleAgentClient {
1050
1066
  throw new import_errors3.AccountNotProvisionedError(ref, task);
1051
1067
  }
1052
1068
  const caps = await this.getCapabilities(options);
1053
- if (caps._synthetic || ["get_products", "list_products"].includes(task) && caps.account?.requiredForProducts || params.push_notification_config || !(0, import_schema_loader.schemaAllowsTopLevelField)(task, "brand")) {
1069
+ if (caps._synthetic || ["get_products", "list_products"].includes(task) && caps.account?.requiredForProducts || params.push_notification_config || !(0, import_schema_loader2.schemaAllowsTopLevelField)(task, "brand")) {
1054
1070
  throw new import_errors3.AccountNotProvisionedError(ref, task);
1055
1071
  }
1056
1072
  if (!("brand" in ref)) throw new import_errors3.AccountNotProvisionedError(ref, task);
@@ -1070,6 +1086,7 @@ class SingleAgentClient {
1070
1086
  // Cache canonical base URL (from agent card or stripped /mcp)
1071
1087
  cachedCapabilities;
1072
1088
  // Cache detected server capabilities
1089
+ runAgentInfo;
1073
1090
  cachedToolSchemas;
1074
1091
  // inputSchema.properties per tool name
1075
1092
  primedCapabilitiesExpiresAt;
@@ -1126,18 +1143,18 @@ class SingleAgentClient {
1126
1143
  persistedAgentUrl.username = "";
1127
1144
  persistedAgentUrl.password = "";
1128
1145
  persistedAgentUrl.hash = "";
1129
- const delegatedOperatorAuthorization = this.effectiveDelegatedOperatorAuthorization(
1130
- args.delegatedOperatorAuthorization
1131
- );
1146
+ const delegatedOperatorAuthorization = args.deliveryKind ? void 0 : this.effectiveDelegatedOperatorAuthorization(args.delegatedOperatorAuthorization);
1132
1147
  const registration = {
1133
1148
  agentId: args.agent.id,
1134
1149
  agentUrl: persistedAgentUrl.toString(),
1135
1150
  protocol: args.agent.protocol,
1136
1151
  operationId: args.operationId,
1137
1152
  taskType: args.taskType,
1138
- callbackUrl: args.callbackUrl,
1153
+ callbackUrl: args.deliveryKind ? (0, import_server.canonicalTargetUri)(args.callbackUrl, "3.2") : args.callbackUrl,
1139
1154
  method: "POST",
1140
1155
  mode: args.mode,
1156
+ ...args.signingProfile && { signingProfile: args.signingProfile },
1157
+ ...args.deliveryKind && { deliveryKind: args.deliveryKind },
1141
1158
  authorizationContextVersion: 1,
1142
1159
  ...delegatedOperatorAuthorization !== void 0 && { delegatedOperatorAuthorization },
1143
1160
  ...previewMode && { previewMode },
@@ -1146,6 +1163,14 @@ class SingleAgentClient {
1146
1163
  };
1147
1164
  (0, import_webhook_registration.validateWebhookRegistrationAuthorization)(registration);
1148
1165
  try {
1166
+ if (args.deliveryKind) {
1167
+ const previous = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
1168
+ if (previous && previous.expiresAt > nowMs && (previous.signingProfile ?? "adcp/webhook-signing/v1") !== (registration.signingProfile ?? "adcp/webhook-signing/v1"))
1169
+ throw new import_errors.ConfigurationError(
1170
+ `${args.deliveryKind} callback is already registered with ${previous.signingProfile ?? "adcp/webhook-signing/v1"}. Use a new callback URL or delete its old registration after outstanding deliveries finish.`,
1171
+ `${args.deliveryKind}_webhook.signing_profile`
1172
+ );
1173
+ }
1149
1174
  await this.webhookRegistrationStore.putIfAbsent(registration);
1150
1175
  const persisted = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
1151
1176
  if (!persisted || !(0, import_webhook_registration.sameWebhookRegistration)(
@@ -1157,6 +1182,8 @@ class SingleAgentClient {
1157
1182
  );
1158
1183
  }
1159
1184
  } catch (cause) {
1185
+ if (args.deliveryKind && cause instanceof import_errors.ConfigurationError && cause.configField === `${args.deliveryKind}_webhook.signing_profile`)
1186
+ throw cause;
1160
1187
  if (args.mode === "rfc9421" || !RECORDLESS_HMAC_READ_ONLY_TASKS.has(args.taskType)) {
1161
1188
  const error = new import_errors.ConfigurationError("Could not persist trusted webhook registration for this operation.");
1162
1189
  Object.defineProperty(error, "cause", { value: cause, configurable: true });
@@ -1318,7 +1345,7 @@ class SingleAgentClient {
1318
1345
  return (0, import_jcs.canonicalize)([this.canonicalAccountScope(account), "package", packageId]);
1319
1346
  }
1320
1347
  sameCanonicalOptionRef(left, right) {
1321
- return left.scope === right.scope && left.format_option_id === right.format_option_id && (left.scope !== "publisher" || right.scope === "publisher" && left.publisher_domain.toLowerCase() === right.publisher_domain.toLowerCase());
1348
+ return (0, import_legacy_routes.sameFormatOptionRef)(left, right);
1322
1349
  }
1323
1350
  rememberCanonicalLegacyRoute(key, route) {
1324
1351
  this.canonicalLegacyRoutes.delete(key);
@@ -1389,20 +1416,7 @@ class SingleAgentClient {
1389
1416
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
1390
1417
  const product = value;
1391
1418
  if (typeof product.product_id !== "string") continue;
1392
- const refs = [];
1393
- for (const optionValue of Array.isArray(product.format_options) ? product.format_options : []) {
1394
- if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
1395
- const option = optionValue;
1396
- if (typeof option.format_option_id !== "string") continue;
1397
- refs.push(
1398
- typeof option.publisher_domain === "string" ? {
1399
- scope: "publisher",
1400
- publisher_domain: option.publisher_domain,
1401
- format_option_id: option.format_option_id
1402
- } : { scope: "product", format_option_id: option.format_option_id }
1403
- );
1404
- }
1405
- declared.set(product.product_id, refs);
1419
+ declared.set(product.product_id, (0, import_legacy_routes.sellerDeclaredFormatOptionRefs)(product));
1406
1420
  }
1407
1421
  return declared;
1408
1422
  }
@@ -1822,9 +1836,10 @@ class SingleAgentClient {
1822
1836
  */
1823
1837
  async ensureEndpointDiscovered(options) {
1824
1838
  (0, import_abort2.throwIfAborted)(options?.signal);
1839
+ if (this.config._reuseConfiguredDiscovery?.()) this.synchronizeCapabilityEvidenceAuthorizationScope();
1825
1840
  const needsDiscovery = this.normalizedAgent._needsDiscovery;
1826
1841
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
1827
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
1842
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
1828
1843
  if (!needsDiscovery) {
1829
1844
  return this.normalizedAgent;
1830
1845
  }
@@ -1930,7 +1945,7 @@ class SingleAgentClient {
1930
1945
  (0, import_abort2.throwIfAborted)(options?.signal);
1931
1946
  const needsCanonicalUrl = this.normalizedAgent._needsCanonicalUrl;
1932
1947
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
1933
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
1948
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
1934
1949
  if (!needsCanonicalUrl) {
1935
1950
  return this.normalizedAgent;
1936
1951
  }
@@ -1949,8 +1964,11 @@ class SingleAgentClient {
1949
1964
  signal: options?.signal
1950
1965
  });
1951
1966
  }
1967
+ const canonicalEpoch = this.discoveryEpochSnapshot(options);
1952
1968
  const canonicalUrl = await this.fetchA2ACanonicalUrl(this.normalizedAgent.agent_uri, options);
1953
- if (!usesScopedFetch) this.canonicalBaseUrl = canonicalUrl;
1969
+ if (!usesScopedFetch && (!canonicalEpoch || this.discoveryEpochIs(canonicalEpoch))) {
1970
+ this.canonicalBaseUrl = canonicalUrl;
1971
+ }
1954
1972
  return {
1955
1973
  ...this.normalizedAgent,
1956
1974
  agent_uri: canonicalUrl
@@ -2075,7 +2093,9 @@ class SingleAgentClient {
2075
2093
  const { connectMCPWithFallback } = await import("../protocols/mcp.js");
2076
2094
  const { probeModernMCPConnection } = await import("../protocols/mcp-modern.js");
2077
2095
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
2078
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
2096
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
2097
+ const endpointEpoch = this.discoveryEpochSnapshot(options);
2098
+ const mayRetain = () => !usesScopedFetch && (!endpointEpoch || this.discoveryEpochIs(endpointEpoch));
2079
2099
  const authToken = this.normalizedAgent.oauth_client_credentials ? this.normalizedAgent.oauth_tokens?.access_token : this.agent.auth_token;
2080
2100
  const agentHeaders = this.agent.headers;
2081
2101
  const authHeaders = (0, import_auth.createMCPRequestHeaders)(agentHeaders, authToken);
@@ -2095,7 +2115,7 @@ class SingleAgentClient {
2095
2115
  allowPrivateIp: transport?.allowPrivateIp
2096
2116
  });
2097
2117
  if (modern.connected) {
2098
- if (!usesScopedFetch) {
2118
+ if (mayRetain()) {
2099
2119
  this.discoveredMcpEra = modern.era;
2100
2120
  this.discoveredMcpEraAt = Date.now();
2101
2121
  }
@@ -2114,7 +2134,7 @@ class SingleAgentClient {
2114
2134
  }
2115
2135
  );
2116
2136
  await client.close();
2117
- if (!usesScopedFetch) {
2137
+ if (mayRetain()) {
2118
2138
  this.discoveredMcpEra = "legacy";
2119
2139
  this.discoveredMcpEraAt = Date.now();
2120
2140
  }
@@ -2291,7 +2311,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2291
2311
  async verifyAndParseWebhook(options) {
2292
2312
  const rawBody = options.rawBody ?? rawBodyFromUnknown(options.body);
2293
2313
  const authHeaders = inspectWebhookAuthenticationHeaders(options.headers, options.signature, options.timestamp);
2294
- const trustedOperationId = options.operationId && options.operationId !== "unknown" ? options.operationId : void 0;
2314
+ let trustedOperationId = options.operationId && options.operationId !== "unknown" ? options.operationId : void 0;
2295
2315
  let registration;
2296
2316
  if (trustedOperationId) {
2297
2317
  let stored;
@@ -2332,6 +2352,24 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2332
2352
  }
2333
2353
  }
2334
2354
  }
2355
+ if (!registration && options.requestUrl && ["media_buy_delivery", "artifact_delivery"].includes(options.taskType ?? "")) {
2356
+ const kind = options.taskType === "artifact_delivery" ? "artifact" : "reporting";
2357
+ const routeId = (0, import_webhook_registration.deliveryWebhookRegistrationId)(kind, options.requestUrl);
2358
+ try {
2359
+ const stored = await this.webhookRegistrationStore.get(this.agent.id, routeId);
2360
+ if (stored) {
2361
+ registration = (0, import_webhook_registration.parseWebhookRegistration)(stored, { agentId: this.agent.id, operationId: routeId });
2362
+ trustedOperationId = routeId;
2363
+ }
2364
+ } catch (cause) {
2365
+ return {
2366
+ ok: false,
2367
+ code: "webhook_registration_store_unavailable",
2368
+ message: "Delivery registration state is unavailable",
2369
+ cause
2370
+ };
2371
+ }
2372
+ }
2335
2373
  if (registration) {
2336
2374
  const nowMs = this.config.webhookVerification?.now ? Math.floor(this.config.webhookVerification.now() * 1e3) : Date.now();
2337
2375
  if (registration.expiresAt <= nowMs) registration = void 0;
@@ -2412,6 +2450,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2412
2450
  }
2413
2451
  }
2414
2452
  if (registration?.mode === "rfc9421") {
2453
+ const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError } = loadWebBotAuth();
2415
2454
  const requestMethod = options.requestMethod;
2416
2455
  const requestUrl = options.requestUrl;
2417
2456
  if (rawBody === void 0 || !options.headers || !trustedOperationId || !requestMethod || !requestUrl) {
@@ -2424,28 +2463,65 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2424
2463
  const normalizedHeaders = normalizeRfc9421WebhookHeaders(options.headers);
2425
2464
  if (!normalizedHeaders.ok) return normalizedHeaders.failure;
2426
2465
  try {
2427
- const delegatedOperatorAuthorization = this.delegatedOperatorAuthorizationForRegistration(registration);
2428
- await (0, import_server.verifyWebhookSignature)(
2429
- {
2430
- method: requestMethod,
2431
- url: requestUrl,
2432
- headers: normalizedHeaders.headers,
2433
- body: rawBody
2434
- },
2435
- {
2436
- jwks: this.webhookJwksFor(registration),
2437
- publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
2438
- onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
2439
- replayStore: this.webhookReplayStore,
2440
- revocationStore: this.webhookRevocationStore,
2441
- ...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
2442
- agentUrlForKeyid: () => registration.agentUrl,
2443
- ...registration.authorizationContextVersion === 1 && {
2444
- replayScopeBinding: `delegated-operator:v1:${crypto.createHash("sha256").update((0, import_webhook_registration.canonicalDelegatedOperatorAuthorization)(delegatedOperatorAuthorization)).digest("base64url")}`
2466
+ const actualProfile = selectSignatureProfile({ headers: normalizedHeaders.headers });
2467
+ if (registration.signingProfile === "web-bot-auth") {
2468
+ if (registration.delegatedOperatorAuthorization || await this.config.webhookVerification?.publisherPins?.(registration))
2469
+ throw new WebBotAuthError(403, "legacy_webhook_authorization_requires_rfc_profile");
2470
+ const config = this.config.webhookVerification?.webBotAuth;
2471
+ if (!config) throw new WebBotAuthError(403, "webhook_profile_not_configured");
2472
+ const signers = await verifyWebBotAuth(
2473
+ {
2474
+ method: requestMethod,
2475
+ url: requestUrl,
2476
+ headers: normalizedHeaders.headers,
2477
+ body: typeof rawBody === "string" ? rawBody : new TextDecoder("utf-8", { fatal: true }).decode(rawBody)
2478
+ },
2479
+ {
2480
+ directory: config.directory,
2481
+ replayStore: this.webhookReplayStore,
2482
+ isRevoked: config.isRevoked,
2483
+ now: this.config.webhookVerification?.now
2445
2484
  }
2446
- }
2447
- );
2485
+ );
2486
+ if (signers.length !== 1 || signers[0].origin !== (0, import_canonicalize.canonicalAgentOrigin)(registration.agentUrl))
2487
+ throw new WebBotAuthError(403, "webhook_signer_mismatch");
2488
+ } else {
2489
+ if (actualProfile === "web-bot-auth") throw new WebBotAuthError(403, "webhook_profile_mismatch");
2490
+ const delegatedOperatorAuthorization = this.delegatedOperatorAuthorizationForRegistration(registration);
2491
+ await (0, import_server.verifyWebhookSignature)(
2492
+ {
2493
+ method: requestMethod,
2494
+ url: requestUrl,
2495
+ headers: normalizedHeaders.headers,
2496
+ body: rawBody
2497
+ },
2498
+ {
2499
+ jwks: this.webhookJwksFor(registration),
2500
+ publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
2501
+ onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
2502
+ replayStore: this.webhookReplayStore,
2503
+ revocationStore: this.webhookRevocationStore,
2504
+ ...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
2505
+ agentUrlForKeyid: () => registration.agentUrl,
2506
+ ...registration.authorizationContextVersion === 1 && {
2507
+ replayScopeBinding: `delegated-operator:v1:${crypto.createHash("sha256").update((0, import_webhook_registration.canonicalDelegatedOperatorAuthorization)(delegatedOperatorAuthorization)).digest("base64url")}`
2508
+ }
2509
+ }
2510
+ );
2511
+ }
2448
2512
  } catch (cause) {
2513
+ if (cause instanceof WebBotAuthError)
2514
+ return {
2515
+ ok: false,
2516
+ code: [
2517
+ "directory_unavailable",
2518
+ "revocation_unavailable",
2519
+ "verification_unavailable",
2520
+ "directory_fetch_limit"
2521
+ ].includes(cause.reason) ? "webhook_verification_unavailable" : "webhook_signature_invalid",
2522
+ message: cause.message,
2523
+ cause
2524
+ };
2449
2525
  if (cause instanceof import_server.WebhookSignatureError) {
2450
2526
  if (cause.retryable)
2451
2527
  return {
@@ -2525,6 +2601,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2525
2601
  if (!parsedPayload.ok) {
2526
2602
  return parsedPayload;
2527
2603
  }
2604
+ if (registration?.deliveryKind) {
2605
+ const loader = require('../validation/schema-loader.js');
2606
+ const body = parsedPayload.payload;
2607
+ const isReport = registration.deliveryKind === "reporting";
2608
+ const payload = isReport ? body.result : body;
2609
+ const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
2610
+ const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
2611
+ const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
2612
+ if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
2613
+ return {
2614
+ ok: false,
2615
+ code: "webhook_envelope_invalid",
2616
+ message: "Authenticated delivery does not match its registered payload kind"
2617
+ };
2618
+ const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
2619
+ const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
2620
+ const status = isReport && (0, import_task_status.isAdcpStatus)(body.status) ? body.status : "completed";
2621
+ return {
2622
+ ok: true,
2623
+ protocol: registration.protocol,
2624
+ envelope: isReport ? body : {
2625
+ ...body,
2626
+ task_type: registration.taskType,
2627
+ operation_id: operationId,
2628
+ task_id: taskId,
2629
+ status,
2630
+ result: payload
2631
+ },
2632
+ result: payload,
2633
+ metadata: {
2634
+ taskId,
2635
+ taskType: registration.taskType,
2636
+ operationId,
2637
+ status,
2638
+ ...typeof body.timestamp === "string" && { timestamp: body.timestamp },
2639
+ ...typeof body.idempotency_key === "string" && { idempotencyKey: body.idempotency_key }
2640
+ }
2641
+ };
2642
+ }
2528
2643
  const topLevelTaskType = isObjectRecord(parsedPayload.payload) && typeof parsedPayload.payload.task_type === "string" ? parsedPayload.payload.task_type : void 0;
2529
2644
  const payloadRecord = isObjectRecord(parsedPayload.payload) ? parsedPayload.payload : void 0;
2530
2645
  const signedRoute = extractSignedWebhookRoute(parsedPayload.payload);
@@ -3286,7 +3401,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3286
3401
  if (!options?.skipIdempotencyAutoInject && !options?.preserveGovernedPayload && (0, import_idempotency.requestUsesIdempotency)(taskType, normalizedParams) && normalizedParams && typeof normalizedParams === "object" && !normalizedParams.idempotency_key) {
3287
3402
  normalizedParams = { ...normalizedParams, idempotency_key: (0, import_idempotency.generateIdempotencyKey)() };
3288
3403
  }
3289
- if (!options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation && !options?.preserveGovernedPayload && !(0, import_schema_loader.isExternalSchemaRootActive)(this.resolvedAdcpVersion)) {
3404
+ if (!options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation && !options?.preserveGovernedPayload && !(0, import_schema_loader2.isExternalSchemaRootActive)(this.resolvedAdcpVersion)) {
3290
3405
  this.validateRequest(taskType, normalizedParams);
3291
3406
  }
3292
3407
  await this.validateTaskFeatures(taskType, options);
@@ -4379,7 +4494,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4379
4494
  const filtered = {};
4380
4495
  const schemaStripped = [];
4381
4496
  for (const [key, value] of Object.entries(adapted)) {
4382
- if (declaredFields.has(key) || envelopeFields.has(key) || (0, import_schema_loader.schemaAllowsTopLevelField)(taskType, key, this.resolvedAdcpVersion)) {
4497
+ if (declaredFields.has(key) || envelopeFields.has(key) || (0, import_schema_loader2.schemaAllowsTopLevelField)(taskType, key, this.resolvedAdcpVersion)) {
4383
4498
  filtered[key] = value;
4384
4499
  } else {
4385
4500
  schemaStripped.push(key);
@@ -4714,6 +4829,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4714
4829
  params.account
4715
4830
  );
4716
4831
  const hasCreativeFormatData = hasMediaBuyCreativeFormatData(params);
4832
+ if (this.config.experimentalIdentity33) await this.getCapabilities(taskOptions);
4833
+ const signed33Webhooks = this.usesSigned33Webhooks();
4717
4834
  if (this.config.webhookUrlTemplate && !options?.disableWebhook) {
4718
4835
  const now = /* @__PURE__ */ new Date();
4719
4836
  const year = now.getUTCFullYear();
@@ -4734,12 +4851,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4734
4851
  const consumerAuth = consumerReportingWebhook?.authentication;
4735
4852
  const consumerUrl = consumerReportingWebhook?.url;
4736
4853
  const consumerFrequency = consumerReportingWebhook?.reporting_frequency;
4737
- const defaultAuth = this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
4854
+ const defaultAuth = !signed33Webhooks && this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
4738
4855
  const resolvedAuth = consumerAuth !== void 0 ? consumerAuth : consumerUrl === void 0 ? defaultAuth : void 0;
4739
- if (resolvedAuth === void 0 || resolvedAuth === null) {
4856
+ if (!signed33Webhooks && resolvedAuth === void 0 || resolvedAuth === null) {
4740
4857
  if (consumerReportingWebhook) {
4741
4858
  throw new Error(
4742
- "reporting_webhook requires an `authentication` block for all of AdCP 3.x, and no credential is available: set `webhookSecret` on the client, or pass `reporting_webhook.authentication` explicitly. Remove `reporting_webhook` from the request if you do not need automated delivery reports \u2014 the media buy itself does not require it."
4859
+ "reporting_webhook requires an `authentication` block without positively negotiated 3.3 signed webhooks, and no credential is available: set `webhookSecret` on the client, or pass `reporting_webhook.authentication` explicitly. Remove `reporting_webhook` from the request if you do not need automated delivery reports \u2014 the media buy itself does not require it."
4743
4860
  );
4744
4861
  }
4745
4862
  warnReportingWebhookNeedsSecret();
@@ -4755,9 +4872,20 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4755
4872
  ...consumerReportingWebhook,
4756
4873
  url: consumerUrl !== void 0 ? consumerUrl : deliveryWebhookUrl,
4757
4874
  reporting_frequency: consumerFrequency !== void 0 ? consumerFrequency : libraryDefaults.reporting_frequency,
4758
- authentication: resolvedAuth
4875
+ ...resolvedAuth !== void 0 && { authentication: resolvedAuth },
4876
+ ...resolvedAuth === void 0 && this.selectedWebhookSigningProfile() && { signing_profile: this.selectedWebhookSigningProfile() }
4759
4877
  }
4760
4878
  };
4879
+ if (signed33Webhooks && resolvedAuth === void 0) {
4880
+ await this.persistWebhookRegistration({
4881
+ agent: this.normalizedAgent,
4882
+ taskType: "media_buy_delivery",
4883
+ operationId,
4884
+ callbackUrl: consumerUrl ?? deliveryWebhookUrl,
4885
+ mode: "rfc9421",
4886
+ signingProfile: this.selectedWebhookSigningProfile()
4887
+ });
4888
+ }
4761
4889
  }
4762
4890
  }
4763
4891
  }
@@ -5012,7 +5140,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5012
5140
  ...options,
5013
5141
  [CAPABILITY_DISCOVERY_CONTEXT]: discoveryContext
5014
5142
  });
5015
- const usesScopedFetch = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport)?.trustedFetchFn !== void 0;
5143
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
5016
5144
  const toolSchemas = discoveryContext.toolSchemas ?? (usesScopedFetch ? void 0 : this.cachedToolSchemas);
5017
5145
  const wireRelease = this.config.wireAdcpVersion ?? this.resolvedAdcpVersion;
5018
5146
  const declared = (0, import_creative_delivery.resolveCreativeFormatWireMode)(capabilities, wireRelease);
@@ -5046,7 +5174,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5046
5174
  if ((0, import_idempotency.requestUsesIdempotency)(taskType, normalizedParams) && normalizedParams && typeof normalizedParams === "object" && !normalizedParams.idempotency_key) {
5047
5175
  normalizedParams = { ...normalizedParams, idempotency_key: (0, import_idempotency.generateIdempotencyKey)() };
5048
5176
  }
5049
- if (!(0, import_schema_loader.isExternalSchemaRootActive)(this.resolvedAdcpVersion)) {
5177
+ if (!(0, import_schema_loader2.isExternalSchemaRootActive)(this.resolvedAdcpVersion)) {
5050
5178
  this.validateRequest(taskType, normalizedParams);
5051
5179
  }
5052
5180
  }
@@ -5327,15 +5455,23 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5327
5455
  );
5328
5456
  }
5329
5457
  async getAdcpCapabilitiesWithinDeadline(params, inputHandler, options) {
5458
+ const scopeKey = this.config._reuseConfiguredDiscovery?.() ? this.getCapabilityEvidenceScope().scopeKey : void 0;
5330
5459
  const agent = await this.ensureEndpointDiscovered(options);
5331
5460
  this.executor.validateRequest("get_adcp_capabilities", params);
5332
- return this.executor.executeTask(
5461
+ const result = await this.executor.executeTask(
5333
5462
  agent,
5334
5463
  "get_adcp_capabilities",
5335
5464
  params,
5336
5465
  inputHandler,
5337
5466
  options
5338
5467
  );
5468
+ if (this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options) && scopeKey === this.getCapabilityEvidenceScope().scopeKey && Object.keys(params).length === 0 && this.runAgentInfo !== void 0 && result.success && result.data && (0, import_capabilities.looksLikeV3Capabilities)(result.data)) {
5469
+ const capabilities = (0, import_capabilities.parseCapabilitiesResponse)(structuredClone(result.data));
5470
+ if (!capabilities._synthetic) {
5471
+ this.cachedCapabilities = (0, import_capabilities.augmentCapabilitiesFromTools)(capabilities, this.runAgentInfo.tools);
5472
+ }
5473
+ }
5474
+ return result;
5339
5475
  }
5340
5476
  // ====== CREATIVE BUILD TASKS ======
5341
5477
  /**
@@ -6433,6 +6569,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6433
6569
  * ```
6434
6570
  */
6435
6571
  async getAgentInfo(options) {
6572
+ (0, import_abort2.throwIfAborted)(options?.signal);
6573
+ const reuse = this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options);
6574
+ if (!reuse) return this.getAgentInfoLive(options);
6575
+ const scopeKey = this.getCapabilityEvidenceScope().scopeKey;
6576
+ if (this.runAgentInfo) return structuredClone(this.runAgentInfo);
6577
+ const info = await this.getAgentInfoLive(options);
6578
+ if (reuse && scopeKey === this.getCapabilityEvidenceScope().scopeKey) {
6579
+ this.runAgentInfo = structuredClone(info);
6580
+ const documents = new Map(
6581
+ this.runAgentInfo.tools.filter((tool) => tool.inputSchema).map((tool) => [tool.name, tool.inputSchema])
6582
+ );
6583
+ this.cachedToolSchemas = new Map(
6584
+ [...documents].map(([name, schema]) => [name, schema.properties ?? {}])
6585
+ );
6586
+ toolInputSchemasByProperties.set(this.cachedToolSchemas, documents);
6587
+ }
6588
+ return info;
6589
+ }
6590
+ async getAgentInfoLive(options) {
6436
6591
  const { withResponseSizeLimit } = await import("../protocols/responseSizeLimit.js");
6437
6592
  (0, import_abort2.throwIfAborted)(options?.signal);
6438
6593
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
@@ -6666,7 +6821,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6666
6821
  this.synchronizeCapabilityEvidenceAuthorizationScope();
6667
6822
  const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
6668
6823
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
6669
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
6824
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
6670
6825
  if (this.primedCapabilitiesExpiresAt !== void 0 && this.primedCapabilitiesExpiresAt <= Date.now()) {
6671
6826
  this.cachedCapabilities = void 0;
6672
6827
  this.cachedToolSchemas = void 0;
@@ -6945,10 +7100,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6945
7100
  }
6946
7101
  if (current === this.capabilityEvidenceAuthMaterial) return;
6947
7102
  this.capabilityEvidenceAuthMaterial = current;
7103
+ this.discoveryEpoch++;
7104
+ this.runAgentInfo = void 0;
6948
7105
  this.cachedCapabilities = void 0;
6949
7106
  this.cachedToolSchemas = void 0;
6950
7107
  this.primedCapabilitiesExpiresAt = void 0;
6951
7108
  this.capabilityEvidenceScopeKey = (0, import_node_crypto.randomUUID)();
7109
+ if (this.config._reuseConfiguredDiscovery?.()) {
7110
+ this.discoveredEndpoint = void 0;
7111
+ this.discoveredAgent = void 0;
7112
+ this.canonicalBaseUrl = void 0;
7113
+ this.discoveredMcpEra = void 0;
7114
+ }
7115
+ }
7116
+ /** A comply() run owns its configured fetch; per-call transport changes still discover separately. */
7117
+ usesScopedDiscoveryTransport(options) {
7118
+ const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
7119
+ if (!this.config._reuseConfiguredDiscovery?.()) return transport?.trustedFetchFn !== void 0;
7120
+ const configured = (0, import_protocols.normalizeTransportOptions)(this.config.transport);
7121
+ return transport?.trustedFetchFn !== configured?.trustedFetchFn || transport?.allowPrivateIp !== configured?.allowPrivateIp || transport?.maxResponseBytes !== configured?.maxResponseBytes || transport?.requestTimeoutMs !== configured?.requestTimeoutMs || transport?.legacyCompat?.enabled !== configured?.legacyCompat?.enabled;
6952
7122
  }
6953
7123
  /**
6954
7124
  * Reuse a fresh capability observation made by the embedding application.
@@ -6971,7 +7141,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6971
7141
  const hasValidToolSchemas = snapshot?.toolSchemas === void 0 || typeof snapshot.toolSchemas === "object" && snapshot.toolSchemas !== null && Object.values(snapshot.toolSchemas).every(
6972
7142
  (properties) => typeof properties === "object" && properties !== null && !Array.isArray(properties)
6973
7143
  );
6974
- const configuredScopedFetch = (0, import_protocols.normalizeTransportOptions)(this.config.transport)?.trustedFetchFn !== void 0;
7144
+ const configuredScopedFetch = this.usesScopedDiscoveryTransport();
6975
7145
  const hasToolEvidence = snapshot?.toolSchemas !== void 0 || Array.isArray(capabilities?.discoveredTools);
6976
7146
  if (!matchesScope || !isFresh || !hasCapabilities || !hasValidToolSchemas || !hasToolEvidence || configuredScopedFetch) {
6977
7147
  this.cachedCapabilities = void 0;
@@ -7014,11 +7184,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7014
7184
  /** Epoch of this client's evidence for the call's effective shared key; `undefined` without a shared cache. */
7015
7185
  discoveryEpochSnapshot(options) {
7016
7186
  const key = this.sharedDiscoveryKey(options);
7017
- if (!key || !this.config.discoveryCache) return void 0;
7187
+ if (!key || !this.config.discoveryCache) {
7188
+ return this.config._reuseConfiguredDiscovery?.() ? { local: this.discoveryEpoch, shared: 0, key: "" } : void 0;
7189
+ }
7018
7190
  return { local: this.discoveryEpoch, shared: this.sharedInvalidationEpoch(key), key };
7019
7191
  }
7020
7192
  discoveryEpochIs(epoch) {
7021
- return epoch.local === this.discoveryEpoch && epoch.shared === this.sharedInvalidationEpoch(epoch.key);
7193
+ return epoch.local === this.discoveryEpoch && (!epoch.key || epoch.shared === this.sharedInvalidationEpoch(epoch.key));
7022
7194
  }
7023
7195
  /** The latest invalidation that applies to `key`: its own, combined with the cache's floor of forgotten ones. */
7024
7196
  sharedInvalidationRecord(key) {
@@ -7327,6 +7499,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7327
7499
  * seller answers with a version or capability error.
7328
7500
  */
7329
7501
  async invalidateDiscoveryCache(options) {
7502
+ this.runAgentInfo = void 0;
7503
+ if (this.config._reuseConfiguredDiscovery?.()) this.canonicalBaseUrl = void 0;
7330
7504
  this.cachedCapabilities = void 0;
7331
7505
  this.cachedToolSchemas = void 0;
7332
7506
  this.primedCapabilitiesExpiresAt = void 0;
@@ -7874,7 +8048,29 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7874
8048
  * injected fields before the adapter gets a chance to clean them up, so
7875
8049
  * the two passes have to agree on "extra keys are fine."
7876
8050
  */
8051
+ usesIdentity33Schemas() {
8052
+ return this.config.experimentalIdentity33 === true && this.cachedCapabilities?._synthetic === false && (0, import_adcp_version_config.isAdcpVersionAtLeast)(this.cachedCapabilities.servedVersion, "3.3.0");
8053
+ }
8054
+ usesSigned33Webhooks() {
8055
+ const capabilities = this.cachedCapabilities;
8056
+ return this.config.experimentalIdentity33 === true && capabilities?._synthetic === false && (0, import_adcp_version_config.isAdcpVersionAtLeast)(capabilities.servedVersion, "3.3.0") && capabilities._raw?.webhook_signing?.supported === true;
8057
+ }
8058
+ selectedWebhookSigningProfile() {
8059
+ if (!this.usesSigned33Webhooks()) return void 0;
8060
+ const advertisement = this.cachedCapabilities?._raw?.webhook_signing;
8061
+ const profile = this.config.webhookSigningProfile ?? (advertisement?.profile === "web-bot-auth" || advertisement?.profiles?.length === 1 && advertisement.profiles[0] === "web-bot-auth" ? "web-bot-auth" : "adcp/webhook-signing/v1");
8062
+ if (profile === "web-bot-auth" && !advertisement?.profiles?.includes(profile))
8063
+ throw new import_errors.ConfigurationError(
8064
+ "Seller did not advertise the selected Web Bot Auth webhook profile",
8065
+ "webhookSigningProfile"
8066
+ );
8067
+ return profile;
8068
+ }
7877
8069
  validateRequest(taskType, params) {
8070
+ if (this.config.experimentalIdentity33 && this.usesIdentity33Schemas()) {
8071
+ this.executor.validateRequest(taskType, params);
8072
+ return;
8073
+ }
7878
8074
  const schema = this.getRequestSchema(taskType);
7879
8075
  if (!schema) {
7880
8076
  return;
@@ -7991,6 +8187,7 @@ function normalizeRfc9421WebhookHeaders(headers) {
7991
8187
  const singletonHeaders = /* @__PURE__ */ new Set([
7992
8188
  "signature",
7993
8189
  "signature-input",
8190
+ "signature-agent",
7994
8191
  "content-digest",
7995
8192
  "content-type",
7996
8193
  "x-adcp-signature",