@adcp/sdk 17.0.0-beta.1 → 17.0.0-beta.3

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 (282) hide show
  1. package/dist/lib/adapters/keyed-account-store.js +1 -1
  2. package/dist/lib/adapters/keyed-account-store.mjs +1 -1
  3. package/dist/lib/adapters/version/3.0/brand-fields.d.mts +7 -1
  4. package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
  5. package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
  6. package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
  7. package/dist/lib/adapters/version/3.0/index.js +6 -0
  8. package/dist/lib/adapters/version/3.0/index.mjs +7 -1
  9. package/dist/lib/adapters/version/index.d.mts +9 -0
  10. package/dist/lib/adapters/version/index.d.ts +9 -0
  11. package/dist/lib/adapters/version/index.js +20 -6
  12. package/dist/lib/adapters/version/index.mjs +15 -2
  13. package/dist/lib/adapters/version/types.d.mts +5 -0
  14. package/dist/lib/adapters/version/types.d.ts +5 -0
  15. package/dist/lib/canonical-references/index.js +2 -0
  16. package/dist/lib/canonical-references/index.mjs +2 -0
  17. package/dist/lib/client/account-changes.d.mts +3 -1
  18. package/dist/lib/client/account-changes.d.ts +3 -1
  19. package/dist/lib/client/account-changes.js +22 -2
  20. package/dist/lib/client/account-changes.mjs +22 -2
  21. package/dist/lib/conformance/oracle.js +3 -2
  22. package/dist/lib/conformance/oracle.mjs +3 -2
  23. package/dist/lib/core/AgentClient.d.mts +165 -1
  24. package/dist/lib/core/AgentClient.d.ts +165 -1
  25. package/dist/lib/core/AgentClient.js +446 -8
  26. package/dist/lib/core/AgentClient.mjs +446 -8
  27. package/dist/lib/core/ConversationTypes.d.mts +8 -0
  28. package/dist/lib/core/ConversationTypes.d.ts +8 -0
  29. package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
  30. package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
  31. package/dist/lib/core/ProtocolResponseParser.js +28 -18
  32. package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
  33. package/dist/lib/core/SingleAgentClient.d.mts +115 -2
  34. package/dist/lib/core/SingleAgentClient.d.ts +115 -2
  35. package/dist/lib/core/SingleAgentClient.js +547 -67
  36. package/dist/lib/core/SingleAgentClient.mjs +534 -54
  37. package/dist/lib/core/TaskExecutor.d.mts +7 -0
  38. package/dist/lib/core/TaskExecutor.d.ts +7 -0
  39. package/dist/lib/core/TaskExecutor.js +18 -5
  40. package/dist/lib/core/TaskExecutor.mjs +18 -5
  41. package/dist/lib/core/task-status.d.mts +2 -0
  42. package/dist/lib/core/task-status.d.ts +2 -0
  43. package/dist/lib/core/task-status.js +11 -2
  44. package/dist/lib/core/task-status.mjs +9 -1
  45. package/dist/lib/identity-3.3/trust.d.mts +1 -4
  46. package/dist/lib/identity-3.3/trust.d.ts +1 -4
  47. package/dist/lib/identity-3.3/trust.js +43 -23
  48. package/dist/lib/identity-3.3/trust.mjs +43 -23
  49. package/dist/lib/identity-3.3/validation.js +5 -3
  50. package/dist/lib/identity-3.3/validation.mjs +6 -4
  51. package/dist/lib/index.d.mts +6 -52
  52. package/dist/lib/index.d.ts +6 -52
  53. package/dist/lib/index.js +11 -0
  54. package/dist/lib/index.mjs +7 -0
  55. package/dist/lib/media-buy/compatibility.js +6 -1
  56. package/dist/lib/media-buy/compatibility.mjs +6 -1
  57. package/dist/lib/protocols/mcp-scope.d.mts +3 -0
  58. package/dist/lib/protocols/mcp-scope.d.ts +3 -0
  59. package/dist/lib/protocols/mcp-scope.js +8 -3
  60. package/dist/lib/protocols/mcp-scope.mjs +8 -3
  61. package/dist/lib/reporting/inspection.js +1 -0
  62. package/dist/lib/reporting/inspection.mjs +1 -0
  63. package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
  64. package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
  65. package/dist/lib/reporting/ledger/coverage.js +37 -3
  66. package/dist/lib/reporting/ledger/coverage.mjs +36 -3
  67. package/dist/lib/reporting/ledger/handler.js +7 -4
  68. package/dist/lib/reporting/ledger/handler.mjs +7 -4
  69. package/dist/lib/reporting/ledger/producer.js +215 -69
  70. package/dist/lib/reporting/ledger/producer.mjs +217 -70
  71. package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
  72. package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
  73. package/dist/lib/reporting/ledger/schedule.js +8 -5
  74. package/dist/lib/reporting/ledger/schedule.mjs +8 -5
  75. package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
  76. package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
  77. package/dist/lib/reporting/ledger/status-ingest.js +4 -3
  78. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
  79. package/dist/lib/reporting/ledger/types.d.mts +36 -1
  80. package/dist/lib/reporting/ledger/types.d.ts +36 -1
  81. package/dist/lib/reporting/service/index.d.mts +14 -1
  82. package/dist/lib/reporting/service/index.d.ts +14 -1
  83. package/dist/lib/reporting/service/index.js +24 -12
  84. package/dist/lib/reporting/service/index.mjs +24 -12
  85. package/dist/lib/schemas/browser.d.mts +2 -0
  86. package/dist/lib/schemas/browser.d.ts +2 -0
  87. package/dist/lib/schemas/browser.js +3 -0
  88. package/dist/lib/schemas/browser.mjs +2 -0
  89. package/dist/lib/schemas/index.d.mts +5 -3
  90. package/dist/lib/schemas/index.d.ts +5 -3
  91. package/dist/lib/schemas/index.js +5 -0
  92. package/dist/lib/schemas/index.mjs +4 -0
  93. package/dist/lib/server/a2a-adapter.js +2 -1
  94. package/dist/lib/server/a2a-adapter.mjs +2 -1
  95. package/dist/lib/server/account-response-identity.d.mts +17 -0
  96. package/dist/lib/server/account-response-identity.d.ts +17 -0
  97. package/dist/lib/server/account-response-identity.js +52 -0
  98. package/dist/lib/server/account-response-identity.mjs +28 -0
  99. package/dist/lib/server/account-sync-contract.js +2 -2
  100. package/dist/lib/server/account-sync-contract.mjs +2 -2
  101. package/dist/lib/server/auth-signature.d.mts +2 -2
  102. package/dist/lib/server/auth-signature.d.ts +2 -2
  103. package/dist/lib/server/auth-signature.js +3 -0
  104. package/dist/lib/server/auth-signature.mjs +3 -0
  105. package/dist/lib/server/create-adcp-server.d.mts +2 -2
  106. package/dist/lib/server/create-adcp-server.d.ts +2 -2
  107. package/dist/lib/server/create-adcp-server.js +58 -23
  108. package/dist/lib/server/create-adcp-server.mjs +61 -15
  109. package/dist/lib/server/decisioning/account.d.mts +36 -10
  110. package/dist/lib/server/decisioning/account.d.ts +36 -10
  111. package/dist/lib/server/decisioning/account.js +33 -14
  112. package/dist/lib/server/decisioning/account.mjs +33 -14
  113. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
  114. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
  115. package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
  116. package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
  117. package/dist/lib/server/media-buy-store.d.mts +26 -12
  118. package/dist/lib/server/media-buy-store.d.ts +26 -12
  119. package/dist/lib/server/media-buy-store.js +69 -21
  120. package/dist/lib/server/media-buy-store.mjs +69 -21
  121. package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
  122. package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
  123. package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
  124. package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
  125. package/dist/lib/server/responses.js +9 -1
  126. package/dist/lib/server/responses.mjs +9 -1
  127. package/dist/lib/server/serve.js +3 -1
  128. package/dist/lib/server/serve.mjs +3 -1
  129. package/dist/lib/server/signed-request-transport.d.mts +1 -0
  130. package/dist/lib/server/signed-request-transport.d.ts +1 -0
  131. package/dist/lib/server/signed-request-transport.js +46 -0
  132. package/dist/lib/server/signed-request-transport.mjs +20 -0
  133. package/dist/lib/server/test-controller.d.mts +1 -0
  134. package/dist/lib/server/test-controller.d.ts +1 -0
  135. package/dist/lib/server/test-controller.js +5 -1
  136. package/dist/lib/server/test-controller.mjs +5 -1
  137. package/dist/lib/signing/agent-fetch.d.mts +1 -1
  138. package/dist/lib/signing/agent-fetch.d.ts +1 -1
  139. package/dist/lib/signing/agent-fetch.js +3 -3
  140. package/dist/lib/signing/agent-fetch.mjs +3 -3
  141. package/dist/lib/testing/index.d.mts +1 -0
  142. package/dist/lib/testing/index.d.ts +1 -0
  143. package/dist/lib/testing/index.js +3 -0
  144. package/dist/lib/testing/index.mjs +2 -0
  145. package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +61 -29
  146. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +61 -29
  147. package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
  148. package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
  149. package/dist/lib/testing/storyboard/compliance.js +62 -13
  150. package/dist/lib/testing/storyboard/compliance.mjs +63 -14
  151. package/dist/lib/testing/storyboard/index.d.mts +1 -0
  152. package/dist/lib/testing/storyboard/index.d.ts +1 -0
  153. package/dist/lib/testing/storyboard/index.js +3 -0
  154. package/dist/lib/testing/storyboard/index.mjs +2 -0
  155. package/dist/lib/testing/storyboard/loader.js +7 -0
  156. package/dist/lib/testing/storyboard/loader.mjs +7 -0
  157. package/dist/lib/testing/storyboard/request-builder.js +9 -6
  158. package/dist/lib/testing/storyboard/request-builder.mjs +9 -6
  159. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
  160. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
  161. package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
  162. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
  163. package/dist/lib/testing/storyboard/runner.js +59 -6
  164. package/dist/lib/testing/storyboard/runner.mjs +59 -6
  165. package/dist/lib/testing/storyboard/types.d.mts +18 -0
  166. package/dist/lib/testing/storyboard/types.d.ts +18 -0
  167. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  168. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  169. package/dist/lib/testing/storyboard/web-bot-auth.d.mts +10 -0
  170. package/dist/lib/testing/storyboard/web-bot-auth.d.ts +10 -0
  171. package/dist/lib/testing/storyboard/web-bot-auth.js +80 -0
  172. package/dist/lib/testing/storyboard/web-bot-auth.mjs +56 -0
  173. package/dist/lib/types/accept-proposal.d.ts +20 -28
  174. package/dist/lib/types/asset-instances.d.mts +1 -1
  175. package/dist/lib/types/asset-instances.d.ts +1 -1
  176. package/dist/lib/types/buy-products.d.ts +20 -28
  177. package/dist/lib/types/check-governance.d.ts +20 -28
  178. package/dist/lib/types/comply-test-controller.d.ts +20 -28
  179. package/dist/lib/types/control-media-buy.d.ts +20 -28
  180. package/dist/lib/types/core.generated.d.mts +273 -184
  181. package/dist/lib/types/core.generated.d.ts +273 -184
  182. package/dist/lib/types/create-media-buy.d.ts +20 -28
  183. package/dist/lib/types/get-media-buys.d.ts +20 -28
  184. package/dist/lib/types/get-products.d.ts +20 -28
  185. package/dist/lib/types/index.d.mts +6 -1
  186. package/dist/lib/types/index.d.ts +6 -1
  187. package/dist/lib/types/index.js +6 -1
  188. package/dist/lib/types/index.mjs +4 -1
  189. package/dist/lib/types/inline-enums.generated.d.mts +30 -4
  190. package/dist/lib/types/inline-enums.generated.d.ts +30 -4
  191. package/dist/lib/types/inline-enums.generated.js +41 -2
  192. package/dist/lib/types/inline-enums.generated.mjs +28 -2
  193. package/dist/lib/types/list-products.d.ts +20 -28
  194. package/dist/lib/types/list-proposals.d.ts +20 -28
  195. package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
  196. package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
  197. package/dist/lib/types/media-buy-delivery-report.js +16 -0
  198. package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
  199. package/dist/lib/types/refine-proposals.d.ts +20 -28
  200. package/dist/lib/types/request-proposals.d.ts +20 -28
  201. package/dist/lib/types/schemas.generated.d.ts +63113 -127273
  202. package/dist/lib/types/schemas.generated.js +759 -770
  203. package/dist/lib/types/schemas.generated.mjs +759 -770
  204. package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
  205. package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
  206. package/dist/lib/types/targeting-keys.generated.js +109 -0
  207. package/dist/lib/types/targeting-keys.generated.mjs +84 -0
  208. package/dist/lib/types/tools.generated.d.mts +2 -68
  209. package/dist/lib/types/tools.generated.d.ts +2 -68
  210. package/dist/lib/types/update-media-buy.d.ts +20 -28
  211. package/dist/lib/utils/adcp-version-config.js +5 -2
  212. package/dist/lib/utils/adcp-version-config.mjs +5 -2
  213. package/dist/lib/utils/response-unwrapper.js +6 -1
  214. package/dist/lib/utils/response-unwrapper.mjs +6 -1
  215. package/dist/lib/v2/format-schema/resolver.js +1 -1
  216. package/dist/lib/v2/format-schema/resolver.mjs +1 -1
  217. package/dist/lib/v2/projection/creative-delivery.js +104 -29
  218. package/dist/lib/v2/projection/creative-delivery.mjs +108 -29
  219. package/dist/lib/v2/projection/index.d.mts +1 -0
  220. package/dist/lib/v2/projection/index.d.ts +1 -0
  221. package/dist/lib/v2/projection/index.js +3 -0
  222. package/dist/lib/v2/projection/index.mjs +2 -0
  223. package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
  224. package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
  225. package/dist/lib/v2/projection/legacy-metadata.js +91 -0
  226. package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
  227. package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
  228. package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
  229. package/dist/lib/v2/projection/v1-to-v2.js +12 -9
  230. package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
  231. package/dist/lib/validation/budget-allocation.d.mts +3 -3
  232. package/dist/lib/validation/budget-allocation.d.ts +3 -3
  233. package/dist/lib/validation/compact-schema.d.mts +27 -0
  234. package/dist/lib/validation/compact-schema.d.ts +27 -0
  235. package/dist/lib/validation/compact-schema.js +276 -0
  236. package/dist/lib/validation/compact-schema.mjs +250 -0
  237. package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
  238. package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
  239. package/dist/lib/validation/media-buy-delivery-report.js +31 -0
  240. package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
  241. package/dist/lib/validation/nonempty-array.d.mts +15 -0
  242. package/dist/lib/validation/nonempty-array.d.ts +15 -0
  243. package/dist/lib/validation/nonempty-array.js +41 -0
  244. package/dist/lib/validation/nonempty-array.mjs +7 -0
  245. package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
  246. package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
  247. package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
  248. package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
  249. package/dist/lib/validation/schema-loader.js +86 -16
  250. package/dist/lib/validation/schema-loader.mjs +82 -16
  251. package/dist/lib/validation/schema-validator.d.mts +10 -19
  252. package/dist/lib/validation/schema-validator.d.ts +10 -19
  253. package/dist/lib/validation/schema-validator.js +135 -42
  254. package/dist/lib/validation/schema-validator.mjs +139 -43
  255. package/dist/lib/validation/sync-creatives.d.mts +22 -22
  256. package/dist/lib/validation/sync-creatives.d.ts +22 -22
  257. package/dist/lib/version.d.mts +3 -3
  258. package/dist/lib/version.d.ts +3 -3
  259. package/dist/lib/version.js +3 -3
  260. package/dist/lib/version.mjs +3 -3
  261. package/dist/lib/webhooks/index.d.mts +3 -0
  262. package/dist/lib/webhooks/index.d.ts +3 -0
  263. package/dist/lib/webhooks/index.js +3 -0
  264. package/dist/lib/webhooks/index.mjs +2 -0
  265. package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
  266. package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
  267. package/dist/lib/webhooks/media-buy-delivery.js +119 -0
  268. package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
  269. package/docs/TYPE-SUMMARY.md +2 -2
  270. package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
  271. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
  272. package/docs/guides/REPORTING-LEDGER.md +93 -0
  273. package/docs/guides/REPORTING-STABILITY.md +1 -1
  274. package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
  275. package/docs/llms.txt +2 -2
  276. package/docs/migration-14.x-rc-worksheet.md +4 -4
  277. package/docs/migration-16-to-17.md +218 -14
  278. package/docs/migration-6.6-to-6.7.md +14 -0
  279. package/docs/migration-account-change-feed.md +15 -0
  280. package/docs/migration-agent-identity-3.3.md +106 -4
  281. package/docs/recipes/verifying-inbound-webhooks.md +18 -2
  282. package/package.json +16 -3
@@ -84,6 +84,7 @@ var import_errors3 = require('../errors/index.js');
84
84
  var import_buyer_account_registry = require('./buyer-account-registry.js');
85
85
  var import_account_resolution = require('./account-resolution.js');
86
86
  var import_request_normalizer = require('../utils/request-normalizer.js');
87
+ var import_legacy_metadata = require('../v2/projection/legacy-metadata.js');
87
88
  var import_global_async_local_storage = require('../utils/global-async-local-storage.js');
88
89
  var import_validate_user_agent = require('../utils/validate-user-agent.js');
89
90
  var import_webhook_url = require('./webhook-url.js');
@@ -93,7 +94,7 @@ var import_creative_delivery = require('../v2/projection/creative-delivery.js');
93
94
  var import_legacy_routes = require('../v2/projection/legacy-routes.js');
94
95
  var import_catalog_snapshot = require('../v2/projection/catalog-snapshot.js');
95
96
  var import_augment_response = require('../v2/projection/augment-response.js');
96
- var import_legacy_metadata = require('../v2/projection/legacy-metadata.js');
97
+ var import_legacy_metadata2 = require('../v2/projection/legacy-metadata.js');
97
98
  var import_types = require('../v2/projection/types.js');
98
99
  var import_jcs = require('../utils/jcs.js');
99
100
  function loadWebBotAuth() {
@@ -101,6 +102,16 @@ function loadWebBotAuth() {
101
102
  }
102
103
  const SKIP_PRODUCT_CACHE = /* @__PURE__ */ Symbol("adcp.skipProductCache");
103
104
  const SKIP_ACCOUNT_REGISTRY_OBSERVATION = /* @__PURE__ */ Symbol("adcp.skipAccountRegistryObservation");
105
+ const NONTERMINAL_TASK_RESULT_STATUSES = /* @__PURE__ */ new Set([
106
+ "submitted",
107
+ "working",
108
+ "input-required",
109
+ "auth-required",
110
+ "deferred"
111
+ ]);
112
+ function isNonterminalTaskResult(result) {
113
+ return result !== null && typeof result === "object" && "success" in result && result.success === true && "status" in result && typeof result.status === "string" && NONTERMINAL_TASK_RESULT_STATUSES.has(result.status);
114
+ }
104
115
  function presentedStaticTransportCredential(authToken, headers, authProvider) {
105
116
  if (authProvider) return false;
106
117
  if (authToken) return true;
@@ -631,10 +642,7 @@ const STANDARD_ADCP_TASK_NAMES = /* @__PURE__ */ new Set([
631
642
  "list_transformers",
632
643
  "preview_creative",
633
644
  "build_creative",
634
- // These standard protocol tools still carry legacy creative `format_id`
635
- // identity through artifacts, manifests, standards, or rights constraints.
636
- // They are available only through explicitly named *Legacy APIs until a
637
- // lossless canonical projection exists.
645
+ // Wire-level creative and content tools also have typed primary methods.
638
646
  "list_content_standards",
639
647
  "get_content_standards",
640
648
  "create_content_standards",
@@ -918,7 +926,19 @@ class SingleAgentClient {
918
926
  adcpVersion: this.resolvedAdcpVersion,
919
927
  ...config.wireAdcpVersion !== void 0 && { wireAdcpVersion: config.wireAdcpVersion },
920
928
  ...config.versionEnvelope !== void 0 && { versionEnvelope: config.versionEnvelope },
921
- transport: config.transport
929
+ transport: config.transport,
930
+ resolveTaskStatusTool: async (pollAgent, options) => {
931
+ const client = pollAgent.id === this.normalizedAgent.id ? this : new SingleAgentClient(pollAgent, {
932
+ adcpVersion: this.resolvedAdcpVersion,
933
+ wireAdcpVersion: this.config.wireAdcpVersion,
934
+ versionEnvelope: this.config.versionEnvelope,
935
+ userAgent: this.config.userAgent,
936
+ discoveryCache: this.config.discoveryCache,
937
+ onTransportActivity: this.config.onTransportActivity,
938
+ transport: options.transport
939
+ });
940
+ return await client.advertisesTool("get_task_status", options) ? "get_task_status" : pollAgent.protocol === "mcp" ? "tasks_get" : "tasks/get";
941
+ }
922
942
  });
923
943
  if (config.handlers) {
924
944
  this.asyncHandler = new import_AsyncHandler.AsyncHandler(config.handlers);
@@ -1466,18 +1486,18 @@ class SingleAgentClient {
1466
1486
  publisher_domain: option.publisher_domain,
1467
1487
  format_option_id: option.format_option_id
1468
1488
  } : { scope: "product", format_option_id: option.format_option_id };
1469
- const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
1470
- const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
1471
- if (declared !== void 0) (0, import_legacy_metadata.rememberSellerDeclaredFormatOption)(option, declared);
1489
+ const refs = (0, import_legacy_metadata2.legacyFormatRefsForDeclaration)(option);
1490
+ const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata2.sellerDeclaredFormatOption)(option);
1491
+ if (declared !== void 0) (0, import_legacy_metadata2.rememberSellerDeclaredFormatOption)(option, declared);
1472
1492
  if (declared === true && evidence)
1473
- (0, import_legacy_metadata.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
1493
+ (0, import_legacy_metadata2.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
1474
1494
  this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
1475
1495
  kind: "product",
1476
1496
  accountScope,
1477
1497
  productId: product.product_id,
1478
1498
  optionRef: ref,
1479
1499
  refs,
1480
- ...declared === true && (0, import_legacy_metadata.sellerFormatEvidence)(option) ? { declaration: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(option) } : {},
1500
+ ...declared === true && (0, import_legacy_metadata2.sellerFormatEvidence)(option) ? { declaration: (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(option) } : {},
1481
1501
  ...declared === false ? { undeclaredSelector: (0, import_legacy_routes.undeclaredFormatOptionSelector)(option) } : {}
1482
1502
  });
1483
1503
  }
@@ -1726,8 +1746,18 @@ class SingleAgentClient {
1726
1746
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(snapshot) : await this.ensureEndpointDiscovered(snapshot);
1727
1747
  return this.executor.trackTask(agent, snapshot);
1728
1748
  }
1729
- /** Poll through the same discovered/canonical protocol endpoint used for dispatch. @internal */
1730
- async getTaskStatus(taskId, transport, signal, wireOptions) {
1749
+ async getTaskStatus(taskIdOrParams, transportOrHandler, signalOrOptions, wireOptions) {
1750
+ if (typeof taskIdOrParams !== "string") {
1751
+ return this.executeTaskUnprojected(
1752
+ "get_task_status",
1753
+ taskIdOrParams,
1754
+ transportOrHandler,
1755
+ signalOrOptions
1756
+ );
1757
+ }
1758
+ const taskId = taskIdOrParams;
1759
+ const transport = transportOrHandler;
1760
+ const signal = signalOrOptions;
1731
1761
  const transportSnapshot = transport === void 0 ? void 0 : { ...transport };
1732
1762
  const options = { transport: transportSnapshot, signal };
1733
1763
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(options) : await this.ensureEndpointDiscovered(options);
@@ -2592,6 +2622,33 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2592
2622
  };
2593
2623
  }
2594
2624
  }
2625
+ let reportingAdcpVersion;
2626
+ let artifactPayloadValidator;
2627
+ if (registration?.deliveryKind) {
2628
+ try {
2629
+ if (registration.deliveryKind === "reporting") {
2630
+ const { prepareMediaBuyDeliveryWebhookValidation } = require('../webhooks/media-buy-delivery.js');
2631
+ reportingAdcpVersion = prepareMediaBuyDeliveryWebhookValidation(
2632
+ options.adcpVersion ?? this.resolvedAdcpVersion
2633
+ ).adcpVersion;
2634
+ } else {
2635
+ const loader = require('../validation/schema-loader.js');
2636
+ artifactPayloadValidator = loader.getSchemaValidatorByRef(
2637
+ "content-standards/artifact-webhook-payload.json",
2638
+ this.resolvedAdcpVersion
2639
+ );
2640
+ if (!artifactPayloadValidator)
2641
+ throw new import_errors.ConfigurationError("Bundled artifact webhook schema is unavailable.");
2642
+ }
2643
+ } catch (cause) {
2644
+ return {
2645
+ ok: false,
2646
+ code: "webhook_verification_unavailable",
2647
+ message: registration.deliveryKind === "reporting" ? "Reporting webhook schema configuration is unavailable." : "Artifact webhook schema configuration is unavailable.",
2648
+ cause
2649
+ };
2650
+ }
2651
+ }
2595
2652
  if (registration?.mode === "rfc9421") {
2596
2653
  const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError, WebBotAuthUnavailableError } = loadWebBotAuth();
2597
2654
  const requestMethod = options.requestMethod;
@@ -2761,21 +2818,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2761
2818
  return parsedPayload;
2762
2819
  }
2763
2820
  if (registration?.deliveryKind) {
2764
- const loader = require('../validation/schema-loader.js');
2765
- const body = parsedPayload.payload;
2821
+ let body = parsedPayload.payload;
2766
2822
  const isReport = registration.deliveryKind === "reporting";
2767
- const payload = isReport ? body.result : body;
2768
- const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
2769
- const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
2770
- const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
2771
- if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
2772
- return {
2773
- ok: false,
2774
- code: "webhook_envelope_invalid",
2775
- message: "Authenticated delivery does not match its registered payload kind"
2776
- };
2823
+ let payload;
2824
+ if (isReport) {
2825
+ const { parseMediaBuyDeliveryWebhook } = require('../webhooks/media-buy-delivery.js');
2826
+ const report = parseMediaBuyDeliveryWebhook(body, {
2827
+ adcpVersion: reportingAdcpVersion
2828
+ });
2829
+ if (!report.ok) {
2830
+ if (report.code === "webhook_unsupported_payload") {
2831
+ return {
2832
+ ...report,
2833
+ message: "Registered reporting delivery requires a media_buy_delivery MCP envelope.",
2834
+ errors: ["Registered reporting delivery requires a media_buy_delivery MCP envelope."]
2835
+ };
2836
+ }
2837
+ return report;
2838
+ }
2839
+ if (report.wireFormat !== "mcp_envelope") {
2840
+ return {
2841
+ ok: false,
2842
+ code: "webhook_unsupported_payload",
2843
+ message: "Registered reporting delivery requires an MCP envelope."
2844
+ };
2845
+ }
2846
+ body = report.envelope;
2847
+ payload = report.result;
2848
+ } else {
2849
+ payload = body;
2850
+ if (!artifactPayloadValidator || !artifactPayloadValidator(payload)) {
2851
+ return {
2852
+ ok: false,
2853
+ code: "webhook_envelope_invalid",
2854
+ message: "Authenticated delivery does not match its registered payload kind"
2855
+ };
2856
+ }
2857
+ }
2777
2858
  const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
2778
- const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
2859
+ const operationId = registration.operationId;
2779
2860
  const status = isReport && (0, import_task_status.isAdcpStatus)(body.status) ? body.status : "completed";
2780
2861
  return {
2781
2862
  ok: true,
@@ -3529,18 +3610,26 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3529
3610
  }).ok;
3530
3611
  }
3531
3612
  /** One task owns discovery and dispatch sessions unless the caller already owns reuse. */
3532
- withConnectionScope(options, run) {
3613
+ withConnectionScope(options, run, preserveSessionOnResult) {
3533
3614
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
3534
3615
  return (0, import_mcp_connection_policy.withMCPConnectionPolicy)(
3535
3616
  transport,
3536
- () => (0, import_mcp_connection_policy.shouldReuseMCPConnection)(transport?.trustedFetchFn !== void 0) ? run() : (0, import_mcp_scope.withMCPConnectionScope)(run, { signal: options?.signal, preserveOnInterruption: true })
3617
+ () => (0, import_mcp_connection_policy.shouldReuseMCPConnection)(transport?.trustedFetchFn !== void 0) ? run() : (0, import_mcp_scope.withMCPConnectionScope)(run, {
3618
+ signal: options?.signal,
3619
+ preserveOnInterruption: true,
3620
+ preserveSessionOnResult
3621
+ })
3537
3622
  );
3538
3623
  }
3539
3624
  withTaskConnectionScope(options, run) {
3540
- return (0, import_task_deadline.withTaskDeadline)(options, (effective) => this.withConnectionScope(effective, () => run(effective)));
3625
+ return (0, import_task_deadline.withTaskDeadline)(
3626
+ options,
3627
+ (effective) => this.withConnectionScope(effective, () => run(effective), isNonterminalTaskResult)
3628
+ );
3541
3629
  }
3542
3630
  /** Execute a task, adapt maintained AdCP 3 releases, and call the completion handler. */
3543
3631
  async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3632
+ const projectionDrifts = (0, import_legacy_metadata.getCreativeDeliveryDiagnostics)(params);
3544
3633
  const requestParamsSnapshot = structuredClone(params);
3545
3634
  const canonicalRequestSnapshot = canonicalRequest === void 0 ? void 0 : structuredClone(canonicalRequest);
3546
3635
  const deferredProjectionCatalogs = projectionCatalogs ? structuredClone(projectionCatalogs) : void 0;
@@ -3556,11 +3645,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3556
3645
  transformCompletedResponse,
3557
3646
  legacyFormatConverter,
3558
3647
  canonicalRequestSnapshot,
3559
- deferredProjectionCatalogs
3648
+ deferredProjectionCatalogs,
3649
+ projectionDrifts
3560
3650
  )
3561
3651
  );
3562
3652
  }
3563
- async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3653
+ async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs, projectionDrifts = []) {
3564
3654
  (0, import_abort2.throwIfAborted)(options?.signal);
3565
3655
  const canonicalCreativeInvocation = CANONICAL_CREATIVE_ACTIVITY_TASKS.has(taskType) || canonicalRequest !== void 0;
3566
3656
  params = await this.applyAccountPolicy(taskType, params, options);
@@ -3636,7 +3726,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3636
3726
  if (negotiatedRelease?.downgraded && !options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation) {
3637
3727
  this.executor.validateRequest(taskType, adaptedParams, inputSchemaStripLogs, negotiatedRelease.version);
3638
3728
  }
3639
- const adaptationLogs = [...adaptDriftLogs];
3729
+ const adaptationLogs = [
3730
+ ...projectionDrifts.map((drift) => ({
3731
+ ...drift,
3732
+ taskName: taskType,
3733
+ clientVersion: this.resolvedAdcpVersion,
3734
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
3735
+ })),
3736
+ ...adaptDriftLogs
3737
+ ];
3640
3738
  if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
3641
3739
  const canonicalInputHandler = this.canonicalCreativeInputHandler(
3642
3740
  taskType,
@@ -4758,8 +4856,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4758
4856
  * stamps it on the version envelope and validates the response against it.
4759
4857
  */
4760
4858
  withNegotiatedRelease(options, negotiated) {
4761
- if (!negotiated?.downgraded) return options;
4762
- return { ...options ?? {}, wireAdcpVersion: negotiated.version, negotiatedAdcpVersion: negotiated.version };
4859
+ if (!negotiated) return options;
4860
+ return {
4861
+ ...options ?? {},
4862
+ selectedAdcpVersion: negotiated.version,
4863
+ ...negotiated.downgraded && {
4864
+ wireAdcpVersion: negotiated.version,
4865
+ negotiatedAdcpVersion: negotiated.version
4866
+ }
4867
+ };
4763
4868
  }
4764
4869
  /**
4765
4870
  * Refuse a tool the negotiated release does not define (a 3.2-only task
@@ -5028,8 +5133,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5028
5133
  const adapterKey = (0, import_version2.resolveAdapterKey)(this.resolvedAdcpVersion, perCallCapabilities ?? this.cachedCapabilities);
5029
5134
  if (adapterKey) {
5030
5135
  const versionAdapter = (0, import_version2.getVersionAdapter)(adapterKey, taskType);
5031
- if (versionAdapter?.adaptRequest) {
5032
- const result = versionAdapter.adaptRequest(adapted);
5136
+ const adaptRequest = negotiated ? versionAdapter?.adaptRequest : versionAdapter?.adaptUnnegotiatedRequest ?? versionAdapter?.adaptRequest;
5137
+ if (adaptRequest) {
5138
+ const result = adaptRequest(adapted);
5033
5139
  adapted = result.params;
5034
5140
  if (result.drift) {
5035
5141
  driftLogs.push({
@@ -5294,7 +5400,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5294
5400
  async createMediaBuy(params, inputHandler, options) {
5295
5401
  assertRawMethodForGovernedPayload("create_media_buy", options);
5296
5402
  this.assertDurableProjectionOverrideSupported(options?.legacyFormatConverter);
5297
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5403
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5298
5404
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5299
5405
  const snapshottedOptions = {
5300
5406
  ...snapshotTaskOptions(options),
@@ -5453,7 +5559,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5453
5559
  async updateMediaBuy(params, inputHandler, options) {
5454
5560
  assertRawMethodForGovernedPayload("update_media_buy", options);
5455
5561
  this.assertDurableProjectionOverrideSupported(options?.legacyFormatConverter);
5456
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5562
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5457
5563
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5458
5564
  const snapshottedOptions = {
5459
5565
  ...snapshotTaskOptions(options),
@@ -5535,12 +5641,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5535
5641
  this.assertDurableProjectionOverrideSupported(
5536
5642
  options?.creativeFormatProjection?.legacyFormatConverter ?? options?.legacyFormatConverter
5537
5643
  );
5538
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5644
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5539
5645
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5540
5646
  const creativeFormatProjection = options?.creativeFormatProjection ? {
5541
5647
  ...options.creativeFormatProjection,
5542
5648
  ...options.creativeFormatProjection.selectorContainers !== void 0 && {
5543
- selectorContainers: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(
5649
+ selectorContainers: (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(
5544
5650
  options.creativeFormatProjection.selectorContainers
5545
5651
  )
5546
5652
  }
@@ -5708,10 +5814,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5708
5814
  const creativeRef = isPlainRecord(creative) ? optionRef(creative.format_option_ref) : void 0;
5709
5815
  if (isPlainRecord(creative) && creative.format_option_ref !== void 0 && !creativeRef) return false;
5710
5816
  const isSellerDeclaration = (value) => {
5711
- if (!isPlainRecord(value) || (0, import_legacy_metadata.sellerDeclaredFormatOption)(value) !== true || (0, import_legacy_metadata.isSynthesizedFormatOption)(value)) {
5817
+ if (!isPlainRecord(value) || (0, import_legacy_metadata2.sellerDeclaredFormatOption)(value) !== true || (0, import_legacy_metadata2.isSynthesizedFormatOption)(value)) {
5712
5818
  return false;
5713
5819
  }
5714
- const evidence2 = (0, import_legacy_metadata.sellerFormatEvidence)(value);
5820
+ const evidence2 = (0, import_legacy_metadata2.sellerFormatEvidence)(value);
5715
5821
  if (!evidence2 || evidence2.scopeKey !== scopeKey || typeof container.product_id === "string" && evidence2.productId !== container.product_id || evidence2.expiresAt <= Date.now() || evidence2.accountScope !== accountScope && evidence2.accountScope !== "none")
5716
5822
  return false;
5717
5823
  const ref = optionRef(value);
@@ -5725,7 +5831,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5725
5831
  };
5726
5832
  const declarations = [
5727
5833
  ...(Array.isArray(container.format_options) ? container.format_options : []).filter(isSellerDeclaration),
5728
- ...(0, import_legacy_metadata.selectedFormatOptions)(container).filter(isSellerDeclaration)
5834
+ ...(0, import_legacy_metadata2.selectedFormatOptions)(container).filter(isSellerDeclaration)
5729
5835
  ];
5730
5836
  if (typeof container.product_id === "string") {
5731
5837
  for (const ref of [...refs, ...creativeRef ? [creativeRef] : []]) {
@@ -6002,25 +6108,31 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6002
6108
  * Pass an explicit agent via options.agent to override.
6003
6109
  */
6004
6110
  async syncPlans(params, inputHandler, options) {
6111
+ if (!options?.agent && !this.config.governance?.campaign?.agent) {
6112
+ return this.executeTaskUnprojected("sync_plans", params, inputHandler, options);
6113
+ }
6005
6114
  const agent = options?.agent ?? this.getGovernanceAgent();
6006
6115
  this.executor.validateRequest("sync_plans", params);
6007
6116
  return this.executor.executeTask(agent, "sync_plans", params, inputHandler, options);
6008
6117
  }
6009
- /**
6010
- * Get governance audit logs for one or more plans.
6011
- * Returns budget state, channel allocation, per-campaign breakdown, and audit trail.
6012
- *
6013
- * Uses the governance agent from config.governance.campaign.agent by default.
6014
- * Pass an explicit agent via options.agent to override.
6015
- */
6016
- async getPlanAuditLogs(params, options) {
6118
+ async getPlanAuditLogs(params, inputHandlerOrOptions, taskOptions) {
6119
+ const inputHandler = typeof inputHandlerOrOptions === "function" ? inputHandlerOrOptions : void 0;
6120
+ const options = inputHandlerOrOptions === void 0 || typeof inputHandlerOrOptions === "function" ? taskOptions : inputHandlerOrOptions;
6121
+ if (!options?.agent && !this.config.governance?.campaign?.agent) {
6122
+ return this.executeTaskUnprojected(
6123
+ "get_plan_audit_logs",
6124
+ params,
6125
+ inputHandler,
6126
+ options
6127
+ );
6128
+ }
6017
6129
  const agent = options?.agent ?? this.getGovernanceAgent();
6018
6130
  this.executor.validateRequest("get_plan_audit_logs", params);
6019
6131
  return this.executor.executeTask(
6020
6132
  agent,
6021
6133
  "get_plan_audit_logs",
6022
6134
  params,
6023
- void 0,
6135
+ inputHandler,
6024
6136
  options
6025
6137
  );
6026
6138
  }
@@ -6058,6 +6170,374 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6058
6170
  }
6059
6171
  return agent;
6060
6172
  }
6173
+ async advertisesTool(taskName, options) {
6174
+ const context = {};
6175
+ const capabilities = await this.getCapabilities({
6176
+ ...options,
6177
+ [CAPABILITY_DISCOVERY_CONTEXT]: context
6178
+ });
6179
+ return capabilities.discoveredTools?.includes(taskName) === true || context.toolSchemas?.has(taskName) === true;
6180
+ }
6181
+ /** Accept a committed proposal to create or amend a media buy, or apply a negotiated cancellation. */
6182
+ async acceptProposal(params, inputHandler, options) {
6183
+ return this.executeTaskUnprojected(
6184
+ "accept_proposal",
6185
+ params,
6186
+ inputHandler,
6187
+ options
6188
+ );
6189
+ }
6190
+ /** Execute the AdCP acquire_rights tool. */
6191
+ async acquireRights(params, inputHandler, options) {
6192
+ return this.executeTaskUnprojected(
6193
+ "acquire_rights",
6194
+ params,
6195
+ inputHandler,
6196
+ options
6197
+ );
6198
+ }
6199
+ /** Generate, transform, refine, retrieve, or adapt creative manifests for advertised creative capabilities. */
6200
+ async buildCreative(params, inputHandler, options) {
6201
+ return this.executeTaskUnprojected(
6202
+ "build_creative",
6203
+ params,
6204
+ inputHandler,
6205
+ options
6206
+ );
6207
+ }
6208
+ /** Create a media buy directly from published seller products and record its accepted commercial snapshot. */
6209
+ async buyProducts(params, inputHandler, options) {
6210
+ return this.executeTaskUnprojected("buy_products", params, inputHandler, options);
6211
+ }
6212
+ /** Execute the AdCP calibrate_content tool. */
6213
+ async calibrateContent(params, inputHandler, options) {
6214
+ return this.executeTaskUnprojected(
6215
+ "calibrate_content",
6216
+ params,
6217
+ inputHandler,
6218
+ options
6219
+ );
6220
+ }
6221
+ /** Execute the AdCP check_governance tool. */
6222
+ async checkGovernance(params, inputHandler, options) {
6223
+ return this.executeTaskUnprojected(
6224
+ "check_governance",
6225
+ params,
6226
+ inputHandler,
6227
+ options
6228
+ );
6229
+ }
6230
+ /** Control a seller compliance scenario. Intended for conformance testing. */
6231
+ async complyTestController(params, inputHandler, options) {
6232
+ return this.executeTaskUnprojected(
6233
+ "comply_test_controller",
6234
+ params,
6235
+ inputHandler,
6236
+ options
6237
+ );
6238
+ }
6239
+ /** Rename, pause, resume, cancel, or adjust delivery controls within accepted proposal change rights. */
6240
+ async controlMediaBuy(params, inputHandler, options) {
6241
+ return this.executeTaskUnprojected(
6242
+ "control_media_buy",
6243
+ params,
6244
+ inputHandler,
6245
+ options
6246
+ );
6247
+ }
6248
+ /** Execute the AdCP create_collection_list tool. */
6249
+ async createCollectionList(params, inputHandler, options) {
6250
+ return this.executeTaskUnprojected(
6251
+ "create_collection_list",
6252
+ params,
6253
+ inputHandler,
6254
+ options
6255
+ );
6256
+ }
6257
+ /** Execute the AdCP create_content_standards tool. */
6258
+ async createContentStandards(params, inputHandler, options) {
6259
+ return this.executeTaskUnprojected(
6260
+ "create_content_standards",
6261
+ params,
6262
+ inputHandler,
6263
+ options
6264
+ );
6265
+ }
6266
+ /** Terminally decline one or more proposals and record the buyer's reason. */
6267
+ async declineProposals(params, inputHandler, options) {
6268
+ return this.executeTaskUnprojected(
6269
+ "decline_proposals",
6270
+ params,
6271
+ inputHandler,
6272
+ options
6273
+ );
6274
+ }
6275
+ /** Execute the AdCP delete_collection_list tool. */
6276
+ async deleteCollectionList(params, inputHandler, options) {
6277
+ return this.executeTaskUnprojected(
6278
+ "delete_collection_list",
6279
+ params,
6280
+ inputHandler,
6281
+ options
6282
+ );
6283
+ }
6284
+ /** Retrieve spend, credit or balance status, and invoice history for an operator-billed account. */
6285
+ async getAccountFinancials(params, inputHandler, options) {
6286
+ return this.executeTaskUnprojected(
6287
+ "get_account_financials",
6288
+ params,
6289
+ inputHandler,
6290
+ options
6291
+ );
6292
+ }
6293
+ /** Execute the AdCP get_brand_identity tool. */
6294
+ async getBrandIdentity(params, inputHandler, options) {
6295
+ return this.executeTaskUnprojected(
6296
+ "get_brand_identity",
6297
+ params,
6298
+ inputHandler,
6299
+ options
6300
+ );
6301
+ }
6302
+ /** Execute the AdCP get_collection_list tool. */
6303
+ async getCollectionList(params, inputHandler, options) {
6304
+ return this.executeTaskUnprojected(
6305
+ "get_collection_list",
6306
+ params,
6307
+ inputHandler,
6308
+ options
6309
+ );
6310
+ }
6311
+ /** Execute the AdCP get_content_standards tool. */
6312
+ async getContentStandards(params, inputHandler, options) {
6313
+ return this.executeTaskUnprojected(
6314
+ "get_content_standards",
6315
+ params,
6316
+ inputHandler,
6317
+ options
6318
+ );
6319
+ }
6320
+ /** Evaluate a creative manifest and return scored safety, content, quality, and governance features. */
6321
+ async getCreativeFeatures(params, inputHandler, options) {
6322
+ return this.executeTaskUnprojected(
6323
+ "get_creative_features",
6324
+ params,
6325
+ inputHandler,
6326
+ options
6327
+ );
6328
+ }
6329
+ /** Execute the AdCP get_media_buy_artifacts tool. */
6330
+ async getMediaBuyArtifacts(params, inputHandler, options) {
6331
+ return this.executeTaskUnprojected(
6332
+ "get_media_buy_artifacts",
6333
+ params,
6334
+ inputHandler,
6335
+ options
6336
+ );
6337
+ }
6338
+ /** Check reporting health, enumerate expected periods and all retained revisions, or resolve one exact reporting revision. */
6339
+ async getReportingStatus(params, inputHandler, options) {
6340
+ return this.executeTaskUnprojected(
6341
+ "get_reporting_status",
6342
+ params,
6343
+ inputHandler,
6344
+ options
6345
+ );
6346
+ }
6347
+ /** Execute the AdCP get_rights tool. */
6348
+ async getRights(params, inputHandler, options) {
6349
+ return this.executeTaskUnprojected("get_rights", params, inputHandler, options);
6350
+ }
6351
+ /** Execute the AdCP list_collection_lists tool. */
6352
+ async listCollectionLists(params, inputHandler, options) {
6353
+ return this.executeTaskUnprojected(
6354
+ "list_collection_lists",
6355
+ params,
6356
+ inputHandler,
6357
+ options
6358
+ );
6359
+ }
6360
+ /** Execute the AdCP list_content_standards tool. */
6361
+ async listContentStandards(params, inputHandler, options) {
6362
+ return this.executeTaskUnprojected(
6363
+ "list_content_standards",
6364
+ params,
6365
+ inputHandler,
6366
+ options
6367
+ );
6368
+ }
6369
+ /** Execute the AdCP list_creative_formats tool. */
6370
+ async listCreativeFormats(params, inputHandler, options) {
6371
+ return this.executeTaskUnprojected(
6372
+ "list_creative_formats",
6373
+ params,
6374
+ inputHandler,
6375
+ options
6376
+ );
6377
+ }
6378
+ /** Discover account-scoped creative transformers and their selectable configuration options. */
6379
+ async listTransformers(params, inputHandler, options) {
6380
+ return this.executeTaskUnprojected(
6381
+ "list_transformers",
6382
+ params,
6383
+ inputHandler,
6384
+ options
6385
+ );
6386
+ }
6387
+ /** Log batches of marketing events against a configured event source for measurement and attribution. */
6388
+ async logEvent(params, inputHandler, options) {
6389
+ return this.executeTaskUnprojected("log_event", params, inputHandler, options);
6390
+ }
6391
+ /** Revise draft proposals, finalize them into committed, inventory-held snapshots, or extend a committed hold. */
6392
+ async refineProposals(params, inputHandler, options) {
6393
+ return this.executeTask("refine_proposals", params, inputHandler, options);
6394
+ }
6395
+ /** Execute the AdCP report_plan_adjustment tool. */
6396
+ async reportPlanAdjustment(params, inputHandler, options) {
6397
+ return this.executeTaskUnprojected(
6398
+ "report_plan_adjustment",
6399
+ params,
6400
+ inputHandler,
6401
+ options
6402
+ );
6403
+ }
6404
+ /** Execute the AdCP report_plan_outcome tool. */
6405
+ async reportPlanOutcome(params, inputHandler, options) {
6406
+ return this.executeTaskUnprojected(
6407
+ "report_plan_outcome",
6408
+ params,
6409
+ inputHandler,
6410
+ options
6411
+ );
6412
+ }
6413
+ /** Report vendor-service consumption and final measurements for revenue tracking and billing reconciliation. */
6414
+ async reportUsage(params, inputHandler, options) {
6415
+ return this.executeTaskUnprojected("report_usage", params, inputHandler, options);
6416
+ }
6417
+ /** Ask a seller to create one or more draft media-plan proposals from a campaign brief. */
6418
+ async requestProposals(params, inputHandler, options) {
6419
+ return this.executeTask("request_proposals", params, inputHandler, options);
6420
+ }
6421
+ /** Execute the AdCP search_brands tool. */
6422
+ async searchBrands(params, inputHandler, options) {
6423
+ return this.executeTaskUnprojected("search_brands", params, inputHandler, options);
6424
+ }
6425
+ /** Register, replace, pause, or clear caller-scoped webhooks for agent-level notifications. */
6426
+ async syncAgentNotificationConfigs(params, inputHandler, options) {
6427
+ return this.executeTaskUnprojected(
6428
+ "sync_agent_notification_configs",
6429
+ params,
6430
+ inputHandler,
6431
+ options
6432
+ );
6433
+ }
6434
+ /** List or synchronize buyer-managed account catalog feeds, suppress or restore specific items, and read current availability state. */
6435
+ async syncCatalogs(params, inputHandler, options) {
6436
+ return this.executeTaskUnprojected("sync_catalogs", params, inputHandler, options);
6437
+ }
6438
+ /** List or synchronize account event sources with upsert and optional replacement semantics. */
6439
+ async syncEventSources(params, inputHandler, options) {
6440
+ return this.executeTaskUnprojected(
6441
+ "sync_event_sources",
6442
+ params,
6443
+ inputHandler,
6444
+ options
6445
+ );
6446
+ }
6447
+ /** Bind or replace the governance agent used for approval across specific advertiser accounts. */
6448
+ async syncGovernance(params, inputHandler, options) {
6449
+ return this.executeTaskUnprojected(
6450
+ "sync_governance",
6451
+ params,
6452
+ inputHandler,
6453
+ options
6454
+ );
6455
+ }
6456
+ /** Record a consumer's independently verified reporting totals and destination evidence in the seller ledger. */
6457
+ async syncReportingReceipts(params, inputHandler, options) {
6458
+ return this.executeTaskUnprojected(
6459
+ "sync_reporting_receipts",
6460
+ params,
6461
+ inputHandler,
6462
+ options
6463
+ );
6464
+ }
6465
+ /** Tell a seller whether expected reporting was received, omitted, missing, unreadable, or contradictory. */
6466
+ async syncReportingStatus(params, inputHandler, options) {
6467
+ return this.executeTaskUnprojected(
6468
+ "sync_reporting_status",
6469
+ params,
6470
+ inputHandler,
6471
+ options
6472
+ );
6473
+ }
6474
+ /** Execute the AdCP update_collection_list tool. */
6475
+ async updateCollectionList(params, inputHandler, options) {
6476
+ return this.executeTaskUnprojected(
6477
+ "update_collection_list",
6478
+ params,
6479
+ inputHandler,
6480
+ options
6481
+ );
6482
+ }
6483
+ /** Execute the AdCP update_content_standards tool. */
6484
+ async updateContentStandards(params, inputHandler, options) {
6485
+ return this.executeTaskUnprojected(
6486
+ "update_content_standards",
6487
+ params,
6488
+ inputHandler,
6489
+ options
6490
+ );
6491
+ }
6492
+ /** Execute the AdCP update_rights tool. */
6493
+ async updateRights(params, inputHandler, options) {
6494
+ return this.executeTaskUnprojected("update_rights", params, inputHandler, options);
6495
+ }
6496
+ /** Execute the AdCP validate_content_delivery tool. */
6497
+ async validateContentDelivery(params, inputHandler, options) {
6498
+ return this.executeTaskUnprojected(
6499
+ "validate_content_delivery",
6500
+ params,
6501
+ inputHandler,
6502
+ options
6503
+ );
6504
+ }
6505
+ /** Preflight a creative manifest against canonical formats, products, third-party formats, or agent capabilities. */
6506
+ async validateInput(params, inputHandler, options) {
6507
+ return this.executeTaskUnprojected(
6508
+ "validate_input",
6509
+ params,
6510
+ inputHandler,
6511
+ options
6512
+ );
6513
+ }
6514
+ /** Execute the AdCP validate_property_delivery tool. */
6515
+ async validatePropertyDelivery(params, inputHandler, options) {
6516
+ return this.executeTaskUnprojected(
6517
+ "validate_property_delivery",
6518
+ params,
6519
+ inputHandler,
6520
+ options
6521
+ );
6522
+ }
6523
+ /** Execute the AdCP verify_brand_claim tool. */
6524
+ async verifyBrandClaim(params, inputHandler, options) {
6525
+ return this.executeTaskUnprojected(
6526
+ "verify_brand_claim",
6527
+ params,
6528
+ inputHandler,
6529
+ options
6530
+ );
6531
+ }
6532
+ /** Execute the AdCP verify_brand_claims tool. */
6533
+ async verifyBrandClaims(params, inputHandler, options) {
6534
+ return this.executeTaskUnprojected(
6535
+ "verify_brand_claims",
6536
+ params,
6537
+ inputHandler,
6538
+ options
6539
+ );
6540
+ }
6061
6541
  // ====== PROTOCOL TASKS ======
6062
6542
  /**
6063
6543
  * Get AdCP capabilities
@@ -6593,6 +7073,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6593
7073
  return this.getMediaBuyDelivery(params, inputHandler, options);
6594
7074
  case "get_creative_delivery":
6595
7075
  return this.getCreativeDelivery(params, inputHandler, options);
7076
+ case "preview_creative":
7077
+ return this.previewCreative(params, inputHandler, options);
7078
+ case "sync_plans":
7079
+ return this.syncPlans(params, inputHandler, options);
7080
+ case "get_plan_audit_logs":
7081
+ return this.getPlanAuditLogs(params, inputHandler, options);
6596
7082
  case "get_principal":
6597
7083
  return this.getPrincipal(params, inputHandler, options);
6598
7084
  case "sync_principal":
@@ -6671,6 +7157,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6671
7157
  const serverVersion = await this.detectServerVersion(detectionOptions);
6672
7158
  detectedServerVersion = serverVersion;
6673
7159
  detectedServerVersionSynthetic = capabilityDiscoveryContext.capabilities?._synthetic;
7160
+ if ((taskName === "sync_plans" || taskName === "get_plan_audit_logs") && capabilityDiscoveryContext.capabilities?.discoveredTools?.includes(taskName) !== true && capabilityDiscoveryContext.toolSchemas?.has(taskName) !== true) {
7161
+ throw new import_errors.ConfigurationError(
7162
+ `No governance agent configured and this agent does not advertise ${taskName}. Pass options.agent or configure governance.campaign.agent.`
7163
+ );
7164
+ }
6674
7165
  const negotiatedRelease = this.negotiateCallRelease(capabilityDiscoveryContext.capabilities, options);
6675
7166
  this.assertToolAvailableAtRelease(taskName, negotiatedRelease, capabilityDiscoveryContext.toolSchemas);
6676
7167
  this.assertRequestSupportedByTargetVersion(
@@ -7044,21 +7535,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7044
7535
  });
7045
7536
  });
7046
7537
  }
7047
- // ====== TASK MANAGEMENT & NOTIFICATIONS ======
7048
- /**
7049
- * List all tasks for this agent with detailed information
7050
- *
7051
- * @returns Promise resolving to array of task information
7052
- *
7053
- * @example
7054
- * ```typescript
7055
- * const tasks = await client.listTasks();
7056
- * tasks.forEach(task => {
7057
- * console.log(`${task.taskName}: ${task.status}`);
7058
- * });
7059
- * ```
7060
- */
7061
- async listTasks() {
7538
+ async listTasks(params, inputHandler, options) {
7539
+ if (params !== void 0) {
7540
+ return this.executeTaskUnprojected("list_tasks", params, inputHandler, options);
7541
+ }
7062
7542
  const tasks = await this.executor.getTaskList(this.agent.id);
7063
7543
  return tasks.map(
7064
7544
  (task) => (0, import_request_proposals_guard.assertNativeRequestProposalsTask)(