@adcp/sdk 17.0.0-beta.0 → 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 (277) 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/3.1/bidding.js +1 -1
  10. package/dist/lib/adapters/version/3.1/bidding.mjs +1 -1
  11. package/dist/lib/adapters/version/types.d.mts +5 -0
  12. package/dist/lib/adapters/version/types.d.ts +5 -0
  13. package/dist/lib/canonical-references/index.js +2 -0
  14. package/dist/lib/canonical-references/index.mjs +2 -0
  15. package/dist/lib/client/account-changes.d.mts +3 -1
  16. package/dist/lib/client/account-changes.d.ts +3 -1
  17. package/dist/lib/client/account-changes.js +22 -2
  18. package/dist/lib/client/account-changes.mjs +22 -2
  19. package/dist/lib/conformance/oracle.js +3 -2
  20. package/dist/lib/conformance/oracle.mjs +3 -2
  21. package/dist/lib/core/AgentClient.d.mts +165 -1
  22. package/dist/lib/core/AgentClient.d.ts +165 -1
  23. package/dist/lib/core/AgentClient.js +446 -8
  24. package/dist/lib/core/AgentClient.mjs +446 -8
  25. package/dist/lib/core/ConversationTypes.d.mts +8 -0
  26. package/dist/lib/core/ConversationTypes.d.ts +8 -0
  27. package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
  28. package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
  29. package/dist/lib/core/ProtocolResponseParser.js +28 -18
  30. package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
  31. package/dist/lib/core/ResponseValidator.js +1 -1
  32. package/dist/lib/core/ResponseValidator.mjs +1 -1
  33. package/dist/lib/core/SingleAgentClient.d.mts +122 -7
  34. package/dist/lib/core/SingleAgentClient.d.ts +122 -7
  35. package/dist/lib/core/SingleAgentClient.js +601 -96
  36. package/dist/lib/core/SingleAgentClient.mjs +590 -84
  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 +23 -8
  40. package/dist/lib/core/TaskExecutor.mjs +23 -8
  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/errors/index.d.mts +22 -0
  46. package/dist/lib/errors/index.d.ts +22 -0
  47. package/dist/lib/errors/index.js +43 -0
  48. package/dist/lib/errors/index.mjs +42 -0
  49. package/dist/lib/identity-3.3/trust.d.mts +1 -4
  50. package/dist/lib/identity-3.3/trust.d.ts +1 -4
  51. package/dist/lib/identity-3.3/trust.js +34 -21
  52. package/dist/lib/identity-3.3/trust.mjs +34 -21
  53. package/dist/lib/identity-3.3/validation.js +5 -3
  54. package/dist/lib/identity-3.3/validation.mjs +6 -4
  55. package/dist/lib/index.d.mts +7 -53
  56. package/dist/lib/index.d.ts +7 -53
  57. package/dist/lib/index.js +13 -0
  58. package/dist/lib/index.mjs +9 -0
  59. package/dist/lib/media-buy/compatibility.js +6 -1
  60. package/dist/lib/media-buy/compatibility.mjs +6 -1
  61. package/dist/lib/protocols/mcp-modern.d.mts +2 -0
  62. package/dist/lib/protocols/mcp-modern.d.ts +2 -0
  63. package/dist/lib/protocols/mcp-modern.js +31 -5
  64. package/dist/lib/protocols/mcp-modern.mjs +31 -5
  65. package/dist/lib/protocols/mcp-scope.d.mts +6 -1
  66. package/dist/lib/protocols/mcp-scope.d.ts +6 -1
  67. package/dist/lib/protocols/mcp-scope.js +25 -3
  68. package/dist/lib/protocols/mcp-scope.mjs +24 -3
  69. package/dist/lib/protocols/mcp.js +12 -6
  70. package/dist/lib/protocols/mcp.mjs +13 -6
  71. package/dist/lib/reporting/inspection.js +1 -0
  72. package/dist/lib/reporting/inspection.mjs +1 -0
  73. package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
  74. package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
  75. package/dist/lib/reporting/ledger/coverage.js +37 -3
  76. package/dist/lib/reporting/ledger/coverage.mjs +36 -3
  77. package/dist/lib/reporting/ledger/handler.js +7 -4
  78. package/dist/lib/reporting/ledger/handler.mjs +7 -4
  79. package/dist/lib/reporting/ledger/producer.js +215 -69
  80. package/dist/lib/reporting/ledger/producer.mjs +217 -70
  81. package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
  82. package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
  83. package/dist/lib/reporting/ledger/schedule.js +8 -5
  84. package/dist/lib/reporting/ledger/schedule.mjs +8 -5
  85. package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
  86. package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
  87. package/dist/lib/reporting/ledger/status-ingest.js +4 -3
  88. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
  89. package/dist/lib/reporting/ledger/types.d.mts +36 -1
  90. package/dist/lib/reporting/ledger/types.d.ts +36 -1
  91. package/dist/lib/reporting/service/index.d.mts +14 -1
  92. package/dist/lib/reporting/service/index.d.ts +14 -1
  93. package/dist/lib/reporting/service/index.js +24 -12
  94. package/dist/lib/reporting/service/index.mjs +24 -12
  95. package/dist/lib/schemas/browser.d.mts +2 -0
  96. package/dist/lib/schemas/browser.d.ts +2 -0
  97. package/dist/lib/schemas/browser.js +3 -0
  98. package/dist/lib/schemas/browser.mjs +2 -0
  99. package/dist/lib/schemas/index.d.mts +5 -3
  100. package/dist/lib/schemas/index.d.ts +5 -3
  101. package/dist/lib/schemas/index.js +5 -0
  102. package/dist/lib/schemas/index.mjs +4 -0
  103. package/dist/lib/server/account-response-identity.d.mts +17 -0
  104. package/dist/lib/server/account-response-identity.d.ts +17 -0
  105. package/dist/lib/server/account-response-identity.js +52 -0
  106. package/dist/lib/server/account-response-identity.mjs +28 -0
  107. package/dist/lib/server/account-sync-contract.js +2 -2
  108. package/dist/lib/server/account-sync-contract.mjs +2 -2
  109. package/dist/lib/server/create-adcp-server.js +33 -20
  110. package/dist/lib/server/create-adcp-server.mjs +36 -12
  111. package/dist/lib/server/decisioning/account.d.mts +36 -10
  112. package/dist/lib/server/decisioning/account.d.ts +36 -10
  113. package/dist/lib/server/decisioning/account.js +33 -14
  114. package/dist/lib/server/decisioning/account.mjs +33 -14
  115. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
  116. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
  117. package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
  118. package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
  119. package/dist/lib/server/media-buy-store.d.mts +26 -12
  120. package/dist/lib/server/media-buy-store.d.ts +26 -12
  121. package/dist/lib/server/media-buy-store.js +69 -21
  122. package/dist/lib/server/media-buy-store.mjs +69 -21
  123. package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
  124. package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
  125. package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
  126. package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
  127. package/dist/lib/server/responses.js +9 -1
  128. package/dist/lib/server/responses.mjs +9 -1
  129. package/dist/lib/signing/agent-fetch.d.mts +1 -1
  130. package/dist/lib/signing/agent-fetch.d.ts +1 -1
  131. package/dist/lib/signing/agent-fetch.js +3 -3
  132. package/dist/lib/signing/agent-fetch.mjs +3 -3
  133. package/dist/lib/testing/client.d.mts +1 -0
  134. package/dist/lib/testing/client.d.ts +1 -0
  135. package/dist/lib/testing/client.js +6 -5
  136. package/dist/lib/testing/client.mjs +6 -5
  137. package/dist/lib/testing/storyboard/agent-routing.d.mts +5 -2
  138. package/dist/lib/testing/storyboard/agent-routing.d.ts +5 -2
  139. package/dist/lib/testing/storyboard/agent-routing.js +11 -4
  140. package/dist/lib/testing/storyboard/agent-routing.mjs +11 -4
  141. package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
  142. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
  143. package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
  144. package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
  145. package/dist/lib/testing/storyboard/compliance.js +62 -13
  146. package/dist/lib/testing/storyboard/compliance.mjs +63 -14
  147. package/dist/lib/testing/storyboard/context.d.mts +13 -3
  148. package/dist/lib/testing/storyboard/context.d.ts +13 -3
  149. package/dist/lib/testing/storyboard/context.js +15 -10
  150. package/dist/lib/testing/storyboard/context.mjs +15 -10
  151. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
  152. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
  153. package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
  154. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
  155. package/dist/lib/testing/storyboard/runner.js +141 -13
  156. package/dist/lib/testing/storyboard/runner.mjs +141 -13
  157. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  158. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  159. package/dist/lib/testing/storyboard/validations.js +4 -1
  160. package/dist/lib/testing/storyboard/validations.mjs +4 -1
  161. package/dist/lib/testing/test-controller.js +3 -0
  162. package/dist/lib/testing/test-controller.mjs +3 -0
  163. package/dist/lib/types/accept-proposal.d.ts +20 -28
  164. package/dist/lib/types/asset-instances.d.mts +1 -1
  165. package/dist/lib/types/asset-instances.d.ts +1 -1
  166. package/dist/lib/types/buy-products.d.ts +20 -28
  167. package/dist/lib/types/check-governance.d.ts +20 -28
  168. package/dist/lib/types/comply-test-controller.d.ts +20 -28
  169. package/dist/lib/types/control-media-buy.d.ts +20 -28
  170. package/dist/lib/types/core.generated.d.mts +273 -184
  171. package/dist/lib/types/core.generated.d.ts +273 -184
  172. package/dist/lib/types/create-media-buy.d.ts +20 -28
  173. package/dist/lib/types/get-media-buys.d.ts +20 -28
  174. package/dist/lib/types/get-products.d.ts +20 -28
  175. package/dist/lib/types/index.d.mts +6 -1
  176. package/dist/lib/types/index.d.ts +6 -1
  177. package/dist/lib/types/index.js +6 -1
  178. package/dist/lib/types/index.mjs +4 -1
  179. package/dist/lib/types/inline-enums.generated.d.mts +30 -4
  180. package/dist/lib/types/inline-enums.generated.d.ts +30 -4
  181. package/dist/lib/types/inline-enums.generated.js +41 -2
  182. package/dist/lib/types/inline-enums.generated.mjs +28 -2
  183. package/dist/lib/types/list-products.d.ts +20 -28
  184. package/dist/lib/types/list-proposals.d.ts +20 -28
  185. package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
  186. package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
  187. package/dist/lib/types/media-buy-delivery-report.js +16 -0
  188. package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
  189. package/dist/lib/types/refine-proposals.d.ts +20 -28
  190. package/dist/lib/types/request-proposals.d.ts +20 -28
  191. package/dist/lib/types/schemas.generated.d.ts +63113 -127273
  192. package/dist/lib/types/schemas.generated.js +759 -770
  193. package/dist/lib/types/schemas.generated.mjs +759 -770
  194. package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
  195. package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
  196. package/dist/lib/types/targeting-keys.generated.js +109 -0
  197. package/dist/lib/types/targeting-keys.generated.mjs +84 -0
  198. package/dist/lib/types/tools.generated.d.mts +2 -68
  199. package/dist/lib/types/tools.generated.d.ts +2 -68
  200. package/dist/lib/types/update-media-buy.d.ts +20 -28
  201. package/dist/lib/utils/adcp-version-config.js +5 -2
  202. package/dist/lib/utils/adcp-version-config.mjs +5 -2
  203. package/dist/lib/utils/envelope-status-compat.d.mts +18 -1
  204. package/dist/lib/utils/envelope-status-compat.d.ts +18 -1
  205. package/dist/lib/utils/envelope-status-compat.js +11 -5
  206. package/dist/lib/utils/envelope-status-compat.mjs +11 -5
  207. package/dist/lib/utils/response-unwrapper.js +18 -10
  208. package/dist/lib/utils/response-unwrapper.mjs +18 -10
  209. package/dist/lib/v2/format-schema/resolver.js +1 -1
  210. package/dist/lib/v2/format-schema/resolver.mjs +1 -1
  211. package/dist/lib/v2/projection/creative-delivery.js +159 -39
  212. package/dist/lib/v2/projection/creative-delivery.mjs +163 -39
  213. package/dist/lib/v2/projection/index.d.mts +1 -0
  214. package/dist/lib/v2/projection/index.d.ts +1 -0
  215. package/dist/lib/v2/projection/index.js +3 -0
  216. package/dist/lib/v2/projection/index.mjs +2 -0
  217. package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
  218. package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
  219. package/dist/lib/v2/projection/legacy-metadata.js +91 -0
  220. package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
  221. package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
  222. package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
  223. package/dist/lib/v2/projection/v1-to-v2.js +12 -9
  224. package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
  225. package/dist/lib/validation/budget-allocation.d.mts +3 -3
  226. package/dist/lib/validation/budget-allocation.d.ts +3 -3
  227. package/dist/lib/validation/compact-schema.d.mts +27 -0
  228. package/dist/lib/validation/compact-schema.d.ts +27 -0
  229. package/dist/lib/validation/compact-schema.js +276 -0
  230. package/dist/lib/validation/compact-schema.mjs +250 -0
  231. package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
  232. package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
  233. package/dist/lib/validation/media-buy-delivery-report.js +31 -0
  234. package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
  235. package/dist/lib/validation/nonempty-array.d.mts +15 -0
  236. package/dist/lib/validation/nonempty-array.d.ts +15 -0
  237. package/dist/lib/validation/nonempty-array.js +41 -0
  238. package/dist/lib/validation/nonempty-array.mjs +7 -0
  239. package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
  240. package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
  241. package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
  242. package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
  243. package/dist/lib/validation/schema-loader.js +86 -16
  244. package/dist/lib/validation/schema-loader.mjs +82 -16
  245. package/dist/lib/validation/schema-validator.d.mts +10 -19
  246. package/dist/lib/validation/schema-validator.d.ts +10 -19
  247. package/dist/lib/validation/schema-validator.js +136 -43
  248. package/dist/lib/validation/schema-validator.mjs +140 -44
  249. package/dist/lib/validation/sync-creatives.d.mts +22 -22
  250. package/dist/lib/validation/sync-creatives.d.ts +22 -22
  251. package/dist/lib/version.d.mts +3 -3
  252. package/dist/lib/version.d.ts +3 -3
  253. package/dist/lib/version.js +3 -3
  254. package/dist/lib/version.mjs +3 -3
  255. package/dist/lib/webhooks/index.d.mts +3 -0
  256. package/dist/lib/webhooks/index.d.ts +3 -0
  257. package/dist/lib/webhooks/index.js +3 -0
  258. package/dist/lib/webhooks/index.mjs +2 -0
  259. package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
  260. package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
  261. package/dist/lib/webhooks/media-buy-delivery.js +119 -0
  262. package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
  263. package/docs/TYPE-SUMMARY.md +2 -2
  264. package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +11 -0
  265. package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
  266. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +27 -1
  267. package/docs/guides/REPORTING-LEDGER.md +93 -0
  268. package/docs/guides/REPORTING-STABILITY.md +1 -1
  269. package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
  270. package/docs/llms.txt +2 -2
  271. package/docs/migration-14.x-rc-worksheet.md +4 -4
  272. package/docs/migration-16-to-17.md +202 -2
  273. package/docs/migration-6.6-to-6.7.md +14 -0
  274. package/docs/migration-account-change-feed.md +15 -0
  275. package/docs/migration-reporting-storage-package.md +1 -1
  276. package/docs/recipes/verifying-inbound-webhooks.md +18 -2
  277. package/package.json +2 -2
@@ -35,6 +35,7 @@ __export(SingleAgentClient_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(SingleAgentClient_exports);
37
37
  var import_mcp_connection_policy = require('../protocols/mcp-connection-policy.js');
38
+ var import_mcp_scope = require('../protocols/mcp-scope.js');
38
39
  var import_protocol_methods = require('../signing/protocol-methods.js');
39
40
  var import_pricing_adapter = require('../utils/pricing-adapter.js');
40
41
  var import_creative_adapter = require('../utils/creative-adapter.js');
@@ -83,6 +84,7 @@ var import_errors3 = require('../errors/index.js');
83
84
  var import_buyer_account_registry = require('./buyer-account-registry.js');
84
85
  var import_account_resolution = require('./account-resolution.js');
85
86
  var import_request_normalizer = require('../utils/request-normalizer.js');
87
+ var import_legacy_metadata = require('../v2/projection/legacy-metadata.js');
86
88
  var import_global_async_local_storage = require('../utils/global-async-local-storage.js');
87
89
  var import_validate_user_agent = require('../utils/validate-user-agent.js');
88
90
  var import_webhook_url = require('./webhook-url.js');
@@ -92,7 +94,7 @@ var import_creative_delivery = require('../v2/projection/creative-delivery.js');
92
94
  var import_legacy_routes = require('../v2/projection/legacy-routes.js');
93
95
  var import_catalog_snapshot = require('../v2/projection/catalog-snapshot.js');
94
96
  var import_augment_response = require('../v2/projection/augment-response.js');
95
- var import_legacy_metadata = require('../v2/projection/legacy-metadata.js');
97
+ var import_legacy_metadata2 = require('../v2/projection/legacy-metadata.js');
96
98
  var import_types = require('../v2/projection/types.js');
97
99
  var import_jcs = require('../utils/jcs.js');
98
100
  function loadWebBotAuth() {
@@ -100,6 +102,16 @@ function loadWebBotAuth() {
100
102
  }
101
103
  const SKIP_PRODUCT_CACHE = /* @__PURE__ */ Symbol("adcp.skipProductCache");
102
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
+ }
103
115
  function presentedStaticTransportCredential(authToken, headers, authProvider) {
104
116
  if (authProvider) return false;
105
117
  if (authToken) return true;
@@ -630,10 +642,7 @@ const STANDARD_ADCP_TASK_NAMES = /* @__PURE__ */ new Set([
630
642
  "list_transformers",
631
643
  "preview_creative",
632
644
  "build_creative",
633
- // These standard protocol tools still carry legacy creative `format_id`
634
- // identity through artifacts, manifests, standards, or rights constraints.
635
- // They are available only through explicitly named *Legacy APIs until a
636
- // lossless canonical projection exists.
645
+ // Wire-level creative and content tools also have typed primary methods.
637
646
  "list_content_standards",
638
647
  "get_content_standards",
639
648
  "create_content_standards",
@@ -917,7 +926,19 @@ class SingleAgentClient {
917
926
  adcpVersion: this.resolvedAdcpVersion,
918
927
  ...config.wireAdcpVersion !== void 0 && { wireAdcpVersion: config.wireAdcpVersion },
919
928
  ...config.versionEnvelope !== void 0 && { versionEnvelope: config.versionEnvelope },
920
- 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
+ }
921
942
  });
922
943
  if (config.handlers) {
923
944
  this.asyncHandler = new import_AsyncHandler.AsyncHandler(config.handlers);
@@ -1465,18 +1486,18 @@ class SingleAgentClient {
1465
1486
  publisher_domain: option.publisher_domain,
1466
1487
  format_option_id: option.format_option_id
1467
1488
  } : { scope: "product", format_option_id: option.format_option_id };
1468
- const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
1469
- const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
1470
- 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);
1471
1492
  if (declared === true && evidence)
1472
- (0, import_legacy_metadata.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
1493
+ (0, import_legacy_metadata2.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
1473
1494
  this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
1474
1495
  kind: "product",
1475
1496
  accountScope,
1476
1497
  productId: product.product_id,
1477
1498
  optionRef: ref,
1478
1499
  refs,
1479
- ...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) } : {},
1480
1501
  ...declared === false ? { undeclaredSelector: (0, import_legacy_routes.undeclaredFormatOptionSelector)(option) } : {}
1481
1502
  });
1482
1503
  }
@@ -1725,8 +1746,18 @@ class SingleAgentClient {
1725
1746
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(snapshot) : await this.ensureEndpointDiscovered(snapshot);
1726
1747
  return this.executor.trackTask(agent, snapshot);
1727
1748
  }
1728
- /** Poll through the same discovered/canonical protocol endpoint used for dispatch. @internal */
1729
- 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;
1730
1761
  const transportSnapshot = transport === void 0 ? void 0 : { ...transport };
1731
1762
  const options = { transport: transportSnapshot, signal };
1732
1763
  const agent = this.normalizedAgent.protocol === "a2a" ? await this.ensureCanonicalUrlResolved(options) : await this.ensureEndpointDiscovered(options);
@@ -2199,6 +2230,9 @@ class SingleAgentClient {
2199
2230
  * - A validated MCP protected-resource metadata chain yields NeedsAuthorizationError
2200
2231
  * - Otherwise AuthenticationRequiredError carries the advertised challenge
2201
2232
  *
2233
+ * Rate limiting (429, or 503 with Retry-After) stops probing at that URL and
2234
+ * throws AgentRateLimitedError carrying the status and Retry-After.
2235
+ *
2202
2236
  * Note: This is async and called lazily on first agent interaction
2203
2237
  */
2204
2238
  async discoverMCPEndpoint(providedUri, options) {
@@ -2209,8 +2243,8 @@ class SingleAgentClient {
2209
2243
  }
2210
2244
  async discoverMCPEndpointWithConnectionPolicy(providedUri, options) {
2211
2245
  (0, import_abort2.throwIfAborted)(options?.signal);
2212
- const { connectMCPWithFallback } = await import("../protocols/mcp.js");
2213
- const { probeModernMCPConnection } = await import("../protocols/mcp-modern.js");
2246
+ const { connectMCPWithFallback, withScopedLegacyConnection } = await import("../protocols/mcp.js");
2247
+ const { probeModernMCPConnection, retryAfterOf } = await import("../protocols/mcp-modern.js");
2214
2248
  const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
2215
2249
  const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
2216
2250
  const endpointEpoch = this.discoveryEpochSnapshot(options);
@@ -2240,19 +2274,35 @@ class SingleAgentClient {
2240
2274
  }
2241
2275
  return { success: true };
2242
2276
  }
2243
- const client = await connectMCPWithFallback(
2244
- new URL(url),
2245
- authHeaders,
2246
- [],
2247
- "endpoint discovery",
2248
- transport?.trustedFetchFn,
2277
+ const shared = await withScopedLegacyConnection(
2249
2278
  {
2279
+ agentUrl: url,
2280
+ authToken,
2281
+ customHeaders: agentHeaders,
2282
+ authProvider,
2250
2283
  signal: options?.signal,
2251
2284
  requestTimeoutMs: transport?.requestTimeoutMs,
2285
+ fetchFn: transport?.trustedFetchFn,
2252
2286
  allowPrivateIp: transport?.allowPrivateIp
2253
- }
2287
+ },
2288
+ "endpoint discovery",
2289
+ async () => void 0
2254
2290
  );
2255
- await client.close();
2291
+ if (!shared) {
2292
+ const client = await connectMCPWithFallback(
2293
+ new URL(url),
2294
+ authHeaders,
2295
+ [],
2296
+ "endpoint discovery",
2297
+ transport?.trustedFetchFn,
2298
+ {
2299
+ signal: options?.signal,
2300
+ requestTimeoutMs: transport?.requestTimeoutMs,
2301
+ allowPrivateIp: transport?.allowPrivateIp
2302
+ }
2303
+ );
2304
+ await client.close();
2305
+ }
2256
2306
  if (mayRetain()) {
2257
2307
  this.discoveredMcpEra = "legacy";
2258
2308
  this.discoveredMcpEraAt = Date.now();
@@ -2269,7 +2319,8 @@ class SingleAgentClient {
2269
2319
  }
2270
2320
  const errObj = error;
2271
2321
  const status = errObj?.status || errObj?.response?.status || errObj?.cause?.status;
2272
- return { success: false, status, error };
2322
+ const retryAfter = retryAfterOf(error);
2323
+ return { success: false, status, ...retryAfter !== void 0 && { retryAfter }, error };
2273
2324
  }
2274
2325
  };
2275
2326
  const urlsToTry = [];
@@ -2292,6 +2343,9 @@ class SingleAgentClient {
2292
2343
  firstWorkingUrl = url;
2293
2344
  break;
2294
2345
  }
2346
+ if (result.status === 429 || result.status === 503 && result.retryAfter !== void 0) {
2347
+ throw new import_errors.AgentRateLimitedError(url, result.status, result.retryAfter, result.error);
2348
+ }
2295
2349
  if (result.status === 401) {
2296
2350
  got401 = true;
2297
2351
  first401Error ??= result.error;
@@ -2568,6 +2622,33 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2568
2622
  };
2569
2623
  }
2570
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
+ }
2571
2652
  if (registration?.mode === "rfc9421") {
2572
2653
  const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError, WebBotAuthUnavailableError } = loadWebBotAuth();
2573
2654
  const requestMethod = options.requestMethod;
@@ -2737,21 +2818,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2737
2818
  return parsedPayload;
2738
2819
  }
2739
2820
  if (registration?.deliveryKind) {
2740
- const loader = require('../validation/schema-loader.js');
2741
- const body = parsedPayload.payload;
2821
+ let body = parsedPayload.payload;
2742
2822
  const isReport = registration.deliveryKind === "reporting";
2743
- const payload = isReport ? body.result : body;
2744
- const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
2745
- const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
2746
- const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
2747
- if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
2748
- return {
2749
- ok: false,
2750
- code: "webhook_envelope_invalid",
2751
- message: "Authenticated delivery does not match its registered payload kind"
2752
- };
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
+ }
2753
2858
  const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
2754
- const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
2859
+ const operationId = registration.operationId;
2755
2860
  const status = isReport && (0, import_task_status.isAdcpStatus)(body.status) ? body.status : "completed";
2756
2861
  return {
2757
2862
  ok: true,
@@ -3504,17 +3609,32 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3504
3609
  timestamp
3505
3610
  }).ok;
3506
3611
  }
3507
- /**
3508
- * Execute task and call appropriate handler on completion
3509
- *
3510
- * Adapts requests for maintained AdCP 3 releases and normalizes product responses.
3511
- */
3612
+ /** One task owns discovery and dispatch sessions unless the caller already owns reuse. */
3613
+ withConnectionScope(options, run, preserveSessionOnResult) {
3614
+ const transport = (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport);
3615
+ return (0, import_mcp_connection_policy.withMCPConnectionPolicy)(
3616
+ transport,
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
+ })
3622
+ );
3623
+ }
3624
+ withTaskConnectionScope(options, run) {
3625
+ return (0, import_task_deadline.withTaskDeadline)(
3626
+ options,
3627
+ (effective) => this.withConnectionScope(effective, () => run(effective), isNonterminalTaskResult)
3628
+ );
3629
+ }
3630
+ /** Execute a task, adapt maintained AdCP 3 releases, and call the completion handler. */
3512
3631
  async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3632
+ const projectionDrifts = (0, import_legacy_metadata.getCreativeDeliveryDiagnostics)(params);
3513
3633
  const requestParamsSnapshot = structuredClone(params);
3514
3634
  const canonicalRequestSnapshot = canonicalRequest === void 0 ? void 0 : structuredClone(canonicalRequest);
3515
3635
  const deferredProjectionCatalogs = projectionCatalogs ? structuredClone(projectionCatalogs) : void 0;
3516
3636
  const taskOptionsSnapshot = snapshotTaskOptions(options);
3517
- return (0, import_task_deadline.withTaskDeadline)(
3637
+ return this.withTaskConnectionScope(
3518
3638
  taskOptionsSnapshot,
3519
3639
  (effectiveOptions) => this.executeAndHandleWithinDeadline(
3520
3640
  taskType,
@@ -3525,11 +3645,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3525
3645
  transformCompletedResponse,
3526
3646
  legacyFormatConverter,
3527
3647
  canonicalRequestSnapshot,
3528
- deferredProjectionCatalogs
3648
+ deferredProjectionCatalogs,
3649
+ projectionDrifts
3529
3650
  )
3530
3651
  );
3531
3652
  }
3532
- async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
3653
+ async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs, projectionDrifts = []) {
3533
3654
  (0, import_abort2.throwIfAborted)(options?.signal);
3534
3655
  const canonicalCreativeInvocation = CANONICAL_CREATIVE_ACTIVITY_TASKS.has(taskType) || canonicalRequest !== void 0;
3535
3656
  params = await this.applyAccountPolicy(taskType, params, options);
@@ -3605,7 +3726,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3605
3726
  if (negotiatedRelease?.downgraded && !options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation) {
3606
3727
  this.executor.validateRequest(taskType, adaptedParams, inputSchemaStripLogs, negotiatedRelease.version);
3607
3728
  }
3608
- 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
+ ];
3609
3738
  if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
3610
3739
  const canonicalInputHandler = this.canonicalCreativeInputHandler(
3611
3740
  taskType,
@@ -4727,8 +4856,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4727
4856
  * stamps it on the version envelope and validates the response against it.
4728
4857
  */
4729
4858
  withNegotiatedRelease(options, negotiated) {
4730
- if (!negotiated?.downgraded) return options;
4731
- 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
+ };
4732
4868
  }
4733
4869
  /**
4734
4870
  * Refuse a tool the negotiated release does not define (a 3.2-only task
@@ -4997,8 +5133,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4997
5133
  const adapterKey = (0, import_version2.resolveAdapterKey)(this.resolvedAdcpVersion, perCallCapabilities ?? this.cachedCapabilities);
4998
5134
  if (adapterKey) {
4999
5135
  const versionAdapter = (0, import_version2.getVersionAdapter)(adapterKey, taskType);
5000
- if (versionAdapter?.adaptRequest) {
5001
- const result = versionAdapter.adaptRequest(adapted);
5136
+ const adaptRequest = negotiated ? versionAdapter?.adaptRequest : versionAdapter?.adaptUnnegotiatedRequest ?? versionAdapter?.adaptRequest;
5137
+ if (adaptRequest) {
5138
+ const result = adaptRequest(adapted);
5002
5139
  adapted = result.params;
5003
5140
  if (result.drift) {
5004
5141
  driftLogs.push({
@@ -5060,7 +5197,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5060
5197
  legacyFormatConverter,
5061
5198
  projectionCatalogs ?? this.config.projectionCatalogs
5062
5199
  );
5063
- return (0, import_task_deadline.withTaskDeadline)(snapshotTaskOptions(taskOptions), async (effectiveOptions) => {
5200
+ return this.withTaskConnectionScope(snapshotTaskOptions(taskOptions), async (effectiveOptions) => {
5064
5201
  this.assertRequestSupportedByConfiguredVersion("get_products", params, effectiveOptions);
5065
5202
  let request = await this.applyAccountPolicy("get_products", params, effectiveOptions);
5066
5203
  const legacyAccountId = request.account_id;
@@ -5263,13 +5400,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5263
5400
  async createMediaBuy(params, inputHandler, options) {
5264
5401
  assertRawMethodForGovernedPayload("create_media_buy", options);
5265
5402
  this.assertDurableProjectionOverrideSupported(options?.legacyFormatConverter);
5266
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5403
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5267
5404
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5268
5405
  const snapshottedOptions = {
5269
5406
  ...snapshotTaskOptions(options),
5270
5407
  ...projectionCatalogs !== void 0 && { projectionCatalogs }
5271
5408
  };
5272
- return (0, import_task_deadline.withTaskDeadline)(
5409
+ return this.withTaskConnectionScope(
5273
5410
  snapshottedOptions,
5274
5411
  (effectiveOptions) => this.createMediaBuyWithinDeadline(requestSnapshot, inputHandler, effectiveOptions)
5275
5412
  );
@@ -5422,13 +5559,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5422
5559
  async updateMediaBuy(params, inputHandler, options) {
5423
5560
  assertRawMethodForGovernedPayload("update_media_buy", options);
5424
5561
  this.assertDurableProjectionOverrideSupported(options?.legacyFormatConverter);
5425
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5562
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5426
5563
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5427
5564
  const snapshottedOptions = {
5428
5565
  ...snapshotTaskOptions(options),
5429
5566
  ...projectionCatalogs !== void 0 && { projectionCatalogs }
5430
5567
  };
5431
- return (0, import_task_deadline.withTaskDeadline)(
5568
+ return this.withTaskConnectionScope(
5432
5569
  snapshottedOptions,
5433
5570
  (effectiveOptions) => this.updateMediaBuyWithinDeadline(requestSnapshot, inputHandler, effectiveOptions)
5434
5571
  );
@@ -5504,12 +5641,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5504
5641
  this.assertDurableProjectionOverrideSupported(
5505
5642
  options?.creativeFormatProjection?.legacyFormatConverter ?? options?.legacyFormatConverter
5506
5643
  );
5507
- const requestSnapshot = (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(params);
5644
+ const requestSnapshot = (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(params);
5508
5645
  const projectionCatalogs = options?.projectionCatalogs ? structuredClone(options.projectionCatalogs) : void 0;
5509
5646
  const creativeFormatProjection = options?.creativeFormatProjection ? {
5510
5647
  ...options.creativeFormatProjection,
5511
5648
  ...options.creativeFormatProjection.selectorContainers !== void 0 && {
5512
- selectorContainers: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(
5649
+ selectorContainers: (0, import_legacy_metadata2.structuredCloneWithLegacyCreativeMetadata)(
5513
5650
  options.creativeFormatProjection.selectorContainers
5514
5651
  )
5515
5652
  }
@@ -5519,7 +5656,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5519
5656
  ...projectionCatalogs !== void 0 && { projectionCatalogs },
5520
5657
  ...creativeFormatProjection !== void 0 && { creativeFormatProjection }
5521
5658
  };
5522
- return (0, import_task_deadline.withTaskDeadline)(
5659
+ return this.withTaskConnectionScope(
5523
5660
  snapshottedOptions,
5524
5661
  (effectiveOptions) => this.syncCreativesWithinDeadline(requestSnapshot, inputHandler, effectiveOptions)
5525
5662
  );
@@ -5677,10 +5814,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5677
5814
  const creativeRef = isPlainRecord(creative) ? optionRef(creative.format_option_ref) : void 0;
5678
5815
  if (isPlainRecord(creative) && creative.format_option_ref !== void 0 && !creativeRef) return false;
5679
5816
  const isSellerDeclaration = (value) => {
5680
- 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)) {
5681
5818
  return false;
5682
5819
  }
5683
- const evidence2 = (0, import_legacy_metadata.sellerFormatEvidence)(value);
5820
+ const evidence2 = (0, import_legacy_metadata2.sellerFormatEvidence)(value);
5684
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")
5685
5822
  return false;
5686
5823
  const ref = optionRef(value);
@@ -5694,7 +5831,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5694
5831
  };
5695
5832
  const declarations = [
5696
5833
  ...(Array.isArray(container.format_options) ? container.format_options : []).filter(isSellerDeclaration),
5697
- ...(0, import_legacy_metadata.selectedFormatOptions)(container).filter(isSellerDeclaration)
5834
+ ...(0, import_legacy_metadata2.selectedFormatOptions)(container).filter(isSellerDeclaration)
5698
5835
  ];
5699
5836
  if (typeof container.product_id === "string") {
5700
5837
  for (const ref of [...refs, ...creativeRef ? [creativeRef] : []]) {
@@ -5971,25 +6108,31 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5971
6108
  * Pass an explicit agent via options.agent to override.
5972
6109
  */
5973
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
+ }
5974
6114
  const agent = options?.agent ?? this.getGovernanceAgent();
5975
6115
  this.executor.validateRequest("sync_plans", params);
5976
6116
  return this.executor.executeTask(agent, "sync_plans", params, inputHandler, options);
5977
6117
  }
5978
- /**
5979
- * Get governance audit logs for one or more plans.
5980
- * Returns budget state, channel allocation, per-campaign breakdown, and audit trail.
5981
- *
5982
- * Uses the governance agent from config.governance.campaign.agent by default.
5983
- * Pass an explicit agent via options.agent to override.
5984
- */
5985
- 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
+ }
5986
6129
  const agent = options?.agent ?? this.getGovernanceAgent();
5987
6130
  this.executor.validateRequest("get_plan_audit_logs", params);
5988
6131
  return this.executor.executeTask(
5989
6132
  agent,
5990
6133
  "get_plan_audit_logs",
5991
6134
  params,
5992
- void 0,
6135
+ inputHandler,
5993
6136
  options
5994
6137
  );
5995
6138
  }
@@ -6027,6 +6170,374 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6027
6170
  }
6028
6171
  return agent;
6029
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
+ }
6030
6541
  // ====== PROTOCOL TASKS ======
6031
6542
  /**
6032
6543
  * Get AdCP capabilities
@@ -6036,7 +6547,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6036
6547
  * @param options - Task execution options
6037
6548
  */
6038
6549
  async getAdcpCapabilities(params, inputHandler, options) {
6039
- return (0, import_task_deadline.withTaskDeadline)(
6550
+ return this.withTaskConnectionScope(
6040
6551
  snapshotTaskOptions(options),
6041
6552
  (effectiveOptions) => this.getAdcpCapabilitiesWithinDeadline(params, inputHandler, effectiveOptions)
6042
6553
  );
@@ -6118,7 +6629,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6118
6629
  );
6119
6630
  }
6120
6631
  async resolveAccount(hints = {}, options, onTaskResult) {
6121
- return (0, import_task_deadline.withTaskDeadline)(snapshotTaskOptions(options), async (effectiveOptions) => {
6632
+ return this.withTaskConnectionScope(snapshotTaskOptions(options), async (effectiveOptions) => {
6122
6633
  const capabilities = await this.getCapabilities(effectiveOptions);
6123
6634
  if (capabilities._synthetic || !capabilities.account) {
6124
6635
  throw new import_errors3.AccountRequiredError(
@@ -6562,6 +7073,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6562
7073
  return this.getMediaBuyDelivery(params, inputHandler, options);
6563
7074
  case "get_creative_delivery":
6564
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);
6565
7082
  case "get_principal":
6566
7083
  return this.getPrincipal(params, inputHandler, options);
6567
7084
  case "sync_principal":
@@ -6598,7 +7115,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6598
7115
  async executeTaskUnprojected(taskName, params, inputHandler, options, handlerName, beforeDispatch) {
6599
7116
  const requestParamsSnapshot = structuredClone(params);
6600
7117
  const taskOptionsSnapshot = snapshotTaskOptions(options);
6601
- return (0, import_task_deadline.withTaskDeadline)(taskOptionsSnapshot, async (effectiveOptions) => {
7118
+ return this.withTaskConnectionScope(taskOptionsSnapshot, async (effectiveOptions) => {
6602
7119
  const result = await this.executeTaskUnprojectedWithinDeadline(
6603
7120
  taskName,
6604
7121
  requestParamsSnapshot,
@@ -6640,6 +7157,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
6640
7157
  const serverVersion = await this.detectServerVersion(detectionOptions);
6641
7158
  detectedServerVersion = serverVersion;
6642
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
+ }
6643
7165
  const negotiatedRelease = this.negotiateCallRelease(capabilityDiscoveryContext.capabilities, options);
6644
7166
  this.assertToolAvailableAtRelease(taskName, negotiatedRelease, capabilityDiscoveryContext.toolSchemas);
6645
7167
  this.assertRequestSupportedByTargetVersion(
@@ -7013,21 +7535,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7013
7535
  });
7014
7536
  });
7015
7537
  }
7016
- // ====== TASK MANAGEMENT & NOTIFICATIONS ======
7017
- /**
7018
- * List all tasks for this agent with detailed information
7019
- *
7020
- * @returns Promise resolving to array of task information
7021
- *
7022
- * @example
7023
- * ```typescript
7024
- * const tasks = await client.listTasks();
7025
- * tasks.forEach(task => {
7026
- * console.log(`${task.taskName}: ${task.status}`);
7027
- * });
7028
- * ```
7029
- */
7030
- async listTasks() {
7538
+ async listTasks(params, inputHandler, options) {
7539
+ if (params !== void 0) {
7540
+ return this.executeTaskUnprojected("list_tasks", params, inputHandler, options);
7541
+ }
7031
7542
  const tasks = await this.executor.getTaskList(this.agent.id);
7032
7543
  return tasks.map(
7033
7544
  (task) => (0, import_request_proposals_guard.assertNativeRequestProposalsTask)(
@@ -7177,10 +7688,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7177
7688
  * ```
7178
7689
  */
7179
7690
  async getAgentInfo(options) {
7180
- return (0, import_mcp_connection_policy.withMCPConnectionPolicy)(
7181
- (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport),
7182
- () => this.getAgentInfoWithConnectionPolicy(options)
7183
- );
7691
+ return this.withConnectionScope(options, () => this.getAgentInfoWithConnectionPolicy(options));
7184
7692
  }
7185
7693
  async getAgentInfoWithConnectionPolicy(options) {
7186
7694
  (0, import_abort2.throwIfAborted)(options?.signal);
@@ -7431,10 +7939,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
7431
7939
  * ```
7432
7940
  */
7433
7941
  async getCapabilities(options) {
7434
- return (0, import_mcp_connection_policy.withMCPConnectionPolicy)(
7435
- (0, import_protocols.normalizeTransportOptions)(options?.transport ?? this.config.transport),
7436
- () => this.getCapabilitiesWithConnectionPolicy(options)
7437
- );
7942
+ return this.withConnectionScope(options, () => this.getCapabilitiesWithConnectionPolicy(options));
7438
7943
  }
7439
7944
  async getCapabilitiesWithConnectionPolicy(options) {
7440
7945
  (0, import_abort2.throwIfAborted)(options?.signal);