@adcp/sdk 17.0.0-beta.21 → 17.0.0-beta.23

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 (223) hide show
  1. package/README.md +26 -2
  2. package/dist/lib/adapters/version/index.d.mts +1 -1
  3. package/dist/lib/adapters/version/index.d.ts +1 -1
  4. package/dist/lib/adapters/version/index.js +2 -0
  5. package/dist/lib/adapters/version/index.mjs +2 -0
  6. package/dist/lib/adapters/version/negotiate.d.mts +13 -0
  7. package/dist/lib/adapters/version/negotiate.d.ts +13 -0
  8. package/dist/lib/adapters/version/negotiate.js +6 -0
  9. package/dist/lib/adapters/version/negotiate.mjs +5 -0
  10. package/dist/lib/client/core.d.mts +4 -0
  11. package/dist/lib/client/core.d.ts +4 -0
  12. package/dist/lib/client/core.js +13 -0
  13. package/dist/lib/client/core.mjs +12 -0
  14. package/dist/lib/conformance/property-lists.d.mts +1 -1
  15. package/dist/lib/conformance/property-lists.d.ts +1 -1
  16. package/dist/lib/conformance/property-lists.js +1 -1
  17. package/dist/lib/conformance/property-lists.mjs +1 -1
  18. package/dist/lib/core/SingleAgentClient.d.mts +23 -1
  19. package/dist/lib/core/SingleAgentClient.d.ts +23 -1
  20. package/dist/lib/core/SingleAgentClient.js +102 -18
  21. package/dist/lib/core/SingleAgentClient.mjs +108 -18
  22. package/dist/lib/core/targeting-helpers.d.mts +123 -0
  23. package/dist/lib/core/targeting-helpers.d.ts +123 -0
  24. package/dist/lib/core/targeting-helpers.js +412 -0
  25. package/dist/lib/core/targeting-helpers.mjs +370 -0
  26. package/dist/lib/entrypoints/client-account-changes.d.mts +5 -0
  27. package/dist/lib/entrypoints/client-account-changes.d.ts +5 -0
  28. package/dist/lib/entrypoints/client-account-changes.js +28 -0
  29. package/dist/lib/entrypoints/client-account-changes.mjs +4 -0
  30. package/dist/lib/entrypoints/client-webhook-stores.d.mts +2 -0
  31. package/dist/lib/entrypoints/client-webhook-stores.d.ts +2 -0
  32. package/dist/lib/entrypoints/client-webhook-stores.js +37 -0
  33. package/dist/lib/entrypoints/client-webhook-stores.mjs +16 -0
  34. package/dist/lib/entrypoints/discovery.d.mts +9 -0
  35. package/dist/lib/entrypoints/discovery.d.ts +9 -0
  36. package/dist/lib/entrypoints/discovery.js +72 -0
  37. package/dist/lib/entrypoints/discovery.mjs +56 -0
  38. package/dist/lib/entrypoints/errors.d.mts +11 -0
  39. package/dist/lib/entrypoints/errors.d.ts +11 -0
  40. package/dist/lib/entrypoints/errors.js +159 -0
  41. package/dist/lib/entrypoints/errors.mjs +132 -0
  42. package/dist/lib/entrypoints/media-buy.d.mts +5 -0
  43. package/dist/lib/entrypoints/media-buy.d.ts +5 -0
  44. package/dist/lib/entrypoints/media-buy.js +119 -0
  45. package/dist/lib/entrypoints/media-buy.mjs +100 -0
  46. package/dist/lib/entrypoints/registry.d.mts +5 -0
  47. package/dist/lib/entrypoints/registry.d.ts +5 -0
  48. package/dist/lib/entrypoints/registry.js +61 -0
  49. package/dist/lib/entrypoints/registry.mjs +40 -0
  50. package/dist/lib/entrypoints/utils.d.mts +7 -0
  51. package/dist/lib/entrypoints/utils.d.ts +7 -0
  52. package/dist/lib/entrypoints/utils.js +100 -0
  53. package/dist/lib/entrypoints/utils.mjs +72 -0
  54. package/dist/lib/entrypoints/version.d.mts +3 -0
  55. package/dist/lib/entrypoints/version.d.ts +3 -0
  56. package/dist/lib/entrypoints/version.js +57 -0
  57. package/dist/lib/entrypoints/version.mjs +36 -0
  58. package/dist/lib/index.d.mts +1 -1
  59. package/dist/lib/index.d.ts +1 -1
  60. package/dist/lib/media-buy/action-contracts.js +3 -3
  61. package/dist/lib/media-buy/action-contracts.mjs +1 -1
  62. package/dist/lib/media-buy/creative-start-policy.d.mts +19 -0
  63. package/dist/lib/media-buy/creative-start-policy.d.ts +19 -0
  64. package/dist/lib/media-buy/creative-start-policy.js +59 -0
  65. package/dist/lib/media-buy/creative-start-policy.mjs +31 -0
  66. package/dist/lib/media-buy/valid-actions.d.mts +47 -0
  67. package/dist/lib/media-buy/valid-actions.d.ts +47 -0
  68. package/dist/lib/media-buy/valid-actions.js +42 -0
  69. package/dist/lib/media-buy/valid-actions.mjs +18 -0
  70. package/dist/lib/net/pin-and-bind-fetch.d.mts +121 -0
  71. package/dist/lib/net/pin-and-bind-fetch.d.ts +121 -0
  72. package/dist/lib/net/pin-and-bind-fetch.js +209 -0
  73. package/dist/lib/net/pin-and-bind-fetch.mjs +183 -0
  74. package/dist/lib/protocols/mcp-modern.js +20 -4
  75. package/dist/lib/protocols/mcp-modern.mjs +20 -4
  76. package/dist/lib/registry/types.generated.d.ts +224 -3
  77. package/dist/lib/reporting/ledger/index.d.mts +1 -0
  78. package/dist/lib/reporting/ledger/index.d.ts +1 -0
  79. package/dist/lib/reporting/ledger/index.js +3 -1
  80. package/dist/lib/reporting/ledger/index.mjs +1 -0
  81. package/dist/lib/reporting/ledger/instant.d.mts +5 -0
  82. package/dist/lib/reporting/ledger/instant.d.ts +5 -0
  83. package/dist/lib/reporting/ledger/instant.js +10 -0
  84. package/dist/lib/reporting/ledger/instant.mjs +9 -0
  85. package/dist/lib/reporting/ledger/issue-events.d.mts +333 -0
  86. package/dist/lib/reporting/ledger/issue-events.d.ts +333 -0
  87. package/dist/lib/reporting/ledger/issue-events.js +310 -0
  88. package/dist/lib/reporting/ledger/issue-events.mjs +282 -0
  89. package/dist/lib/reporting/service/index.d.mts +36 -1
  90. package/dist/lib/reporting/service/index.d.ts +36 -1
  91. package/dist/lib/reporting/service/index.js +51 -1
  92. package/dist/lib/reporting/service/index.mjs +52 -2
  93. package/dist/lib/reporting/service/scheduler-support.d.mts +1 -1
  94. package/dist/lib/reporting/service/scheduler-support.d.ts +1 -1
  95. package/dist/lib/reporting/service/scheduler-support.js +1 -1
  96. package/dist/lib/reporting/service/scheduler-support.mjs +1 -1
  97. package/dist/lib/server/capabilities-release-projection.d.mts +43 -0
  98. package/dist/lib/server/capabilities-release-projection.d.ts +43 -0
  99. package/dist/lib/server/capabilities-release-projection.js +128 -0
  100. package/dist/lib/server/capabilities-release-projection.mjs +112 -0
  101. package/dist/lib/server/create-adcp-server.d.mts +29 -5
  102. package/dist/lib/server/create-adcp-server.d.ts +29 -5
  103. package/dist/lib/server/create-adcp-server.js +97 -24
  104. package/dist/lib/server/create-adcp-server.mjs +108 -23
  105. package/dist/lib/server/decisioning/capabilities.d.mts +27 -0
  106. package/dist/lib/server/decisioning/capabilities.d.ts +27 -0
  107. package/dist/lib/server/decisioning/runtime/from-platform.js +99 -27
  108. package/dist/lib/server/decisioning/runtime/from-platform.mjs +103 -27
  109. package/dist/lib/server/declared-input-schema.d.mts +108 -0
  110. package/dist/lib/server/declared-input-schema.d.ts +108 -0
  111. package/dist/lib/server/declared-input-schema.js +167 -0
  112. package/dist/lib/server/declared-input-schema.mjs +137 -0
  113. package/dist/lib/server/envelope-allowlist.d.mts +1 -105
  114. package/dist/lib/server/envelope-allowlist.d.ts +1 -105
  115. package/dist/lib/server/envelope-allowlist.js +3 -79
  116. package/dist/lib/server/envelope-allowlist.mjs +1 -71
  117. package/dist/lib/server/errors.d.mts +1 -186
  118. package/dist/lib/server/errors.d.ts +1 -186
  119. package/dist/lib/server/errors.js +3 -98
  120. package/dist/lib/server/errors.mjs +1 -94
  121. package/dist/lib/server/index.d.mts +1 -1
  122. package/dist/lib/server/index.d.ts +1 -1
  123. package/dist/lib/server/mcp-modern-server.js +21 -4
  124. package/dist/lib/server/mcp-modern-server.mjs +21 -4
  125. package/dist/lib/server/media-buy-action-resolver.d.mts +7 -0
  126. package/dist/lib/server/media-buy-action-resolver.d.ts +7 -0
  127. package/dist/lib/server/media-buy-action-resolver.js +10 -1
  128. package/dist/lib/server/media-buy-action-resolver.mjs +10 -1
  129. package/dist/lib/server/media-buy-helpers.d.mts +1 -47
  130. package/dist/lib/server/media-buy-helpers.d.ts +1 -47
  131. package/dist/lib/server/media-buy-helpers.js +3 -23
  132. package/dist/lib/server/media-buy-helpers.mjs +1 -18
  133. package/dist/lib/server/pick-safe-details.d.mts +1 -89
  134. package/dist/lib/server/pick-safe-details.d.ts +1 -89
  135. package/dist/lib/server/pick-safe-details.js +3 -61
  136. package/dist/lib/server/pick-safe-details.mjs +1 -56
  137. package/dist/lib/server/pin-and-bind-fetch.d.mts +1 -121
  138. package/dist/lib/server/pin-and-bind-fetch.d.ts +1 -121
  139. package/dist/lib/server/pin-and-bind-fetch.js +3 -190
  140. package/dist/lib/server/pin-and-bind-fetch.mjs +1 -183
  141. package/dist/lib/server/targeting-helpers.d.mts +1 -123
  142. package/dist/lib/server/targeting-helpers.d.ts +1 -123
  143. package/dist/lib/server/targeting-helpers.js +3 -393
  144. package/dist/lib/server/targeting-helpers.mjs +1 -370
  145. package/dist/lib/server/test-controller.js +7 -3
  146. package/dist/lib/server/test-controller.mjs +7 -3
  147. package/dist/lib/storage/memory-ledger.js +219 -1
  148. package/dist/lib/storage/memory-ledger.mjs +223 -1
  149. package/dist/lib/testing/client.js +26 -5
  150. package/dist/lib/testing/client.mjs +24 -5
  151. package/dist/lib/testing/compliance/storyboard-tracks.js +0 -4
  152. package/dist/lib/testing/compliance/storyboard-tracks.mjs +0 -4
  153. package/dist/lib/testing/comply-controller.js +7 -2
  154. package/dist/lib/testing/comply-controller.mjs +7 -2
  155. package/dist/lib/testing/storyboard/request-signing/grader.d.mts +21 -0
  156. package/dist/lib/testing/storyboard/request-signing/grader.d.ts +21 -0
  157. package/dist/lib/testing/storyboard/request-signing/grader.js +31 -0
  158. package/dist/lib/testing/storyboard/request-signing/grader.mjs +30 -0
  159. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +1 -1
  160. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +2 -1
  161. package/dist/lib/testing/storyboard/request-signing/types.d.mts +12 -0
  162. package/dist/lib/testing/storyboard/request-signing/types.d.ts +12 -0
  163. package/dist/lib/testing/storyboard/request-signing/vector-loader.js +7 -2
  164. package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +7 -2
  165. package/dist/lib/testing/storyboard/runner.js +4 -4
  166. package/dist/lib/testing/storyboard/runner.mjs +4 -4
  167. package/dist/lib/testing/storyboard/task-map.js +4 -1
  168. package/dist/lib/testing/storyboard/task-map.mjs +4 -1
  169. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  170. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  171. package/dist/lib/utils/adcp-error-response.d.mts +196 -0
  172. package/dist/lib/utils/adcp-error-response.d.ts +196 -0
  173. package/dist/lib/utils/adcp-error-response.js +118 -0
  174. package/dist/lib/utils/adcp-error-response.mjs +95 -0
  175. package/dist/lib/utils/buyer-retry-policy.js +2 -2
  176. package/dist/lib/utils/buyer-retry-policy.mjs +1 -1
  177. package/dist/lib/utils/capabilities.d.mts +6 -0
  178. package/dist/lib/utils/capabilities.d.ts +6 -0
  179. package/dist/lib/utils/capabilities.js +6 -2
  180. package/dist/lib/utils/capabilities.mjs +6 -2
  181. package/dist/lib/utils/envelope-allowlist.d.mts +105 -0
  182. package/dist/lib/utils/envelope-allowlist.d.ts +105 -0
  183. package/dist/lib/utils/envelope-allowlist.js +98 -0
  184. package/dist/lib/utils/envelope-allowlist.mjs +71 -0
  185. package/dist/lib/utils/pick-safe-details.d.mts +89 -0
  186. package/dist/lib/utils/pick-safe-details.d.ts +89 -0
  187. package/dist/lib/utils/pick-safe-details.js +80 -0
  188. package/dist/lib/utils/pick-safe-details.mjs +56 -0
  189. package/dist/lib/v2/projection/augment-response.d.mts +4 -0
  190. package/dist/lib/v2/projection/augment-response.d.ts +4 -0
  191. package/dist/lib/v2/projection/creative-delivery.d.mts +20 -3
  192. package/dist/lib/v2/projection/creative-delivery.d.ts +20 -3
  193. package/dist/lib/v2/projection/creative-delivery.js +20 -4
  194. package/dist/lib/v2/projection/creative-delivery.mjs +19 -4
  195. package/dist/lib/v2/projection/index.d.mts +2 -2
  196. package/dist/lib/v2/projection/index.d.ts +2 -2
  197. package/dist/lib/v2/projection/index.js +4 -0
  198. package/dist/lib/v2/projection/index.mjs +5 -1
  199. package/dist/lib/v2/projection/legacy-metadata.d.mts +7 -0
  200. package/dist/lib/v2/projection/legacy-metadata.d.ts +7 -0
  201. package/dist/lib/v2/projection/legacy-metadata.js +14 -0
  202. package/dist/lib/v2/projection/legacy-metadata.mjs +12 -0
  203. package/dist/lib/v2/projection/legacy-routes.d.mts +11 -0
  204. package/dist/lib/v2/projection/legacy-routes.d.ts +11 -0
  205. package/dist/lib/v2/projection/legacy-routes.js +2 -1
  206. package/dist/lib/v2/projection/legacy-routes.mjs +7 -2
  207. package/dist/lib/v2/projection/v1-to-v2.d.mts +21 -1
  208. package/dist/lib/v2/projection/v1-to-v2.d.ts +21 -1
  209. package/dist/lib/v2/projection/v1-to-v2.js +18 -11
  210. package/dist/lib/v2/projection/v1-to-v2.mjs +19 -11
  211. package/dist/lib/version.d.mts +3 -3
  212. package/dist/lib/version.d.ts +3 -3
  213. package/dist/lib/version.js +3 -3
  214. package/dist/lib/version.mjs +3 -3
  215. package/docs/TYPE-SUMMARY.md +2 -2
  216. package/docs/guides/CREATIVE-DELIVERY.md +12 -0
  217. package/docs/guides/REPORTING-LEDGER.md +121 -0
  218. package/docs/guides/VALIDATE-YOUR-AGENT.md +1 -0
  219. package/docs/llms.txt +2 -2
  220. package/docs/migration-14.x-rc-worksheet.md +4 -4
  221. package/docs/migration-16-to-17.md +149 -0
  222. package/docs/migration-reporting-storage-package.md +10 -0
  223. package/package.json +106 -1
@@ -36,7 +36,7 @@ export interface ReportingSchedulerReportingOptionsV1 {
36
36
  }
37
37
  /** Where in the scheduler loop a failure happened. */
38
38
  export interface ReportingSchedulerFailureSiteV1 {
39
- readonly phase: 'roster' | 'cycle' | 'maintenance';
39
+ readonly phase: 'roster' | 'cycle' | 'maintenance' | 'issue_observer';
40
40
  readonly accountId?: string | undefined;
41
41
  }
42
42
  export declare function reportReportingSchedulerError(options: ReportingSchedulerReportingOptionsV1, signal: AbortSignal, error: unknown, site: ReportingSchedulerFailureSiteV1): Promise<void>;
@@ -101,7 +101,7 @@ async function reportReportingSchedulerError(options, signal, error, site) {
101
101
  warnReportingSchedulerFailure(options, site, error);
102
102
  }
103
103
  function warnReportingSchedulerFailure(options, site, error, observerError) {
104
- const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
104
+ const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.phase === "issue_observer" ? `issue event delivery failed${site.accountId === void 0 ? "" : ` for account ${site.accountId}`}; the event is retried` : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
105
105
  const observed = observerError === void 0 ? "" : ` (the configured onError also threw: ${reportingSchedulerErrorMessage(observerError)})`;
106
106
  const message = `[adcp/reporting] scheduler ${where}: ${reportingSchedulerErrorMessage(error)}${observed}`;
107
107
  const logger = options.logger;
@@ -73,7 +73,7 @@ async function reportReportingSchedulerError(options, signal, error, site) {
73
73
  warnReportingSchedulerFailure(options, site, error);
74
74
  }
75
75
  function warnReportingSchedulerFailure(options, site, error, observerError) {
76
- const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
76
+ const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.phase === "issue_observer" ? `issue event delivery failed${site.accountId === void 0 ? "" : ` for account ${site.accountId}`}; the event is retried` : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
77
77
  const observed = observerError === void 0 ? "" : ` (the configured onError also threw: ${reportingSchedulerErrorMessage(observerError)})`;
78
78
  const message = `[adcp/reporting] scheduler ${where}: ${reportingSchedulerErrorMessage(error)}${observed}`;
79
79
  const logger = options.logger;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Project a `get_adcp_capabilities` response from the server's release down
3
+ * to the release served to the caller (DR-0024: a response conforms to the
4
+ * served release).
5
+ *
6
+ * Each step between the two releases runs the same schema diff as every other
7
+ * task response (`downgradeResponse`): properties, enum values and union
8
+ * variants the newer release declares but the older one does not are removed.
9
+ * Keys neither release declares, such as `library_version` or a seller's own
10
+ * extension, are left alone.
11
+ *
12
+ * `experimental_features` is a list of free-form ids, so the schema diff
13
+ * cannot see a newer release's ids. Each step also removes the ids the newer
14
+ * release's capabilities schema names and the older one never mentions.
15
+ * Every removal is reported as `version_downgrade_fields_dropped` drift.
16
+ * A 3.0 caller's properties go through the stricter 3.0 allow-list in
17
+ * `create-adcp-server.ts` instead, followed by the experimental-id removal alone.
18
+ */
19
+ import { type VersionDrift } from '../adapters/version/index.mjs';
20
+ /**
21
+ * Convert a capabilities response from the server's release `fromVersion`
22
+ * down to the served release `toVersion`. Returns the original reference and
23
+ * no drift when nothing changes. The input is never mutated.
24
+ */
25
+ export declare function projectCapabilitiesForRelease<T>(data: T, options: {
26
+ fromVersion: string;
27
+ toVersion: string;
28
+ }): {
29
+ data: T;
30
+ drifts: VersionDrift[];
31
+ };
32
+ /**
33
+ * Only the experimental-id removal of {@link projectCapabilitiesForRelease},
34
+ * for a response whose properties another projection already handled (the
35
+ * 3.0 allow-list, which cannot filter the free-form ids).
36
+ */
37
+ export declare function projectExperimentalFeaturesForRelease<T>(data: T, options: {
38
+ fromVersion: string;
39
+ toVersion: string;
40
+ }): {
41
+ data: T;
42
+ drifts: VersionDrift[];
43
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Project a `get_adcp_capabilities` response from the server's release down
3
+ * to the release served to the caller (DR-0024: a response conforms to the
4
+ * served release).
5
+ *
6
+ * Each step between the two releases runs the same schema diff as every other
7
+ * task response (`downgradeResponse`): properties, enum values and union
8
+ * variants the newer release declares but the older one does not are removed.
9
+ * Keys neither release declares, such as `library_version` or a seller's own
10
+ * extension, are left alone.
11
+ *
12
+ * `experimental_features` is a list of free-form ids, so the schema diff
13
+ * cannot see a newer release's ids. Each step also removes the ids the newer
14
+ * release's capabilities schema names and the older one never mentions.
15
+ * Every removal is reported as `version_downgrade_fields_dropped` drift.
16
+ * A 3.0 caller's properties go through the stricter 3.0 allow-list in
17
+ * `create-adcp-server.ts` instead, followed by the experimental-id removal alone.
18
+ */
19
+ import { type VersionDrift } from '../adapters/version';
20
+ /**
21
+ * Convert a capabilities response from the server's release `fromVersion`
22
+ * down to the served release `toVersion`. Returns the original reference and
23
+ * no drift when nothing changes. The input is never mutated.
24
+ */
25
+ export declare function projectCapabilitiesForRelease<T>(data: T, options: {
26
+ fromVersion: string;
27
+ toVersion: string;
28
+ }): {
29
+ data: T;
30
+ drifts: VersionDrift[];
31
+ };
32
+ /**
33
+ * Only the experimental-id removal of {@link projectCapabilitiesForRelease},
34
+ * for a response whose properties another projection already handled (the
35
+ * 3.0 allow-list, which cannot filter the free-form ids).
36
+ */
37
+ export declare function projectExperimentalFeaturesForRelease<T>(data: T, options: {
38
+ fromVersion: string;
39
+ toVersion: string;
40
+ }): {
41
+ data: T;
42
+ drifts: VersionDrift[];
43
+ };
@@ -0,0 +1,128 @@
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 capabilities_release_projection_exports = {};
20
+ __export(capabilities_release_projection_exports, {
21
+ projectCapabilitiesForRelease: () => projectCapabilitiesForRelease,
22
+ projectExperimentalFeaturesForRelease: () => projectExperimentalFeaturesForRelease
23
+ });
24
+ module.exports = __toCommonJS(capabilities_release_projection_exports);
25
+ var import_version = require('../adapters/version/index.js');
26
+ var import_schema_loader = require('../validation/schema-loader.js');
27
+ const TOOL = "get_adcp_capabilities";
28
+ let cachedGeneration = -1;
29
+ const corpusCache = /* @__PURE__ */ new Map();
30
+ function collectStrings(value, out) {
31
+ if (typeof value === "string") out.push(value);
32
+ else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
33
+ else if (value !== null && typeof value === "object")
34
+ for (const item of Object.values(value)) collectStrings(item, out);
35
+ }
36
+ function capabilitiesSchemaText(version) {
37
+ const generation = (0, import_schema_loader.getSchemaLoaderGeneration)();
38
+ if (cachedGeneration !== generation) {
39
+ corpusCache.clear();
40
+ cachedGeneration = generation;
41
+ }
42
+ let key;
43
+ try {
44
+ key = `${(0, import_schema_loader.resolveBundleKey)(version)}\0${(0, import_schema_loader.resolveSchemaRoot)(version)}`;
45
+ } catch {
46
+ return void 0;
47
+ }
48
+ if (corpusCache.has(key)) return corpusCache.get(key);
49
+ let text;
50
+ try {
51
+ const schema = (0, import_schema_loader.getToolSchemaDocument)(TOOL, "sync", version)?.schema;
52
+ if (schema) {
53
+ const strings = [];
54
+ collectStrings(schema, strings);
55
+ text = strings.join("\n");
56
+ }
57
+ } catch {
58
+ text = void 0;
59
+ }
60
+ corpusCache.set(key, text);
61
+ return text;
62
+ }
63
+ function mentions(text, featureId) {
64
+ const escaped = featureId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
65
+ return new RegExp(`(?<![a-z0-9_.])${escaped}(?![a-z0-9_]|\\.[a-z])`).test(text);
66
+ }
67
+ function newerFeatureIds(features, upper, lower) {
68
+ const upperText = capabilitiesSchemaText(upper);
69
+ const lowerText = capabilitiesSchemaText(lower);
70
+ const newer = /* @__PURE__ */ new Set();
71
+ if (upperText === void 0 || lowerText === void 0) return newer;
72
+ for (const feature of features) {
73
+ if (typeof feature !== "string" || newer.has(feature)) continue;
74
+ if (mentions(upperText, feature) && !mentions(lowerText, feature)) newer.add(feature);
75
+ }
76
+ return newer;
77
+ }
78
+ function dropNewerFeatureIds(current, step, drifts) {
79
+ if (current === null || typeof current !== "object" || Array.isArray(current)) return current;
80
+ const body = current;
81
+ const features = body.experimental_features;
82
+ if (!Array.isArray(features)) return current;
83
+ const newer = newerFeatureIds(features, step.upper, step.lower);
84
+ if (newer.size === 0) return current;
85
+ const paths = [];
86
+ const kept = features.filter((feature, index) => {
87
+ if (typeof feature !== "string" || !newer.has(feature)) return true;
88
+ paths.push(`experimental_features[${index}]`);
89
+ return false;
90
+ });
91
+ const next = {};
92
+ for (const [key, value] of Object.entries(body)) {
93
+ if (key !== "experimental_features") next[key] = value;
94
+ else if (kept.length > 0) next[key] = kept;
95
+ }
96
+ drifts.push({
97
+ type: "version_downgrade_fields_dropped",
98
+ message: `${TOOL}: removed ${newer.size} experimental feature id(s) AdCP ${(0, import_version.adcpMinorLine)(step.lower) ?? step.lower} does not define: ${[...newer].join(", ")}.`,
99
+ strippedFields: paths,
100
+ fromVersion: step.upper,
101
+ toVersion: step.lower
102
+ });
103
+ return next;
104
+ }
105
+ function projectCapabilitiesForRelease(data, options) {
106
+ const drifts = [];
107
+ let current = data;
108
+ for (const step of (0, import_version.translationSteps)(options.fromVersion, options.toVersion)) {
109
+ const downgraded = (0, import_version.downgradeResponse)(TOOL, current, { fromVersion: step.upper, toVersion: step.lower });
110
+ current = downgraded.data;
111
+ drifts.push(...downgraded.drifts);
112
+ current = dropNewerFeatureIds(current, step, drifts);
113
+ }
114
+ return { data: current, drifts };
115
+ }
116
+ function projectExperimentalFeaturesForRelease(data, options) {
117
+ const drifts = [];
118
+ let current = data;
119
+ for (const step of (0, import_version.translationSteps)(options.fromVersion, options.toVersion)) {
120
+ current = dropNewerFeatureIds(current, step, drifts);
121
+ }
122
+ return { data: current, drifts };
123
+ }
124
+ // Annotate the CommonJS export names for ESM import in node:
125
+ 0 && (module.exports = {
126
+ projectCapabilitiesForRelease,
127
+ projectExperimentalFeaturesForRelease
128
+ });
@@ -0,0 +1,112 @@
1
+ import {
2
+ adcpMinorLine,
3
+ downgradeResponse,
4
+ translationSteps
5
+ } from "../adapters/version/index.mjs";
6
+ import {
7
+ getSchemaLoaderGeneration,
8
+ getToolSchemaDocument,
9
+ resolveBundleKey,
10
+ resolveSchemaRoot
11
+ } from "../validation/schema-loader.mjs";
12
+ const TOOL = "get_adcp_capabilities";
13
+ let cachedGeneration = -1;
14
+ const corpusCache = /* @__PURE__ */ new Map();
15
+ function collectStrings(value, out) {
16
+ if (typeof value === "string") out.push(value);
17
+ else if (Array.isArray(value)) for (const item of value) collectStrings(item, out);
18
+ else if (value !== null && typeof value === "object")
19
+ for (const item of Object.values(value)) collectStrings(item, out);
20
+ }
21
+ function capabilitiesSchemaText(version) {
22
+ const generation = getSchemaLoaderGeneration();
23
+ if (cachedGeneration !== generation) {
24
+ corpusCache.clear();
25
+ cachedGeneration = generation;
26
+ }
27
+ let key;
28
+ try {
29
+ key = `${resolveBundleKey(version)}\0${resolveSchemaRoot(version)}`;
30
+ } catch {
31
+ return void 0;
32
+ }
33
+ if (corpusCache.has(key)) return corpusCache.get(key);
34
+ let text;
35
+ try {
36
+ const schema = getToolSchemaDocument(TOOL, "sync", version)?.schema;
37
+ if (schema) {
38
+ const strings = [];
39
+ collectStrings(schema, strings);
40
+ text = strings.join("\n");
41
+ }
42
+ } catch {
43
+ text = void 0;
44
+ }
45
+ corpusCache.set(key, text);
46
+ return text;
47
+ }
48
+ function mentions(text, featureId) {
49
+ const escaped = featureId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
50
+ return new RegExp(`(?<![a-z0-9_.])${escaped}(?![a-z0-9_]|\\.[a-z])`).test(text);
51
+ }
52
+ function newerFeatureIds(features, upper, lower) {
53
+ const upperText = capabilitiesSchemaText(upper);
54
+ const lowerText = capabilitiesSchemaText(lower);
55
+ const newer = /* @__PURE__ */ new Set();
56
+ if (upperText === void 0 || lowerText === void 0) return newer;
57
+ for (const feature of features) {
58
+ if (typeof feature !== "string" || newer.has(feature)) continue;
59
+ if (mentions(upperText, feature) && !mentions(lowerText, feature)) newer.add(feature);
60
+ }
61
+ return newer;
62
+ }
63
+ function dropNewerFeatureIds(current, step, drifts) {
64
+ if (current === null || typeof current !== "object" || Array.isArray(current)) return current;
65
+ const body = current;
66
+ const features = body.experimental_features;
67
+ if (!Array.isArray(features)) return current;
68
+ const newer = newerFeatureIds(features, step.upper, step.lower);
69
+ if (newer.size === 0) return current;
70
+ const paths = [];
71
+ const kept = features.filter((feature, index) => {
72
+ if (typeof feature !== "string" || !newer.has(feature)) return true;
73
+ paths.push(`experimental_features[${index}]`);
74
+ return false;
75
+ });
76
+ const next = {};
77
+ for (const [key, value] of Object.entries(body)) {
78
+ if (key !== "experimental_features") next[key] = value;
79
+ else if (kept.length > 0) next[key] = kept;
80
+ }
81
+ drifts.push({
82
+ type: "version_downgrade_fields_dropped",
83
+ message: `${TOOL}: removed ${newer.size} experimental feature id(s) AdCP ${adcpMinorLine(step.lower) ?? step.lower} does not define: ${[...newer].join(", ")}.`,
84
+ strippedFields: paths,
85
+ fromVersion: step.upper,
86
+ toVersion: step.lower
87
+ });
88
+ return next;
89
+ }
90
+ function projectCapabilitiesForRelease(data, options) {
91
+ const drifts = [];
92
+ let current = data;
93
+ for (const step of translationSteps(options.fromVersion, options.toVersion)) {
94
+ const downgraded = downgradeResponse(TOOL, current, { fromVersion: step.upper, toVersion: step.lower });
95
+ current = downgraded.data;
96
+ drifts.push(...downgraded.drifts);
97
+ current = dropNewerFeatureIds(current, step, drifts);
98
+ }
99
+ return { data: current, drifts };
100
+ }
101
+ function projectExperimentalFeaturesForRelease(data, options) {
102
+ const drifts = [];
103
+ let current = data;
104
+ for (const step of translationSteps(options.fromVersion, options.toVersion)) {
105
+ current = dropNewerFeatureIds(current, step, drifts);
106
+ }
107
+ return { data: current, drifts };
108
+ }
109
+ export {
110
+ projectCapabilitiesForRelease,
111
+ projectExperimentalFeaturesForRelease
112
+ };
@@ -966,6 +966,16 @@ export interface AdcpCapabilitiesOverrides {
966
966
  profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
967
967
  }) | null;
968
968
  identity?: GetAdCPCapabilitiesResponse['identity'] | null;
969
+ /**
970
+ * Conditional-fetch (`if_wholesale_feed_version`) support for `get_products` and `get_signals`.
971
+ * The SDK does not derive it: a seller that serves versioned feeds declares it here.
972
+ */
973
+ wholesale_feed_versioning?: GetAdCPCapabilitiesResponse['wholesale_feed_versioning'] | null;
974
+ /**
975
+ * Wholesale feed change webhooks (`product.*`, `signal.*`, `wholesale_feed.bulk_change`). The SDK
976
+ * does not derive it: a seller that emits those events declares it here.
977
+ */
978
+ wholesale_feed_webhooks?: GetAdCPCapabilitiesResponse['wholesale_feed_webhooks'] | null;
969
979
  request_signing?: (NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
970
980
  profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
971
981
  }) | null;
@@ -1203,7 +1213,7 @@ export type AdcpCustomToolHandler<InputArgs extends undefined | ZodRawShapeCompa
1203
1213
  * These tools **bypass the framework's spec-tool pipeline**:
1204
1214
  * idempotency middleware, governance pre-checks, account resolution,
1205
1215
  * and response wrapping are all skipped. The handler receives the
1206
- * SDK-validated arguments and must return a `CallToolResult` directly.
1216
+ * arguments parsed by `inputSchema` and must return a `CallToolResult` directly.
1207
1217
  * If you need any of those behaviors, call the framework helpers from
1208
1218
  * inside the handler (e.g., `checkGovernance(...)`, `adcpError(...)`).
1209
1219
  *
@@ -1215,7 +1225,20 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
1215
1225
  description?: string;
1216
1226
  /** Optional title hint for the MCP inspector. */
1217
1227
  title?: string;
1218
- /** Zod raw shape or schema for argument validation. */
1228
+ /**
1229
+ * Zod raw shape or schema for argument validation.
1230
+ *
1231
+ * `tools/list` advertises it unchanged, but the framework validates it
1232
+ * rather than the MCP SDK: a call that fails it returns an AdCP
1233
+ * `INVALID_REQUEST` with `field`, field-level `issues` and the caller's
1234
+ * `context` echoed, and never reaches the handler. A call that passes
1235
+ * reaches the handler with the parsed value, so coercion, defaults and
1236
+ * transforms apply on every transport.
1237
+ *
1238
+ * Runs before identity authorization. Keep it free of side effects (no
1239
+ * async refinements that hit data stores) and do access checks in the
1240
+ * handler.
1241
+ */
1219
1242
  inputSchema?: InputArgs;
1220
1243
  /**
1221
1244
  * Zod raw shape or schema for the declared response payload.
@@ -1240,7 +1263,7 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
1240
1263
  /** Portable MCP App metadata surfaced unchanged in `tools/list`. */
1241
1264
  _meta?: McpAppMeta;
1242
1265
  /**
1243
- * Tool handler. Gets SDK-validated `args` based on `inputSchema` and
1266
+ * Tool handler. Gets `args` parsed by `inputSchema` and
1244
1267
  * must return a `CallToolResult`. Use `capabilitiesResponse`,
1245
1268
  * `mediaBuyResponse`, `adcpError`, or a hand-built `{ content, structuredContent? }`.
1246
1269
  */
@@ -1769,8 +1792,9 @@ export interface AdcpServerConfig<TAccount = unknown> {
1769
1792
  *
1770
1793
  * **Custom tools bypass the framework's spec-tool pipeline.** No
1771
1794
  * idempotency middleware, no governance pre-check, no account
1772
- * resolution, no response wrapping. The handler receives SDK-validated
1773
- * args and must return a `CallToolResult`. Call framework helpers
1795
+ * resolution, no response wrapping. The handler receives args parsed by
1796
+ * its `inputSchema`; a call that fails it gets an `INVALID_REQUEST` that
1797
+ * echoes `context`. The handler must return a `CallToolResult`. Call framework helpers
1774
1798
  * (`checkGovernance`, `adcpError`, `capabilitiesResponse`, …) from
1775
1799
  * inside the handler if you need those behaviors.
1776
1800
  *
@@ -966,6 +966,16 @@ export interface AdcpCapabilitiesOverrides {
966
966
  profiles?: ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
967
967
  }) | null;
968
968
  identity?: GetAdCPCapabilitiesResponse['identity'] | null;
969
+ /**
970
+ * Conditional-fetch (`if_wholesale_feed_version`) support for `get_products` and `get_signals`.
971
+ * The SDK does not derive it: a seller that serves versioned feeds declares it here.
972
+ */
973
+ wholesale_feed_versioning?: GetAdCPCapabilitiesResponse['wholesale_feed_versioning'] | null;
974
+ /**
975
+ * Wholesale feed change webhooks (`product.*`, `signal.*`, `wholesale_feed.bulk_change`). The SDK
976
+ * does not derive it: a seller that emits those events declares it here.
977
+ */
978
+ wholesale_feed_webhooks?: GetAdCPCapabilitiesResponse['wholesale_feed_webhooks'] | null;
969
979
  request_signing?: (NonNullable<GetAdCPCapabilitiesResponse['request_signing']> & {
970
980
  profiles?: ('adcp/request-signing/v1' | 'web-bot-auth')[];
971
981
  }) | null;
@@ -1203,7 +1213,7 @@ export type AdcpCustomToolHandler<InputArgs extends undefined | ZodRawShapeCompa
1203
1213
  * These tools **bypass the framework's spec-tool pipeline**:
1204
1214
  * idempotency middleware, governance pre-checks, account resolution,
1205
1215
  * and response wrapping are all skipped. The handler receives the
1206
- * SDK-validated arguments and must return a `CallToolResult` directly.
1216
+ * arguments parsed by `inputSchema` and must return a `CallToolResult` directly.
1207
1217
  * If you need any of those behaviors, call the framework helpers from
1208
1218
  * inside the handler (e.g., `checkGovernance(...)`, `adcpError(...)`).
1209
1219
  *
@@ -1215,7 +1225,20 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
1215
1225
  description?: string;
1216
1226
  /** Optional title hint for the MCP inspector. */
1217
1227
  title?: string;
1218
- /** Zod raw shape or schema for argument validation. */
1228
+ /**
1229
+ * Zod raw shape or schema for argument validation.
1230
+ *
1231
+ * `tools/list` advertises it unchanged, but the framework validates it
1232
+ * rather than the MCP SDK: a call that fails it returns an AdCP
1233
+ * `INVALID_REQUEST` with `field`, field-level `issues` and the caller's
1234
+ * `context` echoed, and never reaches the handler. A call that passes
1235
+ * reaches the handler with the parsed value, so coercion, defaults and
1236
+ * transforms apply on every transport.
1237
+ *
1238
+ * Runs before identity authorization. Keep it free of side effects (no
1239
+ * async refinements that hit data stores) and do access checks in the
1240
+ * handler.
1241
+ */
1219
1242
  inputSchema?: InputArgs;
1220
1243
  /**
1221
1244
  * Zod raw shape or schema for the declared response payload.
@@ -1240,7 +1263,7 @@ export interface AdcpCustomToolConfig<InputArgs extends undefined | ZodRawShapeC
1240
1263
  /** Portable MCP App metadata surfaced unchanged in `tools/list`. */
1241
1264
  _meta?: McpAppMeta;
1242
1265
  /**
1243
- * Tool handler. Gets SDK-validated `args` based on `inputSchema` and
1266
+ * Tool handler. Gets `args` parsed by `inputSchema` and
1244
1267
  * must return a `CallToolResult`. Use `capabilitiesResponse`,
1245
1268
  * `mediaBuyResponse`, `adcpError`, or a hand-built `{ content, structuredContent? }`.
1246
1269
  */
@@ -1769,8 +1792,9 @@ export interface AdcpServerConfig<TAccount = unknown> {
1769
1792
  *
1770
1793
  * **Custom tools bypass the framework's spec-tool pipeline.** No
1771
1794
  * idempotency middleware, no governance pre-check, no account
1772
- * resolution, no response wrapping. The handler receives SDK-validated
1773
- * args and must return a `CallToolResult`. Call framework helpers
1795
+ * resolution, no response wrapping. The handler receives args parsed by
1796
+ * its `inputSchema`; a call that fails it gets an `INVALID_REQUEST` that
1797
+ * echoes `context`. The handler must return a `CallToolResult`. Call framework helpers
1774
1798
  * (`checkGovernance`, `adcpError`, `capabilitiesResponse`, …) from
1775
1799
  * inside the handler if you need those behaviors.
1776
1800
  *