@adcp/sdk 12.0.0 → 12.0.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 (942) hide show
  1. package/dist/lib/adapters/content-standards-adapter.mjs +0 -6
  2. package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
  3. package/dist/lib/adapters/derived-account-store.mjs +0 -6
  4. package/dist/lib/adapters/derived-account-store.mjs.map +1 -1
  5. package/dist/lib/adapters/governance-adapter.mjs +0 -6
  6. package/dist/lib/adapters/governance-adapter.mjs.map +1 -1
  7. package/dist/lib/adapters/implicit-account-store.mjs +0 -6
  8. package/dist/lib/adapters/implicit-account-store.mjs.map +1 -1
  9. package/dist/lib/adapters/index.mjs +0 -6
  10. package/dist/lib/adapters/index.mjs.map +1 -1
  11. package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs +0 -6
  12. package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs.map +1 -1
  13. package/dist/lib/adapters/legacy/v2-5/get_products.mjs +0 -6
  14. package/dist/lib/adapters/legacy/v2-5/get_products.mjs.map +1 -1
  15. package/dist/lib/adapters/legacy/v2-5/index.mjs +0 -6
  16. package/dist/lib/adapters/legacy/v2-5/index.mjs.map +1 -1
  17. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs +0 -6
  18. package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs.map +1 -1
  19. package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs +0 -6
  20. package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs.map +1 -1
  21. package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs +0 -6
  22. package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs.map +1 -1
  23. package/dist/lib/adapters/legacy/v2-5/types.mjs +0 -6
  24. package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs +0 -6
  25. package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs.map +1 -1
  26. package/dist/lib/adapters/oauth-passthrough-resolver.mjs +0 -6
  27. package/dist/lib/adapters/oauth-passthrough-resolver.mjs.map +1 -1
  28. package/dist/lib/adapters/property-list-adapter.mjs +0 -6
  29. package/dist/lib/adapters/property-list-adapter.mjs.map +1 -1
  30. package/dist/lib/adapters/roster-account-store.mjs +0 -6
  31. package/dist/lib/adapters/roster-account-store.mjs.map +1 -1
  32. package/dist/lib/adapters/si-session-manager.mjs +0 -6
  33. package/dist/lib/adapters/si-session-manager.mjs.map +1 -1
  34. package/dist/lib/adapters/version/3.0/brand-fields.mjs +0 -6
  35. package/dist/lib/adapters/version/3.0/brand-fields.mjs.map +1 -1
  36. package/dist/lib/adapters/version/3.0/get-products.mjs +0 -6
  37. package/dist/lib/adapters/version/3.0/get-products.mjs.map +1 -1
  38. package/dist/lib/adapters/version/3.0/index.mjs +0 -6
  39. package/dist/lib/adapters/version/3.0/index.mjs.map +1 -1
  40. package/dist/lib/adapters/version/3.0/sync-accounts.mjs +0 -6
  41. package/dist/lib/adapters/version/3.0/sync-accounts.mjs.map +1 -1
  42. package/dist/lib/adapters/version/index.mjs +0 -6
  43. package/dist/lib/adapters/version/index.mjs.map +1 -1
  44. package/dist/lib/adapters/version/types.mjs +0 -6
  45. package/dist/lib/advanced.mjs +0 -6
  46. package/dist/lib/advanced.mjs.map +1 -1
  47. package/dist/lib/agents/index.generated.mjs +0 -6
  48. package/dist/lib/agents/index.generated.mjs.map +1 -1
  49. package/dist/lib/auth/index.mjs +0 -6
  50. package/dist/lib/auth/index.mjs.map +1 -1
  51. package/dist/lib/auth/oauth/CLIFlowHandler.mjs +0 -6
  52. package/dist/lib/auth/oauth/CLIFlowHandler.mjs.map +1 -1
  53. package/dist/lib/auth/oauth/ClientCredentialsFlow.mjs +0 -6
  54. package/dist/lib/auth/oauth/ClientCredentialsFlow.mjs.map +1 -1
  55. package/dist/lib/auth/oauth/MCPOAuthProvider.mjs +0 -6
  56. package/dist/lib/auth/oauth/MCPOAuthProvider.mjs.map +1 -1
  57. package/dist/lib/auth/oauth/NonInteractiveFlowHandler.mjs +0 -6
  58. package/dist/lib/auth/oauth/NonInteractiveFlowHandler.mjs.map +1 -1
  59. package/dist/lib/auth/oauth/authorization-required.mjs +0 -6
  60. package/dist/lib/auth/oauth/authorization-required.mjs.map +1 -1
  61. package/dist/lib/auth/oauth/diagnose.mjs +0 -6
  62. package/dist/lib/auth/oauth/diagnose.mjs.map +1 -1
  63. package/dist/lib/auth/oauth/diagnostics.mjs +0 -6
  64. package/dist/lib/auth/oauth/diagnostics.mjs.map +1 -1
  65. package/dist/lib/auth/oauth/discovery.mjs +0 -6
  66. package/dist/lib/auth/oauth/discovery.mjs.map +1 -1
  67. package/dist/lib/auth/oauth/file-storage.mjs +0 -6
  68. package/dist/lib/auth/oauth/file-storage.mjs.map +1 -1
  69. package/dist/lib/auth/oauth/index.mjs +0 -6
  70. package/dist/lib/auth/oauth/index.mjs.map +1 -1
  71. package/dist/lib/auth/oauth/secret-resolver.mjs +0 -6
  72. package/dist/lib/auth/oauth/secret-resolver.mjs.map +1 -1
  73. package/dist/lib/auth/oauth/storage-registry.mjs +0 -6
  74. package/dist/lib/auth/oauth/storage-registry.mjs.map +1 -1
  75. package/dist/lib/auth/oauth/types.mjs +0 -6
  76. package/dist/lib/auth/oauth/types.mjs.map +1 -1
  77. package/dist/lib/auth/oauth/web-flow.mjs +0 -6
  78. package/dist/lib/auth/oauth/web-flow.mjs.map +1 -1
  79. package/dist/lib/brand/index.mjs +0 -6
  80. package/dist/lib/brand/index.mjs.map +1 -1
  81. package/dist/lib/canonical-references/index.mjs +6 -7
  82. package/dist/lib/canonical-references/index.mjs.map +1 -1
  83. package/dist/lib/client/index.mjs +0 -6
  84. package/dist/lib/client/index.mjs.map +1 -1
  85. package/dist/lib/compliance/index.mjs +0 -6
  86. package/dist/lib/compliance/index.mjs.map +1 -1
  87. package/dist/lib/compliance-fixtures/index.mjs +0 -6
  88. package/dist/lib/compliance-fixtures/index.mjs.map +1 -1
  89. package/dist/lib/compliance-fixtures/test-authorization-server.mjs +0 -6
  90. package/dist/lib/compliance-fixtures/test-authorization-server.mjs.map +1 -1
  91. package/dist/lib/conformance/index.mjs +0 -6
  92. package/dist/lib/conformance/index.mjs.map +1 -1
  93. package/dist/lib/conformance/invariants/uniformError.mjs +0 -6
  94. package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
  95. package/dist/lib/conformance/invariants/uniformErrorComparator.mjs +0 -6
  96. package/dist/lib/conformance/invariants/uniformErrorComparator.mjs.map +1 -1
  97. package/dist/lib/conformance/oracle.mjs +0 -6
  98. package/dist/lib/conformance/oracle.mjs.map +1 -1
  99. package/dist/lib/conformance/runConformance.mjs +0 -6
  100. package/dist/lib/conformance/runConformance.mjs.map +1 -1
  101. package/dist/lib/conformance/runners.mjs +0 -6
  102. package/dist/lib/conformance/runners.mjs.map +1 -1
  103. package/dist/lib/conformance/schemaArbitrary.mjs +0 -6
  104. package/dist/lib/conformance/schemaArbitrary.mjs.map +1 -1
  105. package/dist/lib/conformance/schemaLoader.mjs +5 -6
  106. package/dist/lib/conformance/schemaLoader.mjs.map +1 -1
  107. package/dist/lib/conformance/seeder.mjs +0 -6
  108. package/dist/lib/conformance/seeder.mjs.map +1 -1
  109. package/dist/lib/conformance/types.mjs +0 -6
  110. package/dist/lib/conformance/types.mjs.map +1 -1
  111. package/dist/lib/conformance/webhook.mjs +0 -6
  112. package/dist/lib/conformance/webhook.mjs.map +1 -1
  113. package/dist/lib/core/ADCPMultiAgentClient.mjs +0 -6
  114. package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
  115. package/dist/lib/core/AgentClient.mjs +0 -6
  116. package/dist/lib/core/AgentClient.mjs.map +1 -1
  117. package/dist/lib/core/AsyncHandler.mjs +0 -6
  118. package/dist/lib/core/AsyncHandler.mjs.map +1 -1
  119. package/dist/lib/core/ConfigurationManager.mjs +0 -6
  120. package/dist/lib/core/ConfigurationManager.mjs.map +1 -1
  121. package/dist/lib/core/ConversationTypes.mjs +0 -6
  122. package/dist/lib/core/CreativeAgentClient.mjs +0 -6
  123. package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
  124. package/dist/lib/core/GovernanceMiddleware.mjs +0 -6
  125. package/dist/lib/core/GovernanceMiddleware.mjs.map +1 -1
  126. package/dist/lib/core/GovernanceTypes.mjs +0 -6
  127. package/dist/lib/core/GovernanceTypes.mjs.map +1 -1
  128. package/dist/lib/core/ProtocolResponseParser.mjs +0 -6
  129. package/dist/lib/core/ProtocolResponseParser.mjs.map +1 -1
  130. package/dist/lib/core/ResponseValidator.mjs +0 -6
  131. package/dist/lib/core/ResponseValidator.mjs.map +1 -1
  132. package/dist/lib/core/SingleAgentClient.mjs +0 -6
  133. package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
  134. package/dist/lib/core/TaskEventTypes.mjs +0 -6
  135. package/dist/lib/core/TaskEventTypes.mjs.map +1 -1
  136. package/dist/lib/core/TaskExecutor.mjs +0 -6
  137. package/dist/lib/core/TaskExecutor.mjs.map +1 -1
  138. package/dist/lib/core/match.mjs +0 -6
  139. package/dist/lib/core/match.mjs.map +1 -1
  140. package/dist/lib/core/task-status.mjs +0 -6
  141. package/dist/lib/core/task-status.mjs.map +1 -1
  142. package/dist/lib/core/webhook-url.mjs +0 -6
  143. package/dist/lib/core/webhook-url.mjs.map +1 -1
  144. package/dist/lib/discovery/adagents-redirects.mjs +0 -6
  145. package/dist/lib/discovery/adagents-redirects.mjs.map +1 -1
  146. package/dist/lib/discovery/agent-directory.mjs +0 -6
  147. package/dist/lib/discovery/agent-directory.mjs.map +1 -1
  148. package/dist/lib/discovery/inline-publisher-properties.mjs +0 -6
  149. package/dist/lib/discovery/inline-publisher-properties.mjs.map +1 -1
  150. package/dist/lib/discovery/network-consistency-checker.mjs +0 -6
  151. package/dist/lib/discovery/network-consistency-checker.mjs.map +1 -1
  152. package/dist/lib/discovery/property-crawler.mjs +0 -6
  153. package/dist/lib/discovery/property-crawler.mjs.map +1 -1
  154. package/dist/lib/discovery/property-index.mjs +0 -6
  155. package/dist/lib/discovery/property-index.mjs.map +1 -1
  156. package/dist/lib/discovery/publisher-property-selector.mjs +0 -6
  157. package/dist/lib/discovery/publisher-property-selector.mjs.map +1 -1
  158. package/dist/lib/discovery/resolve-agent-properties.mjs +0 -6
  159. package/dist/lib/discovery/resolve-agent-properties.mjs.map +1 -1
  160. package/dist/lib/discovery/types.mjs +0 -6
  161. package/dist/lib/discovery/validate-adagents.mjs +0 -6
  162. package/dist/lib/discovery/validate-adagents.mjs.map +1 -1
  163. package/dist/lib/enums.mjs +0 -6
  164. package/dist/lib/enums.mjs.map +1 -1
  165. package/dist/lib/errors/index.mjs +0 -6
  166. package/dist/lib/errors/index.mjs.map +1 -1
  167. package/dist/lib/express-mcp/index.mjs +0 -6
  168. package/dist/lib/express-mcp/index.mjs.map +1 -1
  169. package/dist/lib/governance/index.mjs +0 -6
  170. package/dist/lib/governance/index.mjs.map +1 -1
  171. package/dist/lib/handlers/types.mjs +0 -6
  172. package/dist/lib/handlers/types.mjs.map +1 -1
  173. package/dist/lib/index.mjs +0 -6
  174. package/dist/lib/index.mjs.map +1 -1
  175. package/dist/lib/media-buy/available-actions.mjs +0 -6
  176. package/dist/lib/media-buy/available-actions.mjs.map +1 -1
  177. package/dist/lib/media-buy/index.mjs +0 -6
  178. package/dist/lib/media-buy/index.mjs.map +1 -1
  179. package/dist/lib/media-buy/preflight.mjs +0 -6
  180. package/dist/lib/media-buy/preflight.mjs.map +1 -1
  181. package/dist/lib/media-buy/property-policy.mjs +0 -6
  182. package/dist/lib/media-buy/property-policy.mjs.map +1 -1
  183. package/dist/lib/media-buy/types.mjs +0 -6
  184. package/dist/lib/media-buy/types.mjs.map +1 -1
  185. package/dist/lib/media-buy/update-fields.generated.mjs +0 -6
  186. package/dist/lib/media-buy/update-fields.generated.mjs.map +1 -1
  187. package/dist/lib/mock-server/creative-ad-server/seed-data.mjs +0 -6
  188. package/dist/lib/mock-server/creative-ad-server/seed-data.mjs.map +1 -1
  189. package/dist/lib/mock-server/creative-ad-server/server.mjs +0 -6
  190. package/dist/lib/mock-server/creative-ad-server/server.mjs.map +1 -1
  191. package/dist/lib/mock-server/creative-template/seed-data.mjs +0 -6
  192. package/dist/lib/mock-server/creative-template/seed-data.mjs.map +1 -1
  193. package/dist/lib/mock-server/creative-template/server.mjs +0 -6
  194. package/dist/lib/mock-server/creative-template/server.mjs.map +1 -1
  195. package/dist/lib/mock-server/index.mjs +0 -6
  196. package/dist/lib/mock-server/index.mjs.map +1 -1
  197. package/dist/lib/mock-server/sales-guaranteed/recipe.mjs +0 -6
  198. package/dist/lib/mock-server/sales-guaranteed/recipe.mjs.map +1 -1
  199. package/dist/lib/mock-server/sales-guaranteed/seed-data.mjs +0 -6
  200. package/dist/lib/mock-server/sales-guaranteed/seed-data.mjs.map +1 -1
  201. package/dist/lib/mock-server/sales-guaranteed/server.mjs +0 -6
  202. package/dist/lib/mock-server/sales-guaranteed/server.mjs.map +1 -1
  203. package/dist/lib/mock-server/sales-non-guaranteed/recipe.mjs +0 -6
  204. package/dist/lib/mock-server/sales-non-guaranteed/recipe.mjs.map +1 -1
  205. package/dist/lib/mock-server/sales-non-guaranteed/seed-data.mjs +0 -6
  206. package/dist/lib/mock-server/sales-non-guaranteed/seed-data.mjs.map +1 -1
  207. package/dist/lib/mock-server/sales-non-guaranteed/server.mjs +0 -6
  208. package/dist/lib/mock-server/sales-non-guaranteed/server.mjs.map +1 -1
  209. package/dist/lib/mock-server/sales-social/seed-data.mjs +0 -6
  210. package/dist/lib/mock-server/sales-social/seed-data.mjs.map +1 -1
  211. package/dist/lib/mock-server/sales-social/server.mjs +0 -6
  212. package/dist/lib/mock-server/sales-social/server.mjs.map +1 -1
  213. package/dist/lib/mock-server/scenario.mjs +0 -6
  214. package/dist/lib/mock-server/scenario.mjs.map +1 -1
  215. package/dist/lib/mock-server/signal-marketplace/seed-data.mjs +0 -6
  216. package/dist/lib/mock-server/signal-marketplace/seed-data.mjs.map +1 -1
  217. package/dist/lib/mock-server/signal-marketplace/server.mjs +0 -6
  218. package/dist/lib/mock-server/signal-marketplace/server.mjs.map +1 -1
  219. package/dist/lib/mock-server/sponsored-intelligence/seed-data.mjs +0 -6
  220. package/dist/lib/mock-server/sponsored-intelligence/seed-data.mjs.map +1 -1
  221. package/dist/lib/mock-server/sponsored-intelligence/server.mjs +0 -6
  222. package/dist/lib/mock-server/sponsored-intelligence/server.mjs.map +1 -1
  223. package/dist/lib/net/address-guards.mjs +0 -6
  224. package/dist/lib/net/address-guards.mjs.map +1 -1
  225. package/dist/lib/net/index.mjs +0 -6
  226. package/dist/lib/net/index.mjs.map +1 -1
  227. package/dist/lib/net/ssrf-fetch.mjs +0 -6
  228. package/dist/lib/net/ssrf-fetch.mjs.map +1 -1
  229. package/dist/lib/observability/index.mjs +0 -6
  230. package/dist/lib/observability/index.mjs.map +1 -1
  231. package/dist/lib/observability/tracing.mjs +6 -7
  232. package/dist/lib/observability/tracing.mjs.map +1 -1
  233. package/dist/lib/protocols/a2a.mjs +0 -6
  234. package/dist/lib/protocols/a2a.mjs.map +1 -1
  235. package/dist/lib/protocols/abort.mjs +0 -6
  236. package/dist/lib/protocols/abort.mjs.map +1 -1
  237. package/dist/lib/protocols/index.mjs +0 -6
  238. package/dist/lib/protocols/index.mjs.map +1 -1
  239. package/dist/lib/protocols/mcp-modern.mjs +0 -6
  240. package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
  241. package/dist/lib/protocols/mcp-tasks.mjs +0 -6
  242. package/dist/lib/protocols/mcp-tasks.mjs.map +1 -1
  243. package/dist/lib/protocols/mcp.mjs +0 -6
  244. package/dist/lib/protocols/mcp.mjs.map +1 -1
  245. package/dist/lib/protocols/rawResponseCapture.mjs +0 -6
  246. package/dist/lib/protocols/rawResponseCapture.mjs.map +1 -1
  247. package/dist/lib/protocols/responseSizeLimit.mjs +0 -6
  248. package/dist/lib/protocols/responseSizeLimit.mjs.map +1 -1
  249. package/dist/lib/protocols/transportDiagnostics.mjs +0 -6
  250. package/dist/lib/protocols/transportDiagnostics.mjs.map +1 -1
  251. package/dist/lib/registry/cursor-store.mjs +0 -6
  252. package/dist/lib/registry/cursor-store.mjs.map +1 -1
  253. package/dist/lib/registry/feed-stream.mjs +0 -6
  254. package/dist/lib/registry/feed-stream.mjs.map +1 -1
  255. package/dist/lib/registry/index.mjs +0 -6
  256. package/dist/lib/registry/index.mjs.map +1 -1
  257. package/dist/lib/registry/property-registry.mjs +0 -6
  258. package/dist/lib/registry/property-registry.mjs.map +1 -1
  259. package/dist/lib/registry/sync.mjs +0 -6
  260. package/dist/lib/registry/sync.mjs.map +1 -1
  261. package/dist/lib/registry/types.generated.mjs +0 -6
  262. package/dist/lib/registry/types.mjs +0 -6
  263. package/dist/lib/schemas/index.mjs +0 -6
  264. package/dist/lib/schemas/index.mjs.map +1 -1
  265. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  266. package/dist/lib/server/a2a-adapter.mjs +0 -6
  267. package/dist/lib/server/a2a-adapter.mjs.map +1 -1
  268. package/dist/lib/server/account-mode.mjs +0 -6
  269. package/dist/lib/server/account-mode.mjs.map +1 -1
  270. package/dist/lib/server/adcp-server.mjs +0 -6
  271. package/dist/lib/server/adcp-server.mjs.map +1 -1
  272. package/dist/lib/server/auth-introspection.mjs +0 -6
  273. package/dist/lib/server/auth-introspection.mjs.map +1 -1
  274. package/dist/lib/server/auth-signature.mjs +0 -6
  275. package/dist/lib/server/auth-signature.mjs.map +1 -1
  276. package/dist/lib/server/auth.mjs +0 -6
  277. package/dist/lib/server/auth.mjs.map +1 -1
  278. package/dist/lib/server/create-adcp-server.mjs +0 -6
  279. package/dist/lib/server/create-adcp-server.mjs.map +1 -1
  280. package/dist/lib/server/credential-policy.mjs +0 -6
  281. package/dist/lib/server/credential-policy.mjs.map +1 -1
  282. package/dist/lib/server/ctx-metadata/backends/memory.mjs +0 -6
  283. package/dist/lib/server/ctx-metadata/backends/memory.mjs.map +1 -1
  284. package/dist/lib/server/ctx-metadata/backends/pg.mjs +0 -6
  285. package/dist/lib/server/ctx-metadata/backends/pg.mjs.map +1 -1
  286. package/dist/lib/server/ctx-metadata/backends/redis.mjs +0 -6
  287. package/dist/lib/server/ctx-metadata/backends/redis.mjs.map +1 -1
  288. package/dist/lib/server/ctx-metadata/index.mjs +0 -6
  289. package/dist/lib/server/ctx-metadata/index.mjs.map +1 -1
  290. package/dist/lib/server/ctx-metadata/store.mjs +0 -6
  291. package/dist/lib/server/ctx-metadata/store.mjs.map +1 -1
  292. package/dist/lib/server/ctx-metadata/wire-shape.mjs +0 -6
  293. package/dist/lib/server/ctx-metadata/wire-shape.mjs.map +1 -1
  294. package/dist/lib/server/decisioning/account.mjs +0 -6
  295. package/dist/lib/server/decisioning/account.mjs.map +1 -1
  296. package/dist/lib/server/decisioning/admin-router.mjs +0 -6
  297. package/dist/lib/server/decisioning/admin-router.mjs.map +1 -1
  298. package/dist/lib/server/decisioning/assembly-helpers.mjs +0 -6
  299. package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
  300. package/dist/lib/server/decisioning/async-outcome.mjs +0 -6
  301. package/dist/lib/server/decisioning/async-outcome.mjs.map +1 -1
  302. package/dist/lib/server/decisioning/buyer-agent.mjs +0 -6
  303. package/dist/lib/server/decisioning/buyer-agent.mjs.map +1 -1
  304. package/dist/lib/server/decisioning/capabilities.mjs +0 -6
  305. package/dist/lib/server/decisioning/capabilities.mjs.map +1 -1
  306. package/dist/lib/server/decisioning/compose.mjs +0 -6
  307. package/dist/lib/server/decisioning/compose.mjs.map +1 -1
  308. package/dist/lib/server/decisioning/context.mjs +0 -6
  309. package/dist/lib/server/decisioning/errors-typed.mjs +0 -6
  310. package/dist/lib/server/decisioning/errors-typed.mjs.map +1 -1
  311. package/dist/lib/server/decisioning/helpers.mjs +0 -6
  312. package/dist/lib/server/decisioning/helpers.mjs.map +1 -1
  313. package/dist/lib/server/decisioning/index.mjs +0 -6
  314. package/dist/lib/server/decisioning/index.mjs.map +1 -1
  315. package/dist/lib/server/decisioning/list-helpers.mjs +0 -6
  316. package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
  317. package/dist/lib/server/decisioning/manifest-helpers.mjs +0 -6
  318. package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
  319. package/dist/lib/server/decisioning/pagination.mjs +0 -6
  320. package/dist/lib/server/decisioning/platform-helpers.mjs +0 -6
  321. package/dist/lib/server/decisioning/platform-helpers.mjs.map +1 -1
  322. package/dist/lib/server/decisioning/platform.mjs +0 -6
  323. package/dist/lib/server/decisioning/proposal/dispatch.mjs +0 -6
  324. package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
  325. package/dist/lib/server/decisioning/proposal/index.mjs +0 -6
  326. package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
  327. package/dist/lib/server/decisioning/proposal/lifecycle.mjs +0 -6
  328. package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
  329. package/dist/lib/server/decisioning/proposal/mock-manager.mjs +0 -6
  330. package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
  331. package/dist/lib/server/decisioning/proposal/store.mjs +0 -6
  332. package/dist/lib/server/decisioning/proposal/store.mjs.map +1 -1
  333. package/dist/lib/server/decisioning/proposal/types.mjs +0 -6
  334. package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
  335. package/dist/lib/server/decisioning/resolve-presets.mjs +0 -6
  336. package/dist/lib/server/decisioning/resolve-presets.mjs.map +1 -1
  337. package/dist/lib/server/decisioning/runtime/entity-hydration.generated.mjs +0 -6
  338. package/dist/lib/server/decisioning/runtime/entity-hydration.generated.mjs.map +1 -1
  339. package/dist/lib/server/decisioning/runtime/from-platform.mjs +0 -6
  340. package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
  341. package/dist/lib/server/decisioning/runtime/observed-modes.mjs +0 -6
  342. package/dist/lib/server/decisioning/runtime/observed-modes.mjs.map +1 -1
  343. package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs +0 -6
  344. package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs.map +1 -1
  345. package/dist/lib/server/decisioning/runtime/protocol-for-tool.mjs +0 -6
  346. package/dist/lib/server/decisioning/runtime/protocol-for-tool.mjs.map +1 -1
  347. package/dist/lib/server/decisioning/runtime/task-registry.mjs +0 -6
  348. package/dist/lib/server/decisioning/runtime/task-registry.mjs.map +1 -1
  349. package/dist/lib/server/decisioning/runtime/to-context.mjs +0 -6
  350. package/dist/lib/server/decisioning/runtime/to-context.mjs.map +1 -1
  351. package/dist/lib/server/decisioning/runtime/validate-platform.mjs +0 -6
  352. package/dist/lib/server/decisioning/runtime/validate-platform.mjs.map +1 -1
  353. package/dist/lib/server/decisioning/specialisms/audiences.mjs +0 -6
  354. package/dist/lib/server/decisioning/specialisms/brand-rights.mjs +0 -6
  355. package/dist/lib/server/decisioning/specialisms/campaign-governance.mjs +0 -6
  356. package/dist/lib/server/decisioning/specialisms/content-standards.mjs +0 -6
  357. package/dist/lib/server/decisioning/specialisms/creative-ad-server.mjs +0 -6
  358. package/dist/lib/server/decisioning/specialisms/creative.mjs +0 -6
  359. package/dist/lib/server/decisioning/specialisms/lists.mjs +0 -6
  360. package/dist/lib/server/decisioning/specialisms/sales.mjs +0 -6
  361. package/dist/lib/server/decisioning/specialisms/signals.mjs +0 -6
  362. package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.mjs +0 -6
  363. package/dist/lib/server/decisioning/start-time.mjs +0 -6
  364. package/dist/lib/server/decisioning/start-time.mjs.map +1 -1
  365. package/dist/lib/server/decisioning/status-changes.mjs +0 -6
  366. package/dist/lib/server/decisioning/status-changes.mjs.map +1 -1
  367. package/dist/lib/server/decisioning/status-mappers.mjs +0 -6
  368. package/dist/lib/server/decisioning/status-mappers.mjs.map +1 -1
  369. package/dist/lib/server/decisioning/tenant-registry.mjs +0 -6
  370. package/dist/lib/server/decisioning/tenant-registry.mjs.map +1 -1
  371. package/dist/lib/server/decisioning/tenant-store.mjs +0 -6
  372. package/dist/lib/server/decisioning/tenant-store.mjs.map +1 -1
  373. package/dist/lib/server/decisioning/validate-specialisms.mjs +0 -6
  374. package/dist/lib/server/decisioning/validate-specialisms.mjs.map +1 -1
  375. package/dist/lib/server/dynamic-registry.mjs +0 -6
  376. package/dist/lib/server/dynamic-registry.mjs.map +1 -1
  377. package/dist/lib/server/envelope-allowlist.mjs +0 -6
  378. package/dist/lib/server/envelope-allowlist.mjs.map +1 -1
  379. package/dist/lib/server/error-arm-tools.mjs +5 -6
  380. package/dist/lib/server/error-arm-tools.mjs.map +1 -1
  381. package/dist/lib/server/errors.mjs +0 -6
  382. package/dist/lib/server/errors.mjs.map +1 -1
  383. package/dist/lib/server/example-tld-guard.mjs +0 -6
  384. package/dist/lib/server/example-tld-guard.mjs.map +1 -1
  385. package/dist/lib/server/express-adapter.mjs +0 -6
  386. package/dist/lib/server/express-adapter.mjs.map +1 -1
  387. package/dist/lib/server/governance.mjs +0 -6
  388. package/dist/lib/server/governance.mjs.map +1 -1
  389. package/dist/lib/server/idempotency/backends/lazy.mjs +0 -6
  390. package/dist/lib/server/idempotency/backends/lazy.mjs.map +1 -1
  391. package/dist/lib/server/idempotency/backends/memory.mjs +0 -6
  392. package/dist/lib/server/idempotency/backends/memory.mjs.map +1 -1
  393. package/dist/lib/server/idempotency/backends/pg.mjs +0 -6
  394. package/dist/lib/server/idempotency/backends/pg.mjs.map +1 -1
  395. package/dist/lib/server/idempotency/backends/redis.mjs +0 -6
  396. package/dist/lib/server/idempotency/backends/redis.mjs.map +1 -1
  397. package/dist/lib/server/idempotency/index.mjs +0 -6
  398. package/dist/lib/server/idempotency/index.mjs.map +1 -1
  399. package/dist/lib/server/idempotency/store.mjs +0 -6
  400. package/dist/lib/server/idempotency/store.mjs.map +1 -1
  401. package/dist/lib/server/index.mjs +0 -6
  402. package/dist/lib/server/index.mjs.map +1 -1
  403. package/dist/lib/server/legacy/v5/index.mjs +0 -6
  404. package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
  405. package/dist/lib/server/mcp-modern-server.mjs +0 -6
  406. package/dist/lib/server/mcp-modern-server.mjs.map +1 -1
  407. package/dist/lib/server/media-buy-actions.mjs +0 -6
  408. package/dist/lib/server/media-buy-actions.mjs.map +1 -1
  409. package/dist/lib/server/media-buy-helpers.mjs +0 -6
  410. package/dist/lib/server/media-buy-helpers.mjs.map +1 -1
  411. package/dist/lib/server/media-buy-store.mjs +0 -6
  412. package/dist/lib/server/media-buy-store.mjs.map +1 -1
  413. package/dist/lib/server/normalize-errors.mjs +0 -6
  414. package/dist/lib/server/normalize-errors.mjs.map +1 -1
  415. package/dist/lib/server/operational-platform.mjs +0 -6
  416. package/dist/lib/server/operational-platform.mjs.map +1 -1
  417. package/dist/lib/server/pick-safe-details.mjs +0 -6
  418. package/dist/lib/server/pick-safe-details.mjs.map +1 -1
  419. package/dist/lib/server/pin-and-bind-fetch.mjs +0 -6
  420. package/dist/lib/server/pin-and-bind-fetch.mjs.map +1 -1
  421. package/dist/lib/server/postgres-state-store.mjs +0 -6
  422. package/dist/lib/server/postgres-state-store.mjs.map +1 -1
  423. package/dist/lib/server/postgres-task-store.mjs +0 -6
  424. package/dist/lib/server/postgres-task-store.mjs.map +1 -1
  425. package/dist/lib/server/product-defaults.mjs +0 -6
  426. package/dist/lib/server/product-defaults.mjs.map +1 -1
  427. package/dist/lib/server/redact.mjs +0 -6
  428. package/dist/lib/server/redact.mjs.map +1 -1
  429. package/dist/lib/server/responses.mjs +0 -6
  430. package/dist/lib/server/responses.mjs.map +1 -1
  431. package/dist/lib/server/serve.mjs +0 -6
  432. package/dist/lib/server/serve.mjs.map +1 -1
  433. package/dist/lib/server/socket-mode/conformance-client.mjs +0 -6
  434. package/dist/lib/server/socket-mode/conformance-client.mjs.map +1 -1
  435. package/dist/lib/server/socket-mode/index.mjs +0 -6
  436. package/dist/lib/server/socket-mode/index.mjs.map +1 -1
  437. package/dist/lib/server/socket-mode/ws-transport.mjs +0 -6
  438. package/dist/lib/server/socket-mode/ws-transport.mjs.map +1 -1
  439. package/dist/lib/server/state-machine.mjs +0 -6
  440. package/dist/lib/server/state-machine.mjs.map +1 -1
  441. package/dist/lib/server/state-store.mjs +0 -6
  442. package/dist/lib/server/state-store.mjs.map +1 -1
  443. package/dist/lib/server/structured-serialize.mjs +0 -6
  444. package/dist/lib/server/structured-serialize.mjs.map +1 -1
  445. package/dist/lib/server/targeting-helpers.mjs +0 -6
  446. package/dist/lib/server/targeting-helpers.mjs.map +1 -1
  447. package/dist/lib/server/tasks.mjs +0 -6
  448. package/dist/lib/server/tasks.mjs.map +1 -1
  449. package/dist/lib/server/test-controller-bridge.mjs +0 -6
  450. package/dist/lib/server/test-controller-bridge.mjs.map +1 -1
  451. package/dist/lib/server/test-controller.mjs +0 -6
  452. package/dist/lib/server/test-controller.mjs.map +1 -1
  453. package/dist/lib/server/upstream-helpers.mjs +0 -6
  454. package/dist/lib/server/upstream-helpers.mjs.map +1 -1
  455. package/dist/lib/server/webhook-emitter.mjs +0 -6
  456. package/dist/lib/server/webhook-emitter.mjs.map +1 -1
  457. package/dist/lib/server/wire-safe.mjs +0 -6
  458. package/dist/lib/server/wire-safe.mjs.map +1 -1
  459. package/dist/lib/server/wire-spec-fields.generated.mjs +0 -6
  460. package/dist/lib/server/wire-spec-fields.generated.mjs.map +1 -1
  461. package/dist/lib/server/wrap-envelope.mjs +0 -6
  462. package/dist/lib/server/wrap-envelope.mjs.map +1 -1
  463. package/dist/lib/signing/agent-context.mjs +0 -6
  464. package/dist/lib/signing/agent-context.mjs.map +1 -1
  465. package/dist/lib/signing/agent-fetch.mjs +0 -6
  466. package/dist/lib/signing/agent-fetch.mjs.map +1 -1
  467. package/dist/lib/signing/agent-resolver/canonicalize.mjs +0 -6
  468. package/dist/lib/signing/agent-resolver/canonicalize.mjs.map +1 -1
  469. package/dist/lib/signing/agent-resolver/capabilities-types.mjs +0 -6
  470. package/dist/lib/signing/agent-resolver/capabilities-types.mjs.map +1 -1
  471. package/dist/lib/signing/agent-resolver/consistency.mjs +0 -6
  472. package/dist/lib/signing/agent-resolver/consistency.mjs.map +1 -1
  473. package/dist/lib/signing/agent-resolver/errors.mjs +0 -6
  474. package/dist/lib/signing/agent-resolver/errors.mjs.map +1 -1
  475. package/dist/lib/signing/agent-resolver/etld.mjs +0 -6
  476. package/dist/lib/signing/agent-resolver/etld.mjs.map +1 -1
  477. package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +0 -6
  478. package/dist/lib/signing/agent-resolver/fetch-helpers.mjs.map +1 -1
  479. package/dist/lib/signing/agent-resolver/index.mjs +0 -6
  480. package/dist/lib/signing/agent-resolver/index.mjs.map +1 -1
  481. package/dist/lib/signing/agent-resolver/jwks-set.mjs +0 -6
  482. package/dist/lib/signing/agent-resolver/jwks-set.mjs.map +1 -1
  483. package/dist/lib/signing/agent-resolver/resolve-agent.mjs +0 -6
  484. package/dist/lib/signing/agent-resolver/resolve-agent.mjs.map +1 -1
  485. package/dist/lib/signing/agent-resolver/select-agent.mjs +0 -6
  486. package/dist/lib/signing/agent-resolver/select-agent.mjs.map +1 -1
  487. package/dist/lib/signing/agent-resolver/strict-json.mjs +0 -6
  488. package/dist/lib/signing/agent-resolver/strict-json.mjs.map +1 -1
  489. package/dist/lib/signing/brand-jwks.mjs +0 -6
  490. package/dist/lib/signing/brand-jwks.mjs.map +1 -1
  491. package/dist/lib/signing/canonicalize.mjs +0 -6
  492. package/dist/lib/signing/canonicalize.mjs.map +1 -1
  493. package/dist/lib/signing/capability-cache.mjs +0 -6
  494. package/dist/lib/signing/capability-cache.mjs.map +1 -1
  495. package/dist/lib/signing/capability-priming.mjs +0 -6
  496. package/dist/lib/signing/capability-priming.mjs.map +1 -1
  497. package/dist/lib/signing/client.mjs +0 -6
  498. package/dist/lib/signing/client.mjs.map +1 -1
  499. package/dist/lib/signing/content-digest.mjs +0 -6
  500. package/dist/lib/signing/content-digest.mjs.map +1 -1
  501. package/dist/lib/signing/crypto.mjs +0 -6
  502. package/dist/lib/signing/crypto.mjs.map +1 -1
  503. package/dist/lib/signing/ecdsa-encoding.mjs +0 -6
  504. package/dist/lib/signing/ecdsa-encoding.mjs.map +1 -1
  505. package/dist/lib/signing/errors.mjs +0 -6
  506. package/dist/lib/signing/errors.mjs.map +1 -1
  507. package/dist/lib/signing/fetch-async.mjs +0 -6
  508. package/dist/lib/signing/fetch-async.mjs.map +1 -1
  509. package/dist/lib/signing/fetch.mjs +0 -6
  510. package/dist/lib/signing/fetch.mjs.map +1 -1
  511. package/dist/lib/signing/index.mjs +0 -6
  512. package/dist/lib/signing/index.mjs.map +1 -1
  513. package/dist/lib/signing/jwks-helpers.mjs +0 -6
  514. package/dist/lib/signing/jwks-helpers.mjs.map +1 -1
  515. package/dist/lib/signing/jwks-https.mjs +0 -6
  516. package/dist/lib/signing/jwks-https.mjs.map +1 -1
  517. package/dist/lib/signing/jwks.mjs +0 -6
  518. package/dist/lib/signing/jwks.mjs.map +1 -1
  519. package/dist/lib/signing/middleware.mjs +0 -6
  520. package/dist/lib/signing/middleware.mjs.map +1 -1
  521. package/dist/lib/signing/parser.mjs +0 -6
  522. package/dist/lib/signing/parser.mjs.map +1 -1
  523. package/dist/lib/signing/postgres-replay-store.mjs +0 -6
  524. package/dist/lib/signing/postgres-replay-store.mjs.map +1 -1
  525. package/dist/lib/signing/protocol-response.mjs +0 -6
  526. package/dist/lib/signing/protocol-response.mjs.map +1 -1
  527. package/dist/lib/signing/provider.mjs +0 -6
  528. package/dist/lib/signing/redis-replay-store.mjs +0 -6
  529. package/dist/lib/signing/redis-replay-store.mjs.map +1 -1
  530. package/dist/lib/signing/replay.mjs +0 -6
  531. package/dist/lib/signing/replay.mjs.map +1 -1
  532. package/dist/lib/signing/request-context.mjs +0 -6
  533. package/dist/lib/signing/request-context.mjs.map +1 -1
  534. package/dist/lib/signing/revocation-https.mjs +0 -6
  535. package/dist/lib/signing/revocation-https.mjs.map +1 -1
  536. package/dist/lib/signing/revocation.mjs +0 -6
  537. package/dist/lib/signing/revocation.mjs.map +1 -1
  538. package/dist/lib/signing/server.mjs +0 -6
  539. package/dist/lib/signing/server.mjs.map +1 -1
  540. package/dist/lib/signing/signer-async.mjs +0 -6
  541. package/dist/lib/signing/signer-async.mjs.map +1 -1
  542. package/dist/lib/signing/signer.mjs +0 -6
  543. package/dist/lib/signing/signer.mjs.map +1 -1
  544. package/dist/lib/signing/testing.mjs +0 -6
  545. package/dist/lib/signing/testing.mjs.map +1 -1
  546. package/dist/lib/signing/types.mjs +0 -6
  547. package/dist/lib/signing/types.mjs.map +1 -1
  548. package/dist/lib/signing/verifier.mjs +0 -6
  549. package/dist/lib/signing/verifier.mjs.map +1 -1
  550. package/dist/lib/signing/webhook-auth-detection.mjs +0 -6
  551. package/dist/lib/signing/webhook-auth-detection.mjs.map +1 -1
  552. package/dist/lib/signing/webhook-verifier.mjs +0 -6
  553. package/dist/lib/signing/webhook-verifier.mjs.map +1 -1
  554. package/dist/lib/storage/MemoryStorage.mjs +0 -6
  555. package/dist/lib/storage/MemoryStorage.mjs.map +1 -1
  556. package/dist/lib/storage/interfaces.mjs +0 -6
  557. package/dist/lib/substitution/encoder/SubstitutionEncoder.mjs +0 -6
  558. package/dist/lib/substitution/encoder/SubstitutionEncoder.mjs.map +1 -1
  559. package/dist/lib/substitution/encoder/index.mjs +0 -6
  560. package/dist/lib/substitution/encoder/index.mjs.map +1 -1
  561. package/dist/lib/substitution/index.mjs +0 -6
  562. package/dist/lib/substitution/index.mjs.map +1 -1
  563. package/dist/lib/substitution/observer/SubstitutionObserver.mjs +0 -6
  564. package/dist/lib/substitution/observer/SubstitutionObserver.mjs.map +1 -1
  565. package/dist/lib/substitution/observer/alignment.mjs +0 -6
  566. package/dist/lib/substitution/observer/alignment.mjs.map +1 -1
  567. package/dist/lib/substitution/observer/assertions.mjs +0 -6
  568. package/dist/lib/substitution/observer/assertions.mjs.map +1 -1
  569. package/dist/lib/substitution/observer/html-parser.mjs +0 -6
  570. package/dist/lib/substitution/observer/html-parser.mjs.map +1 -1
  571. package/dist/lib/substitution/observer/index.mjs +0 -6
  572. package/dist/lib/substitution/observer/index.mjs.map +1 -1
  573. package/dist/lib/substitution/observer/ssrf.mjs +0 -6
  574. package/dist/lib/substitution/observer/ssrf.mjs.map +1 -1
  575. package/dist/lib/substitution/rfc3986.mjs +0 -6
  576. package/dist/lib/substitution/rfc3986.mjs.map +1 -1
  577. package/dist/lib/substitution/translate.mjs +0 -6
  578. package/dist/lib/substitution/translate.mjs.map +1 -1
  579. package/dist/lib/substitution/types.mjs +0 -6
  580. package/dist/lib/substitution/vectors.mjs +0 -6
  581. package/dist/lib/substitution/vectors.mjs.map +1 -1
  582. package/dist/lib/testing/agent-tester.mjs +0 -6
  583. package/dist/lib/testing/agent-tester.mjs.map +1 -1
  584. package/dist/lib/testing/client.mjs +0 -6
  585. package/dist/lib/testing/client.mjs.map +1 -1
  586. package/dist/lib/testing/compliance/briefs.mjs +0 -6
  587. package/dist/lib/testing/compliance/briefs.mjs.map +1 -1
  588. package/dist/lib/testing/compliance/comply.mjs +0 -6
  589. package/dist/lib/testing/compliance/comply.mjs.map +1 -1
  590. package/dist/lib/testing/compliance/index.mjs +0 -6
  591. package/dist/lib/testing/compliance/index.mjs.map +1 -1
  592. package/dist/lib/testing/compliance/spec-conformance.mjs +0 -6
  593. package/dist/lib/testing/compliance/spec-conformance.mjs.map +1 -1
  594. package/dist/lib/testing/compliance/storyboard-tracks.mjs +0 -6
  595. package/dist/lib/testing/compliance/storyboard-tracks.mjs.map +1 -1
  596. package/dist/lib/testing/compliance/summary.mjs +0 -6
  597. package/dist/lib/testing/compliance/summary.mjs.map +1 -1
  598. package/dist/lib/testing/compliance/types.mjs +0 -6
  599. package/dist/lib/testing/comply-controller.mjs +0 -6
  600. package/dist/lib/testing/comply-controller.mjs.map +1 -1
  601. package/dist/lib/testing/controller-assertions.mjs +0 -6
  602. package/dist/lib/testing/controller-assertions.mjs.map +1 -1
  603. package/dist/lib/testing/formatter.mjs +0 -6
  604. package/dist/lib/testing/formatter.mjs.map +1 -1
  605. package/dist/lib/testing/index.mjs +0 -6
  606. package/dist/lib/testing/index.mjs.map +1 -1
  607. package/dist/lib/testing/local-agent-runner.mjs +0 -6
  608. package/dist/lib/testing/local-agent-runner.mjs.map +1 -1
  609. package/dist/lib/testing/orchestrator.mjs +0 -6
  610. package/dist/lib/testing/orchestrator.mjs.map +1 -1
  611. package/dist/lib/testing/personas/index.mjs +0 -6
  612. package/dist/lib/testing/personas/index.mjs.map +1 -1
  613. package/dist/lib/testing/scenarios/brand-rights.mjs +0 -6
  614. package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
  615. package/dist/lib/testing/scenarios/capabilities.mjs +0 -6
  616. package/dist/lib/testing/scenarios/capabilities.mjs.map +1 -1
  617. package/dist/lib/testing/scenarios/creative.mjs +0 -6
  618. package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
  619. package/dist/lib/testing/scenarios/deterministic.mjs +0 -6
  620. package/dist/lib/testing/scenarios/deterministic.mjs.map +1 -1
  621. package/dist/lib/testing/scenarios/discovery.mjs +0 -6
  622. package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
  623. package/dist/lib/testing/scenarios/edge-cases.mjs +0 -6
  624. package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
  625. package/dist/lib/testing/scenarios/error-compliance.mjs +0 -6
  626. package/dist/lib/testing/scenarios/error-compliance.mjs.map +1 -1
  627. package/dist/lib/testing/scenarios/governance.mjs +0 -6
  628. package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
  629. package/dist/lib/testing/scenarios/health.mjs +0 -6
  630. package/dist/lib/testing/scenarios/health.mjs.map +1 -1
  631. package/dist/lib/testing/scenarios/index.mjs +0 -6
  632. package/dist/lib/testing/scenarios/index.mjs.map +1 -1
  633. package/dist/lib/testing/scenarios/media-buy.mjs +0 -6
  634. package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
  635. package/dist/lib/testing/scenarios/schema-compliance.mjs +0 -6
  636. package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
  637. package/dist/lib/testing/scenarios/signals.mjs +0 -6
  638. package/dist/lib/testing/scenarios/signals.mjs.map +1 -1
  639. package/dist/lib/testing/scenarios/sponsored-intelligence.mjs +0 -6
  640. package/dist/lib/testing/scenarios/sponsored-intelligence.mjs.map +1 -1
  641. package/dist/lib/testing/scenarios/trusted-match.mjs +0 -6
  642. package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
  643. package/dist/lib/testing/seed-merge.mjs +0 -6
  644. package/dist/lib/testing/seed-merge.mjs.map +1 -1
  645. package/dist/lib/testing/storyboard/agent-routing.mjs +0 -6
  646. package/dist/lib/testing/storyboard/agent-routing.mjs.map +1 -1
  647. package/dist/lib/testing/storyboard/assertions.mjs +0 -6
  648. package/dist/lib/testing/storyboard/assertions.mjs.map +1 -1
  649. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +0 -6
  650. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs.map +1 -1
  651. package/dist/lib/testing/storyboard/compliance.mjs +5 -6
  652. package/dist/lib/testing/storyboard/compliance.mjs.map +1 -1
  653. package/dist/lib/testing/storyboard/context.mjs +0 -6
  654. package/dist/lib/testing/storyboard/context.mjs.map +1 -1
  655. package/dist/lib/testing/storyboard/default-invariants.mjs +0 -6
  656. package/dist/lib/testing/storyboard/default-invariants.mjs.map +1 -1
  657. package/dist/lib/testing/storyboard/index.mjs +0 -6
  658. package/dist/lib/testing/storyboard/index.mjs.map +1 -1
  659. package/dist/lib/testing/storyboard/junit.mjs +0 -6
  660. package/dist/lib/testing/storyboard/junit.mjs.map +1 -1
  661. package/dist/lib/testing/storyboard/loader.mjs +0 -6
  662. package/dist/lib/testing/storyboard/loader.mjs.map +1 -1
  663. package/dist/lib/testing/storyboard/parallel-dispatch.mjs +0 -6
  664. package/dist/lib/testing/storyboard/parallel-dispatch.mjs.map +1 -1
  665. package/dist/lib/testing/storyboard/path.mjs +0 -6
  666. package/dist/lib/testing/storyboard/path.mjs.map +1 -1
  667. package/dist/lib/testing/storyboard/probes.mjs +0 -6
  668. package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
  669. package/dist/lib/testing/storyboard/rate-limit-trip.mjs +0 -6
  670. package/dist/lib/testing/storyboard/rate-limit-trip.mjs.map +1 -1
  671. package/dist/lib/testing/storyboard/rejection-hints.mjs +0 -6
  672. package/dist/lib/testing/storyboard/rejection-hints.mjs.map +1 -1
  673. package/dist/lib/testing/storyboard/request-builder.mjs +0 -6
  674. package/dist/lib/testing/storyboard/request-builder.mjs.map +1 -1
  675. package/dist/lib/testing/storyboard/request-signing/builder.mjs +0 -6
  676. package/dist/lib/testing/storyboard/request-signing/builder.mjs.map +1 -1
  677. package/dist/lib/testing/storyboard/request-signing/grader.mjs +0 -6
  678. package/dist/lib/testing/storyboard/request-signing/grader.mjs.map +1 -1
  679. package/dist/lib/testing/storyboard/request-signing/index.mjs +0 -6
  680. package/dist/lib/testing/storyboard/request-signing/index.mjs.map +1 -1
  681. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +0 -6
  682. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs.map +1 -1
  683. package/dist/lib/testing/storyboard/request-signing/probe.mjs +0 -6
  684. package/dist/lib/testing/storyboard/request-signing/probe.mjs.map +1 -1
  685. package/dist/lib/testing/storyboard/request-signing/synthesize.mjs +0 -6
  686. package/dist/lib/testing/storyboard/request-signing/synthesize.mjs.map +1 -1
  687. package/dist/lib/testing/storyboard/request-signing/test-kit.mjs +0 -6
  688. package/dist/lib/testing/storyboard/request-signing/test-kit.mjs.map +1 -1
  689. package/dist/lib/testing/storyboard/request-signing/types.mjs +0 -6
  690. package/dist/lib/testing/storyboard/request-signing/types.mjs.map +1 -1
  691. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +0 -6
  692. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs.map +1 -1
  693. package/dist/lib/testing/storyboard/runner.mjs +0 -6
  694. package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
  695. package/dist/lib/testing/storyboard/sandbox-entities.mjs +0 -6
  696. package/dist/lib/testing/storyboard/sandbox-entities.mjs.map +1 -1
  697. package/dist/lib/testing/storyboard/seeding.mjs +0 -6
  698. package/dist/lib/testing/storyboard/seeding.mjs.map +1 -1
  699. package/dist/lib/testing/storyboard/shape-drift-hints.mjs +0 -6
  700. package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
  701. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +0 -6
  702. package/dist/lib/testing/storyboard/signer-grader/grader.mjs.map +1 -1
  703. package/dist/lib/testing/storyboard/signer-grader/index.mjs +0 -6
  704. package/dist/lib/testing/storyboard/signer-grader/index.mjs.map +1 -1
  705. package/dist/lib/testing/storyboard/signer-grader/types.mjs +0 -6
  706. package/dist/lib/testing/storyboard/strict-validation-hints.mjs +0 -6
  707. package/dist/lib/testing/storyboard/strict-validation-hints.mjs.map +1 -1
  708. package/dist/lib/testing/storyboard/task-map.mjs +0 -6
  709. package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
  710. package/dist/lib/testing/storyboard/test-kit.mjs +0 -6
  711. package/dist/lib/testing/storyboard/test-kit.mjs.map +1 -1
  712. package/dist/lib/testing/storyboard/types.mjs +0 -6
  713. package/dist/lib/testing/storyboard/types.mjs.map +1 -1
  714. package/dist/lib/testing/storyboard/validations.mjs +0 -6
  715. package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
  716. package/dist/lib/testing/storyboard/webhook-assertions.mjs +0 -6
  717. package/dist/lib/testing/storyboard/webhook-assertions.mjs.map +1 -1
  718. package/dist/lib/testing/storyboard/webhook-receiver.mjs +0 -6
  719. package/dist/lib/testing/storyboard/webhook-receiver.mjs.map +1 -1
  720. package/dist/lib/testing/stubs/governance-agent-stub.mjs +0 -6
  721. package/dist/lib/testing/stubs/governance-agent-stub.mjs.map +1 -1
  722. package/dist/lib/testing/stubs/index.mjs +0 -6
  723. package/dist/lib/testing/stubs/index.mjs.map +1 -1
  724. package/dist/lib/testing/test-controller.mjs +0 -6
  725. package/dist/lib/testing/test-controller.mjs.map +1 -1
  726. package/dist/lib/testing/test-helpers.mjs +0 -6
  727. package/dist/lib/testing/test-helpers.mjs.map +1 -1
  728. package/dist/lib/testing/types.mjs +0 -6
  729. package/dist/lib/types/adcp.mjs +0 -6
  730. package/dist/lib/types/adcp.mjs.map +1 -1
  731. package/dist/lib/types/asset-instances.mjs +0 -6
  732. package/dist/lib/types/compat.mjs +0 -6
  733. package/dist/lib/types/compat.mjs.map +1 -1
  734. package/dist/lib/types/core.generated.mjs +0 -6
  735. package/dist/lib/types/enums.generated.mjs +0 -6
  736. package/dist/lib/types/enums.generated.mjs.map +1 -1
  737. package/dist/lib/types/error-codes.mjs +0 -6
  738. package/dist/lib/types/error-codes.mjs.map +1 -1
  739. package/dist/lib/types/error-details.aliases.mjs +0 -6
  740. package/dist/lib/types/error-details.aliases.mjs.map +1 -1
  741. package/dist/lib/types/format-asset-slots.mjs +0 -6
  742. package/dist/lib/types/forward-compat-error-codes.mjs +0 -6
  743. package/dist/lib/types/forward-compat-error-codes.mjs.map +1 -1
  744. package/dist/lib/types/index.mjs +0 -6
  745. package/dist/lib/types/index.mjs.map +1 -1
  746. package/dist/lib/types/inline-enums.aliases.mjs +0 -6
  747. package/dist/lib/types/inline-enums.aliases.mjs.map +1 -1
  748. package/dist/lib/types/inline-enums.generated.mjs +0 -6
  749. package/dist/lib/types/inline-enums.generated.mjs.map +1 -1
  750. package/dist/lib/types/manifest.generated.mjs +0 -6
  751. package/dist/lib/types/manifest.generated.mjs.map +1 -1
  752. package/dist/lib/types/schemas.generated.mjs +0 -6
  753. package/dist/lib/types/schemas.generated.mjs.map +1 -1
  754. package/dist/lib/types/server-payload-aliases.mjs +0 -6
  755. package/dist/lib/types/server-payload.mjs +0 -6
  756. package/dist/lib/types/sync-rows.mjs +0 -6
  757. package/dist/lib/types/tools.generated.mjs +0 -6
  758. package/dist/lib/types/v2-5/index.mjs +0 -6
  759. package/dist/lib/types/v2-5/index.mjs.map +1 -1
  760. package/dist/lib/types/v2-5/tools.generated.mjs +0 -6
  761. package/dist/lib/types/v3-1-beta/index.mjs +0 -6
  762. package/dist/lib/types/v3-1-beta/index.mjs.map +1 -1
  763. package/dist/lib/types/v3-1-beta/tools.generated.mjs +0 -6
  764. package/dist/lib/types/wellknown-schemas.generated.mjs +0 -6
  765. package/dist/lib/types/wellknown-schemas.generated.mjs.map +1 -1
  766. package/dist/lib/upstream-recorder/constants.mjs +0 -6
  767. package/dist/lib/upstream-recorder/constants.mjs.map +1 -1
  768. package/dist/lib/upstream-recorder/index.mjs +0 -6
  769. package/dist/lib/upstream-recorder/index.mjs.map +1 -1
  770. package/dist/lib/upstream-recorder/recorder.mjs +0 -6
  771. package/dist/lib/upstream-recorder/recorder.mjs.map +1 -1
  772. package/dist/lib/upstream-recorder/types.mjs +0 -6
  773. package/dist/lib/upstream-recorder/types.mjs.map +1 -1
  774. package/dist/lib/utils/a2a-artifacts.mjs +0 -6
  775. package/dist/lib/utils/a2a-artifacts.mjs.map +1 -1
  776. package/dist/lib/utils/a2a-discovery.mjs +0 -6
  777. package/dist/lib/utils/a2a-discovery.mjs.map +1 -1
  778. package/dist/lib/utils/activation-key-builders.mjs +0 -6
  779. package/dist/lib/utils/activation-key-builders.mjs.map +1 -1
  780. package/dist/lib/utils/adcp-version-config.mjs +0 -6
  781. package/dist/lib/utils/adcp-version-config.mjs.map +1 -1
  782. package/dist/lib/utils/asset-builders.mjs +0 -6
  783. package/dist/lib/utils/asset-builders.mjs.map +1 -1
  784. package/dist/lib/utils/build-creative-return-builders.mjs +0 -6
  785. package/dist/lib/utils/build-creative-return-builders.mjs.map +1 -1
  786. package/dist/lib/utils/buyer-retry-policy.mjs +0 -6
  787. package/dist/lib/utils/buyer-retry-policy.mjs.map +1 -1
  788. package/dist/lib/utils/capabilities.mjs +0 -6
  789. package/dist/lib/utils/capabilities.mjs.map +1 -1
  790. package/dist/lib/utils/capability-rollups.mjs +0 -6
  791. package/dist/lib/utils/capability-rollups.mjs.map +1 -1
  792. package/dist/lib/utils/creative-adapter.mjs +0 -6
  793. package/dist/lib/utils/creative-adapter.mjs.map +1 -1
  794. package/dist/lib/utils/creative-delivery.mjs +0 -6
  795. package/dist/lib/utils/creative-delivery.mjs.map +1 -1
  796. package/dist/lib/utils/deprecation.mjs +0 -6
  797. package/dist/lib/utils/deprecation.mjs.map +1 -1
  798. package/dist/lib/utils/envelope-status-compat.mjs +0 -6
  799. package/dist/lib/utils/envelope-status-compat.mjs.map +1 -1
  800. package/dist/lib/utils/error-extraction.mjs +0 -6
  801. package/dist/lib/utils/error-extraction.mjs.map +1 -1
  802. package/dist/lib/utils/extract-result.mjs +0 -6
  803. package/dist/lib/utils/extract-result.mjs.map +1 -1
  804. package/dist/lib/utils/format-asset-slot-builders.mjs +0 -6
  805. package/dist/lib/utils/format-asset-slot-builders.mjs.map +1 -1
  806. package/dist/lib/utils/format-assets.mjs +0 -6
  807. package/dist/lib/utils/format-assets.mjs.map +1 -1
  808. package/dist/lib/utils/format-render-builders.mjs +0 -6
  809. package/dist/lib/utils/format-render-builders.mjs.map +1 -1
  810. package/dist/lib/utils/format-renders.mjs +0 -6
  811. package/dist/lib/utils/format-renders.mjs.map +1 -1
  812. package/dist/lib/utils/get-products-cache-scope.mjs +0 -6
  813. package/dist/lib/utils/get-products-cache-scope.mjs.map +1 -1
  814. package/dist/lib/utils/glob.mjs +0 -6
  815. package/dist/lib/utils/glob.mjs.map +1 -1
  816. package/dist/lib/utils/global-async-local-storage.mjs +0 -6
  817. package/dist/lib/utils/global-async-local-storage.mjs.map +1 -1
  818. package/dist/lib/utils/idempotency.mjs +0 -6
  819. package/dist/lib/utils/idempotency.mjs.map +1 -1
  820. package/dist/lib/utils/index.mjs +0 -6
  821. package/dist/lib/utils/index.mjs.map +1 -1
  822. package/dist/lib/utils/jcs.mjs +0 -6
  823. package/dist/lib/utils/jcs.mjs.map +1 -1
  824. package/dist/lib/utils/json-depth.mjs +0 -6
  825. package/dist/lib/utils/json-depth.mjs.map +1 -1
  826. package/dist/lib/utils/logger.mjs +0 -6
  827. package/dist/lib/utils/logger.mjs.map +1 -1
  828. package/dist/lib/utils/media-buy-delivery-notification-builders.mjs +0 -6
  829. package/dist/lib/utils/media-buy-delivery-notification-builders.mjs.map +1 -1
  830. package/dist/lib/utils/media-buy-status.mjs +0 -6
  831. package/dist/lib/utils/media-buy-status.mjs.map +1 -1
  832. package/dist/lib/utils/pagination.mjs +0 -6
  833. package/dist/lib/utils/pagination.mjs.map +1 -1
  834. package/dist/lib/utils/preview-creative-builders.mjs +0 -6
  835. package/dist/lib/utils/preview-creative-builders.mjs.map +1 -1
  836. package/dist/lib/utils/preview-normalizer.mjs +0 -6
  837. package/dist/lib/utils/preview-normalizer.mjs.map +1 -1
  838. package/dist/lib/utils/preview-utils.mjs +0 -6
  839. package/dist/lib/utils/preview-utils.mjs.map +1 -1
  840. package/dist/lib/utils/pricing-adapter.mjs +0 -6
  841. package/dist/lib/utils/pricing-adapter.mjs.map +1 -1
  842. package/dist/lib/utils/probe-policy.mjs +0 -6
  843. package/dist/lib/utils/probe-policy.mjs.map +1 -1
  844. package/dist/lib/utils/protocol-detection.mjs +0 -6
  845. package/dist/lib/utils/protocol-detection.mjs.map +1 -1
  846. package/dist/lib/utils/redact-secrets.mjs +0 -6
  847. package/dist/lib/utils/redact-secrets.mjs.map +1 -1
  848. package/dist/lib/utils/redis-default-prefix-warn.mjs +0 -6
  849. package/dist/lib/utils/redis-default-prefix-warn.mjs.map +1 -1
  850. package/dist/lib/utils/render-builders.mjs +0 -6
  851. package/dist/lib/utils/render-builders.mjs.map +1 -1
  852. package/dist/lib/utils/request-normalizer.mjs +0 -6
  853. package/dist/lib/utils/request-normalizer.mjs.map +1 -1
  854. package/dist/lib/utils/response-schemas.mjs +0 -6
  855. package/dist/lib/utils/response-schemas.mjs.map +1 -1
  856. package/dist/lib/utils/response-unwrapper.mjs +0 -6
  857. package/dist/lib/utils/response-unwrapper.mjs.map +1 -1
  858. package/dist/lib/utils/retry.mjs +0 -6
  859. package/dist/lib/utils/retry.mjs.map +1 -1
  860. package/dist/lib/utils/signal-discovery-helpers.mjs +0 -6
  861. package/dist/lib/utils/signal-discovery-helpers.mjs.map +1 -1
  862. package/dist/lib/utils/signal-id-builders.mjs +0 -6
  863. package/dist/lib/utils/signal-id-builders.mjs.map +1 -1
  864. package/dist/lib/utils/sync-creatives-adapter.mjs +0 -6
  865. package/dist/lib/utils/sync-creatives-adapter.mjs.map +1 -1
  866. package/dist/lib/utils/task-state.mjs +0 -6
  867. package/dist/lib/utils/task-state.mjs.map +1 -1
  868. package/dist/lib/utils/tool-request-schemas.mjs +0 -6
  869. package/dist/lib/utils/tool-request-schemas.mjs.map +1 -1
  870. package/dist/lib/utils/typeGuards.mjs +0 -6
  871. package/dist/lib/utils/typeGuards.mjs.map +1 -1
  872. package/dist/lib/utils/union-errors.mjs +0 -6
  873. package/dist/lib/utils/union-errors.mjs.map +1 -1
  874. package/dist/lib/utils/validate-user-agent.mjs +0 -6
  875. package/dist/lib/utils/validate-user-agent.mjs.map +1 -1
  876. package/dist/lib/v2/format-schema/fetch.mjs +0 -6
  877. package/dist/lib/v2/format-schema/fetch.mjs.map +1 -1
  878. package/dist/lib/v2/format-schema/index.mjs +0 -6
  879. package/dist/lib/v2/format-schema/index.mjs.map +1 -1
  880. package/dist/lib/v2/format-schema/regex-safety.mjs +0 -6
  881. package/dist/lib/v2/format-schema/regex-safety.mjs.map +1 -1
  882. package/dist/lib/v2/format-schema/resolver.mjs +7 -8
  883. package/dist/lib/v2/format-schema/resolver.mjs.map +1 -1
  884. package/dist/lib/v2/format-schema/sandbox-refs.mjs +0 -6
  885. package/dist/lib/v2/format-schema/sandbox-refs.mjs.map +1 -1
  886. package/dist/lib/v2/projection/augment-response.mjs +0 -6
  887. package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
  888. package/dist/lib/v2/projection/builders.mjs +0 -6
  889. package/dist/lib/v2/projection/builders.mjs.map +1 -1
  890. package/dist/lib/v2/projection/cache-versions.mjs +0 -6
  891. package/dist/lib/v2/projection/cache-versions.mjs.map +1 -1
  892. package/dist/lib/v2/projection/canonical-properties.mjs +5 -6
  893. package/dist/lib/v2/projection/canonical-properties.mjs.map +1 -1
  894. package/dist/lib/v2/projection/catalog.mjs +5 -6
  895. package/dist/lib/v2/projection/catalog.mjs.map +1 -1
  896. package/dist/lib/v2/projection/constants.mjs +0 -6
  897. package/dist/lib/v2/projection/constants.mjs.map +1 -1
  898. package/dist/lib/v2/projection/index.mjs +0 -6
  899. package/dist/lib/v2/projection/index.mjs.map +1 -1
  900. package/dist/lib/v2/projection/registry.mjs +5 -6
  901. package/dist/lib/v2/projection/registry.mjs.map +1 -1
  902. package/dist/lib/v2/projection/types.mjs +0 -6
  903. package/dist/lib/v2/projection/v1-to-v2.mjs +0 -6
  904. package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
  905. package/dist/lib/v2/projection/v2-to-v1.mjs +0 -6
  906. package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
  907. package/dist/lib/v2/projection/write-side.mjs +0 -6
  908. package/dist/lib/v2/projection/write-side.mjs.map +1 -1
  909. package/dist/lib/v2/publisher-catalog/formats.mjs +0 -6
  910. package/dist/lib/v2/publisher-catalog/formats.mjs.map +1 -1
  911. package/dist/lib/v2/publisher-catalog/index.mjs +0 -6
  912. package/dist/lib/v2/publisher-catalog/index.mjs.map +1 -1
  913. package/dist/lib/validation/client-hooks.mjs +0 -6
  914. package/dist/lib/validation/client-hooks.mjs.map +1 -1
  915. package/dist/lib/validation/hints.mjs +0 -6
  916. package/dist/lib/validation/hints.mjs.map +1 -1
  917. package/dist/lib/validation/index.mjs +0 -6
  918. package/dist/lib/validation/index.mjs.map +1 -1
  919. package/dist/lib/validation/schema-errors.mjs +0 -6
  920. package/dist/lib/validation/schema-errors.mjs.map +1 -1
  921. package/dist/lib/validation/schema-loader.mjs +5 -6
  922. package/dist/lib/validation/schema-loader.mjs.map +1 -1
  923. package/dist/lib/validation/schema-validator.mjs +0 -6
  924. package/dist/lib/validation/schema-validator.mjs.map +1 -1
  925. package/dist/lib/validation/sync-creatives.mjs +0 -6
  926. package/dist/lib/validation/sync-creatives.mjs.map +1 -1
  927. package/dist/lib/version.d.mts +3 -3
  928. package/dist/lib/version.d.ts +3 -3
  929. package/dist/lib/version.js +3 -3
  930. package/dist/lib/version.js.map +1 -1
  931. package/dist/lib/version.mjs +3 -9
  932. package/dist/lib/version.mjs.map +1 -1
  933. package/dist/lib/webhooks/index.mjs +0 -6
  934. package/dist/lib/webhooks/index.mjs.map +1 -1
  935. package/dist/lib/wholesale-feed-sync/index.mjs +0 -6
  936. package/dist/lib/wholesale-feed-sync/index.mjs.map +1 -1
  937. package/dist/lib/wholesale-feed-sync/sync.mjs +0 -6
  938. package/dist/lib/wholesale-feed-sync/sync.mjs.map +1 -1
  939. package/dist/lib/wholesale-feed-sync/types.mjs +0 -6
  940. package/dist/lib/wholesale-feed-sync/webhook-notification.mjs +0 -6
  941. package/dist/lib/wholesale-feed-sync/webhook-notification.mjs.map +1 -1
  942. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/server/decisioning/buyer-agent.ts"],"sourcesContent":["/**\n * Buyer-agent identity surface from #1269 / #1292.\n *\n * Models a buyer agent (the buying entity calling a seller) as a durable\n * commercial relationship in the seller's records, distinct from the\n * per-request credential that proves identity. The seller's `BuyerAgent`\n * record carries onboarding state (status, billing capabilities, default\n * account terms, allowed brands) that drives commercial behavior.\n *\n * The credential answers \"who signed?\" / \"who holds this token?\" The\n * `BuyerAgent` answers \"who is this counterparty in our books?\" — analogous\n * to how an SSP has a `buyer_id` row keyed to a DSP regardless of whether\n * the DSP authenticates via OAuth, signed requests, or a pre-shared API\n * key. Token proves identity; row drives commercial behavior.\n *\n * AdCP 3.1 framework paths consume the resolved record for status,\n * sandbox-only, and `sync_accounts.billing` enforcement.\n *\n * @public\n */\n\nimport type { BillingParty, BusinessEntity, PaymentTerms } from '../../types/tools.generated';\n\n/**\n * Wire billing-party enum re-exported here for the registry surface.\n * Aliased to `BillingMode` in design discussion (#1269); `BillingParty` is\n * the canonical wire-schema name.\n *\n * @public\n */\nexport type BuyerAgentBillingMode = BillingParty;\n\n/**\n * Kind-discriminated credential variant on `ResolvedAuthInfo.credential`.\n *\n * `kind: 'http_sig'` is cryptographically verified — `agent_url` derives\n * from the `agents[]` entry whose `jwks_uri` resolved the keyid (per\n * adcontextprotocol/adcp#3831), NOT from JWK / JWS / envelope claims.\n * Security-relevant decisions (mutating-tool authorization, brand-side\n * authorization checks once `BrandAuthorizationResolver` lands) MUST read\n * `agent_url` from this variant, not from any informational field elsewhere\n * on `ResolvedAuthInfo`.\n *\n * `kind: 'api_key'` and `kind: 'oauth'` carry no `agent_url` on the\n * credential — the agent identity comes from the registry's\n * `resolveByCredential` lookup against the seller's onboarding record.\n *\n * @public\n */\nexport type AdcpCredential =\n | { readonly kind: 'api_key'; readonly key_id: string }\n | {\n readonly kind: 'oauth';\n readonly client_id: string;\n readonly scopes: readonly string[];\n readonly expires_at?: number;\n }\n | { readonly kind: 'http_sig'; readonly keyid: string; readonly agent_url: string; readonly verified_at: number };\n\n/**\n * Status of a buyer-agent record. Drives framework-level request gating:\n *\n * - `'active'` — normal operation; requests dispatch.\n * - `'suspended'` — temporarily paused; new requests rejected with\n * `AGENT_SUSPENDED` (recovery: `terminal`). In-flight tasks are NOT\n * retroactively cancelled — webhooks fire, status updates flow.\n * Sellers who need hard cutoff implement that in their platform method\n * via `BuyerAgent.status` check.\n * - `'blocked'` — permanently denied; new requests rejected with\n * `AGENT_BLOCKED` (recovery: `terminal`). Lifting requires re-onboarding\n * under a new agent identity.\n *\n * Both `AGENT_SUSPENDED` and `AGENT_BLOCKED` are terminal at the wire level\n * (the buyer cannot recover by retrying the same request). The transient-\n * vs-permanent distinction lives in the seller's `BuyerAgent.status` record\n * — suspension may lift via re-onboarding, blocked does not.\n *\n * Adopted from AdCP 3.1 spec PR adcp#3906, which consolidated the 3.0.5\n * placeholder shape `PERMISSION_DENIED + details.scope:'agent' + details.status`\n * into the dedicated codes.\n *\n * @public\n */\nexport type BuyerAgentStatus = 'active' | 'suspended' | 'blocked';\n\n/**\n * Buyer-agent record — durable commercial relationship in the seller's\n * onboarding ledger. Returned by `BuyerAgentRegistry.resolve` and threaded\n * to handlers via `ctx.agent`.\n *\n * Fields are `readonly` to prevent post-resolution mutation that would\n * silently affect downstream `accounts.resolve` decisions. Mirrors the\n * Python frozen-dataclass shape for cross-language parity.\n *\n * @public\n */\nexport interface BuyerAgent {\n /**\n * Canonical agent URL. Treat like a public key: stable enough that\n * rotation requires explicit re-onboarding. The framework's signed-path\n * resolution checks both this canonical URL and any `aliases[]` against\n * the verified `credential.agent_url`. No separate seller-internal id —\n * adopters who want one mint it in their own DB and key off `agent_url`.\n */\n readonly agent_url: string;\n\n /** Human-readable name for ops / reporting / UI. */\n readonly display_name: string;\n\n /** See {@link BuyerAgentStatus}. */\n readonly status: BuyerAgentStatus;\n\n /**\n * Billing models this agent is permitted to request on `sync_accounts`.\n * Set-valued so real-world models (mixed-billing holdco with both direct\n * and agency-mediated brands) can be expressed without picking one mode.\n *\n * Migration from earlier single-enum sketches:\n * - `passthrough_only` ↔ `new Set(['operator'])`\n * - `agent_billable` ↔ `new Set(['agent', 'operator', 'advertiser'])`\n *\n * The framework enforces this set on `sync_accounts` in AdCP 3.1\n * deployments and returns `BILLING_NOT_PERMITTED_FOR_AGENT` with a\n * clamped details shape when the requested billing value is outside it.\n */\n readonly billing_capabilities: ReadonlySet<BuyerAgentBillingMode>;\n\n /**\n * Commercial defaults applied when accounts are provisioned under this\n * agent. Framework merges with per-request overrides on a SPARSE-MERGE\n * basis: per-request values win for any present field including explicit\n * `null`. The request is the authoritative current intent; defaults are\n * seeds for fields the buyer didn't speak to. Adopters who want\n * non-null-override semantics pre-filter nulls themselves.\n */\n readonly default_account_terms?: {\n readonly rate_card?: string;\n readonly payment_terms?: PaymentTerms;\n readonly credit_limit?: { readonly amount: number; readonly currency: string };\n readonly billing_entity?: BusinessEntity;\n };\n\n /**\n * Static allowlist of brand domains this agent may act for. Pre-RFC\n * stand-in for the per-request authorization check that\n * `BrandAuthorizationResolver` will perform once it lands (gated on\n * Python's RFC + adcp brand-side authz spec finalizing).\n *\n * When both this list and `BrandAuthorizationResolver` are configured,\n * the framework AND-composes them: registry says \"we accept this agent\n * at all\"; resolver says \"and they're authorized for THIS brand.\" One-\n * minor deprecation cycle starts the release after\n * `BrandAuthorizationResolver` ships; sellers who want the static gate\n * gone stop populating the field.\n */\n readonly allowed_brands?: readonly string[];\n\n /**\n * Optional grace-period overlap during `agent_url` rotation. Framework's\n * signed-path resolution checks both canonical `agent_url` AND `aliases`\n * against the `agents[]` entry that resolved the verified keyid.\n *\n * v1 ships with the field present but no special framework behavior\n * beyond resolution; v1.5 adds the documented sunset window pattern.\n * Most adopters never populate this.\n */\n readonly aliases?: readonly string[];\n\n /**\n * When `true`, this buyer agent may ONLY operate against sandbox\n * accounts. The framework rejects any request whose resolved\n * `Account.sandbox !== true` with `PERMISSION_DENIED`,\n * `error.details.scope: 'agent'`, `error.details.reason: 'sandbox-only'`.\n *\n * Defense-in-depth for test agents (CI runners, internal QA agents,\n * partner pre-prod environments): if the test credential leaks, blast\n * radius is bounded to sandbox accounts. Production agents leave this\n * unset (or `false`).\n *\n * Composes with `Account.sandbox` (the wire-level sandbox marker on\n * the resolved Account record): the gate fires when `agent.sandbox_only\n * === true AND ctx.account?.sandbox !== true`. Account-less tools\n * (`provide_performance_feedback`, `list_creative_formats`, etc.) pass\n * the gate — they don't operate on a specific account, so the\n * sandbox/production axis doesn't apply.\n *\n * **Load-bearing pair.** For the gate to admit ANY traffic from a\n * `sandbox_only` agent, the seller's `accounts.resolve` MUST return\n * `sandbox: true` on the accounts that agent should reach. Adopters\n * cloning the worked example with `sandbox_only: true` on their seed\n * agent and a hardcoded `sandbox: true` resolver are demoware-correct;\n * production adopters either flip the agent to `sandbox_only: false`\n * OR have their resolver return `sandbox: true` only for actually-\n * sandbox accounts. Mismatches between these two sides 403 every\n * request — failure is loud, not silent.\n *\n * Default `false` (or undefined) — production-allowed.\n */\n readonly sandbox_only?: boolean;\n}\n\nconst BILLING_SUGGESTION_ORDER: readonly BuyerAgentBillingMode[] = ['operator', 'advertiser', 'agent'];\n\n/**\n * Pick the single autonomous-retry billing value exposed on\n * `BILLING_NOT_PERMITTED_FOR_AGENT.details.suggested_billing`.\n *\n * The details schema intentionally allows only one suggestion, not the\n * agent's full permitted set. Preference is the spec-discussed commercial\n * fallback order: operator > advertiser > agent.\n *\n * @public\n */\nexport function suggestBilling(\n billingCapabilities: ReadonlySet<BuyerAgentBillingMode>,\n rejected: BuyerAgentBillingMode\n): BuyerAgentBillingMode | undefined {\n for (const mode of BILLING_SUGGESTION_ORDER) {\n if (mode !== rejected && billingCapabilities.has(mode)) return mode;\n }\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Registry Protocol + factory functions\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal `ResolvedAuthInfo`-shaped argument to `BuyerAgentRegistry.resolve`.\n * Defined here to break a circular dependency with `account.ts` and to keep\n * the registry surface decoupled from the legacy `ResolvedAuthInfo` shape\n * during the two-minor migration cycle.\n *\n * Stage 3 of the implementation will widen `ResolvedAuthInfo` itself with\n * the `credential` field; this interface is the registry-side contract.\n *\n * @public\n */\nexport interface BuyerAgentResolveInput {\n /**\n * The kind-discriminated credential proven on the request. Stage 3 of\n * the Phase 1 implementation will populate this from the verifier\n * (`http_sig`) or from the legacy `ResolvedAuthInfo` shape (`api_key` /\n * `oauth`); until then, callers pass it through directly when available.\n *\n * When absent, the registry's `resolve` returns `null` — the legacy-\n * shape synthesis lands in Stage 3 alongside the `ResolvedAuthInfo`\n * migration shim, not Stage 1.\n */\n readonly credential?: AdcpCredential;\n\n /**\n * Adopter-provided extension data threaded from `authenticate()`. Populated\n * from the `extra` field stamped on the `AuthPrincipal` returned by the\n * `authenticate()` callback (e.g. `verifyApiKey({ verify: token => ({ ...,\n * extra: { demo_token: token } }) })`). Forwarded to the second argument of\n * {@link ResolveBuyerAgentByCredential} by `bearerOnly` and `mixed` factories.\n *\n * The full MCP `AuthInfo.extra` bag is forwarded here — it includes JWT\n * claims (if `verifyBearer` was used) and the SDK-internal `credential` key\n * alongside adopter-stamped fields. Do not use reserved key names (`credential`,\n * `iss`, `sub`, `aud`, `exp`, `iat`, `nbf`, `jti`) in the `extra` object\n * to avoid collisions.\n */\n readonly extra?: Record<string, unknown>;\n\n /**\n * Raw AdCP request parameters for the current tool call, after transport\n * decoding and before handler dispatch. Registry implementations normally\n * key only on `credential`, but compliance-controller overlays may need the\n * request `context.session_id` or `account` to resolve a scoped test\n * commercial state for this request.\n */\n readonly input?: Record<string, unknown>;\n}\n\n/**\n * Buyer-agent registry — durable identity surface called once per request\n * before `accounts.resolve`. Adopters construct via one of the factory\n * functions; the resulting object exposes a single `resolve` method the\n * framework dispatcher invokes.\n *\n * Three implementer postures, encoded at construction:\n *\n * - {@link signingOnly} — production target. Bearer/API-key/OAuth requests\n * refused at the registry layer; signed requests resolve via\n * `resolveByAgentUrl` against the verified `credential.agent_url`.\n * - {@link bearerOnly} — pre-trust beta. No signature support; bearer-shaped\n * credentials resolve via `resolveByCredential` against the seller's\n * onboarding ledger.\n * - {@link mixed} — transition. Both paths active. Signed traffic resolves\n * cryptographically; bearer falls through to the legacy key table.\n *\n * The factories produce a `BuyerAgentRegistry` whose `resolve` method\n * routes by `credential.kind` and returns `null` when the credential is\n * not honored by the configured posture (e.g., bearer credential against\n * a `signingOnly` registry → `null`, framework rejects the request).\n *\n * @public\n */\nexport interface BuyerAgentRegistry {\n /**\n * Resolve a request's credential to a buyer-agent record.\n *\n * Returns `null` when the credential is not recognized OR when the\n * configured posture rejects the credential's kind (e.g., `bearerOnly`\n * registry receiving an `http_sig` credential).\n *\n * Throws when the underlying lookup fails (DB outage, identity-provider\n * 5xx). Framework projects the throw to `SERVICE_UNAVAILABLE` so the\n * buyer can retry; the inner error is logged server-side.\n */\n resolve(authInfo: BuyerAgentResolveInput): Promise<BuyerAgent | null>;\n}\n\n/**\n * Resolver function type for the signed path. Receives the\n * cryptographically-verified `agent_url` from the request signature and\n * returns the seller's record (or `null` for unrecognized agents).\n *\n * @public\n */\nexport type ResolveBuyerAgentByAgentUrl = (agent_url: string) => Promise<BuyerAgent | null>;\n\n/**\n * Resolver function type for the bearer/API-key/OAuth path. Receives the\n * raw credential and (optionally) adopter-provided extension data, and\n * returns the seller's record (or `null` for unrecognized credentials).\n *\n * **Implementations MUST switch on `credential.kind`** and reject (return\n * `null`) on any kind they don't explicitly recognize. A naive\n * `WHERE token = $1` lookup against an api-key table would otherwise mis-\n * resolve when handed an `http_sig` credential whose `keyid` happens to\n * collide with an existing api-key value — the credential variants share\n * no key namespace, and the registry MUST NOT bridge them.\n *\n * **Credential exposure.** This callback receives unredacted credential\n * payloads (token, key_id, client_id). Adopters MUST NOT log raw credential\n * values AND MUST NOT include them in thrown `Error` messages — the\n * framework projects `err.message` into `error.details.reason` on the wire\n * when `exposeErrorDetails` is on (default: non-production). Throw with\n * a generic message and log the credential separately if you need it for\n * server-side debugging. The framework redacts credential payloads in any\n * log line emitted from registry-resolution code (Stage 4); adopter\n * implementations are expected to do the same (or to use prepared-statement\n * parameters that don't log).\n *\n * **`extra` — adopter extension data.** When the `authenticate()` callback\n * stamps an `extra` field on the returned `AuthPrincipal` (e.g.\n * `verifyApiKey({ verify: token => ({ principal, extra: { demo_token: token } }) })`),\n * the framework propagates that value through `ResolvedAuthInfo.extra` to\n * this second argument. Use it to carry pre-hash data your authenticator\n * already derived (prefix patterns, tenant IDs, test-kit flags) that you\n * can't recover from the hashed `key_id`. Apply the same care as for\n * `credential`: do not log raw values from `extra` or include them in\n * thrown `Error` messages.\n *\n * Existing single-argument implementations `(credential) => ...` satisfy\n * this type — the second argument is optional.\n *\n * @public\n */\nexport type ResolveBuyerAgentByCredential = (\n credential: AdcpCredential,\n extra?: Record<string, unknown>,\n input?: Record<string, unknown>\n) => Promise<BuyerAgent | null>;\n\n/**\n * Belt-and-suspenders check that an `http_sig` credential carries a non-\n * empty `agent_url`. A misbehaving authenticator could produce `kind:\n * 'http_sig'` without populating the verified URL — without this guard, the\n * registry would pass `undefined` (or `''`) to the adopter's resolver and\n * silently get back `null`. Caller is responsible for the kind dispatch;\n * this function only validates the http_sig payload shape.\n */\nfunction isVerifiedHttpSigPayload(credential: { agent_url?: string }): credential is { agent_url: string } {\n return typeof credential.agent_url === 'string' && credential.agent_url.length > 0;\n}\n\n/**\n * Module-private symbol used as a provenance brand on verifier-produced\n * `http_sig` credentials. NOT registered via `Symbol.for(...)` — code\n * outside this module cannot synthesize the symbol value, which is what\n * makes it a usable provenance check.\n *\n * The brand is non-enumerable so it's invisible to `JSON.stringify`,\n * `Object.keys`, spread, and structured-clone — meaning a credential\n * that crosses a serialization boundary loses its brand. For the\n * security model that's correct: a hostile relay or replay strips the\n * brand and the registry refuses to treat the credential as verified.\n *\n * Only `markVerifiedHttpSig` (called by the framework's signature\n * verifier in `src/lib/server/auth-signature.ts`) attaches the brand.\n * Custom `authenticate` callbacks that synthesize a literal-shape\n * `{ kind: 'http_sig', ... }` credential will NOT carry the brand —\n * `signingOnly` and `mixed` registry factories reject those.\n */\nconst VERIFIED_HTTP_SIG_BRAND: unique symbol = Symbol('@adcp/sdk.verifiedHttpSig');\n\ntype VerifiedHttpSig = Extract<AdcpCredential, { kind: 'http_sig' }> & {\n readonly [VERIFIED_HTTP_SIG_BRAND]: true;\n};\n\n/**\n * Brand an `http_sig` credential as verifier-produced. Only the framework's\n * signature verifier (`verifySignatureAsAuthenticator`) calls this; the\n * brand is the registry's proof that the credential's `agent_url` was\n * cryptographically verified per adcontextprotocol/adcp#3831.\n *\n * Returned object is a fresh shallow copy — the input is not mutated.\n *\n * @internal — exported for `auth-signature.ts` only; not part of the\n * adopter surface.\n */\nexport function markVerifiedHttpSig(\n credential: Extract<AdcpCredential, { kind: 'http_sig' }>\n): Extract<AdcpCredential, { kind: 'http_sig' }> {\n const branded = { ...credential };\n Object.defineProperty(branded, VERIFIED_HTTP_SIG_BRAND, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return branded as VerifiedHttpSig;\n}\n\n/**\n * Predicate the registry factories use to distinguish verifier-produced\n * `http_sig` credentials from literal-shape impostors. Returns true ONLY\n * when the credential was produced by the framework's signature verifier\n * (or another caller that imported the symbol from this module — there\n * are none).\n */\nfunction isVerifiedHttpSig(credential: AdcpCredential): boolean {\n return credential.kind === 'http_sig' && (credential as Record<symbol, unknown>)[VERIFIED_HTTP_SIG_BRAND] === true;\n}\n\n/**\n * Construct a signing-only `BuyerAgentRegistry`. Bearer/API-key/OAuth\n * requests resolve to `null` (framework rejects); only signed requests\n * are honored.\n *\n * The path-of-least-resistance factory for production sellers — implement\n * one resolver, traffic that doesn't sign is automatically refused.\n *\n * @public\n */\nexport function signingOnly(opts: { resolveByAgentUrl: ResolveBuyerAgentByAgentUrl }): BuyerAgentRegistry {\n if (typeof opts.resolveByAgentUrl !== 'function') {\n throw new TypeError('BuyerAgentRegistry.signingOnly: resolveByAgentUrl must be a function');\n }\n const resolveByAgentUrl = opts.resolveByAgentUrl;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n if (credential === undefined || credential.kind !== 'http_sig') return null;\n // Reject literal-shape http_sig credentials: only the framework's\n // signature verifier brands a credential as verified. A custom\n // `authenticate` callback that synthesizes `{ kind: 'http_sig', ... }`\n // from arbitrary data would otherwise be routed as if cryptographically\n // verified — the brand check closes that forgery vector.\n if (!isVerifiedHttpSig(credential)) return null;\n if (!isVerifiedHttpSigPayload(credential)) return null;\n return resolveByAgentUrl(credential.agent_url);\n },\n };\n}\n\n/**\n * Construct a bearer-only `BuyerAgentRegistry`. Signed requests still\n * authenticate via the existing signature-verifier surface, but the\n * registry resolves all credential kinds via `resolveByCredential` against\n * the seller's onboarding ledger — useful in pre-trust-beta deployments\n * where the seller maintains a credential→agent table out-of-band.\n *\n * @public\n */\nexport function bearerOnly(opts: { resolveByCredential: ResolveBuyerAgentByCredential }): BuyerAgentRegistry {\n if (typeof opts.resolveByCredential !== 'function') {\n throw new TypeError('BuyerAgentRegistry.bearerOnly: resolveByCredential must be a function');\n }\n const resolveByCredential = opts.resolveByCredential;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n const extra = authInfo.extra;\n if (credential === undefined) return null;\n return resolveByCredential(credential, extra, authInfo.input);\n },\n };\n}\n\n/**\n * Construct a mixed-mode `BuyerAgentRegistry` that supports both signed and\n * bearer/OAuth/API-key credentials. Signed traffic resolves through\n * `resolveByAgentUrl` against the verified `credential.agent_url`; non-\n * signed credentials fall through to `resolveByCredential`.\n *\n * Framework prefers the signed path: when both an `Authorization: Bearer`\n * and a valid `Signature: ...` are present on the same request, the\n * `http_sig` credential variant is what reaches `resolve`, and only\n * `resolveByAgentUrl` is invoked. The bearer path is never consulted on\n * signed traffic.\n *\n * @public\n */\nexport function mixed(opts: {\n resolveByAgentUrl: ResolveBuyerAgentByAgentUrl;\n resolveByCredential: ResolveBuyerAgentByCredential;\n}): BuyerAgentRegistry {\n if (typeof opts.resolveByAgentUrl !== 'function') {\n throw new TypeError('BuyerAgentRegistry.mixed: resolveByAgentUrl must be a function');\n }\n if (typeof opts.resolveByCredential !== 'function') {\n throw new TypeError('BuyerAgentRegistry.mixed: resolveByCredential must be a function');\n }\n const resolveByAgentUrl = opts.resolveByAgentUrl;\n const resolveByCredential = opts.resolveByCredential;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n const extra = authInfo.extra;\n if (credential === undefined) return null;\n if (credential.kind === 'http_sig') {\n // Same forgery clamp as `signingOnly`: only verifier-branded\n // http_sig credentials route through the signed path.\n if (!isVerifiedHttpSig(credential)) return null;\n // Reject a malformed `http_sig` credential here rather than falling\n // through to resolveByCredential. Otherwise `mixed` would be strictly\n // weaker than signingOnly: an authenticator that produces an\n // http_sig-shaped credential without a verified agent_url could\n // bypass signed-path enforcement by routing through the bearer table.\n if (!isVerifiedHttpSigPayload(credential)) return null;\n return resolveByAgentUrl(credential.agent_url);\n }\n return resolveByCredential(credential, extra, authInfo.input);\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Caching decorator — Phase 1 Stage 5 of #1269\n// ---------------------------------------------------------------------------\n\n/**\n * Options for {@link cached}.\n *\n * @public\n */\nexport interface BuyerAgentCacheOptions {\n /**\n * TTL (seconds) for successful resolutions. Default: 60.\n *\n * Adopters whose registry sits in front of a Postgres / external lookup\n * benefit from caching for the request lifecycle of a single buyer's\n * traffic burst. Long TTLs (several minutes) are appropriate for\n * stable agent records; short TTLs (a few seconds) for rapidly-mutating\n * relationships (suspension flags, billing-capability changes).\n *\n * Status changes propagate within `ttlSeconds` of the seller flipping\n * the agent's row in their store — adopters needing instant\n * propagation either set a short TTL or invalidate the cache out-of-\n * band when they mutate.\n */\n ttlSeconds?: number;\n\n /**\n * TTL (seconds) for `null` returns (negative cache). Default: 0\n * (don't cache nulls). A freshly onboarded agent is recognized within\n * one request when nulls aren't cached; sellers willing to delay\n * recognition by N seconds in exchange for fewer DB hits set this to\n * a small positive value.\n *\n * **Timing-oracle note.** When null caching is enabled, an\n * unauthenticated prober comparing hit vs. miss latency on null\n * returns can infer \"this credential was probed recently.\" Pair with\n * rate-limiting at the edge if your deployment runs in a hostile\n * environment. The default (0) avoids the oracle entirely.\n */\n cacheNullsTtlSeconds?: number;\n\n /**\n * Maximum cache entries before LRU eviction. Default: 10000.\n * The cache is bounded so a malicious or misconfigured caller spamming\n * unique credentials (e.g., random api keys probing the seller's\n * onboarding surface) can't exhaust memory.\n */\n maxSize?: number;\n\n /** Override clock for deterministic tests. Returns ms since epoch. */\n now?: () => number;\n}\n\ninterface CacheEntry {\n value: BuyerAgent | null;\n expiresAtMs: number;\n}\n\n/**\n * Cached registry surface. Strict superset of {@link BuyerAgentRegistry}\n * with explicit invalidation hooks adopters call when they mutate the\n * backing record (status flip, billing-capability change). Without\n * `invalidate`, adopters could only purge stale entries by waiting for\n * `ttlSeconds` to expire — for status changes that's exactly the\n * window during which a now-suspended agent retains access.\n *\n * `BuyerAgentRegistry.cached(...)` returns this richer type so adopters\n * can hold a reference and call the invalidation methods directly.\n *\n * @public\n */\nexport interface CachedBuyerAgentRegistry extends BuyerAgentRegistry {\n /**\n * Drop the cache entry for a single credential. No-op when the\n * credential isn't currently cached. Use this when the agent's\n * record is mutated in your backing store so the next request\n * re-resolves rather than serving the stale entry.\n */\n invalidate(credential: AdcpCredential): void;\n\n /**\n * Drop all cached entries. Use on bulk record mutations (onboarding-\n * record migration, daily reset) or test-environment cleanup.\n */\n clear(): void;\n}\n\n/**\n * Compute a cache key from a credential. Returns null when the\n * credential is undefined — uncacheable, falls through to the inner\n * registry on each call. Keys are namespaced by kind so an api_key\n * `key_id` value can never collide with an http_sig `keyid` value or\n * an oauth `client_id`. Note that `key_id` is already a stable hash\n * (Stage 3); using it as a cache key is safe.\n */\nfunction cacheKeyForCredential(credential: AdcpCredential | undefined): string | null {\n if (credential === undefined) return null;\n switch (credential.kind) {\n case 'http_sig':\n return `http_sig:${credential.agent_url}`;\n case 'api_key':\n return `api_key:${credential.key_id}`;\n case 'oauth':\n return `oauth:${credential.client_id}`;\n default: {\n // Exhaustiveness check — adding a new credential kind without\n // updating this switch produces a compile error here, not a\n // runtime cache-miss bug.\n const _exhaustive: never = credential;\n void _exhaustive;\n return null;\n }\n }\n}\n\n/**\n * Wrap a {@link BuyerAgentRegistry} with TTL-based result caching and\n * concurrent-resolve coalescing. Adopters whose `resolveByAgentUrl` /\n * `resolveByCredential` hit a database or external service compose\n * the cache via:\n *\n * ```ts\n * const registry = BuyerAgentRegistry.cached(\n * BuyerAgentRegistry.signingOnly({\n * resolveByAgentUrl: async url => db.findBuyerAgent(url),\n * }),\n * { ttlSeconds: 60 }\n * );\n * ```\n *\n * Cache properties:\n * - **TTL-bounded.** Entries expire after `ttlSeconds` (default 60).\n * Negative cache (null returns) is opt-in via `cacheNullsTtlSeconds`.\n * - **LRU-evicted.** Bounded to `maxSize` entries (default 10000).\n * Oldest-accessed entry evicts on overflow.\n * - **Concurrent-resolve coalesced.** N parallel `resolve()` calls on\n * the same key produce ONE upstream invocation. Subsequent callers\n * await the in-flight promise — important when the seller front-ends\n * a slow upstream and a buyer burst arrives.\n * - **Per-kind cache keys.** Keys are namespaced (`http_sig:`,\n * `api_key:`, `oauth:`) so cross-kind collisions cannot leak an agent\n * resolved through one credential type to a different type.\n * - **`extra` is not part of the cache key.** The cache keys on credential\n * identity only. Two requests with the same credential but different\n * `authInfo.extra` content return the same cached result. This is the\n * right behaviour when `extra` carries pre-hash data derived from the\n * same token (the motivating use-case), but can be surprising if you\n * put per-request session context in `extra`. Set a short `ttlSeconds`\n * or skip the cache decorator if your resolution is sensitive to `extra`\n * variance across requests with the same credential.\n * - **Skips uncacheable inputs.** When the credential is undefined,\n * `resolve()` falls through to the inner registry on each call —\n * adopters wiring custom auth without `credential` synthesis (Stage 3\n * migration cycle) see no behavior change.\n * - **Explicit invalidation.** Returns a {@link CachedBuyerAgentRegistry}\n * with `.invalidate(credential)` and `.clear()` methods. Call\n * `invalidate` when you mutate an agent's record (status flip,\n * billing-capability change) so the next request re-resolves rather\n * than serving the stale entry. Without this, the stale-status window\n * is bounded by `ttlSeconds` — a now-suspended agent retains access\n * for up to that long.\n *\n * Mirrors the `AsyncCachingJwksResolver` over `JwksResolver` pattern\n * already in `src/lib/signing/`.\n *\n * @public\n */\nexport function cached(inner: BuyerAgentRegistry, options: BuyerAgentCacheOptions = {}): CachedBuyerAgentRegistry {\n if (typeof inner !== 'object' || inner === null || typeof inner.resolve !== 'function') {\n throw new TypeError('BuyerAgentRegistry.cached: `inner` must be a BuyerAgentRegistry');\n }\n const ttlMs = (options.ttlSeconds ?? 60) * 1000;\n const nullsTtlMs = (options.cacheNullsTtlSeconds ?? 0) * 1000;\n const maxSize = options.maxSize ?? 10000;\n const now = options.now ?? Date.now;\n\n if (ttlMs <= 0) throw new RangeError('BuyerAgentRegistry.cached: ttlSeconds must be > 0');\n if (nullsTtlMs < 0) throw new RangeError('BuyerAgentRegistry.cached: cacheNullsTtlSeconds must be >= 0');\n if (maxSize < 1) throw new RangeError('BuyerAgentRegistry.cached: maxSize must be >= 1');\n\n // Map iteration order is insertion order, so re-inserting on hit\n // gives us LRU-on-access semantics for free.\n const cache = new Map<string, CacheEntry>();\n const inFlight = new Map<string, Promise<BuyerAgent | null>>();\n\n return {\n async resolve(authInfo) {\n const key = cacheKeyForCredential(authInfo.credential);\n if (key === null) {\n // Uncacheable input — pass through. Adopters wiring custom\n // auth that hasn't migrated to `credential` synthesis see\n // every call hit the inner resolver.\n return inner.resolve(authInfo);\n }\n\n const entry = cache.get(key);\n if (entry !== undefined && now() < entry.expiresAtMs) {\n // LRU touch: re-insert so this entry becomes the most-recent.\n cache.delete(key);\n cache.set(key, entry);\n return entry.value;\n }\n if (entry !== undefined) {\n // Expired — drop before refetch.\n cache.delete(key);\n }\n\n // Coalesce concurrent resolves: subsequent callers on the same\n // key await the existing in-flight promise rather than firing\n // their own upstream lookup. If the upstream rejects, all\n // coalesced callers see the same rejection; the `finally` below\n // releases `inFlight` so the next caller retries upstream\n // (rejected promises do NOT poison the cache — `cache.set`\n // inside the IIFE is unreachable on rejection).\n const existing = inFlight.get(key);\n if (existing !== undefined) return existing;\n\n const promise = (async () => {\n const value = await inner.resolve(authInfo);\n const entryTtlMs = value === null ? nullsTtlMs : ttlMs;\n if (entryTtlMs > 0) {\n // Defense-in-depth: freeze the resolved record before\n // sharing across coalesced callers. The dispatcher seam\n // also freezes per-request (Stage 2), but freezing here\n // makes the cached-shared-reference invariant load-\n // bearing rather than coincidental — a future caller\n // mutating `BuyerAgent.status` would otherwise corrupt\n // every other cached-hit consumer's view.\n if (value !== null && !Object.isFrozen(value)) {\n if (value.billing_capabilities instanceof Set) {\n Object.freeze(value.billing_capabilities);\n }\n Object.freeze(value);\n }\n cache.set(key, { value, expiresAtMs: now() + entryTtlMs });\n while (cache.size > maxSize) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey === undefined) break;\n cache.delete(oldestKey);\n }\n }\n return value;\n })();\n inFlight.set(key, promise);\n try {\n return await promise;\n } finally {\n inFlight.delete(key);\n }\n },\n\n invalidate(credential) {\n const key = cacheKeyForCredential(credential);\n if (key !== null) cache.delete(key);\n },\n\n clear() {\n cache.clear();\n },\n };\n}\n\n/**\n * Factory namespace mirroring the documented surface from #1269. Adopters\n * import the namespace and call `BuyerAgentRegistry.signingOnly({...})`,\n * etc. Individual functions are also exported above for direct use.\n *\n * @public\n */\nexport const BuyerAgentRegistry = {\n signingOnly,\n bearerOnly,\n mixed,\n cached,\n suggestBilling,\n};\n"],"mappings":";;;;;;AAyMA,MAAM,2BAA6D,CAAC,YAAY,cAAc,OAAO;AAY9F,SAAS,eACd,qBACA,UACmC;AACnC,aAAW,QAAQ,0BAA0B;AAC3C,QAAI,SAAS,YAAY,oBAAoB,IAAI,IAAI,EAAG,QAAO;AAAA,EACjE;AACA,SAAO;AACT;AA2JA,SAAS,yBAAyB,YAAyE;AACzG,SAAO,OAAO,WAAW,cAAc,YAAY,WAAW,UAAU,SAAS;AACnF;AAoBA,MAAM,0BAAyC,uBAAO,2BAA2B;AAiB1E,SAAS,oBACd,YAC+C;AAC/C,QAAM,UAAU,EAAE,GAAG,WAAW;AAChC,SAAO,eAAe,SAAS,yBAAyB;AAAA,IACtD,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,UAAU;AAAA,EACZ,CAAC;AACD,SAAO;AACT;AASA,SAAS,kBAAkB,YAAqC;AAC9D,SAAO,WAAW,SAAS,cAAe,WAAuC,uBAAuB,MAAM;AAChH;AAYO,SAAS,YAAY,MAA8E;AACxG,MAAI,OAAO,KAAK,sBAAsB,YAAY;AAChD,UAAM,IAAI,U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GAAG;AAAA,MAClB;AASA,YAAM,WAAW,SAAS,IAAI,GAAG;AACjC,UAAI,aAAa,OAAW,QAAO;AAEnC,YAAM,WAAW,YAAY;AAC3B,cAAM,QAAQ,MAAM,MAAM,QAAQ,QAAQ;AAC1C,cAAM,aAAa,UAAU,OAAO,aAAa;AACjD,YAAI,aAAa,GAAG;AAQlB,cAAI,UAAU,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG;AAC7C,gBAAI,MAAM,gCAAgC,KAAK;AAC7C,qBAAO,OAAO,MAAM,oBAAoB;AAAA,YAC1C;AACA,mBAAO,OAAO,KAAK;AAAA,UACrB;AACA,gBAAM,IAAI,KAAK,EAAE,OAAO,aAAa,IAAI,IAAI,WAAW,CAAC;AACzD,iBAAO,MAAM,OAAO,SAAS;AAC3B,kBAAM,YAAY,MAAM,KAAK,EAAE,KAAK,EAAE;AACtC,gBAAI,cAAc,OAAW;AAC7B,kBAAM,OAAO,SAAS;AAAA,UACxB;AAAA,QACF;AACA,eAAO;AAAA,MACT,GAAG;AACH,eAAS,IAAI,KAAK,OAAO;AACzB,UAAI;AACF,eAAO,MAAM;AAAA,MACf,UAAE;AACA,iBAAS,OAAO,GAAG;AAAA,MACrB;AAAA,IACF;AAAA,IAEA,WAAW,YAAY;AACrB,YAAM,MAAM,sBAAsB,UAAU;AAC5C,UAAI,QAAQ,KAAM,OAAM,OAAO,GAAG;AAAA,IACpC;AAAA,IAEA,QAAQ;AACN,YAAM,MAAM;AAAA,IACd;AAAA,EACF;AACF;AASO,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/server/decisioning/buyer-agent.ts"],"sourcesContent":["/**\n * Buyer-agent identity surface from #1269 / #1292.\n *\n * Models a buyer agent (the buying entity calling a seller) as a durable\n * commercial relationship in the seller's records, distinct from the\n * per-request credential that proves identity. The seller's `BuyerAgent`\n * record carries onboarding state (status, billing capabilities, default\n * account terms, allowed brands) that drives commercial behavior.\n *\n * The credential answers \"who signed?\" / \"who holds this token?\" The\n * `BuyerAgent` answers \"who is this counterparty in our books?\" — analogous\n * to how an SSP has a `buyer_id` row keyed to a DSP regardless of whether\n * the DSP authenticates via OAuth, signed requests, or a pre-shared API\n * key. Token proves identity; row drives commercial behavior.\n *\n * AdCP 3.1 framework paths consume the resolved record for status,\n * sandbox-only, and `sync_accounts.billing` enforcement.\n *\n * @public\n */\n\nimport type { BillingParty, BusinessEntity, PaymentTerms } from '../../types/tools.generated';\n\n/**\n * Wire billing-party enum re-exported here for the registry surface.\n * Aliased to `BillingMode` in design discussion (#1269); `BillingParty` is\n * the canonical wire-schema name.\n *\n * @public\n */\nexport type BuyerAgentBillingMode = BillingParty;\n\n/**\n * Kind-discriminated credential variant on `ResolvedAuthInfo.credential`.\n *\n * `kind: 'http_sig'` is cryptographically verified — `agent_url` derives\n * from the `agents[]` entry whose `jwks_uri` resolved the keyid (per\n * adcontextprotocol/adcp#3831), NOT from JWK / JWS / envelope claims.\n * Security-relevant decisions (mutating-tool authorization, brand-side\n * authorization checks once `BrandAuthorizationResolver` lands) MUST read\n * `agent_url` from this variant, not from any informational field elsewhere\n * on `ResolvedAuthInfo`.\n *\n * `kind: 'api_key'` and `kind: 'oauth'` carry no `agent_url` on the\n * credential — the agent identity comes from the registry's\n * `resolveByCredential` lookup against the seller's onboarding record.\n *\n * @public\n */\nexport type AdcpCredential =\n | { readonly kind: 'api_key'; readonly key_id: string }\n | {\n readonly kind: 'oauth';\n readonly client_id: string;\n readonly scopes: readonly string[];\n readonly expires_at?: number;\n }\n | { readonly kind: 'http_sig'; readonly keyid: string; readonly agent_url: string; readonly verified_at: number };\n\n/**\n * Status of a buyer-agent record. Drives framework-level request gating:\n *\n * - `'active'` — normal operation; requests dispatch.\n * - `'suspended'` — temporarily paused; new requests rejected with\n * `AGENT_SUSPENDED` (recovery: `terminal`). In-flight tasks are NOT\n * retroactively cancelled — webhooks fire, status updates flow.\n * Sellers who need hard cutoff implement that in their platform method\n * via `BuyerAgent.status` check.\n * - `'blocked'` — permanently denied; new requests rejected with\n * `AGENT_BLOCKED` (recovery: `terminal`). Lifting requires re-onboarding\n * under a new agent identity.\n *\n * Both `AGENT_SUSPENDED` and `AGENT_BLOCKED` are terminal at the wire level\n * (the buyer cannot recover by retrying the same request). The transient-\n * vs-permanent distinction lives in the seller's `BuyerAgent.status` record\n * — suspension may lift via re-onboarding, blocked does not.\n *\n * Adopted from AdCP 3.1 spec PR adcp#3906, which consolidated the 3.0.5\n * placeholder shape `PERMISSION_DENIED + details.scope:'agent' + details.status`\n * into the dedicated codes.\n *\n * @public\n */\nexport type BuyerAgentStatus = 'active' | 'suspended' | 'blocked';\n\n/**\n * Buyer-agent record — durable commercial relationship in the seller's\n * onboarding ledger. Returned by `BuyerAgentRegistry.resolve` and threaded\n * to handlers via `ctx.agent`.\n *\n * Fields are `readonly` to prevent post-resolution mutation that would\n * silently affect downstream `accounts.resolve` decisions. Mirrors the\n * Python frozen-dataclass shape for cross-language parity.\n *\n * @public\n */\nexport interface BuyerAgent {\n /**\n * Canonical agent URL. Treat like a public key: stable enough that\n * rotation requires explicit re-onboarding. The framework's signed-path\n * resolution checks both this canonical URL and any `aliases[]` against\n * the verified `credential.agent_url`. No separate seller-internal id —\n * adopters who want one mint it in their own DB and key off `agent_url`.\n */\n readonly agent_url: string;\n\n /** Human-readable name for ops / reporting / UI. */\n readonly display_name: string;\n\n /** See {@link BuyerAgentStatus}. */\n readonly status: BuyerAgentStatus;\n\n /**\n * Billing models this agent is permitted to request on `sync_accounts`.\n * Set-valued so real-world models (mixed-billing holdco with both direct\n * and agency-mediated brands) can be expressed without picking one mode.\n *\n * Migration from earlier single-enum sketches:\n * - `passthrough_only` ↔ `new Set(['operator'])`\n * - `agent_billable` ↔ `new Set(['agent', 'operator', 'advertiser'])`\n *\n * The framework enforces this set on `sync_accounts` in AdCP 3.1\n * deployments and returns `BILLING_NOT_PERMITTED_FOR_AGENT` with a\n * clamped details shape when the requested billing value is outside it.\n */\n readonly billing_capabilities: ReadonlySet<BuyerAgentBillingMode>;\n\n /**\n * Commercial defaults applied when accounts are provisioned under this\n * agent. Framework merges with per-request overrides on a SPARSE-MERGE\n * basis: per-request values win for any present field including explicit\n * `null`. The request is the authoritative current intent; defaults are\n * seeds for fields the buyer didn't speak to. Adopters who want\n * non-null-override semantics pre-filter nulls themselves.\n */\n readonly default_account_terms?: {\n readonly rate_card?: string;\n readonly payment_terms?: PaymentTerms;\n readonly credit_limit?: { readonly amount: number; readonly currency: string };\n readonly billing_entity?: BusinessEntity;\n };\n\n /**\n * Static allowlist of brand domains this agent may act for. Pre-RFC\n * stand-in for the per-request authorization check that\n * `BrandAuthorizationResolver` will perform once it lands (gated on\n * Python's RFC + adcp brand-side authz spec finalizing).\n *\n * When both this list and `BrandAuthorizationResolver` are configured,\n * the framework AND-composes them: registry says \"we accept this agent\n * at all\"; resolver says \"and they're authorized for THIS brand.\" One-\n * minor deprecation cycle starts the release after\n * `BrandAuthorizationResolver` ships; sellers who want the static gate\n * gone stop populating the field.\n */\n readonly allowed_brands?: readonly string[];\n\n /**\n * Optional grace-period overlap during `agent_url` rotation. Framework's\n * signed-path resolution checks both canonical `agent_url` AND `aliases`\n * against the `agents[]` entry that resolved the verified keyid.\n *\n * v1 ships with the field present but no special framework behavior\n * beyond resolution; v1.5 adds the documented sunset window pattern.\n * Most adopters never populate this.\n */\n readonly aliases?: readonly string[];\n\n /**\n * When `true`, this buyer agent may ONLY operate against sandbox\n * accounts. The framework rejects any request whose resolved\n * `Account.sandbox !== true` with `PERMISSION_DENIED`,\n * `error.details.scope: 'agent'`, `error.details.reason: 'sandbox-only'`.\n *\n * Defense-in-depth for test agents (CI runners, internal QA agents,\n * partner pre-prod environments): if the test credential leaks, blast\n * radius is bounded to sandbox accounts. Production agents leave this\n * unset (or `false`).\n *\n * Composes with `Account.sandbox` (the wire-level sandbox marker on\n * the resolved Account record): the gate fires when `agent.sandbox_only\n * === true AND ctx.account?.sandbox !== true`. Account-less tools\n * (`provide_performance_feedback`, `list_creative_formats`, etc.) pass\n * the gate — they don't operate on a specific account, so the\n * sandbox/production axis doesn't apply.\n *\n * **Load-bearing pair.** For the gate to admit ANY traffic from a\n * `sandbox_only` agent, the seller's `accounts.resolve` MUST return\n * `sandbox: true` on the accounts that agent should reach. Adopters\n * cloning the worked example with `sandbox_only: true` on their seed\n * agent and a hardcoded `sandbox: true` resolver are demoware-correct;\n * production adopters either flip the agent to `sandbox_only: false`\n * OR have their resolver return `sandbox: true` only for actually-\n * sandbox accounts. Mismatches between these two sides 403 every\n * request — failure is loud, not silent.\n *\n * Default `false` (or undefined) — production-allowed.\n */\n readonly sandbox_only?: boolean;\n}\n\nconst BILLING_SUGGESTION_ORDER: readonly BuyerAgentBillingMode[] = ['operator', 'advertiser', 'agent'];\n\n/**\n * Pick the single autonomous-retry billing value exposed on\n * `BILLING_NOT_PERMITTED_FOR_AGENT.details.suggested_billing`.\n *\n * The details schema intentionally allows only one suggestion, not the\n * agent's full permitted set. Preference is the spec-discussed commercial\n * fallback order: operator > advertiser > agent.\n *\n * @public\n */\nexport function suggestBilling(\n billingCapabilities: ReadonlySet<BuyerAgentBillingMode>,\n rejected: BuyerAgentBillingMode\n): BuyerAgentBillingMode | undefined {\n for (const mode of BILLING_SUGGESTION_ORDER) {\n if (mode !== rejected && billingCapabilities.has(mode)) return mode;\n }\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Registry Protocol + factory functions\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal `ResolvedAuthInfo`-shaped argument to `BuyerAgentRegistry.resolve`.\n * Defined here to break a circular dependency with `account.ts` and to keep\n * the registry surface decoupled from the legacy `ResolvedAuthInfo` shape\n * during the two-minor migration cycle.\n *\n * Stage 3 of the implementation will widen `ResolvedAuthInfo` itself with\n * the `credential` field; this interface is the registry-side contract.\n *\n * @public\n */\nexport interface BuyerAgentResolveInput {\n /**\n * The kind-discriminated credential proven on the request. Stage 3 of\n * the Phase 1 implementation will populate this from the verifier\n * (`http_sig`) or from the legacy `ResolvedAuthInfo` shape (`api_key` /\n * `oauth`); until then, callers pass it through directly when available.\n *\n * When absent, the registry's `resolve` returns `null` — the legacy-\n * shape synthesis lands in Stage 3 alongside the `ResolvedAuthInfo`\n * migration shim, not Stage 1.\n */\n readonly credential?: AdcpCredential;\n\n /**\n * Adopter-provided extension data threaded from `authenticate()`. Populated\n * from the `extra` field stamped on the `AuthPrincipal` returned by the\n * `authenticate()` callback (e.g. `verifyApiKey({ verify: token => ({ ...,\n * extra: { demo_token: token } }) })`). Forwarded to the second argument of\n * {@link ResolveBuyerAgentByCredential} by `bearerOnly` and `mixed` factories.\n *\n * The full MCP `AuthInfo.extra` bag is forwarded here — it includes JWT\n * claims (if `verifyBearer` was used) and the SDK-internal `credential` key\n * alongside adopter-stamped fields. Do not use reserved key names (`credential`,\n * `iss`, `sub`, `aud`, `exp`, `iat`, `nbf`, `jti`) in the `extra` object\n * to avoid collisions.\n */\n readonly extra?: Record<string, unknown>;\n\n /**\n * Raw AdCP request parameters for the current tool call, after transport\n * decoding and before handler dispatch. Registry implementations normally\n * key only on `credential`, but compliance-controller overlays may need the\n * request `context.session_id` or `account` to resolve a scoped test\n * commercial state for this request.\n */\n readonly input?: Record<string, unknown>;\n}\n\n/**\n * Buyer-agent registry — durable identity surface called once per request\n * before `accounts.resolve`. Adopters construct via one of the factory\n * functions; the resulting object exposes a single `resolve` method the\n * framework dispatcher invokes.\n *\n * Three implementer postures, encoded at construction:\n *\n * - {@link signingOnly} — production target. Bearer/API-key/OAuth requests\n * refused at the registry layer; signed requests resolve via\n * `resolveByAgentUrl` against the verified `credential.agent_url`.\n * - {@link bearerOnly} — pre-trust beta. No signature support; bearer-shaped\n * credentials resolve via `resolveByCredential` against the seller's\n * onboarding ledger.\n * - {@link mixed} — transition. Both paths active. Signed traffic resolves\n * cryptographically; bearer falls through to the legacy key table.\n *\n * The factories produce a `BuyerAgentRegistry` whose `resolve` method\n * routes by `credential.kind` and returns `null` when the credential is\n * not honored by the configured posture (e.g., bearer credential against\n * a `signingOnly` registry → `null`, framework rejects the request).\n *\n * @public\n */\nexport interface BuyerAgentRegistry {\n /**\n * Resolve a request's credential to a buyer-agent record.\n *\n * Returns `null` when the credential is not recognized OR when the\n * configured posture rejects the credential's kind (e.g., `bearerOnly`\n * registry receiving an `http_sig` credential).\n *\n * Throws when the underlying lookup fails (DB outage, identity-provider\n * 5xx). Framework projects the throw to `SERVICE_UNAVAILABLE` so the\n * buyer can retry; the inner error is logged server-side.\n */\n resolve(authInfo: BuyerAgentResolveInput): Promise<BuyerAgent | null>;\n}\n\n/**\n * Resolver function type for the signed path. Receives the\n * cryptographically-verified `agent_url` from the request signature and\n * returns the seller's record (or `null` for unrecognized agents).\n *\n * @public\n */\nexport type ResolveBuyerAgentByAgentUrl = (agent_url: string) => Promise<BuyerAgent | null>;\n\n/**\n * Resolver function type for the bearer/API-key/OAuth path. Receives the\n * raw credential and (optionally) adopter-provided extension data, and\n * returns the seller's record (or `null` for unrecognized credentials).\n *\n * **Implementations MUST switch on `credential.kind`** and reject (return\n * `null`) on any kind they don't explicitly recognize. A naive\n * `WHERE token = $1` lookup against an api-key table would otherwise mis-\n * resolve when handed an `http_sig` credential whose `keyid` happens to\n * collide with an existing api-key value — the credential variants share\n * no key namespace, and the registry MUST NOT bridge them.\n *\n * **Credential exposure.** This callback receives unredacted credential\n * payloads (token, key_id, client_id). Adopters MUST NOT log raw credential\n * values AND MUST NOT include them in thrown `Error` messages — the\n * framework projects `err.message` into `error.details.reason` on the wire\n * when `exposeErrorDetails` is on (default: non-production). Throw with\n * a generic message and log the credential separately if you need it for\n * server-side debugging. The framework redacts credential payloads in any\n * log line emitted from registry-resolution code (Stage 4); adopter\n * implementations are expected to do the same (or to use prepared-statement\n * parameters that don't log).\n *\n * **`extra` — adopter extension data.** When the `authenticate()` callback\n * stamps an `extra` field on the returned `AuthPrincipal` (e.g.\n * `verifyApiKey({ verify: token => ({ principal, extra: { demo_token: token } }) })`),\n * the framework propagates that value through `ResolvedAuthInfo.extra` to\n * this second argument. Use it to carry pre-hash data your authenticator\n * already derived (prefix patterns, tenant IDs, test-kit flags) that you\n * can't recover from the hashed `key_id`. Apply the same care as for\n * `credential`: do not log raw values from `extra` or include them in\n * thrown `Error` messages.\n *\n * Existing single-argument implementations `(credential) => ...` satisfy\n * this type — the second argument is optional.\n *\n * @public\n */\nexport type ResolveBuyerAgentByCredential = (\n credential: AdcpCredential,\n extra?: Record<string, unknown>,\n input?: Record<string, unknown>\n) => Promise<BuyerAgent | null>;\n\n/**\n * Belt-and-suspenders check that an `http_sig` credential carries a non-\n * empty `agent_url`. A misbehaving authenticator could produce `kind:\n * 'http_sig'` without populating the verified URL — without this guard, the\n * registry would pass `undefined` (or `''`) to the adopter's resolver and\n * silently get back `null`. Caller is responsible for the kind dispatch;\n * this function only validates the http_sig payload shape.\n */\nfunction isVerifiedHttpSigPayload(credential: { agent_url?: string }): credential is { agent_url: string } {\n return typeof credential.agent_url === 'string' && credential.agent_url.length > 0;\n}\n\n/**\n * Module-private symbol used as a provenance brand on verifier-produced\n * `http_sig` credentials. NOT registered via `Symbol.for(...)` — code\n * outside this module cannot synthesize the symbol value, which is what\n * makes it a usable provenance check.\n *\n * The brand is non-enumerable so it's invisible to `JSON.stringify`,\n * `Object.keys`, spread, and structured-clone — meaning a credential\n * that crosses a serialization boundary loses its brand. For the\n * security model that's correct: a hostile relay or replay strips the\n * brand and the registry refuses to treat the credential as verified.\n *\n * Only `markVerifiedHttpSig` (called by the framework's signature\n * verifier in `src/lib/server/auth-signature.ts`) attaches the brand.\n * Custom `authenticate` callbacks that synthesize a literal-shape\n * `{ kind: 'http_sig', ... }` credential will NOT carry the brand —\n * `signingOnly` and `mixed` registry factories reject those.\n */\nconst VERIFIED_HTTP_SIG_BRAND: unique symbol = Symbol('@adcp/sdk.verifiedHttpSig');\n\ntype VerifiedHttpSig = Extract<AdcpCredential, { kind: 'http_sig' }> & {\n readonly [VERIFIED_HTTP_SIG_BRAND]: true;\n};\n\n/**\n * Brand an `http_sig` credential as verifier-produced. Only the framework's\n * signature verifier (`verifySignatureAsAuthenticator`) calls this; the\n * brand is the registry's proof that the credential's `agent_url` was\n * cryptographically verified per adcontextprotocol/adcp#3831.\n *\n * Returned object is a fresh shallow copy — the input is not mutated.\n *\n * @internal — exported for `auth-signature.ts` only; not part of the\n * adopter surface.\n */\nexport function markVerifiedHttpSig(\n credential: Extract<AdcpCredential, { kind: 'http_sig' }>\n): Extract<AdcpCredential, { kind: 'http_sig' }> {\n const branded = { ...credential };\n Object.defineProperty(branded, VERIFIED_HTTP_SIG_BRAND, {\n value: true,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return branded as VerifiedHttpSig;\n}\n\n/**\n * Predicate the registry factories use to distinguish verifier-produced\n * `http_sig` credentials from literal-shape impostors. Returns true ONLY\n * when the credential was produced by the framework's signature verifier\n * (or another caller that imported the symbol from this module — there\n * are none).\n */\nfunction isVerifiedHttpSig(credential: AdcpCredential): boolean {\n return credential.kind === 'http_sig' && (credential as Record<symbol, unknown>)[VERIFIED_HTTP_SIG_BRAND] === true;\n}\n\n/**\n * Construct a signing-only `BuyerAgentRegistry`. Bearer/API-key/OAuth\n * requests resolve to `null` (framework rejects); only signed requests\n * are honored.\n *\n * The path-of-least-resistance factory for production sellers — implement\n * one resolver, traffic that doesn't sign is automatically refused.\n *\n * @public\n */\nexport function signingOnly(opts: { resolveByAgentUrl: ResolveBuyerAgentByAgentUrl }): BuyerAgentRegistry {\n if (typeof opts.resolveByAgentUrl !== 'function') {\n throw new TypeError('BuyerAgentRegistry.signingOnly: resolveByAgentUrl must be a function');\n }\n const resolveByAgentUrl = opts.resolveByAgentUrl;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n if (credential === undefined || credential.kind !== 'http_sig') return null;\n // Reject literal-shape http_sig credentials: only the framework's\n // signature verifier brands a credential as verified. A custom\n // `authenticate` callback that synthesizes `{ kind: 'http_sig', ... }`\n // from arbitrary data would otherwise be routed as if cryptographically\n // verified — the brand check closes that forgery vector.\n if (!isVerifiedHttpSig(credential)) return null;\n if (!isVerifiedHttpSigPayload(credential)) return null;\n return resolveByAgentUrl(credential.agent_url);\n },\n };\n}\n\n/**\n * Construct a bearer-only `BuyerAgentRegistry`. Signed requests still\n * authenticate via the existing signature-verifier surface, but the\n * registry resolves all credential kinds via `resolveByCredential` against\n * the seller's onboarding ledger — useful in pre-trust-beta deployments\n * where the seller maintains a credential→agent table out-of-band.\n *\n * @public\n */\nexport function bearerOnly(opts: { resolveByCredential: ResolveBuyerAgentByCredential }): BuyerAgentRegistry {\n if (typeof opts.resolveByCredential !== 'function') {\n throw new TypeError('BuyerAgentRegistry.bearerOnly: resolveByCredential must be a function');\n }\n const resolveByCredential = opts.resolveByCredential;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n const extra = authInfo.extra;\n if (credential === undefined) return null;\n return resolveByCredential(credential, extra, authInfo.input);\n },\n };\n}\n\n/**\n * Construct a mixed-mode `BuyerAgentRegistry` that supports both signed and\n * bearer/OAuth/API-key credentials. Signed traffic resolves through\n * `resolveByAgentUrl` against the verified `credential.agent_url`; non-\n * signed credentials fall through to `resolveByCredential`.\n *\n * Framework prefers the signed path: when both an `Authorization: Bearer`\n * and a valid `Signature: ...` are present on the same request, the\n * `http_sig` credential variant is what reaches `resolve`, and only\n * `resolveByAgentUrl` is invoked. The bearer path is never consulted on\n * signed traffic.\n *\n * @public\n */\nexport function mixed(opts: {\n resolveByAgentUrl: ResolveBuyerAgentByAgentUrl;\n resolveByCredential: ResolveBuyerAgentByCredential;\n}): BuyerAgentRegistry {\n if (typeof opts.resolveByAgentUrl !== 'function') {\n throw new TypeError('BuyerAgentRegistry.mixed: resolveByAgentUrl must be a function');\n }\n if (typeof opts.resolveByCredential !== 'function') {\n throw new TypeError('BuyerAgentRegistry.mixed: resolveByCredential must be a function');\n }\n const resolveByAgentUrl = opts.resolveByAgentUrl;\n const resolveByCredential = opts.resolveByCredential;\n return {\n async resolve(authInfo) {\n const credential = authInfo.credential;\n const extra = authInfo.extra;\n if (credential === undefined) return null;\n if (credential.kind === 'http_sig') {\n // Same forgery clamp as `signingOnly`: only verifier-branded\n // http_sig credentials route through the signed path.\n if (!isVerifiedHttpSig(credential)) return null;\n // Reject a malformed `http_sig` credential here rather than falling\n // through to resolveByCredential. Otherwise `mixed` would be strictly\n // weaker than signingOnly: an authenticator that produces an\n // http_sig-shaped credential without a verified agent_url could\n // bypass signed-path enforcement by routing through the bearer table.\n if (!isVerifiedHttpSigPayload(credential)) return null;\n return resolveByAgentUrl(credential.agent_url);\n }\n return resolveByCredential(credential, extra, authInfo.input);\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Caching decorator — Phase 1 Stage 5 of #1269\n// ---------------------------------------------------------------------------\n\n/**\n * Options for {@link cached}.\n *\n * @public\n */\nexport interface BuyerAgentCacheOptions {\n /**\n * TTL (seconds) for successful resolutions. Default: 60.\n *\n * Adopters whose registry sits in front of a Postgres / external lookup\n * benefit from caching for the request lifecycle of a single buyer's\n * traffic burst. Long TTLs (several minutes) are appropriate for\n * stable agent records; short TTLs (a few seconds) for rapidly-mutating\n * relationships (suspension flags, billing-capability changes).\n *\n * Status changes propagate within `ttlSeconds` of the seller flipping\n * the agent's row in their store — adopters needing instant\n * propagation either set a short TTL or invalidate the cache out-of-\n * band when they mutate.\n */\n ttlSeconds?: number;\n\n /**\n * TTL (seconds) for `null` returns (negative cache). Default: 0\n * (don't cache nulls). A freshly onboarded agent is recognized within\n * one request when nulls aren't cached; sellers willing to delay\n * recognition by N seconds in exchange for fewer DB hits set this to\n * a small positive value.\n *\n * **Timing-oracle note.** When null caching is enabled, an\n * unauthenticated prober comparing hit vs. miss latency on null\n * returns can infer \"this credential was probed recently.\" Pair with\n * rate-limiting at the edge if your deployment runs in a hostile\n * environment. The default (0) avoids the oracle entirely.\n */\n cacheNullsTtlSeconds?: number;\n\n /**\n * Maximum cache entries before LRU eviction. Default: 10000.\n * The cache is bounded so a malicious or misconfigured caller spamming\n * unique credentials (e.g., random api keys probing the seller's\n * onboarding surface) can't exhaust memory.\n */\n maxSize?: number;\n\n /** Override clock for deterministic tests. Returns ms since epoch. */\n now?: () => number;\n}\n\ninterface CacheEntry {\n value: BuyerAgent | null;\n expiresAtMs: number;\n}\n\n/**\n * Cached registry surface. Strict superset of {@link BuyerAgentRegistry}\n * with explicit invalidation hooks adopters call when they mutate the\n * backing record (status flip, billing-capability change). Without\n * `invalidate`, adopters could only purge stale entries by waiting for\n * `ttlSeconds` to expire — for status changes that's exactly the\n * window during which a now-suspended agent retains access.\n *\n * `BuyerAgentRegistry.cached(...)` returns this richer type so adopters\n * can hold a reference and call the invalidation methods directly.\n *\n * @public\n */\nexport interface CachedBuyerAgentRegistry extends BuyerAgentRegistry {\n /**\n * Drop the cache entry for a single credential. No-op when the\n * credential isn't currently cached. Use this when the agent's\n * record is mutated in your backing store so the next request\n * re-resolves rather than serving the stale entry.\n */\n invalidate(credential: AdcpCredential): void;\n\n /**\n * Drop all cached entries. Use on bulk record mutations (onboarding-\n * record migration, daily reset) or test-environment cleanup.\n */\n clear(): void;\n}\n\n/**\n * Compute a cache key from a credential. Returns null when the\n * credential is undefined — uncacheable, falls through to the inner\n * registry on each call. Keys are namespaced by kind so an api_key\n * `key_id` value can never collide with an http_sig `keyid` value or\n * an oauth `client_id`. Note that `key_id` is already a stable hash\n * (Stage 3); using it as a cache key is safe.\n */\nfunction cacheKeyForCredential(credential: AdcpCredential | undefined): string | null {\n if (credential === undefined) return null;\n switch (credential.kind) {\n case 'http_sig':\n return `http_sig:${credential.agent_url}`;\n case 'api_key':\n return `api_key:${credential.key_id}`;\n case 'oauth':\n return `oauth:${credential.client_id}`;\n default: {\n // Exhaustiveness check — adding a new credential kind without\n // updating this switch produces a compile error here, not a\n // runtime cache-miss bug.\n const _exhaustive: never = credential;\n void _exhaustive;\n return null;\n }\n }\n}\n\n/**\n * Wrap a {@link BuyerAgentRegistry} with TTL-based result caching and\n * concurrent-resolve coalescing. Adopters whose `resolveByAgentUrl` /\n * `resolveByCredential` hit a database or external service compose\n * the cache via:\n *\n * ```ts\n * const registry = BuyerAgentRegistry.cached(\n * BuyerAgentRegistry.signingOnly({\n * resolveByAgentUrl: async url => db.findBuyerAgent(url),\n * }),\n * { ttlSeconds: 60 }\n * );\n * ```\n *\n * Cache properties:\n * - **TTL-bounded.** Entries expire after `ttlSeconds` (default 60).\n * Negative cache (null returns) is opt-in via `cacheNullsTtlSeconds`.\n * - **LRU-evicted.** Bounded to `maxSize` entries (default 10000).\n * Oldest-accessed entry evicts on overflow.\n * - **Concurrent-resolve coalesced.** N parallel `resolve()` calls on\n * the same key produce ONE upstream invocation. Subsequent callers\n * await the in-flight promise — important when the seller front-ends\n * a slow upstream and a buyer burst arrives.\n * - **Per-kind cache keys.** Keys are namespaced (`http_sig:`,\n * `api_key:`, `oauth:`) so cross-kind collisions cannot leak an agent\n * resolved through one credential type to a different type.\n * - **`extra` is not part of the cache key.** The cache keys on credential\n * identity only. Two requests with the same credential but different\n * `authInfo.extra` content return the same cached result. This is the\n * right behaviour when `extra` carries pre-hash data derived from the\n * same token (the motivating use-case), but can be surprising if you\n * put per-request session context in `extra`. Set a short `ttlSeconds`\n * or skip the cache decorator if your resolution is sensitive to `extra`\n * variance across requests with the same credential.\n * - **Skips uncacheable inputs.** When the credential is undefined,\n * `resolve()` falls through to the inner registry on each call —\n * adopters wiring custom auth without `credential` synthesis (Stage 3\n * migration cycle) see no behavior change.\n * - **Explicit invalidation.** Returns a {@link CachedBuyerAgentRegistry}\n * with `.invalidate(credential)` and `.clear()` methods. Call\n * `invalidate` when you mutate an agent's record (status flip,\n * billing-capability change) so the next request re-resolves rather\n * than serving the stale entry. Without this, the stale-status window\n * is bounded by `ttlSeconds` — a now-suspended agent retains access\n * for up to that long.\n *\n * Mirrors the `AsyncCachingJwksResolver` over `JwksResolver` pattern\n * already in `src/lib/signing/`.\n *\n * @public\n */\nexport function cached(inner: BuyerAgentRegistry, options: BuyerAgentCacheOptions = {}): CachedBuyerAgentRegistry {\n if (typeof inner !== 'object' || inner === null || typeof inner.resolve !== 'function') {\n throw new TypeError('BuyerAgentRegistry.cached: `inner` must be a BuyerAgentRegistry');\n }\n const ttlMs = (options.ttlSeconds ?? 60) * 1000;\n const nullsTtlMs = (options.cacheNullsTtlSeconds ?? 0) * 1000;\n const maxSize = options.maxSize ?? 10000;\n const now = options.now ?? Date.now;\n\n if (ttlMs <= 0) throw new RangeError('BuyerAgentRegistry.cached: ttlSeconds must be > 0');\n if (nullsTtlMs < 0) throw new RangeError('BuyerAgentRegistry.cached: cacheNullsTtlSeconds must be >= 0');\n if (maxSize < 1) throw new RangeError('BuyerAgentRegistry.cached: maxSize must be >= 1');\n\n // Map iteration order is insertion order, so re-inserting on hit\n // gives us LRU-on-access semantics for free.\n const cache = new Map<string, CacheEntry>();\n const inFlight = new Map<string, Promise<BuyerAgent | null>>();\n\n return {\n async resolve(authInfo) {\n const key = cacheKeyForCredential(authInfo.credential);\n if (key === null) {\n // Uncacheable input — pass through. Adopters wiring custom\n // auth that hasn't migrated to `credential` synthesis see\n // every call hit the inner resolver.\n return inner.resolve(authInfo);\n }\n\n const entry = cache.get(key);\n if (entry !== undefined && now() < entry.expiresAtMs) {\n // LRU touch: re-insert so this entry becomes the most-recent.\n cache.delete(key);\n cache.set(key, entry);\n return entry.value;\n }\n if (entry !== undefined) {\n // Expired — drop before refetch.\n cache.delete(key);\n }\n\n // Coalesce concurrent resolves: subsequent callers on the same\n // key await the existing in-flight promise rather than firing\n // their own upstream lookup. If the upstream rejects, all\n // coalesced callers see the same rejection; the `finally` below\n // releases `inFlight` so the next caller retries upstream\n // (rejected promises do NOT poison the cache — `cache.set`\n // inside the IIFE is unreachable on rejection).\n const existing = inFlight.get(key);\n if (existing !== undefined) return existing;\n\n const promise = (async () => {\n const value = await inner.resolve(authInfo);\n const entryTtlMs = value === null ? nullsTtlMs : ttlMs;\n if (entryTtlMs > 0) {\n // Defense-in-depth: freeze the resolved record before\n // sharing across coalesced callers. The dispatcher seam\n // also freezes per-request (Stage 2), but freezing here\n // makes the cached-shared-reference invariant load-\n // bearing rather than coincidental — a future caller\n // mutating `BuyerAgent.status` would otherwise corrupt\n // every other cached-hit consumer's view.\n if (value !== null && !Object.isFrozen(value)) {\n if (value.billing_capabilities instanceof Set) {\n Object.freeze(value.billing_capabilities);\n }\n Object.freeze(value);\n }\n cache.set(key, { value, expiresAtMs: now() + entryTtlMs });\n while (cache.size > maxSize) {\n const oldestKey = cache.keys().next().value;\n if (oldestKey === undefined) break;\n cache.delete(oldestKey);\n }\n }\n return value;\n })();\n inFlight.set(key, promise);\n try {\n return await promise;\n } finally {\n inFlight.delete(key);\n }\n },\n\n invalidate(credential) {\n const key = cacheKeyForCredential(credential);\n if (key !== null) cache.delete(key);\n },\n\n clear() {\n cache.clear();\n },\n };\n}\n\n/**\n * Factory namespace mirroring the documented surface from #1269. Adopters\n * import the namespace and call `BuyerAgentRegistry.signingOnly({...})`,\n * etc. Individual functions are also exported above for direct use.\n *\n * @public\n */\nexport const BuyerAgentRegistry = {\n signingOnly,\n bearerOnly,\n mixed,\n cached,\n suggestBilling,\n};\n"],"mappings":"AAyMA,MAAM,2BAA6D,CAAC,YAAY,cAAc,OAAO;AAY9F,SAAS,eACd,qBACA,UACmC;AACnC,aAAW,QAAQ,0BAA0B;AAC3C,QAAI,SAAS,YAAY,oBAAoB,IAAI,IAAI,EAAG,QAAO;AAAA,EACjE;AACA,SAAO;AACT;AA2JA,SAAS,yBAAyB,YAAyE;AACzG,SAAO,OAAO,WAAW,cAAc,YAAY,WAAW,UAAU,SAAS;AACnF;AAoBA,MAAM,0BAAyC,uBAAO,2BAA2B;AAiB1E,SAAS,oBACd,YAC+C;AAC/C,QAAM,UAAU,EAAE,GAAG,WAAW;AAChC,SAAO,eAAe,SAAS,yBAAyB;AAAA,IACtD,OAAO;AAAA,IACP,YAAY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AAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
2
- import { dirname as __adcpDirname } from 'node:path';
3
- import { createRequire as __adcpCreateRequire } from 'node:module';
4
- const __filename = __adcpFileURLToPath(import.meta.url);
5
- const __dirname = __adcpDirname(__filename);
6
- const require = __adcpCreateRequire(import.meta.url);
7
1
  const LEGACY_POSTAL_SYSTEMS = {
8
2
  us_zip: { country: "US", system: "zip" },
9
3
  us_zip_plus_four: { country: "US", system: "zip_plus_four" },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/server/decisioning/capabilities.ts"],"sourcesContent":["/**\n * DecisioningCapabilities — single source of truth for `get_adcp_capabilities`\n * response and any admin UI surface a host wants to render.\n *\n * Adopters declare once. Framework wires the wire-protocol response;\n * adopters' admin tools (or the SDK CLI's `validate_platform_config`) consume\n * the same dataclass so there's no drift between \"what the agent says it\n * supports\" and \"what it actually does.\"\n *\n * Status: Preview / 6.0.\n *\n * @public\n */\n\nimport type { ZodSchema } from 'zod';\nimport type {\n AdCPSpecialism,\n MediaChannel,\n PaymentTerms,\n PricingModel,\n GetAdCPCapabilitiesResponse,\n PostalAreaSupport,\n} from '../../types/tools.generated';\nimport type { ProductMetricOptimizationLike } from '../../utils/capability-rollups';\nimport type { MediaBuyFeatures, AccountCapabilities, CreativeCapabilities } from '../../utils/capabilities';\nimport type { AdcpCapabilitiesOverrides } from '../create-adcp-server';\n\n/**\n * Pre-resolved alias for the wire `media_buy` block. Used as the projection\n * source for the five `media_buy.*` capability fields below so each typed\n * field references a single resolved shape instead of re-walking the\n * `GetAdCPCapabilitiesResponse` type graph independently. Without the\n * alias, `strict + skipLibCheck:false` adopters hit the TS instantiation\n * budget on the published `.d.ts` and tsc OOMs.\n */\ntype _MediaBuyCapabilities = NonNullable<GetAdCPCapabilitiesResponse['media_buy']>;\ntype _MediaBuyTargetingCapabilities = NonNullable<NonNullable<_MediaBuyCapabilities['execution']>['targeting']>;\ntype _ComplianceTestingScenario = NonNullable<\n NonNullable<GetAdCPCapabilitiesResponse['compliance_testing']>['scenarios']\n>[number];\n\nexport interface DecisioningCapabilities<TConfig = unknown> {\n /**\n * Specialisms claimed; framework type-checks these against implemented platform\n * interfaces. Arrays are `readonly` so adopters can declare with `as const`\n * (load-bearing for the `RequiredPlatformsFor<S>` compile-time gate).\n */\n specialisms: readonly AdCPSpecialism[];\n\n /**\n * Creative agents this seller composes with. Framework fetches format catalogs\n * from each (1h cache) and unions them on `list_creative_formats`. Self-hosting\n * sellers point at their own `agent_url`; framework calls into their\n * `CreativePlatform.listFormats()` locally instead of HTTP-fetching.\n *\n * `format_ids` filter (optional) subsets a single creative agent's catalog.\n * Useful when a creative agent hosts 50 formats but this seller only accepts\n * 10 of them. Filter scope is per-creative-agent: `[{ agent_url: A, format_ids: ['x'] }, { agent_url: B }]`\n * means \"from A only format x; from B all formats.\"\n *\n * Omit for signals-only platforms (`signal-marketplace`, `signal-owned`) — they\n * sell audience data access, not media inventory, and don't compose with creative agents.\n */\n creative_agents?: readonly CreativeAgentRef[];\n\n /**\n * Channels this platform sells.\n *\n * Omit for non-media-buy platforms — they don't sell ad inventory and have no\n * channels to declare. Applies to signals (`signal-marketplace`, `signal-owned`),\n * governance (`governance-spend-authority`, `governance-delivery-monitor`,\n * `property-lists`, `collection-lists`, `content-standards`), creative-only\n * (`creative-ad-server`, `creative-template`, `creative-generative`), and\n * brand (`brand-rights`) platforms.\n *\n * **Required at runtime for media-buy platforms.** `validatePlatform` (called\n * by `createAdcpServerFromPlatform`) throws `PlatformConfigError` when any\n * `sales-*` specialism is claimed and this field is absent.\n */\n channels?: readonly MediaChannel[];\n\n /**\n * Pricing models this platform supports.\n *\n * Omit for non-media-buy platforms — they don't sell ad inventory and have no\n * channel-level pricing to declare. For signals platforms specifically, pricing\n * is declared per-signal in the signal descriptor's `pricing_options[]` instead.\n * Same non-media-buy specialism set as `channels` above.\n *\n * **Required at runtime for media-buy platforms.** `validatePlatform` (called\n * by `createAdcpServerFromPlatform`) throws `PlatformConfigError` when any\n * `sales-*` specialism is claimed and this field is absent.\n */\n pricingModels?: readonly PricingModel[];\n\n /** Targeting capabilities. Optional — framework infers reasonable defaults if omitted. */\n targeting?: TargetingCapabilities;\n\n /** Reporting capabilities. Optional — framework infers reasonable defaults if omitted. */\n reporting?: ReportingCapabilities;\n\n /**\n * Audience-matching capabilities — projected onto\n * `get_adcp_capabilities.media_buy.audience_targeting`. Required for\n * audience-sync adopters (CRM-list adopters that accept hashed\n * identifiers + UID types) so buyers know which identifier shapes\n * the platform will match against and what minimum audience size /\n * matching latency to expect. Omit when the platform doesn't accept\n * external audience uploads.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.audience_targeting`.\n */\n audience_targeting?: NonNullable<_MediaBuyCapabilities['audience_targeting']>;\n\n /**\n * Conversion-tracking capabilities — projected onto\n * `get_adcp_capabilities.media_buy.conversion_tracking`. Required for\n * adopters that accept conversion events via `sync_event_sources` /\n * `log_event` so buyers know which event types, action sources,\n * attribution windows, and identifier shapes the platform supports.\n * Omit when the platform doesn't track conversions.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.conversion_tracking`.\n */\n conversion_tracking?: NonNullable<_MediaBuyCapabilities['conversion_tracking']>;\n\n /**\n * Content-standards capabilities — projected onto\n * `get_adcp_capabilities.media_buy.content_standards`. Required for\n * adopters claiming the `content-standards` specialism so buyers know\n * whether the platform runs local evaluation, which channels it\n * covers, and whether it supports webhook artifact delivery. Omit\n * when the platform doesn't ship content-standards artifacts.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.content_standards`.\n */\n content_standards?: NonNullable<_MediaBuyCapabilities['content_standards']>;\n\n /**\n * Seller-level rollup of optimization metrics — projected onto\n * `get_adcp_capabilities.media_buy.supported_optimization_metrics`.\n * Added in AdCP 3.1 (adcp#4669). The array union of every product's\n * `metric_optimization.supported_metrics`. Storyboard runners gate\n * `metric_optimization`-using scenarios on this field; declaring it\n * gives buyers an upfront signal of which optimization metrics the\n * seller can compute against (clicks, views, completed_views, etc.).\n *\n * Adopters can compute the rollup from their catalog using the\n * exported {@link rollupOptimizationMetricsFromProducts} helper —\n * keeps the declaration in sync with what products actually offer.\n * Empty arrays are normalized away and the wire field is omitted; use\n * omission to mean \"no seller-level metric rollup advertised\".\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.supported_optimization_metrics`.\n */\n supported_optimization_metrics?: NonNullable<_MediaBuyCapabilities['supported_optimization_metrics']>;\n\n /**\n * Static product-metric summary used for capability rollups.\n *\n * When this is present and `supported_optimization_metrics` is omitted,\n * the framework derives `media_buy.supported_optimization_metrics` as the\n * sorted union of every product summary's\n * `metric_optimization.supported_metrics`. Full AdCP `Product` objects work,\n * but this field is not a general product-discovery surface; a lightweight\n * startup summary with just the `metric_optimization` block is enough.\n * Dynamic per-account catalogs should continue to pass an explicit\n * `supported_optimization_metrics` override. If the derived union is empty,\n * the framework omits `supported_optimization_metrics` from the wire\n * capabilities response.\n */\n productCatalog?: ReadonlyArray<ProductMetricOptimizationLike>;\n\n /**\n * Frequency-cap support declaration — projected onto\n * `get_adcp_capabilities.media_buy.frequency_capping`. Added in AdCP\n * 3.1 (adcp#4670). Presence-only object with `supported_per_units` /\n * `supported_window_units` sub-fields declaring which frequency-cap\n * shapes the platform honors. Omit when the platform doesn't accept\n * frequency caps at all; buyers will avoid the field on `pacing.*`.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.frequency_capping`.\n */\n frequency_capping?: NonNullable<_MediaBuyCapabilities['frequency_capping']>;\n\n /**\n * Whether this seller commits to the proposal lifecycle on get_products.\n * Projected onto `get_adcp_capabilities.media_buy.supports_proposals`.\n * Direct-buy sellers should declare `false` so proposal-only compliance\n * storyboards are skipped; sellers with a ProposalManager are auto-derived\n * as `true` unless they override this explicitly.\n */\n supportsProposals?: boolean;\n\n /**\n * Brand-protocol capabilities. Projected onto the wire `brand` block of\n * `get_adcp_capabilities` (`brand: { rights, right_types, available_uses,\n * generation_providers, description }`). The framework auto-derives\n * `rights: true` when `BrandRightsPlatform` is supplied; adopters\n * declare the rest (right_types they license, RightUses they support,\n * generation providers they issue credentials for).\n *\n * REQUIRED when claiming the `'brand-rights'` specialism — enforced at\n * compile-time via `RequiredCapabilitiesFor<S>`.\n */\n brand?: BrandCapabilities;\n\n /**\n * Compliance-testing capabilities. The presence of this block declares\n * the deployment supports deterministic state-machine testing via the\n * `comply_test_controller` wire tool. Keep this block declared when using\n * `createAdcpServerFromPlatform(..., { complyTest })`; the framework makes\n * live principals byte-identical to a production seller that never wired the\n * controller by hiding this block, filtering `tools/list`, and returning MCP\n * method-not-found for direct live calls.\n *\n * When this block is present, `createAdcpServerFromPlatform` REQUIRES\n * `opts.complyTest` (the `ComplyControllerConfig` adapter set) to be\n * supplied — claiming the capability without implementing the\n * controller is a `PlatformConfigError` at construction.\n *\n * Inversely, supplying `opts.complyTest` without declaring this\n * capability is also caught — the framework derives `scenarios` from\n * the declared force/simulate/seed adapters and emits the discovery\n * field on `get_adcp_capabilities` automatically for sandbox/mock\n * principals. Live principals do not see the block.\n */\n compliance_testing?: ComplianceTestingCapabilities;\n\n /**\n * Billing parties this platform supports. `'operator'` = retail-media model\n * (Criteo, Amazon — operator pays the publisher and bills the brand).\n * `'agent'` = pass-through model (buyer's agent settles directly with the\n * platform). `'advertiser'` = seller invoices the advertiser directly,\n * bypassing operator settlement (advertiser-direct sell-side platforms where\n * the brand is the direct contractual counterparty). Defaults to `['agent']`\n * when omitted. To express advertiser-direct billing per account, set\n * `billing.invoicedTo` to a `BrandReference` (the framework maps any\n * `BrandReference` to `'advertiser'` on the wire).\n */\n supportedBillings?: ReadonlyArray<'operator' | 'agent' | 'advertiser'>;\n\n /**\n * Payment terms this platform accepts on `sync_accounts.payment_terms`.\n * Omit to leave terms validation to `accounts.upsert` (or to accept any\n * schema-valid value). When present, the framework rejects unsupported\n * requested terms with `PAYMENT_TERMS_NOT_SUPPORTED` before dispatching\n * the account entry to the adopter.\n */\n supportedPaymentTerms?: ReadonlyArray<PaymentTerms>;\n\n /**\n * If true, this platform refuses transactions without an authenticated\n * operator principal (operator-billed retail-media). Framework emits\n * `AUTH_REQUIRED` envelope before dispatching to the platform.\n */\n requireOperatorAuth?: boolean;\n\n /**\n * Media-buy feature flags forwarded into `get_adcp_capabilities.media_buy.features`.\n * Adopter values serve as the base; auto-derived `audience_targeting`,\n * `conversion_tracking`, and `content_standards` booleans take precedence\n * for those three keys (overlaid by the framework via the per-domain\n * `media_buy` override on the inner createAdcpServer call). Use this to\n * declare `inlineCreativeManagement` and `propertyListFiltering` directly\n * from `definePlatform`; declare not-supported feature blocks (e.g.\n * `inlineCreativeManagement: false`) so the conformance runner grades\n * them `not_applicable` instead of `fail`.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n features?: Partial<MediaBuyFeatures>;\n\n /**\n * Creative-protocol capabilities forwarded into `get_adcp_capabilities.creative`.\n * Use to declare `supportsCompliance`, `hasCreativeLibrary`,\n * `supportsGeneration`, and `supportsTransformation` from `definePlatform`.\n * Adopters that don't run a provenance-verification pipeline should\n * declare the relevant fields as `false` so creative storyboards gate\n * cleanly.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n creative?: Partial<CreativeCapabilities>;\n\n /**\n * Account capabilities forwarded into `get_adcp_capabilities.account` as a\n * base layer. The framework's existing `requireOperatorAuth` and\n * `supportedBillings` projections overlay on top via the per-domain\n * `account` override, so explicit projections win on those keys.\n * `authorizationEndpoint`, `defaultBilling`, `requiredForProducts`, and\n * `sandbox` are pure adopter-driven additions exposed through this slot.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n account?: Partial<AccountCapabilities>;\n\n /**\n * Deep-merge overrides applied to the wire `get_adcp_capabilities`\n * response. Use this for fields that the top-level `DecisioningCapabilities`\n * shape doesn't model — `media_buy.propagation_surfaces`,\n * `media_buy.measurement_terms`, `signals.discovery_modes`, etc. The\n * framework's per-domain projections (auto-derived `media_buy`, `brand`,\n * `account`, `compliance_testing` blocks) are merged AFTER adopter\n * overrides, so framework-derived values remain authoritative on the keys\n * the projection engine handles.\n *\n * Mirrors `AdcpCapabilitiesConfig.overrides` on the lower-level\n * `createAdcpServer` API. Resolves the `definePlatform` passthrough gap\n * noted in adcp-client#2199.\n */\n overrides?: AdcpCapabilitiesOverrides;\n\n /**\n * Release-precision AdCP versions this platform supports (e.g. `[\"3.0\", \"3.1\"]`).\n * Forwarded into `get_adcp_capabilities.adcp.supported_versions`. 3.1+\n * sellers should declare here the same release-precision strings they\n * emit in `adcp_version` on responses; 3.0-pinned sellers can omit.\n *\n * Resolves the same gap previously noted for `supported_versions` —\n * was unreachable through `definePlatform` because\n * `CreateAdcpServerFromPlatformOptions` omits `'capabilities'` from\n * `AdcpServerConfig`. See adcp-client#2199.\n */\n supported_versions?: string[];\n\n /**\n * Platform-specific config. Strongly typed when the adopter uses the generic.\n * Example: `class GAM extends DecisioningPlatform<{ networkId: string }>`.\n */\n config: TConfig;\n\n /**\n * Optional Zod schema for runtime validation of `config`. When provided,\n * framework validates at platform construction time; missing or wrong-shaped\n * config rejects the agent at boot rather than at first request.\n */\n configSchema?: ZodSchema<TConfig>;\n}\n\nexport interface CreativeAgentRef {\n agent_url: string;\n /** Human-readable label for this creative agent. */\n name?: string;\n /** Optional allowlist of `format_id.id` values from THIS agent's catalog. Omit to include all. */\n format_ids?: string[];\n}\n\n/**\n * Targeting capabilities the platform supports in `create_media_buy`. Maps\n * to AdCP `GetAdcpCapabilitiesResponse.media_buy.execution.targeting`.\n *\n * Shape converged across two independently-evolved peer codebases (Scope3\n * `agentic-adapters`, Prebid `salesagent`). Per-geo-system flags rather than\n * coarse enums because the two implementations agreed: real platforms support\n * specific geo identifier formats (Nielsen DMA, Eurostat NUTS2, US ZIP+4), not\n * abstract \"metro\" / \"postal\" categories.\n */\nexport interface TargetingCapabilities {\n geo_countries?: boolean;\n geo_regions?: boolean;\n\n /** Metro / DMA identifier systems. */\n geo_metros?: {\n nielsen_dma?: boolean;\n uk_itl1?: boolean;\n uk_itl2?: boolean;\n eurostat_nuts2?: boolean;\n };\n\n /**\n * Postal-code identifier systems.\n *\n * AdCP 3.1.0-rc.10 prefers country-keyed arrays, e.g.\n * `{ US: ['zip'], GB: ['outward'] }`. Deprecated country-fused booleans\n * such as `{ us_zip: true }` remain accepted for 3.x adopters; the\n * framework projects both forms with `normalizePostalAreaSupport()` so old\n * and new buyers can read the capability safely during the migration.\n */\n geo_postal_areas?: TargetingPostalAreaSupport;\n\n /** Geographic-proximity targeting (radius / drive-time / arbitrary geometry). */\n geo_proximity?: {\n radius?: boolean;\n travel_time?: boolean;\n geometry?: boolean;\n transport_modes?: ReadonlyArray<'walking' | 'cycling' | 'driving' | 'public_transport'>;\n };\n\n /** Age-restriction targeting; `verification_methods` enumerates the assurance levels accepted. */\n age_restriction?: {\n supported?: boolean;\n verification_methods?: ReadonlyArray<\n 'facial_age_estimation' | 'id_document' | 'digital_id' | 'credit_card' | 'world_id'\n >;\n };\n\n device_platform?: boolean;\n device_type?: boolean;\n language?: boolean;\n audience_include?: boolean;\n audience_exclude?: boolean;\n\n /** Keyword-targeting match types accepted on positive-match terms. */\n keyword_targets?: {\n supported_match_types: ReadonlyArray<'broad' | 'phrase' | 'exact'>;\n };\n\n /** Negative-keyword match types accepted. */\n negative_keywords?: {\n supported_match_types: ReadonlyArray<'broad' | 'phrase' | 'exact'>;\n };\n}\n\nexport type TargetingPostalAreaSupport = {\n US?: readonly ('zip' | 'zip_plus_four')[];\n GB?: readonly ('outward' | 'full')[];\n CA?: readonly ('fsa' | 'full')[];\n DE?: readonly 'plz'[];\n CH?: readonly 'plz'[];\n AT?: readonly 'plz'[];\n FR?: readonly 'code_postal'[];\n AU?: readonly 'postcode'[];\n BR?: readonly 'cep'[];\n IN?: readonly 'pin'[];\n ZA?: readonly 'postal_code'[];\n /** @deprecated Use `US: ['zip']`. */\n us_zip?: boolean;\n /** @deprecated Use `US: ['zip_plus_four']`. */\n us_zip_plus_four?: boolean;\n /** @deprecated Use `GB: ['outward']`. */\n gb_outward?: boolean;\n /** @deprecated Use `GB: ['full']`. */\n gb_full?: boolean;\n /** @deprecated Use `CA: ['fsa']`. */\n ca_fsa?: boolean;\n /** @deprecated Use `CA: ['full']`. */\n ca_full?: boolean;\n /** @deprecated Use `DE: ['plz']`. */\n de_plz?: boolean;\n /** @deprecated Use `FR: ['code_postal']`. */\n fr_code_postal?: boolean;\n /** @deprecated Use `AU: ['postcode']`. */\n au_postcode?: boolean;\n /** @deprecated Use `CH: ['plz']`. */\n ch_plz?: boolean;\n /** @deprecated Use `AT: ['plz']`. */\n at_plz?: boolean;\n [country: `${Uppercase<string>}`]:\n | readonly (\n | 'zip'\n | 'zip_plus_four'\n | 'outward'\n | 'full'\n | 'fsa'\n | 'plz'\n | 'code_postal'\n | 'postcode'\n | 'cep'\n | 'pin'\n | 'postal_code'\n | 'custom'\n )[]\n | undefined;\n};\n\nconst LEGACY_POSTAL_SYSTEMS = {\n us_zip: { country: 'US', system: 'zip' },\n us_zip_plus_four: { country: 'US', system: 'zip_plus_four' },\n gb_outward: { country: 'GB', system: 'outward' },\n gb_full: { country: 'GB', system: 'full' },\n ca_fsa: { country: 'CA', system: 'fsa' },\n ca_full: { country: 'CA', system: 'full' },\n de_plz: { country: 'DE', system: 'plz' },\n fr_code_postal: { country: 'FR', system: 'code_postal' },\n au_postcode: { country: 'AU', system: 'postcode' },\n ch_plz: { country: 'CH', system: 'plz' },\n at_plz: { country: 'AT', system: 'plz' },\n} as const;\n\nconst LEGACY_POSTAL_BY_COUNTRY_SYSTEM = new Map(\n Object.entries(LEGACY_POSTAL_SYSTEMS).map(([legacy, { country, system }]) => [`${country}:${system}`, legacy])\n);\n\nconst POSTAL_SYSTEMS_BY_COUNTRY: Record<string, readonly string[]> = {\n US: ['zip', 'zip_plus_four'],\n GB: ['outward', 'full'],\n CA: ['fsa', 'full'],\n DE: ['plz'],\n CH: ['plz'],\n AT: ['plz'],\n FR: ['code_postal'],\n AU: ['postcode'],\n BR: ['cep'],\n IN: ['pin'],\n ZA: ['postal_code'],\n};\n\nconst GENERIC_POSTAL_SYSTEMS = ['postal_code', 'custom'] as const;\nconst POSTAL_COUNTRY_KEY_PATTERN = /^[A-Z]{2}$/;\n\nfunction appendUnique(target: string[], value: string): void {\n if (!target.includes(value)) target.push(value);\n}\n\nfunction assertSupportedPostalSystems(country: string, systems: readonly string[]): void {\n const allowed = POSTAL_SYSTEMS_BY_COUNTRY[country] ?? GENERIC_POSTAL_SYSTEMS;\n const invalid = systems.filter(system => !allowed.includes(system));\n if (invalid.length > 0) {\n throw new Error(\n `Invalid geo_postal_areas support for ${country}: ${invalid.join(', ')}. ` +\n `Supported systems are: ${allowed.join(', ')}.`\n );\n }\n}\n\n/**\n * Normalize postal-area capabilities across the AdCP 3.1.0-rc.10 migration.\n *\n * The wire schema now prefers `{ US: ['zip'] }` style country-local systems,\n * while the old `{ us_zip: true }` booleans stay deprecated but accepted\n * through 3.x. This helper is deliberately bidirectional:\n *\n * - legacy booleans add their country-keyed system;\n * - country-keyed systems backfill the matching legacy boolean when one exists;\n * - explicit unsupported legacy booleans are omitted unless the system is\n * otherwise advertised.\n */\nexport function normalizePostalAreaSupport(input: TargetingPostalAreaSupport): PostalAreaSupport {\n const normalized: Record<string, string[] | boolean> = {};\n\n for (const [key, value] of Object.entries(input)) {\n if (Array.isArray(value)) {\n if (!POSTAL_COUNTRY_KEY_PATTERN.test(key)) {\n throw new Error(\n `Invalid geo_postal_areas key \"${key}\". Use an ISO 3166-1 alpha-2 country code or a deprecated legacy boolean alias.`\n );\n }\n assertSupportedPostalSystems(key, value);\n const systems = (normalized[key] = Array.isArray(normalized[key]) ? (normalized[key] as string[]) : []);\n for (const system of value) appendUnique(systems, system);\n continue;\n }\n if (value === true && key in LEGACY_POSTAL_SYSTEMS) {\n const { country, system } = LEGACY_POSTAL_SYSTEMS[key as keyof typeof LEGACY_POSTAL_SYSTEMS];\n const systems = (normalized[country] = Array.isArray(normalized[country])\n ? (normalized[country] as string[])\n : []);\n appendUnique(systems, system);\n continue;\n }\n if (value === true) {\n throw new Error(\n `Invalid geo_postal_areas legacy alias \"${key}\". Use an ISO 3166-1 alpha-2 country key with supported postal systems.`\n );\n }\n }\n\n for (const [country, value] of Object.entries(normalized)) {\n if (!Array.isArray(value)) continue;\n for (const system of value) {\n const legacy = LEGACY_POSTAL_BY_COUNTRY_SYSTEM.get(`${country}:${system}`);\n if (legacy) normalized[legacy] = true;\n }\n }\n\n return normalized as PostalAreaSupport;\n}\n\nexport function normalizeTargetingCapabilities(input: TargetingCapabilities): _MediaBuyTargetingCapabilities {\n return {\n ...input,\n ...(input.geo_postal_areas && { geo_postal_areas: normalizePostalAreaSupport(input.geo_postal_areas) }),\n } as _MediaBuyTargetingCapabilities;\n}\n\n/**\n * Reporting capabilities the platform supports in `get_media_buy_delivery`.\n *\n * `availableDimensions` is the breakdown axes the platform can group\n * delivery rows by. Vocabulary converged across Scope3 and Prebid.\n */\nexport interface ReportingCapabilities {\n frequencies: ReadonlyArray<'hourly' | 'daily' | 'weekly'>;\n expected_delay_minutes: number;\n timezone: string;\n metrics: string[];\n date_range_support: 'date_range' | 'fixed_only';\n supports_webhooks: boolean;\n availableDimensions?: ReadonlyArray<\n 'geo' | 'device_type' | 'device_platform' | 'audience' | 'placement' | 'creative' | 'keyword' | 'catalog_item'\n >;\n}\n\n/**\n * Brand-protocol capabilities — projected onto the wire `brand` block of\n * `get_adcp_capabilities` via the framework's `overrides.brand` deep-merge\n * seam. Adopters who also implement `BrandRightsPlatform` get\n * `rights: true` auto-derived; the other four fields (`right_types`,\n * `available_uses`, `generation_providers`, `description`) are\n * adopter-declared.\n *\n * Wire spec: `protocol/get-adcp-capabilities-response.json#brand`.\n */\nexport type BrandCapabilities = NonNullable<NonNullable<GetAdCPCapabilitiesResponse['brand']>>;\n\n/**\n * Compliance-testing capabilities — projected onto the wire-side\n * `compliance_testing` block of `get_adcp_capabilities` so buyers and\n * conformance harnesses can discover which `comply_test_controller`\n * scenarios the agent supports.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#compliance_testing`.\n *\n * The `scenarios` array MUST be non-empty when this block is declared\n * (per the spec). `'list_scenarios'` is implicit — adopters don't need\n * to enumerate it.\n */\nexport interface ComplianceTestingCapabilities {\n /**\n * Scenarios this agent advertises support for. Wire enum is the\n * canonical scenario enum, excluding `list_scenarios` because that\n * is a discovery operation rather than a test capability. Framework\n * defaults this from the adopter-supplied `complyTest` adapter set\n * when omitted.\n */\n scenarios?: ReadonlyArray<_ComplianceTestingScenario>;\n}\n"],"mappings":";;;;;;AAkdA,MAAM,wBAAwB;AAAA,EAC5B,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,kBAAkB,EAAE,SAAS,MAAM,QAAQ,gBAAgB;AAAA,EAC3D,YAAY,EAAE,SAAS,MAAM,QAAQ,UAAU;AAAA,EAC/C,SAAS,EAAE,SAAS,MAAM,QAAQ,OAAO;AAAA,EACzC,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,SAAS,EAAE,SAAS,MAAM,QAAQ,OAAO;AAAA,EACzC,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,gBAAgB,EAAE,SAAS,MAAM,QAAQ,cAAc;AAAA,EACvD,aAAa,EAAE,SAAS,MAAM,QAAQ,WAAW;AAAA,EACjD,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AACzC;AAEA,MAAM,kCAAkC,IAAI;AAAA,EAC1C,OAAO,QAAQ,qBAAqB,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,IAAI,MAAM,IAAI,MAAM,CAAC;AAC/G;AAEA,MAAM,4BAA+D;AAAA,EACnE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,MAAM;AACxD;AAAA,IACF;AACA,QAAI,UAAU,QAAQ,OAAO,uBAAuB;AAClD,YAAM,EAAE,SAAS,OAAO,IAAI,sBAAsB,GAAyC;AAC3F,YAAM,UAAW,WAAW,OAAO,IAAI,MAAM,QAAQ,WAAW,OAAO,CAAC,IACnE,WAAW,OAAO,IACnB,CAAC;AACL,mBAAa,SAAS,MAAM;AAC5B;AAAA,IACF;AACA,QAAI,UAAU,MAAM;AAClB,YAAM,IAAI;AAAA,QACR,0CAA0C,GAAG;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AAEA,aAAW,CAAC,SAAS,KAAK,KAAK,OAAO,QAAQ,UAAU,GAAG;AACzD,QAAI,CAAC,MAAM,QAAQ,KAAK,EAAG;AAC3B,eAAW,UAAU,OAAO;AAC1B,YAAM,SAAS,gCAAgC,IAAI,GAAG,OAAO,IAAI,MAAM,EAAE;AACzE,UAAI,OAAQ,YAAW,MAAM,IAAI;AAAA,IACnC;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,+BAA+B,OAA8D;AAC3G,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAI,MAAM,oBAAoB,EAAE,kBAAkB,2BAA2B,MAAM,gBAAgB,EAAE;AAAA,EACvG;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/server/decisioning/capabilities.ts"],"sourcesContent":["/**\n * DecisioningCapabilities — single source of truth for `get_adcp_capabilities`\n * response and any admin UI surface a host wants to render.\n *\n * Adopters declare once. Framework wires the wire-protocol response;\n * adopters' admin tools (or the SDK CLI's `validate_platform_config`) consume\n * the same dataclass so there's no drift between \"what the agent says it\n * supports\" and \"what it actually does.\"\n *\n * Status: Preview / 6.0.\n *\n * @public\n */\n\nimport type { ZodSchema } from 'zod';\nimport type {\n AdCPSpecialism,\n MediaChannel,\n PaymentTerms,\n PricingModel,\n GetAdCPCapabilitiesResponse,\n PostalAreaSupport,\n} from '../../types/tools.generated';\nimport type { ProductMetricOptimizationLike } from '../../utils/capability-rollups';\nimport type { MediaBuyFeatures, AccountCapabilities, CreativeCapabilities } from '../../utils/capabilities';\nimport type { AdcpCapabilitiesOverrides } from '../create-adcp-server';\n\n/**\n * Pre-resolved alias for the wire `media_buy` block. Used as the projection\n * source for the five `media_buy.*` capability fields below so each typed\n * field references a single resolved shape instead of re-walking the\n * `GetAdCPCapabilitiesResponse` type graph independently. Without the\n * alias, `strict + skipLibCheck:false` adopters hit the TS instantiation\n * budget on the published `.d.ts` and tsc OOMs.\n */\ntype _MediaBuyCapabilities = NonNullable<GetAdCPCapabilitiesResponse['media_buy']>;\ntype _MediaBuyTargetingCapabilities = NonNullable<NonNullable<_MediaBuyCapabilities['execution']>['targeting']>;\ntype _ComplianceTestingScenario = NonNullable<\n NonNullable<GetAdCPCapabilitiesResponse['compliance_testing']>['scenarios']\n>[number];\n\nexport interface DecisioningCapabilities<TConfig = unknown> {\n /**\n * Specialisms claimed; framework type-checks these against implemented platform\n * interfaces. Arrays are `readonly` so adopters can declare with `as const`\n * (load-bearing for the `RequiredPlatformsFor<S>` compile-time gate).\n */\n specialisms: readonly AdCPSpecialism[];\n\n /**\n * Creative agents this seller composes with. Framework fetches format catalogs\n * from each (1h cache) and unions them on `list_creative_formats`. Self-hosting\n * sellers point at their own `agent_url`; framework calls into their\n * `CreativePlatform.listFormats()` locally instead of HTTP-fetching.\n *\n * `format_ids` filter (optional) subsets a single creative agent's catalog.\n * Useful when a creative agent hosts 50 formats but this seller only accepts\n * 10 of them. Filter scope is per-creative-agent: `[{ agent_url: A, format_ids: ['x'] }, { agent_url: B }]`\n * means \"from A only format x; from B all formats.\"\n *\n * Omit for signals-only platforms (`signal-marketplace`, `signal-owned`) — they\n * sell audience data access, not media inventory, and don't compose with creative agents.\n */\n creative_agents?: readonly CreativeAgentRef[];\n\n /**\n * Channels this platform sells.\n *\n * Omit for non-media-buy platforms — they don't sell ad inventory and have no\n * channels to declare. Applies to signals (`signal-marketplace`, `signal-owned`),\n * governance (`governance-spend-authority`, `governance-delivery-monitor`,\n * `property-lists`, `collection-lists`, `content-standards`), creative-only\n * (`creative-ad-server`, `creative-template`, `creative-generative`), and\n * brand (`brand-rights`) platforms.\n *\n * **Required at runtime for media-buy platforms.** `validatePlatform` (called\n * by `createAdcpServerFromPlatform`) throws `PlatformConfigError` when any\n * `sales-*` specialism is claimed and this field is absent.\n */\n channels?: readonly MediaChannel[];\n\n /**\n * Pricing models this platform supports.\n *\n * Omit for non-media-buy platforms — they don't sell ad inventory and have no\n * channel-level pricing to declare. For signals platforms specifically, pricing\n * is declared per-signal in the signal descriptor's `pricing_options[]` instead.\n * Same non-media-buy specialism set as `channels` above.\n *\n * **Required at runtime for media-buy platforms.** `validatePlatform` (called\n * by `createAdcpServerFromPlatform`) throws `PlatformConfigError` when any\n * `sales-*` specialism is claimed and this field is absent.\n */\n pricingModels?: readonly PricingModel[];\n\n /** Targeting capabilities. Optional — framework infers reasonable defaults if omitted. */\n targeting?: TargetingCapabilities;\n\n /** Reporting capabilities. Optional — framework infers reasonable defaults if omitted. */\n reporting?: ReportingCapabilities;\n\n /**\n * Audience-matching capabilities — projected onto\n * `get_adcp_capabilities.media_buy.audience_targeting`. Required for\n * audience-sync adopters (CRM-list adopters that accept hashed\n * identifiers + UID types) so buyers know which identifier shapes\n * the platform will match against and what minimum audience size /\n * matching latency to expect. Omit when the platform doesn't accept\n * external audience uploads.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.audience_targeting`.\n */\n audience_targeting?: NonNullable<_MediaBuyCapabilities['audience_targeting']>;\n\n /**\n * Conversion-tracking capabilities — projected onto\n * `get_adcp_capabilities.media_buy.conversion_tracking`. Required for\n * adopters that accept conversion events via `sync_event_sources` /\n * `log_event` so buyers know which event types, action sources,\n * attribution windows, and identifier shapes the platform supports.\n * Omit when the platform doesn't track conversions.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.conversion_tracking`.\n */\n conversion_tracking?: NonNullable<_MediaBuyCapabilities['conversion_tracking']>;\n\n /**\n * Content-standards capabilities — projected onto\n * `get_adcp_capabilities.media_buy.content_standards`. Required for\n * adopters claiming the `content-standards` specialism so buyers know\n * whether the platform runs local evaluation, which channels it\n * covers, and whether it supports webhook artifact delivery. Omit\n * when the platform doesn't ship content-standards artifacts.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.content_standards`.\n */\n content_standards?: NonNullable<_MediaBuyCapabilities['content_standards']>;\n\n /**\n * Seller-level rollup of optimization metrics — projected onto\n * `get_adcp_capabilities.media_buy.supported_optimization_metrics`.\n * Added in AdCP 3.1 (adcp#4669). The array union of every product's\n * `metric_optimization.supported_metrics`. Storyboard runners gate\n * `metric_optimization`-using scenarios on this field; declaring it\n * gives buyers an upfront signal of which optimization metrics the\n * seller can compute against (clicks, views, completed_views, etc.).\n *\n * Adopters can compute the rollup from their catalog using the\n * exported {@link rollupOptimizationMetricsFromProducts} helper —\n * keeps the declaration in sync with what products actually offer.\n * Empty arrays are normalized away and the wire field is omitted; use\n * omission to mean \"no seller-level metric rollup advertised\".\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.supported_optimization_metrics`.\n */\n supported_optimization_metrics?: NonNullable<_MediaBuyCapabilities['supported_optimization_metrics']>;\n\n /**\n * Static product-metric summary used for capability rollups.\n *\n * When this is present and `supported_optimization_metrics` is omitted,\n * the framework derives `media_buy.supported_optimization_metrics` as the\n * sorted union of every product summary's\n * `metric_optimization.supported_metrics`. Full AdCP `Product` objects work,\n * but this field is not a general product-discovery surface; a lightweight\n * startup summary with just the `metric_optimization` block is enough.\n * Dynamic per-account catalogs should continue to pass an explicit\n * `supported_optimization_metrics` override. If the derived union is empty,\n * the framework omits `supported_optimization_metrics` from the wire\n * capabilities response.\n */\n productCatalog?: ReadonlyArray<ProductMetricOptimizationLike>;\n\n /**\n * Frequency-cap support declaration — projected onto\n * `get_adcp_capabilities.media_buy.frequency_capping`. Added in AdCP\n * 3.1 (adcp#4670). Presence-only object with `supported_per_units` /\n * `supported_window_units` sub-fields declaring which frequency-cap\n * shapes the platform honors. Omit when the platform doesn't accept\n * frequency caps at all; buyers will avoid the field on `pacing.*`.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#media_buy.frequency_capping`.\n */\n frequency_capping?: NonNullable<_MediaBuyCapabilities['frequency_capping']>;\n\n /**\n * Whether this seller commits to the proposal lifecycle on get_products.\n * Projected onto `get_adcp_capabilities.media_buy.supports_proposals`.\n * Direct-buy sellers should declare `false` so proposal-only compliance\n * storyboards are skipped; sellers with a ProposalManager are auto-derived\n * as `true` unless they override this explicitly.\n */\n supportsProposals?: boolean;\n\n /**\n * Brand-protocol capabilities. Projected onto the wire `brand` block of\n * `get_adcp_capabilities` (`brand: { rights, right_types, available_uses,\n * generation_providers, description }`). The framework auto-derives\n * `rights: true` when `BrandRightsPlatform` is supplied; adopters\n * declare the rest (right_types they license, RightUses they support,\n * generation providers they issue credentials for).\n *\n * REQUIRED when claiming the `'brand-rights'` specialism — enforced at\n * compile-time via `RequiredCapabilitiesFor<S>`.\n */\n brand?: BrandCapabilities;\n\n /**\n * Compliance-testing capabilities. The presence of this block declares\n * the deployment supports deterministic state-machine testing via the\n * `comply_test_controller` wire tool. Keep this block declared when using\n * `createAdcpServerFromPlatform(..., { complyTest })`; the framework makes\n * live principals byte-identical to a production seller that never wired the\n * controller by hiding this block, filtering `tools/list`, and returning MCP\n * method-not-found for direct live calls.\n *\n * When this block is present, `createAdcpServerFromPlatform` REQUIRES\n * `opts.complyTest` (the `ComplyControllerConfig` adapter set) to be\n * supplied — claiming the capability without implementing the\n * controller is a `PlatformConfigError` at construction.\n *\n * Inversely, supplying `opts.complyTest` without declaring this\n * capability is also caught — the framework derives `scenarios` from\n * the declared force/simulate/seed adapters and emits the discovery\n * field on `get_adcp_capabilities` automatically for sandbox/mock\n * principals. Live principals do not see the block.\n */\n compliance_testing?: ComplianceTestingCapabilities;\n\n /**\n * Billing parties this platform supports. `'operator'` = retail-media model\n * (Criteo, Amazon — operator pays the publisher and bills the brand).\n * `'agent'` = pass-through model (buyer's agent settles directly with the\n * platform). `'advertiser'` = seller invoices the advertiser directly,\n * bypassing operator settlement (advertiser-direct sell-side platforms where\n * the brand is the direct contractual counterparty). Defaults to `['agent']`\n * when omitted. To express advertiser-direct billing per account, set\n * `billing.invoicedTo` to a `BrandReference` (the framework maps any\n * `BrandReference` to `'advertiser'` on the wire).\n */\n supportedBillings?: ReadonlyArray<'operator' | 'agent' | 'advertiser'>;\n\n /**\n * Payment terms this platform accepts on `sync_accounts.payment_terms`.\n * Omit to leave terms validation to `accounts.upsert` (or to accept any\n * schema-valid value). When present, the framework rejects unsupported\n * requested terms with `PAYMENT_TERMS_NOT_SUPPORTED` before dispatching\n * the account entry to the adopter.\n */\n supportedPaymentTerms?: ReadonlyArray<PaymentTerms>;\n\n /**\n * If true, this platform refuses transactions without an authenticated\n * operator principal (operator-billed retail-media). Framework emits\n * `AUTH_REQUIRED` envelope before dispatching to the platform.\n */\n requireOperatorAuth?: boolean;\n\n /**\n * Media-buy feature flags forwarded into `get_adcp_capabilities.media_buy.features`.\n * Adopter values serve as the base; auto-derived `audience_targeting`,\n * `conversion_tracking`, and `content_standards` booleans take precedence\n * for those three keys (overlaid by the framework via the per-domain\n * `media_buy` override on the inner createAdcpServer call). Use this to\n * declare `inlineCreativeManagement` and `propertyListFiltering` directly\n * from `definePlatform`; declare not-supported feature blocks (e.g.\n * `inlineCreativeManagement: false`) so the conformance runner grades\n * them `not_applicable` instead of `fail`.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n features?: Partial<MediaBuyFeatures>;\n\n /**\n * Creative-protocol capabilities forwarded into `get_adcp_capabilities.creative`.\n * Use to declare `supportsCompliance`, `hasCreativeLibrary`,\n * `supportsGeneration`, and `supportsTransformation` from `definePlatform`.\n * Adopters that don't run a provenance-verification pipeline should\n * declare the relevant fields as `false` so creative storyboards gate\n * cleanly.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n creative?: Partial<CreativeCapabilities>;\n\n /**\n * Account capabilities forwarded into `get_adcp_capabilities.account` as a\n * base layer. The framework's existing `requireOperatorAuth` and\n * `supportedBillings` projections overlay on top via the per-domain\n * `account` override, so explicit projections win on those keys.\n * `authorizationEndpoint`, `defaultBilling`, `requiredForProducts`, and\n * `sandbox` are pure adopter-driven additions exposed through this slot.\n *\n * Resolves the `definePlatform` passthrough gap noted in adcp-client#2199.\n */\n account?: Partial<AccountCapabilities>;\n\n /**\n * Deep-merge overrides applied to the wire `get_adcp_capabilities`\n * response. Use this for fields that the top-level `DecisioningCapabilities`\n * shape doesn't model — `media_buy.propagation_surfaces`,\n * `media_buy.measurement_terms`, `signals.discovery_modes`, etc. The\n * framework's per-domain projections (auto-derived `media_buy`, `brand`,\n * `account`, `compliance_testing` blocks) are merged AFTER adopter\n * overrides, so framework-derived values remain authoritative on the keys\n * the projection engine handles.\n *\n * Mirrors `AdcpCapabilitiesConfig.overrides` on the lower-level\n * `createAdcpServer` API. Resolves the `definePlatform` passthrough gap\n * noted in adcp-client#2199.\n */\n overrides?: AdcpCapabilitiesOverrides;\n\n /**\n * Release-precision AdCP versions this platform supports (e.g. `[\"3.0\", \"3.1\"]`).\n * Forwarded into `get_adcp_capabilities.adcp.supported_versions`. 3.1+\n * sellers should declare here the same release-precision strings they\n * emit in `adcp_version` on responses; 3.0-pinned sellers can omit.\n *\n * Resolves the same gap previously noted for `supported_versions` —\n * was unreachable through `definePlatform` because\n * `CreateAdcpServerFromPlatformOptions` omits `'capabilities'` from\n * `AdcpServerConfig`. See adcp-client#2199.\n */\n supported_versions?: string[];\n\n /**\n * Platform-specific config. Strongly typed when the adopter uses the generic.\n * Example: `class GAM extends DecisioningPlatform<{ networkId: string }>`.\n */\n config: TConfig;\n\n /**\n * Optional Zod schema for runtime validation of `config`. When provided,\n * framework validates at platform construction time; missing or wrong-shaped\n * config rejects the agent at boot rather than at first request.\n */\n configSchema?: ZodSchema<TConfig>;\n}\n\nexport interface CreativeAgentRef {\n agent_url: string;\n /** Human-readable label for this creative agent. */\n name?: string;\n /** Optional allowlist of `format_id.id` values from THIS agent's catalog. Omit to include all. */\n format_ids?: string[];\n}\n\n/**\n * Targeting capabilities the platform supports in `create_media_buy`. Maps\n * to AdCP `GetAdcpCapabilitiesResponse.media_buy.execution.targeting`.\n *\n * Shape converged across two independently-evolved peer codebases (Scope3\n * `agentic-adapters`, Prebid `salesagent`). Per-geo-system flags rather than\n * coarse enums because the two implementations agreed: real platforms support\n * specific geo identifier formats (Nielsen DMA, Eurostat NUTS2, US ZIP+4), not\n * abstract \"metro\" / \"postal\" categories.\n */\nexport interface TargetingCapabilities {\n geo_countries?: boolean;\n geo_regions?: boolean;\n\n /** Metro / DMA identifier systems. */\n geo_metros?: {\n nielsen_dma?: boolean;\n uk_itl1?: boolean;\n uk_itl2?: boolean;\n eurostat_nuts2?: boolean;\n };\n\n /**\n * Postal-code identifier systems.\n *\n * AdCP 3.1.0-rc.10 prefers country-keyed arrays, e.g.\n * `{ US: ['zip'], GB: ['outward'] }`. Deprecated country-fused booleans\n * such as `{ us_zip: true }` remain accepted for 3.x adopters; the\n * framework projects both forms with `normalizePostalAreaSupport()` so old\n * and new buyers can read the capability safely during the migration.\n */\n geo_postal_areas?: TargetingPostalAreaSupport;\n\n /** Geographic-proximity targeting (radius / drive-time / arbitrary geometry). */\n geo_proximity?: {\n radius?: boolean;\n travel_time?: boolean;\n geometry?: boolean;\n transport_modes?: ReadonlyArray<'walking' | 'cycling' | 'driving' | 'public_transport'>;\n };\n\n /** Age-restriction targeting; `verification_methods` enumerates the assurance levels accepted. */\n age_restriction?: {\n supported?: boolean;\n verification_methods?: ReadonlyArray<\n 'facial_age_estimation' | 'id_document' | 'digital_id' | 'credit_card' | 'world_id'\n >;\n };\n\n device_platform?: boolean;\n device_type?: boolean;\n language?: boolean;\n audience_include?: boolean;\n audience_exclude?: boolean;\n\n /** Keyword-targeting match types accepted on positive-match terms. */\n keyword_targets?: {\n supported_match_types: ReadonlyArray<'broad' | 'phrase' | 'exact'>;\n };\n\n /** Negative-keyword match types accepted. */\n negative_keywords?: {\n supported_match_types: ReadonlyArray<'broad' | 'phrase' | 'exact'>;\n };\n}\n\nexport type TargetingPostalAreaSupport = {\n US?: readonly ('zip' | 'zip_plus_four')[];\n GB?: readonly ('outward' | 'full')[];\n CA?: readonly ('fsa' | 'full')[];\n DE?: readonly 'plz'[];\n CH?: readonly 'plz'[];\n AT?: readonly 'plz'[];\n FR?: readonly 'code_postal'[];\n AU?: readonly 'postcode'[];\n BR?: readonly 'cep'[];\n IN?: readonly 'pin'[];\n ZA?: readonly 'postal_code'[];\n /** @deprecated Use `US: ['zip']`. */\n us_zip?: boolean;\n /** @deprecated Use `US: ['zip_plus_four']`. */\n us_zip_plus_four?: boolean;\n /** @deprecated Use `GB: ['outward']`. */\n gb_outward?: boolean;\n /** @deprecated Use `GB: ['full']`. */\n gb_full?: boolean;\n /** @deprecated Use `CA: ['fsa']`. */\n ca_fsa?: boolean;\n /** @deprecated Use `CA: ['full']`. */\n ca_full?: boolean;\n /** @deprecated Use `DE: ['plz']`. */\n de_plz?: boolean;\n /** @deprecated Use `FR: ['code_postal']`. */\n fr_code_postal?: boolean;\n /** @deprecated Use `AU: ['postcode']`. */\n au_postcode?: boolean;\n /** @deprecated Use `CH: ['plz']`. */\n ch_plz?: boolean;\n /** @deprecated Use `AT: ['plz']`. */\n at_plz?: boolean;\n [country: `${Uppercase<string>}`]:\n | readonly (\n | 'zip'\n | 'zip_plus_four'\n | 'outward'\n | 'full'\n | 'fsa'\n | 'plz'\n | 'code_postal'\n | 'postcode'\n | 'cep'\n | 'pin'\n | 'postal_code'\n | 'custom'\n )[]\n | undefined;\n};\n\nconst LEGACY_POSTAL_SYSTEMS = {\n us_zip: { country: 'US', system: 'zip' },\n us_zip_plus_four: { country: 'US', system: 'zip_plus_four' },\n gb_outward: { country: 'GB', system: 'outward' },\n gb_full: { country: 'GB', system: 'full' },\n ca_fsa: { country: 'CA', system: 'fsa' },\n ca_full: { country: 'CA', system: 'full' },\n de_plz: { country: 'DE', system: 'plz' },\n fr_code_postal: { country: 'FR', system: 'code_postal' },\n au_postcode: { country: 'AU', system: 'postcode' },\n ch_plz: { country: 'CH', system: 'plz' },\n at_plz: { country: 'AT', system: 'plz' },\n} as const;\n\nconst LEGACY_POSTAL_BY_COUNTRY_SYSTEM = new Map(\n Object.entries(LEGACY_POSTAL_SYSTEMS).map(([legacy, { country, system }]) => [`${country}:${system}`, legacy])\n);\n\nconst POSTAL_SYSTEMS_BY_COUNTRY: Record<string, readonly string[]> = {\n US: ['zip', 'zip_plus_four'],\n GB: ['outward', 'full'],\n CA: ['fsa', 'full'],\n DE: ['plz'],\n CH: ['plz'],\n AT: ['plz'],\n FR: ['code_postal'],\n AU: ['postcode'],\n BR: ['cep'],\n IN: ['pin'],\n ZA: ['postal_code'],\n};\n\nconst GENERIC_POSTAL_SYSTEMS = ['postal_code', 'custom'] as const;\nconst POSTAL_COUNTRY_KEY_PATTERN = /^[A-Z]{2}$/;\n\nfunction appendUnique(target: string[], value: string): void {\n if (!target.includes(value)) target.push(value);\n}\n\nfunction assertSupportedPostalSystems(country: string, systems: readonly string[]): void {\n const allowed = POSTAL_SYSTEMS_BY_COUNTRY[country] ?? GENERIC_POSTAL_SYSTEMS;\n const invalid = systems.filter(system => !allowed.includes(system));\n if (invalid.length > 0) {\n throw new Error(\n `Invalid geo_postal_areas support for ${country}: ${invalid.join(', ')}. ` +\n `Supported systems are: ${allowed.join(', ')}.`\n );\n }\n}\n\n/**\n * Normalize postal-area capabilities across the AdCP 3.1.0-rc.10 migration.\n *\n * The wire schema now prefers `{ US: ['zip'] }` style country-local systems,\n * while the old `{ us_zip: true }` booleans stay deprecated but accepted\n * through 3.x. This helper is deliberately bidirectional:\n *\n * - legacy booleans add their country-keyed system;\n * - country-keyed systems backfill the matching legacy boolean when one exists;\n * - explicit unsupported legacy booleans are omitted unless the system is\n * otherwise advertised.\n */\nexport function normalizePostalAreaSupport(input: TargetingPostalAreaSupport): PostalAreaSupport {\n const normalized: Record<string, string[] | boolean> = {};\n\n for (const [key, value] of Object.entries(input)) {\n if (Array.isArray(value)) {\n if (!POSTAL_COUNTRY_KEY_PATTERN.test(key)) {\n throw new Error(\n `Invalid geo_postal_areas key \"${key}\". Use an ISO 3166-1 alpha-2 country code or a deprecated legacy boolean alias.`\n );\n }\n assertSupportedPostalSystems(key, value);\n const systems = (normalized[key] = Array.isArray(normalized[key]) ? (normalized[key] as string[]) : []);\n for (const system of value) appendUnique(systems, system);\n continue;\n }\n if (value === true && key in LEGACY_POSTAL_SYSTEMS) {\n const { country, system } = LEGACY_POSTAL_SYSTEMS[key as keyof typeof LEGACY_POSTAL_SYSTEMS];\n const systems = (normalized[country] = Array.isArray(normalized[country])\n ? (normalized[country] as string[])\n : []);\n appendUnique(systems, system);\n continue;\n }\n if (value === true) {\n throw new Error(\n `Invalid geo_postal_areas legacy alias \"${key}\". Use an ISO 3166-1 alpha-2 country key with supported postal systems.`\n );\n }\n }\n\n for (const [country, value] of Object.entries(normalized)) {\n if (!Array.isArray(value)) continue;\n for (const system of value) {\n const legacy = LEGACY_POSTAL_BY_COUNTRY_SYSTEM.get(`${country}:${system}`);\n if (legacy) normalized[legacy] = true;\n }\n }\n\n return normalized as PostalAreaSupport;\n}\n\nexport function normalizeTargetingCapabilities(input: TargetingCapabilities): _MediaBuyTargetingCapabilities {\n return {\n ...input,\n ...(input.geo_postal_areas && { geo_postal_areas: normalizePostalAreaSupport(input.geo_postal_areas) }),\n } as _MediaBuyTargetingCapabilities;\n}\n\n/**\n * Reporting capabilities the platform supports in `get_media_buy_delivery`.\n *\n * `availableDimensions` is the breakdown axes the platform can group\n * delivery rows by. Vocabulary converged across Scope3 and Prebid.\n */\nexport interface ReportingCapabilities {\n frequencies: ReadonlyArray<'hourly' | 'daily' | 'weekly'>;\n expected_delay_minutes: number;\n timezone: string;\n metrics: string[];\n date_range_support: 'date_range' | 'fixed_only';\n supports_webhooks: boolean;\n availableDimensions?: ReadonlyArray<\n 'geo' | 'device_type' | 'device_platform' | 'audience' | 'placement' | 'creative' | 'keyword' | 'catalog_item'\n >;\n}\n\n/**\n * Brand-protocol capabilities — projected onto the wire `brand` block of\n * `get_adcp_capabilities` via the framework's `overrides.brand` deep-merge\n * seam. Adopters who also implement `BrandRightsPlatform` get\n * `rights: true` auto-derived; the other four fields (`right_types`,\n * `available_uses`, `generation_providers`, `description`) are\n * adopter-declared.\n *\n * Wire spec: `protocol/get-adcp-capabilities-response.json#brand`.\n */\nexport type BrandCapabilities = NonNullable<NonNullable<GetAdCPCapabilitiesResponse['brand']>>;\n\n/**\n * Compliance-testing capabilities — projected onto the wire-side\n * `compliance_testing` block of `get_adcp_capabilities` so buyers and\n * conformance harnesses can discover which `comply_test_controller`\n * scenarios the agent supports.\n *\n * Wire spec: `core/get-adcp-capabilities-response.json#compliance_testing`.\n *\n * The `scenarios` array MUST be non-empty when this block is declared\n * (per the spec). `'list_scenarios'` is implicit — adopters don't need\n * to enumerate it.\n */\nexport interface ComplianceTestingCapabilities {\n /**\n * Scenarios this agent advertises support for. Wire enum is the\n * canonical scenario enum, excluding `list_scenarios` because that\n * is a discovery operation rather than a test capability. Framework\n * defaults this from the adopter-supplied `complyTest` adapter set\n * when omitted.\n */\n scenarios?: ReadonlyArray<_ComplianceTestingScenario>;\n}\n"],"mappings":"AAkdA,MAAM,wBAAwB;AAAA,EAC5B,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,kBAAkB,EAAE,SAAS,MAAM,QAAQ,gBAAgB;AAAA,EAC3D,YAAY,EAAE,SAAS,MAAM,QAAQ,UAAU;AAAA,EAC/C,SAAS,EAAE,SAAS,MAAM,QAAQ,OAAO;AAAA,EACzC,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAAA,EACvC,SAAS,EAAE,SAAS,MAAM,QAAQ,OAAO;AAAA,EACzC,QAAQ,EAAE,SAAS,MAAM,QAAQ,MAAM;AAA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as __adcpFileURLToPath } from 'node:url';
2
- import { dirname as __adcpDirname } from 'node:path';
3
- import { createRequire as __adcpCreateRequire } from 'node:module';
4
- const __filename = __adcpFileURLToPath(import.meta.url);
5
- const __dirname = __adcpDirname(__filename);
6
- const require = __adcpCreateRequire(import.meta.url);
7
1
  function composeSingle(inner, hooks) {
8
2
  return async (params, ctx) => {
9
3
  let result;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/server/decisioning/compose.ts"],"sourcesContent":["/**\n * Method-level composition helpers for {@link DecisioningPlatform} adopters\n * who need to wrap individual platform methods with pre/post hooks — typical\n * shapes are early-return short-circuits (price-optimization paths skipping\n * the inner call), response enrichment (carbon emissions, brand-manifest\n * merging), and response-level caching.\n *\n * Closes adcp-client#1314.\n *\n * @public\n */\n\n/**\n * Wrapper returned by a `before` hook to short-circuit the wrapped method.\n *\n * Returning a wrapped object (e.g. `{ shortCircuit: cachedPriceOpt }`) skips\n * the inner method and feeds the wrapped value through `after` (if any)\n * back to the caller. Returning `undefined` (or no return) falls through.\n *\n * Discriminated wrapper rather than a sentinel symbol because the wrapper\n * is unambiguous even when `TResult` itself includes `undefined`, and\n * adopters can't accidentally short-circuit by forgetting an import.\n *\n * @public\n */\nexport interface ComposeShortCircuit<TResult> {\n shortCircuit: TResult;\n}\n\n/**\n * Hooks accepted by {@link composeMethod}.\n *\n * `before` returning `undefined` (or no return) falls through to the wrapped\n * method. Returning `{ shortCircuit: value }` short-circuits — `after` (if\n * any) still runs on the short-circuit value before it flows back to the\n * caller.\n *\n * `after` runs on the result whether it came from the wrapped method or\n * from a `before` short-circuit. Receives the original `params` and `ctx`\n * for context-dependent enrichment.\n *\n * The `after` hook runs BEFORE response-schema validation. The wrapped\n * value still has to satisfy the wire schema for the tool — adopters\n * decorating responses with vendor-specific data should put it under\n * `ext` (the spec's typed extension surface) rather than at the top level.\n *\n * @public\n */\nexport interface ComposeHooks<TParams, TCtx, TResult> {\n before?: (params: TParams, ctx: TCtx) => Promise<ComposeShortCircuit<TResult> | undefined>;\n after?: (result: TResult, params: TParams, ctx: TCtx) => Promise<TResult>;\n}\n\ntype MethodFn<TParams, TCtx, TResult> = (params: TParams, ctx: TCtx) => Promise<TResult>;\n\nfunction composeSingle<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n hooks: ComposeHooks<TParams, TCtx, TResult>\n): MethodFn<TParams, TCtx, TResult> {\n return async (params, ctx) => {\n let result: TResult;\n if (hooks.before) {\n const early = await hooks.before(params, ctx);\n if (early === undefined) {\n result = await inner(params, ctx);\n } else {\n result = early.shortCircuit;\n }\n } else {\n result = await inner(params, ctx);\n }\n if (hooks.after) {\n result = await hooks.after(result, params, ctx);\n }\n return result;\n };\n}\n\n/**\n * Wrap a single platform method with optional `before` / `after` hooks.\n *\n * Type-preserving: the returned function has the same `(params, ctx) =>\n * Promise<TResult>` signature as `inner`, so it slots into a typed\n * `DecisioningPlatform` shape without `as` casts.\n *\n * Validates `inner` is a function eagerly (at wrap time, not at first\n * invocation) so adopters who reference an optional method that wasn't\n * implemented on the underlying platform get a clear error at module load\n * rather than the first traffic to hit the method.\n *\n * **Variadic overload** — pass multiple hooks to chain them without nesting.\n * `before` hooks run left-to-right (first argument runs first); `after`\n * hooks run right-to-left (last argument runs first), matching standard\n * middleware-stack semantics. A short-circuit from a `before` hook skips\n * remaining `before` hooks and the `after` hooks of inner wrappers that\n * were never entered; `after` hooks for the short-circuiting wrapper and\n * any outer wrappers still run. Equivalent to manually nesting\n * `composeMethod` calls right-to-left:\n *\n * ```ts\n * // These are identical:\n * composeMethod(inner, hookA, hookB, hookC)\n * composeMethod(composeMethod(composeMethod(inner, hookC), hookB), hookA)\n * ```\n *\n * @example Short-circuit + enrichment (single hook)\n * ```ts\n * import { composeMethod } from '@adcp/sdk/server';\n *\n * const wrapped = {\n * ...basePlatform,\n * sales: {\n * ...basePlatform.sales,\n * getMediaBuyDelivery: composeMethod(basePlatform.sales.getMediaBuyDelivery, {\n * before: async (params) =>\n * params.optimization === 'price'\n * ? { shortCircuit: cachedPriceOpt }\n * : undefined,\n * after: async (result) => ({\n * ...result,\n * ext: { ...result.ext, carbon_grams_per_impression: await score(result) },\n * }),\n * }),\n * getProducts: composeMethod(basePlatform.sales.getProducts, {\n * after: async (result) => mergeBrandManifest(result, await brandCache.get()),\n * }),\n * },\n * };\n *\n * createAdcpServerFromPlatform(wrapped, opts);\n * ```\n *\n * @example Stacking multiple security gates (variadic)\n * ```ts\n * import { composeMethod, requireAdvertiserMatch } from '@adcp/sdk/server';\n *\n * accounts: {\n * resolve: composeMethod(\n * baseResolve,\n * { before: async (_p, ctx) => ctx.token ? undefined : { shortCircuit: null } },\n * requireAdvertiserMatch(async (ctx) => tenantRoster.for(ctx?.agent)),\n * ),\n * }\n * ```\n *\n * @public\n */\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n hooks: ComposeHooks<TParams, TCtx, TResult>\n): MethodFn<TParams, TCtx, TResult>;\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n first: ComposeHooks<TParams, TCtx, TResult>,\n ...rest: ComposeHooks<TParams, TCtx, TResult>[]\n): MethodFn<TParams, TCtx, TResult>;\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n first: ComposeHooks<TParams, TCtx, TResult>,\n ...rest: ComposeHooks<TParams, TCtx, TResult>[]\n): MethodFn<TParams, TCtx, TResult> {\n if (typeof inner !== 'function') {\n throw new TypeError(\n `composeMethod: 'inner' must be a function, got ${inner === null ? 'null' : typeof inner}. ` +\n `Did you reference an optional method that wasn't implemented on the platform?`\n );\n }\n if (rest.length === 0) {\n return composeSingle(inner, first);\n }\n // Fold right so the first argument becomes the outermost wrapper (runs first).\n // Equivalent to: composeMethod(composeMethod(composeMethod(inner, hookC), hookB), hookA)\n return [first, ...rest].reduceRight<MethodFn<TParams, TCtx, TResult>>(\n (acc, hooks) => composeSingle(acc, hooks),\n inner\n );\n}\n"],"mappings":";;;;;;AAuDA,SAAS,cACP,OACA,OACkC;AAClC,SAAO,OAAO,QAAQ,QAAQ;AAC5B,QAAI;AACJ,QAAI,MAAM,QAAQ;AAChB,YAAM,QAAQ,MAAM,MAAM,OAAO,QAAQ,GAAG;AAC5C,UAAI,UAAU,QAAW;AACvB,iBAAS,MAAM,MAAM,QAAQ,GAAG;AAAA,MAClC,OAAO;AACL,iBAAS,MAAM;AAAA,MACjB;AAAA,IACF,OAAO;AACL,eAAS,MAAM,MAAM,QAAQ,GAAG;AAAA,IAClC;AACA,QAAI,MAAM,OAAO;AACf,eAAS,MAAM,MAAM,MAAM,QAAQ,QAAQ,GAAG;AAAA,IAChD;AACA,WAAO;AAAA,EACT;AACF;AAgFO,SAAS,cACd,OACA,UACG,MAC+B;AAClC,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,IAAI;AAAA,MACR,kDAAkD,UAAU,OAAO,SAAS,OAAO,KAAK;AAAA,IAE1F;AAAA,EACF;AACA,MAAI,KAAK,WAAW,GAAG;AACrB,WAAO,cAAc,OAAO,KAAK;AAAA,EACnC;AAGA,SAAO,CAAC,OAAO,GAAG,IAAI,EAAE;AAAA,IACtB,CAAC,KAAK,UAAU,cAAc,KAAK,KAAK;AAAA,IACxC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/server/decisioning/compose.ts"],"sourcesContent":["/**\n * Method-level composition helpers for {@link DecisioningPlatform} adopters\n * who need to wrap individual platform methods with pre/post hooks — typical\n * shapes are early-return short-circuits (price-optimization paths skipping\n * the inner call), response enrichment (carbon emissions, brand-manifest\n * merging), and response-level caching.\n *\n * Closes adcp-client#1314.\n *\n * @public\n */\n\n/**\n * Wrapper returned by a `before` hook to short-circuit the wrapped method.\n *\n * Returning a wrapped object (e.g. `{ shortCircuit: cachedPriceOpt }`) skips\n * the inner method and feeds the wrapped value through `after` (if any)\n * back to the caller. Returning `undefined` (or no return) falls through.\n *\n * Discriminated wrapper rather than a sentinel symbol because the wrapper\n * is unambiguous even when `TResult` itself includes `undefined`, and\n * adopters can't accidentally short-circuit by forgetting an import.\n *\n * @public\n */\nexport interface ComposeShortCircuit<TResult> {\n shortCircuit: TResult;\n}\n\n/**\n * Hooks accepted by {@link composeMethod}.\n *\n * `before` returning `undefined` (or no return) falls through to the wrapped\n * method. Returning `{ shortCircuit: value }` short-circuits — `after` (if\n * any) still runs on the short-circuit value before it flows back to the\n * caller.\n *\n * `after` runs on the result whether it came from the wrapped method or\n * from a `before` short-circuit. Receives the original `params` and `ctx`\n * for context-dependent enrichment.\n *\n * The `after` hook runs BEFORE response-schema validation. The wrapped\n * value still has to satisfy the wire schema for the tool — adopters\n * decorating responses with vendor-specific data should put it under\n * `ext` (the spec's typed extension surface) rather than at the top level.\n *\n * @public\n */\nexport interface ComposeHooks<TParams, TCtx, TResult> {\n before?: (params: TParams, ctx: TCtx) => Promise<ComposeShortCircuit<TResult> | undefined>;\n after?: (result: TResult, params: TParams, ctx: TCtx) => Promise<TResult>;\n}\n\ntype MethodFn<TParams, TCtx, TResult> = (params: TParams, ctx: TCtx) => Promise<TResult>;\n\nfunction composeSingle<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n hooks: ComposeHooks<TParams, TCtx, TResult>\n): MethodFn<TParams, TCtx, TResult> {\n return async (params, ctx) => {\n let result: TResult;\n if (hooks.before) {\n const early = await hooks.before(params, ctx);\n if (early === undefined) {\n result = await inner(params, ctx);\n } else {\n result = early.shortCircuit;\n }\n } else {\n result = await inner(params, ctx);\n }\n if (hooks.after) {\n result = await hooks.after(result, params, ctx);\n }\n return result;\n };\n}\n\n/**\n * Wrap a single platform method with optional `before` / `after` hooks.\n *\n * Type-preserving: the returned function has the same `(params, ctx) =>\n * Promise<TResult>` signature as `inner`, so it slots into a typed\n * `DecisioningPlatform` shape without `as` casts.\n *\n * Validates `inner` is a function eagerly (at wrap time, not at first\n * invocation) so adopters who reference an optional method that wasn't\n * implemented on the underlying platform get a clear error at module load\n * rather than the first traffic to hit the method.\n *\n * **Variadic overload** — pass multiple hooks to chain them without nesting.\n * `before` hooks run left-to-right (first argument runs first); `after`\n * hooks run right-to-left (last argument runs first), matching standard\n * middleware-stack semantics. A short-circuit from a `before` hook skips\n * remaining `before` hooks and the `after` hooks of inner wrappers that\n * were never entered; `after` hooks for the short-circuiting wrapper and\n * any outer wrappers still run. Equivalent to manually nesting\n * `composeMethod` calls right-to-left:\n *\n * ```ts\n * // These are identical:\n * composeMethod(inner, hookA, hookB, hookC)\n * composeMethod(composeMethod(composeMethod(inner, hookC), hookB), hookA)\n * ```\n *\n * @example Short-circuit + enrichment (single hook)\n * ```ts\n * import { composeMethod } from '@adcp/sdk/server';\n *\n * const wrapped = {\n * ...basePlatform,\n * sales: {\n * ...basePlatform.sales,\n * getMediaBuyDelivery: composeMethod(basePlatform.sales.getMediaBuyDelivery, {\n * before: async (params) =>\n * params.optimization === 'price'\n * ? { shortCircuit: cachedPriceOpt }\n * : undefined,\n * after: async (result) => ({\n * ...result,\n * ext: { ...result.ext, carbon_grams_per_impression: await score(result) },\n * }),\n * }),\n * getProducts: composeMethod(basePlatform.sales.getProducts, {\n * after: async (result) => mergeBrandManifest(result, await brandCache.get()),\n * }),\n * },\n * };\n *\n * createAdcpServerFromPlatform(wrapped, opts);\n * ```\n *\n * @example Stacking multiple security gates (variadic)\n * ```ts\n * import { composeMethod, requireAdvertiserMatch } from '@adcp/sdk/server';\n *\n * accounts: {\n * resolve: composeMethod(\n * baseResolve,\n * { before: async (_p, ctx) => ctx.token ? undefined : { shortCircuit: null } },\n * requireAdvertiserMatch(async (ctx) => tenantRoster.for(ctx?.agent)),\n * ),\n * }\n * ```\n *\n * @public\n */\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n hooks: ComposeHooks<TParams, TCtx, TResult>\n): MethodFn<TParams, TCtx, TResult>;\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n first: ComposeHooks<TParams, TCtx, TResult>,\n ...rest: ComposeHooks<TParams, TCtx, TResult>[]\n): MethodFn<TParams, TCtx, TResult>;\nexport function composeMethod<TParams, TCtx, TResult>(\n inner: MethodFn<TParams, TCtx, TResult>,\n first: ComposeHooks<TParams, TCtx, TResult>,\n ...rest: ComposeHooks<TParams, TCtx, TResult>[]\n): MethodFn<TParams, TCtx, TResult> {\n if (typeof inner !== 'function') {\n throw new TypeError(\n `composeMethod: 'inner' must be a function, got ${inner === null ? 'null' : typeof inner}. ` +\n `Did you reference an optional method that wasn't implemented on the platform?`\n );\n }\n if (rest.length === 0) {\n return composeSingle(inner, first);\n }\n // Fold right so the first argument becomes the outermost wrapper (runs first).\n // Equivalent to: composeMethod(composeMethod(composeMethod(inner, hookC), hookB), hookA)\n return [first, ...rest].reduceRight<MethodFn<TParams, TCtx, TResult>>(\n (acc, hooks) => composeSingle(acc, hooks),\n inner\n );\n}\n"],"mappings":"AAuDA,SAAS,cACP,OACA,OACkC;AAClC,SAAO,OAAO,QAAQ,QAAQ;AAC5B,QAAI;AACJ,QAAI,MAAM,QAAQ;AAChB,YAAM,QAAQ,MAAM,MAAM,OAAO,QAAQ,GAAG;AAC5C,UAAI,UAAU,QAAW;AACvB,iBAAS,MAAM,MAAM,QAAQ,GAAG;AAAA,MAClC,OAAO;AACL,iBAAS,MAAM;AAAA,MACjB;AAAA,IACF,OAAO;AACL,eAAS,MAAM,MAAM,QAAQ,GAAG;AAAA,IAClC;AACA,QAAI,MAAM,OAAO;AACf,eAAS,MAAM,MAAM,MAAM,QAAQ,QAAQ,GAAG;AAAA,IAChD;AACA,WAAO;AAAA,EACT;AACF;AAgFO,SAAS,cACd,OACA,UACG,MAC+B;AAClC,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,IAAI;AAAA,MACR,kDAAkD,UAAU,OAAO,SAAS,OAAO,KAAK;AAAA,IAE1F;AAAA,EACF;AACA,MAAI,KAAK,WAAW,GAAG;AACrB,WAAO,cAAc,OAAO,KAAK;AAAA,EACnC;AAGA,SAAO,CAAC,OAAO,GAAG,IAAI,EAAE;AAAA,IACtB,CAAC,KAAK,UAAU,cAAc,KAAK,KAAK;AAAA,IACxC;AAAA,EACF;AACF;","names":[]}
@@ -1,7 +1 @@
1
- import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
2
- import { dirname as __adcpDirname } from 'node:path';
3
- import { createRequire as __adcpCreateRequire } from 'node:module';
4
- const __filename = __adcpFileURLToPath(import.meta.url);
5
- const __dirname = __adcpDirname(__filename);
6
- const require = __adcpCreateRequire(import.meta.url);
7
1
  //# sourceMappingURL=context.mjs.map
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
2
- import { dirname as __adcpDirname } from 'node:path';
3
- import { createRequire as __adcpCreateRequire } from 'node:module';
4
- const __filename = __adcpFileURLToPath(import.meta.url);
5
- const __dirname = __adcpDirname(__filename);
6
- const require = __adcpCreateRequire(import.meta.url);
7
1
  import { AdcpError } from "./async-outcome.mjs";
8
2
  class PackageNotFoundError extends AdcpError {
9
3
  constructor(packageId, opts = {}) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"sourcesContent":["/**\n * Typed `AdcpError` subclasses. Adopters pick from a closed set of class\n * imports rather than memorizing string codes + recovery semantics.\n *\n * Each class encodes the canonical `code` / `field` / `suggestion` shape\n * for its scenario. `recovery` is inherited from the spec via\n * `getErrorRecovery(code)` — these classes never hardcode it. That keeps\n * the typed-class hierarchy in lockstep with the canonical recovery\n * classifications in `STANDARD_ERROR_CODES` (which derives from the\n * generated `ErrorCodeValues`). When the spec rev changes a recovery\n * value, every typed class picks it up automatically.\n *\n * LLM-generated platforms get autocomplete on the import; humans skim\n * the list to find the right class for their case.\n *\n * Empirical baseline (Emma matrix v17, 2026-04-30): LLM-generated\n * sellers throw generic `Error` because the AdcpError code catalog\n * isn't visible at the throw site. Framework auto-maps generic throws\n * to `SERVICE_UNAVAILABLE`, which storyboards reject because (e.g.)\n * the right code for \"package_id doesn't exist\" is `PACKAGE_NOT_FOUND`.\n * Typed classes close the gap: the LLM imports `PackageNotFoundError`\n * and the right code is implicit.\n *\n * **Coverage**: the ~20 highest-traffic codes from the v3 spec. Adopters\n * needing a code not in this list still construct `AdcpError(code, ...)`\n * directly with the full code vocabulary; this module is a convenience\n * over the typed-class subset.\n *\n * @public\n */\n\nimport { AdcpError } from './async-outcome';\n\ninterface CommonOpts {\n /** Override the default message. Most callers use the default. */\n message?: string;\n /** Suggested fix surfaced to the buyer. */\n suggestion?: string;\n /** Additional structured context. */\n details?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------\n// Resource-not-found family.\n// ---------------------------------------------------------------------------\n\nexport class PackageNotFoundError extends AdcpError {\n constructor(packageId: string, opts: CommonOpts = {}) {\n super('PACKAGE_NOT_FOUND', {\n message: opts.message ?? `Package not found: ${packageId}`,\n field: 'package_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class MediaBuyNotFoundError extends AdcpError {\n constructor(mediaBuyId: string, opts: CommonOpts = {}) {\n super('MEDIA_BUY_NOT_FOUND', {\n message: opts.message ?? `Media buy not found: ${mediaBuyId}`,\n field: 'media_buy_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class ProductNotFoundError extends AdcpError {\n constructor(productId: string, opts: CommonOpts = {}) {\n super('PRODUCT_NOT_FOUND', {\n message: opts.message ?? `Product not found: ${productId}`,\n field: 'product_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class CreativeNotFoundError extends AdcpError {\n constructor(creativeId: string, opts: CommonOpts = {}) {\n super('CREATIVE_NOT_FOUND', {\n message: opts.message ?? `Creative not found: ${creativeId}`,\n field: 'creative_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// Note: an `AccountNotFoundError` already exists in `./account` as a plain\n// `Error` subclass for the framework's `accounts.resolve()` path (caught\n// and translated internally). Adopters who need the wire-facing\n// `ACCOUNT_NOT_FOUND` error code throw `new AdcpError('ACCOUNT_NOT_FOUND',\n// { message: '...', field: 'account.id' })` directly — recovery defaults\n// to the spec value (`terminal`) via `getErrorRecovery`.\n\n// ---------------------------------------------------------------------------\n// Resource-unavailable family — id is right but state precludes use.\n// ---------------------------------------------------------------------------\n\nexport class ProductUnavailableError extends AdcpError {\n constructor(productId: string, opts: CommonOpts = {}) {\n super('PRODUCT_UNAVAILABLE', {\n message: opts.message ?? `Product unavailable (sold out / no inventory): ${productId}`,\n field: 'product_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class CreativeRejectedError extends AdcpError {\n constructor(creativeId: string, reason: string, opts: CommonOpts = {}) {\n super('CREATIVE_REJECTED', {\n message: opts.message ?? `Creative ${creativeId} rejected: ${reason}`,\n field: 'creative_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Budget family\n// ---------------------------------------------------------------------------\n\nexport class BudgetTooLowError extends AdcpError {\n constructor(opts: CommonOpts & { floor?: number; currency?: string } = {}) {\n const floorStr =\n opts.floor != null && opts.currency != null\n ? `Floor is ${opts.floor} ${opts.currency}.`\n : opts.floor != null\n ? `Floor is ${opts.floor}.`\n : 'Budget below required floor.';\n super('BUDGET_TOO_LOW', {\n message: opts.message ?? floorStr,\n field: 'total_budget',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.floor != null && { details: { ...(opts.details ?? {}), floor: opts.floor, currency: opts.currency } }),\n });\n }\n}\n\nexport class BudgetExhaustedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('BUDGET_EXHAUSTED', {\n message: opts.message ?? 'Budget exhausted.',\n field: 'total_budget',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Idempotency family\n// ---------------------------------------------------------------------------\n\nexport class IdempotencyConflictError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('IDEMPOTENCY_CONFLICT', {\n message: opts.message ?? 'Same idempotency_key with different payload.',\n field: 'idempotency_key',\n suggestion: opts.suggestion ?? 'Use a fresh idempotency_key for the new payload.',\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Validation / state family\n// ---------------------------------------------------------------------------\n\nexport class InvalidRequestError extends AdcpError {\n constructor(field: string, message: string, opts: CommonOpts = {}) {\n super('INVALID_REQUEST', {\n message,\n field,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class InvalidStateError extends AdcpError {\n constructor(field: string, message: string, opts: CommonOpts = {}) {\n super('INVALID_STATE', {\n message,\n field,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * Convenience for the common `start_time >= end_time` case. Use\n * `InvalidRequestError` for arbitrary field-level validation.\n */\nexport class BackwardsTimeRangeError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('INVALID_REQUEST', {\n message: opts.message ?? 'start_time must be before end_time.',\n field: 'start_time',\n suggestion: opts.suggestion ?? 'Verify the buyer-provided campaign window.',\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Auth / permission family\n// ---------------------------------------------------------------------------\n\n/**\n * No credentials were presented. Sellers MUST return this when no\n * `Authorization` header was included on the request. Recovery:\n * correctable (provide credentials via the auth header and retry).\n *\n * @since AdCP 3.1 (adcp#3730 splits `AUTH_REQUIRED`).\n */\nexport class AuthMissingError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_MISSING', {\n message: opts.message ?? 'Authentication required: no credentials presented.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * 3.0.x-era authentication error that conflates missing credentials with\n * rejected credentials. AdCP 3.1 splits this into {@link AuthMissingError}\n * (correctable; no `Authorization` header presented) and\n * {@link AuthInvalidError} (terminal; credentials presented but rejected).\n *\n * This deprecated convenience remains wire-compatible and still emits\n * `AUTH_REQUIRED`. New seller code should throw {@link AuthMissingError}\n * or {@link AuthInvalidError} explicitly; buyer code should continue to\n * handle wire `AUTH_REQUIRED` for older sellers and SDK compatibility paths.\n *\n * @deprecated Prefer `AuthMissingError` (missing credentials) or\n * `AuthInvalidError` (rejected credentials). Retained as a source-compatible\n * alias for older adopter code during the 3.x deprecation window.\n */\nexport class AuthRequiredError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_REQUIRED', {\n message: opts.message ?? 'Authentication required.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * Credentials were presented but rejected — revoked, malformed signature,\n * or a key no longer in the seller's keystore. Recovery: terminal — do NOT\n * auto-retry. Auto-retry creates an SSO retry-storm indistinguishable from\n * brute-force probing. The decisioning runtime treats this as terminal even\n * when an account store has a refresh hook.\n *\n * **Credential-leak guard.** `opts.message` and `opts.details` cross to\n * the buyer verbatim on the wire envelope. Do NOT place rejected\n * credentials, token fragments, JWT payload material, or upstream\n * identity-provider error bodies in either field — log those server-side\n * instead. The framework is a witness, not a redactor.\n *\n * @since AdCP 3.1 (adcp#3730 splits `AUTH_REQUIRED`).\n */\nexport class AuthInvalidError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_INVALID', {\n message: opts.message ?? 'Authentication failed: credentials rejected.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class PermissionDeniedError extends AdcpError {\n constructor(action: string, opts: CommonOpts = {}) {\n super('PERMISSION_DENIED', {\n message: opts.message ?? `Permission denied for ${action}.`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), action },\n });\n }\n}\n\n/**\n * The buyer agent's commercial relationship with the seller is suspended.\n * Recovery: terminal at the wire level — a buyer cannot \"wait out\" a\n * suspension by retrying the same request. The transient-vs-permanent\n * distinction lives at the seller's `BuyerAgent.status` record, not on the\n * wire.\n *\n * Consolidates the 3.0.5 placeholder shape\n * `PERMISSION_DENIED + details.scope:'agent' + details.status:'suspended'`,\n * which is removed in 3.1 (envelopes carrying `details.status` fail schema\n * validation).\n *\n * @since AdCP 3.1 (adcp#3906 consolidates the `details.status` placeholder).\n */\nexport class AgentSuspendedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AGENT_SUSPENDED', {\n message: opts.message ?? 'Buyer agent is suspended. Contact the seller to restore access.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * The buyer agent is permanently denied by the seller. Recovery: terminal —\n * re-onboarding under a new agent identity is the only recovery path.\n *\n * Consolidates the 3.0.5 placeholder shape\n * `PERMISSION_DENIED + details.scope:'agent' + details.status:'blocked'`,\n * which is removed in 3.1.\n *\n * @since AdCP 3.1 (adcp#3906 consolidates the `details.status` placeholder).\n */\nexport class AgentBlockedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AGENT_BLOCKED', {\n message: opts.message ?? 'Buyer agent is blocked.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Throttling / availability family\n// ---------------------------------------------------------------------------\n\nexport class RateLimitedError extends AdcpError {\n constructor(retryAfterSeconds: number, opts: CommonOpts = {}) {\n super('RATE_LIMITED', {\n message: opts.message ?? `Rate limited. Retry after ${retryAfterSeconds}s.`,\n retry_after: Math.max(1, Math.min(3600, Math.floor(retryAfterSeconds))),\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class ServiceUnavailableError extends AdcpError {\n constructor(opts: CommonOpts & { retryAfterSeconds?: number } = {}) {\n super('SERVICE_UNAVAILABLE', {\n message: opts.message ?? 'Service temporarily unavailable.',\n retry_after:\n opts.retryAfterSeconds != null ? Math.max(1, Math.min(3600, Math.floor(opts.retryAfterSeconds))) : 60,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class UnsupportedFeatureError extends AdcpError {\n constructor(feature: string, opts: CommonOpts = {}) {\n super('UNSUPPORTED_FEATURE', {\n message: opts.message ?? `Feature not supported: ${feature}.`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), feature },\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Compliance / governance family\n// ---------------------------------------------------------------------------\n\nexport class ComplianceUnsatisfiedError extends AdcpError {\n constructor(reason: string, opts: CommonOpts = {}) {\n super('COMPLIANCE_UNSATISFIED', {\n message: opts.message ?? `Compliance not satisfied: ${reason}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\nexport class GovernanceDeniedError extends AdcpError {\n constructor(reason: string, opts: CommonOpts = {}) {\n super('GOVERNANCE_DENIED', {\n message: opts.message ?? `Governance denied: ${reason}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\nexport class PolicyViolationError extends AdcpError {\n constructor(policy: string, opts: CommonOpts = {}) {\n super('POLICY_VIOLATION', {\n message: opts.message ?? `Policy violation: ${policy}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), policy },\n });\n }\n}\n"],"mappings":";;;;;;AA+BA,SAAS,iBAAiB;AAenB,MAAM,6BAA6B,UAAU;AAAA,EAClD,YAAY,WAAmB,OAAmB,CAAC,GAAG;AACpD,UAAM,qBAAqB;AAAA,MACzB,SAAS,KAAK,WAAW,sBAAsB,SAAS;AAAA,MACxD,OAAO;AAAA,MACP,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,QAAQ;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;AAEO,MAAM,8BAA8B,UAAU;AAAA,EACnD,YAAY,YAAoB,OAAmB,CAAC,GAAG;AACrD,UAAM,uBAAuB;AAAA,MAC3B,SAAS,KAAK,WAAW,wBAAwB,UAAU;AAAA,MAC3D,OAAO;AAAA,MACP,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,QAAQ;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;AAEO,MAAM,6BAA6B,UAAU;AAAA,EAClD,YAAY,WAAmB,OAAmB,CAAC,GAAG;AACpD,UAAM,qBAAqB;AAAA,MACzB,SAAS,KAAK,WAAW,sBAAsB,SAAS;AAAA,MACxD,OAAO;AAAA,MACP,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,QAAQ;AAAA,IAC5D,CAAC;AAAA,EACH;AACF;AAEO,MAAM,8BAA8B,UAAU;AAAA,EACnD,YAAY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,MACxB,SAAS,KAAK,WAAW,qBAAqB,MAAM;AAAA,MACpD,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,SAAS,EAAE,GAAI,KAAK,WAAW,CAAC,GAAI,OAAO;AAAA,IAC7C,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/server/decisioning/errors-typed.ts"],"sourcesContent":["/**\n * Typed `AdcpError` subclasses. Adopters pick from a closed set of class\n * imports rather than memorizing string codes + recovery semantics.\n *\n * Each class encodes the canonical `code` / `field` / `suggestion` shape\n * for its scenario. `recovery` is inherited from the spec via\n * `getErrorRecovery(code)` — these classes never hardcode it. That keeps\n * the typed-class hierarchy in lockstep with the canonical recovery\n * classifications in `STANDARD_ERROR_CODES` (which derives from the\n * generated `ErrorCodeValues`). When the spec rev changes a recovery\n * value, every typed class picks it up automatically.\n *\n * LLM-generated platforms get autocomplete on the import; humans skim\n * the list to find the right class for their case.\n *\n * Empirical baseline (Emma matrix v17, 2026-04-30): LLM-generated\n * sellers throw generic `Error` because the AdcpError code catalog\n * isn't visible at the throw site. Framework auto-maps generic throws\n * to `SERVICE_UNAVAILABLE`, which storyboards reject because (e.g.)\n * the right code for \"package_id doesn't exist\" is `PACKAGE_NOT_FOUND`.\n * Typed classes close the gap: the LLM imports `PackageNotFoundError`\n * and the right code is implicit.\n *\n * **Coverage**: the ~20 highest-traffic codes from the v3 spec. Adopters\n * needing a code not in this list still construct `AdcpError(code, ...)`\n * directly with the full code vocabulary; this module is a convenience\n * over the typed-class subset.\n *\n * @public\n */\n\nimport { AdcpError } from './async-outcome';\n\ninterface CommonOpts {\n /** Override the default message. Most callers use the default. */\n message?: string;\n /** Suggested fix surfaced to the buyer. */\n suggestion?: string;\n /** Additional structured context. */\n details?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------\n// Resource-not-found family.\n// ---------------------------------------------------------------------------\n\nexport class PackageNotFoundError extends AdcpError {\n constructor(packageId: string, opts: CommonOpts = {}) {\n super('PACKAGE_NOT_FOUND', {\n message: opts.message ?? `Package not found: ${packageId}`,\n field: 'package_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class MediaBuyNotFoundError extends AdcpError {\n constructor(mediaBuyId: string, opts: CommonOpts = {}) {\n super('MEDIA_BUY_NOT_FOUND', {\n message: opts.message ?? `Media buy not found: ${mediaBuyId}`,\n field: 'media_buy_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class ProductNotFoundError extends AdcpError {\n constructor(productId: string, opts: CommonOpts = {}) {\n super('PRODUCT_NOT_FOUND', {\n message: opts.message ?? `Product not found: ${productId}`,\n field: 'product_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class CreativeNotFoundError extends AdcpError {\n constructor(creativeId: string, opts: CommonOpts = {}) {\n super('CREATIVE_NOT_FOUND', {\n message: opts.message ?? `Creative not found: ${creativeId}`,\n field: 'creative_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// Note: an `AccountNotFoundError` already exists in `./account` as a plain\n// `Error` subclass for the framework's `accounts.resolve()` path (caught\n// and translated internally). Adopters who need the wire-facing\n// `ACCOUNT_NOT_FOUND` error code throw `new AdcpError('ACCOUNT_NOT_FOUND',\n// { message: '...', field: 'account.id' })` directly — recovery defaults\n// to the spec value (`terminal`) via `getErrorRecovery`.\n\n// ---------------------------------------------------------------------------\n// Resource-unavailable family — id is right but state precludes use.\n// ---------------------------------------------------------------------------\n\nexport class ProductUnavailableError extends AdcpError {\n constructor(productId: string, opts: CommonOpts = {}) {\n super('PRODUCT_UNAVAILABLE', {\n message: opts.message ?? `Product unavailable (sold out / no inventory): ${productId}`,\n field: 'product_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class CreativeRejectedError extends AdcpError {\n constructor(creativeId: string, reason: string, opts: CommonOpts = {}) {\n super('CREATIVE_REJECTED', {\n message: opts.message ?? `Creative ${creativeId} rejected: ${reason}`,\n field: 'creative_id',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Budget family\n// ---------------------------------------------------------------------------\n\nexport class BudgetTooLowError extends AdcpError {\n constructor(opts: CommonOpts & { floor?: number; currency?: string } = {}) {\n const floorStr =\n opts.floor != null && opts.currency != null\n ? `Floor is ${opts.floor} ${opts.currency}.`\n : opts.floor != null\n ? `Floor is ${opts.floor}.`\n : 'Budget below required floor.';\n super('BUDGET_TOO_LOW', {\n message: opts.message ?? floorStr,\n field: 'total_budget',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.floor != null && { details: { ...(opts.details ?? {}), floor: opts.floor, currency: opts.currency } }),\n });\n }\n}\n\nexport class BudgetExhaustedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('BUDGET_EXHAUSTED', {\n message: opts.message ?? 'Budget exhausted.',\n field: 'total_budget',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Idempotency family\n// ---------------------------------------------------------------------------\n\nexport class IdempotencyConflictError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('IDEMPOTENCY_CONFLICT', {\n message: opts.message ?? 'Same idempotency_key with different payload.',\n field: 'idempotency_key',\n suggestion: opts.suggestion ?? 'Use a fresh idempotency_key for the new payload.',\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Validation / state family\n// ---------------------------------------------------------------------------\n\nexport class InvalidRequestError extends AdcpError {\n constructor(field: string, message: string, opts: CommonOpts = {}) {\n super('INVALID_REQUEST', {\n message,\n field,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class InvalidStateError extends AdcpError {\n constructor(field: string, message: string, opts: CommonOpts = {}) {\n super('INVALID_STATE', {\n message,\n field,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * Convenience for the common `start_time >= end_time` case. Use\n * `InvalidRequestError` for arbitrary field-level validation.\n */\nexport class BackwardsTimeRangeError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('INVALID_REQUEST', {\n message: opts.message ?? 'start_time must be before end_time.',\n field: 'start_time',\n suggestion: opts.suggestion ?? 'Verify the buyer-provided campaign window.',\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Auth / permission family\n// ---------------------------------------------------------------------------\n\n/**\n * No credentials were presented. Sellers MUST return this when no\n * `Authorization` header was included on the request. Recovery:\n * correctable (provide credentials via the auth header and retry).\n *\n * @since AdCP 3.1 (adcp#3730 splits `AUTH_REQUIRED`).\n */\nexport class AuthMissingError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_MISSING', {\n message: opts.message ?? 'Authentication required: no credentials presented.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * 3.0.x-era authentication error that conflates missing credentials with\n * rejected credentials. AdCP 3.1 splits this into {@link AuthMissingError}\n * (correctable; no `Authorization` header presented) and\n * {@link AuthInvalidError} (terminal; credentials presented but rejected).\n *\n * This deprecated convenience remains wire-compatible and still emits\n * `AUTH_REQUIRED`. New seller code should throw {@link AuthMissingError}\n * or {@link AuthInvalidError} explicitly; buyer code should continue to\n * handle wire `AUTH_REQUIRED` for older sellers and SDK compatibility paths.\n *\n * @deprecated Prefer `AuthMissingError` (missing credentials) or\n * `AuthInvalidError` (rejected credentials). Retained as a source-compatible\n * alias for older adopter code during the 3.x deprecation window.\n */\nexport class AuthRequiredError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_REQUIRED', {\n message: opts.message ?? 'Authentication required.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * Credentials were presented but rejected — revoked, malformed signature,\n * or a key no longer in the seller's keystore. Recovery: terminal — do NOT\n * auto-retry. Auto-retry creates an SSO retry-storm indistinguishable from\n * brute-force probing. The decisioning runtime treats this as terminal even\n * when an account store has a refresh hook.\n *\n * **Credential-leak guard.** `opts.message` and `opts.details` cross to\n * the buyer verbatim on the wire envelope. Do NOT place rejected\n * credentials, token fragments, JWT payload material, or upstream\n * identity-provider error bodies in either field — log those server-side\n * instead. The framework is a witness, not a redactor.\n *\n * @since AdCP 3.1 (adcp#3730 splits `AUTH_REQUIRED`).\n */\nexport class AuthInvalidError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AUTH_INVALID', {\n message: opts.message ?? 'Authentication failed: credentials rejected.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class PermissionDeniedError extends AdcpError {\n constructor(action: string, opts: CommonOpts = {}) {\n super('PERMISSION_DENIED', {\n message: opts.message ?? `Permission denied for ${action}.`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), action },\n });\n }\n}\n\n/**\n * The buyer agent's commercial relationship with the seller is suspended.\n * Recovery: terminal at the wire level — a buyer cannot \"wait out\" a\n * suspension by retrying the same request. The transient-vs-permanent\n * distinction lives at the seller's `BuyerAgent.status` record, not on the\n * wire.\n *\n * Consolidates the 3.0.5 placeholder shape\n * `PERMISSION_DENIED + details.scope:'agent' + details.status:'suspended'`,\n * which is removed in 3.1 (envelopes carrying `details.status` fail schema\n * validation).\n *\n * @since AdCP 3.1 (adcp#3906 consolidates the `details.status` placeholder).\n */\nexport class AgentSuspendedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AGENT_SUSPENDED', {\n message: opts.message ?? 'Buyer agent is suspended. Contact the seller to restore access.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n/**\n * The buyer agent is permanently denied by the seller. Recovery: terminal —\n * re-onboarding under a new agent identity is the only recovery path.\n *\n * Consolidates the 3.0.5 placeholder shape\n * `PERMISSION_DENIED + details.scope:'agent' + details.status:'blocked'`,\n * which is removed in 3.1.\n *\n * @since AdCP 3.1 (adcp#3906 consolidates the `details.status` placeholder).\n */\nexport class AgentBlockedError extends AdcpError {\n constructor(opts: CommonOpts = {}) {\n super('AGENT_BLOCKED', {\n message: opts.message ?? 'Buyer agent is blocked.',\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Throttling / availability family\n// ---------------------------------------------------------------------------\n\nexport class RateLimitedError extends AdcpError {\n constructor(retryAfterSeconds: number, opts: CommonOpts = {}) {\n super('RATE_LIMITED', {\n message: opts.message ?? `Rate limited. Retry after ${retryAfterSeconds}s.`,\n retry_after: Math.max(1, Math.min(3600, Math.floor(retryAfterSeconds))),\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class ServiceUnavailableError extends AdcpError {\n constructor(opts: CommonOpts & { retryAfterSeconds?: number } = {}) {\n super('SERVICE_UNAVAILABLE', {\n message: opts.message ?? 'Service temporarily unavailable.',\n retry_after:\n opts.retryAfterSeconds != null ? Math.max(1, Math.min(3600, Math.floor(opts.retryAfterSeconds))) : 60,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n ...(opts.details !== undefined && { details: opts.details }),\n });\n }\n}\n\nexport class UnsupportedFeatureError extends AdcpError {\n constructor(feature: string, opts: CommonOpts = {}) {\n super('UNSUPPORTED_FEATURE', {\n message: opts.message ?? `Feature not supported: ${feature}.`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), feature },\n });\n }\n}\n\n// ---------------------------------------------------------------------------\n// Compliance / governance family\n// ---------------------------------------------------------------------------\n\nexport class ComplianceUnsatisfiedError extends AdcpError {\n constructor(reason: string, opts: CommonOpts = {}) {\n super('COMPLIANCE_UNSATISFIED', {\n message: opts.message ?? `Compliance not satisfied: ${reason}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\nexport class GovernanceDeniedError extends AdcpError {\n constructor(reason: string, opts: CommonOpts = {}) {\n super('GOVERNANCE_DENIED', {\n message: opts.message ?? `Governance denied: ${reason}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), reason },\n });\n }\n}\n\nexport class PolicyViolationError extends AdcpError {\n constructor(policy: string, opts: CommonOpts = {}) {\n super('POLICY_VIOLATION', {\n message: opts.message ?? `Policy violation: ${policy}`,\n ...(opts.suggestion !== undefined && { suggestion: opts.suggestion }),\n details: { ...(opts.details ?? {}), policy },\n });\n }\n}\n"],"mappings":"AA+BA,SAAS,iBAAiB;AAenB,MAAM,6BAA6B,UAAU;AAAA,EAClD,YAAY,WAAmB,OAAmB,CAAC,GAAG;AACpD,UAAM,qBAAqB;AAAA,MACzB,SAAS,KAAK,WAAW,sBAAsB,SAAS;AAAA,MACxD,OAAO;AAAA,MACP,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,QAAQ;AAAA,IAC5D,CA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F;AAMO,MAAM,mCAAmC,UAAU;AAAA,EACxD,YAAY,QAAgB,OAAmB,CAAC,GAAG;AACjD,UAAM,0BAA0B;AAAA,MAC9B,SAAS,KAAK,WAAW,6BAA6B,MAAM;AAAA,MAC5D,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,SAAS,EAAE,GAAI,KAAK,WAAW,CAAC,GAAI,OAAO;AAAA,IAC7C,CAAC;AAAA,EACH;AACF;AAEO,MAAM,8BAA8B,UAAU;AAAA,EACnD,YAAY,QAAgB,OAAmB,CAAC,GAAG;AACjD,UAAM,qBAAqB;AAAA,MACzB,SAAS,KAAK,WAAW,sBAAsB,MAAM;AAAA,MACrD,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,SAAS,EAAE,GAAI,KAAK,WAAW,CAAC,GAAI,OAAO;AAAA,IAC7C,CAAC;AAAA,EACH;AACF;AAEO,MAAM,6BAA6B,UAAU;AAAA,EAClD,YAAY,QAAgB,OAAmB,CAAC,GAAG;AACjD,UAAM,oBAAoB;AAAA,MACxB,SAAS,KAAK,WAAW,qBAAqB,MAAM;AAAA,MACpD,GAAI,KAAK,eAAe,UAAa,EAAE,YAAY,KAAK,WAAW;AAAA,MACnE,SAAS,EAAE,GAAI,KAAK,WAAW,CAAC,GAAI,OAAO;AAAA,IAC7C,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __adcpFileURLToPath } from 'node:url';
2
- import { dirname as __adcpDirname } from 'node:path';
3
- import { createRequire as __adcpCreateRequire } from 'node:module';
4
- const __filename = __adcpFileURLToPath(import.meta.url);
5
- const __dirname = __adcpDirname(__filename);
6
- const require = __adcpCreateRequire(import.meta.url);
7
1
  import { AdcpError } from "./async-outcome.mjs";
8
2
  import { pickSafeDetails } from "../pick-safe-details.mjs";
9
3
  async function batchPoll(ids, lookup) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/server/decisioning/helpers.ts"],"sourcesContent":["/**\n * Adopter utility helpers for DecisioningPlatform implementations.\n *\n * All exports are opt-in convenience — nothing in the framework calls\n * these internally. They lift boilerplate that every adopter with the\n * corresponding pattern would otherwise rewrite from scratch.\n *\n * @public\n */\n\nimport { AdcpError, type ErrorCode } from './async-outcome';\nimport { pickSafeDetails } from '../pick-safe-details';\n\n// ---------------------------------------------------------------------------\n// batchPoll\n// ---------------------------------------------------------------------------\n\n/**\n * Project a per-id Result-returning lookup into the `pollAudienceStatuses`\n * `Map<id, status>` shape.\n *\n * Runs all lookups in parallel. Drops entries where `result.isOk()` is\n * false OR `result.value` is `undefined` — per the SDK contract, not-found\n * entries are omitted from the map (callers handle missing keys via\n * `Map.prototype.get`).\n *\n * Typical use in `AudiencePlatform.pollAudienceStatuses`:\n *\n * ```ts\n * import { batchPoll } from '@adcp/sdk/server/decisioning';\n *\n * async pollAudienceStatuses(audienceIds, ctx) {\n * return batchPoll(audienceIds, async (id) =>\n * this.myPlatform.getAudienceStatus(id, ctx.account.ctx_metadata.token)\n * );\n * }\n * ```\n *\n * The `lookup` return type is structural — any object with `isOk(): boolean`\n * and `value?: TValue` matches (`neverthrow`, `fp-ts`, or custom Result types\n * all work without wrapping).\n *\n * @public\n */\nexport async function batchPoll<TKey extends string, TValue>(\n ids: readonly TKey[],\n lookup: (id: TKey) => Promise<{ isOk(): boolean; value?: TValue }>\n): Promise<Map<TKey, TValue>> {\n const pairs = await Promise.all(\n ids.map(async id => {\n const r = await lookup(id);\n return [id, r] as const;\n })\n );\n const result = new Map<TKey, TValue>();\n for (const [id, r] of pairs) {\n if (r.isOk() && r.value !== undefined) {\n result.set(id, r.value);\n }\n }\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Error factory helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Construct an `AdcpError` for a buyer-correctable validation failure.\n * Shorthand for `new AdcpError('VALIDATION_ERROR', { recovery: 'correctable', ... })`.\n *\n * ```ts\n * import { validationError } from '@adcp/sdk/server/decisioning';\n *\n * if (!req.targeting?.geos?.length) {\n * throw validationError('At least one geo is required', {\n * field: 'targeting.geos',\n * });\n * }\n * ```\n *\n * @param message - Human-readable explanation of the validation failure.\n * @param opts.field - Wire `field` path (e.g. `'targeting.geos'`).\n * @param opts.code - Override the error code (default `'VALIDATION_ERROR'`).\n * @public\n */\nexport function validationError(\n message: string,\n opts?: { field?: string; code?: ErrorCode | (string & {}) }\n): AdcpError {\n return new AdcpError((opts?.code ?? 'VALIDATION_ERROR') as ErrorCode, {\n message,\n ...(opts?.field !== undefined && { field: opts.field }),\n });\n}\n\n/**\n * Construct an `AdcpError` for an upstream-platform failure (5xx /\n * rate-limited). `extraDetails` is run through {@link pickSafeDetails}\n * internally — depth-capped and size-capped — so credentials or stack\n * traces the caller accidentally included don't cross the wire boundary.\n *\n * HTTP 429 maps to `RATE_LIMITED` (with `retry_after: 60`). All other\n * upstream failures map to `SERVICE_UNAVAILABLE`. Both use\n * `recovery: 'transient'`.\n *\n * ```ts\n * import { upstreamError } from '@adcp/sdk/server/decisioning';\n *\n * try {\n * return await this.gam.createOrder(req);\n * } catch (e) {\n * throw upstreamError('GAM order creation failed', e, {\n * gam_error_code: e.errorCode,\n * request_id: e.requestId,\n * });\n * }\n * ```\n *\n * @param prefix - Short description of the operation that failed\n * (e.g. `'GAM order creation failed'`). Prepended to the upstream message.\n * @param e - Upstream error. Only `message`, `code`, and `status` are read;\n * all other fields are ignored.\n * @param extraDetails - Optional pre-selected safe fields to surface to the\n * buyer. Run through `pickSafeDetails` with depth/size caps before attaching\n * to the wire envelope.\n * @public\n */\nexport function upstreamError(\n prefix: string,\n e: { message?: string; code?: number | string; status?: number },\n extraDetails?: Record<string, unknown>\n): AdcpError {\n const statusCode = e.status ?? (typeof e.code === 'number' ? e.code : undefined);\n const isRateLimited = statusCode === 429;\n const errorCode: ErrorCode = isRateLimited ? 'RATE_LIMITED' : 'SERVICE_UNAVAILABLE';\n const upstreamMsg = typeof e.message === 'string' && e.message.length > 0 ? e.message : 'upstream error';\n const details = extraDetails !== undefined ? pickSafeDetails(extraDetails, Object.keys(extraDetails)) : undefined;\n\n return new AdcpError(errorCode, {\n message: `${prefix}: ${upstreamMsg}`,\n ...(isRateLimited && { retry_after: 60 }),\n ...(details !== undefined && { details }),\n });\n}\n\n// ---------------------------------------------------------------------------\n// RequestShape<T>\n// ---------------------------------------------------------------------------\n\n/**\n * Strip index signatures from a wire request type for back-compat with\n * v5-era task functions whose parameter types don't carry the spec's\n * `additionalProperties: true` index signature (`[x: string]: unknown`).\n *\n * Without this, passing a v6 wire type directly to a v5 task fn produces:\n *\n * ```\n * Type 'CreateMediaBuyRequest' is not assignable to type\n * 'Parameters<typeof createMediaBuyTask>[1]'\n * ```\n *\n * because generated v6 types include `[x: string]: unknown` for\n * forward-compat but v5 fn signatures were authored without it.\n *\n * ```ts\n * import type { RequestShape } from '@adcp/sdk/server/decisioning';\n *\n * const result = await createMediaBuyTask(\n * snapCtx(account),\n * req as RequestShape<typeof req>, // drops index sig for v5 adapter compat\n * );\n * ```\n *\n * @public\n */\nexport type RequestShape<T> = { [K in keyof T]: T[K] };\n"],"mappings":";;;;;;AAUA,SAAS,iBAAiC;AAC1C,SAAS,uBAAuB;AAiChC,eAAsB,UACpB,KACA,QAC4B;AAC5B,QAAM,QAAQ,MAAM,QAAQ;AAAA,IAC1B,IAAI,IAAI,OAAM,OAAM;AAClB,YAAM,IAAI,MAAM,OAAO,EAAE;AACzB,aAAO,CAAC,IAAI,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACA,QAAM,SAAS,oBAAI,IAAkB;AACrC,aAAW,CAAC,IAAI,CAAC,KAAK,OAAO;AAC3B,QAAI,EAAE,KAAK,KAAK,EAAE,UAAU,QAAW;AACrC,aAAO,IAAI,IAAI,EAAE,KAAK;AAAA,IACxB;AAAA,EACF;AACA,SAAO;AACT;AAyBO,SAAS,gBACd,SACA,MACW;AACX,SAAO,IAAI,UAAW,MAAM,QAAQ,oBAAkC;AAAA,IACpE;AAAA,IACA,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,KAAK,MAAM;AAAA,EACvD,CAAC;AACH;AAkCO,SAAS,cACd,QACA,GACA,cACW;AACX,QAAM,aAAa,EAAE,WAAW,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO;AACtE,QAAM,gBAAgB,eAAe;AACrC,QAAM,YAAuB,gBAAgB,iBAAiB;AAC9D,QAAM,cAAc,OAAO,EAAE,YAAY,YAAY,EAAE,QAAQ,SAAS,IAAI,EAAE,UAAU;AACxF,QAAM,UAAU,iBAAiB,SAAY,gBAAgB,cAAc,OAAO,KAAK,YAAY,CAAC,IAAI;AAExG,SAAO,IAAI,UAAU,WAAW;AAAA,IAC9B,SAAS,GAAG,MAAM,KAAK,WAAW;AAAA,IAClC,GAAI,iBAAiB,EAAE,aAAa,GAAG;AAAA,IACvC,GAAI,YAAY,UAAa,EAAE,QAAQ;AAAA,EACzC,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/server/decisioning/helpers.ts"],"sourcesContent":["/**\n * Adopter utility helpers for DecisioningPlatform implementations.\n *\n * All exports are opt-in convenience — nothing in the framework calls\n * these internally. They lift boilerplate that every adopter with the\n * corresponding pattern would otherwise rewrite from scratch.\n *\n * @public\n */\n\nimport { AdcpError, type ErrorCode } from './async-outcome';\nimport { pickSafeDetails } from '../pick-safe-details';\n\n// ---------------------------------------------------------------------------\n// batchPoll\n// ---------------------------------------------------------------------------\n\n/**\n * Project a per-id Result-returning lookup into the `pollAudienceStatuses`\n * `Map<id, status>` shape.\n *\n * Runs all lookups in parallel. Drops entries where `result.isOk()` is\n * false OR `result.value` is `undefined` — per the SDK contract, not-found\n * entries are omitted from the map (callers handle missing keys via\n * `Map.prototype.get`).\n *\n * Typical use in `AudiencePlatform.pollAudienceStatuses`:\n *\n * ```ts\n * import { batchPoll } from '@adcp/sdk/server/decisioning';\n *\n * async pollAudienceStatuses(audienceIds, ctx) {\n * return batchPoll(audienceIds, async (id) =>\n * this.myPlatform.getAudienceStatus(id, ctx.account.ctx_metadata.token)\n * );\n * }\n * ```\n *\n * The `lookup` return type is structural — any object with `isOk(): boolean`\n * and `value?: TValue` matches (`neverthrow`, `fp-ts`, or custom Result types\n * all work without wrapping).\n *\n * @public\n */\nexport async function batchPoll<TKey extends string, TValue>(\n ids: readonly TKey[],\n lookup: (id: TKey) => Promise<{ isOk(): boolean; value?: TValue }>\n): Promise<Map<TKey, TValue>> {\n const pairs = await Promise.all(\n ids.map(async id => {\n const r = await lookup(id);\n return [id, r] as const;\n })\n );\n const result = new Map<TKey, TValue>();\n for (const [id, r] of pairs) {\n if (r.isOk() && r.value !== undefined) {\n result.set(id, r.value);\n }\n }\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Error factory helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Construct an `AdcpError` for a buyer-correctable validation failure.\n * Shorthand for `new AdcpError('VALIDATION_ERROR', { recovery: 'correctable', ... })`.\n *\n * ```ts\n * import { validationError } from '@adcp/sdk/server/decisioning';\n *\n * if (!req.targeting?.geos?.length) {\n * throw validationError('At least one geo is required', {\n * field: 'targeting.geos',\n * });\n * }\n * ```\n *\n * @param message - Human-readable explanation of the validation failure.\n * @param opts.field - Wire `field` path (e.g. `'targeting.geos'`).\n * @param opts.code - Override the error code (default `'VALIDATION_ERROR'`).\n * @public\n */\nexport function validationError(\n message: string,\n opts?: { field?: string; code?: ErrorCode | (string & {}) }\n): AdcpError {\n return new AdcpError((opts?.code ?? 'VALIDATION_ERROR') as ErrorCode, {\n message,\n ...(opts?.field !== undefined && { field: opts.field }),\n });\n}\n\n/**\n * Construct an `AdcpError` for an upstream-platform failure (5xx /\n * rate-limited). `extraDetails` is run through {@link pickSafeDetails}\n * internally — depth-capped and size-capped — so credentials or stack\n * traces the caller accidentally included don't cross the wire boundary.\n *\n * HTTP 429 maps to `RATE_LIMITED` (with `retry_after: 60`). All other\n * upstream failures map to `SERVICE_UNAVAILABLE`. Both use\n * `recovery: 'transient'`.\n *\n * ```ts\n * import { upstreamError } from '@adcp/sdk/server/decisioning';\n *\n * try {\n * return await this.gam.createOrder(req);\n * } catch (e) {\n * throw upstreamError('GAM order creation failed', e, {\n * gam_error_code: e.errorCode,\n * request_id: e.requestId,\n * });\n * }\n * ```\n *\n * @param prefix - Short description of the operation that failed\n * (e.g. `'GAM order creation failed'`). Prepended to the upstream message.\n * @param e - Upstream error. Only `message`, `code`, and `status` are read;\n * all other fields are ignored.\n * @param extraDetails - Optional pre-selected safe fields to surface to the\n * buyer. Run through `pickSafeDetails` with depth/size caps before attaching\n * to the wire envelope.\n * @public\n */\nexport function upstreamError(\n prefix: string,\n e: { message?: string; code?: number | string; status?: number },\n extraDetails?: Record<string, unknown>\n): AdcpError {\n const statusCode = e.status ?? (typeof e.code === 'number' ? e.code : undefined);\n const isRateLimited = statusCode === 429;\n const errorCode: ErrorCode = isRateLimited ? 'RATE_LIMITED' : 'SERVICE_UNAVAILABLE';\n const upstreamMsg = typeof e.message === 'string' && e.message.length > 0 ? e.message : 'upstream error';\n const details = extraDetails !== undefined ? pickSafeDetails(extraDetails, Object.keys(extraDetails)) : undefined;\n\n return new AdcpError(errorCode, {\n message: `${prefix}: ${upstreamMsg}`,\n ...(isRateLimited && { retry_after: 60 }),\n ...(details !== undefined && { details }),\n });\n}\n\n// ---------------------------------------------------------------------------\n// RequestShape<T>\n// ---------------------------------------------------------------------------\n\n/**\n * Strip index signatures from a wire request type for back-compat with\n * v5-era task functions whose parameter types don't carry the spec's\n * `additionalProperties: true` index signature (`[x: string]: unknown`).\n *\n * Without this, passing a v6 wire type directly to a v5 task fn produces:\n *\n * ```\n * Type 'CreateMediaBuyRequest' is not assignable to type\n * 'Parameters<typeof createMediaBuyTask>[1]'\n * ```\n *\n * because generated v6 types include `[x: string]: unknown` for\n * forward-compat but v5 fn signatures were authored without it.\n *\n * ```ts\n * import type { RequestShape } from '@adcp/sdk/server/decisioning';\n *\n * const result = await createMediaBuyTask(\n * snapCtx(account),\n * req as RequestShape<typeof req>, // drops index sig for v5 adapter compat\n * );\n * ```\n *\n * @public\n */\nexport type RequestShape<T> = { [K in keyof T]: T[K] };\n"],"mappings":"AAUA,SAAS,iBAAiC;AAC1C,SAAS,uBAAuB;AAiChC,eAAsB,UACpB,KACA,QAC4B;AAC5B,QAAM,QAAQ,MAAM,QAAQ;AAAA,IAC1B,IAAI,IAAI,OAAM,OAAM;AAClB,YAAM,IAAI,MAAM,OAAO,EAAE;AACzB,aAAO,CAAC,IAAI,CAAC;AAAA,IACf,CAAC;AAAA,EACH;AACA,QAAM,SAAS,oBAAI,IAAkB;AACrC,aAAW,CAAC,IAAI,CAAC,KAAK,OAAO;AAC3B,QAAI,EAAE,KAAK,KAAK,EAAE,UAAU,QAAW;AACrC,aAAO,IAAI,IAAI,EAAE,KAAK;AAAA,IACxB;AAAA,EACF;AACA,SAAO;AACT;AAyBO,SAAS,gBACd,SACA,MACW;AACX,SAAO,IAAI,UAAW,MAAM,QAAQ,oBAAkC;AAAA,IACpE;AAAA,IACA,GAAI,MAAM,UAAU,UAAa,EAAE,OAAO,KAAK,MAAM;AAAA,EACvD,CAAC;AACH;AAkCO,SAAS,cACd,QACA,GACA,cACW;AACX,QAAM,aAAa,EAAE,WAAW,OAAO,EAAE,SAAS,WAAW,EAAE,OAAO;AACtE,QAAM,gBAAgB,eAAe;AACrC,QAAM,YAAuB,gBAAgB,iBAAiB;AAC9D,QAAM,cAAc,OAAO,EAAE,YAAY,YAAY,EAAE,QAAQ,SAAS,IAAI,EAAE,UAAU;AACxF,QAAM,UAAU,iBAAiB,SAAY,gBAAgB,cAAc,OAAO,KAAK,YAAY,CAAC,IAAI;AAExG,SAAO,IAAI,UAAU,WAAW;AAAA,IAC9B,SAAS,GAAG,MAAM,KAAK,WAAW;AAAA,IAClC,GAAI,iBAAiB,EAAE,aAAa,GAAG;AAAA,IACvC,GAAI,YAAY,UAAa,EAAE,QAAQ;AAAA,EACzC,CAAC;AACH;","names":[]}