@adcp/sdk 16.0.0-beta.2 → 16.0.0-beta.4

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 (248) hide show
  1. package/README.md +54 -0
  2. package/dist/lib/auth/oauth/diagnose.js +3 -11
  3. package/dist/lib/auth/oauth/diagnose.mjs +4 -12
  4. package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
  5. package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
  6. package/dist/lib/auth/oauth/diagnostics.js +8 -10
  7. package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
  8. package/dist/lib/core/ConversationTypes.d.mts +8 -3
  9. package/dist/lib/core/ConversationTypes.d.ts +8 -3
  10. package/dist/lib/core/SingleAgentClient.d.mts +5 -3
  11. package/dist/lib/core/SingleAgentClient.d.ts +5 -3
  12. package/dist/lib/core/TaskExecutor.js +5 -1
  13. package/dist/lib/core/TaskExecutor.mjs +5 -1
  14. package/dist/lib/errors/index.d.mts +9 -4
  15. package/dist/lib/errors/index.d.ts +9 -4
  16. package/dist/lib/index.d.mts +3 -3
  17. package/dist/lib/index.d.ts +3 -3
  18. package/dist/lib/index.js +8 -0
  19. package/dist/lib/index.mjs +14 -2
  20. package/dist/lib/negotiation/types.d.mts +20 -39
  21. package/dist/lib/negotiation/types.d.ts +20 -39
  22. package/dist/lib/protocols/index.d.mts +60 -24
  23. package/dist/lib/protocols/index.d.ts +60 -24
  24. package/dist/lib/protocols/index.js +9 -4
  25. package/dist/lib/protocols/index.mjs +3 -0
  26. package/dist/lib/protocols/mcp-modern.js +1 -0
  27. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  28. package/dist/lib/protocols/mcp.js +1 -0
  29. package/dist/lib/protocols/mcp.mjs +2 -1
  30. package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
  31. package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
  32. package/dist/lib/protocols/responseSizeLimit.js +195 -31
  33. package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
  34. package/dist/lib/reporting/consumer-runtime.js +2 -1
  35. package/dist/lib/reporting/consumer-runtime.mjs +2 -1
  36. package/dist/lib/reporting/ledger/handler.js +50 -11
  37. package/dist/lib/reporting/ledger/handler.mjs +50 -12
  38. package/dist/lib/reporting/ledger/index.d.mts +17 -14
  39. package/dist/lib/reporting/ledger/index.d.ts +17 -14
  40. package/dist/lib/reporting/ledger/index.js +32 -20
  41. package/dist/lib/reporting/ledger/index.mjs +21 -10
  42. package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
  43. package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
  44. package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
  45. package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
  46. package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
  47. package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
  48. package/dist/lib/reporting/ledger/receipts.js +186 -0
  49. package/dist/lib/reporting/ledger/receipts.mjs +161 -0
  50. package/dist/lib/reporting/ledger/status-ingest.js +3 -3
  51. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
  52. package/dist/lib/reporting/ledger/types.d.mts +43 -0
  53. package/dist/lib/reporting/ledger/types.d.ts +43 -0
  54. package/dist/lib/reporting/ledger/types.js +31 -2
  55. package/dist/lib/reporting/ledger/types.mjs +26 -1
  56. package/dist/lib/reporting/pagination.d.mts +6 -0
  57. package/dist/lib/reporting/pagination.d.ts +6 -0
  58. package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
  59. package/dist/lib/reporting/pagination.mjs +12 -0
  60. package/dist/lib/reporting/reconciliation.d.mts +1 -0
  61. package/dist/lib/reporting/reconciliation.d.ts +1 -0
  62. package/dist/lib/reporting/reconciliation.js +3 -2
  63. package/dist/lib/reporting/reconciliation.mjs +3 -2
  64. package/dist/lib/reporting/service/index.d.mts +79 -153
  65. package/dist/lib/reporting/service/index.d.ts +79 -153
  66. package/dist/lib/reporting/service/index.js +34 -491
  67. package/dist/lib/reporting/service/index.mjs +36 -510
  68. package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
  69. package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
  70. package/dist/lib/reporting/service/scheduler-support.js +125 -0
  71. package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
  72. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  73. package/dist/lib/signing/canonicalize.d.mts +4 -0
  74. package/dist/lib/signing/canonicalize.d.ts +4 -0
  75. package/dist/lib/signing/canonicalize.js +14 -8
  76. package/dist/lib/signing/canonicalize.mjs +14 -8
  77. package/dist/lib/signing/content-digest.d.mts +8 -0
  78. package/dist/lib/signing/content-digest.d.ts +8 -0
  79. package/dist/lib/signing/content-digest.js +11 -5
  80. package/dist/lib/signing/content-digest.mjs +10 -5
  81. package/dist/lib/signing/crypto.d.mts +15 -0
  82. package/dist/lib/signing/crypto.d.ts +15 -0
  83. package/dist/lib/signing/crypto.js +75 -3
  84. package/dist/lib/signing/crypto.mjs +78 -3
  85. package/dist/lib/signing/server.d.mts +1 -1
  86. package/dist/lib/signing/server.d.ts +1 -1
  87. package/dist/lib/signing/server.js +2 -0
  88. package/dist/lib/signing/server.mjs +2 -1
  89. package/dist/lib/signing/signer.js +11 -14
  90. package/dist/lib/signing/signer.mjs +13 -16
  91. package/dist/lib/signing/testing.js +2 -6
  92. package/dist/lib/signing/testing.mjs +3 -7
  93. package/dist/lib/signing/verifier.js +2 -2
  94. package/dist/lib/signing/verifier.mjs +3 -3
  95. package/dist/lib/signing/web-bot-auth.js +122 -43
  96. package/dist/lib/signing/web-bot-auth.mjs +128 -44
  97. package/dist/lib/signing/webhook-verifier.js +2 -2
  98. package/dist/lib/signing/webhook-verifier.mjs +3 -3
  99. package/dist/lib/substitution/compile.js +2 -1
  100. package/dist/lib/substitution/compile.mjs +2 -1
  101. package/dist/lib/substitution/consent-macros.d.mts +4 -0
  102. package/dist/lib/substitution/consent-macros.d.ts +4 -0
  103. package/dist/lib/substitution/consent-macros.js +45 -0
  104. package/dist/lib/substitution/consent-macros.mjs +20 -0
  105. package/dist/lib/substitution/index.d.mts +1 -1
  106. package/dist/lib/substitution/index.d.ts +1 -1
  107. package/dist/lib/substitution/index.js +2 -0
  108. package/dist/lib/substitution/index.mjs +2 -1
  109. package/dist/lib/substitution/translate.d.mts +15 -2
  110. package/dist/lib/substitution/translate.d.ts +15 -2
  111. package/dist/lib/substitution/translate.js +148 -26
  112. package/dist/lib/substitution/translate.mjs +147 -26
  113. package/dist/lib/testing/client.js +2 -1
  114. package/dist/lib/testing/client.mjs +2 -1
  115. package/dist/lib/testing/scenarios/capabilities.js +1 -1
  116. package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
  117. package/dist/lib/testing/storyboard/junit.js +16 -3
  118. package/dist/lib/testing/storyboard/junit.mjs +16 -3
  119. package/dist/lib/testing/storyboard/request-signing/builder.js +12 -14
  120. package/dist/lib/testing/storyboard/request-signing/builder.mjs +13 -15
  121. package/dist/lib/testing/storyboard/runner.js +94 -25
  122. package/dist/lib/testing/storyboard/runner.mjs +94 -25
  123. package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
  124. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
  125. package/dist/lib/testing/storyboard/types.d.mts +6 -0
  126. package/dist/lib/testing/storyboard/types.d.ts +6 -0
  127. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  128. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  129. package/dist/lib/types/enums.generated.d.mts +3 -0
  130. package/dist/lib/types/enums.generated.d.ts +3 -0
  131. package/dist/lib/types/enums.generated.js +9 -0
  132. package/dist/lib/types/enums.generated.mjs +6 -0
  133. package/dist/lib/validation/schema-loader.js +25 -0
  134. package/dist/lib/validation/schema-loader.mjs +24 -0
  135. package/dist/lib/version.d.mts +3 -3
  136. package/dist/lib/version.d.ts +3 -3
  137. package/dist/lib/version.js +3 -3
  138. package/dist/lib/version.mjs +3 -3
  139. package/docs/TYPE-SUMMARY.md +28 -5
  140. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
  141. package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
  142. package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
  143. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
  144. package/docs/guides/REPORTING-LEDGER.md +107 -51
  145. package/docs/guides/REPORTING-OPERATIONS.md +66 -5
  146. package/docs/guides/REPORTING-STABILITY.md +36 -32
  147. package/docs/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
  148. package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
  149. package/docs/llms.txt +4 -3
  150. package/docs/migration-14.x-rc-worksheet.md +4 -7
  151. package/docs/migration-reporting-storage-package.md +186 -0
  152. package/examples/README.md +1 -1
  153. package/package.json +14 -78
  154. package/dist/lib/reporting/azure/index.d.mts +0 -31
  155. package/dist/lib/reporting/azure/index.d.ts +0 -31
  156. package/dist/lib/reporting/azure/index.js +0 -266
  157. package/dist/lib/reporting/azure/index.mjs +0 -249
  158. package/dist/lib/reporting/bigquery/index.d.mts +0 -246
  159. package/dist/lib/reporting/bigquery/index.d.ts +0 -246
  160. package/dist/lib/reporting/bigquery/index.js +0 -633
  161. package/dist/lib/reporting/bigquery/index.mjs +0 -594
  162. package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
  163. package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
  164. package/dist/lib/reporting/gcs/adapter.js +0 -342
  165. package/dist/lib/reporting/gcs/adapter.mjs +0 -325
  166. package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
  167. package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
  168. package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
  169. package/dist/lib/reporting/gcs/errors.d.mts +0 -11
  170. package/dist/lib/reporting/gcs/errors.d.ts +0 -11
  171. package/dist/lib/reporting/gcs/errors.mjs +0 -16
  172. package/dist/lib/reporting/gcs/fence.d.mts +0 -41
  173. package/dist/lib/reporting/gcs/fence.d.ts +0 -41
  174. package/dist/lib/reporting/gcs/fence.js +0 -250
  175. package/dist/lib/reporting/gcs/fence.mjs +0 -230
  176. package/dist/lib/reporting/gcs/index.d.mts +0 -18
  177. package/dist/lib/reporting/gcs/index.d.ts +0 -18
  178. package/dist/lib/reporting/gcs/index.js +0 -44
  179. package/dist/lib/reporting/gcs/index.mjs +0 -14
  180. package/dist/lib/reporting/gcs/io.d.mts +0 -7
  181. package/dist/lib/reporting/gcs/io.d.ts +0 -7
  182. package/dist/lib/reporting/gcs/io.js +0 -95
  183. package/dist/lib/reporting/gcs/io.mjs +0 -69
  184. package/dist/lib/reporting/gcs/reader.d.mts +0 -67
  185. package/dist/lib/reporting/gcs/reader.d.ts +0 -67
  186. package/dist/lib/reporting/gcs/reader.js +0 -193
  187. package/dist/lib/reporting/gcs/reader.mjs +0 -169
  188. package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
  189. package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
  190. package/dist/lib/reporting/gcs/row-provider.js +0 -225
  191. package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
  192. package/dist/lib/reporting/gcs/validation.d.mts +0 -5
  193. package/dist/lib/reporting/gcs/validation.d.ts +0 -5
  194. package/dist/lib/reporting/gcs/validation.js +0 -49
  195. package/dist/lib/reporting/gcs/validation.mjs +0 -25
  196. package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
  197. package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
  198. package/dist/lib/reporting/ledger/change-feed.js +0 -107
  199. package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
  200. package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
  201. package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
  202. package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
  203. package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
  204. package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
  205. package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
  206. package/dist/lib/reporting/ledger/managed-router.js +0 -280
  207. package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
  208. package/dist/lib/reporting/ledger/managed.d.mts +0 -535
  209. package/dist/lib/reporting/ledger/managed.d.ts +0 -535
  210. package/dist/lib/reporting/ledger/managed.js +0 -761
  211. package/dist/lib/reporting/ledger/managed.mjs +0 -729
  212. package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
  213. package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
  214. package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
  215. package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
  216. package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
  217. package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
  218. package/dist/lib/reporting/ledger/object-writes.js +0 -147
  219. package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
  220. package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
  221. package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
  222. package/dist/lib/reporting/ledger/postgres.js +0 -4462
  223. package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
  224. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
  225. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
  226. package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
  227. package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
  228. package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
  229. package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
  230. package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
  231. package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
  232. package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
  233. package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
  234. package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
  235. package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
  236. package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
  237. package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
  238. package/dist/lib/reporting/ledger/row-storage.js +0 -812
  239. package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
  240. package/dist/lib/reporting/s3/index.d.mts +0 -34
  241. package/dist/lib/reporting/s3/index.d.ts +0 -34
  242. package/dist/lib/reporting/s3/index.js +0 -347
  243. package/dist/lib/reporting/s3/index.mjs +0 -340
  244. package/dist/lib/reporting/service/maintenance.d.mts +0 -148
  245. package/dist/lib/reporting/service/maintenance.d.ts +0 -148
  246. package/dist/lib/reporting/service/maintenance.js +0 -185
  247. package/dist/lib/reporting/service/maintenance.mjs +0 -159
  248. package/examples/reliable-reporting-service/README.md +0 -169
@@ -295,7 +295,12 @@ export * from "./reporting/index.mjs";
295
295
  export * from "./types/index.mjs";
296
296
  import { BrandJsonSchema, AdagentsJsonSchema } from "./types/wellknown-schemas.generated.mjs";
297
297
  import { PlacementPresentationDocumentSchema, PlacementPresentationReferenceSchema } from "./types/schemas.generated.mjs";
298
- import { STANDARD_ERROR_CODES, isStandardErrorCode, getErrorRecovery } from "./types/error-codes.mjs";
298
+ import {
299
+ STANDARD_ERROR_CODES,
300
+ isStandardErrorCode,
301
+ getErrorRecovery,
302
+ DEFAULT_UNKNOWN_ERROR_RECOVERY
303
+ } from "./types/error-codes.mjs";
299
304
  import {
300
305
  adcpError,
301
306
  legacyCapabilitiesResponse,
@@ -465,7 +470,9 @@ import {
465
470
  BODY_SNIPPET_TIMEOUT_MS,
466
471
  OBSERVER_FLUSH_TIMEOUT_MS,
467
472
  sanitizeTransportHeaders,
468
- sanitizeTransportUrl
473
+ sanitizeTransportUrl,
474
+ DEFAULT_MAX_RESPONSE_BYTES,
475
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER
469
476
  } from "./protocols/index.mjs";
470
477
  import { toReleasePrecisionWire, validateAdcpVersionWire } from "./validation/schema-loader.mjs";
471
478
  import { bundleSupportsAdcpVersionField as _isSupported } from "./protocols/index.mjs";
@@ -785,6 +792,7 @@ import {
785
792
  divergenceOffset,
786
793
  translateUniversalMacros,
787
794
  UnsafeNativeMappingError,
795
+ MultipleVendorConsentMacrosError,
788
796
  compileUniversalMacroTemplate
789
797
  } from "./substitution/index.mjs";
790
798
  import {
@@ -879,9 +887,11 @@ export {
879
887
  CreativeFormatCapabilityError,
880
888
  CreativeFormatProjectionError,
881
889
  DEFAULT_MACRO_PROHIBITED_PATTERN,
890
+ DEFAULT_MAX_RESPONSE_BYTES,
882
891
  DEFAULT_MAX_SSE_FRAME_BYTES,
883
892
  DEFAULT_REPORTING_CAPABILITIES,
884
893
  DEFAULT_SSRF_POLICY,
894
+ DEFAULT_UNKNOWN_ERROR_RECOVERY,
885
895
  DISCOVERY_ARM_SCENARIOS,
886
896
  DeferredSettlementOwnershipError,
887
897
  DeferredTaskError,
@@ -945,6 +955,7 @@ export {
945
955
  MemoryStorage,
946
956
  MissingEnvSecretError,
947
957
  MissingInputHandlerError,
958
+ MultipleVendorConsentMacrosError,
948
959
  NeedsAuthorizationError,
949
960
  NetworkConsistencyChecker,
950
961
  OBSERVER_FLUSH_TIMEOUT_MS,
@@ -987,6 +998,7 @@ export {
987
998
  SIErrorCodes,
988
999
  SIGNALS_TOOLS,
989
1000
  SISessionManager,
1001
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER,
990
1002
  SSRF_TRANSIENT_CODES,
991
1003
  STANDARD_CREATIVE_AGENTS,
992
1004
  STANDARD_ERROR_CODES,
@@ -1,5 +1,5 @@
1
1
  /** Public AdCP proposal-negotiation types (introduced by the 3.2 contract). */
2
- import type { AcceptanceContext, CanonicalDeliveryForecast, CanonicalProposal as GeneratedCanonicalProposal, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, ProductPurchase as GeneratedProductPurchase } from '../types/core.generated.mjs';
2
+ import type { AcceptanceContext, CanonicalProposal as GeneratedCanonicalProposal, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, ProductPurchase as GeneratedProductPurchase } from '../types/core.generated.mjs';
3
3
  export type { AcceptanceContext, CanonicalDeliveryForecast, CanonicalForecastPoint, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, } from '../types/core.generated.mjs';
4
4
  export declare const PROPOSAL_REFINEMENT_DIMENSIONS: readonly ["total_budget", "cpm", "impressions", "flight", "product_changes", "alternatives", "criteria"];
5
5
  export type ProposalRefinementDimension = (typeof PROPOSAL_REFINEMENT_DIMENSIONS)[number];
@@ -109,31 +109,17 @@ export interface ProposalResolvedPricing {
109
109
  min_spend_per_package?: number;
110
110
  commission_rate?: number;
111
111
  }
112
- export interface ProposalPurchase {
113
- product_id: string;
114
- pricing_option_id: string;
112
+ /**
113
+ * A purchase inside proposal commercial terms. Every field comes from the
114
+ * generated `ProductPurchase` wire type, so fields the pinned schemas add reach
115
+ * this type without edits here. Only `pricing` is widened.
116
+ */
117
+ export interface ProposalPurchase extends Omit<GeneratedProductPurchase, ProposalPurchaseOverriddenKey> {
115
118
  /** Resolved pricing is required in accepted snapshots but optional on direct-purchase inputs. */
116
119
  pricing?: ProposalResolvedPricing | GeneratedProductPurchase['pricing'];
117
- format_option_refs?: GeneratedProductPurchase['format_option_refs'];
118
- catalog_ids?: GeneratedProductPurchase['catalog_ids'];
119
- budget?: GeneratedProductPurchase['budget'];
120
- daily_budget_cap?: GeneratedProductPurchase['daily_budget_cap'];
121
- min_spend_target?: GeneratedProductPurchase['min_spend_target'];
122
- impressions?: number;
123
- start_time?: string;
124
- end_time?: string;
125
- pacing?: GeneratedProductPurchase['pacing'];
126
- bidding?: GeneratedProductPurchase['bidding'];
127
- targeting_overlay?: GeneratedProductPurchase['targeting_overlay'];
128
- optimization_goals?: GeneratedProductPurchase['optimization_goals'];
129
- audience_evidence_requirements?: GeneratedProductPurchase['audience_evidence_requirements'];
130
- audience_evidence_pins?: GeneratedProductPurchase['audience_evidence_pins'];
131
- agency_estimate_number?: GeneratedProductPurchase['agency_estimate_number'];
132
- context?: GeneratedProductPurchase['context'];
133
- ext?: GeneratedProductPurchase['ext'];
134
- measurement_terms?: GeneratedProductPurchase['measurement_terms'];
135
- performance_standards?: GeneratedProductPurchase['performance_standards'];
136
120
  }
121
+ /** Generated `ProductPurchase` fields whose SDK type is intentionally wider. */
122
+ type ProposalPurchaseOverriddenKey = 'pricing';
137
123
  export interface ProposalCommercialTerms<TPurchase extends ProposalPurchase = ProposalPurchase> {
138
124
  /** Keep the legacy open object while accepting the generated compact BrandKey. */
139
125
  brand: Record<string, unknown> | GeneratedCanonicalProposal['commercial_terms']['brand'];
@@ -145,25 +131,20 @@ export interface ProposalCommercialTerms<TPurchase extends ProposalPurchase = Pr
145
131
  currency: string;
146
132
  };
147
133
  }
148
- export interface CanonicalProposal<TTerms extends ProposalCommercialTerms = ProposalCommercialTerms> {
149
- proposal_id: string;
150
- proposal_kind: 'new_media_buy' | 'media_buy_update' | 'media_buy_cancellation';
151
- parent_proposal_id?: string;
152
- media_buy_id?: string;
153
- base_media_buy_revision?: number;
154
- opportunity_id?: string;
155
- proposal_status: 'draft' | 'committed' | 'accepted';
156
- accepted_at?: string;
157
- expires_at?: string;
158
- name: string;
159
- description?: string;
160
- brief_alignment?: string;
134
+ /**
135
+ * A canonical proposal snapshot. Every field comes from the generated
136
+ * `CanonicalProposal` wire type (including fields such as `hold_policy` and
137
+ * `hold_placed_at` once the pinned schemas define them), so the SDK type tracks
138
+ * spec revisions without edits here. Only two fields are re-declared:
139
+ * `commercial_terms` is generic over the caller's terms type and `insertion_order` keeps the
140
+ * legacy open object.
141
+ */
142
+ export interface CanonicalProposal<TTerms extends ProposalCommercialTerms = ProposalCommercialTerms> extends Omit<GeneratedCanonicalProposal, CanonicalProposalOverriddenKey> {
161
143
  commercial_terms: TTerms;
162
- terms_digest: string;
163
144
  insertion_order?: Record<string, unknown> | GeneratedCanonicalProposal['insertion_order'];
164
- total_budget_guidance?: GeneratedCanonicalProposal['total_budget_guidance'];
165
- forecast?: CanonicalDeliveryForecast;
166
145
  }
146
+ /** Generated `CanonicalProposal` fields whose SDK type is intentionally re-declared. */
147
+ type CanonicalProposalOverriddenKey = 'commercial_terms' | 'insertion_order';
167
148
  export type ProposalRefinementReason = 'commercially_declined' | 'constraint_unsatisfiable' | 'unsupported_dimension' | 'uninterpreted' | 'alternatives_unavailable' | 'source_unavailable' | 'hold_unavailable' | 'batch_aborted';
168
149
  export interface RefinedProposalResult<TProposal extends CanonicalProposal = CanonicalProposal> {
169
150
  source_proposal_id: string;
@@ -1,5 +1,5 @@
1
1
  /** Public AdCP proposal-negotiation types (introduced by the 3.2 contract). */
2
- import type { AcceptanceContext, CanonicalDeliveryForecast, CanonicalProposal as GeneratedCanonicalProposal, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, ProductPurchase as GeneratedProductPurchase } from '../types/core.generated';
2
+ import type { AcceptanceContext, CanonicalProposal as GeneratedCanonicalProposal, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, ProductPurchase as GeneratedProductPurchase } from '../types/core.generated';
3
3
  export type { AcceptanceContext, CanonicalDeliveryForecast, CanonicalForecastPoint, MediaBuyFrequencyCap, OutcomeTarget, ProductMediaBuySupportRequirements, } from '../types/core.generated';
4
4
  export declare const PROPOSAL_REFINEMENT_DIMENSIONS: readonly ["total_budget", "cpm", "impressions", "flight", "product_changes", "alternatives", "criteria"];
5
5
  export type ProposalRefinementDimension = (typeof PROPOSAL_REFINEMENT_DIMENSIONS)[number];
@@ -109,31 +109,17 @@ export interface ProposalResolvedPricing {
109
109
  min_spend_per_package?: number;
110
110
  commission_rate?: number;
111
111
  }
112
- export interface ProposalPurchase {
113
- product_id: string;
114
- pricing_option_id: string;
112
+ /**
113
+ * A purchase inside proposal commercial terms. Every field comes from the
114
+ * generated `ProductPurchase` wire type, so fields the pinned schemas add reach
115
+ * this type without edits here. Only `pricing` is widened.
116
+ */
117
+ export interface ProposalPurchase extends Omit<GeneratedProductPurchase, ProposalPurchaseOverriddenKey> {
115
118
  /** Resolved pricing is required in accepted snapshots but optional on direct-purchase inputs. */
116
119
  pricing?: ProposalResolvedPricing | GeneratedProductPurchase['pricing'];
117
- format_option_refs?: GeneratedProductPurchase['format_option_refs'];
118
- catalog_ids?: GeneratedProductPurchase['catalog_ids'];
119
- budget?: GeneratedProductPurchase['budget'];
120
- daily_budget_cap?: GeneratedProductPurchase['daily_budget_cap'];
121
- min_spend_target?: GeneratedProductPurchase['min_spend_target'];
122
- impressions?: number;
123
- start_time?: string;
124
- end_time?: string;
125
- pacing?: GeneratedProductPurchase['pacing'];
126
- bidding?: GeneratedProductPurchase['bidding'];
127
- targeting_overlay?: GeneratedProductPurchase['targeting_overlay'];
128
- optimization_goals?: GeneratedProductPurchase['optimization_goals'];
129
- audience_evidence_requirements?: GeneratedProductPurchase['audience_evidence_requirements'];
130
- audience_evidence_pins?: GeneratedProductPurchase['audience_evidence_pins'];
131
- agency_estimate_number?: GeneratedProductPurchase['agency_estimate_number'];
132
- context?: GeneratedProductPurchase['context'];
133
- ext?: GeneratedProductPurchase['ext'];
134
- measurement_terms?: GeneratedProductPurchase['measurement_terms'];
135
- performance_standards?: GeneratedProductPurchase['performance_standards'];
136
120
  }
121
+ /** Generated `ProductPurchase` fields whose SDK type is intentionally wider. */
122
+ type ProposalPurchaseOverriddenKey = 'pricing';
137
123
  export interface ProposalCommercialTerms<TPurchase extends ProposalPurchase = ProposalPurchase> {
138
124
  /** Keep the legacy open object while accepting the generated compact BrandKey. */
139
125
  brand: Record<string, unknown> | GeneratedCanonicalProposal['commercial_terms']['brand'];
@@ -145,25 +131,20 @@ export interface ProposalCommercialTerms<TPurchase extends ProposalPurchase = Pr
145
131
  currency: string;
146
132
  };
147
133
  }
148
- export interface CanonicalProposal<TTerms extends ProposalCommercialTerms = ProposalCommercialTerms> {
149
- proposal_id: string;
150
- proposal_kind: 'new_media_buy' | 'media_buy_update' | 'media_buy_cancellation';
151
- parent_proposal_id?: string;
152
- media_buy_id?: string;
153
- base_media_buy_revision?: number;
154
- opportunity_id?: string;
155
- proposal_status: 'draft' | 'committed' | 'accepted';
156
- accepted_at?: string;
157
- expires_at?: string;
158
- name: string;
159
- description?: string;
160
- brief_alignment?: string;
134
+ /**
135
+ * A canonical proposal snapshot. Every field comes from the generated
136
+ * `CanonicalProposal` wire type (including fields such as `hold_policy` and
137
+ * `hold_placed_at` once the pinned schemas define them), so the SDK type tracks
138
+ * spec revisions without edits here. Only two fields are re-declared:
139
+ * `commercial_terms` is generic over the caller's terms type and `insertion_order` keeps the
140
+ * legacy open object.
141
+ */
142
+ export interface CanonicalProposal<TTerms extends ProposalCommercialTerms = ProposalCommercialTerms> extends Omit<GeneratedCanonicalProposal, CanonicalProposalOverriddenKey> {
161
143
  commercial_terms: TTerms;
162
- terms_digest: string;
163
144
  insertion_order?: Record<string, unknown> | GeneratedCanonicalProposal['insertion_order'];
164
- total_budget_guidance?: GeneratedCanonicalProposal['total_budget_guidance'];
165
- forecast?: CanonicalDeliveryForecast;
166
145
  }
146
+ /** Generated `CanonicalProposal` fields whose SDK type is intentionally re-declared. */
147
+ type CanonicalProposalOverriddenKey = 'commercial_terms' | 'insertion_order';
167
148
  export type ProposalRefinementReason = 'commercially_declined' | 'constraint_unsatisfiable' | 'unsupported_dimension' | 'uninterpreted' | 'alternatives_unavailable' | 'source_unavailable' | 'hold_unavailable' | 'batch_aborted';
168
149
  export interface RefinedProposalResult<TProposal extends CanonicalProposal = CanonicalProposal> {
169
150
  source_proposal_id: string;
@@ -11,6 +11,7 @@ export { withMCPConnectionScope };
11
11
  export type { MCPCallOptions, MCPConnectionResult } from './mcp.mjs';
12
12
  export { callA2ATool, createA2AClientFromCardUrl } from './a2a.mjs';
13
13
  export { DEFAULT_REQUEST_TIMEOUT_MS } from './abort.mjs';
14
+ export { DEFAULT_MAX_RESPONSE_BYTES, SSE_CUMULATIVE_BUDGET_MULTIPLIER } from './responseSizeLimit.mjs';
14
15
  export { callMCPToolWithTasks, getMCPTaskStatus, getMCPTaskResult, listMCPTasks, cancelMCPTask, mapMCPTaskStatus, serverSupportsTasks, } from './mcp-tasks.mjs';
15
16
  import type { AgentConfig, DebugLogEntry } from '../types/index.mjs';
16
17
  import type { PushNotificationConfig } from '../types/tools.generated.mjs';
@@ -36,36 +37,71 @@ export declare function bundleSupportsAdcpVersionField(bundleKey: string): boole
36
37
  export interface TransportOptions {
37
38
  /**
38
39
  * Maximum response body size (in octets) the SDK will read before aborting
39
- * with `ResponseTooLargeError`. When unset, the SDK does not impose a cap —
40
- * matches the underlying MCP / A2A transport defaults.
40
+ * with `ResponseTooLargeError`.
41
41
  *
42
- * Set this when crawling **untrusted** agents (registries, federated
43
- * discovery layers, monitoring tools) to prevent a hostile vendor from
44
- * buffering a large reply before any application-layer schema validation
45
- * runs. Counted across response chunks; pre-cancels when `Content-Length`
46
- * exceeds the cap. Applies to A2A agent-card discovery
47
- * (`/.well-known/agent.json`) on the same call as well.
42
+ * **Defaults to 4 MiB** (`DEFAULT_MAX_RESPONSE_BYTES`). Agent responses are
43
+ * untrusted input, so the cap is on by default on every MCP and A2A call
44
+ * path — tool calls, endpoint discovery, `tools/list`, and A2A agent-card
45
+ * lookup (`/.well-known/agent.json`). Counted across response chunks as
46
+ * they arrive; pre-cancels when `Content-Length` already exceeds the cap.
48
47
  *
49
- * Per-call override (`TaskOptions.transport.maxResponseBytes`) beats the
50
- * value set on the client constructor (`SingleAgentClientConfig.transport`).
48
+ * Raise it for an agent that legitimately publishes a large catalog; lower
49
+ * it when crawling **untrusted** agents (registries, federated discovery
50
+ * layers, monitoring tools). Set it to exactly `0` to opt out of
51
+ * enforcement entirely — an explicit opt-out, never the default. `Infinity`
52
+ * and negative values are *not* opt-outs: they fall back to the 4 MiB
53
+ * default, because they almost always arrive from a misparsed env var or a
54
+ * budget subtraction rather than an intention. Use `0`.
55
+ *
56
+ * Per-call `transport` **replaces** the client constructor's `transport`
57
+ * object rather than merging field by field
58
+ * (`TaskOptions.transport` ?? `SingleAgentClientConfig.transport`), so a
59
+ * per-call object that omits `maxResponseBytes` gets the default back, not
60
+ * the constructor's value. Repeat the field when you override the object.
61
+ *
62
+ * Cached MCP connections are keyed on the cap, so varying it per call opens
63
+ * a separate connection (and MCP session) per distinct value against the
64
+ * same agent. That is deliberate — a connection established under one
65
+ * policy must not serve a call that configured another — but it means
66
+ * raising the cap for one tool is not free. Prefer a single client-level
67
+ * value where you can, or pin the session explicitly with
68
+ * `withMCPConnectionScope` when continuity matters.
51
69
  *
52
70
  * @remarks
53
- * **Safe to set on all calls.** SSE responses (`text/event-stream`) are
54
- * passed through unchanged — a single tool call legitimately emits N status
55
- * frames + a final result, bounded by protocol-level framing rather than
56
- * cumulative byte counts. The cap applies to one-shot JSON responses
57
- * (`get_adcp_capabilities`, agent-card lookup, tool result payloads on
58
- * non-streaming transports) where the body is bounded by definition.
71
+ * **SSE is covered too.** `text/event-stream` responses used to be exempt,
72
+ * which let any peer opt itself out of the cap by changing one response
73
+ * header. They now carry two bounds: no single event frame may exceed
74
+ * `maxResponseBytes` (the memory bound — an SSE consumer buffers one frame
75
+ * at a time), and the cumulative event-stream octets read during one call
76
+ * may not exceed `maxResponseBytes * 2`
77
+ * (`SSE_CUMULATIVE_BUDGET_MULTIPLIER`, the liveness bound that stops an
78
+ * endless drip of individually legal frames). Both failures raise the same
79
+ * `ResponseTooLargeError`; nothing is silently truncated.
80
+ *
81
+ * A long-lived `GET` event-stream — MCP's standalone notification listener,
82
+ * the legacy SSE transport — outlives the call that opened it, so it meters
83
+ * its cumulative allowance per *connection* instead of per call. That makes
84
+ * the cumulative number a memory bound there, not a liveness bound: a peer
85
+ * that keeps tripping it gets a reconnect cycle at a bounded cost per
86
+ * cycle. Cached connections are keyed on the cap in effect, so a listener
87
+ * is only ever reused by calls that configured the same policy as the call
88
+ * that opened it.
59
89
  *
60
90
  * @remarks
61
- * **Hostile-peer note:** A peer can opt itself out of this cap by responding
62
- * with `Content-Type: text/event-stream`. SSE is bypassed because cumulative
63
- * event-frame bytes are unbounded by spec — MCP and A2A both stream tool
64
- * responses this way. The MCP/A2A SDKs consume SSE incrementally and frame
65
- * termination bounds memory in practice, so this is not a memory-bomb risk
66
- * for well-formed transports. Adopters relying on `maxResponseBytes` as a
67
- * hostile-server defense should treat it as best-effort for non-SSE
68
- * responses only.
91
+ * **Compression and streaming failures.** The byte counter runs downstream
92
+ * of the runtime's content-decoder, so it measures decompressed octets: a
93
+ * small gzip blob that inflates to gigabytes still trips the cap after
94
+ * `maxResponseBytes` of output. The `Content-Length` pre-check, by
95
+ * contrast, sees the compressed length and is therefore only a fast path,
96
+ * not the guarantee.
97
+ *
98
+ * On a streaming transport the cap errors the response body. Some
99
+ * transports classify that as a stream disconnect and retry rather than
100
+ * propagating it, so the call would otherwise run out its deadline: the SDK
101
+ * records the violation and, if the call then fails, raises
102
+ * `ResponseTooLargeError` with the transport's own error as `cause` instead
103
+ * of the timeout. A buyer never gets a timeout for what is really an
104
+ * over-cap response.
69
105
  *
70
106
  * @remarks
71
107
  * Future hardening knobs (DNS-rebind defense, scheme allow-list, request
@@ -11,6 +11,7 @@ export { withMCPConnectionScope };
11
11
  export type { MCPCallOptions, MCPConnectionResult } from './mcp';
12
12
  export { callA2ATool, createA2AClientFromCardUrl } from './a2a';
13
13
  export { DEFAULT_REQUEST_TIMEOUT_MS } from './abort';
14
+ export { DEFAULT_MAX_RESPONSE_BYTES, SSE_CUMULATIVE_BUDGET_MULTIPLIER } from './responseSizeLimit';
14
15
  export { callMCPToolWithTasks, getMCPTaskStatus, getMCPTaskResult, listMCPTasks, cancelMCPTask, mapMCPTaskStatus, serverSupportsTasks, } from './mcp-tasks';
15
16
  import type { AgentConfig, DebugLogEntry } from '../types';
16
17
  import type { PushNotificationConfig } from '../types/tools.generated';
@@ -36,36 +37,71 @@ export declare function bundleSupportsAdcpVersionField(bundleKey: string): boole
36
37
  export interface TransportOptions {
37
38
  /**
38
39
  * Maximum response body size (in octets) the SDK will read before aborting
39
- * with `ResponseTooLargeError`. When unset, the SDK does not impose a cap —
40
- * matches the underlying MCP / A2A transport defaults.
40
+ * with `ResponseTooLargeError`.
41
41
  *
42
- * Set this when crawling **untrusted** agents (registries, federated
43
- * discovery layers, monitoring tools) to prevent a hostile vendor from
44
- * buffering a large reply before any application-layer schema validation
45
- * runs. Counted across response chunks; pre-cancels when `Content-Length`
46
- * exceeds the cap. Applies to A2A agent-card discovery
47
- * (`/.well-known/agent.json`) on the same call as well.
42
+ * **Defaults to 4 MiB** (`DEFAULT_MAX_RESPONSE_BYTES`). Agent responses are
43
+ * untrusted input, so the cap is on by default on every MCP and A2A call
44
+ * path — tool calls, endpoint discovery, `tools/list`, and A2A agent-card
45
+ * lookup (`/.well-known/agent.json`). Counted across response chunks as
46
+ * they arrive; pre-cancels when `Content-Length` already exceeds the cap.
48
47
  *
49
- * Per-call override (`TaskOptions.transport.maxResponseBytes`) beats the
50
- * value set on the client constructor (`SingleAgentClientConfig.transport`).
48
+ * Raise it for an agent that legitimately publishes a large catalog; lower
49
+ * it when crawling **untrusted** agents (registries, federated discovery
50
+ * layers, monitoring tools). Set it to exactly `0` to opt out of
51
+ * enforcement entirely — an explicit opt-out, never the default. `Infinity`
52
+ * and negative values are *not* opt-outs: they fall back to the 4 MiB
53
+ * default, because they almost always arrive from a misparsed env var or a
54
+ * budget subtraction rather than an intention. Use `0`.
55
+ *
56
+ * Per-call `transport` **replaces** the client constructor's `transport`
57
+ * object rather than merging field by field
58
+ * (`TaskOptions.transport` ?? `SingleAgentClientConfig.transport`), so a
59
+ * per-call object that omits `maxResponseBytes` gets the default back, not
60
+ * the constructor's value. Repeat the field when you override the object.
61
+ *
62
+ * Cached MCP connections are keyed on the cap, so varying it per call opens
63
+ * a separate connection (and MCP session) per distinct value against the
64
+ * same agent. That is deliberate — a connection established under one
65
+ * policy must not serve a call that configured another — but it means
66
+ * raising the cap for one tool is not free. Prefer a single client-level
67
+ * value where you can, or pin the session explicitly with
68
+ * `withMCPConnectionScope` when continuity matters.
51
69
  *
52
70
  * @remarks
53
- * **Safe to set on all calls.** SSE responses (`text/event-stream`) are
54
- * passed through unchanged — a single tool call legitimately emits N status
55
- * frames + a final result, bounded by protocol-level framing rather than
56
- * cumulative byte counts. The cap applies to one-shot JSON responses
57
- * (`get_adcp_capabilities`, agent-card lookup, tool result payloads on
58
- * non-streaming transports) where the body is bounded by definition.
71
+ * **SSE is covered too.** `text/event-stream` responses used to be exempt,
72
+ * which let any peer opt itself out of the cap by changing one response
73
+ * header. They now carry two bounds: no single event frame may exceed
74
+ * `maxResponseBytes` (the memory bound — an SSE consumer buffers one frame
75
+ * at a time), and the cumulative event-stream octets read during one call
76
+ * may not exceed `maxResponseBytes * 2`
77
+ * (`SSE_CUMULATIVE_BUDGET_MULTIPLIER`, the liveness bound that stops an
78
+ * endless drip of individually legal frames). Both failures raise the same
79
+ * `ResponseTooLargeError`; nothing is silently truncated.
80
+ *
81
+ * A long-lived `GET` event-stream — MCP's standalone notification listener,
82
+ * the legacy SSE transport — outlives the call that opened it, so it meters
83
+ * its cumulative allowance per *connection* instead of per call. That makes
84
+ * the cumulative number a memory bound there, not a liveness bound: a peer
85
+ * that keeps tripping it gets a reconnect cycle at a bounded cost per
86
+ * cycle. Cached connections are keyed on the cap in effect, so a listener
87
+ * is only ever reused by calls that configured the same policy as the call
88
+ * that opened it.
59
89
  *
60
90
  * @remarks
61
- * **Hostile-peer note:** A peer can opt itself out of this cap by responding
62
- * with `Content-Type: text/event-stream`. SSE is bypassed because cumulative
63
- * event-frame bytes are unbounded by spec — MCP and A2A both stream tool
64
- * responses this way. The MCP/A2A SDKs consume SSE incrementally and frame
65
- * termination bounds memory in practice, so this is not a memory-bomb risk
66
- * for well-formed transports. Adopters relying on `maxResponseBytes` as a
67
- * hostile-server defense should treat it as best-effort for non-SSE
68
- * responses only.
91
+ * **Compression and streaming failures.** The byte counter runs downstream
92
+ * of the runtime's content-decoder, so it measures decompressed octets: a
93
+ * small gzip blob that inflates to gigabytes still trips the cap after
94
+ * `maxResponseBytes` of output. The `Content-Length` pre-check, by
95
+ * contrast, sees the compressed length and is therefore only a fast path,
96
+ * not the guarantee.
97
+ *
98
+ * On a streaming transport the cap errors the response body. Some
99
+ * transports classify that as a stream disconnect and retry rather than
100
+ * propagating it, so the call would otherwise run out its deadline: the SDK
101
+ * records the violation and, if the call then fails, raises
102
+ * `ResponseTooLargeError` with the transport's own error as `cause` instead
103
+ * of the timeout. A buyer never gets a timeout for what is really an
104
+ * over-cap response.
69
105
  *
70
106
  * @remarks
71
107
  * Future hardening knobs (DNS-rebind defense, scheme allow-list, request
@@ -19,9 +19,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var protocols_exports = {};
20
20
  __export(protocols_exports, {
21
21
  BODY_SNIPPET_TIMEOUT_MS: () => import_transportDiagnostics2.BODY_SNIPPET_TIMEOUT_MS,
22
+ DEFAULT_MAX_RESPONSE_BYTES: () => import_responseSizeLimit.DEFAULT_MAX_RESPONSE_BYTES,
22
23
  DEFAULT_REQUEST_TIMEOUT_MS: () => import_abort.DEFAULT_REQUEST_TIMEOUT_MS,
23
24
  OBSERVER_FLUSH_TIMEOUT_MS: () => import_transportDiagnostics2.OBSERVER_FLUSH_TIMEOUT_MS,
24
25
  ProtocolClient: () => ProtocolClient,
26
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER: () => import_responseSizeLimit.SSE_CUMULATIVE_BUDGET_MULTIPLIER,
25
27
  UnauthorizedError: () => import_mcp.UnauthorizedError,
26
28
  applyVersionEnvelope: () => applyVersionEnvelope,
27
29
  bundleSupportsAdcpVersionField: () => bundleSupportsAdcpVersionField,
@@ -59,6 +61,7 @@ var import_a2a = require('./a2a.js');
59
61
  var import_node_crypto = require("node:crypto");
60
62
  var import_a2a2 = require('./a2a.js');
61
63
  var import_abort = require('./abort.js');
64
+ var import_responseSizeLimit = require('./responseSizeLimit.js');
62
65
  var import_mcp_tasks = require('./mcp-tasks.js');
63
66
  var import_mcp_tasks2 = require('./mcp-tasks.js');
64
67
  var import_mcp3 = require('./mcp.js');
@@ -76,7 +79,7 @@ var import_version = require('../version.js');
76
79
  var import_errors2 = require('../errors/index.js');
77
80
  var import_schema_loader = require('../validation/schema-loader.js');
78
81
  var import_client = require('../signing/client.js');
79
- var import_responseSizeLimit = require('./responseSizeLimit.js');
82
+ var import_responseSizeLimit2 = require('./responseSizeLimit.js');
80
83
  var import_prepared_call_context = require('./prepared-call-context.js');
81
84
  var import_adcp_version_config = require('../utils/adcp-version-config.js');
82
85
  var import_transportDiagnostics = require('./transportDiagnostics.js');
@@ -259,7 +262,7 @@ class ProtocolClient {
259
262
  wireAdcpVersion,
260
263
  versionEnvelope: versionEnvelopeMode
261
264
  });
262
- return (0, import_responseSizeLimit.withResponseSizeLimit)(
265
+ return (0, import_responseSizeLimit2.withResponseSizeLimit)(
263
266
  transport?.maxResponseBytes,
264
267
  () => (0, import_transportDiagnostics.withTransportDiagnostics)(
265
268
  {
@@ -523,7 +526,7 @@ const createMCPClient = (agentUrl, authToken, headers, serverVersion, adcpVersio
523
526
  transport = normalizeTransportOptions(transport);
524
527
  const versionEnvelope = buildVersionEnvelopeForMode(versionEnvelopeMode, adcpVersion, serverVersion);
525
528
  return {
526
- callTool: (toolName, args, debugLogs) => (0, import_responseSizeLimit.withResponseSizeLimit)(
529
+ callTool: (toolName, args, debugLogs) => (0, import_responseSizeLimit2.withResponseSizeLimit)(
527
530
  transport?.maxResponseBytes,
528
531
  () => (0, import_mcp_tasks2.callMCPToolWithTasks)(
529
532
  agentUrl,
@@ -545,7 +548,7 @@ const createA2AClient = (agentUrl, authToken, headers, serverVersion, adcpVersio
545
548
  transport = normalizeTransportOptions(transport);
546
549
  const versionEnvelope = buildVersionEnvelopeForMode(versionEnvelopeMode, adcpVersion, serverVersion);
547
550
  return {
548
- callTool: (toolName, parameters, debugLogs) => (0, import_responseSizeLimit.withResponseSizeLimit)(
551
+ callTool: (toolName, parameters, debugLogs) => (0, import_responseSizeLimit2.withResponseSizeLimit)(
549
552
  transport?.maxResponseBytes,
550
553
  () => (0, import_a2a3.callA2ATool)(
551
554
  agentUrl,
@@ -569,9 +572,11 @@ const createA2AClient = (agentUrl, authToken, headers, serverVersion, adcpVersio
569
572
  // Annotate the CommonJS export names for ESM import in node:
570
573
  0 && (module.exports = {
571
574
  BODY_SNIPPET_TIMEOUT_MS,
575
+ DEFAULT_MAX_RESPONSE_BYTES,
572
576
  DEFAULT_REQUEST_TIMEOUT_MS,
573
577
  OBSERVER_FLUSH_TIMEOUT_MS,
574
578
  ProtocolClient,
579
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER,
575
580
  UnauthorizedError,
576
581
  applyVersionEnvelope,
577
582
  bundleSupportsAdcpVersionField,
@@ -31,6 +31,7 @@ async function closeScopedConnections(protocol = "mcp") {
31
31
  }
32
32
  import { callA2ATool, createA2AClientFromCardUrl } from "./a2a.mjs";
33
33
  import { DEFAULT_REQUEST_TIMEOUT_MS } from "./abort.mjs";
34
+ import { DEFAULT_MAX_RESPONSE_BYTES, SSE_CUMULATIVE_BUDGET_MULTIPLIER } from "./responseSizeLimit.mjs";
34
35
  import {
35
36
  callMCPToolWithTasks,
36
37
  getMCPTaskStatus,
@@ -548,9 +549,11 @@ const createA2AClient = (agentUrl, authToken, headers, serverVersion, adcpVersio
548
549
  };
549
550
  export {
550
551
  BODY_SNIPPET_TIMEOUT_MS,
552
+ DEFAULT_MAX_RESPONSE_BYTES,
551
553
  DEFAULT_REQUEST_TIMEOUT_MS,
552
554
  OBSERVER_FLUSH_TIMEOUT_MS,
553
555
  ProtocolClient,
556
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER,
554
557
  UnauthorizedError,
555
558
  applyVersionEnvelope,
556
559
  bundleSupportsAdcpVersionField,
@@ -102,6 +102,7 @@ function connectionCacheKey(agentUrl, headers, signingCacheKey, authProvider, fe
102
102
  if (fetchKey) parts.push(fetchKey);
103
103
  if (handleLegacy !== void 0) parts.push(`handle-legacy:${handleLegacy}`);
104
104
  if (allowPrivateIp !== void 0) parts.push(`allow-private-ip:${allowPrivateIp}`);
105
+ parts.push((0, import_responseSizeLimit.responseSizeCapCacheKey)());
105
106
  const scopeKey = (0, import_mcp_scope.currentMCPConnectionScopeKey)();
106
107
  if (scopeKey) parts.push(scopeKey);
107
108
  return parts.join("::");
@@ -43,7 +43,7 @@ import {
43
43
  } from "./abort.mjs";
44
44
  import { wrapFetchWithCapture } from "./rawResponseCapture.mjs";
45
45
  import { wrapFetchWithSignedRequestRejection } from "./signedRequestRejection.mjs";
46
- import { wrapFetchWithSizeLimit } from "./responseSizeLimit.mjs";
46
+ import { responseSizeCapCacheKey, wrapFetchWithSizeLimit } from "./responseSizeLimit.mjs";
47
47
  import { wrapFetchWithTransportDiagnostics } from "./transportDiagnostics.mjs";
48
48
  import { createAgentTransportFetch } from "../net/agent-transport-fetch.mjs";
49
49
  const modernConnections = /* @__PURE__ */ new Map();
@@ -109,6 +109,7 @@ function connectionCacheKey(agentUrl, headers, signingCacheKey, authProvider, fe
109
109
  if (fetchKey) parts.push(fetchKey);
110
110
  if (handleLegacy !== void 0) parts.push(`handle-legacy:${handleLegacy}`);
111
111
  if (allowPrivateIp !== void 0) parts.push(`allow-private-ip:${allowPrivateIp}`);
112
+ parts.push(responseSizeCapCacheKey());
112
113
  const scopeKey = currentMCPConnectionScopeKey();
113
114
  if (scopeKey) parts.push(scopeKey);
114
115
  return parts.join("::");
@@ -89,6 +89,7 @@ function connectionCacheKey(agentUrl, authToken, signingCacheKey, authHeaders, t
89
89
  if (signingCacheKey) parts.push(signingCacheKey);
90
90
  if (transportFetch) parts.push(`fetch:${getTransportFetchFnDisambiguator(transportFetch)}`);
91
91
  if (allowPrivateIp !== void 0) parts.push(`allow-private-ip:${allowPrivateIp}`);
92
+ parts.push((0, import_responseSizeLimit.responseSizeCapCacheKey)());
92
93
  const scopeKey = (0, import_mcp_scope.currentMCPConnectionScopeKey)();
93
94
  if (scopeKey) parts.push(scopeKey);
94
95
  return parts.join("::");
@@ -19,7 +19,7 @@ import { buildAgentSigningFetch, signingContextStorage } from "../signing/client
19
19
  import { redactArgsForLog } from "../utils/redact-args.mjs";
20
20
  import { wrapFetchWithCapture } from "./rawResponseCapture.mjs";
21
21
  import { getSignedRequestRejection, wrapFetchWithSignedRequestRejection } from "./signedRequestRejection.mjs";
22
- import { wrapFetchWithSizeLimit } from "./responseSizeLimit.mjs";
22
+ import { responseSizeCapCacheKey, wrapFetchWithSizeLimit } from "./responseSizeLimit.mjs";
23
23
  import { sanitizeTransportUrl, wrapFetchWithTransportDiagnostics } from "./transportDiagnostics.mjs";
24
24
  import {
25
25
  isAbortOrTimeoutError,
@@ -88,6 +88,7 @@ function connectionCacheKey(agentUrl, authToken, signingCacheKey, authHeaders, t
88
88
  if (signingCacheKey) parts.push(signingCacheKey);
89
89
  if (transportFetch) parts.push(`fetch:${getTransportFetchFnDisambiguator(transportFetch)}`);
90
90
  if (allowPrivateIp !== void 0) parts.push(`allow-private-ip:${allowPrivateIp}`);
91
+ parts.push(responseSizeCapCacheKey());
91
92
  const scopeKey = currentMCPConnectionScopeKey();
92
93
  if (scopeKey) parts.push(scopeKey);
93
94
  return parts.join("::");