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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) 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/types.d.mts +5 -0
  10. package/dist/lib/adapters/version/types.d.ts +5 -0
  11. package/dist/lib/canonical-references/index.js +2 -0
  12. package/dist/lib/canonical-references/index.mjs +2 -0
  13. package/dist/lib/client/account-changes.d.mts +3 -1
  14. package/dist/lib/client/account-changes.d.ts +3 -1
  15. package/dist/lib/client/account-changes.js +22 -2
  16. package/dist/lib/client/account-changes.mjs +22 -2
  17. package/dist/lib/conformance/oracle.js +3 -2
  18. package/dist/lib/conformance/oracle.mjs +3 -2
  19. package/dist/lib/core/AgentClient.d.mts +165 -1
  20. package/dist/lib/core/AgentClient.d.ts +165 -1
  21. package/dist/lib/core/AgentClient.js +446 -8
  22. package/dist/lib/core/AgentClient.mjs +446 -8
  23. package/dist/lib/core/ConversationTypes.d.mts +8 -0
  24. package/dist/lib/core/ConversationTypes.d.ts +8 -0
  25. package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
  26. package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
  27. package/dist/lib/core/ProtocolResponseParser.js +28 -18
  28. package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
  29. package/dist/lib/core/SingleAgentClient.d.mts +115 -2
  30. package/dist/lib/core/SingleAgentClient.d.ts +115 -2
  31. package/dist/lib/core/SingleAgentClient.js +547 -67
  32. package/dist/lib/core/SingleAgentClient.mjs +534 -54
  33. package/dist/lib/core/TaskExecutor.d.mts +7 -0
  34. package/dist/lib/core/TaskExecutor.d.ts +7 -0
  35. package/dist/lib/core/TaskExecutor.js +18 -5
  36. package/dist/lib/core/TaskExecutor.mjs +18 -5
  37. package/dist/lib/core/task-status.d.mts +2 -0
  38. package/dist/lib/core/task-status.d.ts +2 -0
  39. package/dist/lib/core/task-status.js +11 -2
  40. package/dist/lib/core/task-status.mjs +9 -1
  41. package/dist/lib/identity-3.3/trust.d.mts +1 -4
  42. package/dist/lib/identity-3.3/trust.d.ts +1 -4
  43. package/dist/lib/identity-3.3/trust.js +34 -21
  44. package/dist/lib/identity-3.3/trust.mjs +34 -21
  45. package/dist/lib/identity-3.3/validation.js +5 -3
  46. package/dist/lib/identity-3.3/validation.mjs +6 -4
  47. package/dist/lib/index.d.mts +6 -52
  48. package/dist/lib/index.d.ts +6 -52
  49. package/dist/lib/index.js +11 -0
  50. package/dist/lib/index.mjs +7 -0
  51. package/dist/lib/media-buy/compatibility.js +6 -1
  52. package/dist/lib/media-buy/compatibility.mjs +6 -1
  53. package/dist/lib/protocols/mcp-scope.d.mts +3 -0
  54. package/dist/lib/protocols/mcp-scope.d.ts +3 -0
  55. package/dist/lib/protocols/mcp-scope.js +8 -3
  56. package/dist/lib/protocols/mcp-scope.mjs +8 -3
  57. package/dist/lib/reporting/inspection.js +1 -0
  58. package/dist/lib/reporting/inspection.mjs +1 -0
  59. package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
  60. package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
  61. package/dist/lib/reporting/ledger/coverage.js +37 -3
  62. package/dist/lib/reporting/ledger/coverage.mjs +36 -3
  63. package/dist/lib/reporting/ledger/handler.js +7 -4
  64. package/dist/lib/reporting/ledger/handler.mjs +7 -4
  65. package/dist/lib/reporting/ledger/producer.js +215 -69
  66. package/dist/lib/reporting/ledger/producer.mjs +217 -70
  67. package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
  68. package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
  69. package/dist/lib/reporting/ledger/schedule.js +8 -5
  70. package/dist/lib/reporting/ledger/schedule.mjs +8 -5
  71. package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
  72. package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
  73. package/dist/lib/reporting/ledger/status-ingest.js +4 -3
  74. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
  75. package/dist/lib/reporting/ledger/types.d.mts +36 -1
  76. package/dist/lib/reporting/ledger/types.d.ts +36 -1
  77. package/dist/lib/reporting/service/index.d.mts +14 -1
  78. package/dist/lib/reporting/service/index.d.ts +14 -1
  79. package/dist/lib/reporting/service/index.js +24 -12
  80. package/dist/lib/reporting/service/index.mjs +24 -12
  81. package/dist/lib/schemas/browser.d.mts +2 -0
  82. package/dist/lib/schemas/browser.d.ts +2 -0
  83. package/dist/lib/schemas/browser.js +3 -0
  84. package/dist/lib/schemas/browser.mjs +2 -0
  85. package/dist/lib/schemas/index.d.mts +5 -3
  86. package/dist/lib/schemas/index.d.ts +5 -3
  87. package/dist/lib/schemas/index.js +5 -0
  88. package/dist/lib/schemas/index.mjs +4 -0
  89. package/dist/lib/server/account-response-identity.d.mts +17 -0
  90. package/dist/lib/server/account-response-identity.d.ts +17 -0
  91. package/dist/lib/server/account-response-identity.js +52 -0
  92. package/dist/lib/server/account-response-identity.mjs +28 -0
  93. package/dist/lib/server/account-sync-contract.js +2 -2
  94. package/dist/lib/server/account-sync-contract.mjs +2 -2
  95. package/dist/lib/server/create-adcp-server.js +33 -20
  96. package/dist/lib/server/create-adcp-server.mjs +36 -12
  97. package/dist/lib/server/decisioning/account.d.mts +36 -10
  98. package/dist/lib/server/decisioning/account.d.ts +36 -10
  99. package/dist/lib/server/decisioning/account.js +33 -14
  100. package/dist/lib/server/decisioning/account.mjs +33 -14
  101. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
  102. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
  103. package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
  104. package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
  105. package/dist/lib/server/media-buy-store.d.mts +26 -12
  106. package/dist/lib/server/media-buy-store.d.ts +26 -12
  107. package/dist/lib/server/media-buy-store.js +69 -21
  108. package/dist/lib/server/media-buy-store.mjs +69 -21
  109. package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
  110. package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
  111. package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
  112. package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
  113. package/dist/lib/server/responses.js +9 -1
  114. package/dist/lib/server/responses.mjs +9 -1
  115. package/dist/lib/signing/agent-fetch.d.mts +1 -1
  116. package/dist/lib/signing/agent-fetch.d.ts +1 -1
  117. package/dist/lib/signing/agent-fetch.js +3 -3
  118. package/dist/lib/signing/agent-fetch.mjs +3 -3
  119. package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
  120. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
  121. package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
  122. package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
  123. package/dist/lib/testing/storyboard/compliance.js +62 -13
  124. package/dist/lib/testing/storyboard/compliance.mjs +63 -14
  125. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
  126. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
  127. package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
  128. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
  129. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  130. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  131. package/dist/lib/types/accept-proposal.d.ts +20 -28
  132. package/dist/lib/types/asset-instances.d.mts +1 -1
  133. package/dist/lib/types/asset-instances.d.ts +1 -1
  134. package/dist/lib/types/buy-products.d.ts +20 -28
  135. package/dist/lib/types/check-governance.d.ts +20 -28
  136. package/dist/lib/types/comply-test-controller.d.ts +20 -28
  137. package/dist/lib/types/control-media-buy.d.ts +20 -28
  138. package/dist/lib/types/core.generated.d.mts +273 -184
  139. package/dist/lib/types/core.generated.d.ts +273 -184
  140. package/dist/lib/types/create-media-buy.d.ts +20 -28
  141. package/dist/lib/types/get-media-buys.d.ts +20 -28
  142. package/dist/lib/types/get-products.d.ts +20 -28
  143. package/dist/lib/types/index.d.mts +6 -1
  144. package/dist/lib/types/index.d.ts +6 -1
  145. package/dist/lib/types/index.js +6 -1
  146. package/dist/lib/types/index.mjs +4 -1
  147. package/dist/lib/types/inline-enums.generated.d.mts +30 -4
  148. package/dist/lib/types/inline-enums.generated.d.ts +30 -4
  149. package/dist/lib/types/inline-enums.generated.js +41 -2
  150. package/dist/lib/types/inline-enums.generated.mjs +28 -2
  151. package/dist/lib/types/list-products.d.ts +20 -28
  152. package/dist/lib/types/list-proposals.d.ts +20 -28
  153. package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
  154. package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
  155. package/dist/lib/types/media-buy-delivery-report.js +16 -0
  156. package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
  157. package/dist/lib/types/refine-proposals.d.ts +20 -28
  158. package/dist/lib/types/request-proposals.d.ts +20 -28
  159. package/dist/lib/types/schemas.generated.d.ts +63113 -127273
  160. package/dist/lib/types/schemas.generated.js +759 -770
  161. package/dist/lib/types/schemas.generated.mjs +759 -770
  162. package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
  163. package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
  164. package/dist/lib/types/targeting-keys.generated.js +109 -0
  165. package/dist/lib/types/targeting-keys.generated.mjs +84 -0
  166. package/dist/lib/types/tools.generated.d.mts +2 -68
  167. package/dist/lib/types/tools.generated.d.ts +2 -68
  168. package/dist/lib/types/update-media-buy.d.ts +20 -28
  169. package/dist/lib/utils/adcp-version-config.js +5 -2
  170. package/dist/lib/utils/adcp-version-config.mjs +5 -2
  171. package/dist/lib/utils/response-unwrapper.js +6 -1
  172. package/dist/lib/utils/response-unwrapper.mjs +6 -1
  173. package/dist/lib/v2/format-schema/resolver.js +1 -1
  174. package/dist/lib/v2/format-schema/resolver.mjs +1 -1
  175. package/dist/lib/v2/projection/creative-delivery.js +104 -29
  176. package/dist/lib/v2/projection/creative-delivery.mjs +108 -29
  177. package/dist/lib/v2/projection/index.d.mts +1 -0
  178. package/dist/lib/v2/projection/index.d.ts +1 -0
  179. package/dist/lib/v2/projection/index.js +3 -0
  180. package/dist/lib/v2/projection/index.mjs +2 -0
  181. package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
  182. package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
  183. package/dist/lib/v2/projection/legacy-metadata.js +91 -0
  184. package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
  185. package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
  186. package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
  187. package/dist/lib/v2/projection/v1-to-v2.js +12 -9
  188. package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
  189. package/dist/lib/validation/budget-allocation.d.mts +3 -3
  190. package/dist/lib/validation/budget-allocation.d.ts +3 -3
  191. package/dist/lib/validation/compact-schema.d.mts +27 -0
  192. package/dist/lib/validation/compact-schema.d.ts +27 -0
  193. package/dist/lib/validation/compact-schema.js +276 -0
  194. package/dist/lib/validation/compact-schema.mjs +250 -0
  195. package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
  196. package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
  197. package/dist/lib/validation/media-buy-delivery-report.js +31 -0
  198. package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
  199. package/dist/lib/validation/nonempty-array.d.mts +15 -0
  200. package/dist/lib/validation/nonempty-array.d.ts +15 -0
  201. package/dist/lib/validation/nonempty-array.js +41 -0
  202. package/dist/lib/validation/nonempty-array.mjs +7 -0
  203. package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
  204. package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
  205. package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
  206. package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
  207. package/dist/lib/validation/schema-loader.js +86 -16
  208. package/dist/lib/validation/schema-loader.mjs +82 -16
  209. package/dist/lib/validation/schema-validator.d.mts +10 -19
  210. package/dist/lib/validation/schema-validator.d.ts +10 -19
  211. package/dist/lib/validation/schema-validator.js +135 -42
  212. package/dist/lib/validation/schema-validator.mjs +139 -43
  213. package/dist/lib/validation/sync-creatives.d.mts +22 -22
  214. package/dist/lib/validation/sync-creatives.d.ts +22 -22
  215. package/dist/lib/version.d.mts +3 -3
  216. package/dist/lib/version.d.ts +3 -3
  217. package/dist/lib/version.js +3 -3
  218. package/dist/lib/version.mjs +3 -3
  219. package/dist/lib/webhooks/index.d.mts +3 -0
  220. package/dist/lib/webhooks/index.d.ts +3 -0
  221. package/dist/lib/webhooks/index.js +3 -0
  222. package/dist/lib/webhooks/index.mjs +2 -0
  223. package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
  224. package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
  225. package/dist/lib/webhooks/media-buy-delivery.js +119 -0
  226. package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
  227. package/docs/TYPE-SUMMARY.md +2 -2
  228. package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
  229. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
  230. package/docs/guides/REPORTING-LEDGER.md +93 -0
  231. package/docs/guides/REPORTING-STABILITY.md +1 -1
  232. package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
  233. package/docs/llms.txt +2 -2
  234. package/docs/migration-14.x-rc-worksheet.md +4 -4
  235. package/docs/migration-16-to-17.md +191 -14
  236. package/docs/migration-6.6-to-6.7.md +14 -0
  237. package/docs/migration-account-change-feed.md +15 -0
  238. package/docs/recipes/verifying-inbound-webhooks.md +18 -2
  239. package/package.json +2 -2
@@ -24,6 +24,16 @@ import {
24
24
  import { randomUUID, scryptSync } from "node:crypto";
25
25
  const SKIP_PRODUCT_CACHE = /* @__PURE__ */ Symbol("adcp.skipProductCache");
26
26
  const SKIP_ACCOUNT_REGISTRY_OBSERVATION = /* @__PURE__ */ Symbol("adcp.skipAccountRegistryObservation");
27
+ const NONTERMINAL_TASK_RESULT_STATUSES = /* @__PURE__ */ new Set([
28
+ "submitted",
29
+ "working",
30
+ "input-required",
31
+ "auth-required",
32
+ "deferred"
33
+ ]);
34
+ function isNonterminalTaskResult(result) {
35
+ 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);
36
+ }
27
37
  import { accountKeySites, naturalAccountKey, reducedFields, valueAt, withReducedKeyAt } from "./account-reduction.mjs";
28
38
  import { ADCP_ENVELOPE_FIELDS } from "../types/adcp.mjs";
29
39
  import { parseAdcpMajorVersion, toReleasePrecisionVersion } from "../version.mjs";
@@ -177,6 +187,7 @@ import {
177
187
  selectListedAccount
178
188
  } from "./account-resolution.mjs";
179
189
  import { normalizeRequestParams } from "../utils/request-normalizer.mjs";
190
+ import { getCreativeDeliveryDiagnostics } from "../v2/projection/legacy-metadata.mjs";
180
191
  import { globalAsyncLocalStorage } from "../utils/global-async-local-storage.mjs";
181
192
  import { validateUserAgent } from "../utils/validate-user-agent.mjs";
182
193
  import { resolveWebhookUrl, selectWebhookTemplate } from "./webhook-url.mjs";
@@ -742,10 +753,7 @@ const STANDARD_ADCP_TASK_NAMES = /* @__PURE__ */ new Set([
742
753
  "list_transformers",
743
754
  "preview_creative",
744
755
  "build_creative",
745
- // These standard protocol tools still carry legacy creative `format_id`
746
- // identity through artifacts, manifests, standards, or rights constraints.
747
- // They are available only through explicitly named *Legacy APIs until a
748
- // lossless canonical projection exists.
756
+ // Wire-level creative and content tools also have typed primary methods.
749
757
  "list_content_standards",
750
758
  "get_content_standards",
751
759
  "create_content_standards",
@@ -1029,7 +1037,19 @@ class SingleAgentClient {
1029
1037
  adcpVersion: this.resolvedAdcpVersion,
1030
1038
  ...config.wireAdcpVersion !== void 0 && { wireAdcpVersion: config.wireAdcpVersion },
1031
1039
  ...config.versionEnvelope !== void 0 && { versionEnvelope: config.versionEnvelope },
1032
- transport: config.transport
1040
+ transport: config.transport,
1041
+ resolveTaskStatusTool: async (pollAgent, options) => {
1042
+ const client = pollAgent.id === this.normalizedAgent.id ? this : new SingleAgentClient(pollAgent, {
1043
+ adcpVersion: this.resolvedAdcpVersion,
1044
+ wireAdcpVersion: this.config.wireAdcpVersion,
1045
+ versionEnvelope: this.config.versionEnvelope,
1046
+ userAgent: this.config.userAgent,
1047
+ discoveryCache: this.config.discoveryCache,
1048
+ onTransportActivity: this.config.onTransportActivity,
1049
+ transport: options.transport
1050
+ });
1051
+ return await client.advertisesTool("get_task_status", options) ? "get_task_status" : pollAgent.protocol === "mcp" ? "tasks_get" : "tasks/get";
1052
+ }
1033
1053
  });
1034
1054
  if (config.handlers) {
1035
1055
  this.asyncHandler = new AsyncHandler(config.handlers);
@@ -1837,8 +1857,18 @@ class SingleAgentClient {
1837
1857
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(snapshot) : await this.ensureEndpointDiscovered(snapshot);
1838
1858
  return this.executor.trackTask(agent, snapshot);
1839
1859
  }
1840
- /** Poll through the same discovered/canonical protocol endpoint used for dispatch. @internal */
1841
- async getTaskStatus(taskId, transport, signal, wireOptions) {
1860
+ async getTaskStatus(taskIdOrParams, transportOrHandler, signalOrOptions, wireOptions) {
1861
+ if (typeof taskIdOrParams !== "string") {
1862
+ return this.executeTaskUnprojected(
1863
+ "get_task_status",
1864
+ taskIdOrParams,
1865
+ transportOrHandler,
1866
+ signalOrOptions
1867
+ );
1868
+ }
1869
+ const taskId = taskIdOrParams;
1870
+ const transport = transportOrHandler;
1871
+ const signal = signalOrOptions;
1842
1872
  const transportSnapshot = transport === void 0 ? void 0 : { ...transport };
1843
1873
  const options = { transport: transportSnapshot, signal };
1844
1874
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(options) : await this.ensureEndpointDiscovered(options);
@@ -2703,6 +2733,33 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2703
2733
  };
2704
2734
  }
2705
2735
  }
2736
+ let reportingAdcpVersion;
2737
+ let artifactPayloadValidator;
2738
+ if (registration?.deliveryKind) {
2739
+ try {
2740
+ if (registration.deliveryKind === "reporting") {
2741
+ const { prepareMediaBuyDeliveryWebhookValidation } = require2("../webhooks/media-buy-delivery");
2742
+ reportingAdcpVersion = prepareMediaBuyDeliveryWebhookValidation(
2743
+ options.adcpVersion ?? this.resolvedAdcpVersion
2744
+ ).adcpVersion;
2745
+ } else {
2746
+ const loader = require2("../validation/schema-loader");
2747
+ artifactPayloadValidator = loader.getSchemaValidatorByRef(
2748
+ "content-standards/artifact-webhook-payload.json",
2749
+ this.resolvedAdcpVersion
2750
+ );
2751
+ if (!artifactPayloadValidator)
2752
+ throw new ConfigurationError("Bundled artifact webhook schema is unavailable.");
2753
+ }
2754
+ } catch (cause) {
2755
+ return {
2756
+ ok: false,
2757
+ code: "webhook_verification_unavailable",
2758
+ message: registration.deliveryKind === "reporting" ? "Reporting webhook schema configuration is unavailable." : "Artifact webhook schema configuration is unavailable.",
2759
+ cause
2760
+ };
2761
+ }
2762
+ }
2706
2763
  if (registration?.mode === "rfc9421") {
2707
2764
  const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError, WebBotAuthUnavailableError } = loadWebBotAuth();
2708
2765
  const requestMethod = options.requestMethod;
@@ -2872,21 +2929,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2872
2929
  return parsedPayload;
2873
2930
  }
2874
2931
  if (registration?.deliveryKind) {
2875
- const loader = require2("../validation/schema-loader");
2876
- const body = parsedPayload.payload;
2932
+ let body = parsedPayload.payload;
2877
2933
  const isReport = registration.deliveryKind === "reporting";
2878
- const payload = isReport ? body.result : body;
2879
- const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
2880
- const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
2881
- const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
2882
- if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
2883
- return {
2884
- ok: false,
2885
- code: "webhook_envelope_invalid",
2886
- message: "Authenticated delivery does not match its registered payload kind"
2887
- };
2934
+ let payload;
2935
+ if (isReport) {
2936
+ const { parseMediaBuyDeliveryWebhook } = require2("../webhooks/media-buy-delivery");
2937
+ const report = parseMediaBuyDeliveryWebhook(body, {
2938
+ adcpVersion: reportingAdcpVersion
2939
+ });
2940
+ if (!report.ok) {
2941
+ if (report.code === "webhook_unsupported_payload") {
2942
+ return {
2943
+ ...report,
2944
+ message: "Registered reporting delivery requires a media_buy_delivery MCP envelope.",
2945
+ errors: ["Registered reporting delivery requires a media_buy_delivery MCP envelope."]
2946
+ };
2947
+ }
2948
+ return report;
2949
+ }
2950
+ if (report.wireFormat !== "mcp_envelope") {
2951
+ return {
2952
+ ok: false,
2953
+ code: "webhook_unsupported_payload",
2954
+ message: "Registered reporting delivery requires an MCP envelope."
2955
+ };
2956
+ }
2957
+ body = report.envelope;
2958
+ payload = report.result;
2959
+ } else {
2960
+ payload = body;
2961
+ if (!artifactPayloadValidator || !artifactPayloadValidator(payload)) {
2962
+ return {
2963
+ ok: false,
2964
+ code: "webhook_envelope_invalid",
2965
+ message: "Authenticated delivery does not match its registered payload kind"
2966
+ };
2967
+ }
2968
+ }
2888
2969
  const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
2889
- const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
2970
+ const operationId = registration.operationId;
2890
2971
  const status = isReport && isAdcpStatus(body.status) ? body.status : "completed";
2891
2972
  return {
2892
2973
  ok: true,
@@ -3640,18 +3721,26 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3640
3721
  }).ok;
3641
3722
  }
3642
3723
  /** One task owns discovery and dispatch sessions unless the caller already owns reuse. */
3643
- withConnectionScope(options, run) {
3724
+ withConnectionScope(options, run, preserveSessionOnResult) {
3644
3725
  const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
3645
3726
  return withMCPConnectionPolicy(
3646
3727
  transport,
3647
- () => shouldReuseMCPConnection(transport?.trustedFetchFn !== void 0) ? run() : withMCPConnectionScope(run, { signal: options?.signal, preserveOnInterruption: true })
3728
+ () => shouldReuseMCPConnection(transport?.trustedFetchFn !== void 0) ? run() : withMCPConnectionScope(run, {
3729
+ signal: options?.signal,
3730
+ preserveOnInterruption: true,
3731
+ preserveSessionOnResult
3732
+ })
3648
3733
  );
3649
3734
  }
3650
3735
  withTaskConnectionScope(options, run) {
3651
- return withTaskDeadline(options, (effective) => this.withConnectionScope(effective, () => run(effective)));
3736
+ return withTaskDeadline(
3737
+ options,
3738
+ (effective) => this.withConnectionScope(effective, () => run(effective), isNonterminalTaskResult)
3739
+ );
3652
3740
  }
3653
3741
  /** Execute a task, adapt maintained AdCP 3 releases, and call the completion handler. */
3654
3742
  async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3743
+ const projectionDrifts = getCreativeDeliveryDiagnostics(params);
3655
3744
  const requestParamsSnapshot = structuredClone(params);
3656
3745
  const canonicalRequestSnapshot = canonicalRequest === void 0 ? void 0 : structuredClone(canonicalRequest);
3657
3746
  const deferredProjectionCatalogs = projectionCatalogs ? structuredClone(projectionCatalogs) : void 0;
@@ -3667,11 +3756,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3667
3756
  transformCompletedResponse,
3668
3757
  legacyFormatConverter,
3669
3758
  canonicalRequestSnapshot,
3670
- deferredProjectionCatalogs
3759
+ deferredProjectionCatalogs,
3760
+ projectionDrifts
3671
3761
  )
3672
3762
  );
3673
3763
  }
3674
- async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3764
+ async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs, projectionDrifts = []) {
3675
3765
  throwIfAborted(options?.signal);
3676
3766
  const canonicalCreativeInvocation = CANONICAL_CREATIVE_ACTIVITY_TASKS.has(taskType) || canonicalRequest !== void 0;
3677
3767
  params = await this.applyAccountPolicy(taskType, params, options);
@@ -3747,7 +3837,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3747
3837
  if (negotiatedRelease?.downgraded && !options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation) {
3748
3838
  this.executor.validateRequest(taskType, adaptedParams, inputSchemaStripLogs, negotiatedRelease.version);
3749
3839
  }
3750
- const adaptationLogs = [...adaptDriftLogs];
3840
+ const adaptationLogs = [
3841
+ ...projectionDrifts.map((drift) => ({
3842
+ ...drift,
3843
+ taskName: taskType,
3844
+ clientVersion: this.resolvedAdcpVersion,
3845
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
3846
+ })),
3847
+ ...adaptDriftLogs
3848
+ ];
3751
3849
  if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
3752
3850
  const canonicalInputHandler = this.canonicalCreativeInputHandler(
3753
3851
  taskType,
@@ -4869,8 +4967,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4869
4967
  * stamps it on the version envelope and validates the response against it.
4870
4968
  */
4871
4969
  withNegotiatedRelease(options, negotiated) {
4872
- if (!negotiated?.downgraded) return options;
4873
- return { ...options ?? {}, wireAdcpVersion: negotiated.version, negotiatedAdcpVersion: negotiated.version };
4970
+ if (!negotiated) return options;
4971
+ return {
4972
+ ...options ?? {},
4973
+ selectedAdcpVersion: negotiated.version,
4974
+ ...negotiated.downgraded && {
4975
+ wireAdcpVersion: negotiated.version,
4976
+ negotiatedAdcpVersion: negotiated.version
4977
+ }
4978
+ };
4874
4979
  }
4875
4980
  /**
4876
4981
  * Refuse a tool the negotiated release does not define (a 3.2-only task
@@ -5139,8 +5244,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5139
5244
  const adapterKey = resolveAdapterKey(this.resolvedAdcpVersion, perCallCapabilities ?? this.cachedCapabilities);
5140
5245
  if (adapterKey) {
5141
5246
  const versionAdapter = getVersionAdapter(adapterKey, taskType);
5142
- if (versionAdapter?.adaptRequest) {
5143
- const result = versionAdapter.adaptRequest(adapted);
5247
+ const adaptRequest = negotiated ? versionAdapter?.adaptRequest : versionAdapter?.adaptUnnegotiatedRequest ?? versionAdapter?.adaptRequest;
5248
+ if (adaptRequest) {
5249
+ const result = adaptRequest(adapted);
5144
5250
  adapted = result.params;
5145
5251
  if (result.drift) {
5146
5252
  driftLogs.push({
@@ -6113,25 +6219,31 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6113
6219
  * Pass an explicit agent via options.agent to override.
6114
6220
  */
6115
6221
  async syncPlans(params, inputHandler, options) {
6222
+ if (!options?.agent && !this.config.governance?.campaign?.agent) {
6223
+ return this.executeTaskUnprojected("sync_plans", params, inputHandler, options);
6224
+ }
6116
6225
  const agent = options?.agent ?? this.getGovernanceAgent();
6117
6226
  this.executor.validateRequest("sync_plans", params);
6118
6227
  return this.executor.executeTask(agent, "sync_plans", params, inputHandler, options);
6119
6228
  }
6120
- /**
6121
- * Get governance audit logs for one or more plans.
6122
- * Returns budget state, channel allocation, per-campaign breakdown, and audit trail.
6123
- *
6124
- * Uses the governance agent from config.governance.campaign.agent by default.
6125
- * Pass an explicit agent via options.agent to override.
6126
- */
6127
- async getPlanAuditLogs(params, options) {
6229
+ async getPlanAuditLogs(params, inputHandlerOrOptions, taskOptions) {
6230
+ const inputHandler = typeof inputHandlerOrOptions === "function" ? inputHandlerOrOptions : void 0;
6231
+ const options = inputHandlerOrOptions === void 0 || typeof inputHandlerOrOptions === "function" ? taskOptions : inputHandlerOrOptions;
6232
+ if (!options?.agent && !this.config.governance?.campaign?.agent) {
6233
+ return this.executeTaskUnprojected(
6234
+ "get_plan_audit_logs",
6235
+ params,
6236
+ inputHandler,
6237
+ options
6238
+ );
6239
+ }
6128
6240
  const agent = options?.agent ?? this.getGovernanceAgent();
6129
6241
  this.executor.validateRequest("get_plan_audit_logs", params);
6130
6242
  return this.executor.executeTask(
6131
6243
  agent,
6132
6244
  "get_plan_audit_logs",
6133
6245
  params,
6134
- void 0,
6246
+ inputHandler,
6135
6247
  options
6136
6248
  );
6137
6249
  }
@@ -6169,6 +6281,374 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6169
6281
  }
6170
6282
  return agent;
6171
6283
  }
6284
+ async advertisesTool(taskName, options) {
6285
+ const context = {};
6286
+ const capabilities = await this.getCapabilities({
6287
+ ...options,
6288
+ [CAPABILITY_DISCOVERY_CONTEXT]: context
6289
+ });
6290
+ return capabilities.discoveredTools?.includes(taskName) === true || context.toolSchemas?.has(taskName) === true;
6291
+ }
6292
+ /** Accept a committed proposal to create or amend a media buy, or apply a negotiated cancellation. */
6293
+ async acceptProposal(params, inputHandler, options) {
6294
+ return this.executeTaskUnprojected(
6295
+ "accept_proposal",
6296
+ params,
6297
+ inputHandler,
6298
+ options
6299
+ );
6300
+ }
6301
+ /** Execute the AdCP acquire_rights tool. */
6302
+ async acquireRights(params, inputHandler, options) {
6303
+ return this.executeTaskUnprojected(
6304
+ "acquire_rights",
6305
+ params,
6306
+ inputHandler,
6307
+ options
6308
+ );
6309
+ }
6310
+ /** Generate, transform, refine, retrieve, or adapt creative manifests for advertised creative capabilities. */
6311
+ async buildCreative(params, inputHandler, options) {
6312
+ return this.executeTaskUnprojected(
6313
+ "build_creative",
6314
+ params,
6315
+ inputHandler,
6316
+ options
6317
+ );
6318
+ }
6319
+ /** Create a media buy directly from published seller products and record its accepted commercial snapshot. */
6320
+ async buyProducts(params, inputHandler, options) {
6321
+ return this.executeTaskUnprojected("buy_products", params, inputHandler, options);
6322
+ }
6323
+ /** Execute the AdCP calibrate_content tool. */
6324
+ async calibrateContent(params, inputHandler, options) {
6325
+ return this.executeTaskUnprojected(
6326
+ "calibrate_content",
6327
+ params,
6328
+ inputHandler,
6329
+ options
6330
+ );
6331
+ }
6332
+ /** Execute the AdCP check_governance tool. */
6333
+ async checkGovernance(params, inputHandler, options) {
6334
+ return this.executeTaskUnprojected(
6335
+ "check_governance",
6336
+ params,
6337
+ inputHandler,
6338
+ options
6339
+ );
6340
+ }
6341
+ /** Control a seller compliance scenario. Intended for conformance testing. */
6342
+ async complyTestController(params, inputHandler, options) {
6343
+ return this.executeTaskUnprojected(
6344
+ "comply_test_controller",
6345
+ params,
6346
+ inputHandler,
6347
+ options
6348
+ );
6349
+ }
6350
+ /** Rename, pause, resume, cancel, or adjust delivery controls within accepted proposal change rights. */
6351
+ async controlMediaBuy(params, inputHandler, options) {
6352
+ return this.executeTaskUnprojected(
6353
+ "control_media_buy",
6354
+ params,
6355
+ inputHandler,
6356
+ options
6357
+ );
6358
+ }
6359
+ /** Execute the AdCP create_collection_list tool. */
6360
+ async createCollectionList(params, inputHandler, options) {
6361
+ return this.executeTaskUnprojected(
6362
+ "create_collection_list",
6363
+ params,
6364
+ inputHandler,
6365
+ options
6366
+ );
6367
+ }
6368
+ /** Execute the AdCP create_content_standards tool. */
6369
+ async createContentStandards(params, inputHandler, options) {
6370
+ return this.executeTaskUnprojected(
6371
+ "create_content_standards",
6372
+ params,
6373
+ inputHandler,
6374
+ options
6375
+ );
6376
+ }
6377
+ /** Terminally decline one or more proposals and record the buyer's reason. */
6378
+ async declineProposals(params, inputHandler, options) {
6379
+ return this.executeTaskUnprojected(
6380
+ "decline_proposals",
6381
+ params,
6382
+ inputHandler,
6383
+ options
6384
+ );
6385
+ }
6386
+ /** Execute the AdCP delete_collection_list tool. */
6387
+ async deleteCollectionList(params, inputHandler, options) {
6388
+ return this.executeTaskUnprojected(
6389
+ "delete_collection_list",
6390
+ params,
6391
+ inputHandler,
6392
+ options
6393
+ );
6394
+ }
6395
+ /** Retrieve spend, credit or balance status, and invoice history for an operator-billed account. */
6396
+ async getAccountFinancials(params, inputHandler, options) {
6397
+ return this.executeTaskUnprojected(
6398
+ "get_account_financials",
6399
+ params,
6400
+ inputHandler,
6401
+ options
6402
+ );
6403
+ }
6404
+ /** Execute the AdCP get_brand_identity tool. */
6405
+ async getBrandIdentity(params, inputHandler, options) {
6406
+ return this.executeTaskUnprojected(
6407
+ "get_brand_identity",
6408
+ params,
6409
+ inputHandler,
6410
+ options
6411
+ );
6412
+ }
6413
+ /** Execute the AdCP get_collection_list tool. */
6414
+ async getCollectionList(params, inputHandler, options) {
6415
+ return this.executeTaskUnprojected(
6416
+ "get_collection_list",
6417
+ params,
6418
+ inputHandler,
6419
+ options
6420
+ );
6421
+ }
6422
+ /** Execute the AdCP get_content_standards tool. */
6423
+ async getContentStandards(params, inputHandler, options) {
6424
+ return this.executeTaskUnprojected(
6425
+ "get_content_standards",
6426
+ params,
6427
+ inputHandler,
6428
+ options
6429
+ );
6430
+ }
6431
+ /** Evaluate a creative manifest and return scored safety, content, quality, and governance features. */
6432
+ async getCreativeFeatures(params, inputHandler, options) {
6433
+ return this.executeTaskUnprojected(
6434
+ "get_creative_features",
6435
+ params,
6436
+ inputHandler,
6437
+ options
6438
+ );
6439
+ }
6440
+ /** Execute the AdCP get_media_buy_artifacts tool. */
6441
+ async getMediaBuyArtifacts(params, inputHandler, options) {
6442
+ return this.executeTaskUnprojected(
6443
+ "get_media_buy_artifacts",
6444
+ params,
6445
+ inputHandler,
6446
+ options
6447
+ );
6448
+ }
6449
+ /** Check reporting health, enumerate expected periods and all retained revisions, or resolve one exact reporting revision. */
6450
+ async getReportingStatus(params, inputHandler, options) {
6451
+ return this.executeTaskUnprojected(
6452
+ "get_reporting_status",
6453
+ params,
6454
+ inputHandler,
6455
+ options
6456
+ );
6457
+ }
6458
+ /** Execute the AdCP get_rights tool. */
6459
+ async getRights(params, inputHandler, options) {
6460
+ return this.executeTaskUnprojected("get_rights", params, inputHandler, options);
6461
+ }
6462
+ /** Execute the AdCP list_collection_lists tool. */
6463
+ async listCollectionLists(params, inputHandler, options) {
6464
+ return this.executeTaskUnprojected(
6465
+ "list_collection_lists",
6466
+ params,
6467
+ inputHandler,
6468
+ options
6469
+ );
6470
+ }
6471
+ /** Execute the AdCP list_content_standards tool. */
6472
+ async listContentStandards(params, inputHandler, options) {
6473
+ return this.executeTaskUnprojected(
6474
+ "list_content_standards",
6475
+ params,
6476
+ inputHandler,
6477
+ options
6478
+ );
6479
+ }
6480
+ /** Execute the AdCP list_creative_formats tool. */
6481
+ async listCreativeFormats(params, inputHandler, options) {
6482
+ return this.executeTaskUnprojected(
6483
+ "list_creative_formats",
6484
+ params,
6485
+ inputHandler,
6486
+ options
6487
+ );
6488
+ }
6489
+ /** Discover account-scoped creative transformers and their selectable configuration options. */
6490
+ async listTransformers(params, inputHandler, options) {
6491
+ return this.executeTaskUnprojected(
6492
+ "list_transformers",
6493
+ params,
6494
+ inputHandler,
6495
+ options
6496
+ );
6497
+ }
6498
+ /** Log batches of marketing events against a configured event source for measurement and attribution. */
6499
+ async logEvent(params, inputHandler, options) {
6500
+ return this.executeTaskUnprojected("log_event", params, inputHandler, options);
6501
+ }
6502
+ /** Revise draft proposals, finalize them into committed, inventory-held snapshots, or extend a committed hold. */
6503
+ async refineProposals(params, inputHandler, options) {
6504
+ return this.executeTask("refine_proposals", params, inputHandler, options);
6505
+ }
6506
+ /** Execute the AdCP report_plan_adjustment tool. */
6507
+ async reportPlanAdjustment(params, inputHandler, options) {
6508
+ return this.executeTaskUnprojected(
6509
+ "report_plan_adjustment",
6510
+ params,
6511
+ inputHandler,
6512
+ options
6513
+ );
6514
+ }
6515
+ /** Execute the AdCP report_plan_outcome tool. */
6516
+ async reportPlanOutcome(params, inputHandler, options) {
6517
+ return this.executeTaskUnprojected(
6518
+ "report_plan_outcome",
6519
+ params,
6520
+ inputHandler,
6521
+ options
6522
+ );
6523
+ }
6524
+ /** Report vendor-service consumption and final measurements for revenue tracking and billing reconciliation. */
6525
+ async reportUsage(params, inputHandler, options) {
6526
+ return this.executeTaskUnprojected("report_usage", params, inputHandler, options);
6527
+ }
6528
+ /** Ask a seller to create one or more draft media-plan proposals from a campaign brief. */
6529
+ async requestProposals(params, inputHandler, options) {
6530
+ return this.executeTask("request_proposals", params, inputHandler, options);
6531
+ }
6532
+ /** Execute the AdCP search_brands tool. */
6533
+ async searchBrands(params, inputHandler, options) {
6534
+ return this.executeTaskUnprojected("search_brands", params, inputHandler, options);
6535
+ }
6536
+ /** Register, replace, pause, or clear caller-scoped webhooks for agent-level notifications. */
6537
+ async syncAgentNotificationConfigs(params, inputHandler, options) {
6538
+ return this.executeTaskUnprojected(
6539
+ "sync_agent_notification_configs",
6540
+ params,
6541
+ inputHandler,
6542
+ options
6543
+ );
6544
+ }
6545
+ /** List or synchronize buyer-managed account catalog feeds, suppress or restore specific items, and read current availability state. */
6546
+ async syncCatalogs(params, inputHandler, options) {
6547
+ return this.executeTaskUnprojected("sync_catalogs", params, inputHandler, options);
6548
+ }
6549
+ /** List or synchronize account event sources with upsert and optional replacement semantics. */
6550
+ async syncEventSources(params, inputHandler, options) {
6551
+ return this.executeTaskUnprojected(
6552
+ "sync_event_sources",
6553
+ params,
6554
+ inputHandler,
6555
+ options
6556
+ );
6557
+ }
6558
+ /** Bind or replace the governance agent used for approval across specific advertiser accounts. */
6559
+ async syncGovernance(params, inputHandler, options) {
6560
+ return this.executeTaskUnprojected(
6561
+ "sync_governance",
6562
+ params,
6563
+ inputHandler,
6564
+ options
6565
+ );
6566
+ }
6567
+ /** Record a consumer's independently verified reporting totals and destination evidence in the seller ledger. */
6568
+ async syncReportingReceipts(params, inputHandler, options) {
6569
+ return this.executeTaskUnprojected(
6570
+ "sync_reporting_receipts",
6571
+ params,
6572
+ inputHandler,
6573
+ options
6574
+ );
6575
+ }
6576
+ /** Tell a seller whether expected reporting was received, omitted, missing, unreadable, or contradictory. */
6577
+ async syncReportingStatus(params, inputHandler, options) {
6578
+ return this.executeTaskUnprojected(
6579
+ "sync_reporting_status",
6580
+ params,
6581
+ inputHandler,
6582
+ options
6583
+ );
6584
+ }
6585
+ /** Execute the AdCP update_collection_list tool. */
6586
+ async updateCollectionList(params, inputHandler, options) {
6587
+ return this.executeTaskUnprojected(
6588
+ "update_collection_list",
6589
+ params,
6590
+ inputHandler,
6591
+ options
6592
+ );
6593
+ }
6594
+ /** Execute the AdCP update_content_standards tool. */
6595
+ async updateContentStandards(params, inputHandler, options) {
6596
+ return this.executeTaskUnprojected(
6597
+ "update_content_standards",
6598
+ params,
6599
+ inputHandler,
6600
+ options
6601
+ );
6602
+ }
6603
+ /** Execute the AdCP update_rights tool. */
6604
+ async updateRights(params, inputHandler, options) {
6605
+ return this.executeTaskUnprojected("update_rights", params, inputHandler, options);
6606
+ }
6607
+ /** Execute the AdCP validate_content_delivery tool. */
6608
+ async validateContentDelivery(params, inputHandler, options) {
6609
+ return this.executeTaskUnprojected(
6610
+ "validate_content_delivery",
6611
+ params,
6612
+ inputHandler,
6613
+ options
6614
+ );
6615
+ }
6616
+ /** Preflight a creative manifest against canonical formats, products, third-party formats, or agent capabilities. */
6617
+ async validateInput(params, inputHandler, options) {
6618
+ return this.executeTaskUnprojected(
6619
+ "validate_input",
6620
+ params,
6621
+ inputHandler,
6622
+ options
6623
+ );
6624
+ }
6625
+ /** Execute the AdCP validate_property_delivery tool. */
6626
+ async validatePropertyDelivery(params, inputHandler, options) {
6627
+ return this.executeTaskUnprojected(
6628
+ "validate_property_delivery",
6629
+ params,
6630
+ inputHandler,
6631
+ options
6632
+ );
6633
+ }
6634
+ /** Execute the AdCP verify_brand_claim tool. */
6635
+ async verifyBrandClaim(params, inputHandler, options) {
6636
+ return this.executeTaskUnprojected(
6637
+ "verify_brand_claim",
6638
+ params,
6639
+ inputHandler,
6640
+ options
6641
+ );
6642
+ }
6643
+ /** Execute the AdCP verify_brand_claims tool. */
6644
+ async verifyBrandClaims(params, inputHandler, options) {
6645
+ return this.executeTaskUnprojected(
6646
+ "verify_brand_claims",
6647
+ params,
6648
+ inputHandler,
6649
+ options
6650
+ );
6651
+ }
6172
6652
  // ====== PROTOCOL TASKS ======
6173
6653
  /**
6174
6654
  * Get AdCP capabilities
@@ -6704,6 +7184,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6704
7184
  return this.getMediaBuyDelivery(params, inputHandler, options);
6705
7185
  case "get_creative_delivery":
6706
7186
  return this.getCreativeDelivery(params, inputHandler, options);
7187
+ case "preview_creative":
7188
+ return this.previewCreative(params, inputHandler, options);
7189
+ case "sync_plans":
7190
+ return this.syncPlans(params, inputHandler, options);
7191
+ case "get_plan_audit_logs":
7192
+ return this.getPlanAuditLogs(params, inputHandler, options);
6707
7193
  case "get_principal":
6708
7194
  return this.getPrincipal(params, inputHandler, options);
6709
7195
  case "sync_principal":
@@ -6782,6 +7268,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6782
7268
  const serverVersion = await this.detectServerVersion(detectionOptions);
6783
7269
  detectedServerVersion = serverVersion;
6784
7270
  detectedServerVersionSynthetic = capabilityDiscoveryContext.capabilities?._synthetic;
7271
+ if ((taskName === "sync_plans" || taskName === "get_plan_audit_logs") && capabilityDiscoveryContext.capabilities?.discoveredTools?.includes(taskName) !== true && capabilityDiscoveryContext.toolSchemas?.has(taskName) !== true) {
7272
+ throw new ConfigurationError(
7273
+ `No governance agent configured and this agent does not advertise ${taskName}. Pass options.agent or configure governance.campaign.agent.`
7274
+ );
7275
+ }
6785
7276
  const negotiatedRelease = this.negotiateCallRelease(capabilityDiscoveryContext.capabilities, options);
6786
7277
  this.assertToolAvailableAtRelease(taskName, negotiatedRelease, capabilityDiscoveryContext.toolSchemas);
6787
7278
  this.assertRequestSupportedByTargetVersion(
@@ -7155,21 +7646,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7155
7646
  });
7156
7647
  });
7157
7648
  }
7158
- // ====== TASK MANAGEMENT & NOTIFICATIONS ======
7159
- /**
7160
- * List all tasks for this agent with detailed information
7161
- *
7162
- * @returns Promise resolving to array of task information
7163
- *
7164
- * @example
7165
- * ```typescript
7166
- * const tasks = await client.listTasks();
7167
- * tasks.forEach(task => {
7168
- * console.log(`${task.taskName}: ${task.status}`);
7169
- * });
7170
- * ```
7171
- */
7172
- async listTasks() {
7649
+ async listTasks(params, inputHandler, options) {
7650
+ if (params !== void 0) {
7651
+ return this.executeTaskUnprojected("list_tasks", params, inputHandler, options);
7652
+ }
7173
7653
  const tasks = await this.executor.getTaskList(this.agent.id);
7174
7654
  return tasks.map(
7175
7655
  (task) => assertNativeRequestProposalsTask(