@adcp/sdk 15.9.1 → 16.0.0-beta.2

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 (321) 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 +25 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +25 -2
  13. package/dist/lib/core/SingleAgentClient.js +280 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +282 -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/generated-compat.d.mts +34 -0
  28. package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
  29. package/dist/lib/identity-3.3/generated-compat.js +16 -0
  30. package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
  31. package/dist/lib/identity-3.3/index.d.mts +10 -0
  32. package/dist/lib/identity-3.3/index.d.ts +10 -0
  33. package/dist/lib/identity-3.3/index.js +79 -0
  34. package/dist/lib/identity-3.3/index.mjs +50 -0
  35. package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
  36. package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
  37. package/dist/lib/identity-3.3/lifecycle.js +294 -0
  38. package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
  39. package/dist/lib/identity-3.3/revocation.d.mts +86 -0
  40. package/dist/lib/identity-3.3/revocation.d.ts +86 -0
  41. package/dist/lib/identity-3.3/revocation.js +308 -0
  42. package/dist/lib/identity-3.3/revocation.mjs +286 -0
  43. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  44. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  45. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  46. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  47. package/dist/lib/identity-3.3/server.d.mts +46 -0
  48. package/dist/lib/identity-3.3/server.d.ts +46 -0
  49. package/dist/lib/identity-3.3/server.js +279 -0
  50. package/dist/lib/identity-3.3/server.mjs +260 -0
  51. package/dist/lib/identity-3.3/store.d.mts +24 -0
  52. package/dist/lib/identity-3.3/store.d.ts +24 -0
  53. package/dist/lib/identity-3.3/store.js +191 -0
  54. package/dist/lib/identity-3.3/store.mjs +169 -0
  55. package/dist/lib/identity-3.3/trust.d.mts +155 -0
  56. package/dist/lib/identity-3.3/trust.d.ts +155 -0
  57. package/dist/lib/identity-3.3/trust.js +383 -0
  58. package/dist/lib/identity-3.3/trust.mjs +342 -0
  59. package/dist/lib/identity-3.3/types.d.mts +155 -0
  60. package/dist/lib/identity-3.3/types.d.ts +155 -0
  61. package/dist/lib/identity-3.3/types.js +16 -0
  62. package/dist/lib/identity-3.3/types.mjs +0 -0
  63. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  64. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  65. package/dist/lib/identity-3.3/validation.js +125 -0
  66. package/dist/lib/identity-3.3/validation.mjs +91 -0
  67. package/dist/lib/index.d.mts +1 -1
  68. package/dist/lib/index.d.ts +1 -1
  69. package/dist/lib/index.js +2 -0
  70. package/dist/lib/index.mjs +2 -0
  71. package/dist/lib/protocols/index.d.mts +1 -1
  72. package/dist/lib/protocols/index.d.ts +1 -1
  73. package/dist/lib/protocols/index.js +2 -2
  74. package/dist/lib/protocols/index.mjs +2 -2
  75. package/dist/lib/reporting/azure/index.d.mts +5 -0
  76. package/dist/lib/reporting/azure/index.d.ts +5 -0
  77. package/dist/lib/reporting/azure/index.js +26 -7
  78. package/dist/lib/reporting/azure/index.mjs +26 -7
  79. package/dist/lib/reporting/bigquery/index.d.mts +39 -5
  80. package/dist/lib/reporting/bigquery/index.d.ts +39 -5
  81. package/dist/lib/reporting/bigquery/index.js +26 -20
  82. package/dist/lib/reporting/bigquery/index.mjs +26 -20
  83. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  84. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  85. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  86. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  87. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  88. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  89. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  90. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  91. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  92. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  93. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  94. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  95. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  96. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  97. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  98. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  99. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  100. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  101. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  102. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  103. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  104. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  105. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  106. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  107. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  108. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  109. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  110. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  111. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  112. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  113. package/dist/lib/reporting/ledger/postgres.js +43 -27
  114. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  115. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  116. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  117. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  118. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  119. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  120. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  121. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  122. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  123. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  124. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  125. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  126. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  127. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  128. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  129. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  130. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  131. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  132. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  133. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  134. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  135. package/dist/lib/reporting/ledger/schedule.js +24 -0
  136. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  137. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  138. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  139. package/dist/lib/reporting/s3/index.d.mts +5 -0
  140. package/dist/lib/reporting/s3/index.d.ts +5 -0
  141. package/dist/lib/reporting/s3/index.js +37 -14
  142. package/dist/lib/reporting/s3/index.mjs +37 -14
  143. package/dist/lib/reporting/service/index.d.mts +10 -0
  144. package/dist/lib/reporting/service/index.d.ts +10 -0
  145. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  146. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  147. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  148. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  149. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  150. package/dist/lib/server/account-sync-contract.js +225 -0
  151. package/dist/lib/server/account-sync-contract.mjs +197 -0
  152. package/dist/lib/server/adcp-server.js +5 -0
  153. package/dist/lib/server/adcp-server.mjs +10 -0
  154. package/dist/lib/server/auth-signature.d.mts +15 -0
  155. package/dist/lib/server/auth-signature.d.ts +15 -0
  156. package/dist/lib/server/auth-signature.js +72 -2
  157. package/dist/lib/server/auth-signature.mjs +81 -2
  158. package/dist/lib/server/auth.d.mts +6 -0
  159. package/dist/lib/server/auth.d.ts +6 -0
  160. package/dist/lib/server/auth.js +6 -0
  161. package/dist/lib/server/auth.mjs +6 -0
  162. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  163. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  164. package/dist/lib/server/create-adcp-server.js +259 -19
  165. package/dist/lib/server/create-adcp-server.mjs +266 -10
  166. package/dist/lib/server/decisioning/account.d.mts +24 -1
  167. package/dist/lib/server/decisioning/account.d.ts +24 -1
  168. package/dist/lib/server/decisioning/index.d.mts +1 -1
  169. package/dist/lib/server/decisioning/index.d.ts +1 -1
  170. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  171. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  172. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  173. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  174. package/dist/lib/server/index.d.mts +2 -0
  175. package/dist/lib/server/index.d.ts +2 -0
  176. package/dist/lib/server/index.js +12 -0
  177. package/dist/lib/server/index.mjs +12 -0
  178. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  179. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  180. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  181. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  182. package/dist/lib/server/principal/types.d.mts +1 -1
  183. package/dist/lib/server/principal/types.d.ts +1 -1
  184. package/dist/lib/server/serve.js +5 -0
  185. package/dist/lib/server/serve.mjs +5 -0
  186. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  187. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  188. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  189. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  190. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  191. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  192. package/dist/lib/server/webhook-emitter.js +22 -0
  193. package/dist/lib/server/webhook-emitter.mjs +22 -0
  194. package/dist/lib/signing/agent-context.d.mts +0 -5
  195. package/dist/lib/signing/agent-context.d.ts +0 -5
  196. package/dist/lib/signing/agent-context.js +9 -1
  197. package/dist/lib/signing/agent-context.mjs +9 -1
  198. package/dist/lib/signing/agent-fetch.js +27 -2
  199. package/dist/lib/signing/agent-fetch.mjs +32 -2
  200. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  201. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  202. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  203. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  204. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  205. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  206. package/dist/lib/signing/agent-resolver/index.js +5 -0
  207. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  208. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  209. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  210. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  211. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  212. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  213. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  214. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  215. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  216. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  217. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  218. package/dist/lib/signing/brand-jwks.js +4 -4
  219. package/dist/lib/signing/brand-jwks.mjs +4 -4
  220. package/dist/lib/signing/client.d.mts +1 -0
  221. package/dist/lib/signing/client.d.ts +1 -0
  222. package/dist/lib/signing/client.js +5 -0
  223. package/dist/lib/signing/client.mjs +3 -0
  224. package/dist/lib/signing/crypto.js +8 -0
  225. package/dist/lib/signing/crypto.mjs +9 -1
  226. package/dist/lib/signing/fetch-async.js +1 -1
  227. package/dist/lib/signing/fetch-async.mjs +1 -1
  228. package/dist/lib/signing/fetch.js +1 -1
  229. package/dist/lib/signing/fetch.mjs +1 -1
  230. package/dist/lib/signing/jwks-https.d.mts +1 -1
  231. package/dist/lib/signing/jwks-https.d.ts +1 -1
  232. package/dist/lib/signing/jwks-https.js +1 -1
  233. package/dist/lib/signing/jwks-https.mjs +1 -1
  234. package/dist/lib/signing/jwks.d.mts +11 -3
  235. package/dist/lib/signing/jwks.d.ts +11 -3
  236. package/dist/lib/signing/jwks.js +1 -1
  237. package/dist/lib/signing/jwks.mjs +1 -1
  238. package/dist/lib/signing/middleware.js +9 -0
  239. package/dist/lib/signing/middleware.mjs +14 -0
  240. package/dist/lib/signing/parser.d.mts +9 -6
  241. package/dist/lib/signing/parser.d.ts +9 -6
  242. package/dist/lib/signing/parser.js +82 -64
  243. package/dist/lib/signing/parser.mjs +83 -65
  244. package/dist/lib/signing/revocation.d.mts +4 -1
  245. package/dist/lib/signing/revocation.d.ts +4 -1
  246. package/dist/lib/signing/revocation.js +36 -3
  247. package/dist/lib/signing/revocation.mjs +34 -2
  248. package/dist/lib/signing/server.d.mts +1 -1
  249. package/dist/lib/signing/server.d.ts +1 -1
  250. package/dist/lib/signing/server.js +4 -0
  251. package/dist/lib/signing/server.mjs +4 -0
  252. package/dist/lib/signing/types.d.mts +3 -0
  253. package/dist/lib/signing/types.d.ts +3 -0
  254. package/dist/lib/signing/verifier.js +1 -1
  255. package/dist/lib/signing/verifier.mjs +1 -1
  256. package/dist/lib/signing/web-bot-auth.d.mts +191 -0
  257. package/dist/lib/signing/web-bot-auth.d.ts +191 -0
  258. package/dist/lib/signing/web-bot-auth.js +837 -0
  259. package/dist/lib/signing/web-bot-auth.mjs +796 -0
  260. package/dist/lib/signing/webhook-verifier.js +1 -1
  261. package/dist/lib/signing/webhook-verifier.mjs +1 -1
  262. package/dist/lib/testing/client.d.mts +1 -4
  263. package/dist/lib/testing/client.d.ts +1 -4
  264. package/dist/lib/testing/client.js +141 -20
  265. package/dist/lib/testing/client.mjs +137 -19
  266. package/dist/lib/testing/compliance/comply.js +29 -10
  267. package/dist/lib/testing/compliance/comply.mjs +37 -11
  268. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  269. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  270. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  271. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  272. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  273. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  274. package/dist/lib/testing/storyboard/runner.js +23 -8
  275. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  276. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  277. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  278. package/dist/lib/types/adcp.d.mts +4 -0
  279. package/dist/lib/types/adcp.d.ts +4 -0
  280. package/dist/lib/types/schemas.generated.d.ts +6 -6
  281. package/dist/lib/utils/capabilities.d.mts +1 -0
  282. package/dist/lib/utils/capabilities.d.ts +1 -0
  283. package/dist/lib/utils/capabilities.js +5 -0
  284. package/dist/lib/utils/capabilities.mjs +5 -0
  285. package/dist/lib/v2/projection/catalog-snapshot.js +3 -1
  286. package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
  287. package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
  288. package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
  289. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  290. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  291. package/dist/lib/v2/projection/index.d.mts +1 -1
  292. package/dist/lib/v2/projection/index.d.ts +1 -1
  293. package/dist/lib/v2/projection/index.js +2 -0
  294. package/dist/lib/v2/projection/index.mjs +2 -0
  295. package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
  296. package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
  297. package/dist/lib/v2/projection/legacy-routes.js +35 -2
  298. package/dist/lib/v2/projection/legacy-routes.mjs +32 -2
  299. package/dist/lib/validation/schema-loader.d.mts +2 -0
  300. package/dist/lib/validation/schema-loader.d.ts +2 -0
  301. package/dist/lib/validation/schema-loader.js +43 -4
  302. package/dist/lib/validation/schema-loader.mjs +39 -3
  303. package/dist/lib/version.d.mts +3 -3
  304. package/dist/lib/version.d.ts +3 -3
  305. package/dist/lib/version.js +3 -3
  306. package/dist/lib/version.mjs +3 -3
  307. package/docs/TYPE-SUMMARY.md +2 -2
  308. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  309. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  310. package/docs/guides/REPORTING-LEDGER.md +99 -29
  311. package/docs/guides/REPORTING-OPERATIONS.md +29 -13
  312. package/docs/guides/REPORTING-STABILITY.md +76 -0
  313. package/docs/guides/account-resolution.md +101 -0
  314. package/docs/llms.txt +3 -2
  315. package/docs/migration-12-to-13.md +15 -0
  316. package/docs/migration-14.x-rc-worksheet.md +4 -4
  317. package/docs/migration-agent-identity-3.3.md +494 -0
  318. package/docs/migration-agent-resolution-3.3.md +5 -0
  319. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  320. package/examples/storyboards/account-sync-contract.yaml +57 -0
  321. package/package.json +17 -1
@@ -0,0 +1,342 @@
1
+ import Ajv from "ajv";
2
+ import addFormats from "ajv-formats";
3
+ import { ssrfSafeFetch } from "../net/index.mjs";
4
+ import { canonicalAgentOrigin } from "../signing/agent-resolver/canonicalize.mjs";
5
+ import { eTldPlusOne } from "../signing/agent-resolver/etld.mjs";
6
+ import { parseStrictJson } from "../signing/agent-resolver/strict-json.mjs";
7
+ import { parse as parseDomain } from "tldts";
8
+ import schemas from "./schemas.draft.mjs";
9
+ const ajv = new Ajv({ strict: false, allErrors: false });
10
+ addFormats(ajv);
11
+ for (const schema of schemas) ajv.addSchema(schema);
12
+ function validateIdentity33Schema(id, value) {
13
+ return ajv.getSchema(`/schemas/${id}.json`)?.(value) === true;
14
+ }
15
+ class IdentityAuthorizationError extends Error {
16
+ code = "PERMISSION_DENIED";
17
+ details;
18
+ constructor(reason = "authorization_failed") {
19
+ super(reason === "grant_absent" ? "Agent authority is not granted" : "Agent authorization failed");
20
+ this.name = "IdentityAuthorizationError";
21
+ this.details = reason === "grant_absent" ? { scope: "agent", reason } : void 0;
22
+ }
23
+ }
24
+ class TrustRecordUnavailableError extends IdentityAuthorizationError {
25
+ transient = true;
26
+ /**
27
+ * Set by `match()`: the last record read for this operator listed the origin
28
+ * with the role and is still within the seller's outage bound
29
+ * (`maxOutageContinuationSeconds` past its freshness). Only then may non-spend
30
+ * calls continue under a binding.
31
+ */
32
+ lastKnownListed = false;
33
+ constructor() {
34
+ super();
35
+ this.name = "TrustRecordUnavailableError";
36
+ this.message = "Agent trust record is temporarily unavailable";
37
+ }
38
+ }
39
+ class TrustMembershipError extends IdentityAuthorizationError {
40
+ constructor(membership = "unlisted") {
41
+ super();
42
+ this.membership = membership;
43
+ this.name = "TrustMembershipError";
44
+ }
45
+ membership;
46
+ }
47
+ function unavailable(cause) {
48
+ const error = new TrustRecordUnavailableError();
49
+ if (cause !== void 0) Object.defineProperty(error, "cause", { value: cause });
50
+ throw error;
51
+ }
52
+ class TrustHostCapacityError extends Error {
53
+ }
54
+ const FOREIGN_HOST_BUDGET = "\0foreign";
55
+ const OWN_HOST_REQUESTS_PER_MINUTE = 10;
56
+ const FOREIGN_HOST_REQUESTS_PER_MINUTE = 30;
57
+ function failure(cause) {
58
+ const error = new IdentityAuthorizationError();
59
+ if (cause !== void 0) Object.defineProperty(error, "cause", { value: cause });
60
+ throw error;
61
+ }
62
+ function validateTrustRecord(value) {
63
+ if (!validateIdentity33Schema("trust/v1/trust", value)) failure();
64
+ const record = value;
65
+ const origins = /* @__PURE__ */ new Set();
66
+ for (const agent of record.agents ?? []) {
67
+ if (agent.jwks_uri !== void 0) failure();
68
+ const origin = canonicalAgentOrigin(agent.url);
69
+ if (origins.has(origin)) failure();
70
+ origins.add(origin);
71
+ }
72
+ }
73
+ function createTrustRecord(record) {
74
+ validateTrustRecord(record);
75
+ return structuredClone(record);
76
+ }
77
+ class TrustEvaluator {
78
+ constructor(options = {}) {
79
+ this.options = options;
80
+ this.pollingIntervalSeconds = options.pollingIntervalSeconds ?? 300;
81
+ this.maxOutageContinuationSeconds = options.maxOutageContinuationSeconds ?? 4 * this.pollingIntervalSeconds;
82
+ if (!Number.isFinite(this.maxOutageContinuationSeconds) || this.maxOutageContinuationSeconds < 0)
83
+ throw new TypeError("maxOutageContinuationSeconds must be a finite, non-negative number");
84
+ if (!Number.isFinite(this.pollingIntervalSeconds) || this.pollingIntervalSeconds < 60 || this.pollingIntervalSeconds > 1800)
85
+ throw new TypeError("Trust polling interval must be 60\u20131800 seconds");
86
+ }
87
+ options;
88
+ cache = /* @__PURE__ */ new Map();
89
+ negative = /* @__PURE__ */ new Map();
90
+ pending = /* @__PURE__ */ new Map();
91
+ urlRequests = /* @__PURE__ */ new Map();
92
+ /** Keyed by (operator, host): one operator's authoritative_location hops never spend another's budget. */
93
+ hostRates = /* @__PURE__ */ new Map();
94
+ authoritativeOperators = /* @__PURE__ */ new Set();
95
+ /** Remembered authoritative operators per budget group (see authorityGroup). */
96
+ authorityGroups = /* @__PURE__ */ new Map();
97
+ privateAuthorityOperators = 0;
98
+ pollingIntervalSeconds;
99
+ maxOutageContinuationSeconds;
100
+ async get(domainOrOrigin, force = false) {
101
+ let operator;
102
+ try {
103
+ operator = eTldPlusOne(domainOrOrigin);
104
+ } catch {
105
+ return failure();
106
+ }
107
+ const now = this.now();
108
+ const cached = this.cache.get(operator);
109
+ if (!force && cached && cached.freshUntil > now) return cached;
110
+ if ((this.negative.get(operator) ?? 0) > now) unavailable();
111
+ let pending = this.pending.get(operator);
112
+ if (!pending) {
113
+ if (this.pending.size >= (this.options.maxConcurrentFetches ?? 16)) unavailable();
114
+ pending = this.fetch(operator, now);
115
+ this.pending.set(operator, pending);
116
+ }
117
+ try {
118
+ return await pending;
119
+ } finally {
120
+ if (this.pending.get(operator) === pending) this.pending.delete(operator);
121
+ }
122
+ }
123
+ async match(origin, role, countries) {
124
+ const canonical = canonicalAgentOrigin(origin);
125
+ let result;
126
+ try {
127
+ result = await this.get(canonical);
128
+ } catch (error) {
129
+ if (!(error instanceof TrustRecordUnavailableError)) throw error;
130
+ const last = this.cache.get(eTldPlusOne(canonical));
131
+ if (last && !listedAgent(last, canonical, role))
132
+ throw new TrustMembershipError(last.status === "present" ? "unlisted" : "absent");
133
+ error.lastKnownListed = !!last && this.now() <= last.freshUntil + this.maxOutageContinuationSeconds;
134
+ throw error;
135
+ }
136
+ const agent = listedAgent(result, canonical, role);
137
+ if (result.status !== "present") throw new TrustMembershipError("absent");
138
+ if (!agent) throw new TrustMembershipError();
139
+ if (agent.countries && countries?.length && countries.some((country) => !agent.countries.includes(country)))
140
+ failure();
141
+ return { operator: result.operator, agent, record: result.record, freshUntil: result.freshUntil };
142
+ }
143
+ invalidate(domain) {
144
+ this.cache.delete(eTldPlusOne(domain));
145
+ }
146
+ /**
147
+ * Record that `operator` served a trust record. With durable history the
148
+ * in-memory set is only a cache and may evict; without it, nothing is
149
+ * evicted and an operator over its group budget or the total is refused.
150
+ */
151
+ rememberAuthority(operator, durable) {
152
+ if (this.authoritativeOperators.has(operator)) return true;
153
+ const max = this.options.maxEntries ?? 1e3;
154
+ if (durable) {
155
+ if (this.authoritativeOperators.size >= max)
156
+ this.authoritativeOperators.delete(this.authoritativeOperators.values().next().value);
157
+ this.authoritativeOperators.add(operator);
158
+ return true;
159
+ }
160
+ const group = authorityGroup(operator);
161
+ const hosted = group !== operator;
162
+ if (this.authoritativeOperators.size >= max || hosted && (this.privateAuthorityOperators >= (this.options.maxPrivateAuthoritativeOperators ?? Math.floor(max / 2)) || (this.authorityGroups.get(group) ?? 0) >= (this.options.maxAuthoritativeOperatorsPerPrivateSuffix ?? 32)))
163
+ return false;
164
+ this.authoritativeOperators.add(operator);
165
+ if (hosted) {
166
+ this.privateAuthorityOperators++;
167
+ this.authorityGroups.set(group, (this.authorityGroups.get(group) ?? 0) + 1);
168
+ }
169
+ return true;
170
+ }
171
+ /**
172
+ * Process-local view only. With durable `authorityHistory` this set is a
173
+ * cache and may have evicted an operator that durable history still records.
174
+ */
175
+ hasAuthoritativeRecord(domain) {
176
+ return this.authoritativeOperators.has(eTldPlusOne(domain));
177
+ }
178
+ now() {
179
+ return (this.options.now ?? (() => Date.now() / 1e3))();
180
+ }
181
+ async request(url, operator) {
182
+ const parsed = new URL(url);
183
+ if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.hash) failure();
184
+ let own = false;
185
+ try {
186
+ own = eTldPlusOne(parsed.hostname) === operator;
187
+ } catch {
188
+ }
189
+ const host = JSON.stringify([own ? operator : FOREIGN_HOST_BUDGET, parsed.hostname]);
190
+ const limit = own ? OWN_HOST_REQUESTS_PER_MINUTE : FOREIGN_HOST_REQUESTS_PER_MINUTE;
191
+ const pending = this.urlRequests.get(url);
192
+ if (pending) return pending;
193
+ const now = this.now(), rate = this.hostRates.get(host);
194
+ if (rate && now - rate.started < 60 && rate.count >= limit) throw new TrustHostCapacityError();
195
+ if (!rate && this.hostRates.size >= (this.options.maxEntries ?? 1e3))
196
+ this.hostRates.delete(this.hostRates.keys().next().value);
197
+ this.hostRates.set(
198
+ host,
199
+ rate && now - rate.started < 60 ? { ...rate, count: rate.count + 1 } : { started: now, count: 1 }
200
+ );
201
+ const request = ssrfSafeFetch(url, {
202
+ ...this.options.fetchOptions,
203
+ maxBodyBytes: 2 * 1024 * 1024,
204
+ timeoutMs: 1e4,
205
+ headers: { accept: "application/json" }
206
+ });
207
+ this.urlRequests.set(url, request);
208
+ try {
209
+ return await request;
210
+ } finally {
211
+ if (this.urlRequests.get(url) === request) this.urlRequests.delete(url);
212
+ }
213
+ }
214
+ async fetch(operator, now) {
215
+ try {
216
+ let response = await this.request(`https://${operator}/.well-known/trust.json`, operator);
217
+ let result;
218
+ if (response.status === 404 || response.status === 410) {
219
+ if (this.authoritativeOperators.has(operator) || await this.options.authorityHistory?.has(operator))
220
+ failure();
221
+ result = { status: "absent", operator, checkedAt: now, freshUntil: now + 60 };
222
+ } else {
223
+ if (response.status !== 200) failure();
224
+ if (this.options.authorityHistory) {
225
+ await this.options.authorityHistory.mark(operator);
226
+ this.rememberAuthority(operator, true);
227
+ } else if (!this.rememberAuthority(operator, false)) {
228
+ failure();
229
+ }
230
+ let record = parseStrictJson(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
231
+ validateTrustRecord(record);
232
+ if (record.authoritative_location) {
233
+ response = await this.request(record.authoritative_location, operator);
234
+ if (response.status !== 200) failure();
235
+ record = parseStrictJson(new TextDecoder("utf-8", { fatal: true }).decode(response.body), 32);
236
+ validateTrustRecord(record);
237
+ if (record.authoritative_location) failure();
238
+ }
239
+ result = {
240
+ status: "present",
241
+ operator,
242
+ record,
243
+ checkedAt: now,
244
+ freshUntil: now + this.pollingIntervalSeconds
245
+ };
246
+ }
247
+ const max = this.options.maxEntries ?? 1e3;
248
+ if (this.cache.size >= max && !this.cache.has(operator)) this.cache.delete(this.cache.keys().next().value);
249
+ this.cache.set(operator, result);
250
+ this.negative.delete(operator);
251
+ return result;
252
+ } catch (cause) {
253
+ if (cause instanceof TrustHostCapacityError) return unavailable(cause);
254
+ if (this.negative.size >= (this.options.maxEntries ?? 1e3))
255
+ this.negative.delete(this.negative.keys().next().value);
256
+ this.negative.set(operator, now + 60);
257
+ return unavailable(cause);
258
+ }
259
+ }
260
+ }
261
+ function listedAgent(result, origin, role) {
262
+ if (result.status !== "present") return void 0;
263
+ const entries = (result.record.agents ?? []).filter((agent) => canonicalAgentOrigin(agent.url) === origin);
264
+ return entries.length === 1 && entries[0].roles.includes(role) ? entries[0] : void 0;
265
+ }
266
+ function authorityGroup(operator) {
267
+ if (!parseDomain(operator, { allowPrivateDomains: true }).isPrivate) return operator;
268
+ const provider = parseDomain(operator).domain;
269
+ return `private:${provider ?? operator}`;
270
+ }
271
+ function grantMatches(grant, target, claim, now) {
272
+ if (eTldPlusOne(grant.grantee) !== target) return false;
273
+ if (!grant.scopes.some(
274
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
275
+ ))
276
+ return false;
277
+ if (grant.agents && !grant.agents.some((agent) => canonicalAgentOrigin(agent.url) === canonicalAgentOrigin(claim.signerOrigin)))
278
+ return false;
279
+ const brands = grant.profiles?.adcp?.brands;
280
+ if (brands && !brands.includes("*") && (!claim.brand.brand_id || !brands.includes(claim.brand.brand_id)))
281
+ return false;
282
+ if (grant.countries && (!claim.brand.countries?.length || claim.brand.countries.some((country) => !grant.countries.includes(country))))
283
+ return false;
284
+ if (grant.valid_from && Date.parse(grant.valid_from) / 1e3 > now) return false;
285
+ if (grant.valid_until && Date.parse(grant.valid_until) / 1e3 <= now) return false;
286
+ return true;
287
+ }
288
+ async function authorizeDemandGrant(claim, options) {
289
+ const now = (options.now ?? (() => Date.now() / 1e3))();
290
+ const signer = await options.evaluator.match(claim.signerOrigin, "adcp:buying", claim.brand.countries);
291
+ if (signer.agent.countries && !claim.brand.countries?.length) failure();
292
+ const brand = eTldPlusOne(claim.brand.domain), account = eTldPlusOne(claim.accountOperator), operator = signer.operator;
293
+ const result = (source, chain, grants = []) => ({
294
+ source,
295
+ chain,
296
+ operator,
297
+ checkedAt: now,
298
+ ...grants.some((g) => g.valid_until) ? { expiresAt: Math.min(...grants.map((g) => g.valid_until ? Date.parse(g.valid_until) / 1e3 : Infinity)) } : {}
299
+ });
300
+ if (brand === operator && account === operator) return result("implicit", [brand]);
301
+ if (brand === operator && account !== operator) throw new IdentityAuthorizationError("grant_absent");
302
+ const house = await options.resolveBrandHouse?.(claim.brand);
303
+ const authoritativeBrand = house ? eTldPlusOne(house.domain) : brand;
304
+ const grantClaim = house ? { ...claim, brand: { ...claim.brand, brand_id: house.brand_id } } : claim;
305
+ const record = await options.evaluator.get(authoritativeBrand);
306
+ if (record.status === "absent") {
307
+ if (await options.legacyAuthorization?.(claim)) return result("legacy", [brand, account, operator]);
308
+ throw new IdentityAuthorizationError("grant_absent");
309
+ }
310
+ const first = (record.record.grants ?? []).filter((g) => grantMatches(g, account, grantClaim, now));
311
+ if (account === operator && first.length) return result("trust", [brand, operator], [first[0]]);
312
+ const selfOperated = account === brand || account === authoritativeBrand;
313
+ if (selfOperated && account !== operator) {
314
+ const direct = (record.record.grants ?? []).find((g) => grantMatches(g, operator, grantClaim, now));
315
+ if (direct) return result("trust", [brand, operator], [direct]);
316
+ }
317
+ if (account !== operator && account !== brand && first.length) {
318
+ const intermediary = await options.evaluator.get(account);
319
+ if (intermediary.status === "present") {
320
+ const second = (intermediary.record.grants ?? []).find((g) => grantMatches(g, operator, grantClaim, now));
321
+ if (second) return result("trust", [brand, account, operator], [first[0], second]);
322
+ }
323
+ }
324
+ const covered = (record.record.grants ?? []).some(
325
+ (g) => (eTldPlusOne(g.grantee) === account || selfOperated && eTldPlusOne(g.grantee) === operator) && g.scopes.some(
326
+ (scope) => scope === "*" || scope === claim.scope || scope === "adcp:all" && claim.scope.startsWith("adcp:")
327
+ )
328
+ );
329
+ if (!covered && !record.record.exclusive_grants && await options.sellerAuthorization?.(claim))
330
+ return result("seller", [brand, account, operator]);
331
+ throw new IdentityAuthorizationError("grant_absent");
332
+ }
333
+ export {
334
+ IdentityAuthorizationError,
335
+ TrustEvaluator,
336
+ TrustMembershipError,
337
+ TrustRecordUnavailableError,
338
+ authorizeDemandGrant,
339
+ createTrustRecord,
340
+ validateIdentity33Schema,
341
+ validateTrustRecord
342
+ };
@@ -0,0 +1,155 @@
1
+ /** Experimental drafts; the released SDK wire/schema pin remains 3.2.4. */
2
+ import type { GeneratedAccountCapabilities, ResolveAgentOnboarding } from './generated-compat.mjs';
3
+ export type BillingParty = 'operator' | 'agent' | 'advertiser';
4
+ type DraftAgentOnboardingRequirementKind = 'agent_identity' | 'grant' | 'billing_entity' | 'contract' | 'credit_application' | 'aao_verified' | 'storyboard' | 'sandbox' | 'experimental_feature';
5
+ interface DraftAgentOnboardingRequirement {
6
+ kind: DraftAgentOnboardingRequirementKind;
7
+ role?: string;
8
+ verification_modes?: string[];
9
+ specialisms?: string[];
10
+ adcp_version?: string;
11
+ id?: string;
12
+ ext?: Record<string, unknown>;
13
+ }
14
+ interface DraftAgentOnboardingTier {
15
+ mode: 'open' | 'application' | 'invite_only';
16
+ url?: string;
17
+ requirements?: DraftAgentOnboardingRequirement[];
18
+ ext?: Record<string, unknown>;
19
+ }
20
+ interface DraftAgentOnboarding {
21
+ sandbox?: DraftAgentOnboardingTier;
22
+ billing?: Partial<Record<BillingParty, DraftAgentOnboardingTier>>;
23
+ url?: string;
24
+ documentation_url?: string;
25
+ message?: string;
26
+ ext?: Record<string, unknown>;
27
+ }
28
+ /** `get_adcp_capabilities.account.agent_onboarding`: how a seller onboards buyer agents. */
29
+ export type AgentOnboarding = ResolveAgentOnboarding<GeneratedAccountCapabilities, DraftAgentOnboarding>;
30
+ type AgentOnboardingBilling = NonNullable<AgentOnboarding['billing']>;
31
+ /** The onboarding mode for sandbox access or for one billing party. */
32
+ export type AgentOnboardingTier = NonNullable<AgentOnboarding['sandbox']> | NonNullable<AgentOnboardingBilling[keyof AgentOnboardingBilling]>;
33
+ export type AgentOnboardingMode = AgentOnboardingTier['mode'];
34
+ /** One requirement an onboarding mode imposes, discriminated by `kind`. */
35
+ export type AgentOnboardingRequirement = NonNullable<AgentOnboardingTier['requirements']>[number];
36
+ export type AgentOnboardingRequirementKind = AgentOnboardingRequirement['kind'];
37
+ /**
38
+ * A requirement as an evaluator sees it. `kind` accepts any string because a
39
+ * counterparty on a newer revision may publish kinds this SDK does not know,
40
+ * and readers MUST treat those as unsatisfiable rather than reject the
41
+ * posture. Structural on purpose: every {@link AgentOnboardingRequirement} is
42
+ * assignable to it, whichever shape the pinned schemas give that type.
43
+ * `verified_specialisms` is the revised #8170 name for `specialisms`.
44
+ */
45
+ export interface ObservedAgentOnboardingRequirement {
46
+ kind: AgentOnboardingRequirementKind | (string & {});
47
+ role?: string;
48
+ verification_modes?: readonly string[];
49
+ specialisms?: readonly string[];
50
+ verified_specialisms?: readonly string[];
51
+ adcp_version?: string;
52
+ id?: string;
53
+ ext?: Record<string, unknown>;
54
+ }
55
+ export interface BuyerOnboardingPosture {
56
+ mode: 'considers_unsolicited' | 'application' | 'invite_only';
57
+ requirements?: ObservedAgentOnboardingRequirement[];
58
+ url?: string;
59
+ documentation_url?: string;
60
+ message?: string;
61
+ ext?: Record<string, unknown>;
62
+ }
63
+ export interface PrincipalRelationship {
64
+ status: 'pending' | 'active' | 'suspended' | 'blocked';
65
+ expires_at?: string;
66
+ setup?: {
67
+ message: string;
68
+ url?: string;
69
+ expires_at?: string;
70
+ [key: string]: unknown;
71
+ };
72
+ ext?: Record<string, unknown>;
73
+ }
74
+ export type IdentityPrincipalChangedReason = 'relationship_changed' | 'relationship_expiring';
75
+ export interface TrustAgent {
76
+ url: string;
77
+ roles: string[];
78
+ id?: string;
79
+ protocols?: string[];
80
+ countries?: string[];
81
+ profiles?: {
82
+ adcp?: {
83
+ onboarding?: BuyerOnboardingPosture;
84
+ [key: string]: unknown;
85
+ };
86
+ [key: string]: unknown;
87
+ };
88
+ [key: string]: unknown;
89
+ }
90
+ export interface TrustGrant {
91
+ grantee: string;
92
+ scopes: string[];
93
+ agents?: {
94
+ url: string;
95
+ }[];
96
+ countries?: string[];
97
+ valid_from?: string;
98
+ valid_until?: string;
99
+ profiles?: {
100
+ adcp?: {
101
+ brands?: string[];
102
+ [key: string]: unknown;
103
+ };
104
+ [key: string]: unknown;
105
+ };
106
+ [key: string]: unknown;
107
+ }
108
+ export interface TrustRecord {
109
+ agents?: TrustAgent[];
110
+ grants?: TrustGrant[];
111
+ acknowledgements?: unknown[];
112
+ exclusive_grants?: boolean;
113
+ authoritative_location?: string;
114
+ profiles?: {
115
+ adcp?: {
116
+ onboarding?: BuyerOnboardingPosture;
117
+ [key: string]: unknown;
118
+ };
119
+ [key: string]: unknown;
120
+ };
121
+ [key: string]: unknown;
122
+ }
123
+ export type RevocationReason = 'unspecified' | 'keyCompromise' | 'cACompromise' | 'affiliationChanged' | 'superseded' | 'cessationOfOperation' | 'certificateHold' | 'removeFromCRL' | 'privilegeWithdrawn' | 'aACompromise';
124
+ export interface RevocationDetail {
125
+ reason?: RevocationReason;
126
+ invalidity_date?: string;
127
+ }
128
+ export interface AgentGrantDeniedDetails {
129
+ scope: 'agent';
130
+ reason: 'grant_absent';
131
+ }
132
+ export interface Identity33Capabilities {
133
+ request_signing?: {
134
+ profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
135
+ wba_draft_revision?: string;
136
+ };
137
+ webhook_signing?: {
138
+ supported: boolean;
139
+ profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
140
+ wba_draft_revision?: string;
141
+ };
142
+ account?: {
143
+ agent_onboarding?: AgentOnboarding;
144
+ };
145
+ }
146
+ export type Identity33GetPrincipalResponse = Omit<import('../types/tools.generated.mjs').GetPrincipalResponse, 'result'> & {
147
+ result: (Exclude<import('../types/tools.generated.mjs').GetPrincipalResponse['result'], {
148
+ kind: 'failed';
149
+ }> & {
150
+ relationship?: PrincipalRelationship;
151
+ }) | Extract<import('../types/tools.generated.mjs').GetPrincipalResponse['result'], {
152
+ kind: 'failed';
153
+ }>;
154
+ };
155
+ export {};
@@ -0,0 +1,155 @@
1
+ /** Experimental drafts; the released SDK wire/schema pin remains 3.2.4. */
2
+ import type { GeneratedAccountCapabilities, ResolveAgentOnboarding } from './generated-compat';
3
+ export type BillingParty = 'operator' | 'agent' | 'advertiser';
4
+ type DraftAgentOnboardingRequirementKind = 'agent_identity' | 'grant' | 'billing_entity' | 'contract' | 'credit_application' | 'aao_verified' | 'storyboard' | 'sandbox' | 'experimental_feature';
5
+ interface DraftAgentOnboardingRequirement {
6
+ kind: DraftAgentOnboardingRequirementKind;
7
+ role?: string;
8
+ verification_modes?: string[];
9
+ specialisms?: string[];
10
+ adcp_version?: string;
11
+ id?: string;
12
+ ext?: Record<string, unknown>;
13
+ }
14
+ interface DraftAgentOnboardingTier {
15
+ mode: 'open' | 'application' | 'invite_only';
16
+ url?: string;
17
+ requirements?: DraftAgentOnboardingRequirement[];
18
+ ext?: Record<string, unknown>;
19
+ }
20
+ interface DraftAgentOnboarding {
21
+ sandbox?: DraftAgentOnboardingTier;
22
+ billing?: Partial<Record<BillingParty, DraftAgentOnboardingTier>>;
23
+ url?: string;
24
+ documentation_url?: string;
25
+ message?: string;
26
+ ext?: Record<string, unknown>;
27
+ }
28
+ /** `get_adcp_capabilities.account.agent_onboarding`: how a seller onboards buyer agents. */
29
+ export type AgentOnboarding = ResolveAgentOnboarding<GeneratedAccountCapabilities, DraftAgentOnboarding>;
30
+ type AgentOnboardingBilling = NonNullable<AgentOnboarding['billing']>;
31
+ /** The onboarding mode for sandbox access or for one billing party. */
32
+ export type AgentOnboardingTier = NonNullable<AgentOnboarding['sandbox']> | NonNullable<AgentOnboardingBilling[keyof AgentOnboardingBilling]>;
33
+ export type AgentOnboardingMode = AgentOnboardingTier['mode'];
34
+ /** One requirement an onboarding mode imposes, discriminated by `kind`. */
35
+ export type AgentOnboardingRequirement = NonNullable<AgentOnboardingTier['requirements']>[number];
36
+ export type AgentOnboardingRequirementKind = AgentOnboardingRequirement['kind'];
37
+ /**
38
+ * A requirement as an evaluator sees it. `kind` accepts any string because a
39
+ * counterparty on a newer revision may publish kinds this SDK does not know,
40
+ * and readers MUST treat those as unsatisfiable rather than reject the
41
+ * posture. Structural on purpose: every {@link AgentOnboardingRequirement} is
42
+ * assignable to it, whichever shape the pinned schemas give that type.
43
+ * `verified_specialisms` is the revised #8170 name for `specialisms`.
44
+ */
45
+ export interface ObservedAgentOnboardingRequirement {
46
+ kind: AgentOnboardingRequirementKind | (string & {});
47
+ role?: string;
48
+ verification_modes?: readonly string[];
49
+ specialisms?: readonly string[];
50
+ verified_specialisms?: readonly string[];
51
+ adcp_version?: string;
52
+ id?: string;
53
+ ext?: Record<string, unknown>;
54
+ }
55
+ export interface BuyerOnboardingPosture {
56
+ mode: 'considers_unsolicited' | 'application' | 'invite_only';
57
+ requirements?: ObservedAgentOnboardingRequirement[];
58
+ url?: string;
59
+ documentation_url?: string;
60
+ message?: string;
61
+ ext?: Record<string, unknown>;
62
+ }
63
+ export interface PrincipalRelationship {
64
+ status: 'pending' | 'active' | 'suspended' | 'blocked';
65
+ expires_at?: string;
66
+ setup?: {
67
+ message: string;
68
+ url?: string;
69
+ expires_at?: string;
70
+ [key: string]: unknown;
71
+ };
72
+ ext?: Record<string, unknown>;
73
+ }
74
+ export type IdentityPrincipalChangedReason = 'relationship_changed' | 'relationship_expiring';
75
+ export interface TrustAgent {
76
+ url: string;
77
+ roles: string[];
78
+ id?: string;
79
+ protocols?: string[];
80
+ countries?: string[];
81
+ profiles?: {
82
+ adcp?: {
83
+ onboarding?: BuyerOnboardingPosture;
84
+ [key: string]: unknown;
85
+ };
86
+ [key: string]: unknown;
87
+ };
88
+ [key: string]: unknown;
89
+ }
90
+ export interface TrustGrant {
91
+ grantee: string;
92
+ scopes: string[];
93
+ agents?: {
94
+ url: string;
95
+ }[];
96
+ countries?: string[];
97
+ valid_from?: string;
98
+ valid_until?: string;
99
+ profiles?: {
100
+ adcp?: {
101
+ brands?: string[];
102
+ [key: string]: unknown;
103
+ };
104
+ [key: string]: unknown;
105
+ };
106
+ [key: string]: unknown;
107
+ }
108
+ export interface TrustRecord {
109
+ agents?: TrustAgent[];
110
+ grants?: TrustGrant[];
111
+ acknowledgements?: unknown[];
112
+ exclusive_grants?: boolean;
113
+ authoritative_location?: string;
114
+ profiles?: {
115
+ adcp?: {
116
+ onboarding?: BuyerOnboardingPosture;
117
+ [key: string]: unknown;
118
+ };
119
+ [key: string]: unknown;
120
+ };
121
+ [key: string]: unknown;
122
+ }
123
+ export type RevocationReason = 'unspecified' | 'keyCompromise' | 'cACompromise' | 'affiliationChanged' | 'superseded' | 'cessationOfOperation' | 'certificateHold' | 'removeFromCRL' | 'privilegeWithdrawn' | 'aACompromise';
124
+ export interface RevocationDetail {
125
+ reason?: RevocationReason;
126
+ invalidity_date?: string;
127
+ }
128
+ export interface AgentGrantDeniedDetails {
129
+ scope: 'agent';
130
+ reason: 'grant_absent';
131
+ }
132
+ export interface Identity33Capabilities {
133
+ request_signing?: {
134
+ profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
135
+ wba_draft_revision?: string;
136
+ };
137
+ webhook_signing?: {
138
+ supported: boolean;
139
+ profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
140
+ wba_draft_revision?: string;
141
+ };
142
+ account?: {
143
+ agent_onboarding?: AgentOnboarding;
144
+ };
145
+ }
146
+ export type Identity33GetPrincipalResponse = Omit<import('../types/tools.generated').GetPrincipalResponse, 'result'> & {
147
+ result: (Exclude<import('../types/tools.generated').GetPrincipalResponse['result'], {
148
+ kind: 'failed';
149
+ }> & {
150
+ relationship?: PrincipalRelationship;
151
+ }) | Extract<import('../types/tools.generated').GetPrincipalResponse['result'], {
152
+ kind: 'failed';
153
+ }>;
154
+ };
155
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
File without changes
@@ -0,0 +1,2 @@
1
+ import type { ValidationOutcome } from '../validation/schema-validator.mjs';
2
+ export declare function validateIdentity33Payload(tool: string, direction: 'request' | 'response', payload: unknown, version?: string): ValidationOutcome;
@@ -0,0 +1,2 @@
1
+ import type { ValidationOutcome } from '../validation/schema-validator';
2
+ export declare function validateIdentity33Payload(tool: string, direction: 'request' | 'response', payload: unknown, version?: string): ValidationOutcome;