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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/dist/lib/adapters/keyed-account-store.js +1 -1
  2. package/dist/lib/adapters/keyed-account-store.mjs +1 -1
  3. package/dist/lib/adapters/version/3.0/brand-fields.d.mts +7 -1
  4. package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
  5. package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
  6. package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
  7. package/dist/lib/adapters/version/3.0/index.js +6 -0
  8. package/dist/lib/adapters/version/3.0/index.mjs +7 -1
  9. package/dist/lib/adapters/version/types.d.mts +5 -0
  10. package/dist/lib/adapters/version/types.d.ts +5 -0
  11. package/dist/lib/canonical-references/index.js +2 -0
  12. package/dist/lib/canonical-references/index.mjs +2 -0
  13. package/dist/lib/client/account-changes.d.mts +3 -1
  14. package/dist/lib/client/account-changes.d.ts +3 -1
  15. package/dist/lib/client/account-changes.js +22 -2
  16. package/dist/lib/client/account-changes.mjs +22 -2
  17. package/dist/lib/conformance/oracle.js +3 -2
  18. package/dist/lib/conformance/oracle.mjs +3 -2
  19. package/dist/lib/core/AgentClient.d.mts +165 -1
  20. package/dist/lib/core/AgentClient.d.ts +165 -1
  21. package/dist/lib/core/AgentClient.js +446 -8
  22. package/dist/lib/core/AgentClient.mjs +446 -8
  23. package/dist/lib/core/ConversationTypes.d.mts +8 -0
  24. package/dist/lib/core/ConversationTypes.d.ts +8 -0
  25. package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
  26. package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
  27. package/dist/lib/core/ProtocolResponseParser.js +28 -18
  28. package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
  29. package/dist/lib/core/SingleAgentClient.d.mts +115 -2
  30. package/dist/lib/core/SingleAgentClient.d.ts +115 -2
  31. package/dist/lib/core/SingleAgentClient.js +547 -67
  32. package/dist/lib/core/SingleAgentClient.mjs +534 -54
  33. package/dist/lib/core/TaskExecutor.d.mts +7 -0
  34. package/dist/lib/core/TaskExecutor.d.ts +7 -0
  35. package/dist/lib/core/TaskExecutor.js +18 -5
  36. package/dist/lib/core/TaskExecutor.mjs +18 -5
  37. package/dist/lib/core/task-status.d.mts +2 -0
  38. package/dist/lib/core/task-status.d.ts +2 -0
  39. package/dist/lib/core/task-status.js +11 -2
  40. package/dist/lib/core/task-status.mjs +9 -1
  41. package/dist/lib/identity-3.3/trust.d.mts +1 -4
  42. package/dist/lib/identity-3.3/trust.d.ts +1 -4
  43. package/dist/lib/identity-3.3/trust.js +34 -21
  44. package/dist/lib/identity-3.3/trust.mjs +34 -21
  45. package/dist/lib/identity-3.3/validation.js +5 -3
  46. package/dist/lib/identity-3.3/validation.mjs +6 -4
  47. package/dist/lib/index.d.mts +6 -52
  48. package/dist/lib/index.d.ts +6 -52
  49. package/dist/lib/index.js +11 -0
  50. package/dist/lib/index.mjs +7 -0
  51. package/dist/lib/media-buy/compatibility.js +6 -1
  52. package/dist/lib/media-buy/compatibility.mjs +6 -1
  53. package/dist/lib/protocols/mcp-scope.d.mts +3 -0
  54. package/dist/lib/protocols/mcp-scope.d.ts +3 -0
  55. package/dist/lib/protocols/mcp-scope.js +8 -3
  56. package/dist/lib/protocols/mcp-scope.mjs +8 -3
  57. package/dist/lib/reporting/inspection.js +1 -0
  58. package/dist/lib/reporting/inspection.mjs +1 -0
  59. package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
  60. package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
  61. package/dist/lib/reporting/ledger/coverage.js +37 -3
  62. package/dist/lib/reporting/ledger/coverage.mjs +36 -3
  63. package/dist/lib/reporting/ledger/handler.js +7 -4
  64. package/dist/lib/reporting/ledger/handler.mjs +7 -4
  65. package/dist/lib/reporting/ledger/producer.js +215 -69
  66. package/dist/lib/reporting/ledger/producer.mjs +217 -70
  67. package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
  68. package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
  69. package/dist/lib/reporting/ledger/schedule.js +8 -5
  70. package/dist/lib/reporting/ledger/schedule.mjs +8 -5
  71. package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
  72. package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
  73. package/dist/lib/reporting/ledger/status-ingest.js +4 -3
  74. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
  75. package/dist/lib/reporting/ledger/types.d.mts +36 -1
  76. package/dist/lib/reporting/ledger/types.d.ts +36 -1
  77. package/dist/lib/reporting/service/index.d.mts +14 -1
  78. package/dist/lib/reporting/service/index.d.ts +14 -1
  79. package/dist/lib/reporting/service/index.js +24 -12
  80. package/dist/lib/reporting/service/index.mjs +24 -12
  81. package/dist/lib/schemas/browser.d.mts +2 -0
  82. package/dist/lib/schemas/browser.d.ts +2 -0
  83. package/dist/lib/schemas/browser.js +3 -0
  84. package/dist/lib/schemas/browser.mjs +2 -0
  85. package/dist/lib/schemas/index.d.mts +5 -3
  86. package/dist/lib/schemas/index.d.ts +5 -3
  87. package/dist/lib/schemas/index.js +5 -0
  88. package/dist/lib/schemas/index.mjs +4 -0
  89. package/dist/lib/server/account-response-identity.d.mts +17 -0
  90. package/dist/lib/server/account-response-identity.d.ts +17 -0
  91. package/dist/lib/server/account-response-identity.js +52 -0
  92. package/dist/lib/server/account-response-identity.mjs +28 -0
  93. package/dist/lib/server/account-sync-contract.js +2 -2
  94. package/dist/lib/server/account-sync-contract.mjs +2 -2
  95. package/dist/lib/server/create-adcp-server.js +33 -20
  96. package/dist/lib/server/create-adcp-server.mjs +36 -12
  97. package/dist/lib/server/decisioning/account.d.mts +36 -10
  98. package/dist/lib/server/decisioning/account.d.ts +36 -10
  99. package/dist/lib/server/decisioning/account.js +33 -14
  100. package/dist/lib/server/decisioning/account.mjs +33 -14
  101. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
  102. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
  103. package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
  104. package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
  105. package/dist/lib/server/media-buy-store.d.mts +26 -12
  106. package/dist/lib/server/media-buy-store.d.ts +26 -12
  107. package/dist/lib/server/media-buy-store.js +69 -21
  108. package/dist/lib/server/media-buy-store.mjs +69 -21
  109. package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
  110. package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
  111. package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
  112. package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
  113. package/dist/lib/server/responses.js +9 -1
  114. package/dist/lib/server/responses.mjs +9 -1
  115. package/dist/lib/signing/agent-fetch.d.mts +1 -1
  116. package/dist/lib/signing/agent-fetch.d.ts +1 -1
  117. package/dist/lib/signing/agent-fetch.js +3 -3
  118. package/dist/lib/signing/agent-fetch.mjs +3 -3
  119. package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
  120. package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
  121. package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
  122. package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
  123. package/dist/lib/testing/storyboard/compliance.js +62 -13
  124. package/dist/lib/testing/storyboard/compliance.mjs +63 -14
  125. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
  126. package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
  127. package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
  128. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
  129. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  130. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  131. package/dist/lib/types/accept-proposal.d.ts +20 -28
  132. package/dist/lib/types/asset-instances.d.mts +1 -1
  133. package/dist/lib/types/asset-instances.d.ts +1 -1
  134. package/dist/lib/types/buy-products.d.ts +20 -28
  135. package/dist/lib/types/check-governance.d.ts +20 -28
  136. package/dist/lib/types/comply-test-controller.d.ts +20 -28
  137. package/dist/lib/types/control-media-buy.d.ts +20 -28
  138. package/dist/lib/types/core.generated.d.mts +273 -184
  139. package/dist/lib/types/core.generated.d.ts +273 -184
  140. package/dist/lib/types/create-media-buy.d.ts +20 -28
  141. package/dist/lib/types/get-media-buys.d.ts +20 -28
  142. package/dist/lib/types/get-products.d.ts +20 -28
  143. package/dist/lib/types/index.d.mts +6 -1
  144. package/dist/lib/types/index.d.ts +6 -1
  145. package/dist/lib/types/index.js +6 -1
  146. package/dist/lib/types/index.mjs +4 -1
  147. package/dist/lib/types/inline-enums.generated.d.mts +30 -4
  148. package/dist/lib/types/inline-enums.generated.d.ts +30 -4
  149. package/dist/lib/types/inline-enums.generated.js +41 -2
  150. package/dist/lib/types/inline-enums.generated.mjs +28 -2
  151. package/dist/lib/types/list-products.d.ts +20 -28
  152. package/dist/lib/types/list-proposals.d.ts +20 -28
  153. package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
  154. package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
  155. package/dist/lib/types/media-buy-delivery-report.js +16 -0
  156. package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
  157. package/dist/lib/types/refine-proposals.d.ts +20 -28
  158. package/dist/lib/types/request-proposals.d.ts +20 -28
  159. package/dist/lib/types/schemas.generated.d.ts +63113 -127273
  160. package/dist/lib/types/schemas.generated.js +759 -770
  161. package/dist/lib/types/schemas.generated.mjs +759 -770
  162. package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
  163. package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
  164. package/dist/lib/types/targeting-keys.generated.js +109 -0
  165. package/dist/lib/types/targeting-keys.generated.mjs +84 -0
  166. package/dist/lib/types/tools.generated.d.mts +2 -68
  167. package/dist/lib/types/tools.generated.d.ts +2 -68
  168. package/dist/lib/types/update-media-buy.d.ts +20 -28
  169. package/dist/lib/utils/adcp-version-config.js +5 -2
  170. package/dist/lib/utils/adcp-version-config.mjs +5 -2
  171. package/dist/lib/utils/response-unwrapper.js +6 -1
  172. package/dist/lib/utils/response-unwrapper.mjs +6 -1
  173. package/dist/lib/v2/format-schema/resolver.js +1 -1
  174. package/dist/lib/v2/format-schema/resolver.mjs +1 -1
  175. package/dist/lib/v2/projection/creative-delivery.js +104 -29
  176. package/dist/lib/v2/projection/creative-delivery.mjs +108 -29
  177. package/dist/lib/v2/projection/index.d.mts +1 -0
  178. package/dist/lib/v2/projection/index.d.ts +1 -0
  179. package/dist/lib/v2/projection/index.js +3 -0
  180. package/dist/lib/v2/projection/index.mjs +2 -0
  181. package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
  182. package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
  183. package/dist/lib/v2/projection/legacy-metadata.js +91 -0
  184. package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
  185. package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
  186. package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
  187. package/dist/lib/v2/projection/v1-to-v2.js +12 -9
  188. package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
  189. package/dist/lib/validation/budget-allocation.d.mts +3 -3
  190. package/dist/lib/validation/budget-allocation.d.ts +3 -3
  191. package/dist/lib/validation/compact-schema.d.mts +27 -0
  192. package/dist/lib/validation/compact-schema.d.ts +27 -0
  193. package/dist/lib/validation/compact-schema.js +276 -0
  194. package/dist/lib/validation/compact-schema.mjs +250 -0
  195. package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
  196. package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
  197. package/dist/lib/validation/media-buy-delivery-report.js +31 -0
  198. package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
  199. package/dist/lib/validation/nonempty-array.d.mts +15 -0
  200. package/dist/lib/validation/nonempty-array.d.ts +15 -0
  201. package/dist/lib/validation/nonempty-array.js +41 -0
  202. package/dist/lib/validation/nonempty-array.mjs +7 -0
  203. package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
  204. package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
  205. package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
  206. package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
  207. package/dist/lib/validation/schema-loader.js +86 -16
  208. package/dist/lib/validation/schema-loader.mjs +82 -16
  209. package/dist/lib/validation/schema-validator.d.mts +10 -19
  210. package/dist/lib/validation/schema-validator.d.ts +10 -19
  211. package/dist/lib/validation/schema-validator.js +135 -42
  212. package/dist/lib/validation/schema-validator.mjs +139 -43
  213. package/dist/lib/validation/sync-creatives.d.mts +22 -22
  214. package/dist/lib/validation/sync-creatives.d.ts +22 -22
  215. package/dist/lib/version.d.mts +3 -3
  216. package/dist/lib/version.d.ts +3 -3
  217. package/dist/lib/version.js +3 -3
  218. package/dist/lib/version.mjs +3 -3
  219. package/dist/lib/webhooks/index.d.mts +3 -0
  220. package/dist/lib/webhooks/index.d.ts +3 -0
  221. package/dist/lib/webhooks/index.js +3 -0
  222. package/dist/lib/webhooks/index.mjs +2 -0
  223. package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
  224. package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
  225. package/dist/lib/webhooks/media-buy-delivery.js +119 -0
  226. package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
  227. package/docs/TYPE-SUMMARY.md +2 -2
  228. package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
  229. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +15 -0
  230. package/docs/guides/REPORTING-LEDGER.md +93 -0
  231. package/docs/guides/REPORTING-STABILITY.md +1 -1
  232. package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
  233. package/docs/llms.txt +2 -2
  234. package/docs/migration-14.x-rc-worksheet.md +4 -4
  235. package/docs/migration-16-to-17.md +191 -14
  236. package/docs/migration-6.6-to-6.7.md +14 -0
  237. package/docs/migration-account-change-feed.md +15 -0
  238. package/docs/recipes/verifying-inbound-webhooks.md +18 -2
  239. package/package.json +2 -2
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var account_response_identity_exports = {};
20
+ __export(account_response_identity_exports, {
21
+ projectAccountResponseIdentityFields: () => projectAccountResponseIdentityFields
22
+ });
23
+ module.exports = __toCommonJS(account_response_identity_exports);
24
+ var import_schema_loader = require('../validation/schema-loader.js');
25
+ const IDENTITY_RESPONSE_SCHEMAS = {
26
+ account: "core/account-ref.json",
27
+ operator_unit: "core/operator-unit.json",
28
+ identity_change: "core/account-identity-change.json",
29
+ identity_change_preview: "core/account-identity-change-preview.json"
30
+ };
31
+ function projectAccountResponseIdentityFields(account) {
32
+ const fields = account;
33
+ const projected = {};
34
+ for (const [field, schemaRef] of Object.entries(IDENTITY_RESPONSE_SCHEMAS)) {
35
+ const value = fields[field];
36
+ if (value === void 0) continue;
37
+ const snapshot = structuredClone(value);
38
+ const validate = (0, import_schema_loader.getSchemaValidatorByRef)(schemaRef);
39
+ if (!validate) throw new Error(`Account response identity schema unavailable: ${schemaRef}.`);
40
+ if (!validate(snapshot)) {
41
+ throw new Error(
42
+ `Account response ${field} must match its canonical identity schema without retained internal fields.`
43
+ );
44
+ }
45
+ Object.assign(projected, { [field]: snapshot });
46
+ }
47
+ return projected;
48
+ }
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ projectAccountResponseIdentityFields
52
+ });
@@ -0,0 +1,28 @@
1
+ import { getSchemaValidatorByRef } from "../validation/schema-loader.mjs";
2
+ const IDENTITY_RESPONSE_SCHEMAS = {
3
+ account: "core/account-ref.json",
4
+ operator_unit: "core/operator-unit.json",
5
+ identity_change: "core/account-identity-change.json",
6
+ identity_change_preview: "core/account-identity-change-preview.json"
7
+ };
8
+ function projectAccountResponseIdentityFields(account) {
9
+ const fields = account;
10
+ const projected = {};
11
+ for (const [field, schemaRef] of Object.entries(IDENTITY_RESPONSE_SCHEMAS)) {
12
+ const value = fields[field];
13
+ if (value === void 0) continue;
14
+ const snapshot = structuredClone(value);
15
+ const validate = getSchemaValidatorByRef(schemaRef);
16
+ if (!validate) throw new Error(`Account response identity schema unavailable: ${schemaRef}.`);
17
+ if (!validate(snapshot)) {
18
+ throw new Error(
19
+ `Account response ${field} must match its canonical identity schema without retained internal fields.`
20
+ );
21
+ }
22
+ Object.assign(projected, { [field]: snapshot });
23
+ }
24
+ return projected;
25
+ }
26
+ export {
27
+ projectAccountResponseIdentityFields
28
+ };
@@ -205,9 +205,9 @@ async function checkSyncAccountRows(accounts, entries, existing, rows, indices,
205
205
  field: `accounts[${index}]${termsViolation ? ".payment_terms" : billingViolation ? ".billing" : ""}`
206
206
  }
207
207
  ).toStructuredError();
208
+ const anchor = row.account !== void 0 ? { account: row.account } : { brand: row.brand, operator: row.operator };
208
209
  row = {
209
- brand: row.brand,
210
- operator: row.operator,
210
+ ...anchor,
211
211
  ...priorId === row.account_id && priorId && { account_id: priorId },
212
212
  action: "failed",
213
213
  status: existing[offset]?.status ?? row.status,
@@ -178,9 +178,9 @@ async function checkSyncAccountRows(accounts, entries, existing, rows, indices,
178
178
  field: `accounts[${index}]${termsViolation ? ".payment_terms" : billingViolation ? ".billing" : ""}`
179
179
  }
180
180
  ).toStructuredError();
181
+ const anchor = row.account !== void 0 ? { account: row.account } : { brand: row.brand, operator: row.operator };
181
182
  row = {
182
- brand: row.brand,
183
- operator: row.operator,
183
+ ...anchor,
184
184
  ...priorId === row.account_id && priorId && { account_id: priorId },
185
185
  action: "failed",
186
186
  status: existing[offset]?.status ?? row.status,
@@ -30,6 +30,7 @@ __export(create_adcp_server_exports, {
30
30
  requireSessionKey: () => requireSessionKey
31
31
  });
32
32
  module.exports = __toCommonJS(create_adcp_server_exports);
33
+ var import_adcp_version_config = require('../utils/adcp-version-config.js');
33
34
  var import_web_bot_auth = require('../signing/web-bot-auth.js');
34
35
  var import_version = require('../adapters/version/index.js');
35
36
  var import_schema_loader = require('../validation/schema-loader.js');
@@ -40,7 +41,7 @@ var import_validation = require('../identity-3.3/validation.js');
40
41
  var import_trust = require('../identity-3.3/trust.js');
41
42
  var import_zod = require("zod");
42
43
  var import_version2 = require('../version.js');
43
- var import_adcp_version_config = require('../utils/adcp-version-config.js');
44
+ var import_adcp_version_config2 = require('../utils/adcp-version-config.js');
44
45
  var import_errors = require('../errors/index.js');
45
46
  var import_schema_loader2 = require('../validation/schema-loader.js');
46
47
  var import_schemas = require('../schemas/index.js');
@@ -962,8 +963,7 @@ function projectValueToCapabilitySchema(root, schema, value, depth = 0) {
962
963
  return projectedObject;
963
964
  }
964
965
  function projectCapabilitiesToVersion(data, version) {
965
- const validator = (0, import_schema_loader2.getValidator)("get_adcp_capabilities", "sync", version);
966
- const schema = asProjectionSchema(validator?.schema);
966
+ const schema = asProjectionSchema((0, import_schema_loader2.getToolSchemaDocument)("get_adcp_capabilities", "sync", version)?.schema);
967
967
  if (!schema) return data;
968
968
  const projected = projectValueToCapabilitySchema(schema, schema, data);
969
969
  if (!isPlainObject(projected)) return data;
@@ -1392,7 +1392,9 @@ function injectContextIntoResponse(response, context) {
1392
1392
  syncContentJsonText(response, sc, mirrorsStructuredContent);
1393
1393
  }
1394
1394
  }
1395
- function injectEnvelopeStatusIntoResponse(response, toolName) {
1395
+ function injectEnvelopeStatusIntoResponse(response, toolName, servedVersion) {
1396
+ if (servedVersion && (0, import_adcp_version_config.isPre31AdcpVersion)(servedVersion) && MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName) && response.isError !== true)
1397
+ return;
1396
1398
  const sc = response.structuredContent;
1397
1399
  if (!sc || typeof sc !== "object") return;
1398
1400
  if ("status" in sc) return;
@@ -1416,12 +1418,23 @@ const MEDIA_BUY_STATUS_VALUES = /* @__PURE__ */ new Set([
1416
1418
  "rejected",
1417
1419
  "canceled"
1418
1420
  ]);
1419
- function normalizeMediaBuyStatusCollision(response, toolName) {
1421
+ function normalizeMediaBuyStatusCollision(response, toolName, servedVersion) {
1420
1422
  if (!MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName)) return;
1421
1423
  const sc = response.structuredContent;
1422
1424
  if (!sc || typeof sc !== "object") return;
1425
+ if (servedVersion && (0, import_adcp_version_config.isPre31AdcpVersion)(servedVersion)) {
1426
+ const adapted = typeof sc.media_buy_status === "string" ? (0, import_version.getVersionAdapter)("3.0", toolName)?.downgradeResponse?.(sc) : void 0;
1427
+ if (adapted && adapted.data !== sc && adapted.data && typeof adapted.data === "object") {
1428
+ const mirrors = contentTextMirrorsStructuredContent(response, sc);
1429
+ response.structuredContent = adapted.data;
1430
+ syncContentJsonText(response, response.structuredContent, mirrors);
1431
+ }
1432
+ return;
1433
+ }
1423
1434
  const status = sc.status;
1424
1435
  if (typeof status !== "string" || !MEDIA_BUY_STATUS_VALUES.has(status)) return;
1436
+ if (servedVersion && sc.media_buy_status === void 0 && (status === "completed" || status === "rejected" || status === "canceled"))
1437
+ return;
1425
1438
  const looksLikeMediaBuyPayload = typeof sc.media_buy_id === "string" || "media_buy_status" in sc || Array.isArray(sc.packages);
1426
1439
  if (!looksLikeMediaBuyPayload) return;
1427
1440
  const mirrorsStructuredContent = contentTextMirrorsStructuredContent(response, sc);
@@ -1798,7 +1811,7 @@ function supportedVersionsForTool(toolName, ranges, capConfig, serverPin) {
1798
1811
  }
1799
1812
  const PUSH_OPERATION_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,255}$/;
1800
1813
  function releaseRequiresPushOperationId(release) {
1801
- return (0, import_adcp_version_config.isAdcpVersionAtLeast)((0, import_schema_loader2.resolveBundleKey)(release), "3.2.0-beta.5");
1814
+ return (0, import_adcp_version_config2.isAdcpVersionAtLeast)((0, import_schema_loader2.resolveBundleKey)(release), "3.2.0-beta.5");
1802
1815
  }
1803
1816
  function pushOperationIdError(params, release) {
1804
1817
  const config = params.push_notification_config;
@@ -2082,18 +2095,18 @@ function createAdcpServer(config) {
2082
2095
  logger.warn(message);
2083
2096
  }
2084
2097
  const credentialPolicyPatterns = credentialPolicy === void 0 || typeof credentialPolicy === "string" ? void 0 : credentialPolicy.patterns;
2085
- const adcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(
2098
+ const adcpVersion = (0, import_adcp_version_config2.resolveAdcpVersion)(
2086
2099
  configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ? import_version3.ADCP_VERSION : void 0)
2087
2100
  );
2088
2101
  const toolVersionRanges = parseToolVersionRanges(config.toolVersions);
2089
2102
  const toolAvailableForRelease = (toolName, release) => toolIsAvailableInRelease(toolVersionRanges, toolName, release);
2090
- const movingSupportedVersion = capConfig?.supported_versions?.find(import_adcp_version_config.isMovingAdcpPrereleaseFamilyAlias);
2103
+ const movingSupportedVersion = capConfig?.supported_versions?.find(import_adcp_version_config2.isMovingAdcpPrereleaseFamilyAlias);
2091
2104
  if (movingSupportedVersion) {
2092
2105
  throw new Error(
2093
2106
  `createAdcpServer: capabilities.supported_versions contains moving prerelease-family alias ${JSON.stringify(movingSupportedVersion)}; pin ${JSON.stringify((0, import_version2.toReleasePrecisionVersion)(import_version3.ADCP_VERSION))} instead`
2094
2107
  );
2095
2108
  }
2096
- const configuredDefaultVersion = configuredDefaultAdcpVersion === void 0 ? void 0 : (0, import_adcp_version_config.resolveAdcpVersion)(configuredDefaultAdcpVersion, "defaultAdcpVersion");
2109
+ const configuredDefaultVersion = configuredDefaultAdcpVersion === void 0 ? void 0 : (0, import_adcp_version_config2.resolveAdcpVersion)(configuredDefaultAdcpVersion, "defaultAdcpVersion");
2097
2110
  const maximumRelease = parseAdcpRelease(adcpVersion);
2098
2111
  const requestedDefaultRelease = configuredDefaultVersion === void 0 ? void 0 : parseAdcpRelease(configuredDefaultVersion);
2099
2112
  if (maximumRelease === void 0) {
@@ -2430,8 +2443,8 @@ function createAdcpServer(config) {
2430
2443
  enrichErrorTwoLayer(response, toolName, (0, import_error_arm_tools.getToolsWithErrorArm)(release.validationVersion));
2431
2444
  if (!isErrorResponse(response)) {
2432
2445
  response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
2433
- normalizeMediaBuyStatusCollision(response, toolName);
2434
- injectEnvelopeStatusIntoResponse(response, toolName);
2446
+ normalizeMediaBuyStatusCollision(response, toolName, release.validationVersion);
2447
+ injectEnvelopeStatusIntoResponse(response, toolName, release.validationVersion);
2435
2448
  const validationError = protocolTaskResponseValidationError(toolName, response, params);
2436
2449
  if (validationError) return finalizeProtocolTaskToolResponse(toolName, params, validationError, opts);
2437
2450
  }
@@ -2810,8 +2823,8 @@ function createAdcpServer(config) {
2810
2823
  const finalizeProtocolEnvelope = (response) => {
2811
2824
  sanitizeAdcpErrorEnvelope(response);
2812
2825
  enrichErrorTwoLayer(response, toolName, requestErrorArms);
2813
- normalizeMediaBuyStatusCollision(response, toolName);
2814
- injectEnvelopeStatusIntoResponse(response, toolName);
2826
+ normalizeMediaBuyStatusCollision(response, toolName, requestRelease.validationVersion);
2827
+ injectEnvelopeStatusIntoResponse(response, toolName, requestRelease.validationVersion);
2815
2828
  injectContextIntoResponse(response, params.context);
2816
2829
  injectVersionIntoResponse(response, requestRelease.wireVersion);
2817
2830
  return response;
@@ -2840,7 +2853,7 @@ function createAdcpServer(config) {
2840
2853
  const offered = capabilitiesData.webhook_signing?.profiles ?? [
2841
2854
  "adcp/webhook-signing/v1"
2842
2855
  ];
2843
- if (typeof selectedProfile !== "string" || !offered.includes(selectedProfile) || selectedProfile === "web-bot-auth" && (!config.identity33 || !(0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")) || selectedProfile === "web-bot-auth" && registration.authentication !== void 0)
2856
+ if (typeof selectedProfile !== "string" || !offered.includes(selectedProfile) || selectedProfile === "web-bot-auth" && (!config.identity33 || !(0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")) || selectedProfile === "web-bot-auth" && registration.authentication !== void 0)
2844
2857
  return finalize(
2845
2858
  (0, import_errors2.adcpError)("INVALID_REQUEST", {
2846
2859
  message: "Unsupported or ambiguous webhook signing profile",
@@ -3028,7 +3041,7 @@ function createAdcpServer(config) {
3028
3041
  params,
3029
3042
  requestRelease.validationVersion,
3030
3043
  proposalRefinementCapabilities,
3031
- !!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
3044
+ !!config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
3032
3045
  );
3033
3046
  if (!outcome.valid) {
3034
3047
  if ("refinementError" in outcome && outcome.refinementError?.code === "UNSUPPORTED_FEATURE") {
@@ -3101,7 +3114,7 @@ function createAdcpServer(config) {
3101
3114
  }
3102
3115
  }
3103
3116
  let unresolvedAccountPassThrough = false;
3104
- const requireVerifiedAccountReferences = strictAccountReferences || (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.validationVersion, "3.3.0-beta.0");
3117
+ const requireVerifiedAccountReferences = strictAccountReferences || (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.validationVersion, "3.3.0-beta.0");
3105
3118
  const suppliedAccountRef = hasAccount && params.account != null && !(requireVerifiedAccountReferences && toolName === "list_accounts");
3106
3119
  if (suppliedAccountRef && toolName === "list_accounts") {
3107
3120
  (0, import_account_reference_warnings.warnAccountReferenceDeprecation)(
@@ -4003,8 +4016,8 @@ function createAdcpServer(config) {
4003
4016
  formatted = normalizeGetProductsCacheScope(formatted, params, ctx.account, ctx.authInfo, exposeErrorDetails) ?? formatted;
4004
4017
  }
4005
4018
  if (!isErrorResponse(formatted)) {
4006
- normalizeMediaBuyStatusCollision(formatted, toolName);
4007
- injectEnvelopeStatusIntoResponse(formatted, toolName);
4019
+ normalizeMediaBuyStatusCollision(formatted, toolName, adcpVersion);
4020
+ injectEnvelopeStatusIntoResponse(formatted, toolName, adcpVersion);
4008
4021
  }
4009
4022
  }
4010
4023
  if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
@@ -4040,7 +4053,7 @@ function createAdcpServer(config) {
4040
4053
  payload,
4041
4054
  requestRelease.validationVersion,
4042
4055
  void 0,
4043
- !!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
4056
+ !!config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
4044
4057
  );
4045
4058
  if (!outcome.valid) {
4046
4059
  logger.warn(
@@ -4935,7 +4948,7 @@ function createAdcpServer(config) {
4935
4948
  delete validationPayload.media_buy.proposal_refinement;
4936
4949
  delete validationPayload.media_buy.lifecycle_tools;
4937
4950
  }
4938
- const responseOutcome = config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(release.wireVersion, "3.3") ? (0, import_validation.validateIdentity33Payload)(
4951
+ const responseOutcome = config.identity33 && (0, import_adcp_version_config2.isAdcpVersionAtLeast)(release.wireVersion, "3.3") ? (0, import_validation.validateIdentity33Payload)(
4939
4952
  "get_adcp_capabilities",
4940
4953
  "response",
4941
4954
  validationPayload,
@@ -1,5 +1,11 @@
1
+ import { isPre31AdcpVersion } from "../utils/adcp-version-config.mjs";
1
2
  import { assertWebBotAuthSigningKey, getWebBotAuthLegacyOriginGate } from "../signing/web-bot-auth.mjs";
2
- import { downgradeResponse, translationSteps, upgradeRequest } from "../adapters/version/index.mjs";
3
+ import {
4
+ downgradeResponse,
5
+ getVersionAdapter,
6
+ translationSteps,
7
+ upgradeRequest
8
+ } from "../adapters/version/index.mjs";
3
9
  import {
4
10
  isIdentity33SchemaScope,
5
11
  withIdentity33SchemaScope,
@@ -37,7 +43,13 @@ import {
37
43
  resolveAdcpVersion
38
44
  } from "../utils/adcp-version-config.mjs";
39
45
  import { ConfigurationError } from "../errors/index.mjs";
40
- import { getValidator, hasSchemaBundle, resolveBundleKey, getMcpProfileInputSchema } from "../validation/schema-loader.mjs";
46
+ import {
47
+ getValidator,
48
+ getToolSchemaDocument,
49
+ hasSchemaBundle,
50
+ resolveBundleKey,
51
+ getMcpProfileInputSchema
52
+ } from "../validation/schema-loader.mjs";
41
53
  import { TOOL_INPUT_SHAPES } from "../schemas/index.mjs";
42
54
  import { TaskTypeValues } from "../types/enums.generated.mjs";
43
55
  import { bundleSupportsAdcpVersionField } from "../protocols/index.mjs";
@@ -1053,8 +1065,7 @@ function projectValueToCapabilitySchema(root, schema, value, depth = 0) {
1053
1065
  return projectedObject;
1054
1066
  }
1055
1067
  function projectCapabilitiesToVersion(data, version) {
1056
- const validator = getValidator("get_adcp_capabilities", "sync", version);
1057
- const schema = asProjectionSchema(validator?.schema);
1068
+ const schema = asProjectionSchema(getToolSchemaDocument("get_adcp_capabilities", "sync", version)?.schema);
1058
1069
  if (!schema) return data;
1059
1070
  const projected = projectValueToCapabilitySchema(schema, schema, data);
1060
1071
  if (!isPlainObject(projected)) return data;
@@ -1483,7 +1494,9 @@ function injectContextIntoResponse(response, context) {
1483
1494
  syncContentJsonText(response, sc, mirrorsStructuredContent);
1484
1495
  }
1485
1496
  }
1486
- function injectEnvelopeStatusIntoResponse(response, toolName) {
1497
+ function injectEnvelopeStatusIntoResponse(response, toolName, servedVersion) {
1498
+ if (servedVersion && isPre31AdcpVersion(servedVersion) && MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName) && response.isError !== true)
1499
+ return;
1487
1500
  const sc = response.structuredContent;
1488
1501
  if (!sc || typeof sc !== "object") return;
1489
1502
  if ("status" in sc) return;
@@ -1507,12 +1520,23 @@ const MEDIA_BUY_STATUS_VALUES = /* @__PURE__ */ new Set([
1507
1520
  "rejected",
1508
1521
  "canceled"
1509
1522
  ]);
1510
- function normalizeMediaBuyStatusCollision(response, toolName) {
1523
+ function normalizeMediaBuyStatusCollision(response, toolName, servedVersion) {
1511
1524
  if (!MEDIA_BUY_RESPONSE_TOOLS_REQUIRING_STATUS_SPLIT.has(toolName)) return;
1512
1525
  const sc = response.structuredContent;
1513
1526
  if (!sc || typeof sc !== "object") return;
1527
+ if (servedVersion && isPre31AdcpVersion(servedVersion)) {
1528
+ const adapted = typeof sc.media_buy_status === "string" ? getVersionAdapter("3.0", toolName)?.downgradeResponse?.(sc) : void 0;
1529
+ if (adapted && adapted.data !== sc && adapted.data && typeof adapted.data === "object") {
1530
+ const mirrors = contentTextMirrorsStructuredContent(response, sc);
1531
+ response.structuredContent = adapted.data;
1532
+ syncContentJsonText(response, response.structuredContent, mirrors);
1533
+ }
1534
+ return;
1535
+ }
1514
1536
  const status = sc.status;
1515
1537
  if (typeof status !== "string" || !MEDIA_BUY_STATUS_VALUES.has(status)) return;
1538
+ if (servedVersion && sc.media_buy_status === void 0 && (status === "completed" || status === "rejected" || status === "canceled"))
1539
+ return;
1516
1540
  const looksLikeMediaBuyPayload = typeof sc.media_buy_id === "string" || "media_buy_status" in sc || Array.isArray(sc.packages);
1517
1541
  if (!looksLikeMediaBuyPayload) return;
1518
1542
  const mirrorsStructuredContent = contentTextMirrorsStructuredContent(response, sc);
@@ -2521,8 +2545,8 @@ function createAdcpServer(config) {
2521
2545
  enrichErrorTwoLayer(response, toolName, getToolsWithErrorArm(release.validationVersion));
2522
2546
  if (!isErrorResponse(response)) {
2523
2547
  response = downgradeTaskStatusResult(toolName, response, release.validationVersion);
2524
- normalizeMediaBuyStatusCollision(response, toolName);
2525
- injectEnvelopeStatusIntoResponse(response, toolName);
2548
+ normalizeMediaBuyStatusCollision(response, toolName, release.validationVersion);
2549
+ injectEnvelopeStatusIntoResponse(response, toolName, release.validationVersion);
2526
2550
  const validationError = protocolTaskResponseValidationError(toolName, response, params);
2527
2551
  if (validationError) return finalizeProtocolTaskToolResponse(toolName, params, validationError, opts);
2528
2552
  }
@@ -2901,8 +2925,8 @@ function createAdcpServer(config) {
2901
2925
  const finalizeProtocolEnvelope = (response) => {
2902
2926
  sanitizeAdcpErrorEnvelope(response);
2903
2927
  enrichErrorTwoLayer(response, toolName, requestErrorArms);
2904
- normalizeMediaBuyStatusCollision(response, toolName);
2905
- injectEnvelopeStatusIntoResponse(response, toolName);
2928
+ normalizeMediaBuyStatusCollision(response, toolName, requestRelease.validationVersion);
2929
+ injectEnvelopeStatusIntoResponse(response, toolName, requestRelease.validationVersion);
2906
2930
  injectContextIntoResponse(response, params.context);
2907
2931
  injectVersionIntoResponse(response, requestRelease.wireVersion);
2908
2932
  return response;
@@ -4094,8 +4118,8 @@ function createAdcpServer(config) {
4094
4118
  formatted = normalizeGetProductsCacheScope(formatted, params, ctx.account, ctx.authInfo, exposeErrorDetails) ?? formatted;
4095
4119
  }
4096
4120
  if (!isErrorResponse(formatted)) {
4097
- normalizeMediaBuyStatusCollision(formatted, toolName);
4098
- injectEnvelopeStatusIntoResponse(formatted, toolName);
4121
+ normalizeMediaBuyStatusCollision(formatted, toolName, adcpVersion);
4122
+ injectEnvelopeStatusIntoResponse(formatted, toolName, adcpVersion);
4099
4123
  }
4100
4124
  }
4101
4125
  if (translatesRelease && !isErrorResponse(formatted) && formatted.structuredContent) {
@@ -633,11 +633,10 @@ export interface AccountStore<TCtxMeta = Record<string, unknown>> {
633
633
  * already run, and note the framework performs no such check for
634
634
  * `'explicit'` / `'implicit'`, where the entry key is buyer-declared.
635
635
  *
636
- * **Rows must carry `brand` + `operator`** (`sync-accounts-response.json`
637
- * requires them on every row, including `action: 'failed'`). Echo them from
638
- * your own account record on settings-update results. If your upstream
639
- * accounts have no expressible natural key, don't wire this method — see
640
- * adcontextprotocol/adcp#7517.
636
+ * **Echo the selected release's identity anchor.** AdCP 3.2+ settings-update
637
+ * rows carry `account` instead of flat `brand` + `operator`; provisioning
638
+ * rows carry the natural key. Older releases require `brand` + `operator`
639
+ * on every row. Failed 3.2+ rows may omit an unknown lifecycle `status`.
641
640
  *
642
641
  * In AdCP 3.1 beta, adopters that need settings-update entries with
643
642
  * `notification_configs[]` can read the full wire body from `ctx.input`
@@ -890,18 +889,26 @@ export type AccountFilter = ListAccountsRequest;
890
889
  * returned rows — same MUST-NOT-LEAK rule the framework enforces on
891
890
  * `Account.authInfo`.
892
891
  */
893
- export interface SyncAccountsResultRow {
892
+ interface SyncAccountsResultFields {
894
893
  account_id?: string;
895
- brand: BrandReference;
896
- operator: string;
894
+ /** Current canonical operator unit, distinct from the seller account ID. */
895
+ operator_unit?: SyncAccountsRow['operator_unit'];
896
+ /** Current persisted account revision, including during a dry-run preview. */
897
+ revision?: SyncAccountsRow['revision'];
898
+ /** Pending or rejected desired identity; canonical fields remain unchanged. */
899
+ identity_change?: SyncAccountsRow['identity_change'];
900
+ /** Non-persisted evaluation of an identity change requested in a dry run. */
901
+ identity_change_preview?: SyncAccountsRow['identity_change_preview'];
902
+ currency?: SyncAccountsRow['currency'];
903
+ timezone?: SyncAccountsRow['timezone'];
897
904
  /** Human-readable account name assigned by the seller. */
898
905
  name?: string;
899
- action: 'created' | 'updated' | 'unchanged' | 'failed';
900
- status: AdcpAccountStatus;
901
906
  /** Invoiced-to party. Echoes the request's `billing` after seller acceptance. */
902
907
  billing?: BillingParty;
903
908
  /** Business entity invoiced. `bank` is stripped on emit (write-only). */
904
909
  billing_entity?: BusinessEntity;
910
+ /** Request-only staging data. The entire field MUST NOT appear in responses. */
911
+ destination_billing_entity?: never;
905
912
  account_scope?: AccountScope;
906
913
  /** Setup payload for `pending_approval` accounts (URL/message/expiry). */
907
914
  setup?: WireAccount['setup'];
@@ -926,6 +933,25 @@ export interface SyncAccountsResultRow {
926
933
  warnings?: string[];
927
934
  sandbox?: boolean;
928
935
  }
936
+ /**
937
+ * Provisioning results use the natural key; 3.2+ settings-update results use
938
+ * account instead. Only failed results can omit an unknown lifecycle status.
939
+ */
940
+ export type SyncAccountsResultRow = SyncAccountsResultFields & ({
941
+ account: NonNullable<SyncAccountsRow['account']>;
942
+ brand?: never;
943
+ operator?: never;
944
+ } | {
945
+ account?: never;
946
+ brand: BrandReference;
947
+ operator: string;
948
+ }) & ({
949
+ action: 'failed';
950
+ status?: AdcpAccountStatus;
951
+ } | {
952
+ action: 'created' | 'updated' | 'unchanged';
953
+ status: AdcpAccountStatus;
954
+ });
929
955
  export type AdcpAccountStatus = 'active' | 'pending_approval' | 'rejected' | 'payment_required' | 'suspended' | 'closed';
930
956
  /**
931
957
  * Project a framework `Account<TCtxMeta>` to the wire `Account` shape.
@@ -633,11 +633,10 @@ export interface AccountStore<TCtxMeta = Record<string, unknown>> {
633
633
  * already run, and note the framework performs no such check for
634
634
  * `'explicit'` / `'implicit'`, where the entry key is buyer-declared.
635
635
  *
636
- * **Rows must carry `brand` + `operator`** (`sync-accounts-response.json`
637
- * requires them on every row, including `action: 'failed'`). Echo them from
638
- * your own account record on settings-update results. If your upstream
639
- * accounts have no expressible natural key, don't wire this method — see
640
- * adcontextprotocol/adcp#7517.
636
+ * **Echo the selected release's identity anchor.** AdCP 3.2+ settings-update
637
+ * rows carry `account` instead of flat `brand` + `operator`; provisioning
638
+ * rows carry the natural key. Older releases require `brand` + `operator`
639
+ * on every row. Failed 3.2+ rows may omit an unknown lifecycle `status`.
641
640
  *
642
641
  * In AdCP 3.1 beta, adopters that need settings-update entries with
643
642
  * `notification_configs[]` can read the full wire body from `ctx.input`
@@ -890,18 +889,26 @@ export type AccountFilter = ListAccountsRequest;
890
889
  * returned rows — same MUST-NOT-LEAK rule the framework enforces on
891
890
  * `Account.authInfo`.
892
891
  */
893
- export interface SyncAccountsResultRow {
892
+ interface SyncAccountsResultFields {
894
893
  account_id?: string;
895
- brand: BrandReference;
896
- operator: string;
894
+ /** Current canonical operator unit, distinct from the seller account ID. */
895
+ operator_unit?: SyncAccountsRow['operator_unit'];
896
+ /** Current persisted account revision, including during a dry-run preview. */
897
+ revision?: SyncAccountsRow['revision'];
898
+ /** Pending or rejected desired identity; canonical fields remain unchanged. */
899
+ identity_change?: SyncAccountsRow['identity_change'];
900
+ /** Non-persisted evaluation of an identity change requested in a dry run. */
901
+ identity_change_preview?: SyncAccountsRow['identity_change_preview'];
902
+ currency?: SyncAccountsRow['currency'];
903
+ timezone?: SyncAccountsRow['timezone'];
897
904
  /** Human-readable account name assigned by the seller. */
898
905
  name?: string;
899
- action: 'created' | 'updated' | 'unchanged' | 'failed';
900
- status: AdcpAccountStatus;
901
906
  /** Invoiced-to party. Echoes the request's `billing` after seller acceptance. */
902
907
  billing?: BillingParty;
903
908
  /** Business entity invoiced. `bank` is stripped on emit (write-only). */
904
909
  billing_entity?: BusinessEntity;
910
+ /** Request-only staging data. The entire field MUST NOT appear in responses. */
911
+ destination_billing_entity?: never;
905
912
  account_scope?: AccountScope;
906
913
  /** Setup payload for `pending_approval` accounts (URL/message/expiry). */
907
914
  setup?: WireAccount['setup'];
@@ -926,6 +933,25 @@ export interface SyncAccountsResultRow {
926
933
  warnings?: string[];
927
934
  sandbox?: boolean;
928
935
  }
936
+ /**
937
+ * Provisioning results use the natural key; 3.2+ settings-update results use
938
+ * account instead. Only failed results can omit an unknown lifecycle status.
939
+ */
940
+ export type SyncAccountsResultRow = SyncAccountsResultFields & ({
941
+ account: NonNullable<SyncAccountsRow['account']>;
942
+ brand?: never;
943
+ operator?: never;
944
+ } | {
945
+ account?: never;
946
+ brand: BrandReference;
947
+ operator: string;
948
+ }) & ({
949
+ action: 'failed';
950
+ status?: AdcpAccountStatus;
951
+ } | {
952
+ action: 'created' | 'updated' | 'unchanged';
953
+ status: AdcpAccountStatus;
954
+ });
929
955
  export type AdcpAccountStatus = 'active' | 'pending_approval' | 'rejected' | 'payment_required' | 'suspended' | 'closed';
930
956
  /**
931
957
  * Project a framework `Account<TCtxMeta>` to the wire `Account` shape.
@@ -30,6 +30,7 @@ __export(account_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(account_exports);
32
32
  var import_reporting_delivery_config = require('../reporting-delivery-config.js');
33
+ var import_account_response_identity = require('../account-response-identity.js');
33
34
  const ACCOUNT_AUTHORIZATION_WIRE_KEYS = [
34
35
  "allowed_tasks",
35
36
  "field_scopes",
@@ -50,6 +51,30 @@ class AccountNotFoundError extends Error {
50
51
  super(message);
51
52
  }
52
53
  }
54
+ const SYNC_ACCOUNT_PASSTHROUGH_KEYS = [
55
+ "account_id",
56
+ "brand",
57
+ "operator",
58
+ "revision",
59
+ "currency",
60
+ "timezone",
61
+ "name",
62
+ "action",
63
+ "status",
64
+ "billing",
65
+ "account_scope",
66
+ "setup",
67
+ "rate_card",
68
+ "payment_terms",
69
+ "credit_limit",
70
+ "errors",
71
+ "warnings",
72
+ "sandbox"
73
+ ];
74
+ const SYNC_ACCOUNTS_RESULT_KEY_COVERAGE = {};
75
+ void SYNC_ACCOUNTS_RESULT_KEY_COVERAGE;
76
+ const SYNC_ACCOUNTS_PROJECTION_KEY_COVERAGE = {};
77
+ void SYNC_ACCOUNTS_PROJECTION_KEY_COVERAGE;
53
78
  function toWireAccount(account) {
54
79
  const wire = {
55
80
  account_id: account.id,
@@ -107,22 +132,19 @@ function projectAccountAuthorization(authorization) {
107
132
  return projected;
108
133
  }
109
134
  function toWireSyncAccountRow(row) {
135
+ const identity = (0, import_account_response_identity.projectAccountResponseIdentityFields)(row);
110
136
  const wire = {
111
- brand: row.brand,
112
- operator: row.operator,
113
137
  action: row.action,
114
- status: row.status
138
+ ...identity
115
139
  };
116
- if (row.account_id !== void 0) wire.account_id = row.account_id;
117
- if (row.name !== void 0) wire.name = row.name;
118
- if (row.billing !== void 0) wire.billing = row.billing;
140
+ const source = row;
141
+ function copyField(key) {
142
+ const value = source[key];
143
+ if (value !== void 0) wire[key] = value;
144
+ }
145
+ for (const key of SYNC_ACCOUNT_PASSTHROUGH_KEYS) copyField(key);
119
146
  const projectedEntity = projectBillingEntity(row.billing_entity);
120
147
  if (projectedEntity !== void 0) wire.billing_entity = projectedEntity;
121
- if (row.account_scope !== void 0) wire.account_scope = row.account_scope;
122
- if (row.setup !== void 0) wire.setup = row.setup;
123
- if (row.rate_card !== void 0) wire.rate_card = row.rate_card;
124
- if (row.payment_terms !== void 0) wire.payment_terms = row.payment_terms;
125
- if (row.credit_limit !== void 0) wire.credit_limit = row.credit_limit;
126
148
  if (row.notification_configs !== void 0) {
127
149
  wire.notification_configs = row.notification_configs.map(projectNotificationConfig);
128
150
  }
@@ -134,9 +156,6 @@ function toWireSyncAccountRow(row) {
134
156
  row.authorization
135
157
  );
136
158
  }
137
- if (row.errors !== void 0) wire.errors = row.errors;
138
- if (row.warnings !== void 0) wire.warnings = row.warnings;
139
- if (row.sandbox !== void 0) wire.sandbox = row.sandbox;
140
159
  return wire;
141
160
  }
142
161
  function projectNotificationConfig(config) {