@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
@@ -75,27 +75,15 @@ export type { GetProductsRequest as LegacyGetProductsRequest, GetProductsRespons
75
75
  CreativeAsset as LegacyCompatibleCreativeAsset, CreativePolicy, BrandReference, BrandID, AccountReference, CPAPricingOption, EventType, ActionSource, OptimizationGoal, ReachUnit, TargetingOverlay, OutcomeMeasurementDeprecated, OutcomeMeasurementDeprecated as OutcomeMeasurement, Duration, DeviceType, DigitalSourceType, FrequencyCap, GeographicBreakdownSupport, Catalog, CatalogType, FeedFormat, UpdateFrequency, ContentIDType, CatalogFieldMapping, SyncCatalogsRequest, SyncCatalogsResponse, SyncCatalogsSuccess, SyncCatalogsError, Overlay, Placement as LegacyPlacement, CreativeManifest as LegacyCreativeManifest, CreativeVariable, BuildCreativeRequest as LegacyBuildCreativeRequest, BuildCreativeResponse as LegacyBuildCreativeResponse, BuildCreativeSuccess as LegacyBuildCreativeSuccess, BuildCreativeMultiSuccess as LegacyBuildCreativeMultiSuccess, BuildCreativeVariantSuccess as LegacyBuildCreativeVariantSuccess, BuildCreativeError as LegacyBuildCreativeError, PreviewCreativeRequest as LegacyPreviewCreativeRequest, PreviewCreativeResponse as LegacyPreviewCreativeResponse, GetMediaBuysRequest, GetMediaBuysResponse as LegacyGetMediaBuysResponse, ImageAsset, VideoAsset, AudioAsset, TextAsset, URLAsset, HTMLAsset, VASTAsset, DAASTAsset, JavaScriptAsset, WebhookAsset, CSSAsset, MarkdownAsset, CatalogAsset, BriefAsset, ReferenceAsset, Provenance, PreviewOutputFormat, DisclosurePosition, EventCustomData, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse as LegacyGetCreativeDeliveryResponse, Account, AccountChange, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAccountsSuccess, SyncAccountsError, GetAccountFinancialsRequest, GetAccountFinancialsResponse, GetAccountFinancialsSuccess, GetAccountFinancialsError, PaginationRequest, PaginationResponse, PackageUpdate as LegacyPackageUpdate, Package as LegacyPackage, Destination, SignalFilters, PricingOption, PriceGuidance, } from './types/tools.generated.mjs';
76
76
  export type { GetMediaBuyArtifactsRequest as LegacyGetMediaBuyArtifactsRequest, GetMediaBuyArtifactsResponse as LegacyGetMediaBuyArtifactsResponse, } from './types/tools.generated.mjs';
77
77
  export type { GetRightsRequest as LegacyGetRightsRequest, GetRightsResponse as LegacyGetRightsResponse, AcquireRightsRequest as LegacyAcquireRightsRequest, AcquireRightsResponse as LegacyAcquireRightsResponse, UpdateRightsRequest as LegacyUpdateRightsRequest, UpdateRightsResponse as LegacyUpdateRightsResponse, } from './types/core.generated.mjs';
78
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
79
- export type GetMediaBuyArtifactsRequest = never;
80
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
81
- export type GetMediaBuyArtifactsResponse = never;
82
78
  export type { FormatReferenceStructuredObject as LegacyFormatReferenceStructuredObject, FormatReferenceStructuredObject as LegacyFormatID, } from './types/core.generated.mjs';
83
79
  /** @deprecated Legacy creative routing identity is available as `LegacyFormatReferenceStructuredObject`. */
84
80
  export type FormatReferenceStructuredObject = never;
85
81
  /** @deprecated Legacy creative routing identity is available as `LegacyFormatID`. */
86
82
  export type FormatID = never;
87
- /** @deprecated Use `LegacyBuildCreativeRequest`; canonical build support awaits a canonical protocol request. */
88
- export type BuildCreativeRequest = never;
89
- /** @deprecated Use `LegacyBuildCreativeResponse`. */
90
- export type BuildCreativeResponse = never;
91
83
  /** @deprecated Use `LegacyBuildCreativePayload`. */
92
84
  export type BuildCreativePayload = never;
93
85
  /** @deprecated Use `LegacyBuildCreativeMultiPayload`. */
94
86
  export type BuildCreativeMultiPayload = never;
95
- /** @deprecated Use `LegacyListCreativeFormatsRequest`. */
96
- export type ListCreativeFormatsRequest = never;
97
- /** @deprecated Use `LegacyListCreativeFormatsResponse`. */
98
- export type ListCreativeFormatsResponse = never;
99
87
  /** @deprecated Use `LegacyListCreativeFormatsPayload`. */
100
88
  export type ListCreativeFormatsPayload = never;
101
89
  /** @deprecated Use `LegacyListCreativeFormatsResponsePayload`. */
@@ -118,49 +106,9 @@ export type UpdateMediaBuyAsyncResponseData = never;
118
106
  /** @deprecated Use `LegacySyncCreativesAsyncResponseData`. */
119
107
  export type SyncCreativesAsyncResponseData = never;
120
108
  /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
121
- export type ListContentStandardsRequest = never;
122
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
123
- export type ListContentStandardsResponse = never;
124
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
125
- export type GetContentStandardsRequest = never;
126
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
127
- export type GetContentStandardsResponse = never;
128
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
129
- export type CreateContentStandardsRequest = never;
130
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
131
- export type CreateContentStandardsResponse = never;
132
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
133
- export type UpdateContentStandardsRequest = never;
134
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
135
- export type UpdateContentStandardsResponse = never;
136
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
137
- export type CalibrateContentRequest = never;
138
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
139
- export type CalibrateContentResponse = never;
140
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
141
- export type ValidateContentDeliveryRequest = never;
142
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
143
- export type ValidateContentDeliveryResponse = never;
144
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
145
- export type GetCreativeFeaturesRequest = never;
146
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
147
- export type GetCreativeFeaturesResponse = never;
148
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
149
109
  export type ContentStandards = never;
150
110
  /** @deprecated Use `LegacyArtifact` from the migration surface. */
151
111
  export type Artifact = never;
152
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
153
- export type GetRightsRequest = never;
154
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
155
- export type GetRightsResponse = never;
156
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
157
- export type AcquireRightsRequest = never;
158
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
159
- export type AcquireRightsResponse = never;
160
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
161
- export type UpdateRightsRequest = never;
162
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
163
- export type UpdateRightsResponse = never;
164
112
  export type { AccountStatus, CreativeStatus, DelegationAuthority, CatalogAction, CatalogItemStatus, MediaBuyStatus, CreativeBrief, CompatibilityPurchaseCoordinatorInput, } from './types/core.generated.mjs';
165
113
  export type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated.mjs';
166
114
  export { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated.mjs';
@@ -279,3 +227,9 @@ export * from './supply-path/index.mjs';
279
227
  export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types.mjs';
280
228
  export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type BuyerAccountDispatch, type BuyerAccountProvisioningDispatch, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry.mjs';
281
229
  export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache.mjs';
230
+ export type { AssetVariant, DaypartTarget, TargetingOverlaySupport } from './types/core.generated.mjs';
231
+ export { TargetingOverlayKeys, TargetingOverlaySupportKeys } from './types/targeting-keys.generated.mjs';
232
+ export { parseMediaBuyDeliveryWebhook } from './webhooks/media-buy-delivery.mjs';
233
+ export type { ParseMediaBuyDeliveryWebhookOptions, MediaBuyDeliveryWebhookEnvelope, MediaBuyDeliveryWebhookParseErrorCode, MediaBuyDeliveryWebhookParseResult, } from './webhooks/media-buy-delivery.mjs';
234
+ export type { MediaBuyDeliveryReport } from './types/media-buy-delivery-report.mjs';
235
+ export { MediaBuyDeliveryReportSchema } from './validation/media-buy-delivery-report.mjs';
@@ -75,27 +75,15 @@ export type { GetProductsRequest as LegacyGetProductsRequest, GetProductsRespons
75
75
  CreativeAsset as LegacyCompatibleCreativeAsset, CreativePolicy, BrandReference, BrandID, AccountReference, CPAPricingOption, EventType, ActionSource, OptimizationGoal, ReachUnit, TargetingOverlay, OutcomeMeasurementDeprecated, OutcomeMeasurementDeprecated as OutcomeMeasurement, Duration, DeviceType, DigitalSourceType, FrequencyCap, GeographicBreakdownSupport, Catalog, CatalogType, FeedFormat, UpdateFrequency, ContentIDType, CatalogFieldMapping, SyncCatalogsRequest, SyncCatalogsResponse, SyncCatalogsSuccess, SyncCatalogsError, Overlay, Placement as LegacyPlacement, CreativeManifest as LegacyCreativeManifest, CreativeVariable, BuildCreativeRequest as LegacyBuildCreativeRequest, BuildCreativeResponse as LegacyBuildCreativeResponse, BuildCreativeSuccess as LegacyBuildCreativeSuccess, BuildCreativeMultiSuccess as LegacyBuildCreativeMultiSuccess, BuildCreativeVariantSuccess as LegacyBuildCreativeVariantSuccess, BuildCreativeError as LegacyBuildCreativeError, PreviewCreativeRequest as LegacyPreviewCreativeRequest, PreviewCreativeResponse as LegacyPreviewCreativeResponse, GetMediaBuysRequest, GetMediaBuysResponse as LegacyGetMediaBuysResponse, ImageAsset, VideoAsset, AudioAsset, TextAsset, URLAsset, HTMLAsset, VASTAsset, DAASTAsset, JavaScriptAsset, WebhookAsset, CSSAsset, MarkdownAsset, CatalogAsset, BriefAsset, ReferenceAsset, Provenance, PreviewOutputFormat, DisclosurePosition, EventCustomData, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse as LegacyGetCreativeDeliveryResponse, Account, AccountChange, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAccountsSuccess, SyncAccountsError, GetAccountFinancialsRequest, GetAccountFinancialsResponse, GetAccountFinancialsSuccess, GetAccountFinancialsError, PaginationRequest, PaginationResponse, PackageUpdate as LegacyPackageUpdate, Package as LegacyPackage, Destination, SignalFilters, PricingOption, PriceGuidance, } from './types/tools.generated';
76
76
  export type { GetMediaBuyArtifactsRequest as LegacyGetMediaBuyArtifactsRequest, GetMediaBuyArtifactsResponse as LegacyGetMediaBuyArtifactsResponse, } from './types/tools.generated';
77
77
  export type { GetRightsRequest as LegacyGetRightsRequest, GetRightsResponse as LegacyGetRightsResponse, AcquireRightsRequest as LegacyAcquireRightsRequest, AcquireRightsResponse as LegacyAcquireRightsResponse, UpdateRightsRequest as LegacyUpdateRightsRequest, UpdateRightsResponse as LegacyUpdateRightsResponse, } from './types/core.generated';
78
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
79
- export type GetMediaBuyArtifactsRequest = never;
80
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
81
- export type GetMediaBuyArtifactsResponse = never;
82
78
  export type { FormatReferenceStructuredObject as LegacyFormatReferenceStructuredObject, FormatReferenceStructuredObject as LegacyFormatID, } from './types/core.generated';
83
79
  /** @deprecated Legacy creative routing identity is available as `LegacyFormatReferenceStructuredObject`. */
84
80
  export type FormatReferenceStructuredObject = never;
85
81
  /** @deprecated Legacy creative routing identity is available as `LegacyFormatID`. */
86
82
  export type FormatID = never;
87
- /** @deprecated Use `LegacyBuildCreativeRequest`; canonical build support awaits a canonical protocol request. */
88
- export type BuildCreativeRequest = never;
89
- /** @deprecated Use `LegacyBuildCreativeResponse`. */
90
- export type BuildCreativeResponse = never;
91
83
  /** @deprecated Use `LegacyBuildCreativePayload`. */
92
84
  export type BuildCreativePayload = never;
93
85
  /** @deprecated Use `LegacyBuildCreativeMultiPayload`. */
94
86
  export type BuildCreativeMultiPayload = never;
95
- /** @deprecated Use `LegacyListCreativeFormatsRequest`. */
96
- export type ListCreativeFormatsRequest = never;
97
- /** @deprecated Use `LegacyListCreativeFormatsResponse`. */
98
- export type ListCreativeFormatsResponse = never;
99
87
  /** @deprecated Use `LegacyListCreativeFormatsPayload`. */
100
88
  export type ListCreativeFormatsPayload = never;
101
89
  /** @deprecated Use `LegacyListCreativeFormatsResponsePayload`. */
@@ -118,49 +106,9 @@ export type UpdateMediaBuyAsyncResponseData = never;
118
106
  /** @deprecated Use `LegacySyncCreativesAsyncResponseData`. */
119
107
  export type SyncCreativesAsyncResponseData = never;
120
108
  /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
121
- export type ListContentStandardsRequest = never;
122
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
123
- export type ListContentStandardsResponse = never;
124
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
125
- export type GetContentStandardsRequest = never;
126
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
127
- export type GetContentStandardsResponse = never;
128
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
129
- export type CreateContentStandardsRequest = never;
130
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
131
- export type CreateContentStandardsResponse = never;
132
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
133
- export type UpdateContentStandardsRequest = never;
134
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
135
- export type UpdateContentStandardsResponse = never;
136
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
137
- export type CalibrateContentRequest = never;
138
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
139
- export type CalibrateContentResponse = never;
140
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
141
- export type ValidateContentDeliveryRequest = never;
142
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
143
- export type ValidateContentDeliveryResponse = never;
144
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
145
- export type GetCreativeFeaturesRequest = never;
146
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
147
- export type GetCreativeFeaturesResponse = never;
148
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
149
109
  export type ContentStandards = never;
150
110
  /** @deprecated Use `LegacyArtifact` from the migration surface. */
151
111
  export type Artifact = never;
152
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
153
- export type GetRightsRequest = never;
154
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
155
- export type GetRightsResponse = never;
156
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
157
- export type AcquireRightsRequest = never;
158
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
159
- export type AcquireRightsResponse = never;
160
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
161
- export type UpdateRightsRequest = never;
162
- /** @deprecated Use the corresponding explicit `Legacy*` migration type. */
163
- export type UpdateRightsResponse = never;
164
112
  export type { AccountStatus, CreativeStatus, DelegationAuthority, CatalogAction, CatalogItemStatus, MediaBuyStatus, CreativeBrief, CompatibilityPurchaseCoordinatorInput, } from './types/core.generated';
165
113
  export type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated';
166
114
  export { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated';
@@ -279,3 +227,9 @@ export * from './supply-path';
279
227
  export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types';
280
228
  export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type BuyerAccountDispatch, type BuyerAccountProvisioningDispatch, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry';
281
229
  export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache';
230
+ export type { AssetVariant, DaypartTarget, TargetingOverlaySupport } from './types/core.generated';
231
+ export { TargetingOverlayKeys, TargetingOverlaySupportKeys } from './types/targeting-keys.generated';
232
+ export { parseMediaBuyDeliveryWebhook } from './webhooks/media-buy-delivery';
233
+ export type { ParseMediaBuyDeliveryWebhookOptions, MediaBuyDeliveryWebhookEnvelope, MediaBuyDeliveryWebhookParseErrorCode, MediaBuyDeliveryWebhookParseResult, } from './webhooks/media-buy-delivery';
234
+ export type { MediaBuyDeliveryReport } from './types/media-buy-delivery-report';
235
+ export { MediaBuyDeliveryReportSchema } from './validation/media-buy-delivery-report';
package/dist/lib/index.js CHANGED
@@ -139,6 +139,7 @@ __export(index_exports, {
139
139
  MUTATING_TASKS: () => import_idempotency.MUTATING_TASKS,
140
140
  MacroInRawValueError: () => import_substitution.MacroInRawValueError,
141
141
  MaxClarificationError: () => import_errors.MaxClarificationError,
142
+ MediaBuyDeliveryReportSchema: () => import_media_buy_delivery_report.MediaBuyDeliveryReportSchema,
142
143
  MediaBuyLifecycleCompatibilityError: () => import_compatibility.MediaBuyLifecycleCompatibilityError,
143
144
  MediaBuyLifecycleCoordinator: () => import_compatibility.MediaBuyLifecycleCoordinator,
144
145
  MemoryStorage: () => import_MemoryStorage.MemoryStorage,
@@ -205,6 +206,8 @@ __export(index_exports, {
205
206
  TEST_AGENT_NO_AUTH_MCP_CONFIG: () => import_testing.TEST_AGENT_NO_AUTH_MCP_CONFIG,
206
207
  TEST_AGENT_TOKEN: () => import_testing.TEST_AGENT_TOKEN,
207
208
  TOOL_INPUT_SHAPE: () => import_server.TOOL_INPUT_SHAPE,
209
+ TargetingOverlayKeys: () => import_targeting_keys.TargetingOverlayKeys,
210
+ TargetingOverlaySupportKeys: () => import_targeting_keys.TargetingOverlaySupportKeys,
208
211
  TaskAbortedError: () => import_errors.TaskAbortedError,
209
212
  TaskExecutor: () => import_TaskExecutor.TaskExecutor,
210
213
  TaskTimeoutError: () => import_errors.TaskTimeoutError,
@@ -592,6 +595,7 @@ __export(index_exports, {
592
595
  parseAdcpMajorVersion: () => import_version.parseAdcpMajorVersion,
593
596
  parseCapabilitiesResponse: () => import_capabilities.parseCapabilitiesResponse,
594
597
  parseManagerDomain: () => import_validate_adagents.parseManagerDomain,
598
+ parseMediaBuyDeliveryWebhook: () => import_media_buy_delivery.parseMediaBuyDeliveryWebhook,
595
599
  parsePublisherPropertySelector: () => import_publisher_property_selector.parsePublisherPropertySelector,
596
600
  parseSseStream: () => import_registry2.parseSseStream,
597
601
  parseWWWAuthenticate: () => import_oauth.parseWWWAuthenticate,
@@ -853,6 +857,9 @@ var import_media_buy_action_resolver = require('./server/media-buy-action-resolv
853
857
  __reExport(index_exports, require('./supply-path/index.js'), module.exports);
854
858
  var import_buyer_account_registry = require('./core/buyer-account-registry.js');
855
859
  var import_product_cache = require('./core/product-cache.js');
860
+ var import_targeting_keys = require('./types/targeting-keys.generated.js');
861
+ var import_media_buy_delivery = require('./webhooks/media-buy-delivery.js');
862
+ var import_media_buy_delivery_report = require('./validation/media-buy-delivery-report.js');
856
863
  const wireVersion = {
857
864
  isSupported: import_protocols2.bundleSupportsAdcpVersionField,
858
865
  normalize: import_schema_loader2.toReleasePrecisionWire,
@@ -987,6 +994,7 @@ function createAdCPClientFromEnv() {
987
994
  MUTATING_TASKS,
988
995
  MacroInRawValueError,
989
996
  MaxClarificationError,
997
+ MediaBuyDeliveryReportSchema,
990
998
  MediaBuyLifecycleCompatibilityError,
991
999
  MediaBuyLifecycleCoordinator,
992
1000
  MemoryStorage,
@@ -1053,6 +1061,8 @@ function createAdCPClientFromEnv() {
1053
1061
  TEST_AGENT_NO_AUTH_MCP_CONFIG,
1054
1062
  TEST_AGENT_TOKEN,
1055
1063
  TOOL_INPUT_SHAPE,
1064
+ TargetingOverlayKeys,
1065
+ TargetingOverlaySupportKeys,
1056
1066
  TaskAbortedError,
1057
1067
  TaskExecutor,
1058
1068
  TaskTimeoutError,
@@ -1440,6 +1450,7 @@ function createAdCPClientFromEnv() {
1440
1450
  parseAdcpMajorVersion,
1441
1451
  parseCapabilitiesResponse,
1442
1452
  parseManagerDomain,
1453
+ parseMediaBuyDeliveryWebhook,
1443
1454
  parsePublisherPropertySelector,
1444
1455
  parseSseStream,
1445
1456
  parseWWWAuthenticate,
@@ -828,6 +828,9 @@ import {
828
828
  BuyerAccountRegistry
829
829
  } from "./core/buyer-account-registry.mjs";
830
830
  import { createProductCache, ProductCache } from "./core/product-cache.mjs";
831
+ import { TargetingOverlayKeys, TargetingOverlaySupportKeys } from "./types/targeting-keys.generated.mjs";
832
+ import { parseMediaBuyDeliveryWebhook } from "./webhooks/media-buy-delivery.mjs";
833
+ import { MediaBuyDeliveryReportSchema } from "./validation/media-buy-delivery-report.mjs";
831
834
  export {
832
835
  A2AInvocationError,
833
836
  A2A_CARD_PATHS,
@@ -949,6 +952,7 @@ export {
949
952
  MUTATING_TASKS,
950
953
  MacroInRawValueError,
951
954
  MaxClarificationError,
955
+ MediaBuyDeliveryReportSchema,
952
956
  MediaBuyLifecycleCompatibilityError,
953
957
  MediaBuyLifecycleCoordinator,
954
958
  MemoryStorage,
@@ -1015,6 +1019,8 @@ export {
1015
1019
  TEST_AGENT_NO_AUTH_MCP_CONFIG,
1016
1020
  TEST_AGENT_TOKEN,
1017
1021
  TOOL_INPUT_SHAPE,
1022
+ TargetingOverlayKeys,
1023
+ TargetingOverlaySupportKeys,
1018
1024
  TaskAbortedError,
1019
1025
  TaskExecutor,
1020
1026
  TaskTimeoutError,
@@ -1402,6 +1408,7 @@ export {
1402
1408
  parseAdcpMajorVersion,
1403
1409
  parseCapabilitiesResponse,
1404
1410
  parseManagerDomain,
1411
+ parseMediaBuyDeliveryWebhook,
1405
1412
  parsePublisherPropertySelector,
1406
1413
  parseSseStream,
1407
1414
  parseWWWAuthenticate,
@@ -6132,7 +6132,12 @@ class MediaBuyLifecycleCoordinator {
6132
6132
  });
6133
6133
  void new Promise((resolve) => setTimeout(resolve, 0)).then(async () => {
6134
6134
  while (!watchSignal.aborted) {
6135
- const task = await this.agent.getTaskStatus(sellerTaskId, settlementTransport, watchSignal, wireOptions);
6135
+ const task = await this.agent.getTaskStatus(
6136
+ sellerTaskId,
6137
+ settlementTransport,
6138
+ watchSignal,
6139
+ wireOptions
6140
+ );
6136
6141
  if (task.taskId !== sellerTaskId || task.taskType !== "create_media_buy") {
6137
6142
  throw this.legacyPurchaseAmbiguousError(
6138
6143
  "The polled working seller task does not match the durably recorded create_media_buy task."
@@ -6120,7 +6120,12 @@ class MediaBuyLifecycleCoordinator {
6120
6120
  });
6121
6121
  void new Promise((resolve) => setTimeout(resolve, 0)).then(async () => {
6122
6122
  while (!watchSignal.aborted) {
6123
- const task = await this.agent.getTaskStatus(sellerTaskId, settlementTransport, watchSignal, wireOptions);
6123
+ const task = await this.agent.getTaskStatus(
6124
+ sellerTaskId,
6125
+ settlementTransport,
6126
+ watchSignal,
6127
+ wireOptions
6128
+ );
6124
6129
  if (task.taskId !== sellerTaskId || task.taskType !== "create_media_buy") {
6125
6130
  throw this.legacyPurchaseAmbiguousError(
6126
6131
  "The polled working seller task does not match the durably recorded create_media_buy task."
@@ -22,6 +22,9 @@ export declare function closeCurrentMCPConnectionScope(): Promise<boolean>;
22
22
  * Per-call correlation headers, `AbortSignal`s and timeouts do not choose the
23
23
  * session. The scope terminates its sessions once, when `fn` settles; pass
24
24
  * `{ isolate: true }` to force a fresh scope even when called from inside one.
25
+ * Explicit workflows terminate sessions at exit even if an inner call returned
26
+ * submitted/working; the caller owns that lifetime. Implicit task scopes may
27
+ * close only their local clients when their final result remains nonterminal.
25
28
  *
26
29
  * @example
27
30
  * ```ts
@@ -22,6 +22,9 @@ export declare function closeCurrentMCPConnectionScope(): Promise<boolean>;
22
22
  * Per-call correlation headers, `AbortSignal`s and timeouts do not choose the
23
23
  * session. The scope terminates its sessions once, when `fn` settles; pass
24
24
  * `{ isolate: true }` to force a fresh scope even when called from inside one.
25
+ * Explicit workflows terminate sessions at exit even if an inner call returned
26
+ * submitted/working; the caller owns that lifetime. Implicit task scopes may
27
+ * close only their local clients when their final result remains nonterminal.
25
28
  *
26
29
  * @example
27
30
  * ```ts
@@ -61,7 +61,9 @@ async function closeCurrentMCPConnectionScope() {
61
61
  }
62
62
  const cleanups = [...scope.cleanups.values()];
63
63
  scope.cleanups.clear();
64
- await Promise.allSettled(cleanups.map((cleanup) => cleanup(!scope.signal?.aborted && !scope.interrupted)));
64
+ await Promise.allSettled(
65
+ cleanups.map((cleanup) => cleanup(!scope.signal?.aborted && !scope.interrupted && !scope.preserveSession))
66
+ );
65
67
  return true;
66
68
  }
67
69
  async function withMCPConnectionScope(fn, options = {}) {
@@ -73,12 +75,15 @@ async function withMCPConnectionScope(fn, options = {}) {
73
75
  pending: /* @__PURE__ */ new Set(),
74
76
  cleanups: /* @__PURE__ */ new Map(),
75
77
  signal: options.signal,
76
- preserveOnInterruption: options.preserveOnInterruption
78
+ preserveOnInterruption: options.preserveOnInterruption,
79
+ preserveSessionOnResult: options.preserveSessionOnResult
77
80
  };
78
81
  activeScopeKeys.add(scope.cacheKey);
79
82
  return scopeStorage.run(scope, async () => {
80
83
  try {
81
- return await fn();
84
+ const result = await fn();
85
+ scope.preserveSession = scope.preserveSessionOnResult?.(result) === true;
86
+ return result;
82
87
  } catch (error) {
83
88
  if ((0, import_abort.isAbortOrTimeoutError)(error)) markMCPConnectionScopeInterrupted();
84
89
  throw error;
@@ -37,7 +37,9 @@ async function closeCurrentMCPConnectionScope() {
37
37
  }
38
38
  const cleanups = [...scope.cleanups.values()];
39
39
  scope.cleanups.clear();
40
- await Promise.allSettled(cleanups.map((cleanup) => cleanup(!scope.signal?.aborted && !scope.interrupted)));
40
+ await Promise.allSettled(
41
+ cleanups.map((cleanup) => cleanup(!scope.signal?.aborted && !scope.interrupted && !scope.preserveSession))
42
+ );
41
43
  return true;
42
44
  }
43
45
  async function withMCPConnectionScope(fn, options = {}) {
@@ -49,12 +51,15 @@ async function withMCPConnectionScope(fn, options = {}) {
49
51
  pending: /* @__PURE__ */ new Set(),
50
52
  cleanups: /* @__PURE__ */ new Map(),
51
53
  signal: options.signal,
52
- preserveOnInterruption: options.preserveOnInterruption
54
+ preserveOnInterruption: options.preserveOnInterruption,
55
+ preserveSessionOnResult: options.preserveSessionOnResult
53
56
  };
54
57
  activeScopeKeys.add(scope.cacheKey);
55
58
  return scopeStorage.run(scope, async () => {
56
59
  try {
57
- return await fn();
60
+ const result = await fn();
61
+ scope.preserveSession = scope.preserveSessionOnResult?.(result) === true;
62
+ return result;
58
63
  } catch (error) {
59
64
  if (isAbortOrTimeoutError(error)) markMCPConnectionScopeInterrupted();
60
65
  throw error;
@@ -502,6 +502,7 @@ function compileRowSchema(schema, maxCompileMs, deadline) {
502
502
  assertInspectionDeadline(deadline);
503
503
  const startedAt = Date.now();
504
504
  const ajv = new Ajv2020({
505
+ inlineRefs: false,
505
506
  strictSchema: true,
506
507
  strictTypes: false,
507
508
  allErrors: true,
@@ -472,6 +472,7 @@ function compileRowSchema(schema, maxCompileMs, deadline) {
472
472
  assertInspectionDeadline(deadline);
473
473
  const startedAt = Date.now();
474
474
  const ajv = new Ajv2020({
475
+ inlineRefs: false,
475
476
  strictSchema: true,
476
477
  strictTypes: false,
477
478
  allErrors: true,
@@ -19,3 +19,8 @@ export declare function evaluateReportingLedgerCoverageV1(query: ReportingLedger
19
19
  complete: boolean;
20
20
  retainedFrom: string;
21
21
  };
22
+ /**
23
+ * Store-side guard, evaluated under the same account lock as generation writes.
24
+ * @experimental Storage-facing building block; see docs/guides/REPORTING-STABILITY.md.
25
+ */
26
+ export declare function assertReportingLedgerHistoryDoesNotOverlap(configuration: ReportingLedgerConfigurationV1, configurations: readonly ReportingLedgerConfigurationV1[]): void;
@@ -19,3 +19,8 @@ export declare function evaluateReportingLedgerCoverageV1(query: ReportingLedger
19
19
  complete: boolean;
20
20
  retainedFrom: string;
21
21
  };
22
+ /**
23
+ * Store-side guard, evaluated under the same account lock as generation writes.
24
+ * @experimental Storage-facing building block; see docs/guides/REPORTING-STABILITY.md.
25
+ */
26
+ export declare function assertReportingLedgerHistoryDoesNotOverlap(configuration: ReportingLedgerConfigurationV1, configurations: readonly ReportingLedgerConfigurationV1[]): void;
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var coverage_exports = {};
20
20
  __export(coverage_exports, {
21
+ assertReportingLedgerHistoryDoesNotOverlap: () => assertReportingLedgerHistoryDoesNotOverlap,
21
22
  evaluateReportingLedgerCoverageV1: () => evaluateReportingLedgerCoverageV1,
22
23
  matchingReportingLedgerConfigurations: () => matchingReportingLedgerConfigurations,
23
24
  relevantReportingLedgerConfigurations: () => relevantReportingLedgerConfigurations,
@@ -56,7 +57,7 @@ function relevantReportingLedgerConfigurations(configurations, periodStart, peri
56
57
  const start = Date.parse(periodStart);
57
58
  const end = Date.parse(periodEnd);
58
59
  return configurations.filter((configuration) => {
59
- const installed = Date.parse(configuration.installedAt);
60
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
60
61
  const successor = reportingLedgerSuccessor(configuration, configurations);
61
62
  const superseded = Math.min(
62
63
  successor ? Date.parse(successor.installedAt) : Number.POSITIVE_INFINITY,
@@ -83,7 +84,7 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
83
84
  let complete = true;
84
85
  let retainedFrom;
85
86
  for (const configuration of configurations.filter((value) => reportingLedgerConfigurationMatchesScope(query, value))) {
86
- const installedAt = Date.parse(configuration.installedAt);
87
+ const installedAt = Date.parse(configuration.historyStart ?? configuration.installedAt);
87
88
  const successor = reportingLedgerSuccessor(configuration, configurations);
88
89
  const ownershipEnd = Math.min(
89
90
  successor ? Date.parse(successor.installedAt) : Number.POSITIVE_INFINITY,
@@ -108,7 +109,7 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
108
109
  }
109
110
  continue;
110
111
  }
111
- const firstOwned = Math.max(0, schedule.ceil(installedAt));
112
+ const firstOwned = configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installedAt));
112
113
  const ownershipLast = Number.isFinite(ownershipEnd) ? schedule.ceil(ownershipEnd) - 1 : Number.POSITIVE_INFINITY;
113
114
  if (ownershipLast < firstOwned) continue;
114
115
  const end = Number.isFinite(ownershipLast) ? schedule.boundary(ownershipLast + 1) : Number.POSITIVE_INFINITY;
@@ -135,8 +136,41 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
135
136
  }
136
137
  return { complete, retainedFrom: retainedFrom ?? period.start };
137
138
  }
139
+ function assertReportingLedgerHistoryDoesNotOverlap(configuration, configurations) {
140
+ if (configuration.historyStart === void 0) return;
141
+ const all = [
142
+ ...configurations.filter((value) => value.configurationId !== configuration.configurationId),
143
+ configuration
144
+ ];
145
+ const range = (value) => {
146
+ const schedule2 = (0, import_schedule.reportingPeriodSchedule)(value);
147
+ const first = value.historyStartOrdinal ?? Math.max(0, schedule2.ceil(Date.parse(value.installedAt)));
148
+ const successor = reportingLedgerSuccessor(value, all);
149
+ const end2 = Math.min(
150
+ successor ? Date.parse(successor.installedAt) : Infinity,
151
+ value.supersededAt ? Date.parse(value.supersededAt) : Infinity
152
+ );
153
+ return [schedule2.boundary(first), Number.isFinite(end2) ? schedule2.boundary(schedule2.ceil(end2)) : Infinity];
154
+ };
155
+ const [start, ownershipEnd] = range(configuration);
156
+ const previous = configurations.find((value) => value.configurationId === configuration.configurationId);
157
+ const schedule = (0, import_schedule.reportingPeriodSchedule)(configuration);
158
+ const previousStart = previous?.historyStart !== void 0 ? Date.parse(previous.historyStart) : schedule.boundary(Math.max(0, schedule.ceil(Date.parse(configuration.installedAt))));
159
+ const end = Math.min(ownershipEnd, previousStart);
160
+ if (start >= end) return;
161
+ for (const other of all) {
162
+ if (other.configurationId === configuration.configurationId || other.account.account_id !== configuration.account.account_id || other.delivery_config_id !== configuration.delivery_config_id)
163
+ continue;
164
+ if (Date.parse(other.historyStart ?? other.installedAt) >= end) continue;
165
+ const [otherStart, otherEnd] = range(other);
166
+ if (start < end && otherStart < otherEnd && start < otherEnd && otherStart < end) {
167
+ throw new RangeError("Reporting history overlaps another configuration generation");
168
+ }
169
+ }
170
+ }
138
171
  // Annotate the CommonJS export names for ESM import in node:
139
172
  0 && (module.exports = {
173
+ assertReportingLedgerHistoryDoesNotOverlap,
140
174
  evaluateReportingLedgerCoverageV1,
141
175
  matchingReportingLedgerConfigurations,
142
176
  relevantReportingLedgerConfigurations,
@@ -31,7 +31,7 @@ function relevantReportingLedgerConfigurations(configurations, periodStart, peri
31
31
  const start = Date.parse(periodStart);
32
32
  const end = Date.parse(periodEnd);
33
33
  return configurations.filter((configuration) => {
34
- const installed = Date.parse(configuration.installedAt);
34
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
35
35
  const successor = reportingLedgerSuccessor(configuration, configurations);
36
36
  const superseded = Math.min(
37
37
  successor ? Date.parse(successor.installedAt) : Number.POSITIVE_INFINITY,
@@ -58,7 +58,7 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
58
58
  let complete = true;
59
59
  let retainedFrom;
60
60
  for (const configuration of configurations.filter((value) => reportingLedgerConfigurationMatchesScope(query, value))) {
61
- const installedAt = Date.parse(configuration.installedAt);
61
+ const installedAt = Date.parse(configuration.historyStart ?? configuration.installedAt);
62
62
  const successor = reportingLedgerSuccessor(configuration, configurations);
63
63
  const ownershipEnd = Math.min(
64
64
  successor ? Date.parse(successor.installedAt) : Number.POSITIVE_INFINITY,
@@ -83,7 +83,7 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
83
83
  }
84
84
  continue;
85
85
  }
86
- const firstOwned = Math.max(0, schedule.ceil(installedAt));
86
+ const firstOwned = configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installedAt));
87
87
  const ownershipLast = Number.isFinite(ownershipEnd) ? schedule.ceil(ownershipEnd) - 1 : Number.POSITIVE_INFINITY;
88
88
  if (ownershipLast < firstOwned) continue;
89
89
  const end = Number.isFinite(ownershipLast) ? schedule.boundary(ownershipLast + 1) : Number.POSITIVE_INFINITY;
@@ -110,7 +110,40 @@ function evaluateReportingLedgerCoverageV1(query, configurations, obligations, l
110
110
  }
111
111
  return { complete, retainedFrom: retainedFrom ?? period.start };
112
112
  }
113
+ function assertReportingLedgerHistoryDoesNotOverlap(configuration, configurations) {
114
+ if (configuration.historyStart === void 0) return;
115
+ const all = [
116
+ ...configurations.filter((value) => value.configurationId !== configuration.configurationId),
117
+ configuration
118
+ ];
119
+ const range = (value) => {
120
+ const schedule2 = reportingPeriodSchedule(value);
121
+ const first = value.historyStartOrdinal ?? Math.max(0, schedule2.ceil(Date.parse(value.installedAt)));
122
+ const successor = reportingLedgerSuccessor(value, all);
123
+ const end2 = Math.min(
124
+ successor ? Date.parse(successor.installedAt) : Infinity,
125
+ value.supersededAt ? Date.parse(value.supersededAt) : Infinity
126
+ );
127
+ return [schedule2.boundary(first), Number.isFinite(end2) ? schedule2.boundary(schedule2.ceil(end2)) : Infinity];
128
+ };
129
+ const [start, ownershipEnd] = range(configuration);
130
+ const previous = configurations.find((value) => value.configurationId === configuration.configurationId);
131
+ const schedule = reportingPeriodSchedule(configuration);
132
+ const previousStart = previous?.historyStart !== void 0 ? Date.parse(previous.historyStart) : schedule.boundary(Math.max(0, schedule.ceil(Date.parse(configuration.installedAt))));
133
+ const end = Math.min(ownershipEnd, previousStart);
134
+ if (start >= end) return;
135
+ for (const other of all) {
136
+ if (other.configurationId === configuration.configurationId || other.account.account_id !== configuration.account.account_id || other.delivery_config_id !== configuration.delivery_config_id)
137
+ continue;
138
+ if (Date.parse(other.historyStart ?? other.installedAt) >= end) continue;
139
+ const [otherStart, otherEnd] = range(other);
140
+ if (start < end && otherStart < otherEnd && start < otherEnd && otherStart < end) {
141
+ throw new RangeError("Reporting history overlaps another configuration generation");
142
+ }
143
+ }
144
+ }
113
145
  export {
146
+ assertReportingLedgerHistoryDoesNotOverlap,
114
147
  evaluateReportingLedgerCoverageV1,
115
148
  matchingReportingLedgerConfigurations,
116
149
  relevantReportingLedgerConfigurations,
@@ -922,11 +922,14 @@ function nextExpectedAt(health, selected, query, configurations, ledgerAsOf) {
922
922
  }
923
923
  function nextActivePeriodStart(configuration, configurations, ledgerAsOf) {
924
924
  const asOf = Date.parse(ledgerAsOf);
925
- const installed = Date.parse(configuration.installedAt);
925
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
926
926
  const ownershipEnd = reportingLedgerConfigurationOwnershipEnd(configuration, configurations);
927
927
  if (installed > asOf || ownershipEnd <= asOf) return [];
928
928
  const schedule = (0, import_schedule.reportingPeriodSchedule)(configuration);
929
- const ordinal = Math.max(0, schedule.ceil(installed), schedule.floor(asOf) + 1);
929
+ const ordinal = Math.max(
930
+ configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installed)),
931
+ schedule.floor(asOf) + 1
932
+ );
930
933
  const start = schedule.boundary(ordinal);
931
934
  if (start >= ownershipEnd) return [];
932
935
  schedule.period(ordinal);
@@ -934,13 +937,13 @@ function nextActivePeriodStart(configuration, configurations, ledgerAsOf) {
934
937
  }
935
938
  function nextObligationDue(configuration, configurations, query, ledgerAsOf) {
936
939
  const schedule = (0, import_schedule.reportingPeriodSchedule)(configuration);
937
- const installed = Date.parse(configuration.installedAt);
940
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
938
941
  const ownershipEnd = reportingLedgerConfigurationOwnershipEnd(configuration, configurations);
939
942
  const period = (0, import_coverage.reportingLedgerEffectivePeriod)(query, ledgerAsOf);
940
943
  const periodStart = Date.parse(period.start);
941
944
  const periodEnd = Date.parse(period.end);
942
945
  const expectedOffset = configuration.schedule.deliverySlaMilliseconds;
943
- const firstOwned = Math.max(0, schedule.ceil(installed));
946
+ const firstOwned = configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installed));
944
947
  const lastOwned = schedule.ceil(ownershipEnd) - 1;
945
948
  if (lastOwned < firstOwned) return [];
946
949
  const end = Number.isFinite(lastOwned) ? schedule.boundary(lastOwned + 1) : Number.POSITIVE_INFINITY;
@@ -906,11 +906,14 @@ function nextExpectedAt(health, selected, query, configurations, ledgerAsOf) {
906
906
  }
907
907
  function nextActivePeriodStart(configuration, configurations, ledgerAsOf) {
908
908
  const asOf = Date.parse(ledgerAsOf);
909
- const installed = Date.parse(configuration.installedAt);
909
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
910
910
  const ownershipEnd = reportingLedgerConfigurationOwnershipEnd(configuration, configurations);
911
911
  if (installed > asOf || ownershipEnd <= asOf) return [];
912
912
  const schedule = reportingPeriodSchedule(configuration);
913
- const ordinal = Math.max(0, schedule.ceil(installed), schedule.floor(asOf) + 1);
913
+ const ordinal = Math.max(
914
+ configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installed)),
915
+ schedule.floor(asOf) + 1
916
+ );
914
917
  const start = schedule.boundary(ordinal);
915
918
  if (start >= ownershipEnd) return [];
916
919
  schedule.period(ordinal);
@@ -918,13 +921,13 @@ function nextActivePeriodStart(configuration, configurations, ledgerAsOf) {
918
921
  }
919
922
  function nextObligationDue(configuration, configurations, query, ledgerAsOf) {
920
923
  const schedule = reportingPeriodSchedule(configuration);
921
- const installed = Date.parse(configuration.installedAt);
924
+ const installed = Date.parse(configuration.historyStart ?? configuration.installedAt);
922
925
  const ownershipEnd = reportingLedgerConfigurationOwnershipEnd(configuration, configurations);
923
926
  const period = reportingLedgerEffectivePeriod(query, ledgerAsOf);
924
927
  const periodStart = Date.parse(period.start);
925
928
  const periodEnd = Date.parse(period.end);
926
929
  const expectedOffset = configuration.schedule.deliverySlaMilliseconds;
927
- const firstOwned = Math.max(0, schedule.ceil(installed));
930
+ const firstOwned = configuration.historyStartOrdinal ?? Math.max(0, schedule.ceil(installed));
928
931
  const lastOwned = schedule.ceil(ownershipEnd) - 1;
929
932
  if (lastOwned < firstOwned) return [];
930
933
  const end = Number.isFinite(lastOwned) ? schedule.boundary(lastOwned + 1) : Number.POSITIVE_INFINITY;