@adcp/sdk 17.0.0-beta.24 → 17.0.0-beta.25

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 (51) hide show
  1. package/dist/lib/adapters/version/schema-projection.d.mts +11 -0
  2. package/dist/lib/adapters/version/schema-projection.d.ts +11 -0
  3. package/dist/lib/adapters/version/schema-projection.js +52 -0
  4. package/dist/lib/adapters/version/schema-projection.mjs +51 -0
  5. package/dist/lib/reporting/evidence.d.mts +8 -0
  6. package/dist/lib/reporting/evidence.d.ts +8 -0
  7. package/dist/lib/reporting/evidence.js +10 -2
  8. package/dist/lib/reporting/evidence.mjs +8 -1
  9. package/dist/lib/reporting/ledger/index.d.mts +1 -1
  10. package/dist/lib/reporting/ledger/index.d.ts +1 -1
  11. package/dist/lib/reporting/ledger/index.js +3 -1
  12. package/dist/lib/reporting/ledger/index.mjs +4 -2
  13. package/dist/lib/reporting/ledger/status-ingest.js +3 -2
  14. package/dist/lib/reporting/ledger/status-ingest.mjs +3 -2
  15. package/dist/lib/reporting/subscriptions/engine.js +1 -1
  16. package/dist/lib/reporting/subscriptions/engine.mjs +1 -1
  17. package/dist/lib/server/account-response-identity.d.mts +4 -3
  18. package/dist/lib/server/account-response-identity.d.ts +4 -3
  19. package/dist/lib/server/account-response-identity.js +8 -4
  20. package/dist/lib/server/account-response-identity.mjs +8 -4
  21. package/dist/lib/server/credential-policy.js +5 -0
  22. package/dist/lib/server/credential-policy.mjs +5 -0
  23. package/dist/lib/server/decisioning/account.js +14 -3
  24. package/dist/lib/server/decisioning/account.mjs +16 -4
  25. package/dist/lib/server/notification-subscriptions/runtime.d.mts +6 -0
  26. package/dist/lib/server/notification-subscriptions/runtime.d.ts +6 -0
  27. package/dist/lib/server/notification-subscriptions/runtime.js +99 -0
  28. package/dist/lib/server/notification-subscriptions/runtime.mjs +98 -0
  29. package/dist/lib/server/principal/reporting-subscriptions.js +4 -1
  30. package/dist/lib/server/principal/reporting-subscriptions.mjs +4 -1
  31. package/dist/lib/server/reporting-delivery-config.d.mts +2 -2
  32. package/dist/lib/server/reporting-delivery-config.d.ts +2 -2
  33. package/dist/lib/server/reporting-delivery-config.js +9 -3
  34. package/dist/lib/server/reporting-delivery-config.mjs +9 -3
  35. package/dist/lib/server/wire-safe.js +3 -0
  36. package/dist/lib/server/wire-safe.mjs +3 -0
  37. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  38. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  39. package/dist/lib/utils/json-depth.d.mts +8 -0
  40. package/dist/lib/utils/json-depth.d.ts +8 -0
  41. package/dist/lib/utils/json-depth.js +18 -2
  42. package/dist/lib/utils/json-depth.mjs +16 -1
  43. package/dist/lib/version.d.mts +3 -3
  44. package/dist/lib/version.d.ts +3 -3
  45. package/dist/lib/version.js +3 -3
  46. package/dist/lib/version.mjs +3 -3
  47. package/docs/TYPE-SUMMARY.md +2 -2
  48. package/docs/llms.txt +2 -2
  49. package/docs/migration-14.x-rc-worksheet.md +4 -4
  50. package/docs/migration-16-to-17.md +22 -8
  51. package/package.json +1 -1
@@ -20,6 +20,7 @@ var runtime_exports = {};
20
20
  __export(runtime_exports, {
21
21
  ACCOUNT_NOTIFICATION_TYPES: () => ACCOUNT_NOTIFICATION_TYPES,
22
22
  CALLER_NOTIFICATION_TYPES: () => CALLER_NOTIFICATION_TYPES,
23
+ NOTIFICATION_WEBHOOK_SCHEMAS: () => NOTIFICATION_WEBHOOK_SCHEMAS,
23
24
  createPersistentNotificationRuntime: () => createPersistentNotificationRuntime,
24
25
  notificationSuppressionDisposition: () => notificationSuppressionDisposition,
25
26
  projectNotificationSubscriptionReadback: () => projectNotificationSubscriptionReadback,
@@ -30,6 +31,7 @@ module.exports = __toCommonJS(runtime_exports);
30
31
  var import_node_crypto = require("node:crypto");
31
32
  var import_promises = require("node:dns/promises");
32
33
  var import_jcs = require('../../utils/jcs.js');
34
+ var import_schema_loader = require('../../validation/schema-loader.js');
33
35
  var import_common = require('../webhook-delivery/common.js');
34
36
  var import_ssrf = require('../../substitution/observer/ssrf.js');
35
37
  var import_pin_and_bind_fetch = require('../pin-and-bind-fetch.js');
@@ -835,8 +837,23 @@ function assertEvent(event, accountEventTypes, callerOnlyEventTypes) {
835
837
  field
836
838
  );
837
839
  }
840
+ assertWebhookExclusions(event);
838
841
  }
839
842
  const IDENTIFIERS_ONLY_PAYLOAD_FIELDS = {
843
+ // AdCP 3.3 experimental media_buy.seller_offers: the same identifiers-only rule.
844
+ "proposal.offered": /* @__PURE__ */ new Set([
845
+ "idempotency_key",
846
+ "notification_id",
847
+ "notification_type",
848
+ "fired_at",
849
+ "subscriber_id",
850
+ "account_id",
851
+ "media_buy_id",
852
+ "proposal_id",
853
+ "expires_at",
854
+ "offer_reason",
855
+ "ext"
856
+ ]),
840
857
  "proposal.created": /* @__PURE__ */ new Set([
841
858
  "idempotency_key",
842
859
  "notification_id",
@@ -852,6 +869,87 @@ const IDENTIFIERS_ONLY_PAYLOAD_FIELDS = {
852
869
  "ext"
853
870
  ])
854
871
  };
872
+ const NOTIFICATION_WEBHOOK_SCHEMAS = Object.freeze({
873
+ "capabilities.changed": "core/capabilities-changed-webhook.json",
874
+ "principal.changed": "core/principal-changed-webhook.json",
875
+ "account_request.changed": "core/account-request-changed-webhook.json",
876
+ "creative.status_changed": "creative/creative-status-changed-webhook.json",
877
+ "creative.assignment_changed": "creative/creative-assignment-changed-webhook.json",
878
+ "indicators.changed": "core/indicators-changed-webhook.json",
879
+ "creative.purged": "creative/creative-purged-webhook.json",
880
+ "creative.staged_update_changed": "creative/creative-staged-update-changed-webhook.json",
881
+ "account.status_changed": "core/account-status-changed-webhook.json",
882
+ "account.change_recorded": "core/account-change-recorded-webhook.json",
883
+ "product.created": "core/wholesale-feed-webhook.json",
884
+ "product.updated": "core/wholesale-feed-webhook.json",
885
+ "product.priced": "core/wholesale-feed-webhook.json",
886
+ "product.removed": "core/wholesale-feed-webhook.json",
887
+ "signal.created": "core/wholesale-feed-webhook.json",
888
+ "signal.updated": "core/wholesale-feed-webhook.json",
889
+ "signal.priced": "core/wholesale-feed-webhook.json",
890
+ "signal.removed": "core/wholesale-feed-webhook.json",
891
+ "wholesale_feed.bulk_change": "core/wholesale-feed-webhook.json",
892
+ "collection_card.updated": "core/wholesale-feed-webhook.json",
893
+ "collection_card.removed": "core/wholesale-feed-webhook.json",
894
+ "collection_catalog.bulk_change": "core/wholesale-feed-webhook.json",
895
+ "proposal.created": "core/proposal-created-webhook.json",
896
+ "proposal.offered": "core/proposal-offered-webhook.json",
897
+ "reporting.delivery_ready": "core/reporting-delivery-ready-webhook.json",
898
+ "reporting.status_changed": "core/reporting-status-changed-webhook.json",
899
+ "reporting.ledger_changed": "core/reporting-ledger-changed-webhook.json"
900
+ });
901
+ const PLAIN_MEMBER = /^[a-z][a-z0-9_]{0,63}$/;
902
+ function assertWebhookExclusions(event) {
903
+ const ref = NOTIFICATION_WEBHOOK_SCHEMAS[event.notificationType];
904
+ if (!ref) return;
905
+ const validate = (0, import_schema_loader.getSchemaValidatorByRef)(ref, void 0, void 0, { allErrors: true });
906
+ if (!validate) throw new Error(`Webhook payload schema unavailable for ${event.notificationType}: ${ref}`);
907
+ const body = {
908
+ ...event.payload,
909
+ notification_type: event.notificationType,
910
+ notification_id: event.notificationId,
911
+ ...event.accountId === void 0 ? {} : { account_id: event.accountId }
912
+ };
913
+ validate(body);
914
+ const exclusion = validate.errors?.find((error) => error.keyword === "not");
915
+ if (!exclusion) return;
916
+ const segments = exclusion.instancePath.split("/").slice(1).map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
917
+ const plain = segments.every((segment) => PLAIN_MEMBER.test(segment) || /^\d+$/.test(segment));
918
+ const location = plain ? ["payload", ...segments].join(".") : "payload";
919
+ let target = body;
920
+ for (const segment of plain ? segments : []) {
921
+ target = target && typeof target === "object" ? target[segment] : void 0;
922
+ }
923
+ const present = excludedMembers(ref, exclusion.schemaPath).filter(
924
+ (member) => plain && target !== null && typeof target === "object" && Object.hasOwn(target, member)
925
+ );
926
+ const field = present.length > 0 ? `${location}.${present[0]}` : location;
927
+ throw new import_types.NotificationSubscriptionValidationError(
928
+ `${event.notificationType} must not carry ${present.length > 0 ? present.map((member) => `${location}.${member}`).join(" with ") : `what its webhook schema excludes at ${location}`}`,
929
+ field
930
+ );
931
+ }
932
+ function excludedMembers(ref, schemaPath) {
933
+ if (!schemaPath.startsWith("#/")) return [];
934
+ let node = (0, import_schema_loader.getSchemaDocumentByRef)(ref)?.schema;
935
+ for (const segment of schemaPath.slice(2).split("/")) {
936
+ if (!node || typeof node !== "object") return [];
937
+ node = node[segment.replace(/~1/g, "/").replace(/~0/g, "~")];
938
+ }
939
+ const members = /* @__PURE__ */ new Set();
940
+ const collect = (value) => {
941
+ const required = value && typeof value === "object" ? value.required : void 0;
942
+ if (Array.isArray(required)) {
943
+ for (const key of required) if (typeof key === "string") members.add(key);
944
+ }
945
+ };
946
+ collect(node);
947
+ for (const keyword of ["anyOf", "oneOf"]) {
948
+ const branches = node && typeof node === "object" ? node[keyword] : void 0;
949
+ if (Array.isArray(branches)) branches.forEach(collect);
950
+ }
951
+ return [...members].filter((member) => PLAIN_MEMBER.test(member));
952
+ }
855
953
  function assertUniqueSubscribers(configs) {
856
954
  if (!Array.isArray(configs) || configs.length > 16) {
857
955
  throw new import_types.NotificationSubscriptionValidationError(
@@ -1040,6 +1138,7 @@ function validation(message, index, field) {
1040
1138
  0 && (module.exports = {
1041
1139
  ACCOUNT_NOTIFICATION_TYPES,
1042
1140
  CALLER_NOTIFICATION_TYPES,
1141
+ NOTIFICATION_WEBHOOK_SCHEMAS,
1043
1142
  createPersistentNotificationRuntime,
1044
1143
  notificationSuppressionDisposition,
1045
1144
  projectNotificationSubscriptionReadback,
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { lookup } from "node:dns/promises";
3
3
  import { canonicalJsonSha256 } from "../../utils/jcs.mjs";
4
+ import { getSchemaDocumentByRef, getSchemaValidatorByRef } from "../../validation/schema-loader.mjs";
4
5
  import { isWebhookDeliveryTerminalError } from "../webhook-delivery/common.mjs";
5
6
  import { enforceSsrfPolicy, enforceSsrfPolicyResolved } from "../../substitution/observer/ssrf.mjs";
6
7
  import { WEBHOOK_SSRF_POLICY } from "../pin-and-bind-fetch.mjs";
@@ -806,8 +807,23 @@ function assertEvent(event, accountEventTypes, callerOnlyEventTypes) {
806
807
  field
807
808
  );
808
809
  }
810
+ assertWebhookExclusions(event);
809
811
  }
810
812
  const IDENTIFIERS_ONLY_PAYLOAD_FIELDS = {
813
+ // AdCP 3.3 experimental media_buy.seller_offers: the same identifiers-only rule.
814
+ "proposal.offered": /* @__PURE__ */ new Set([
815
+ "idempotency_key",
816
+ "notification_id",
817
+ "notification_type",
818
+ "fired_at",
819
+ "subscriber_id",
820
+ "account_id",
821
+ "media_buy_id",
822
+ "proposal_id",
823
+ "expires_at",
824
+ "offer_reason",
825
+ "ext"
826
+ ]),
811
827
  "proposal.created": /* @__PURE__ */ new Set([
812
828
  "idempotency_key",
813
829
  "notification_id",
@@ -823,6 +839,87 @@ const IDENTIFIERS_ONLY_PAYLOAD_FIELDS = {
823
839
  "ext"
824
840
  ])
825
841
  };
842
+ const NOTIFICATION_WEBHOOK_SCHEMAS = Object.freeze({
843
+ "capabilities.changed": "core/capabilities-changed-webhook.json",
844
+ "principal.changed": "core/principal-changed-webhook.json",
845
+ "account_request.changed": "core/account-request-changed-webhook.json",
846
+ "creative.status_changed": "creative/creative-status-changed-webhook.json",
847
+ "creative.assignment_changed": "creative/creative-assignment-changed-webhook.json",
848
+ "indicators.changed": "core/indicators-changed-webhook.json",
849
+ "creative.purged": "creative/creative-purged-webhook.json",
850
+ "creative.staged_update_changed": "creative/creative-staged-update-changed-webhook.json",
851
+ "account.status_changed": "core/account-status-changed-webhook.json",
852
+ "account.change_recorded": "core/account-change-recorded-webhook.json",
853
+ "product.created": "core/wholesale-feed-webhook.json",
854
+ "product.updated": "core/wholesale-feed-webhook.json",
855
+ "product.priced": "core/wholesale-feed-webhook.json",
856
+ "product.removed": "core/wholesale-feed-webhook.json",
857
+ "signal.created": "core/wholesale-feed-webhook.json",
858
+ "signal.updated": "core/wholesale-feed-webhook.json",
859
+ "signal.priced": "core/wholesale-feed-webhook.json",
860
+ "signal.removed": "core/wholesale-feed-webhook.json",
861
+ "wholesale_feed.bulk_change": "core/wholesale-feed-webhook.json",
862
+ "collection_card.updated": "core/wholesale-feed-webhook.json",
863
+ "collection_card.removed": "core/wholesale-feed-webhook.json",
864
+ "collection_catalog.bulk_change": "core/wholesale-feed-webhook.json",
865
+ "proposal.created": "core/proposal-created-webhook.json",
866
+ "proposal.offered": "core/proposal-offered-webhook.json",
867
+ "reporting.delivery_ready": "core/reporting-delivery-ready-webhook.json",
868
+ "reporting.status_changed": "core/reporting-status-changed-webhook.json",
869
+ "reporting.ledger_changed": "core/reporting-ledger-changed-webhook.json"
870
+ });
871
+ const PLAIN_MEMBER = /^[a-z][a-z0-9_]{0,63}$/;
872
+ function assertWebhookExclusions(event) {
873
+ const ref = NOTIFICATION_WEBHOOK_SCHEMAS[event.notificationType];
874
+ if (!ref) return;
875
+ const validate = getSchemaValidatorByRef(ref, void 0, void 0, { allErrors: true });
876
+ if (!validate) throw new Error(`Webhook payload schema unavailable for ${event.notificationType}: ${ref}`);
877
+ const body = {
878
+ ...event.payload,
879
+ notification_type: event.notificationType,
880
+ notification_id: event.notificationId,
881
+ ...event.accountId === void 0 ? {} : { account_id: event.accountId }
882
+ };
883
+ validate(body);
884
+ const exclusion = validate.errors?.find((error) => error.keyword === "not");
885
+ if (!exclusion) return;
886
+ const segments = exclusion.instancePath.split("/").slice(1).map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
887
+ const plain = segments.every((segment) => PLAIN_MEMBER.test(segment) || /^\d+$/.test(segment));
888
+ const location = plain ? ["payload", ...segments].join(".") : "payload";
889
+ let target = body;
890
+ for (const segment of plain ? segments : []) {
891
+ target = target && typeof target === "object" ? target[segment] : void 0;
892
+ }
893
+ const present = excludedMembers(ref, exclusion.schemaPath).filter(
894
+ (member) => plain && target !== null && typeof target === "object" && Object.hasOwn(target, member)
895
+ );
896
+ const field = present.length > 0 ? `${location}.${present[0]}` : location;
897
+ throw new NotificationSubscriptionValidationError(
898
+ `${event.notificationType} must not carry ${present.length > 0 ? present.map((member) => `${location}.${member}`).join(" with ") : `what its webhook schema excludes at ${location}`}`,
899
+ field
900
+ );
901
+ }
902
+ function excludedMembers(ref, schemaPath) {
903
+ if (!schemaPath.startsWith("#/")) return [];
904
+ let node = getSchemaDocumentByRef(ref)?.schema;
905
+ for (const segment of schemaPath.slice(2).split("/")) {
906
+ if (!node || typeof node !== "object") return [];
907
+ node = node[segment.replace(/~1/g, "/").replace(/~0/g, "~")];
908
+ }
909
+ const members = /* @__PURE__ */ new Set();
910
+ const collect = (value) => {
911
+ const required = value && typeof value === "object" ? value.required : void 0;
912
+ if (Array.isArray(required)) {
913
+ for (const key of required) if (typeof key === "string") members.add(key);
914
+ }
915
+ };
916
+ collect(node);
917
+ for (const keyword of ["anyOf", "oneOf"]) {
918
+ const branches = node && typeof node === "object" ? node[keyword] : void 0;
919
+ if (Array.isArray(branches)) branches.forEach(collect);
920
+ }
921
+ return [...members].filter((member) => PLAIN_MEMBER.test(member));
922
+ }
826
923
  function assertUniqueSubscribers(configs) {
827
924
  if (!Array.isArray(configs) || configs.length > 16) {
828
925
  throw new NotificationSubscriptionValidationError(
@@ -1010,6 +1107,7 @@ function validation(message, index, field) {
1010
1107
  export {
1011
1108
  ACCOUNT_NOTIFICATION_TYPES,
1012
1109
  CALLER_NOTIFICATION_TYPES,
1110
+ NOTIFICATION_WEBHOOK_SCHEMAS,
1013
1111
  createPersistentNotificationRuntime,
1014
1112
  notificationSuppressionDisposition,
1015
1113
  projectNotificationSubscriptionReadback,
@@ -37,6 +37,7 @@ class ReportingSubscriptionValidationError extends Error {
37
37
  }
38
38
  field;
39
39
  }
40
+ const REPORTING_SUBSCRIPTION_SCOPE_SELECTORS = /* @__PURE__ */ new Set(["all_authorized_accounts", "account_ids"]);
40
41
  const MAX_INACTIVE_INTERVALS = 64;
41
42
  const SUBSCRIPTION_ID = /^(?!\.{1,2}$)[A-Za-z0-9_.:-]{1,64}$/;
42
43
  const PATH_TEMPLATE = /^(?!\/)(?!(?:.*\/)?\.{1,2}(?:\/|$))[A-Za-z0-9_.=/{}-]+$/;
@@ -114,7 +115,9 @@ function validateReportingSubscription(subscription, destinations) {
114
115
  if (typeof subscription.active !== "boolean") fail("active is required");
115
116
  const scope = subscription.scope;
116
117
  const scopeKeys = scope && typeof scope === "object" ? Object.keys(scope) : [];
117
- if (scopeKeys.length !== 1) fail("scope must name exactly one of all_authorized_accounts or account_ids");
118
+ if (scopeKeys.length !== 1 || !REPORTING_SUBSCRIPTION_SCOPE_SELECTORS.has(scopeKeys[0])) {
119
+ fail("scope must name exactly one of all_authorized_accounts or account_ids");
120
+ }
118
121
  if (scope.all_authorized_accounts !== void 0 && scope.all_authorized_accounts !== true) {
119
122
  fail("scope.all_authorized_accounts must be true when present");
120
123
  }
@@ -8,6 +8,7 @@ class ReportingSubscriptionValidationError extends Error {
8
8
  }
9
9
  field;
10
10
  }
11
+ const REPORTING_SUBSCRIPTION_SCOPE_SELECTORS = /* @__PURE__ */ new Set(["all_authorized_accounts", "account_ids"]);
11
12
  const MAX_INACTIVE_INTERVALS = 64;
12
13
  const SUBSCRIPTION_ID = /^(?!\.{1,2}$)[A-Za-z0-9_.:-]{1,64}$/;
13
14
  const PATH_TEMPLATE = /^(?!\/)(?!(?:.*\/)?\.{1,2}(?:\/|$))[A-Za-z0-9_.=/{}-]+$/;
@@ -85,7 +86,9 @@ function validateReportingSubscription(subscription, destinations) {
85
86
  if (typeof subscription.active !== "boolean") fail("active is required");
86
87
  const scope = subscription.scope;
87
88
  const scopeKeys = scope && typeof scope === "object" ? Object.keys(scope) : [];
88
- if (scopeKeys.length !== 1) fail("scope must name exactly one of all_authorized_accounts or account_ids");
89
+ if (scopeKeys.length !== 1 || !REPORTING_SUBSCRIPTION_SCOPE_SELECTORS.has(scopeKeys[0])) {
90
+ fail("scope must name exactly one of all_authorized_accounts or account_ids");
91
+ }
89
92
  if (scope.all_authorized_accounts !== void 0 && scope.all_authorized_accounts !== true) {
90
93
  fail("scope.all_authorized_accounts must be true when present");
91
94
  }
@@ -12,7 +12,7 @@ import type { ReportingDeliveryConfigurationState } from '../types/tools.generat
12
12
  * persistence model fail closed, so they never reach a buyer or an
13
13
  * idempotency/replay cache. AdCP 3.3.0-beta.6 opened these schemas
14
14
  * (adcontextprotocol/adcp#8866), so schema validation alone no longer rejects
15
- * an unknown member; a credential-shaped key or SDK-internal field anywhere in
16
- * the record is refused explicitly.
15
+ * an unknown member: a credential-shaped key or SDK-internal field anywhere in
16
+ * the record is refused, and every other undeclared member is stripped.
17
17
  */
18
18
  export declare function projectReportingDeliveryConfigStates(states: readonly ReportingDeliveryConfigurationState[]): ReportingDeliveryConfigurationState[];
@@ -12,7 +12,7 @@ import type { ReportingDeliveryConfigurationState } from '../types/tools.generat
12
12
  * persistence model fail closed, so they never reach a buyer or an
13
13
  * idempotency/replay cache. AdCP 3.3.0-beta.6 opened these schemas
14
14
  * (adcontextprotocol/adcp#8866), so schema validation alone no longer rejects
15
- * an unknown member; a credential-shaped key or SDK-internal field anywhere in
16
- * the record is refused explicitly.
15
+ * an unknown member: a credential-shaped key or SDK-internal field anywhere in
16
+ * the record is refused, and every other undeclared member is stripped.
17
17
  */
18
18
  export declare function projectReportingDeliveryConfigStates(states: readonly ReportingDeliveryConfigurationState[]): ReportingDeliveryConfigurationState[];
@@ -21,9 +21,12 @@ __export(reporting_delivery_config_exports, {
21
21
  projectReportingDeliveryConfigStates: () => projectReportingDeliveryConfigStates
22
22
  });
23
23
  module.exports = __toCommonJS(reporting_delivery_config_exports);
24
+ var import_schema_projection = require('../adapters/version/schema-projection.js');
25
+ var import_json_depth = require('../utils/json-depth.js');
24
26
  var import_schema_loader = require('../validation/schema-loader.js');
25
27
  var import_account_response_identity = require('./account-response-identity.js');
26
28
  const MAX_REPORTING_DELIVERY_CONFIGS = 16;
29
+ const DELIVERY_CONFIG_STATE_SCHEMA = "core/reporting-delivery-config-state.json";
27
30
  const CREDENTIAL_LIKE_URL_COMPONENT = /\b(?:access[_-]?token|api[_-]?key|assertion|authorization|bearer|code|credential|password|passwd|secret|session|signature|token|x-amz-credential|x-amz-security-token|x-amz-signature)\b/i;
28
31
  function isCredentialLikeUrlComponent(value) {
29
32
  try {
@@ -56,9 +59,12 @@ function projectReportingDeliveryConfigStates(states) {
56
59
  if (!Array.isArray(states) || states.length > MAX_REPORTING_DELIVERY_CONFIGS) {
57
60
  throw new Error(`reporting_delivery_configs must contain at most ${MAX_REPORTING_DELIVERY_CONFIGS} state records`);
58
61
  }
59
- const validateState = (0, import_schema_loader.getSchemaValidatorByRef)("core/reporting-delivery-config-state.json");
62
+ const validateState = (0, import_schema_loader.getSchemaValidatorByRef)(DELIVERY_CONFIG_STATE_SCHEMA);
60
63
  if (!validateState) {
61
- throw new Error("Bundled schema core/reporting-delivery-config-state.json is unavailable");
64
+ throw new Error(`Bundled schema ${DELIVERY_CONFIG_STATE_SCHEMA} is unavailable`);
65
+ }
66
+ if (states.some((state) => (0, import_json_depth.exceedsJsonDepth)(state))) {
67
+ throw new Error("reporting_delivery_configs contains a state that exceeds the maximum JSON depth");
62
68
  }
63
69
  const snapshots = states.map((state) => structuredClone(state));
64
70
  for (const state of snapshots) {
@@ -67,7 +73,7 @@ function projectReportingDeliveryConfigStates(states) {
67
73
  }
68
74
  assertSafeSetupUrl(state.setup?.url);
69
75
  }
70
- return snapshots;
76
+ return snapshots.map((state) => (0, import_schema_projection.projectToDeclaredMembers)(DELIVERY_CONFIG_STATE_SCHEMA, state).value);
71
77
  }
72
78
  // Annotate the CommonJS export names for ESM import in node:
73
79
  0 && (module.exports = {
@@ -1,6 +1,9 @@
1
+ import { projectToDeclaredMembers } from "../adapters/version/schema-projection.mjs";
2
+ import { exceedsJsonDepth } from "../utils/json-depth.mjs";
1
3
  import { getSchemaValidatorByRef } from "../validation/schema-loader.mjs";
2
4
  import { retainsNonResponseAccountMember } from "./account-response-identity.mjs";
3
5
  const MAX_REPORTING_DELIVERY_CONFIGS = 16;
6
+ const DELIVERY_CONFIG_STATE_SCHEMA = "core/reporting-delivery-config-state.json";
4
7
  const CREDENTIAL_LIKE_URL_COMPONENT = /\b(?:access[_-]?token|api[_-]?key|assertion|authorization|bearer|code|credential|password|passwd|secret|session|signature|token|x-amz-credential|x-amz-security-token|x-amz-signature)\b/i;
5
8
  function isCredentialLikeUrlComponent(value) {
6
9
  try {
@@ -33,9 +36,12 @@ function projectReportingDeliveryConfigStates(states) {
33
36
  if (!Array.isArray(states) || states.length > MAX_REPORTING_DELIVERY_CONFIGS) {
34
37
  throw new Error(`reporting_delivery_configs must contain at most ${MAX_REPORTING_DELIVERY_CONFIGS} state records`);
35
38
  }
36
- const validateState = getSchemaValidatorByRef("core/reporting-delivery-config-state.json");
39
+ const validateState = getSchemaValidatorByRef(DELIVERY_CONFIG_STATE_SCHEMA);
37
40
  if (!validateState) {
38
- throw new Error("Bundled schema core/reporting-delivery-config-state.json is unavailable");
41
+ throw new Error(`Bundled schema ${DELIVERY_CONFIG_STATE_SCHEMA} is unavailable`);
42
+ }
43
+ if (states.some((state) => exceedsJsonDepth(state))) {
44
+ throw new Error("reporting_delivery_configs contains a state that exceeds the maximum JSON depth");
39
45
  }
40
46
  const snapshots = states.map((state) => structuredClone(state));
41
47
  for (const state of snapshots) {
@@ -44,7 +50,7 @@ function projectReportingDeliveryConfigStates(states) {
44
50
  }
45
51
  assertSafeSetupUrl(state.setup?.url);
46
52
  }
47
- return snapshots;
53
+ return snapshots.map((state) => projectToDeclaredMembers(DELIVERY_CONFIG_STATE_SCHEMA, state).value);
48
54
  }
49
55
  export {
50
56
  projectReportingDeliveryConfigStates
@@ -76,6 +76,9 @@ function scrubExtensions(request, options) {
76
76
  function stripNestedCredentials(value, patterns, fromDepth = 0) {
77
77
  const hits = new Set((0, import_credential_policy.scanArgsForCredentials)(value, patterns));
78
78
  if (hits.size === 0) return value;
79
+ if ([...hits].some((hit) => hit.endsWith("<too-deep>") || hit.endsWith("<unreadable>"))) {
80
+ return Array.isArray(value) ? [] : {};
81
+ }
79
82
  const seen = /* @__PURE__ */ new WeakSet();
80
83
  const walk = (node, path, depth) => {
81
84
  if (node === null || typeof node !== "object") return node;
@@ -51,6 +51,9 @@ function scrubExtensions(request, options) {
51
51
  function stripNestedCredentials(value, patterns, fromDepth = 0) {
52
52
  const hits = new Set(scanArgsForCredentials(value, patterns));
53
53
  if (hits.size === 0) return value;
54
+ if ([...hits].some((hit) => hit.endsWith("<too-deep>") || hit.endsWith("<unreadable>"))) {
55
+ return Array.isArray(value) ? [] : {};
56
+ }
54
57
  const seen = /* @__PURE__ */ new WeakSet();
55
58
  const walk = (node, path, depth) => {
56
59
  if (node === null || typeof node !== "object") return node;
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.24";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.25";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -200,7 +200,7 @@ export interface UpstreamTrafficQueryResult {
200
200
  */
201
201
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
202
202
  /** Capability semver emitted in run summaries and used for advisory expiry. */
203
- export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.24";
203
+ export declare const RUNNER_CAPABILITY_VERSION = "17.0.0-beta.25";
204
204
  /** True when a failed validation contributes to the owning step's grade. */
205
205
  export declare function validationFailsStep(result: ValidationResult): boolean;
206
206
  /**
@@ -1 +1,9 @@
1
1
  export declare const MAX_JSON_DEPTH = 256;
2
+ /**
3
+ * Whether a value nests objects or arrays deeper than `max`. Iterative, so a
4
+ * hostile or corrupted value cannot overflow the stack before a bounded walk
5
+ * (or `structuredClone`) rejects it. A node shared through several paths is
6
+ * revisited whenever a deeper path reaches it, so a long chain cannot hide
7
+ * behind shallow aliases; a cycle therefore counts as exceeding `max`.
8
+ */
9
+ export declare function exceedsJsonDepth(value: unknown, max?: number): boolean;
@@ -1 +1,9 @@
1
1
  export declare const MAX_JSON_DEPTH = 256;
2
+ /**
3
+ * Whether a value nests objects or arrays deeper than `max`. Iterative, so a
4
+ * hostile or corrupted value cannot overflow the stack before a bounded walk
5
+ * (or `structuredClone`) rejects it. A node shared through several paths is
6
+ * revisited whenever a deeper path reaches it, so a long chain cannot hide
7
+ * behind shallow aliases; a cycle therefore counts as exceeding `max`.
8
+ */
9
+ export declare function exceedsJsonDepth(value: unknown, max?: number): boolean;
@@ -18,11 +18,27 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var json_depth_exports = {};
20
20
  __export(json_depth_exports, {
21
- MAX_JSON_DEPTH: () => MAX_JSON_DEPTH
21
+ MAX_JSON_DEPTH: () => MAX_JSON_DEPTH,
22
+ exceedsJsonDepth: () => exceedsJsonDepth
22
23
  });
23
24
  module.exports = __toCommonJS(json_depth_exports);
24
25
  const MAX_JSON_DEPTH = 256;
26
+ function exceedsJsonDepth(value, max = MAX_JSON_DEPTH) {
27
+ const stack = [{ node: value, depth: 0 }];
28
+ const deepest = /* @__PURE__ */ new Map();
29
+ while (stack.length > 0) {
30
+ const { node, depth } = stack.pop();
31
+ if (node === null || typeof node !== "object") continue;
32
+ if (depth > max) return true;
33
+ const previous = deepest.get(node);
34
+ if (previous !== void 0 && previous >= depth) continue;
35
+ deepest.set(node, depth);
36
+ for (const child of Object.values(node)) stack.push({ node: child, depth: depth + 1 });
37
+ }
38
+ return false;
39
+ }
25
40
  // Annotate the CommonJS export names for ESM import in node:
26
41
  0 && (module.exports = {
27
- MAX_JSON_DEPTH
42
+ MAX_JSON_DEPTH,
43
+ exceedsJsonDepth
28
44
  });
@@ -1,4 +1,19 @@
1
1
  const MAX_JSON_DEPTH = 256;
2
+ function exceedsJsonDepth(value, max = MAX_JSON_DEPTH) {
3
+ const stack = [{ node: value, depth: 0 }];
4
+ const deepest = /* @__PURE__ */ new Map();
5
+ while (stack.length > 0) {
6
+ const { node, depth } = stack.pop();
7
+ if (node === null || typeof node !== "object") continue;
8
+ if (depth > max) return true;
9
+ const previous = deepest.get(node);
10
+ if (previous !== void 0 && previous >= depth) continue;
11
+ deepest.set(node, depth);
12
+ for (const child of Object.values(node)) stack.push({ node: child, depth: depth + 1 });
13
+ }
14
+ return false;
15
+ }
2
16
  export {
3
- MAX_JSON_DEPTH
17
+ MAX_JSON_DEPTH,
18
+ exceedsJsonDepth
4
19
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AdCP SDK library version
3
3
  */
4
- export declare const LIBRARY_VERSION = "17.0.0-beta.24";
4
+ export declare const LIBRARY_VERSION = "17.0.0-beta.25";
5
5
  /**
6
6
  * AdCP specification version this library is built for
7
7
  */
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
33
33
  * Full version information
34
34
  */
35
35
  export declare const VERSION_INFO: {
36
- readonly library: "17.0.0-beta.24";
36
+ readonly library: "17.0.0-beta.25";
37
37
  readonly adcp: "3.3.0-beta.6";
38
38
  readonly compatibleVersions: readonly ["v3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.0.13", "3.0.14", "3.0.15", "3.0.16", "3.0.17", "3.0.18", "3.0.19", "3.0.20", "3.0.21", "3.0.22", "3.0.23", "3.0.24", "3.0.25", "3.1.0", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.1.5", "3.1.6", "3.1.7", "3.1.8", "3.1.9", "3.1.10", "3.1.11", "3.1.12", "3.1.13", "3.1.14", "3.1.15", "3.1.16", "3.1.17", "3.1.18", "3.1.19", "3.1.20", "3.1.21", "3.1.22", "3.1.23", "3.1.24", "3.1.25", "3.1.26", "3.1.27", "3.1.28", "3.1.29", "3.1.30", "3.1.31", "3.2.1", "3.2", "3.2.2", "3.2.3", "3.2.4", "3.2.5", "3.2.6", "3.2.7", "3.2.8", "3.3.0-beta.6", "3.3-beta.6"];
39
- readonly generatedAt: "2026-11-13T23:01:19.246Z";
39
+ readonly generatedAt: "2026-11-14T01:28:39.866Z";
40
40
  };
41
41
  /**
42
42
  * Get the AdCP specification version this library is built for
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * AdCP SDK library version
3
3
  */
4
- export declare const LIBRARY_VERSION = "17.0.0-beta.24";
4
+ export declare const LIBRARY_VERSION = "17.0.0-beta.25";
5
5
  /**
6
6
  * AdCP specification version this library is built for
7
7
  */
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
33
33
  * Full version information
34
34
  */
35
35
  export declare const VERSION_INFO: {
36
- readonly library: "17.0.0-beta.24";
36
+ readonly library: "17.0.0-beta.25";
37
37
  readonly adcp: "3.3.0-beta.6";
38
38
  readonly compatibleVersions: readonly ["v3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.0.13", "3.0.14", "3.0.15", "3.0.16", "3.0.17", "3.0.18", "3.0.19", "3.0.20", "3.0.21", "3.0.22", "3.0.23", "3.0.24", "3.0.25", "3.1.0", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.1.4", "3.1.5", "3.1.6", "3.1.7", "3.1.8", "3.1.9", "3.1.10", "3.1.11", "3.1.12", "3.1.13", "3.1.14", "3.1.15", "3.1.16", "3.1.17", "3.1.18", "3.1.19", "3.1.20", "3.1.21", "3.1.22", "3.1.23", "3.1.24", "3.1.25", "3.1.26", "3.1.27", "3.1.28", "3.1.29", "3.1.30", "3.1.31", "3.2.1", "3.2", "3.2.2", "3.2.3", "3.2.4", "3.2.5", "3.2.6", "3.2.7", "3.2.8", "3.3.0-beta.6", "3.3-beta.6"];
39
- readonly generatedAt: "2026-11-13T23:01:19.246Z";
39
+ readonly generatedAt: "2026-11-14T01:28:39.866Z";
40
40
  };
41
41
  /**
42
42
  * Get the AdCP specification version this library is built for
@@ -31,7 +31,7 @@ __export(version_exports, {
31
31
  toReleasePrecisionVersion: () => toReleasePrecisionVersion
32
32
  });
33
33
  module.exports = __toCommonJS(version_exports);
34
- const LIBRARY_VERSION = "17.0.0-beta.24";
34
+ const LIBRARY_VERSION = "17.0.0-beta.25";
35
35
  const ADCP_VERSION = "3.3.0-beta.6";
36
36
  const ADCP_MAJOR_VERSION = 3;
37
37
  const COMPATIBLE_ADCP_VERSIONS = [
@@ -109,10 +109,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
109
109
  "3.3-beta.6"
110
110
  ];
111
111
  const VERSION_INFO = {
112
- library: "17.0.0-beta.24",
112
+ library: "17.0.0-beta.25",
113
113
  adcp: "3.3.0-beta.6",
114
114
  compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
115
- generatedAt: "2026-11-13T23:01:19.246Z"
115
+ generatedAt: "2026-11-14T01:28:39.866Z"
116
116
  };
117
117
  function getAdcpVersion() {
118
118
  return ADCP_VERSION;
@@ -1,4 +1,4 @@
1
- const LIBRARY_VERSION = "17.0.0-beta.24";
1
+ const LIBRARY_VERSION = "17.0.0-beta.25";
2
2
  const ADCP_VERSION = "3.3.0-beta.6";
3
3
  const ADCP_MAJOR_VERSION = 3;
4
4
  const COMPATIBLE_ADCP_VERSIONS = [
@@ -76,10 +76,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
76
76
  "3.3-beta.6"
77
77
  ];
78
78
  const VERSION_INFO = {
79
- library: "17.0.0-beta.24",
79
+ library: "17.0.0-beta.25",
80
80
  adcp: "3.3.0-beta.6",
81
81
  compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
82
- generatedAt: "2026-11-13T23:01:19.246Z"
82
+ generatedAt: "2026-11-14T01:28:39.866Z"
83
83
  };
84
84
  function getAdcpVersion() {
85
85
  return ADCP_VERSION;
@@ -1,7 +1,7 @@
1
1
  # AdCP Type Summary
2
2
 
3
- > Generated at: 2026-11-13
4
- > @adcp/sdk v17.0.0-beta.24
3
+ > Generated at: 2026-11-14
4
+ > @adcp/sdk v17.0.0-beta.25
5
5
 
6
6
  Curated reference of the types that matter for using the AdCP client. For full generated types see `src/lib/types/tools.generated.ts` and `src/lib/types/core.generated.ts`.
7
7
 
package/docs/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # Ad Context Protocol (AdCP)
2
2
 
3
- > Generated at: 2026-11-13
4
- > Library: @adcp/sdk v17.0.0-beta.24
3
+ > Generated at: 2026-11-14
4
+ > Library: @adcp/sdk v17.0.0-beta.25
5
5
  > AdCP major version: 3
6
6
  > Canonical URL: https://adcontextprotocol.github.io/adcp-client/llms.txt
7
7
  > Note: the `Library` stamp reflects the package.json version at doc-generation time. The narrative below describes the surface that lands on the next-published minor — including any 6.7 helpers documented here ahead of the release tag.