@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
@@ -3,6 +3,15 @@ import { dirname as __adcpDirname } from "node:path";
3
3
  import { createRequire as __adcpCreateRequire } from "node:module";
4
4
  const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
5
5
  const require2 = __adcpCreateRequire(import.meta.url);
6
+ import {
7
+ isIdentity33SchemaScope,
8
+ withIdentity33SchemaScope,
9
+ bindIdentity33SchemaScope
10
+ } from "../validation/schema-loader.mjs";
11
+ function loadWebBotAuth() {
12
+ return require2("../signing/web-bot-auth");
13
+ }
14
+ import { canonicalAgentOrigin } from "../signing/agent-resolver/canonicalize.mjs";
6
15
  import {
7
16
  annotateProductsSupplyPaths
8
17
  } from "../supply-path/products.mjs";
@@ -74,6 +83,7 @@ import {
74
83
  canonicalDelegatedOperatorAuthorization,
75
84
  InMemoryWebhookRegistrationStore,
76
85
  parseWebhookRegistration,
86
+ deliveryWebhookRegistrationId,
77
87
  sameWebhookRegistration,
78
88
  WebhookRegistrationIntegrityError,
79
89
  validateWebhookRegistrationAuthorization
@@ -168,6 +178,8 @@ import {
168
178
  } from "../v2/projection/creative-delivery.mjs";
169
179
  import {
170
180
  formatOptionOriginFromRoutes,
181
+ sameFormatOptionRef,
182
+ sellerDeclaredFormatOptionRefs,
171
183
  undeclaredFormatOptionSelector
172
184
  } from "../v2/projection/legacy-routes.mjs";
173
185
  import {
@@ -826,6 +838,11 @@ class SingleAgentClient {
826
838
  constructor(agent, config = {}) {
827
839
  this.agent = agent;
828
840
  this.config = config;
841
+ if (config.experimentalIdentity33 === true !== isIdentity33SchemaScope())
842
+ return withIdentity33SchemaScope(() => {
843
+ const instance = Reflect.construct(SingleAgentClient, [agent, config], new.target);
844
+ return config.experimentalIdentity33 ? bindIdentity33SchemaScope(instance) : instance;
845
+ }, config.experimentalIdentity33 === true);
829
846
  const configuredTransport = config.transport === void 0 ? void 0 : { ...config.transport };
830
847
  const configuredWebhookVerification = config.webhookVerification === void 0 ? void 0 : {
831
848
  ...config.webhookVerification,
@@ -840,7 +857,9 @@ class SingleAgentClient {
840
857
  };
841
858
  config = this.config;
842
859
  validateAgentDiscoveryCacheConfig(config.discoveryCache);
843
- this.resolvedAdcpVersion = resolveAdcpVersion(config.adcpVersion);
860
+ this.resolvedAdcpVersion = resolveAdcpVersion(
861
+ config.adcpVersion ?? (config.experimentalIdentity33 ? "3.3" : void 0)
862
+ );
844
863
  this.webhookRegistrationStore = config.webhookRegistrationStore ?? new InMemoryWebhookRegistrationStore();
845
864
  this.webhookReplayStore = config.webhookVerification?.replayStore ?? new InMemoryReplayStore();
846
865
  this.webhookRevocationStore = config.webhookVerification?.revocationStore ?? new InMemoryRevocationStore();
@@ -899,6 +918,10 @@ class SingleAgentClient {
899
918
  webhookUrlTemplate: config.webhookUrlTemplate,
900
919
  agentId: agent.id,
901
920
  webhookSecret: config.webhookSecret,
921
+ identity33SchemaExperiment: config.experimentalIdentity33,
922
+ experimentalIdentity33: () => this.config.experimentalIdentity33 === true && this.usesIdentity33Schemas(),
923
+ signedIdentity33Webhooks: () => this.usesSigned33Webhooks(),
924
+ webhookSigningProfile: () => this.selectedWebhookSigningProfile(),
902
925
  onWebhookRegistration: (registration) => this.persistWebhookRegistration(registration),
903
926
  onDurableSettlementRequired: (operationId) => this.markWebhookDurableSettlementRequired(operationId),
904
927
  externalTaskSettlementRetentionMs: registrationTtl * 1e3,
@@ -1154,6 +1177,7 @@ class SingleAgentClient {
1154
1177
  // Cache canonical base URL (from agent card or stripped /mcp)
1155
1178
  cachedCapabilities;
1156
1179
  // Cache detected server capabilities
1180
+ runAgentInfo;
1157
1181
  cachedToolSchemas;
1158
1182
  // inputSchema.properties per tool name
1159
1183
  primedCapabilitiesExpiresAt;
@@ -1210,18 +1234,18 @@ class SingleAgentClient {
1210
1234
  persistedAgentUrl.username = "";
1211
1235
  persistedAgentUrl.password = "";
1212
1236
  persistedAgentUrl.hash = "";
1213
- const delegatedOperatorAuthorization = this.effectiveDelegatedOperatorAuthorization(
1214
- args.delegatedOperatorAuthorization
1215
- );
1237
+ const delegatedOperatorAuthorization = args.deliveryKind ? void 0 : this.effectiveDelegatedOperatorAuthorization(args.delegatedOperatorAuthorization);
1216
1238
  const registration = {
1217
1239
  agentId: args.agent.id,
1218
1240
  agentUrl: persistedAgentUrl.toString(),
1219
1241
  protocol: args.agent.protocol,
1220
1242
  operationId: args.operationId,
1221
1243
  taskType: args.taskType,
1222
- callbackUrl: args.callbackUrl,
1244
+ callbackUrl: args.deliveryKind ? canonicalTargetUri(args.callbackUrl, "3.2") : args.callbackUrl,
1223
1245
  method: "POST",
1224
1246
  mode: args.mode,
1247
+ ...args.signingProfile && { signingProfile: args.signingProfile },
1248
+ ...args.deliveryKind && { deliveryKind: args.deliveryKind },
1225
1249
  authorizationContextVersion: 1,
1226
1250
  ...delegatedOperatorAuthorization !== void 0 && { delegatedOperatorAuthorization },
1227
1251
  ...previewMode && { previewMode },
@@ -1230,6 +1254,14 @@ class SingleAgentClient {
1230
1254
  };
1231
1255
  validateWebhookRegistrationAuthorization(registration);
1232
1256
  try {
1257
+ if (args.deliveryKind) {
1258
+ const previous = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
1259
+ if (previous && previous.expiresAt > nowMs && (previous.signingProfile ?? "adcp/webhook-signing/v1") !== (registration.signingProfile ?? "adcp/webhook-signing/v1"))
1260
+ throw new ConfigurationError(
1261
+ `${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.`,
1262
+ `${args.deliveryKind}_webhook.signing_profile`
1263
+ );
1264
+ }
1233
1265
  await this.webhookRegistrationStore.putIfAbsent(registration);
1234
1266
  const persisted = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
1235
1267
  if (!persisted || !sameWebhookRegistration(
@@ -1241,6 +1273,8 @@ class SingleAgentClient {
1241
1273
  );
1242
1274
  }
1243
1275
  } catch (cause) {
1276
+ if (args.deliveryKind && cause instanceof ConfigurationError && cause.configField === `${args.deliveryKind}_webhook.signing_profile`)
1277
+ throw cause;
1244
1278
  if (args.mode === "rfc9421" || !RECORDLESS_HMAC_READ_ONLY_TASKS.has(args.taskType)) {
1245
1279
  const error = new ConfigurationError("Could not persist trusted webhook registration for this operation.");
1246
1280
  Object.defineProperty(error, "cause", { value: cause, configurable: true });
@@ -1402,7 +1436,7 @@ class SingleAgentClient {
1402
1436
  return canonicalizeJson([this.canonicalAccountScope(account), "package", packageId]);
1403
1437
  }
1404
1438
  sameCanonicalOptionRef(left, right) {
1405
- 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());
1439
+ return sameFormatOptionRef(left, right);
1406
1440
  }
1407
1441
  rememberCanonicalLegacyRoute(key, route) {
1408
1442
  this.canonicalLegacyRoutes.delete(key);
@@ -1473,20 +1507,7 @@ class SingleAgentClient {
1473
1507
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
1474
1508
  const product = value;
1475
1509
  if (typeof product.product_id !== "string") continue;
1476
- const refs = [];
1477
- for (const optionValue of Array.isArray(product.format_options) ? product.format_options : []) {
1478
- if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
1479
- const option = optionValue;
1480
- if (typeof option.format_option_id !== "string") continue;
1481
- refs.push(
1482
- typeof option.publisher_domain === "string" ? {
1483
- scope: "publisher",
1484
- publisher_domain: option.publisher_domain,
1485
- format_option_id: option.format_option_id
1486
- } : { scope: "product", format_option_id: option.format_option_id }
1487
- );
1488
- }
1489
- declared.set(product.product_id, refs);
1510
+ declared.set(product.product_id, sellerDeclaredFormatOptionRefs(product));
1490
1511
  }
1491
1512
  return declared;
1492
1513
  }
@@ -1906,9 +1927,10 @@ class SingleAgentClient {
1906
1927
  */
1907
1928
  async ensureEndpointDiscovered(options) {
1908
1929
  throwIfAborted(options?.signal);
1930
+ if (this.config._reuseConfiguredDiscovery?.()) this.synchronizeCapabilityEvidenceAuthorizationScope();
1909
1931
  const needsDiscovery = this.normalizedAgent._needsDiscovery;
1910
1932
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
1911
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
1933
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
1912
1934
  if (!needsDiscovery) {
1913
1935
  return this.normalizedAgent;
1914
1936
  }
@@ -2014,7 +2036,7 @@ class SingleAgentClient {
2014
2036
  throwIfAborted(options?.signal);
2015
2037
  const needsCanonicalUrl = this.normalizedAgent._needsCanonicalUrl;
2016
2038
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
2017
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
2039
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
2018
2040
  if (!needsCanonicalUrl) {
2019
2041
  return this.normalizedAgent;
2020
2042
  }
@@ -2033,8 +2055,11 @@ class SingleAgentClient {
2033
2055
  signal: options?.signal
2034
2056
  });
2035
2057
  }
2058
+ const canonicalEpoch = this.discoveryEpochSnapshot(options);
2036
2059
  const canonicalUrl = await this.fetchA2ACanonicalUrl(this.normalizedAgent.agent_uri, options);
2037
- if (!usesScopedFetch) this.canonicalBaseUrl = canonicalUrl;
2060
+ if (!usesScopedFetch && (!canonicalEpoch || this.discoveryEpochIs(canonicalEpoch))) {
2061
+ this.canonicalBaseUrl = canonicalUrl;
2062
+ }
2038
2063
  return {
2039
2064
  ...this.normalizedAgent,
2040
2065
  agent_uri: canonicalUrl
@@ -2159,7 +2184,9 @@ class SingleAgentClient {
2159
2184
  const { connectMCPWithFallback } = await import("../protocols/mcp.mjs");
2160
2185
  const { probeModernMCPConnection } = await import("../protocols/mcp-modern.mjs");
2161
2186
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
2162
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
2187
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
2188
+ const endpointEpoch = this.discoveryEpochSnapshot(options);
2189
+ const mayRetain = () => !usesScopedFetch && (!endpointEpoch || this.discoveryEpochIs(endpointEpoch));
2163
2190
  const authToken = this.normalizedAgent.oauth_client_credentials ? this.normalizedAgent.oauth_tokens?.access_token : this.agent.auth_token;
2164
2191
  const agentHeaders = this.agent.headers;
2165
2192
  const authHeaders = createMCPRequestHeaders(agentHeaders, authToken);
@@ -2179,7 +2206,7 @@ class SingleAgentClient {
2179
2206
  allowPrivateIp: transport?.allowPrivateIp
2180
2207
  });
2181
2208
  if (modern.connected) {
2182
- if (!usesScopedFetch) {
2209
+ if (mayRetain()) {
2183
2210
  this.discoveredMcpEra = modern.era;
2184
2211
  this.discoveredMcpEraAt = Date.now();
2185
2212
  }
@@ -2198,7 +2225,7 @@ class SingleAgentClient {
2198
2225
  }
2199
2226
  );
2200
2227
  await client.close();
2201
- if (!usesScopedFetch) {
2228
+ if (mayRetain()) {
2202
2229
  this.discoveredMcpEra = "legacy";
2203
2230
  this.discoveredMcpEraAt = Date.now();
2204
2231
  }
@@ -2375,7 +2402,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2375
2402
  async verifyAndParseWebhook(options) {
2376
2403
  const rawBody = options.rawBody ?? rawBodyFromUnknown(options.body);
2377
2404
  const authHeaders = inspectWebhookAuthenticationHeaders(options.headers, options.signature, options.timestamp);
2378
- const trustedOperationId = options.operationId && options.operationId !== "unknown" ? options.operationId : void 0;
2405
+ let trustedOperationId = options.operationId && options.operationId !== "unknown" ? options.operationId : void 0;
2379
2406
  let registration;
2380
2407
  if (trustedOperationId) {
2381
2408
  let stored;
@@ -2416,6 +2443,24 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2416
2443
  }
2417
2444
  }
2418
2445
  }
2446
+ if (!registration && options.requestUrl && ["media_buy_delivery", "artifact_delivery"].includes(options.taskType ?? "")) {
2447
+ const kind = options.taskType === "artifact_delivery" ? "artifact" : "reporting";
2448
+ const routeId = deliveryWebhookRegistrationId(kind, options.requestUrl);
2449
+ try {
2450
+ const stored = await this.webhookRegistrationStore.get(this.agent.id, routeId);
2451
+ if (stored) {
2452
+ registration = parseWebhookRegistration(stored, { agentId: this.agent.id, operationId: routeId });
2453
+ trustedOperationId = routeId;
2454
+ }
2455
+ } catch (cause) {
2456
+ return {
2457
+ ok: false,
2458
+ code: "webhook_registration_store_unavailable",
2459
+ message: "Delivery registration state is unavailable",
2460
+ cause
2461
+ };
2462
+ }
2463
+ }
2419
2464
  if (registration) {
2420
2465
  const nowMs = this.config.webhookVerification?.now ? Math.floor(this.config.webhookVerification.now() * 1e3) : Date.now();
2421
2466
  if (registration.expiresAt <= nowMs) registration = void 0;
@@ -2496,6 +2541,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2496
2541
  }
2497
2542
  }
2498
2543
  if (registration?.mode === "rfc9421") {
2544
+ const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError } = loadWebBotAuth();
2499
2545
  const requestMethod = options.requestMethod;
2500
2546
  const requestUrl = options.requestUrl;
2501
2547
  if (rawBody === void 0 || !options.headers || !trustedOperationId || !requestMethod || !requestUrl) {
@@ -2508,28 +2554,65 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2508
2554
  const normalizedHeaders = normalizeRfc9421WebhookHeaders(options.headers);
2509
2555
  if (!normalizedHeaders.ok) return normalizedHeaders.failure;
2510
2556
  try {
2511
- const delegatedOperatorAuthorization = this.delegatedOperatorAuthorizationForRegistration(registration);
2512
- await verifyRfc9421WebhookSignature(
2513
- {
2514
- method: requestMethod,
2515
- url: requestUrl,
2516
- headers: normalizedHeaders.headers,
2517
- body: rawBody
2518
- },
2519
- {
2520
- jwks: this.webhookJwksFor(registration),
2521
- publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
2522
- onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
2523
- replayStore: this.webhookReplayStore,
2524
- revocationStore: this.webhookRevocationStore,
2525
- ...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
2526
- agentUrlForKeyid: () => registration.agentUrl,
2527
- ...registration.authorizationContextVersion === 1 && {
2528
- replayScopeBinding: `delegated-operator:v1:${crypto.createHash("sha256").update(canonicalDelegatedOperatorAuthorization(delegatedOperatorAuthorization)).digest("base64url")}`
2557
+ const actualProfile = selectSignatureProfile({ headers: normalizedHeaders.headers });
2558
+ if (registration.signingProfile === "web-bot-auth") {
2559
+ if (registration.delegatedOperatorAuthorization || await this.config.webhookVerification?.publisherPins?.(registration))
2560
+ throw new WebBotAuthError(403, "legacy_webhook_authorization_requires_rfc_profile");
2561
+ const config = this.config.webhookVerification?.webBotAuth;
2562
+ if (!config) throw new WebBotAuthError(403, "webhook_profile_not_configured");
2563
+ const signers = await verifyWebBotAuth(
2564
+ {
2565
+ method: requestMethod,
2566
+ url: requestUrl,
2567
+ headers: normalizedHeaders.headers,
2568
+ body: typeof rawBody === "string" ? rawBody : new TextDecoder("utf-8", { fatal: true }).decode(rawBody)
2569
+ },
2570
+ {
2571
+ directory: config.directory,
2572
+ replayStore: this.webhookReplayStore,
2573
+ isRevoked: config.isRevoked,
2574
+ now: this.config.webhookVerification?.now
2529
2575
  }
2530
- }
2531
- );
2576
+ );
2577
+ if (signers.length !== 1 || signers[0].origin !== canonicalAgentOrigin(registration.agentUrl))
2578
+ throw new WebBotAuthError(403, "webhook_signer_mismatch");
2579
+ } else {
2580
+ if (actualProfile === "web-bot-auth") throw new WebBotAuthError(403, "webhook_profile_mismatch");
2581
+ const delegatedOperatorAuthorization = this.delegatedOperatorAuthorizationForRegistration(registration);
2582
+ await verifyRfc9421WebhookSignature(
2583
+ {
2584
+ method: requestMethod,
2585
+ url: requestUrl,
2586
+ headers: normalizedHeaders.headers,
2587
+ body: rawBody
2588
+ },
2589
+ {
2590
+ jwks: this.webhookJwksFor(registration),
2591
+ publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
2592
+ onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
2593
+ replayStore: this.webhookReplayStore,
2594
+ revocationStore: this.webhookRevocationStore,
2595
+ ...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
2596
+ agentUrlForKeyid: () => registration.agentUrl,
2597
+ ...registration.authorizationContextVersion === 1 && {
2598
+ replayScopeBinding: `delegated-operator:v1:${crypto.createHash("sha256").update(canonicalDelegatedOperatorAuthorization(delegatedOperatorAuthorization)).digest("base64url")}`
2599
+ }
2600
+ }
2601
+ );
2602
+ }
2532
2603
  } catch (cause) {
2604
+ if (cause instanceof WebBotAuthError)
2605
+ return {
2606
+ ok: false,
2607
+ code: [
2608
+ "directory_unavailable",
2609
+ "revocation_unavailable",
2610
+ "verification_unavailable",
2611
+ "directory_fetch_limit"
2612
+ ].includes(cause.reason) ? "webhook_verification_unavailable" : "webhook_signature_invalid",
2613
+ message: cause.message,
2614
+ cause
2615
+ };
2533
2616
  if (cause instanceof WebhookSignatureError) {
2534
2617
  if (cause.retryable)
2535
2618
  return {
@@ -2609,6 +2692,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2609
2692
  if (!parsedPayload.ok) {
2610
2693
  return parsedPayload;
2611
2694
  }
2695
+ if (registration?.deliveryKind) {
2696
+ const loader = require2("../validation/schema-loader");
2697
+ const body = parsedPayload.payload;
2698
+ const isReport = registration.deliveryKind === "reporting";
2699
+ const payload = isReport ? body.result : body;
2700
+ const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
2701
+ const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
2702
+ const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
2703
+ if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
2704
+ return {
2705
+ ok: false,
2706
+ code: "webhook_envelope_invalid",
2707
+ message: "Authenticated delivery does not match its registered payload kind"
2708
+ };
2709
+ const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
2710
+ const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
2711
+ const status = isReport && isAdcpStatus(body.status) ? body.status : "completed";
2712
+ return {
2713
+ ok: true,
2714
+ protocol: registration.protocol,
2715
+ envelope: isReport ? body : {
2716
+ ...body,
2717
+ task_type: registration.taskType,
2718
+ operation_id: operationId,
2719
+ task_id: taskId,
2720
+ status,
2721
+ result: payload
2722
+ },
2723
+ result: payload,
2724
+ metadata: {
2725
+ taskId,
2726
+ taskType: registration.taskType,
2727
+ operationId,
2728
+ status,
2729
+ ...typeof body.timestamp === "string" && { timestamp: body.timestamp },
2730
+ ...typeof body.idempotency_key === "string" && { idempotencyKey: body.idempotency_key }
2731
+ }
2732
+ };
2733
+ }
2612
2734
  const topLevelTaskType = isObjectRecord(parsedPayload.payload) && typeof parsedPayload.payload.task_type === "string" ? parsedPayload.payload.task_type : void 0;
2613
2735
  const payloadRecord = isObjectRecord(parsedPayload.payload) ? parsedPayload.payload : void 0;
2614
2736
  const signedRoute = extractSignedWebhookRoute(parsedPayload.payload);
@@ -4798,6 +4920,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4798
4920
  params.account
4799
4921
  );
4800
4922
  const hasCreativeFormatData = hasMediaBuyCreativeFormatData(params);
4923
+ if (this.config.experimentalIdentity33) await this.getCapabilities(taskOptions);
4924
+ const signed33Webhooks = this.usesSigned33Webhooks();
4801
4925
  if (this.config.webhookUrlTemplate && !options?.disableWebhook) {
4802
4926
  const now = /* @__PURE__ */ new Date();
4803
4927
  const year = now.getUTCFullYear();
@@ -4818,12 +4942,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4818
4942
  const consumerAuth = consumerReportingWebhook?.authentication;
4819
4943
  const consumerUrl = consumerReportingWebhook?.url;
4820
4944
  const consumerFrequency = consumerReportingWebhook?.reporting_frequency;
4821
- const defaultAuth = this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
4945
+ const defaultAuth = !signed33Webhooks && this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
4822
4946
  const resolvedAuth = consumerAuth !== void 0 ? consumerAuth : consumerUrl === void 0 ? defaultAuth : void 0;
4823
- if (resolvedAuth === void 0 || resolvedAuth === null) {
4947
+ if (!signed33Webhooks && resolvedAuth === void 0 || resolvedAuth === null) {
4824
4948
  if (consumerReportingWebhook) {
4825
4949
  throw new Error(
4826
- "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."
4950
+ "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."
4827
4951
  );
4828
4952
  }
4829
4953
  warnReportingWebhookNeedsSecret();
@@ -4839,9 +4963,20 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4839
4963
  ...consumerReportingWebhook,
4840
4964
  url: consumerUrl !== void 0 ? consumerUrl : deliveryWebhookUrl,
4841
4965
  reporting_frequency: consumerFrequency !== void 0 ? consumerFrequency : libraryDefaults.reporting_frequency,
4842
- authentication: resolvedAuth
4966
+ ...resolvedAuth !== void 0 && { authentication: resolvedAuth },
4967
+ ...resolvedAuth === void 0 && this.selectedWebhookSigningProfile() && { signing_profile: this.selectedWebhookSigningProfile() }
4843
4968
  }
4844
4969
  };
4970
+ if (signed33Webhooks && resolvedAuth === void 0) {
4971
+ await this.persistWebhookRegistration({
4972
+ agent: this.normalizedAgent,
4973
+ taskType: "media_buy_delivery",
4974
+ operationId,
4975
+ callbackUrl: consumerUrl ?? deliveryWebhookUrl,
4976
+ mode: "rfc9421",
4977
+ signingProfile: this.selectedWebhookSigningProfile()
4978
+ });
4979
+ }
4845
4980
  }
4846
4981
  }
4847
4982
  }
@@ -5096,7 +5231,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5096
5231
  ...options,
5097
5232
  [CAPABILITY_DISCOVERY_CONTEXT]: discoveryContext
5098
5233
  });
5099
- const usesScopedFetch = normalizeTransportOptions(options?.transport ?? this.config.transport)?.trustedFetchFn !== void 0;
5234
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
5100
5235
  const toolSchemas = discoveryContext.toolSchemas ?? (usesScopedFetch ? void 0 : this.cachedToolSchemas);
5101
5236
  const wireRelease = this.config.wireAdcpVersion ?? this.resolvedAdcpVersion;
5102
5237
  const declared = resolveCreativeFormatWireMode(capabilities, wireRelease);
@@ -5411,15 +5546,23 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5411
5546
  );
5412
5547
  }
5413
5548
  async getAdcpCapabilitiesWithinDeadline(params, inputHandler, options) {
5549
+ const scopeKey = this.config._reuseConfiguredDiscovery?.() ? this.getCapabilityEvidenceScope().scopeKey : void 0;
5414
5550
  const agent = await this.ensureEndpointDiscovered(options);
5415
5551
  this.executor.validateRequest("get_adcp_capabilities", params);
5416
- return this.executor.executeTask(
5552
+ const result = await this.executor.executeTask(
5417
5553
  agent,
5418
5554
  "get_adcp_capabilities",
5419
5555
  params,
5420
5556
  inputHandler,
5421
5557
  options
5422
5558
  );
5559
+ if (this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options) && scopeKey === this.getCapabilityEvidenceScope().scopeKey && Object.keys(params).length === 0 && this.runAgentInfo !== void 0 && result.success && result.data && looksLikeV3Capabilities(result.data)) {
5560
+ const capabilities = parseCapabilitiesResponse(structuredClone(result.data));
5561
+ if (!capabilities._synthetic) {
5562
+ this.cachedCapabilities = augmentCapabilitiesFromTools(capabilities, this.runAgentInfo.tools);
5563
+ }
5564
+ }
5565
+ return result;
5423
5566
  }
5424
5567
  // ====== CREATIVE BUILD TASKS ======
5425
5568
  /**
@@ -6517,6 +6660,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6517
6660
  * ```
6518
6661
  */
6519
6662
  async getAgentInfo(options) {
6663
+ throwIfAborted(options?.signal);
6664
+ const reuse = this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options);
6665
+ if (!reuse) return this.getAgentInfoLive(options);
6666
+ const scopeKey = this.getCapabilityEvidenceScope().scopeKey;
6667
+ if (this.runAgentInfo) return structuredClone(this.runAgentInfo);
6668
+ const info = await this.getAgentInfoLive(options);
6669
+ if (reuse && scopeKey === this.getCapabilityEvidenceScope().scopeKey) {
6670
+ this.runAgentInfo = structuredClone(info);
6671
+ const documents = new Map(
6672
+ this.runAgentInfo.tools.filter((tool) => tool.inputSchema).map((tool) => [tool.name, tool.inputSchema])
6673
+ );
6674
+ this.cachedToolSchemas = new Map(
6675
+ [...documents].map(([name, schema]) => [name, schema.properties ?? {}])
6676
+ );
6677
+ toolInputSchemasByProperties.set(this.cachedToolSchemas, documents);
6678
+ }
6679
+ return info;
6680
+ }
6681
+ async getAgentInfoLive(options) {
6520
6682
  const { withResponseSizeLimit } = await import("../protocols/responseSizeLimit.mjs");
6521
6683
  throwIfAborted(options?.signal);
6522
6684
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
@@ -6750,7 +6912,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6750
6912
  this.synchronizeCapabilityEvidenceAuthorizationScope();
6751
6913
  const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
6752
6914
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
6753
- const usesScopedFetch = transport?.trustedFetchFn !== void 0;
6915
+ const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
6754
6916
  if (this.primedCapabilitiesExpiresAt !== void 0 && this.primedCapabilitiesExpiresAt <= Date.now()) {
6755
6917
  this.cachedCapabilities = void 0;
6756
6918
  this.cachedToolSchemas = void 0;
@@ -7029,10 +7191,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7029
7191
  }
7030
7192
  if (current === this.capabilityEvidenceAuthMaterial) return;
7031
7193
  this.capabilityEvidenceAuthMaterial = current;
7194
+ this.discoveryEpoch++;
7195
+ this.runAgentInfo = void 0;
7032
7196
  this.cachedCapabilities = void 0;
7033
7197
  this.cachedToolSchemas = void 0;
7034
7198
  this.primedCapabilitiesExpiresAt = void 0;
7035
7199
  this.capabilityEvidenceScopeKey = randomUUID();
7200
+ if (this.config._reuseConfiguredDiscovery?.()) {
7201
+ this.discoveredEndpoint = void 0;
7202
+ this.discoveredAgent = void 0;
7203
+ this.canonicalBaseUrl = void 0;
7204
+ this.discoveredMcpEra = void 0;
7205
+ }
7206
+ }
7207
+ /** A comply() run owns its configured fetch; per-call transport changes still discover separately. */
7208
+ usesScopedDiscoveryTransport(options) {
7209
+ const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
7210
+ if (!this.config._reuseConfiguredDiscovery?.()) return transport?.trustedFetchFn !== void 0;
7211
+ const configured = normalizeTransportOptions(this.config.transport);
7212
+ return transport?.trustedFetchFn !== configured?.trustedFetchFn || transport?.allowPrivateIp !== configured?.allowPrivateIp || transport?.maxResponseBytes !== configured?.maxResponseBytes || transport?.requestTimeoutMs !== configured?.requestTimeoutMs || transport?.legacyCompat?.enabled !== configured?.legacyCompat?.enabled;
7036
7213
  }
7037
7214
  /**
7038
7215
  * Reuse a fresh capability observation made by the embedding application.
@@ -7055,7 +7232,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7055
7232
  const hasValidToolSchemas = snapshot?.toolSchemas === void 0 || typeof snapshot.toolSchemas === "object" && snapshot.toolSchemas !== null && Object.values(snapshot.toolSchemas).every(
7056
7233
  (properties) => typeof properties === "object" && properties !== null && !Array.isArray(properties)
7057
7234
  );
7058
- const configuredScopedFetch = normalizeTransportOptions(this.config.transport)?.trustedFetchFn !== void 0;
7235
+ const configuredScopedFetch = this.usesScopedDiscoveryTransport();
7059
7236
  const hasToolEvidence = snapshot?.toolSchemas !== void 0 || Array.isArray(capabilities?.discoveredTools);
7060
7237
  if (!matchesScope || !isFresh || !hasCapabilities || !hasValidToolSchemas || !hasToolEvidence || configuredScopedFetch) {
7061
7238
  this.cachedCapabilities = void 0;
@@ -7098,11 +7275,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7098
7275
  /** Epoch of this client's evidence for the call's effective shared key; `undefined` without a shared cache. */
7099
7276
  discoveryEpochSnapshot(options) {
7100
7277
  const key = this.sharedDiscoveryKey(options);
7101
- if (!key || !this.config.discoveryCache) return void 0;
7278
+ if (!key || !this.config.discoveryCache) {
7279
+ return this.config._reuseConfiguredDiscovery?.() ? { local: this.discoveryEpoch, shared: 0, key: "" } : void 0;
7280
+ }
7102
7281
  return { local: this.discoveryEpoch, shared: this.sharedInvalidationEpoch(key), key };
7103
7282
  }
7104
7283
  discoveryEpochIs(epoch) {
7105
- return epoch.local === this.discoveryEpoch && epoch.shared === this.sharedInvalidationEpoch(epoch.key);
7284
+ return epoch.local === this.discoveryEpoch && (!epoch.key || epoch.shared === this.sharedInvalidationEpoch(epoch.key));
7106
7285
  }
7107
7286
  /** The latest invalidation that applies to `key`: its own, combined with the cache's floor of forgotten ones. */
7108
7287
  sharedInvalidationRecord(key) {
@@ -7411,6 +7590,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7411
7590
  * seller answers with a version or capability error.
7412
7591
  */
7413
7592
  async invalidateDiscoveryCache(options) {
7593
+ this.runAgentInfo = void 0;
7594
+ if (this.config._reuseConfiguredDiscovery?.()) this.canonicalBaseUrl = void 0;
7414
7595
  this.cachedCapabilities = void 0;
7415
7596
  this.cachedToolSchemas = void 0;
7416
7597
  this.primedCapabilitiesExpiresAt = void 0;
@@ -7958,7 +8139,29 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7958
8139
  * injected fields before the adapter gets a chance to clean them up, so
7959
8140
  * the two passes have to agree on "extra keys are fine."
7960
8141
  */
8142
+ usesIdentity33Schemas() {
8143
+ return this.config.experimentalIdentity33 === true && this.cachedCapabilities?._synthetic === false && isAdcpVersionAtLeast(this.cachedCapabilities.servedVersion, "3.3.0");
8144
+ }
8145
+ usesSigned33Webhooks() {
8146
+ const capabilities = this.cachedCapabilities;
8147
+ return this.config.experimentalIdentity33 === true && capabilities?._synthetic === false && isAdcpVersionAtLeast(capabilities.servedVersion, "3.3.0") && capabilities._raw?.webhook_signing?.supported === true;
8148
+ }
8149
+ selectedWebhookSigningProfile() {
8150
+ if (!this.usesSigned33Webhooks()) return void 0;
8151
+ const advertisement = this.cachedCapabilities?._raw?.webhook_signing;
8152
+ 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");
8153
+ if (profile === "web-bot-auth" && !advertisement?.profiles?.includes(profile))
8154
+ throw new ConfigurationError(
8155
+ "Seller did not advertise the selected Web Bot Auth webhook profile",
8156
+ "webhookSigningProfile"
8157
+ );
8158
+ return profile;
8159
+ }
7961
8160
  validateRequest(taskType, params) {
8161
+ if (this.config.experimentalIdentity33 && this.usesIdentity33Schemas()) {
8162
+ this.executor.validateRequest(taskType, params);
8163
+ return;
8164
+ }
7962
8165
  const schema = this.getRequestSchema(taskType);
7963
8166
  if (!schema) {
7964
8167
  return;
@@ -8075,6 +8278,7 @@ function normalizeRfc9421WebhookHeaders(headers) {
8075
8278
  const singletonHeaders = /* @__PURE__ */ new Set([
8076
8279
  "signature",
8077
8280
  "signature-input",
8281
+ "signature-agent",
8078
8282
  "content-digest",
8079
8283
  "content-type",
8080
8284
  "x-adcp-signature",
@@ -154,6 +154,10 @@ export declare class TaskExecutor {
154
154
  agentId?: string;
155
155
  /** Webhook secret for legacy HMAC authentication. */
156
156
  webhookSecret?: string;
157
+ experimentalIdentity33?: () => boolean;
158
+ signedIdentity33Webhooks?: () => boolean;
159
+ identity33SchemaExperiment?: boolean;
160
+ webhookSigningProfile?: () => 'adcp/webhook-signing/v1' | 'web-bot-auth' | undefined;
157
161
  /** Persist sanitized callback mode provenance before dispatch. */
158
162
  onWebhookRegistration?: (registration: {
159
163
  agent: AgentConfig;
@@ -161,6 +165,8 @@ export declare class TaskExecutor {
161
165
  operationId: string;
162
166
  callbackUrl: string;
163
167
  mode: 'rfc9421' | 'hmac-sha256';
168
+ signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
169
+ deliveryKind?: 'reporting' | 'artifact';
164
170
  delegatedOperatorAuthorization?: TaskOptions['delegatedOperatorAuthorization'];
165
171
  }) => void | Promise<void>;
166
172
  /** Persist fail-closed routing provenance before a durable mutation claim can run. */
@@ -154,6 +154,10 @@ export declare class TaskExecutor {
154
154
  agentId?: string;
155
155
  /** Webhook secret for legacy HMAC authentication. */
156
156
  webhookSecret?: string;
157
+ experimentalIdentity33?: () => boolean;
158
+ signedIdentity33Webhooks?: () => boolean;
159
+ identity33SchemaExperiment?: boolean;
160
+ webhookSigningProfile?: () => 'adcp/webhook-signing/v1' | 'web-bot-auth' | undefined;
157
161
  /** Persist sanitized callback mode provenance before dispatch. */
158
162
  onWebhookRegistration?: (registration: {
159
163
  agent: AgentConfig;
@@ -161,6 +165,8 @@ export declare class TaskExecutor {
161
165
  operationId: string;
162
166
  callbackUrl: string;
163
167
  mode: 'rfc9421' | 'hmac-sha256';
168
+ signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
169
+ deliveryKind?: 'reporting' | 'artifact';
164
170
  delegatedOperatorAuthorization?: TaskOptions['delegatedOperatorAuthorization'];
165
171
  }) => void | Promise<void>;
166
172
  /** Persist fail-closed routing provenance before a durable mutation claim can run. */