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

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 (87) hide show
  1. package/README.md +54 -0
  2. package/dist/lib/core/ConversationTypes.d.mts +8 -3
  3. package/dist/lib/core/ConversationTypes.d.ts +8 -3
  4. package/dist/lib/core/SingleAgentClient.d.mts +5 -3
  5. package/dist/lib/core/SingleAgentClient.d.ts +5 -3
  6. package/dist/lib/core/TaskExecutor.js +5 -1
  7. package/dist/lib/core/TaskExecutor.mjs +5 -1
  8. package/dist/lib/errors/index.d.mts +9 -4
  9. package/dist/lib/errors/index.d.ts +9 -4
  10. package/dist/lib/index.d.mts +2 -2
  11. package/dist/lib/index.d.ts +2 -2
  12. package/dist/lib/index.js +6 -0
  13. package/dist/lib/index.mjs +7 -1
  14. package/dist/lib/negotiation/types.d.mts +20 -39
  15. package/dist/lib/negotiation/types.d.ts +20 -39
  16. package/dist/lib/protocols/index.d.mts +60 -24
  17. package/dist/lib/protocols/index.d.ts +60 -24
  18. package/dist/lib/protocols/index.js +9 -4
  19. package/dist/lib/protocols/index.mjs +3 -0
  20. package/dist/lib/protocols/mcp-modern.js +1 -0
  21. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  22. package/dist/lib/protocols/mcp.js +1 -0
  23. package/dist/lib/protocols/mcp.mjs +2 -1
  24. package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
  25. package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
  26. package/dist/lib/protocols/responseSizeLimit.js +195 -31
  27. package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
  28. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  29. package/dist/lib/signing/crypto.d.mts +15 -0
  30. package/dist/lib/signing/crypto.d.ts +15 -0
  31. package/dist/lib/signing/crypto.js +75 -3
  32. package/dist/lib/signing/crypto.mjs +78 -3
  33. package/dist/lib/signing/server.d.mts +1 -1
  34. package/dist/lib/signing/server.d.ts +1 -1
  35. package/dist/lib/signing/server.js +2 -0
  36. package/dist/lib/signing/server.mjs +2 -1
  37. package/dist/lib/signing/signer.js +2 -8
  38. package/dist/lib/signing/signer.mjs +3 -9
  39. package/dist/lib/signing/testing.js +2 -6
  40. package/dist/lib/signing/testing.mjs +3 -7
  41. package/dist/lib/signing/verifier.js +2 -2
  42. package/dist/lib/signing/verifier.mjs +3 -3
  43. package/dist/lib/signing/web-bot-auth.js +20 -7
  44. package/dist/lib/signing/web-bot-auth.mjs +21 -8
  45. package/dist/lib/signing/webhook-verifier.js +2 -2
  46. package/dist/lib/signing/webhook-verifier.mjs +3 -3
  47. package/dist/lib/substitution/compile.js +2 -1
  48. package/dist/lib/substitution/compile.mjs +2 -1
  49. package/dist/lib/substitution/consent-macros.d.mts +4 -0
  50. package/dist/lib/substitution/consent-macros.d.ts +4 -0
  51. package/dist/lib/substitution/consent-macros.js +45 -0
  52. package/dist/lib/substitution/consent-macros.mjs +20 -0
  53. package/dist/lib/substitution/index.d.mts +1 -1
  54. package/dist/lib/substitution/index.d.ts +1 -1
  55. package/dist/lib/substitution/index.js +2 -0
  56. package/dist/lib/substitution/index.mjs +2 -1
  57. package/dist/lib/substitution/translate.d.mts +15 -2
  58. package/dist/lib/substitution/translate.d.ts +15 -2
  59. package/dist/lib/substitution/translate.js +148 -26
  60. package/dist/lib/substitution/translate.mjs +147 -26
  61. package/dist/lib/testing/client.js +2 -1
  62. package/dist/lib/testing/client.mjs +2 -1
  63. package/dist/lib/testing/scenarios/capabilities.js +1 -1
  64. package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
  65. package/dist/lib/testing/storyboard/request-signing/builder.js +2 -5
  66. package/dist/lib/testing/storyboard/request-signing/builder.mjs +3 -6
  67. package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
  68. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
  69. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  70. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  71. package/dist/lib/types/enums.generated.d.mts +3 -0
  72. package/dist/lib/types/enums.generated.d.ts +3 -0
  73. package/dist/lib/types/enums.generated.js +9 -0
  74. package/dist/lib/types/enums.generated.mjs +6 -0
  75. package/dist/lib/validation/schema-loader.js +25 -0
  76. package/dist/lib/validation/schema-loader.mjs +24 -0
  77. package/dist/lib/version.d.mts +3 -3
  78. package/dist/lib/version.d.ts +3 -3
  79. package/dist/lib/version.js +3 -3
  80. package/dist/lib/version.mjs +3 -3
  81. package/docs/TYPE-SUMMARY.md +6 -1
  82. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
  83. package/docs/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
  84. package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
  85. package/docs/llms.txt +1 -1
  86. package/docs/migration-14.x-rc-worksheet.md +4 -4
  87. package/package.json +2 -1
package/README.md CHANGED
@@ -602,6 +602,60 @@ app.post(
602
602
 
603
603
  Full guide covering key generation, JWKS publication, brand.json setup, webhook signing, capability declaration, key rotation, and conformance testing: **[docs/guides/SIGNING-GUIDE.md](./docs/guides/SIGNING-GUIDE.md)**.
604
604
 
605
+ ### Response Size Cap
606
+
607
+ Agent responses are untrusted input, so the SDK caps every response body it
608
+ reads. **The default is 4 MiB** (`DEFAULT_MAX_RESPONSE_BYTES`), applied on
609
+ every MCP and A2A call path: tool calls, endpoint discovery, `tools/list`,
610
+ A2A agent-card lookup, and OAuth token exchange. (OAuth metadata discovery
611
+ has its own, tighter 64 KiB cap and does not use this mechanism.)
612
+
613
+ Bytes are counted as they stream in, a declared `Content-Length` over the cap
614
+ is refused before the body is read, and an oversized response fails with a
615
+ typed `ResponseTooLargeError`. Nothing is silently truncated.
616
+
617
+ ```typescript
618
+ import { ResponseTooLargeError } from '@adcp/sdk';
619
+
620
+ // Raise the cap for an agent that legitimately publishes a large catalog.
621
+ const client = new ADCPMultiAgentClient(agents, {
622
+ transport: { maxResponseBytes: 32 * 1024 * 1024 },
623
+ });
624
+
625
+ // …or per call.
626
+ await client.agent('agent_x').getProducts(params, {
627
+ transport: { maxResponseBytes: 32 * 1024 * 1024 },
628
+ });
629
+
630
+ // Opt out entirely — explicit, never the default. Only `0` opts out;
631
+ // `Infinity` and negative values fall back to the 4 MiB default.
632
+ await client.agent('agent_x').getProducts(params, { transport: { maxResponseBytes: 0 } });
633
+
634
+ try {
635
+ await client.agent('agent_x').getProducts(params);
636
+ } catch (err) {
637
+ if (err instanceof ResponseTooLargeError) {
638
+ console.warn(`agent returned > ${err.limit} bytes from ${err.url}`);
639
+ }
640
+ }
641
+ ```
642
+
643
+ `text/event-stream` responses are covered too, with two bounds: no single
644
+ event frame may exceed `maxResponseBytes`, and the cumulative event-stream
645
+ octets read during one call may not exceed `maxResponseBytes * 2` (8 MiB by
646
+ default). A peer cannot escape the cap by replying with
647
+ `Content-Type: text/event-stream`.
648
+
649
+ The counter runs downstream of the runtime's content-decoder, so it measures
650
+ **decompressed** octets: a small gzip blob that inflates to gigabytes still
651
+ trips the cap after `maxResponseBytes` of output. The `Content-Length`
652
+ pre-check sees the compressed length, so it is a fast path rather than the
653
+ guarantee.
654
+
655
+ A per-call `transport` object **replaces** the client's `transport` rather
656
+ than merging into it — repeat `maxResponseBytes` when you override the object
657
+ for some other reason.
658
+
605
659
  ### Authentication
606
660
 
607
661
  ```typescript
@@ -184,10 +184,15 @@ export interface TaskOptions {
184
184
  /** Additional metadata to include */
185
185
  metadata?: Record<string, any>;
186
186
  /**
187
- * Transport-level safeguards for this call. Overrides the matching field
188
- * on the client constructor's `transport` option. Use to lift or tighten
187
+ * Transport-level safeguards for this call. Use to lift or tighten
189
188
  * `maxResponseBytes` per call when an agent legitimately publishes large
190
- * catalogs (e.g., `list_creative_formats` on a generative seller).
189
+ * catalogs (e.g., `list_creative_formats` on a generative seller) — the
190
+ * default is 4 MiB.
191
+ *
192
+ * This object **replaces** the client constructor's `transport` rather than
193
+ * merging into it. A per-call object that sets only `requestTimeoutMs`
194
+ * drops the constructor's `maxResponseBytes` back to the default; repeat
195
+ * every field you still want.
191
196
  */
192
197
  transport?: import('../protocols/index.mjs').TransportOptions;
193
198
  }
@@ -184,10 +184,15 @@ export interface TaskOptions {
184
184
  /** Additional metadata to include */
185
185
  metadata?: Record<string, any>;
186
186
  /**
187
- * Transport-level safeguards for this call. Overrides the matching field
188
- * on the client constructor's `transport` option. Use to lift or tighten
187
+ * Transport-level safeguards for this call. Use to lift or tighten
189
188
  * `maxResponseBytes` per call when an agent legitimately publishes large
190
- * catalogs (e.g., `list_creative_formats` on a generative seller).
189
+ * catalogs (e.g., `list_creative_formats` on a generative seller) — the
190
+ * default is 4 MiB.
191
+ *
192
+ * This object **replaces** the client constructor's `transport` rather than
193
+ * merging into it. A per-call object that sets only `requestTimeoutMs`
194
+ * drops the constructor's `maxResponseBytes` back to the default; repeat
195
+ * every field you still want.
191
196
  */
192
197
  transport?: import('../protocols').TransportOptions;
193
198
  }
@@ -495,9 +495,11 @@ export interface SingleAgentClientConfig extends ConversationConfig {
495
495
  * Transport-level safeguards. Applies to every call this client dispatches
496
496
  * unless overridden at call time.
497
497
  *
498
- * Set `maxResponseBytes` when crawling untrusted agents (registries,
499
- * federated discovery layers) to prevent a hostile vendor from buffering
500
- * a large reply before any application-layer schema validation runs. Set
498
+ * `maxResponseBytes` defaults to 4 MiB on every call; raise it for an agent
499
+ * that legitimately publishes a large catalog, lower it when crawling
500
+ * untrusted agents (registries, federated discovery layers), or set it to
501
+ * exactly `0` to opt out of the cap entirely. A per-call `transport`
502
+ * replaces this object wholesale rather than merging into it. Set
501
503
  * `requestTimeoutMs` to override the default 60s cap on A2A agent-card
502
504
  * discovery; use `0` to disable the SDK-imposed discovery timeout.
503
505
  */
@@ -495,9 +495,11 @@ export interface SingleAgentClientConfig extends ConversationConfig {
495
495
  * Transport-level safeguards. Applies to every call this client dispatches
496
496
  * unless overridden at call time.
497
497
  *
498
- * Set `maxResponseBytes` when crawling untrusted agents (registries,
499
- * federated discovery layers) to prevent a hostile vendor from buffering
500
- * a large reply before any application-layer schema validation runs. Set
498
+ * `maxResponseBytes` defaults to 4 MiB on every call; raise it for an agent
499
+ * that legitimately publishes a large catalog, lower it when crawling
500
+ * untrusted agents (registries, federated discovery layers), or set it to
501
+ * exactly `0` to opt out of the cap entirely. A per-call `transport`
502
+ * replaces this object wholesale rather than merging into it. Set
501
503
  * `requestTimeoutMs` to override the default 60s cap on A2A agent-card
502
504
  * discovery; use `0` to disable the SDK-imposed discovery timeout.
503
505
  */
@@ -50,6 +50,7 @@ var import_signedRequestRejection = require('../protocols/signedRequestRejection
50
50
  var import_errors = require('../errors/index.js');
51
51
  var import_client_hooks = require('../validation/client-hooks.js');
52
52
  var import_schema_validator = require('../validation/schema-validator.js');
53
+ var import_schema_loader = require('../validation/schema-loader.js');
53
54
  var import_version = require('../version.js');
54
55
  var import_response_unwrapper = require('../utils/response-unwrapper.js');
55
56
  var import_error_extraction = require('../utils/error-extraction.js');
@@ -4458,7 +4459,10 @@ class TaskExecutor {
4458
4459
  const mode = this.responseValidationMode;
4459
4460
  const logViolations = this.config.logSchemaViolations !== false;
4460
4461
  try {
4461
- const validationVersion = (serverVersion ?? this.lastKnownServerVersion) === "v2" ? "v2.5" : this.responseAdcpVersionForValidation() ?? this.config.adcpVersion ?? import_version.ADCP_VERSION;
4462
+ let validationVersion = (serverVersion ?? this.lastKnownServerVersion) === "v2" ? "v2.5" : this.responseAdcpVersionForValidation() ?? this.config.adcpVersion ?? import_version.ADCP_VERSION;
4463
+ if (taskName === "get_adcp_capabilities" && validationVersion !== "v2.5") {
4464
+ validationVersion = (0, import_schema_loader.resolveServedValidationVersion)(response, validationVersion);
4465
+ }
4462
4466
  const normalizedResponse = this.normalizeResponseForValidation(response, taskName, validationVersion === "v2.5");
4463
4467
  const outcome = (this.config.experimentalIdentity33?.() || this.config.identity33SchemaExperiment && normalizedResponse && typeof normalizedResponse === "object" && (0, import_adcp_version_config.isAdcpVersionAtLeast)(normalizedResponse.adcp_version, "3.3")) && mode !== "off" ? validateIdentity33Payload(taskName, "response", normalizedResponse, validationVersion) : (0, import_client_hooks.validateIncomingResponse)(taskName, normalizedResponse, mode, void 0, validationVersion);
4464
4468
  if (outcome.valid) return { valid: true, errors: [] };
@@ -26,6 +26,7 @@ import {
26
26
  resolveValidationModes
27
27
  } from "../validation/client-hooks.mjs";
28
28
  import { formatIssues } from "../validation/schema-validator.mjs";
29
+ import { resolveServedValidationVersion } from "../validation/schema-loader.mjs";
29
30
  import { ADCP_VERSION } from "../version.mjs";
30
31
  import { unwrapProtocolResponse, isAdcpOperationSuccess } from "../utils/response-unwrapper.mjs";
31
32
  import { extractAdcpErrorInfo, extractCorrelationId } from "../utils/error-extraction.mjs";
@@ -4436,7 +4437,10 @@ class TaskExecutor {
4436
4437
  const mode = this.responseValidationMode;
4437
4438
  const logViolations = this.config.logSchemaViolations !== false;
4438
4439
  try {
4439
- const validationVersion = (serverVersion ?? this.lastKnownServerVersion) === "v2" ? "v2.5" : this.responseAdcpVersionForValidation() ?? this.config.adcpVersion ?? ADCP_VERSION;
4440
+ let validationVersion = (serverVersion ?? this.lastKnownServerVersion) === "v2" ? "v2.5" : this.responseAdcpVersionForValidation() ?? this.config.adcpVersion ?? ADCP_VERSION;
4441
+ if (taskName === "get_adcp_capabilities" && validationVersion !== "v2.5") {
4442
+ validationVersion = resolveServedValidationVersion(response, validationVersion);
4443
+ }
4440
4444
  const normalizedResponse = this.normalizeResponseForValidation(response, taskName, validationVersion === "v2.5");
4441
4445
  const outcome = (this.config.experimentalIdentity33?.() || this.config.identity33SchemaExperiment && normalizedResponse && typeof normalizedResponse === "object" && isAdcpVersionAtLeast(normalizedResponse.adcp_version, "3.3")) && mode !== "off" ? validateIdentity33Payload(taskName, "response", normalizedResponse, validationVersion) : validateIncomingResponse(taskName, normalizedResponse, mode, void 0, validationVersion);
4442
4446
  if (outcome.valid) return { valid: true, errors: [] };
@@ -374,10 +374,15 @@ export declare class ProtocolFeatureUnsupportedError extends FeatureUnsupportedE
374
374
  }
375
375
  export declare function getClientPreflightAdcpError(error: unknown): ClientPreflightAdcpErrorInfo | undefined;
376
376
  /**
377
- * Error thrown when a response body exceeds the configured `maxResponseBytes`
378
- * cap on the transport. Surfaced when crawling untrusted agents (registries,
379
- * federated discovery layers) to prevent a hostile vendor from buffering a
380
- * large reply before schema validation runs.
377
+ * Error thrown when a response body exceeds the `maxResponseBytes` cap on the
378
+ * transport — 4 MiB by default on every MCP and A2A call path. It prevents a
379
+ * hostile or merely careless agent from buffering a large reply before schema
380
+ * validation runs.
381
+ *
382
+ * Raised on three paths: a declared `Content-Length` over the cap, a one-shot
383
+ * body that crosses the cap mid-stream, and a `text/event-stream` response
384
+ * whose single event exceeds the cap or whose cumulative octets exceed the
385
+ * call's stream budget. Nothing is truncated — the read fails.
381
386
  *
382
387
  * Recovery: `terminal` from the SDK's view — repeating the call against the
383
388
  * same agent will hit the same cap. The buyer's options are to widen the
@@ -374,10 +374,15 @@ export declare class ProtocolFeatureUnsupportedError extends FeatureUnsupportedE
374
374
  }
375
375
  export declare function getClientPreflightAdcpError(error: unknown): ClientPreflightAdcpErrorInfo | undefined;
376
376
  /**
377
- * Error thrown when a response body exceeds the configured `maxResponseBytes`
378
- * cap on the transport. Surfaced when crawling untrusted agents (registries,
379
- * federated discovery layers) to prevent a hostile vendor from buffering a
380
- * large reply before schema validation runs.
377
+ * Error thrown when a response body exceeds the `maxResponseBytes` cap on the
378
+ * transport — 4 MiB by default on every MCP and A2A call path. It prevents a
379
+ * hostile or merely careless agent from buffering a large reply before schema
380
+ * validation runs.
381
+ *
382
+ * Raised on three paths: a declared `Content-Length` over the cap, a one-shot
383
+ * body that crosses the cap mid-stream, and a `text/event-stream` response
384
+ * whose single event exceeds the cap or whose cumulative octets exceed the
385
+ * call's stream budget. Nothing is truncated — the read fails.
381
386
  *
382
387
  * Recovery: `terminal` from the SDK's view — repeating the call against the
383
388
  * same agent will hit the same cap. The buyer's options are to widen the
@@ -190,7 +190,7 @@ export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions,
190
190
  export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth/index.mjs';
191
191
  export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, AgentOAuthClientCredentialsSchema, } from './auth/oauth/index.mjs';
192
192
  export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation/index.mjs';
193
- export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols/index.mjs';
193
+ export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, DEFAULT_MAX_RESPONSE_BYTES, SSE_CUMULATIVE_BUDGET_MULTIPLIER, } from './protocols/index.mjs';
194
194
  export { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader.mjs';
195
195
  export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, TransportOptions, A2ALegacyCompatOptions, } from './protocols/index.mjs';
196
196
  import { bundleSupportsAdcpVersionField as _isSupported } from './protocols/index.mjs';
@@ -261,7 +261,7 @@ export declare function createAdCPClient(agents?: AgentConfig[]): ADCPMultiAgent
261
261
  * @deprecated Use ADCPMultiAgentClient.fromEnv() instead
262
262
  */
263
263
  export declare function createAdCPClientFromEnv(): ADCPMultiAgentClient;
264
- export { SubstitutionObserver, SubstitutionEncoder, PreviewFetchError, MacroInRawValueError, CATALOG_MACRO_VECTORS, getCatalogMacroVector, extractTrackerUrls, matchBindings, assertRfc3986Safe, assertUnreservedOnly, assertNoNestedExpansion, assertSchemePreserved, DEFAULT_MACRO_PROHIBITED_PATTERN, enforceSsrfPolicy, enforceSsrfPolicyResolved, DEFAULT_SSRF_POLICY, encodeUnreserved, equalUnderHexCasePolicy, isUnreservedOnly, divergenceOffset, translateUniversalMacros, UnsafeNativeMappingError, compileUniversalMacroTemplate, } from './substitution/index.mjs';
264
+ export { SubstitutionObserver, SubstitutionEncoder, PreviewFetchError, MacroInRawValueError, CATALOG_MACRO_VECTORS, getCatalogMacroVector, extractTrackerUrls, matchBindings, assertRfc3986Safe, assertUnreservedOnly, assertNoNestedExpansion, assertSchemePreserved, DEFAULT_MACRO_PROHIBITED_PATTERN, enforceSsrfPolicy, enforceSsrfPolicyResolved, DEFAULT_SSRF_POLICY, encodeUnreserved, equalUnderHexCasePolicy, isUnreservedOnly, divergenceOffset, translateUniversalMacros, UnsafeNativeMappingError, MultipleVendorConsentMacrosError, compileUniversalMacroTemplate, } from './substitution/index.mjs';
265
265
  export type { ObserverFetchOptions, ObserverDispatcher, CatalogMacroVectorName, AssertionOptions as SubstitutionAssertionOptions, AssertionResult as SubstitutionAssertionResult, BindingMatch, CatalogBinding, CatalogMacroVector, PolicyResult as SubstitutionPolicyResult, SsrfPolicy, TrackerUrlRecord, MacroMapping, TranslateResult, BuiltInSourceMacroSyntax, CompileUniversalMacroTemplateInput, CompileUniversalMacroTemplateResult, CustomSourceMacroSyntax, MacroDocumentationReference, SourceMacroMapping, SourceMacroRequirement, SourceMacroRequirementSatisfaction, SourceMacroSyntax, SourceMacroSyntaxDeclaration, UniversalMacroCompileDiagnostic, UniversalMacroOccurrence, } from './substitution/index.mjs';
266
266
  export { testAgent, testAgentA2A, testAgentClient, createTestAgent, TEST_AGENT_TOKEN, TEST_AGENT_MCP_CONFIG, TEST_AGENT_A2A_CONFIG, testAgentNoAuth, testAgentNoAuthA2A, TEST_AGENT_NO_AUTH_MCP_CONFIG, TEST_AGENT_NO_AUTH_A2A_CONFIG, creativeAgent, testBrandRightsFlow, hasBrandRightsTools, expectControllerError, expectControllerSuccess, RateLimitTripObserver, RATE_LIMIT_TRIP_CONTRACT, RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN, validateRateLimitTripSpec, } from './testing/index.mjs';
267
267
  export type { ControllerErrorWithDetail, TestClient, RateLimitTripSpec, RateLimitTripClient, RateLimitTripFailureCode, RateLimitTripObservation, RateLimitTripObserverOptions, RateLimitTripResponseSnapshot, RateLimitTripStructuredResult, RateLimitTripTaskOptions, } from './testing/index.mjs';
@@ -190,7 +190,7 @@ export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions,
190
190
  export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth';
191
191
  export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, AgentOAuthClientCredentialsSchema, } from './auth/oauth';
192
192
  export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation';
193
- export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols';
193
+ export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, DEFAULT_MAX_RESPONSE_BYTES, SSE_CUMULATIVE_BUDGET_MULTIPLIER, } from './protocols';
194
194
  export { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader';
195
195
  export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, TransportOptions, A2ALegacyCompatOptions, } from './protocols';
196
196
  import { bundleSupportsAdcpVersionField as _isSupported } from './protocols';
@@ -261,7 +261,7 @@ export declare function createAdCPClient(agents?: AgentConfig[]): ADCPMultiAgent
261
261
  * @deprecated Use ADCPMultiAgentClient.fromEnv() instead
262
262
  */
263
263
  export declare function createAdCPClientFromEnv(): ADCPMultiAgentClient;
264
- export { SubstitutionObserver, SubstitutionEncoder, PreviewFetchError, MacroInRawValueError, CATALOG_MACRO_VECTORS, getCatalogMacroVector, extractTrackerUrls, matchBindings, assertRfc3986Safe, assertUnreservedOnly, assertNoNestedExpansion, assertSchemePreserved, DEFAULT_MACRO_PROHIBITED_PATTERN, enforceSsrfPolicy, enforceSsrfPolicyResolved, DEFAULT_SSRF_POLICY, encodeUnreserved, equalUnderHexCasePolicy, isUnreservedOnly, divergenceOffset, translateUniversalMacros, UnsafeNativeMappingError, compileUniversalMacroTemplate, } from './substitution';
264
+ export { SubstitutionObserver, SubstitutionEncoder, PreviewFetchError, MacroInRawValueError, CATALOG_MACRO_VECTORS, getCatalogMacroVector, extractTrackerUrls, matchBindings, assertRfc3986Safe, assertUnreservedOnly, assertNoNestedExpansion, assertSchemePreserved, DEFAULT_MACRO_PROHIBITED_PATTERN, enforceSsrfPolicy, enforceSsrfPolicyResolved, DEFAULT_SSRF_POLICY, encodeUnreserved, equalUnderHexCasePolicy, isUnreservedOnly, divergenceOffset, translateUniversalMacros, UnsafeNativeMappingError, MultipleVendorConsentMacrosError, compileUniversalMacroTemplate, } from './substitution';
265
265
  export type { ObserverFetchOptions, ObserverDispatcher, CatalogMacroVectorName, AssertionOptions as SubstitutionAssertionOptions, AssertionResult as SubstitutionAssertionResult, BindingMatch, CatalogBinding, CatalogMacroVector, PolicyResult as SubstitutionPolicyResult, SsrfPolicy, TrackerUrlRecord, MacroMapping, TranslateResult, BuiltInSourceMacroSyntax, CompileUniversalMacroTemplateInput, CompileUniversalMacroTemplateResult, CustomSourceMacroSyntax, MacroDocumentationReference, SourceMacroMapping, SourceMacroRequirement, SourceMacroRequirementSatisfaction, SourceMacroSyntax, SourceMacroSyntaxDeclaration, UniversalMacroCompileDiagnostic, UniversalMacroOccurrence, } from './substitution';
266
266
  export { testAgent, testAgentA2A, testAgentClient, createTestAgent, TEST_AGENT_TOKEN, TEST_AGENT_MCP_CONFIG, TEST_AGENT_A2A_CONFIG, testAgentNoAuth, testAgentNoAuthA2A, TEST_AGENT_NO_AUTH_MCP_CONFIG, TEST_AGENT_NO_AUTH_A2A_CONFIG, creativeAgent, testBrandRightsFlow, hasBrandRightsTools, expectControllerError, expectControllerSuccess, RateLimitTripObserver, RATE_LIMIT_TRIP_CONTRACT, RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX, RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN, validateRateLimitTripSpec, } from './testing/index';
267
267
  export type { ControllerErrorWithDetail, TestClient, RateLimitTripSpec, RateLimitTripClient, RateLimitTripFailureCode, RateLimitTripObservation, RateLimitTripObserverOptions, RateLimitTripResponseSnapshot, RateLimitTripStructuredResult, RateLimitTripTaskOptions, } from './testing/index';
package/dist/lib/index.js CHANGED
@@ -75,6 +75,7 @@ __export(index_exports, {
75
75
  CreativeFormatCapabilityError: () => import_projection2.CreativeFormatCapabilityError,
76
76
  CreativeFormatProjectionError: () => import_projection2.CreativeFormatProjectionError,
77
77
  DEFAULT_MACRO_PROHIBITED_PATTERN: () => import_substitution.DEFAULT_MACRO_PROHIBITED_PATTERN,
78
+ DEFAULT_MAX_RESPONSE_BYTES: () => import_protocols.DEFAULT_MAX_RESPONSE_BYTES,
78
79
  DEFAULT_MAX_SSE_FRAME_BYTES: () => import_registry2.DEFAULT_MAX_SSE_FRAME_BYTES,
79
80
  DEFAULT_REPORTING_CAPABILITIES: () => import_server.DEFAULT_REPORTING_CAPABILITIES,
80
81
  DEFAULT_SSRF_POLICY: () => import_substitution.DEFAULT_SSRF_POLICY,
@@ -141,6 +142,7 @@ __export(index_exports, {
141
142
  MemoryStorage: () => import_MemoryStorage.MemoryStorage,
142
143
  MissingEnvSecretError: () => import_oauth4.MissingEnvSecretError,
143
144
  MissingInputHandlerError: () => import_errors.MissingInputHandlerError,
145
+ MultipleVendorConsentMacrosError: () => import_substitution.MultipleVendorConsentMacrosError,
144
146
  NeedsAuthorizationError: () => import_oauth3.NeedsAuthorizationError,
145
147
  NetworkConsistencyChecker: () => import_network_consistency_checker.NetworkConsistencyChecker,
146
148
  OBSERVER_FLUSH_TIMEOUT_MS: () => import_protocols.OBSERVER_FLUSH_TIMEOUT_MS,
@@ -183,6 +185,7 @@ __export(index_exports, {
183
185
  SIErrorCodes: () => import_adapters.SIErrorCodes,
184
186
  SIGNALS_TOOLS: () => import_capabilities.SIGNALS_TOOLS,
185
187
  SISessionManager: () => import_adapters.SISessionManager,
188
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER: () => import_protocols.SSE_CUMULATIVE_BUDGET_MULTIPLIER,
186
189
  SSRF_TRANSIENT_CODES: () => import_net.SSRF_TRANSIENT_CODES,
187
190
  STANDARD_CREATIVE_AGENTS: () => import_CreativeAgentClient.STANDARD_CREATIVE_AGENTS,
188
191
  STANDARD_ERROR_CODES: () => import_error_codes.STANDARD_ERROR_CODES,
@@ -921,6 +924,7 @@ function createAdCPClientFromEnv() {
921
924
  CreativeFormatCapabilityError,
922
925
  CreativeFormatProjectionError,
923
926
  DEFAULT_MACRO_PROHIBITED_PATTERN,
927
+ DEFAULT_MAX_RESPONSE_BYTES,
924
928
  DEFAULT_MAX_SSE_FRAME_BYTES,
925
929
  DEFAULT_REPORTING_CAPABILITIES,
926
930
  DEFAULT_SSRF_POLICY,
@@ -987,6 +991,7 @@ function createAdCPClientFromEnv() {
987
991
  MemoryStorage,
988
992
  MissingEnvSecretError,
989
993
  MissingInputHandlerError,
994
+ MultipleVendorConsentMacrosError,
990
995
  NeedsAuthorizationError,
991
996
  NetworkConsistencyChecker,
992
997
  OBSERVER_FLUSH_TIMEOUT_MS,
@@ -1029,6 +1034,7 @@ function createAdCPClientFromEnv() {
1029
1034
  SIErrorCodes,
1030
1035
  SIGNALS_TOOLS,
1031
1036
  SISessionManager,
1037
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER,
1032
1038
  SSRF_TRANSIENT_CODES,
1033
1039
  STANDARD_CREATIVE_AGENTS,
1034
1040
  STANDARD_ERROR_CODES,
@@ -465,7 +465,9 @@ import {
465
465
  BODY_SNIPPET_TIMEOUT_MS,
466
466
  OBSERVER_FLUSH_TIMEOUT_MS,
467
467
  sanitizeTransportHeaders,
468
- sanitizeTransportUrl
468
+ sanitizeTransportUrl,
469
+ DEFAULT_MAX_RESPONSE_BYTES,
470
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER
469
471
  } from "./protocols/index.mjs";
470
472
  import { toReleasePrecisionWire, validateAdcpVersionWire } from "./validation/schema-loader.mjs";
471
473
  import { bundleSupportsAdcpVersionField as _isSupported } from "./protocols/index.mjs";
@@ -785,6 +787,7 @@ import {
785
787
  divergenceOffset,
786
788
  translateUniversalMacros,
787
789
  UnsafeNativeMappingError,
790
+ MultipleVendorConsentMacrosError,
788
791
  compileUniversalMacroTemplate
789
792
  } from "./substitution/index.mjs";
790
793
  import {
@@ -879,6 +882,7 @@ export {
879
882
  CreativeFormatCapabilityError,
880
883
  CreativeFormatProjectionError,
881
884
  DEFAULT_MACRO_PROHIBITED_PATTERN,
885
+ DEFAULT_MAX_RESPONSE_BYTES,
882
886
  DEFAULT_MAX_SSE_FRAME_BYTES,
883
887
  DEFAULT_REPORTING_CAPABILITIES,
884
888
  DEFAULT_SSRF_POLICY,
@@ -945,6 +949,7 @@ export {
945
949
  MemoryStorage,
946
950
  MissingEnvSecretError,
947
951
  MissingInputHandlerError,
952
+ MultipleVendorConsentMacrosError,
948
953
  NeedsAuthorizationError,
949
954
  NetworkConsistencyChecker,
950
955
  OBSERVER_FLUSH_TIMEOUT_MS,
@@ -987,6 +992,7 @@ export {
987
992
  SIErrorCodes,
988
993
  SIGNALS_TOOLS,
989
994
  SISessionManager,
995
+ SSE_CUMULATIVE_BUDGET_MULTIPLIER,
990
996
  SSRF_TRANSIENT_CODES,
991
997
  STANDARD_CREATIVE_AGENTS,
992
998
  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;