@adcp/sdk 14.0.0 → 14.2.0

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 (234) hide show
  1. package/dist/lib/adapters/implicit-account-store.d.mts +12 -7
  2. package/dist/lib/adapters/implicit-account-store.d.ts +12 -7
  3. package/dist/lib/adapters/implicit-account-store.js +69 -15
  4. package/dist/lib/adapters/implicit-account-store.mjs +69 -15
  5. package/dist/lib/core/AgentClient.d.mts +1 -0
  6. package/dist/lib/core/AgentClient.d.ts +1 -0
  7. package/dist/lib/core/AgentClient.js +3 -0
  8. package/dist/lib/core/AgentClient.mjs +3 -0
  9. package/dist/lib/core/SingleAgentClient.d.mts +35 -2
  10. package/dist/lib/core/SingleAgentClient.d.ts +35 -2
  11. package/dist/lib/core/SingleAgentClient.js +377 -36
  12. package/dist/lib/core/SingleAgentClient.mjs +387 -38
  13. package/dist/lib/core/TaskExecutor.d.mts +3 -1
  14. package/dist/lib/core/TaskExecutor.d.ts +3 -1
  15. package/dist/lib/core/TaskExecutor.js +17 -12
  16. package/dist/lib/core/TaskExecutor.mjs +17 -12
  17. package/dist/lib/core/account-key.d.mts +3 -0
  18. package/dist/lib/core/account-key.d.ts +3 -0
  19. package/dist/lib/core/account-key.js +41 -0
  20. package/dist/lib/core/account-key.mjs +17 -0
  21. package/dist/lib/core/account-resolution.d.mts +2 -0
  22. package/dist/lib/core/account-resolution.d.ts +2 -0
  23. package/dist/lib/core/buyer-account-registry.d.mts +93 -0
  24. package/dist/lib/core/buyer-account-registry.d.ts +93 -0
  25. package/dist/lib/core/buyer-account-registry.js +602 -0
  26. package/dist/lib/core/buyer-account-registry.mjs +578 -0
  27. package/dist/lib/core/product-cache.d.mts +18 -0
  28. package/dist/lib/core/product-cache.d.ts +18 -0
  29. package/dist/lib/core/product-cache.js +137 -0
  30. package/dist/lib/core/product-cache.mjs +112 -0
  31. package/dist/lib/errors/index.d.mts +40 -1
  32. package/dist/lib/errors/index.d.ts +40 -1
  33. package/dist/lib/errors/index.js +69 -3
  34. package/dist/lib/errors/index.mjs +64 -3
  35. package/dist/lib/governance/authorization.d.mts +17 -1
  36. package/dist/lib/governance/authorization.d.ts +17 -1
  37. package/dist/lib/governance/authorization.js +55 -7
  38. package/dist/lib/governance/authorization.mjs +59 -7
  39. package/dist/lib/governance/index.d.mts +2 -2
  40. package/dist/lib/governance/index.d.ts +2 -2
  41. package/dist/lib/governance/index.js +2 -0
  42. package/dist/lib/governance/index.mjs +3 -1
  43. package/dist/lib/index.d.mts +7 -4
  44. package/dist/lib/index.d.ts +7 -4
  45. package/dist/lib/index.js +29 -0
  46. package/dist/lib/index.mjs +31 -1
  47. package/dist/lib/net/agent-transport-fetch.d.mts +4 -0
  48. package/dist/lib/net/agent-transport-fetch.d.ts +4 -0
  49. package/dist/lib/net/agent-transport-fetch.js +18 -5
  50. package/dist/lib/net/agent-transport-fetch.mjs +17 -5
  51. package/dist/lib/protocols/a2a.js +9 -1
  52. package/dist/lib/protocols/a2a.mjs +9 -1
  53. package/dist/lib/protocols/index.js +9 -2
  54. package/dist/lib/protocols/index.mjs +9 -2
  55. package/dist/lib/protocols/mcp-modern.js +2 -1
  56. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  57. package/dist/lib/protocols/mcp.js +5 -2
  58. package/dist/lib/protocols/mcp.mjs +5 -2
  59. package/dist/lib/protocols/rawResponseCapture.d.mts +6 -0
  60. package/dist/lib/protocols/rawResponseCapture.d.ts +6 -0
  61. package/dist/lib/protocols/rawResponseCapture.js +41 -29
  62. package/dist/lib/protocols/rawResponseCapture.mjs +40 -29
  63. package/dist/lib/protocols/signedRequestRejection.d.mts +9 -0
  64. package/dist/lib/protocols/signedRequestRejection.d.ts +9 -0
  65. package/dist/lib/protocols/signedRequestRejection.js +209 -0
  66. package/dist/lib/protocols/signedRequestRejection.mjs +189 -0
  67. package/dist/lib/protocols/transportDiagnostics.d.mts +1 -0
  68. package/dist/lib/protocols/transportDiagnostics.d.ts +1 -0
  69. package/dist/lib/protocols/transportDiagnostics.js +2 -0
  70. package/dist/lib/protocols/transportDiagnostics.mjs +1 -0
  71. package/dist/lib/registry/types.generated.d.mts +112 -45
  72. package/dist/lib/registry/types.generated.d.ts +112 -45
  73. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  74. package/dist/lib/server/account-provisioning.d.mts +2 -0
  75. package/dist/lib/server/account-provisioning.d.ts +2 -0
  76. package/dist/lib/server/account-provisioning.js +30 -0
  77. package/dist/lib/server/account-provisioning.mjs +6 -0
  78. package/dist/lib/server/account-reference-warnings.d.mts +12 -0
  79. package/dist/lib/server/account-reference-warnings.d.ts +12 -0
  80. package/dist/lib/server/account-reference-warnings.js +48 -0
  81. package/dist/lib/server/account-reference-warnings.mjs +23 -0
  82. package/dist/lib/server/auth-signature.js +1 -0
  83. package/dist/lib/server/auth-signature.mjs +1 -0
  84. package/dist/lib/server/create-adcp-server.d.mts +34 -0
  85. package/dist/lib/server/create-adcp-server.d.ts +34 -0
  86. package/dist/lib/server/create-adcp-server.js +225 -14
  87. package/dist/lib/server/create-adcp-server.mjs +225 -14
  88. package/dist/lib/server/decisioning/account.d.mts +2 -0
  89. package/dist/lib/server/decisioning/account.d.ts +2 -0
  90. package/dist/lib/server/decisioning/runtime/from-platform.js +49 -10
  91. package/dist/lib/server/decisioning/runtime/from-platform.mjs +49 -10
  92. package/dist/lib/server/index.d.mts +2 -2
  93. package/dist/lib/server/index.d.ts +2 -2
  94. package/dist/lib/server/index.js +2 -0
  95. package/dist/lib/server/index.mjs +3 -1
  96. package/dist/lib/signing/agent-resolver/consistency.d.mts +6 -13
  97. package/dist/lib/signing/agent-resolver/consistency.d.ts +6 -13
  98. package/dist/lib/signing/agent-resolver/consistency.js +0 -1
  99. package/dist/lib/signing/agent-resolver/consistency.mjs +0 -1
  100. package/dist/lib/signing/agent-resolver/errors.d.mts +3 -1
  101. package/dist/lib/signing/agent-resolver/errors.d.ts +3 -1
  102. package/dist/lib/signing/agent-resolver/errors.js +6 -0
  103. package/dist/lib/signing/agent-resolver/errors.mjs +6 -0
  104. package/dist/lib/signing/agent-resolver/fetch-helpers.d.mts +11 -0
  105. package/dist/lib/signing/agent-resolver/fetch-helpers.d.ts +11 -0
  106. package/dist/lib/signing/agent-resolver/fetch-helpers.js +37 -2
  107. package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +40 -3
  108. package/dist/lib/signing/agent-resolver/jwks-set.js +24 -3
  109. package/dist/lib/signing/agent-resolver/jwks-set.mjs +24 -3
  110. package/dist/lib/signing/agent-resolver/legacy-brand.d.mts +15 -0
  111. package/dist/lib/signing/agent-resolver/legacy-brand.d.ts +15 -0
  112. package/dist/lib/signing/agent-resolver/legacy-brand.js +60 -0
  113. package/dist/lib/signing/agent-resolver/legacy-brand.mjs +36 -0
  114. package/dist/lib/signing/agent-resolver/operator-authorization.d.mts +13 -0
  115. package/dist/lib/signing/agent-resolver/operator-authorization.d.ts +13 -0
  116. package/dist/lib/signing/agent-resolver/operator-authorization.js +108 -0
  117. package/dist/lib/signing/agent-resolver/operator-authorization.mjs +84 -0
  118. package/dist/lib/signing/agent-resolver/resolve-agent.d.mts +14 -4
  119. package/dist/lib/signing/agent-resolver/resolve-agent.d.ts +14 -4
  120. package/dist/lib/signing/agent-resolver/resolve-agent.js +148 -137
  121. package/dist/lib/signing/agent-resolver/resolve-agent.mjs +157 -139
  122. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +7 -1
  123. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +7 -1
  124. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +50 -17
  125. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +50 -17
  126. package/dist/lib/signing/agent-resolver/select-agent.d.mts +14 -15
  127. package/dist/lib/signing/agent-resolver/select-agent.d.ts +14 -15
  128. package/dist/lib/signing/agent-resolver/select-agent.js +98 -13
  129. package/dist/lib/signing/agent-resolver/select-agent.mjs +95 -13
  130. package/dist/lib/signing/brand-jwks.d.mts +29 -75
  131. package/dist/lib/signing/brand-jwks.d.ts +29 -75
  132. package/dist/lib/signing/brand-jwks.js +120 -182
  133. package/dist/lib/signing/brand-jwks.mjs +120 -182
  134. package/dist/lib/signing/errors.d.mts +7 -3
  135. package/dist/lib/signing/errors.d.ts +7 -3
  136. package/dist/lib/signing/errors.js +7 -2
  137. package/dist/lib/signing/errors.mjs +7 -2
  138. package/dist/lib/signing/jwks-https.d.mts +7 -0
  139. package/dist/lib/signing/jwks-https.d.ts +7 -0
  140. package/dist/lib/signing/jwks-https.js +31 -8
  141. package/dist/lib/signing/jwks-https.mjs +31 -8
  142. package/dist/lib/signing/jwks.d.mts +8 -0
  143. package/dist/lib/signing/jwks.d.ts +8 -0
  144. package/dist/lib/signing/middleware.js +2 -1
  145. package/dist/lib/signing/middleware.mjs +2 -1
  146. package/dist/lib/signing/publisher-pins.d.mts +11 -0
  147. package/dist/lib/signing/publisher-pins.d.ts +11 -0
  148. package/dist/lib/signing/publisher-pins.js +125 -0
  149. package/dist/lib/signing/publisher-pins.mjs +101 -0
  150. package/dist/lib/signing/server.d.mts +1 -0
  151. package/dist/lib/signing/server.d.ts +1 -0
  152. package/dist/lib/signing/types.d.mts +5 -0
  153. package/dist/lib/signing/types.d.ts +5 -0
  154. package/dist/lib/signing/verifier.js +50 -5
  155. package/dist/lib/signing/verifier.mjs +50 -5
  156. package/dist/lib/signing/webhook-verifier.d.mts +7 -2
  157. package/dist/lib/signing/webhook-verifier.d.ts +7 -2
  158. package/dist/lib/signing/webhook-verifier.js +42 -2
  159. package/dist/lib/signing/webhook-verifier.mjs +42 -2
  160. package/dist/lib/testing/storyboard/account-policy.d.mts +2 -0
  161. package/dist/lib/testing/storyboard/account-policy.d.ts +2 -0
  162. package/dist/lib/testing/storyboard/account-policy.js +35 -0
  163. package/dist/lib/testing/storyboard/account-policy.mjs +11 -0
  164. package/dist/lib/testing/storyboard/context.js +6 -0
  165. package/dist/lib/testing/storyboard/context.mjs +6 -0
  166. package/dist/lib/testing/storyboard/request-builder.js +12 -2
  167. package/dist/lib/testing/storyboard/request-builder.mjs +12 -2
  168. package/dist/lib/testing/storyboard/runner.js +3 -2
  169. package/dist/lib/testing/storyboard/runner.mjs +3 -2
  170. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  171. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  172. package/dist/lib/types/accept-proposal.d.ts +19 -1
  173. package/dist/lib/types/buy-products.d.ts +19 -1
  174. package/dist/lib/types/check-governance.d.ts +19 -1
  175. package/dist/lib/types/comply-test-controller.d.ts +19 -1
  176. package/dist/lib/types/control-media-buy.d.ts +19 -1
  177. package/dist/lib/types/core.generated.d.mts +14 -1
  178. package/dist/lib/types/core.generated.d.ts +14 -1
  179. package/dist/lib/types/create-media-buy.d.ts +14 -1
  180. package/dist/lib/types/get-media-buys.d.ts +14 -1
  181. package/dist/lib/types/get-products.d.ts +19 -1
  182. package/dist/lib/types/list-products.d.ts +19 -1
  183. package/dist/lib/types/refine-proposals.d.ts +19 -1
  184. package/dist/lib/types/request-proposals.d.ts +19 -1
  185. package/dist/lib/types/schemas.generated.d.ts +12 -3
  186. package/dist/lib/types/schemas.generated.js +4 -1
  187. package/dist/lib/types/schemas.generated.mjs +4 -1
  188. package/dist/lib/types/tools.generated.d.mts +14 -1
  189. package/dist/lib/types/tools.generated.d.ts +14 -1
  190. package/dist/lib/types/update-media-buy.d.ts +14 -1
  191. package/dist/lib/version.d.mts +3 -3
  192. package/dist/lib/version.d.ts +3 -3
  193. package/dist/lib/version.js +3 -3
  194. package/dist/lib/version.mjs +3 -3
  195. package/dist/lib/webhooks/index.d.mts +24 -0
  196. package/dist/lib/webhooks/index.d.ts +24 -0
  197. package/dist/lib/webhooks/index.js +50 -24
  198. package/dist/lib/webhooks/index.mjs +49 -24
  199. package/dist/lib/wholesale-feed-sync/index.d.mts +2 -0
  200. package/dist/lib/wholesale-feed-sync/index.d.ts +2 -0
  201. package/dist/lib/wholesale-feed-sync/index.js +7 -0
  202. package/dist/lib/wholesale-feed-sync/index.mjs +4 -0
  203. package/dist/lib/wholesale-feed-sync/mirror.d.mts +97 -0
  204. package/dist/lib/wholesale-feed-sync/mirror.d.ts +97 -0
  205. package/dist/lib/wholesale-feed-sync/mirror.js +350 -0
  206. package/dist/lib/wholesale-feed-sync/mirror.mjs +322 -0
  207. package/dist/lib/wholesale-feed-sync/sync.d.mts +13 -29
  208. package/dist/lib/wholesale-feed-sync/sync.d.ts +13 -29
  209. package/dist/lib/wholesale-feed-sync/sync.js +208 -281
  210. package/dist/lib/wholesale-feed-sync/sync.mjs +213 -281
  211. package/dist/lib/wholesale-feed-sync/types.d.mts +4 -3
  212. package/dist/lib/wholesale-feed-sync/types.d.ts +4 -3
  213. package/docs/README.md +6 -0
  214. package/docs/TYPE-SUMMARY.md +2 -2
  215. package/docs/guides/BUILD-AN-AGENT.md +2 -2
  216. package/docs/guides/BUYER-QUICKSTART-3.2.md +2 -0
  217. package/docs/guides/BUYER-STORAGE.md +3 -0
  218. package/docs/guides/FIRST-CALL-TO-A-SELLER.md +106 -0
  219. package/docs/guides/SIGNING-GUIDE.md +16 -7
  220. package/docs/guides/account-resolution.md +132 -10
  221. package/docs/llms.txt +3 -2
  222. package/docs/migration-14.0-to-14.1.md +85 -0
  223. package/docs/migration-14.x-rc-worksheet.md +4 -4
  224. package/docs/migration-4.x-to-5.x.md +1 -0
  225. package/docs/migration-agent-resolution-3.3.md +125 -0
  226. package/docs/recipes/verifying-inbound-webhooks.md +60 -15
  227. package/package.json +3 -2
  228. package/skills/adcp-brand.previous/SKILL.md +0 -200
  229. package/skills/adcp-creative.previous/SKILL.md +0 -305
  230. package/skills/adcp-governance.previous/SKILL.md +0 -566
  231. package/skills/adcp-measurement.previous/SKILL.md +0 -136
  232. package/skills/adcp-media-buy.previous/SKILL.md +0 -556
  233. package/skills/adcp-si.previous/SKILL.md +0 -206
  234. package/skills/adcp-signals.previous/SKILL.md +0 -204
@@ -6,7 +6,9 @@ const require2 = __adcpCreateRequire(import.meta.url);
6
6
  import {
7
7
  annotateProductsSupplyPaths
8
8
  } from "../supply-path/products.mjs";
9
- import { randomUUID } from "node:crypto";
9
+ import { randomUUID, scryptSync } from "node:crypto";
10
+ const SKIP_PRODUCT_CACHE = /* @__PURE__ */ Symbol("adcp.skipProductCache");
11
+ const SKIP_ACCOUNT_REGISTRY_OBSERVATION = /* @__PURE__ */ Symbol("adcp.skipAccountRegistryObservation");
10
12
  import { ADCP_ENVELOPE_FIELDS } from "../types/adcp.mjs";
11
13
  import { parseAdcpMajorVersion, toReleasePrecisionVersion } from "../version.mjs";
12
14
  import {
@@ -40,6 +42,7 @@ import {
40
42
  import { withTaskDeadline } from "./task-deadline.mjs";
41
43
  import { createMCPRequestHeaders } from "../auth/index.mjs";
42
44
  import { isAbortOrTimeoutError } from "../protocols/abort.mjs";
45
+ import { getSignedRequestRejection } from "../protocols/signedRequestRejection.mjs";
43
46
  import { ProtocolClient, normalizeTransportOptions } from "../protocols/index.mjs";
44
47
  import {
45
48
  AuthenticationCredentialsRejectedError,
@@ -122,7 +125,16 @@ import {
122
125
  assertValidIdempotencyReplayTtlSeconds,
123
126
  supportsBuyingMode
124
127
  } from "../utils/capabilities.mjs";
125
- import { AccountPendingApprovalError, AccountRequiredError, UnsupportedBuyingModeError } from "../errors/index.mjs";
128
+ import {
129
+ AccountPendingApprovalError,
130
+ AccountRequiredError,
131
+ AccountNotProvisionedError,
132
+ AccountNotFoundError,
133
+ AccountSetupRequiredError,
134
+ AccountPaymentRequiredError,
135
+ UnsupportedBuyingModeError
136
+ } from "../errors/index.mjs";
137
+ import { BuyerAccountRegistry } from "./buyer-account-registry.mjs";
126
138
  import { sameCountrySet, selectListedAccount } from "./account-resolution.mjs";
127
139
  import { normalizeRequestParams } from "../utils/request-normalizer.mjs";
128
140
  import { globalAsyncLocalStorage } from "../utils/global-async-local-storage.mjs";
@@ -827,6 +839,8 @@ class SingleAgentClient {
827
839
  };
828
840
  }
829
841
  this.normalizedAgent = this.normalizeAgentConfig(this.agent);
842
+ if (this.normalizedAgent.oauth_tokens && !this.normalizedAgent.oauth_client_credentials)
843
+ this.initialOAuthGrantMaterial = JSON.stringify(this.normalizedAgent.oauth_tokens);
830
844
  this.capabilityEvidenceAuthMaterial = this.currentCapabilityEvidenceAuthMaterial();
831
845
  this.executor = new TaskExecutor({
832
846
  workingTimeout: config.workingTimeout || 12e4,
@@ -895,6 +909,179 @@ class SingleAgentClient {
895
909
  }
896
910
  agent;
897
911
  config;
912
+ _accounts;
913
+ accountRegistryExplicitlyAccessed = false;
914
+ initialOAuthGrantMaterial;
915
+ accountCredentialMaterial;
916
+ accountCredentialScope;
917
+ credentialScope(material) {
918
+ if (this.accountCredentialMaterial !== material) {
919
+ this.accountCredentialScope = scryptSync(material, "adcp-sdk/account-registry-scope/v1", 32).toString("hex");
920
+ this.accountCredentialMaterial = material;
921
+ }
922
+ return this.accountCredentialScope;
923
+ }
924
+ accountScope() {
925
+ const agent = this.normalizedAgent ?? this.agent;
926
+ const cc = agent.oauth_client_credentials;
927
+ if (!cc && agent.oauth_tokens && !this.initialOAuthGrantMaterial)
928
+ this.initialOAuthGrantMaterial = JSON.stringify(agent.oauth_tokens);
929
+ const oauthIdentity = cc ? { client_id: cc.client_id, token_endpoint: cc.token_endpoint, scope: cc.scope, resource: cc.resource } : this.initialOAuthGrantMaterial;
930
+ const signing = agent.request_signing;
931
+ const signingIdentity = signing ? signing.kind === "provider" ? {
932
+ keyid: signing.provider.keyid,
933
+ algorithm: signing.provider.algorithm,
934
+ fingerprint: signing.provider.fingerprint,
935
+ purpose: signing.provider.adcpUse
936
+ } : { keyid: signing.kid, algorithm: signing.alg, key: signing.private_key } : void 0;
937
+ const credential = this.config.accountRegistryScope ?? this.credentialScope(
938
+ JSON.stringify({
939
+ token: agent.auth_token,
940
+ oauth: oauthIdentity,
941
+ oauthClient: agent.oauth_client?.client_id,
942
+ oauthResource: agent.oauth_resource,
943
+ headers: agent.headers,
944
+ signing: signingIdentity
945
+ })
946
+ );
947
+ return JSON.stringify([this.agent.agent_uri, this.agent.protocol, credential]);
948
+ }
949
+ get accounts() {
950
+ this.accountRegistryExplicitlyAccessed = true;
951
+ return this.getAccountRegistry();
952
+ }
953
+ getAccountRegistry() {
954
+ return this._accounts ??= new BuyerAccountRegistry(
955
+ () => this.accountScope(),
956
+ async (account, options, taskOptions, dispatch) => {
957
+ const caps = await this.getCapabilities(taskOptions);
958
+ const supported = caps.account?.supportedBilling ?? [];
959
+ const billing = options.billing ?? caps.account?.defaultBilling ?? (supported.length === 1 ? supported[0] : void 0);
960
+ if (!billing || supported.length && !supported.includes(billing)) {
961
+ throw new AccountRequiredError(
962
+ "implicit",
963
+ "sync_accounts",
964
+ "Choose a supported billing party before provisioning."
965
+ );
966
+ }
967
+ return this.syncAccounts(
968
+ {
969
+ ...dispatch && { idempotency_key: dispatch.idempotencyKey },
970
+ accounts: [
971
+ {
972
+ ...account,
973
+ billing,
974
+ ...options.paymentTerms !== void 0 && { payment_terms: options.paymentTerms },
975
+ ...options.billingEntity !== void 0 && { billing_entity: options.billingEntity }
976
+ }
977
+ ]
978
+ },
979
+ void 0,
980
+ { ...taskOptions, [SKIP_ACCOUNT_REGISTRY_OBSERVATION]: true },
981
+ dispatch
982
+ );
983
+ },
984
+ this.config.accountStorage,
985
+ async (accountId, options) => {
986
+ const rows = [];
987
+ const cursors = /* @__PURE__ */ new Set();
988
+ let cursor;
989
+ for (let page = 0; page < 100; page++) {
990
+ const result = await this.listAccounts(
991
+ { account: { account_id: accountId }, ...cursor && { pagination: { cursor } } },
992
+ void 0,
993
+ { ...options, [SKIP_ACCOUNT_REGISTRY_OBSERVATION]: true }
994
+ );
995
+ if (!result.success || result.status !== "completed" || !result.data || !("accounts" in result.data))
996
+ throw new Error("Account status reconciliation failed.");
997
+ rows.push(...result.data.accounts);
998
+ if (rows.some((row) => row.account_id === accountId) || !result.data.pagination?.has_more)
999
+ return rows.filter((row) => row.account_id === accountId);
1000
+ const next = result.data.pagination.cursor;
1001
+ if (!next || cursors.has(next)) break;
1002
+ cursors.add(next);
1003
+ cursor = next;
1004
+ }
1005
+ throw new Error("Account status reconciliation could not complete pagination.");
1006
+ },
1007
+ {
1008
+ ...this.config.accountRegistryOptions,
1009
+ provisionOwnsDispatchBoundary: true,
1010
+ maxEntries: this.config.accountRegistryMaxEntries,
1011
+ normalizeOptions: async (options, taskOptions) => {
1012
+ if (options.billing) return options;
1013
+ const caps = await this.getCapabilities(taskOptions);
1014
+ const supported = caps.account?.supportedBilling ?? [];
1015
+ const billing = caps.account?.defaultBilling ?? (supported.length === 1 ? supported[0] : void 0);
1016
+ return { ...options, ...billing && { billing } };
1017
+ }
1018
+ }
1019
+ );
1020
+ }
1021
+ /**
1022
+ * The memoized registry backs `resolveAccount()` only when the caller opts
1023
+ * in with an account policy or registry configuration. Otherwise
1024
+ * `resolveAccount()` keeps the SDK 14.0 sync-on-every-call behavior.
1025
+ */
1026
+ accountRegistryOptedIn() {
1027
+ return (this.config.accountPolicy ?? "off") !== "off" || this.config.accountStorage !== void 0 || this.config.accountRegistryScope !== void 0 || this.config.accountRegistryMaxEntries !== void 0 || this.config.accountRegistryOptions !== void 0;
1028
+ }
1029
+ accountRegistryContext(task, params, options) {
1030
+ const knownOnly = !this.accountRegistryExplicitlyAccessed && (this.config.accountPolicy ?? "off") === "off" && !this.config.accountStorage;
1031
+ if (knownOnly && !this._accounts) return void 0;
1032
+ if (options?.[SKIP_ACCOUNT_REGISTRY_OBSERVATION])
1033
+ return void 0;
1034
+ if (task !== "sync_accounts" && task !== "list_accounts") return void 0;
1035
+ return {
1036
+ scope: this.accountScope(),
1037
+ ...knownOnly && { knownOnly: true },
1038
+ observationEpoch: this.getAccountRegistry().captureObservation(),
1039
+ ...task === "list_accounts" && params.account && { refs: [params.account] },
1040
+ ...task === "sync_accounts" && {
1041
+ refs: Array.isArray(params.accounts) ? params.accounts.flatMap((value) => {
1042
+ const ref = canonicalAccountRoutingSnapshot(value);
1043
+ return ref ? [ref] : [];
1044
+ }) : [],
1045
+ dryRun: params.dry_run === true
1046
+ }
1047
+ };
1048
+ }
1049
+ async applyAccountPolicy(task, params, options) {
1050
+ const policy = this.config.accountPolicy ?? "off";
1051
+ const ref = params?.account ?? (typeof params?.account_id === "string" ? { account_id: params.account_id } : void 0);
1052
+ if (policy === "off" || options?.skipAccountValidation || options?.preserveGovernedPayload || !ref || task === "list_accounts")
1053
+ return params;
1054
+ if (typeof ref !== "object" || ref === null || !("account_id" in ref) && (typeof ref.brand?.domain !== "string" || typeof ref.operator !== "string"))
1055
+ return params;
1056
+ const known = await this.getAccountRegistry().get(ref);
1057
+ if (known && !["unknown", "provisioning", "failed_provisioning"].includes(known.status)) {
1058
+ if (["create_media_buy", "buy_products", "accept_proposal", "activate_signal", "acquire_rights"].includes(task) && known.status !== "active") {
1059
+ if (known.status === "pending_approval") throw new AccountPendingApprovalError(ref, known.account_id);
1060
+ if (known.status === "payment_required") throw new AccountPaymentRequiredError();
1061
+ throw new AccountSetupRequiredError(
1062
+ `Account status is ${known.status}. Refresh it with client.accounts.applyStatusChange or complete seller setup.`
1063
+ );
1064
+ }
1065
+ return params;
1066
+ }
1067
+ if (policy === "strict" || ![
1068
+ "get_products",
1069
+ "list_products",
1070
+ "get_signals",
1071
+ "request_proposals",
1072
+ "refine_proposals",
1073
+ "decline_proposals"
1074
+ ].includes(task)) {
1075
+ throw new AccountNotProvisionedError(ref, task);
1076
+ }
1077
+ const caps = await this.getCapabilities(options);
1078
+ if (caps._synthetic || ["get_products", "list_products"].includes(task) && caps.account?.requiredForProducts || params.push_notification_config || !schemaAllowsTopLevelField(task, "brand")) {
1079
+ throw new AccountNotProvisionedError(ref, task);
1080
+ }
1081
+ if (!("brand" in ref)) throw new AccountNotProvisionedError(ref, task);
1082
+ const { account, ...publicRequest } = params;
1083
+ return { ...publicRequest, brand: params.brand ?? ref.brand };
1084
+ }
898
1085
  executor;
899
1086
  asyncHandler;
900
1087
  normalizedAgent;
@@ -1061,6 +1248,7 @@ class SingleAgentClient {
1061
1248
  } = configuredResolverOptions ?? {};
1062
1249
  const resolver = new ResolvedAgentJwksResolver(registration.agentUrl, registration.protocol, {
1063
1250
  ...resolverOptionsWithoutOperatorContext,
1251
+ legacyWebhookFallback: configuredResolverOptions?.legacyWebhookFallback ?? true,
1064
1252
  ...delegatedOperatorAuthorization?.brand !== void 0 && {
1065
1253
  requiredOperatorBrand: delegatedOperatorAuthorization.brand
1066
1254
  },
@@ -1828,6 +2016,8 @@ class SingleAgentClient {
1828
2016
  }
1829
2017
  return { success: true };
1830
2018
  } catch (error) {
2019
+ const signedRejection = getSignedRequestRejection(error);
2020
+ if (signedRejection) throw signedRejection;
1831
2021
  if (isAbortOrTimeoutError(error)) {
1832
2022
  throw error;
1833
2023
  }
@@ -2140,6 +2330,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2140
2330
  },
2141
2331
  {
2142
2332
  jwks: this.webhookJwksFor(registration),
2333
+ publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
2334
+ onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
2143
2335
  replayStore: this.webhookReplayStore,
2144
2336
  revocationStore: this.webhookRevocationStore,
2145
2337
  ...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
@@ -2151,6 +2343,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2151
2343
  );
2152
2344
  } catch (cause) {
2153
2345
  if (cause instanceof WebhookSignatureError) {
2346
+ if (cause.retryable)
2347
+ return {
2348
+ ok: false,
2349
+ code: "webhook_verification_unavailable",
2350
+ message: "Seller signing keys could not be resolved for webhook verification.",
2351
+ cause
2352
+ };
2154
2353
  return { ok: false, code: cause.code, message: cause.message, cause };
2155
2354
  }
2156
2355
  if (cause instanceof AgentResolverError && RequestSigningErrorCodeMetadata[cause.code].recovery !== "transient") {
@@ -2972,6 +3171,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
2972
3171
  async executeAndHandleWithinDeadline(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
2973
3172
  throwIfAborted(options?.signal);
2974
3173
  const canonicalCreativeInvocation = CANONICAL_CREATIVE_ACTIVITY_TASKS.has(taskType) || canonicalRequest !== void 0;
3174
+ params = await this.applyAccountPolicy(taskType, params, options);
2975
3175
  let normalizedParams = options?.preserveGovernedPayload ? params : normalizeRequestParams(taskType, params, {
2976
3176
  skipIdempotencyAutoInject: options?.skipIdempotencyAutoInject,
2977
3177
  skipAccountValidation: options?.skipAccountValidation
@@ -3055,6 +3255,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3055
3255
  serverVersionSynthetic: capabilityDiscoveryContext.capabilities._synthetic
3056
3256
  },
3057
3257
  productPolicyRequest: productPolicyRequestSnapshot(normalizedParams),
3258
+ accountRegistry: this.accountRegistryContext(taskType, normalizedParams, effectiveOptions),
3058
3259
  ...projectionCatalogs !== void 0 && { projectionCatalogs },
3059
3260
  ...routingSnapshot !== void 0 && { routingSnapshot },
3060
3261
  ...effectiveOptions?.taskId !== void 0 && { optionTaskId: effectiveOptions.taskId },
@@ -3119,6 +3320,53 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
3119
3320
  const completionHandlerAlreadyPublished = hasCompletionHandlerAlreadyPublished(result);
3120
3321
  const settlementAcknowledger = result[DEFERRED_SETTLEMENT_ACK];
3121
3322
  const taskType = context.taskType;
3323
+ if (context.accountRegistry !== void 0 && context.accountRegistry.scope === this.accountScope() && result.success && result.status === "completed" && result.data && typeof result.data === "object" && "accounts" in result.data && Array.isArray(result.data.accounts)) {
3324
+ try {
3325
+ const registry = this.getAccountRegistry();
3326
+ let refs = context.accountRegistry.refs ?? [];
3327
+ let rows = result.data.accounts;
3328
+ if (context.accountRegistry.knownOnly) {
3329
+ refs = (await Promise.all(refs.map(async (ref) => await registry.get(ref) ? ref : void 0))).filter(
3330
+ (ref) => ref !== void 0
3331
+ );
3332
+ if (taskType === "list_accounts") {
3333
+ rows = (await Promise.all(
3334
+ result.data.accounts.map(async (row) => {
3335
+ const ref = canonicalAccountRoutingSnapshot(row);
3336
+ if (ref && await registry.get(ref)) return row;
3337
+ const natural = canonicalAccountRoutingSnapshot({ ...row, account_id: void 0 });
3338
+ return natural && await registry.get(natural) ? row : void 0;
3339
+ })
3340
+ )).filter((row) => row !== void 0);
3341
+ }
3342
+ }
3343
+ if (context.accountRegistry.scope !== this.accountScope()) return result;
3344
+ if (taskType === "sync_accounts")
3345
+ await registry.observeSync(
3346
+ refs,
3347
+ rows,
3348
+ context.accountRegistry.dryRun,
3349
+ context.accountRegistry.observationEpoch
3350
+ );
3351
+ if (taskType === "list_accounts") {
3352
+ const ref = refs[0];
3353
+ await registry.observeList(
3354
+ rows,
3355
+ ref && "account_id" in ref && (!result.data.pagination?.has_more || result.data.accounts.some((row) => row.account_id === ref.account_id)) ? ref.account_id : void 0,
3356
+ context.accountRegistry.observationEpoch
3357
+ );
3358
+ }
3359
+ } catch {
3360
+ result.debug_logs = [
3361
+ ...result.debug_logs ?? [],
3362
+ {
3363
+ level: "warn",
3364
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3365
+ message: "Account registry observation failed. The seller operation completed; reconcile with listAccounts before relying on the registry."
3366
+ }
3367
+ ];
3368
+ }
3369
+ }
3122
3370
  const resumedOptions = {
3123
3371
  ...options ?? {},
3124
3372
  ...context.optionTaskId !== void 0 && { taskId: context.optionTaskId },
@@ -4138,7 +4386,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4138
4386
  );
4139
4387
  return withTaskDeadline(snapshotTaskOptions(taskOptions), async (effectiveOptions) => {
4140
4388
  this.assertRequestSupportedByConfiguredVersion("get_products", params, effectiveOptions);
4141
- let request = params;
4389
+ let request = await this.applyAccountPolicy("get_products", params, effectiveOptions);
4142
4390
  const legacyAccountId = request.account_id;
4143
4391
  const accountReference = request.account ?? (typeof legacyAccountId === "string" && legacyAccountId ? { account_id: legacyAccountId } : void 0);
4144
4392
  if (!request.account && typeof legacyAccountId === "string" && legacyAccountId) {
@@ -4175,10 +4423,36 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4175
4423
  request = { ...request, buying_mode: "wholesale" };
4176
4424
  }
4177
4425
  const account = canonicalAccountRoutingSnapshot(accountReference);
4178
- return this.executeAndHandle(
4426
+ const cache = !effectiveOptions.skipRequestValidation && !effectiveOptions.preserveGovernedPayload && !inputHandler && !request.push_notification_config && !this.config.webhookUrlTemplate && !this.config.handlers?.onGetProductsStatusChange ? this.config.productCache : void 0;
4427
+ const cacheScope = cache ? JSON.stringify([
4428
+ this.accountScope(),
4429
+ this.resolvedAdcpVersion,
4430
+ this.capabilityEvidenceScopeKey,
4431
+ effectiveOptions.contextId
4432
+ ]) : "";
4433
+ const cacheParams = request;
4434
+ const skipCacheRead = options?.[SKIP_PRODUCT_CACHE];
4435
+ if (cache && !skipCacheRead && cacheParams.if_wholesale_feed_version === void 0 && cacheParams.if_pricing_version === void 0) {
4436
+ const hit = cache.read(cacheScope, cacheParams);
4437
+ if (hit) {
4438
+ throwIfAborted(effectiveOptions.signal);
4439
+ if (hit.success && hit.status === "completed")
4440
+ this.rememberCanonicalProductRoutes(hit.data.products ?? [], account, hit.data.products ?? []);
4441
+ return attachMatch(
4442
+ await this.applyProductPropertyPolicy(
4443
+ hit,
4444
+ "get_products",
4445
+ productPolicyRequestSnapshot(request),
4446
+ effectiveOptions.signal
4447
+ )
4448
+ );
4449
+ }
4450
+ }
4451
+ const conditionalSnapshot = skipCacheRead ? void 0 : cache?.read(cacheScope, cacheParams, true);
4452
+ const result = await this.executeAndHandle(
4179
4453
  "get_products",
4180
4454
  "onGetProductsStatusChange",
4181
- request,
4455
+ cache && !skipCacheRead ? cache.conditionalParams(cacheScope, cacheParams) : request,
4182
4456
  inputHandler,
4183
4457
  effectiveOptions,
4184
4458
  (data) => {
@@ -4196,6 +4470,37 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4196
4470
  void 0,
4197
4471
  projectionCatalogs
4198
4472
  );
4473
+ const finishCache = async (completed) => {
4474
+ if (!cache) return completed;
4475
+ const cachedResult = cache.write(cacheScope, cacheParams, completed, conditionalSnapshot);
4476
+ if (cachedResult.success && cachedResult.status === "completed") {
4477
+ if (!skipCacheRead && cacheParams.if_wholesale_feed_version === void 0 && cacheParams.if_pricing_version === void 0 && cachedResult.data.unchanged === true) {
4478
+ return this.getProducts(params, inputHandler, {
4479
+ ...options,
4480
+ ...effectiveOptions,
4481
+ [SKIP_PRODUCT_CACHE]: true
4482
+ });
4483
+ }
4484
+ this.rememberCanonicalProductRoutes(
4485
+ cachedResult.data.products ?? [],
4486
+ account,
4487
+ cachedResult.data.products ?? []
4488
+ );
4489
+ }
4490
+ if (cachedResult.submitted) {
4491
+ const submitted = cachedResult.submitted;
4492
+ cachedResult.submitted = {
4493
+ ...submitted,
4494
+ waitForCompletion: (interval, signal) => submitted.waitForCompletion(interval, signal).then(finishCache)
4495
+ };
4496
+ }
4497
+ if (cachedResult.deferred) {
4498
+ const deferred = cachedResult.deferred;
4499
+ cachedResult.deferred = { ...deferred, resume: (input) => deferred.resume(input).then(finishCache) };
4500
+ }
4501
+ return attachMatch(cachedResult);
4502
+ };
4503
+ return finishCache(result);
4199
4504
  });
4200
4505
  }
4201
4506
  /** Discover products through the compact AdCP 3.2 catalog task. */
@@ -4934,7 +5239,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4934
5239
  const seenCursors = /* @__PURE__ */ new Set();
4935
5240
  let cursor;
4936
5241
  for (let page = 0; page < 100; page++) {
4937
- const result2 = await this.listAccounts(
5242
+ const result = await this.listAccounts(
4938
5243
  {
4939
5244
  status: "active",
4940
5245
  sandbox: hints.sandbox ?? false,
@@ -4943,13 +5248,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
4943
5248
  void 0,
4944
5249
  effectiveOptions
4945
5250
  );
4946
- onTaskResult?.(result2);
4947
- if (!result2.success || result2.status !== "completed" || !result2.data || !("accounts" in result2.data) || !Array.isArray(result2.data.accounts)) {
5251
+ onTaskResult?.(result);
5252
+ if (!result.success || result.status !== "completed" || !result.data || !("accounts" in result.data) || !Array.isArray(result.data.accounts)) {
4948
5253
  throw new Error("list_accounts did not return a completed account list.");
4949
5254
  }
4950
- accounts.push(...result2.data.accounts);
4951
- if (!result2.data.pagination?.has_more) return selectListedAccount(accounts, hints);
4952
- const nextCursor = result2.data.pagination.cursor;
5255
+ accounts.push(...result.data.accounts);
5256
+ if (!result.data.pagination?.has_more) return selectListedAccount(accounts, hints);
5257
+ const nextCursor = result.data.pagination.cursor;
4953
5258
  if (!nextCursor || seenCursors.has(nextCursor)) break;
4954
5259
  seenCursors.add(nextCursor);
4955
5260
  cursor = nextCursor;
@@ -5016,42 +5321,84 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5016
5321
  `Choose a supported billing party for sync_accounts (seller supports: ${supportedBilling.join(", ") || "(none)"}).`
5017
5322
  );
5018
5323
  }
5019
- const result = await this.syncAccounts(
5020
- {
5021
- accounts: [
5022
- {
5023
- ...account,
5024
- billing
5025
- }
5026
- ]
5027
- },
5028
- void 0,
5029
- effectiveOptions
5030
- );
5031
- onTaskResult?.(result);
5032
- if (!result.success || result.status !== "completed" || !result.data || !("accounts" in result.data) || !Array.isArray(result.data.accounts)) {
5033
- throw new Error("sync_accounts did not return a completed account result.");
5034
- }
5035
- const synced = result.data.accounts.find(
5036
- (row) => row.brand?.domain === hints.brand.domain && row.operator === hints.operator && (!hints.brand.brand_id || row.brand.brand_id === hints.brand.brand_id) && sameCountrySet(hints.brand.countries, row.brand.countries) && (!hints.operatorUnit || row.operator_unit?.id === hints.operatorUnit.id) && (!hints.currency || row.currency === hints.currency) && (!hints.timezone || row.timezone === hints.timezone) && (row.sandbox === void 0 || row.sandbox === true === (hints.sandbox === true))
5037
- );
5038
- if (synced?.status === "pending_approval") {
5039
- throw new AccountPendingApprovalError(account, synced.account_id);
5324
+ if (!this.accountRegistryOptedIn()) {
5325
+ const result = await this.syncAccounts(
5326
+ {
5327
+ accounts: [
5328
+ {
5329
+ ...account,
5330
+ billing,
5331
+ ...hints.paymentTerms !== void 0 && { payment_terms: hints.paymentTerms },
5332
+ ...hints.billingEntity !== void 0 && { billing_entity: hints.billingEntity }
5333
+ }
5334
+ ]
5335
+ },
5336
+ void 0,
5337
+ effectiveOptions
5338
+ );
5339
+ onTaskResult?.(result);
5340
+ if (!result.success || result.status !== "completed" || !result.data || !("accounts" in result.data) || !Array.isArray(result.data.accounts)) {
5341
+ throw new Error("sync_accounts did not return a completed account result.");
5342
+ }
5343
+ const syncedRow = result.data.accounts.find(
5344
+ (row) => row.brand?.domain === hints.brand.domain && row.operator === hints.operator && (!hints.brand.brand_id || row.brand.brand_id === hints.brand.brand_id) && sameCountrySet(hints.brand.countries, row.brand.countries) && (!hints.operatorUnit || row.operator_unit?.id === hints.operatorUnit.id) && (!hints.currency || row.currency === hints.currency) && (!hints.timezone || row.timezone === hints.timezone) && (row.sandbox === void 0 || row.sandbox === true === (hints.sandbox === true))
5345
+ );
5346
+ if (syncedRow?.status === "pending_approval") {
5347
+ throw new AccountPendingApprovalError(account, syncedRow.account_id);
5348
+ }
5349
+ if (!syncedRow || syncedRow.action === "failed" || syncedRow.status !== "active") {
5350
+ throw new AccountRequiredError(
5351
+ "implicit",
5352
+ "resolveAccount",
5353
+ "sync_accounts did not establish an active account for the requested brand and operator."
5354
+ );
5355
+ }
5356
+ return account;
5040
5357
  }
5041
- if (!synced || synced.action === "failed" || synced.status !== "active") {
5042
- throw new AccountRequiredError(
5043
- "implicit",
5044
- "resolveAccount",
5045
- "sync_accounts did not establish an active account for the requested brand and operator."
5358
+ let synced;
5359
+ try {
5360
+ synced = await this.getAccountRegistry().ensure(
5361
+ account,
5362
+ {
5363
+ billing,
5364
+ paymentTerms: hints.paymentTerms,
5365
+ billingEntity: hints.billingEntity
5366
+ },
5367
+ effectiveOptions,
5368
+ onTaskResult
5046
5369
  );
5370
+ } catch (error) {
5371
+ if (error instanceof AccountNotFoundError)
5372
+ throw new AccountRequiredError("implicit", "resolveAccount", error.message);
5373
+ throw error;
5047
5374
  }
5375
+ if (synced.status === "pending_approval") throw new AccountPendingApprovalError(account, synced.account_id);
5376
+ if (synced.status !== "active")
5377
+ throw new AccountRequiredError("implicit", "resolveAccount", "The account is not active.");
5048
5378
  return account;
5049
5379
  });
5050
5380
  }
5051
5381
  /**
5052
5382
  * Sync accounts
5053
5383
  */
5054
- async syncAccounts(params, inputHandler, options) {
5384
+ async syncAccounts(params, inputHandler, options, dispatch) {
5385
+ if (dispatch)
5386
+ return this.executeTaskUnprojected(
5387
+ "sync_accounts",
5388
+ params,
5389
+ inputHandler,
5390
+ options,
5391
+ "onSyncAccountsStatusChange",
5392
+ Object.assign(
5393
+ async (effectiveParams) => {
5394
+ if (dispatch.requireIdempotencyKey !== false && effectiveParams.idempotency_key !== dispatch.idempotencyKey)
5395
+ throw new ConfigurationError("Account provisioning idempotency key changed before dispatch.");
5396
+ await dispatch.beforeDispatch();
5397
+ return { action: "dispatch_ready" };
5398
+ },
5399
+ { terminalSettlement: "executor" }
5400
+ )
5401
+ );
5055
5402
  return this.executeAndHandle(
5056
5403
  "sync_accounts",
5057
5404
  "onSyncAccountsStatusChange",
@@ -5315,6 +5662,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5315
5662
  const startTime = Date.now();
5316
5663
  let detectedServerVersion;
5317
5664
  let detectedServerVersionSynthetic;
5665
+ params = await this.applyAccountPolicy(taskName, params, options);
5318
5666
  try {
5319
5667
  const normalizedParams = options?.preserveGovernedPayload ? params : normalizeRequestParams(taskName, params, {
5320
5668
  skipIdempotencyAutoInject: options?.skipIdempotencyAutoInject,
@@ -5380,6 +5728,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
5380
5728
  serverVersionSynthetic: capabilityDiscoveryContext.capabilities._synthetic
5381
5729
  },
5382
5730
  productPolicyRequest: productPolicyRequestSnapshot(normalizedParams),
5731
+ accountRegistry: this.accountRegistryContext(taskName, normalizedParams, effectiveOptions),
5383
5732
  ...effectiveOptions?.taskId !== void 0 && { optionTaskId: effectiveOptions.taskId },
5384
5733
  ...effectiveOptions?.contextId !== void 0 && { optionContextId: effectiveOptions.contextId }
5385
5734
  };
@@ -41,6 +41,8 @@ export declare function acknowledgeDeferredSettlement(result: TaskResult<any>):
41
41
  export declare function rejectDeferredSettlement(result: TaskResult<any>): Promise<void>;
42
42
  /** Supporting contract for the internal pre-dispatch boundary. */
43
43
  export type BeforeProtocolDispatchHookResult<T> = {
44
+ action: 'dispatch_ready';
45
+ } | {
44
46
  action: 'dispatch_committed';
45
47
  /** Require the owning durable coordinator to authorize every seller-input continuation. */
46
48
  requireDeferredSettlementResumeAuthorization?: boolean;
@@ -84,7 +86,7 @@ export interface ExternalTaskStatusResult {
84
86
  error?: string;
85
87
  }
86
88
  /** Hook used by higher-level SDK coordinators at the final dispatch boundary. */
87
- export type BeforeProtocolDispatchHook<T> = (effectiveParams: any, context: BeforeProtocolDispatchContext) => Promise<BeforeProtocolDispatchHookResult<T>>;
89
+ export type BeforeProtocolDispatchHook<T> = ((effectiveParams: any, context: BeforeProtocolDispatchContext) => Promise<BeforeProtocolDispatchHookResult<T>>) & {};
88
90
  /**
89
91
  * Webhook manager for submitted tasks
90
92
  */
@@ -41,6 +41,8 @@ export declare function acknowledgeDeferredSettlement(result: TaskResult<any>):
41
41
  export declare function rejectDeferredSettlement(result: TaskResult<any>): Promise<void>;
42
42
  /** Supporting contract for the internal pre-dispatch boundary. */
43
43
  export type BeforeProtocolDispatchHookResult<T> = {
44
+ action: 'dispatch_ready';
45
+ } | {
44
46
  action: 'dispatch_committed';
45
47
  /** Require the owning durable coordinator to authorize every seller-input continuation. */
46
48
  requireDeferredSettlementResumeAuthorization?: boolean;
@@ -84,7 +86,7 @@ export interface ExternalTaskStatusResult {
84
86
  error?: string;
85
87
  }
86
88
  /** Hook used by higher-level SDK coordinators at the final dispatch boundary. */
87
- export type BeforeProtocolDispatchHook<T> = (effectiveParams: any, context: BeforeProtocolDispatchContext) => Promise<BeforeProtocolDispatchHookResult<T>>;
89
+ export type BeforeProtocolDispatchHook<T> = ((effectiveParams: any, context: BeforeProtocolDispatchContext) => Promise<BeforeProtocolDispatchHookResult<T>>) & {};
88
90
  /**
89
91
  * Webhook manager for submitted tasks
90
92
  */