@adcp/sdk 16.0.0-beta.7 → 16.0.0-beta.9
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.
- package/AGENTS.md +3 -3
- package/README.md +20 -0
- package/bin/adcp.js +10 -13
- package/dist/lib/conformance/index.d.mts +2 -0
- package/dist/lib/conformance/index.d.ts +2 -0
- package/dist/lib/conformance/index.js +3 -0
- package/dist/lib/conformance/index.mjs +2 -0
- package/dist/lib/conformance/property-lists.d.mts +14 -0
- package/dist/lib/conformance/property-lists.d.ts +14 -0
- package/dist/lib/conformance/property-lists.js +45 -0
- package/dist/lib/conformance/property-lists.mjs +21 -0
- package/dist/lib/conformance/runConformance.js +20 -1
- package/dist/lib/conformance/runConformance.mjs +20 -1
- package/dist/lib/conformance/types.d.mts +3 -0
- package/dist/lib/conformance/types.d.ts +3 -0
- package/dist/lib/core/AgentClient.d.mts +8 -5
- package/dist/lib/core/AgentClient.d.ts +8 -5
- package/dist/lib/core/AgentClient.js +9 -4
- package/dist/lib/core/AgentClient.mjs +9 -4
- package/dist/lib/core/SingleAgentClient.d.mts +32 -115
- package/dist/lib/core/SingleAgentClient.d.ts +32 -115
- package/dist/lib/core/SingleAgentClient.js +379 -273
- package/dist/lib/core/SingleAgentClient.mjs +387 -275
- package/dist/lib/core/TaskExecutor.d.mts +1 -16
- package/dist/lib/core/TaskExecutor.d.ts +1 -16
- package/dist/lib/core/TaskExecutor.js +34 -51
- package/dist/lib/core/TaskExecutor.mjs +12 -29
- package/dist/lib/core/product-cache.d.mts +3 -1
- package/dist/lib/core/product-cache.d.ts +3 -1
- package/dist/lib/core/product-cache.js +2 -1
- package/dist/lib/core/product-cache.mjs +2 -1
- package/dist/lib/errors/index.d.mts +2 -8
- package/dist/lib/errors/index.d.ts +2 -8
- package/dist/lib/errors/index.js +4 -4
- package/dist/lib/errors/index.mjs +4 -4
- package/dist/lib/identifiers.d.mts +53 -0
- package/dist/lib/identifiers.d.ts +53 -0
- package/dist/lib/identifiers.js +212 -0
- package/dist/lib/identifiers.mjs +163 -0
- package/dist/lib/index.d.mts +7 -5
- package/dist/lib/index.d.ts +7 -5
- package/dist/lib/index.js +2 -14
- package/dist/lib/index.mjs +1 -14
- package/dist/lib/media-buy/compatibility.d.mts +1 -1
- package/dist/lib/media-buy/compatibility.d.ts +1 -1
- package/dist/lib/media-buy/compatibility.js +26 -45
- package/dist/lib/media-buy/compatibility.mjs +26 -45
- package/dist/lib/media-buy/index.d.mts +1 -1
- package/dist/lib/media-buy/index.d.ts +1 -1
- package/dist/lib/media-buy/legacy-purchase-continuation.d.mts +2 -2
- package/dist/lib/media-buy/legacy-purchase-continuation.d.ts +2 -2
- package/dist/lib/media-buy/property-policy.d.mts +15 -1
- package/dist/lib/media-buy/property-policy.d.ts +15 -1
- package/dist/lib/media-buy/property-policy.js +135 -3
- package/dist/lib/media-buy/property-policy.mjs +134 -3
- package/dist/lib/protocols/index.js +14 -22
- package/dist/lib/protocols/index.mjs +5 -13
- package/dist/lib/registry/index.d.mts +12 -0
- package/dist/lib/registry/index.d.ts +12 -0
- package/dist/lib/registry/index.js +159 -5
- package/dist/lib/registry/index.mjs +156 -4
- package/dist/lib/registry/types.d.mts +26 -2
- package/dist/lib/registry/types.d.ts +26 -2
- package/dist/lib/registry/types.generated.d.mts +51 -11
- package/dist/lib/registry/types.generated.d.ts +51 -11
- package/dist/lib/reporting/source/conformance.d.mts +8 -8
- package/dist/lib/reporting/source/conformance.d.ts +8 -8
- package/dist/lib/reporting/source/manifest.d.mts +27 -27
- package/dist/lib/reporting/source/manifest.d.ts +27 -27
- package/dist/lib/server/create-adcp-server.js +6 -0
- package/dist/lib/server/create-adcp-server.mjs +6 -0
- package/dist/lib/server/decisioning/specialisms/lists.d.mts +4 -4
- package/dist/lib/server/decisioning/specialisms/lists.d.ts +4 -4
- package/dist/lib/server/index.d.mts +3 -0
- package/dist/lib/server/index.d.ts +3 -0
- package/dist/lib/server/index.js +8 -1
- package/dist/lib/server/index.mjs +4 -0
- package/dist/lib/server/property-lists.d.mts +36 -0
- package/dist/lib/server/property-lists.d.ts +36 -0
- package/dist/lib/server/property-lists.js +154 -0
- package/dist/lib/server/property-lists.mjs +129 -0
- package/dist/lib/server/targeting-helpers.d.mts +2 -0
- package/dist/lib/server/targeting-helpers.d.ts +2 -0
- package/dist/lib/server/targeting-helpers.js +28 -1
- package/dist/lib/server/targeting-helpers.mjs +18 -1
- package/dist/lib/signing/parser.js +2 -2
- package/dist/lib/signing/parser.mjs +2 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.mjs +5 -1
- package/dist/lib/signing/webhook-verifier.d.mts +11 -0
- package/dist/lib/signing/webhook-verifier.d.ts +11 -0
- package/dist/lib/signing/webhook-verifier.js +11 -3
- package/dist/lib/signing/webhook-verifier.mjs +11 -3
- package/dist/lib/supply-path/verify.js +12 -2
- package/dist/lib/supply-path/verify.mjs +2 -2
- package/dist/lib/testing/compliance/comply.js +0 -8
- package/dist/lib/testing/compliance/comply.mjs +0 -8
- package/dist/lib/testing/compliance/storyboard-tracks.js +11 -0
- package/dist/lib/testing/compliance/storyboard-tracks.mjs +11 -0
- package/dist/lib/testing/index.d.mts +2 -0
- package/dist/lib/testing/index.d.ts +2 -0
- package/dist/lib/testing/index.js +5 -0
- package/dist/lib/testing/index.mjs +3 -0
- package/dist/lib/testing/scenarios/capabilities.d.mts +2 -2
- package/dist/lib/testing/scenarios/capabilities.d.ts +2 -2
- package/dist/lib/testing/scenarios/capabilities.js +8 -41
- package/dist/lib/testing/scenarios/capabilities.mjs +9 -42
- package/dist/lib/testing/storyboard/creative-build-probe.d.mts +34 -0
- package/dist/lib/testing/storyboard/creative-build-probe.d.ts +34 -0
- package/dist/lib/testing/storyboard/creative-build-probe.js +395 -0
- package/dist/lib/testing/storyboard/creative-build-probe.mjs +373 -0
- package/dist/lib/testing/storyboard/index.d.mts +2 -0
- package/dist/lib/testing/storyboard/index.d.ts +2 -0
- package/dist/lib/testing/storyboard/index.js +5 -0
- package/dist/lib/testing/storyboard/index.mjs +3 -0
- package/dist/lib/testing/storyboard/loader.js +12 -0
- package/dist/lib/testing/storyboard/loader.mjs +12 -0
- package/dist/lib/testing/storyboard/property-list-reference.d.mts +15 -0
- package/dist/lib/testing/storyboard/property-list-reference.d.ts +15 -0
- package/dist/lib/testing/storyboard/property-list-reference.js +514 -0
- package/dist/lib/testing/storyboard/property-list-reference.mjs +487 -0
- package/dist/lib/testing/storyboard/runner.js +318 -58
- package/dist/lib/testing/storyboard/runner.mjs +322 -58
- package/dist/lib/testing/storyboard/types.d.mts +38 -16
- package/dist/lib/testing/storyboard/types.d.ts +38 -16
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.mjs +1 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +64 -0
- package/dist/lib/testing/storyboard/validations.mjs +67 -1
- package/dist/lib/testing/types.d.mts +15 -1
- package/dist/lib/testing/types.d.ts +15 -1
- package/dist/lib/types/schemas.generated.d.ts +65 -65
- package/dist/lib/types/wellknown-schemas.generated.d.mts +21 -21
- package/dist/lib/types/wellknown-schemas.generated.d.ts +21 -21
- package/dist/lib/utils/adcp-version-config.js +6 -0
- package/dist/lib/utils/adcp-version-config.mjs +6 -0
- package/dist/lib/utils/capabilities.d.mts +7 -9
- package/dist/lib/utils/capabilities.d.ts +7 -9
- package/dist/lib/utils/capabilities.js +14 -28
- package/dist/lib/utils/capabilities.mjs +14 -27
- package/dist/lib/utils/creative-adapter.d.mts +15 -113
- package/dist/lib/utils/creative-adapter.d.ts +15 -113
- package/dist/lib/utils/creative-adapter.js +7 -106
- package/dist/lib/utils/creative-adapter.mjs +7 -102
- package/dist/lib/utils/format-renders.d.mts +20 -80
- package/dist/lib/utils/format-renders.d.ts +20 -80
- package/dist/lib/utils/format-renders.js +7 -67
- package/dist/lib/utils/format-renders.mjs +7 -66
- package/dist/lib/utils/index.d.mts +1 -2
- package/dist/lib/utils/index.d.ts +1 -2
- package/dist/lib/utils/index.js +0 -7
- package/dist/lib/utils/index.mjs +0 -6
- package/dist/lib/utils/preview-normalizer.d.mts +31 -80
- package/dist/lib/utils/preview-normalizer.d.ts +31 -80
- package/dist/lib/utils/preview-normalizer.js +5 -50
- package/dist/lib/utils/preview-normalizer.mjs +5 -49
- package/dist/lib/utils/pricing-adapter.d.mts +2 -36
- package/dist/lib/utils/pricing-adapter.d.ts +2 -36
- package/dist/lib/utils/pricing-adapter.js +0 -105
- package/dist/lib/utils/pricing-adapter.mjs +0 -100
- package/dist/lib/utils/request-normalizer.d.mts +1 -2
- package/dist/lib/utils/request-normalizer.d.ts +1 -2
- package/dist/lib/v2/projection/creative-delivery.d.mts +2 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts +2 -0
- package/dist/lib/v2/projection/creative-delivery.js +7 -0
- package/dist/lib/v2/projection/creative-delivery.mjs +6 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +12 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +12 -0
- package/dist/lib/v2/projection/legacy-metadata.js +41 -1
- package/dist/lib/v2/projection/legacy-metadata.mjs +37 -1
- package/dist/lib/v2/projection/legacy-normalization.d.mts +1 -1
- package/dist/lib/v2/projection/legacy-normalization.d.ts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +13 -0
- package/dist/lib/v2/projection/v1-to-v2.mjs +14 -0
- package/dist/lib/validation/client-hooks.d.mts +1 -4
- package/dist/lib/validation/client-hooks.d.ts +1 -4
- package/dist/lib/validation/get-products-request.d.mts +1 -1
- package/dist/lib/validation/get-products-request.d.ts +1 -1
- package/dist/lib/validation/schema-loader.js +6 -0
- package/dist/lib/validation/schema-loader.mjs +6 -0
- package/dist/lib/validation/schema-validator.js +1 -26
- package/dist/lib/validation/schema-validator.mjs +1 -26
- package/dist/lib/version.d.mts +5 -5
- package/dist/lib/version.d.ts +5 -5
- package/dist/lib/version.js +3 -5
- package/dist/lib/version.mjs +3 -5
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/development/PROTOCOL_DIFFERENCES.md +1 -1
- package/docs/guides/CONFORMANCE.md +25 -0
- package/docs/guides/CREATIVE-BUILD-PROBE.md +156 -0
- package/docs/guides/CREATIVE-DELIVERY.md +45 -6
- package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +15 -18
- package/docs/guides/PROPERTY-LISTS.md +264 -0
- package/docs/guides/SIGNING-GUIDE.md +25 -0
- package/docs/guides/VALIDATE-YOUR-AGENT.md +5 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-13-to-14.md +20 -16
- package/docs/migration-14.x-rc-worksheet.md +5 -5
- package/docs/migration-4.x-to-5.x.md +12 -7
- package/docs/migration-drop-adcp-2.md +25 -0
- package/package.json +3 -18
- package/skills/call-adcp-agent/SKILL.md +23 -25
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.mts +0 -3
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.d.ts +0 -3
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.js +0 -33
- package/dist/lib/adapters/legacy/v2-5/create_media_buy.mjs +0 -9
- package/dist/lib/adapters/legacy/v2-5/get_products.d.mts +0 -8
- package/dist/lib/adapters/legacy/v2-5/get_products.d.ts +0 -8
- package/dist/lib/adapters/legacy/v2-5/get_products.js +0 -33
- package/dist/lib/adapters/legacy/v2-5/get_products.mjs +0 -9
- package/dist/lib/adapters/legacy/v2-5/index.d.mts +0 -34
- package/dist/lib/adapters/legacy/v2-5/index.d.ts +0 -34
- package/dist/lib/adapters/legacy/v2-5/index.js +0 -50
- package/dist/lib/adapters/legacy/v2-5/index.mjs +0 -25
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.mts +0 -8
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.d.ts +0 -8
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.js +0 -33
- package/dist/lib/adapters/legacy/v2-5/list_creative_formats.mjs +0 -9
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.mts +0 -3
- package/dist/lib/adapters/legacy/v2-5/preview_creative.d.ts +0 -3
- package/dist/lib/adapters/legacy/v2-5/preview_creative.js +0 -33
- package/dist/lib/adapters/legacy/v2-5/preview_creative.mjs +0 -9
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.mts +0 -11
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +0 -11
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +0 -32
- package/dist/lib/adapters/legacy/v2-5/sync_creatives.mjs +0 -8
- package/dist/lib/adapters/legacy/v2-5/types.d.mts +0 -39
- package/dist/lib/adapters/legacy/v2-5/types.d.ts +0 -39
- package/dist/lib/adapters/legacy/v2-5/types.js +0 -16
- package/dist/lib/adapters/legacy/v2-5/types.mjs +0 -0
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.mts +0 -3
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.d.ts +0 -3
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.js +0 -35
- package/dist/lib/adapters/legacy/v2-5/update_media_buy.mjs +0 -11
- package/dist/lib/schemas-data/v2.5/_provenance.json +0 -8
- package/dist/lib/schemas-data/v2.5/adagents.json +0 -494
- package/dist/lib/schemas-data/v2.5/core/activation-key.json +0 -50
- package/dist/lib/schemas-data/v2.5/core/assets/audio-asset.json +0 -32
- package/dist/lib/schemas-data/v2.5/core/assets/css-asset.json +0 -21
- package/dist/lib/schemas-data/v2.5/core/assets/daast-asset.json +0 -87
- package/dist/lib/schemas-data/v2.5/core/assets/html-asset.json +0 -21
- package/dist/lib/schemas-data/v2.5/core/assets/image-asset.json +0 -38
- package/dist/lib/schemas-data/v2.5/core/assets/javascript-asset.json +0 -21
- package/dist/lib/schemas-data/v2.5/core/assets/markdown-asset.json +0 -31
- package/dist/lib/schemas-data/v2.5/core/assets/text-asset.json +0 -21
- package/dist/lib/schemas-data/v2.5/core/assets/url-asset.json +0 -26
- package/dist/lib/schemas-data/v2.5/core/assets/vast-asset.json +0 -87
- package/dist/lib/schemas-data/v2.5/core/assets/video-asset.json +0 -44
- package/dist/lib/schemas-data/v2.5/core/assets/webhook-asset.json +0 -71
- package/dist/lib/schemas-data/v2.5/core/async-response-data.json +0 -88
- package/dist/lib/schemas-data/v2.5/core/brand-manifest-ref.json +0 -33
- package/dist/lib/schemas-data/v2.5/core/brand-manifest.json +0 -409
- package/dist/lib/schemas-data/v2.5/core/context.json +0 -8
- package/dist/lib/schemas-data/v2.5/core/creative-asset.json +0 -125
- package/dist/lib/schemas-data/v2.5/core/creative-assignment.json +0 -31
- package/dist/lib/schemas-data/v2.5/core/creative-filters.json +0 -111
- package/dist/lib/schemas-data/v2.5/core/creative-manifest.json +0 -72
- package/dist/lib/schemas-data/v2.5/core/creative-policy.json +0 -27
- package/dist/lib/schemas-data/v2.5/core/delivery-metrics.json +0 -171
- package/dist/lib/schemas-data/v2.5/core/deployment.json +0 -93
- package/dist/lib/schemas-data/v2.5/core/destination.json +0 -53
- package/dist/lib/schemas-data/v2.5/core/error.json +0 -40
- package/dist/lib/schemas-data/v2.5/core/ext.json +0 -8
- package/dist/lib/schemas-data/v2.5/core/format-id.json +0 -47
- package/dist/lib/schemas-data/v2.5/core/format.json +0 -324
- package/dist/lib/schemas-data/v2.5/core/frequency-cap.json +0 -18
- package/dist/lib/schemas-data/v2.5/core/mcp-webhook-payload.json +0 -152
- package/dist/lib/schemas-data/v2.5/core/measurement.json +0 -48
- package/dist/lib/schemas-data/v2.5/core/media-buy.json +0 -62
- package/dist/lib/schemas-data/v2.5/core/package.json +0 -72
- package/dist/lib/schemas-data/v2.5/core/performance-feedback.json +0 -90
- package/dist/lib/schemas-data/v2.5/core/placement.json +0 -34
- package/dist/lib/schemas-data/v2.5/core/pricing-option.json +0 -35
- package/dist/lib/schemas-data/v2.5/core/product-filters.json +0 -102
- package/dist/lib/schemas-data/v2.5/core/product.json +0 -153
- package/dist/lib/schemas-data/v2.5/core/promoted-offerings.json +0 -115
- package/dist/lib/schemas-data/v2.5/core/promoted-products.json +0 -67
- package/dist/lib/schemas-data/v2.5/core/property-id.json +0 -14
- package/dist/lib/schemas-data/v2.5/core/property-tag.json +0 -16
- package/dist/lib/schemas-data/v2.5/core/property.json +0 -62
- package/dist/lib/schemas-data/v2.5/core/protocol-envelope.json +0 -146
- package/dist/lib/schemas-data/v2.5/core/publisher-property-selector.json +0 -92
- package/dist/lib/schemas-data/v2.5/core/push-notification-config.json +0 -48
- package/dist/lib/schemas-data/v2.5/core/reporting-capabilities.json +0 -71
- package/dist/lib/schemas-data/v2.5/core/response.json +0 -24
- package/dist/lib/schemas-data/v2.5/core/signal-filters.json +0 -35
- package/dist/lib/schemas-data/v2.5/core/start-timing.json +0 -18
- package/dist/lib/schemas-data/v2.5/core/sub-asset.json +0 -79
- package/dist/lib/schemas-data/v2.5/core/targeting.json +0 -50
- package/dist/lib/schemas-data/v2.5/core/tasks-get-request.json +0 -43
- package/dist/lib/schemas-data/v2.5/core/tasks-get-response.json +0 -166
- package/dist/lib/schemas-data/v2.5/core/tasks-list-request.json +0 -192
- package/dist/lib/schemas-data/v2.5/core/tasks-list-response.json +0 -183
- package/dist/lib/schemas-data/v2.5/creative/asset-types/index.json +0 -101
- package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-request.json +0 -73
- package/dist/lib/schemas-data/v2.5/creative/list-creative-formats-response.json +0 -61
- package/dist/lib/schemas-data/v2.5/creative/preview-creative-request.json +0 -164
- package/dist/lib/schemas-data/v2.5/creative/preview-creative-response.json +0 -245
- package/dist/lib/schemas-data/v2.5/creative/preview-render.json +0 -225
- package/dist/lib/schemas-data/v2.5/enums/adcp-domain.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/asset-content-type.json +0 -22
- package/dist/lib/schemas-data/v2.5/enums/auth-scheme.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/available-metric.json +0 -18
- package/dist/lib/schemas-data/v2.5/enums/channels.json +0 -18
- package/dist/lib/schemas-data/v2.5/enums/co-branding-requirement.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/creative-action.json +0 -14
- package/dist/lib/schemas-data/v2.5/enums/creative-agent-capability.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/creative-sort-field.json +0 -15
- package/dist/lib/schemas-data/v2.5/enums/creative-status.json +0 -19
- package/dist/lib/schemas-data/v2.5/enums/daast-tracking-event.json +0 -20
- package/dist/lib/schemas-data/v2.5/enums/daast-version.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/delivery-type.json +0 -15
- package/dist/lib/schemas-data/v2.5/enums/dimension-unit.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/feed-format.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/feedback-source.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/format-category.json +0 -16
- package/dist/lib/schemas-data/v2.5/enums/format-id-parameter.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/frequency-cap-scope.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/history-entry-type.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/http-method.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/identifier-types.json +0 -34
- package/dist/lib/schemas-data/v2.5/enums/javascript-module-type.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/landing-page-requirement.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/markdown-flavor.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/media-buy-status.json +0 -19
- package/dist/lib/schemas-data/v2.5/enums/metric-type.json +0 -17
- package/dist/lib/schemas-data/v2.5/enums/notification-type.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/pacing.json +0 -17
- package/dist/lib/schemas-data/v2.5/enums/preview-output-format.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/pricing-model.json +0 -25
- package/dist/lib/schemas-data/v2.5/enums/property-type.json +0 -16
- package/dist/lib/schemas-data/v2.5/enums/publisher-identifier-types.json +0 -19
- package/dist/lib/schemas-data/v2.5/enums/reporting-frequency.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/signal-catalog-type.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/sort-direction.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/standard-format-ids.json +0 -103
- package/dist/lib/schemas-data/v2.5/enums/task-status.json +0 -29
- package/dist/lib/schemas-data/v2.5/enums/task-type.json +0 -27
- package/dist/lib/schemas-data/v2.5/enums/update-frequency.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/url-asset-type.json +0 -12
- package/dist/lib/schemas-data/v2.5/enums/validation-mode.json +0 -11
- package/dist/lib/schemas-data/v2.5/enums/vast-tracking-event.json +0 -25
- package/dist/lib/schemas-data/v2.5/enums/vast-version.json +0 -14
- package/dist/lib/schemas-data/v2.5/enums/webhook-response-type.json +0 -13
- package/dist/lib/schemas-data/v2.5/enums/webhook-security-method.json +0 -12
- package/dist/lib/schemas-data/v2.5/index.json +0 -604
- package/dist/lib/schemas-data/v2.5/media-buy/build-creative-request.json +0 -31
- package/dist/lib/schemas-data/v2.5/media-buy/build-creative-response.json +0 -65
- package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-input-required.json +0 -31
- package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-submitted.json +0 -16
- package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-async-response-working.json +0 -36
- package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-request.json +0 -126
- package/dist/lib/schemas-data/v2.5/media-buy/create-media-buy-response.json +0 -97
- package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-request.json +0 -54
- package/dist/lib/schemas-data/v2.5/media-buy/get-media-buy-delivery-response.json +0 -285
- package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-input-required.json +0 -38
- package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-submitted.json +0 -21
- package/dist/lib/schemas-data/v2.5/media-buy/get-products-async-response-working.json +0 -34
- package/dist/lib/schemas-data/v2.5/media-buy/get-products-request.json +0 -28
- package/dist/lib/schemas-data/v2.5/media-buy/get-products-response.json +0 -33
- package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-request.json +0 -26
- package/dist/lib/schemas-data/v2.5/media-buy/list-authorized-properties-response.json +0 -70
- package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-request.json +0 -58
- package/dist/lib/schemas-data/v2.5/media-buy/list-creative-formats-response.json +0 -61
- package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-request.json +0 -137
- package/dist/lib/schemas-data/v2.5/media-buy/list-creatives-response.json +0 -437
- package/dist/lib/schemas-data/v2.5/media-buy/package-request.json +0 -80
- package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-request.json +0 -88
- package/dist/lib/schemas-data/v2.5/media-buy/provide-performance-feedback-response.json +0 -66
- package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-input-required.json +0 -25
- package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-submitted.json +0 -16
- package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-async-response-working.json +0 -46
- package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-request.json +0 -178
- package/dist/lib/schemas-data/v2.5/media-buy/sync-creatives-response.json +0 -149
- package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-input-required.json +0 -24
- package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-submitted.json +0 -16
- package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-async-response-working.json +0 -36
- package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-request.json +0 -129
- package/dist/lib/schemas-data/v2.5/media-buy/update-media-buy-response.json +0 -99
- package/dist/lib/schemas-data/v2.5/pricing-options/cpc-option.json +0 -52
- package/dist/lib/schemas-data/v2.5/pricing-options/cpcv-option.json +0 -52
- package/dist/lib/schemas-data/v2.5/pricing-options/cpm-auction-option.json +0 -81
- package/dist/lib/schemas-data/v2.5/pricing-options/cpm-fixed-option.json +0 -52
- package/dist/lib/schemas-data/v2.5/pricing-options/cpp-option.json +0 -73
- package/dist/lib/schemas-data/v2.5/pricing-options/cpv-option.json +0 -88
- package/dist/lib/schemas-data/v2.5/pricing-options/flat-rate-option.json +0 -93
- package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-auction-option.json +0 -81
- package/dist/lib/schemas-data/v2.5/pricing-options/vcpm-fixed-option.json +0 -52
- package/dist/lib/schemas-data/v2.5/protocols/adcp-extension.json +0 -33
- package/dist/lib/schemas-data/v2.5/signals/activate-signal-request.json +0 -32
- package/dist/lib/schemas-data/v2.5/signals/activate-signal-response.json +0 -68
- package/dist/lib/schemas-data/v2.5/signals/get-signals-request.json +0 -59
- package/dist/lib/schemas-data/v2.5/signals/get-signals-response.json +0 -100
- package/dist/lib/types/v2-5/index.d.mts +0 -1
- package/dist/lib/types/v2-5/index.d.ts +0 -1
- package/dist/lib/types/v2-5/index.js +0 -22
- package/dist/lib/types/v2-5/index.mjs +0 -1
- package/dist/lib/types/v2-5/tools.generated.d.mts +0 -3568
- package/dist/lib/types/v2-5/tools.generated.d.ts +0 -3568
- package/dist/lib/types/v2-5/tools.generated.js +0 -16
- package/dist/lib/types/v2-5/tools.generated.mjs +0 -0
- package/dist/lib/utils/sync-creatives-adapter.d.mts +0 -33
- package/dist/lib/utils/sync-creatives-adapter.d.ts +0 -33
- package/dist/lib/utils/sync-creatives-adapter.js +0 -83
- package/dist/lib/utils/sync-creatives-adapter.mjs +0 -59
|
@@ -34,6 +34,9 @@ __export(SingleAgentClient_exports, {
|
|
|
34
34
|
createSingleAgentClient: () => createSingleAgentClient
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(SingleAgentClient_exports);
|
|
37
|
+
var import_pricing_adapter = require('../utils/pricing-adapter.js');
|
|
38
|
+
var import_creative_adapter = require('../utils/creative-adapter.js');
|
|
39
|
+
var import_format_renders = require('../utils/format-renders.js');
|
|
37
40
|
var import_schema_loader = require('../validation/schema-loader.js');
|
|
38
41
|
var import_canonicalize = require('../signing/agent-resolver/canonicalize.js');
|
|
39
42
|
var import_products = require('../supply-path/products.js');
|
|
@@ -80,7 +83,6 @@ var import_request_normalizer = require('../utils/request-normalizer.js');
|
|
|
80
83
|
var import_global_async_local_storage = require('../utils/global-async-local-storage.js');
|
|
81
84
|
var import_validate_user_agent = require('../utils/validate-user-agent.js');
|
|
82
85
|
var import_webhook_url = require('./webhook-url.js');
|
|
83
|
-
var import_v2_5 = require('../adapters/legacy/v2-5/index.js');
|
|
84
86
|
var import_property_policy = require('../media-buy/property-policy.js');
|
|
85
87
|
var import_targeting_helpers = require('../server/targeting-helpers.js');
|
|
86
88
|
var import_creative_delivery = require('../v2/projection/creative-delivery.js');
|
|
@@ -220,6 +222,56 @@ const RECORDLESS_HMAC_READ_ONLY_TASKS = /* @__PURE__ */ new Set([
|
|
|
220
222
|
]);
|
|
221
223
|
const TASK_SCOPED_STATE_LIMIT = 1e4;
|
|
222
224
|
const WEBHOOK_JWKS_RESOLVER_LIMIT = 1024;
|
|
225
|
+
function creativeMatchesProductOption(creative, declaration) {
|
|
226
|
+
const params = isPlainRecord(declaration.params) ? declaration.params : {};
|
|
227
|
+
const assets = isPlainRecord(creative.assets) ? creative.assets : {};
|
|
228
|
+
const slots = Array.isArray(params.slots) ? params.slots : [];
|
|
229
|
+
if (!slots.every((slot) => {
|
|
230
|
+
if (!isPlainRecord(slot) || typeof slot.asset_group_id !== "string") return false;
|
|
231
|
+
const value = assets[slot.asset_group_id];
|
|
232
|
+
const entries = value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
233
|
+
const minimum = Math.max(typeof slot.min === "number" ? slot.min : 0, slot.required === true ? 1 : 0);
|
|
234
|
+
if (entries.length < minimum || typeof slot.max === "number" && entries.length > slot.max) return false;
|
|
235
|
+
return entries.every(
|
|
236
|
+
(asset) => isPlainRecord(asset) && (typeof slot.asset_type !== "string" || asset.asset_type === slot.asset_type)
|
|
237
|
+
);
|
|
238
|
+
}))
|
|
239
|
+
return false;
|
|
240
|
+
const formatParams = isPlainRecord(creative.format_parameters) ? creative.format_parameters : {};
|
|
241
|
+
const kind = String(creative.format_kind);
|
|
242
|
+
const mediaType = kind.startsWith("image") ? "image" : kind.startsWith("video") ? "video" : kind.startsWith("audio") ? "audio" : kind === "html5" ? "html" : void 0;
|
|
243
|
+
const assetTypes = mediaType === "video" ? ["video", "vast"] : mediaType === "audio" ? ["audio", "vast", "daast"] : mediaType === "html" ? ["html", "zip"] : mediaType ? [mediaType] : ["image", "video", "audio", "html", "zip", "vast", "daast"];
|
|
244
|
+
const requiredMediaSlots = slots.filter(
|
|
245
|
+
(slot) => isPlainRecord(slot) && (slot.required === true || typeof slot.min === "number" && slot.min > 0) && assetTypes.includes(String(slot.asset_type))
|
|
246
|
+
);
|
|
247
|
+
const preferredGroups = mediaType ? [`${mediaType}_main`, mediaType, kind, ...assetTypes] : [];
|
|
248
|
+
const primaryGroup = (requiredMediaSlots.length === 1 ? String(requiredMediaSlots[0].asset_group_id) : void 0) ?? preferredGroups.find((group) => assets[group] !== void 0);
|
|
249
|
+
const sourceAssets = primaryGroup ? [assets[primaryGroup]] : Object.values(assets);
|
|
250
|
+
const dimensionalAssets = sourceAssets.flatMap((value) => Array.isArray(value) ? value : [value]).filter(
|
|
251
|
+
(value) => isPlainRecord(value) && assetTypes.includes(String(value.asset_type))
|
|
252
|
+
);
|
|
253
|
+
return (dimensionalAssets.length > 0 ? dimensionalAssets : [{}]).every((asset) => {
|
|
254
|
+
const actual = { ...asset, ...formatParams };
|
|
255
|
+
for (const key of ["width", "height"]) {
|
|
256
|
+
if (typeof params[key] === "number" && actual[key] !== params[key]) return false;
|
|
257
|
+
const min = params[`min_${key}`];
|
|
258
|
+
const max = params[`max_${key}`];
|
|
259
|
+
if (typeof min === "number" && (typeof actual[key] !== "number" || actual[key] < min)) return false;
|
|
260
|
+
if (typeof max === "number" && (typeof actual[key] !== "number" || actual[key] > max)) return false;
|
|
261
|
+
}
|
|
262
|
+
if (Array.isArray(params.sizes) && !params.sizes.some((size) => isPlainRecord(size) && size.width === actual.width && size.height === actual.height))
|
|
263
|
+
return false;
|
|
264
|
+
const duration = actual.duration_ms ?? actual.duration_ms_exact;
|
|
265
|
+
const exact = params.duration_ms_exact ?? params.duration_ms;
|
|
266
|
+
if (typeof exact === "number" && duration !== exact) return false;
|
|
267
|
+
if (typeof exact !== "number" && Array.isArray(params.duration_ms_range)) {
|
|
268
|
+
const [min, max] = params.duration_ms_range;
|
|
269
|
+
if (typeof duration !== "number" || typeof min === "number" && duration < min || typeof max === "number" && duration > max)
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
223
275
|
function isDeferredClientFinalizationContext(value) {
|
|
224
276
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
225
277
|
const context = value;
|
|
@@ -666,24 +718,7 @@ function isToolSchemaRecord(value) {
|
|
|
666
718
|
function isCapabilityEvidence(value) {
|
|
667
719
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
668
720
|
const candidate = value;
|
|
669
|
-
return
|
|
670
|
-
}
|
|
671
|
-
function valueMatchesSchemaType(value, propSchema) {
|
|
672
|
-
if (!propSchema || typeof propSchema !== "object") return false;
|
|
673
|
-
const schema = propSchema;
|
|
674
|
-
if (schema.$ref) return true;
|
|
675
|
-
const valueType = Array.isArray(value) ? "array" : value === null ? "null" : typeof value === "object" ? "object" : typeof value;
|
|
676
|
-
for (const key of ["anyOf", "oneOf"]) {
|
|
677
|
-
const variants = schema[key];
|
|
678
|
-
if (Array.isArray(variants)) {
|
|
679
|
-
return variants.some((v) => valueMatchesSchemaType(value, v));
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
const declared = schema.type;
|
|
683
|
-
if (declared === void 0) return false;
|
|
684
|
-
if (typeof declared === "string") return declared === valueType;
|
|
685
|
-
if (Array.isArray(declared)) return declared.includes(valueType);
|
|
686
|
-
return false;
|
|
721
|
+
return candidate.version === "v3" && Array.isArray(candidate.majorVersions) && candidate.majorVersions.includes(3) && candidate.majorVersions.every((version) => Number.isSafeInteger(version) && version > 0) && Array.isArray(candidate.protocols) && candidate.protocols.every((protocol) => typeof protocol === "string") && typeof candidate.features === "object" && candidate.features !== null && !Array.isArray(candidate.features) && Array.isArray(candidate.extensions) && candidate.extensions.every((extension) => typeof extension === "string") && typeof candidate._synthetic === "boolean";
|
|
687
722
|
}
|
|
688
723
|
function productHasPricingOptions(product) {
|
|
689
724
|
if (!product || typeof product !== "object") return false;
|
|
@@ -696,7 +731,9 @@ function productIdForPricingDiagnostics(product) {
|
|
|
696
731
|
return typeof id === "string" ? id : void 0;
|
|
697
732
|
}
|
|
698
733
|
function propertyListReferenceFromRequest(params) {
|
|
699
|
-
const
|
|
734
|
+
const filters = params.filters;
|
|
735
|
+
const nested = filters && typeof filters === "object" && !Array.isArray(filters) && Object.hasOwn(filters, "property_list") && filters.property_list !== void 0;
|
|
736
|
+
const value = nested ? filters.property_list : params.property_list;
|
|
700
737
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
701
738
|
const ref = value;
|
|
702
739
|
if (typeof ref.agent_url !== "string" || typeof ref.list_id !== "string") return void 0;
|
|
@@ -709,21 +746,37 @@ function propertyListReferenceFromRequest(params) {
|
|
|
709
746
|
function productPolicyRequestSnapshot(requestParams) {
|
|
710
747
|
const account = canonicalAccountRoutingSnapshot(requestParams.account);
|
|
711
748
|
const propertyList = propertyListReferenceFromRequest(requestParams);
|
|
749
|
+
const referenceError = propertyListReferenceError(requestParams);
|
|
712
750
|
return Object.freeze({
|
|
713
751
|
...account ? { account } : {},
|
|
714
|
-
...propertyList ? { property_list: Object.freeze(propertyList) } : {}
|
|
752
|
+
...propertyList ? { property_list: Object.freeze(propertyList) } : {},
|
|
753
|
+
...referenceError ? { property_list_error: referenceError } : {}
|
|
715
754
|
});
|
|
716
755
|
}
|
|
756
|
+
function propertyListReferenceError(params) {
|
|
757
|
+
if (typeof params.property_list_error === "string") return params.property_list_error;
|
|
758
|
+
const filters = params.filters;
|
|
759
|
+
if (params.property_list !== void 0 && !propertyListReferenceFromRequest({ property_list: params.property_list }))
|
|
760
|
+
return "property_list_invalid_reference";
|
|
761
|
+
if (!filters || typeof filters !== "object" || Array.isArray(filters) || !Object.hasOwn(filters, "property_list") || filters.property_list === void 0)
|
|
762
|
+
return void 0;
|
|
763
|
+
const nested = propertyListReferenceFromRequest(params);
|
|
764
|
+
if (!nested) return "property_list_invalid_reference";
|
|
765
|
+
if (params.property_list !== void 0) {
|
|
766
|
+
const legacy = propertyListReferenceFromRequest({ property_list: params.property_list });
|
|
767
|
+
if (!legacy || nested.agent_url !== legacy.agent_url || nested.list_id !== legacy.list_id || nested.auth_token !== legacy.auth_token) {
|
|
768
|
+
return "property_list_conflicting_references";
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return void 0;
|
|
772
|
+
}
|
|
717
773
|
function hasProductPropertyPolicyRules(policy) {
|
|
718
774
|
return Boolean(
|
|
719
775
|
policy.allowedDomains?.length || policy.allowedPropertyIdentifiers?.length || policy.requireAllowedPropertyMatch || policy.excludedDomains?.length || policy.excludedPropertyIds?.length || policy.strict || policy.unknownSelectorBehavior || policy.missingPublisherPropertiesBehavior
|
|
720
776
|
);
|
|
721
777
|
}
|
|
722
|
-
function comparablePropertyIdentifiers(identifiers) {
|
|
723
|
-
return identifiers.filter((identifier) => identifier.type === "domain" || identifier.type === "subdomain").map((identifier) => ({ type: identifier.type, value: identifier.value }));
|
|
724
|
-
}
|
|
725
778
|
function unsupportedPropertyIdentifiers(identifiers) {
|
|
726
|
-
return identifiers.filter((identifier) =>
|
|
779
|
+
return identifiers.filter((identifier) => !(0, import_property_policy.isSupportedPropertyIdentifierType)(identifier.type)).map((identifier) => ({ type: identifier.type }));
|
|
727
780
|
}
|
|
728
781
|
function sanitizeDiagnosticUrl(value) {
|
|
729
782
|
try {
|
|
@@ -1107,12 +1160,8 @@ class SingleAgentClient {
|
|
|
1107
1160
|
// shared invalidation epoch of that key when the evidence was obtained
|
|
1108
1161
|
sharedEvidenceKey;
|
|
1109
1162
|
// discoveryCache key the local capability cache was obtained under
|
|
1110
|
-
_v2WarningFired = false;
|
|
1111
|
-
// Gate: emit the v2-sunset warning once per client instance
|
|
1112
1163
|
_syntheticV3WarningFired = false;
|
|
1113
1164
|
// Gate: emit the synthetic-v3 warning once per client instance
|
|
1114
|
-
_syntheticV2WarningFired = false;
|
|
1115
|
-
// Gate: emit the synthetic-v2 warning once per client instance
|
|
1116
1165
|
productPolicyRequestParamsByTask = /* @__PURE__ */ new Map();
|
|
1117
1166
|
canonicalCreativeTaskAssociations = /* @__PURE__ */ new Map();
|
|
1118
1167
|
previewCreativeHandlersByTask = /* @__PURE__ */ new Map();
|
|
@@ -1320,8 +1369,17 @@ class SingleAgentClient {
|
|
|
1320
1369
|
}
|
|
1321
1370
|
assertDurablePropertyListCredentialSupported(taskType, requestParams) {
|
|
1322
1371
|
if (!this.config.deferredStorage || taskType !== "get_products") return;
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1372
|
+
const filters = requestParams.filters;
|
|
1373
|
+
const references = [
|
|
1374
|
+
requestParams.property_list,
|
|
1375
|
+
filters && typeof filters === "object" ? filters.property_list : void 0
|
|
1376
|
+
];
|
|
1377
|
+
const hasCredential = references.some((reference) => {
|
|
1378
|
+
if (!reference || typeof reference !== "object") return false;
|
|
1379
|
+
const token = reference.auth_token;
|
|
1380
|
+
return token !== void 0 && token !== null && token !== "";
|
|
1381
|
+
});
|
|
1382
|
+
if (!hasCredential) return;
|
|
1325
1383
|
const policyConfig = this.config.validation?.productPropertyPolicy;
|
|
1326
1384
|
if (policyConfig === false || policyConfig?.enforceRequestPropertyList === false) return;
|
|
1327
1385
|
throw new import_errors.ConfigurationError(
|
|
@@ -1374,7 +1432,7 @@ class SingleAgentClient {
|
|
|
1374
1432
|
}
|
|
1375
1433
|
}
|
|
1376
1434
|
}
|
|
1377
|
-
rememberCanonicalProductRoutes(products, account, authoritativeProducts) {
|
|
1435
|
+
rememberCanonicalProductRoutes(products, account, authoritativeProducts, evidence) {
|
|
1378
1436
|
this.invalidateCanonicalProductRoutes(authoritativeProducts ?? products, account);
|
|
1379
1437
|
const accountScope = this.canonicalAccountScope(account);
|
|
1380
1438
|
const declaredOptions = authoritativeProducts ? this.sellerDeclaredFormatOptions(authoritativeProducts) : void 0;
|
|
@@ -1394,12 +1452,15 @@ class SingleAgentClient {
|
|
|
1394
1452
|
const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
|
|
1395
1453
|
const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
|
|
1396
1454
|
if (declared !== void 0) (0, import_legacy_metadata.rememberSellerDeclaredFormatOption)(option, declared);
|
|
1455
|
+
if (declared === true && evidence)
|
|
1456
|
+
(0, import_legacy_metadata.rememberSellerFormatEvidence)(option, { ...evidence, productId: product.product_id });
|
|
1397
1457
|
this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
|
|
1398
1458
|
kind: "product",
|
|
1399
1459
|
accountScope,
|
|
1400
1460
|
productId: product.product_id,
|
|
1401
1461
|
optionRef: ref,
|
|
1402
1462
|
refs,
|
|
1463
|
+
...declared === true && (0, import_legacy_metadata.sellerFormatEvidence)(option) ? { declaration: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(option) } : {},
|
|
1403
1464
|
...declared === false ? { undeclaredSelector: (0, import_legacy_routes.undeclaredFormatOptionSelector)(option) } : {}
|
|
1404
1465
|
});
|
|
1405
1466
|
}
|
|
@@ -3381,7 +3442,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3381
3442
|
/**
|
|
3382
3443
|
* Execute task and call appropriate handler on completion
|
|
3383
3444
|
*
|
|
3384
|
-
*
|
|
3445
|
+
* Adapts requests for maintained AdCP 3 releases and normalizes product responses.
|
|
3385
3446
|
*/
|
|
3386
3447
|
async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
|
|
3387
3448
|
const requestParamsSnapshot = structuredClone(params);
|
|
@@ -3426,11 +3487,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3426
3487
|
await this.requireSupportedMajor(taskType, options);
|
|
3427
3488
|
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3428
3489
|
}
|
|
3429
|
-
const earlyResult = await this.getEarlyResultForUnsupportedFeatures(taskType, normalizedParams, options);
|
|
3430
|
-
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3431
|
-
if (earlyResult) {
|
|
3432
|
-
return (0, import_match.attachMatch)(earlyResult);
|
|
3433
|
-
}
|
|
3434
3490
|
const agent = await this.ensureEndpointDiscovered(options);
|
|
3435
3491
|
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3436
3492
|
if (!options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation && !options?.preserveGovernedPayload) {
|
|
@@ -3469,11 +3525,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3469
3525
|
capabilityDiscoveryContext.toolSchemas,
|
|
3470
3526
|
capabilityDiscoveryContext.capabilities
|
|
3471
3527
|
);
|
|
3472
|
-
const
|
|
3473
|
-
if (webhookDriftLog)
|
|
3474
|
-
if (serverVersion === "v2") {
|
|
3475
|
-
this.executor.validateAdaptedRequestAgainstV2(taskType, adaptedParams, v25DriftLogs);
|
|
3476
|
-
}
|
|
3528
|
+
const adaptationLogs = [...adaptDriftLogs];
|
|
3529
|
+
if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
|
|
3477
3530
|
const canonicalInputHandler = this.canonicalCreativeInputHandler(
|
|
3478
3531
|
taskType,
|
|
3479
3532
|
inputHandler,
|
|
@@ -3520,7 +3573,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3520
3573
|
);
|
|
3521
3574
|
(0, import_abort2.throwIfAborted)(effectiveOptions?.signal);
|
|
3522
3575
|
if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
|
|
3523
|
-
const postAdapterLogs = [...inputSchemaStripLogs, ...
|
|
3576
|
+
const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
|
|
3524
3577
|
if (postAdapterLogs.length > 0) {
|
|
3525
3578
|
result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
|
|
3526
3579
|
}
|
|
@@ -3616,7 +3669,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3616
3669
|
const rawSubmittedWaitForCompletion = result.submitted?.waitForCompletion;
|
|
3617
3670
|
const finalizerLegacyFormatConverter = legacyFormatConverter ?? this.resolveLegacyFormatConverter(void 0, context.projectionCatalogs);
|
|
3618
3671
|
if (result.success && result.data) {
|
|
3619
|
-
result.data = this.
|
|
3672
|
+
result.data = this.normalizeEstablishedResponse(taskType, result.data);
|
|
3620
3673
|
}
|
|
3621
3674
|
result = this.wrapProductPolicySubmittedContinuation(
|
|
3622
3675
|
result,
|
|
@@ -3762,7 +3815,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3762
3815
|
};
|
|
3763
3816
|
}
|
|
3764
3817
|
projectCanonicalCreativeData(taskType, data, transform, legacyFormatConverter) {
|
|
3765
|
-
let projected = this.
|
|
3818
|
+
let projected = this.normalizeEstablishedResponse(taskType, data);
|
|
3766
3819
|
const record = projected && typeof projected === "object" ? projected : void 0;
|
|
3767
3820
|
const canProjectRead = taskType === "get_products" ? Array.isArray(record?.products) : taskType === "list_creatives" ? Array.isArray(record?.creatives) : true;
|
|
3768
3821
|
if (transform && canProjectRead) {
|
|
@@ -4132,39 +4185,40 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4132
4185
|
message = "Property list not adhered to",
|
|
4133
4186
|
enforceRequestPropertyList = true,
|
|
4134
4187
|
propertyListResolveOptions,
|
|
4188
|
+
resolvePublisherProperties,
|
|
4189
|
+
maxPublisherLookups = 100,
|
|
4190
|
+
publisherLookupTimeoutMs = 1e4,
|
|
4191
|
+
publisherLookupBudgetMs = 1e4,
|
|
4135
4192
|
...explicitPolicy
|
|
4136
4193
|
} = policyConfig || {};
|
|
4137
4194
|
const policy = {
|
|
4138
4195
|
...explicitPolicy
|
|
4139
4196
|
};
|
|
4140
4197
|
let resolvedRequestPropertyList;
|
|
4141
|
-
|
|
4198
|
+
const referenceError = propertyListReferenceError(requestParams);
|
|
4199
|
+
if ((requestPropertyList || referenceError) && enforceRequestPropertyList) {
|
|
4142
4200
|
try {
|
|
4201
|
+
if (referenceError) throw new Error(referenceError);
|
|
4143
4202
|
const resolved = await (0, import_targeting_helpers.resolvePropertyList)(requestPropertyList, propertyListResolveOptions);
|
|
4144
|
-
const comparableIdentifiers = comparablePropertyIdentifiers(resolved.identifiers);
|
|
4145
4203
|
const unsupportedIdentifiers = unsupportedPropertyIdentifiers(resolved.identifiers);
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
}
|
|
4149
|
-
if (comparableIdentifiers.length > 0 || resolved.identifiers.length === 0) {
|
|
4150
|
-
policy.allowedPropertyIdentifiers = [...policy.allowedPropertyIdentifiers ?? [], ...comparableIdentifiers];
|
|
4151
|
-
policy.requireAllowedPropertyMatch = true;
|
|
4152
|
-
}
|
|
4204
|
+
policy.allowedPropertyIdentifiers = [...policy.allowedPropertyIdentifiers ?? [], ...resolved.identifiers];
|
|
4205
|
+
policy.requireAllowedPropertyMatch = true;
|
|
4153
4206
|
policy.strict = policy.strict ?? true;
|
|
4154
4207
|
resolvedRequestPropertyList = {
|
|
4155
4208
|
listId: resolved.listId,
|
|
4156
4209
|
agentUrl: resolved.agentUrl,
|
|
4157
4210
|
identifierCount: resolved.identifiers.length,
|
|
4211
|
+
unsupportedIdentifierTypes: [...new Set(unsupportedIdentifiers.map((identifier) => identifier.type))],
|
|
4158
4212
|
...resolved.cacheValidUntil ? { cacheValidUntil: resolved.cacheValidUntil } : {}
|
|
4159
4213
|
};
|
|
4160
4214
|
} catch (err) {
|
|
4161
4215
|
const errorCode = propertyListResolutionErrorCode(err);
|
|
4162
|
-
const diagnosticAgentUrl = sanitizeDiagnosticUrl(requestPropertyList.agent_url);
|
|
4216
|
+
const diagnosticAgentUrl = requestPropertyList ? sanitizeDiagnosticUrl(requestPropertyList.agent_url) : "invalid_url";
|
|
4163
4217
|
return (0, import_match.attachMatch)({
|
|
4164
4218
|
success: false,
|
|
4165
4219
|
status: "failed",
|
|
4166
4220
|
data: response,
|
|
4167
|
-
error: `${message}: could not resolve property_list
|
|
4221
|
+
error: `${message}: could not resolve property_list`,
|
|
4168
4222
|
metadata: {
|
|
4169
4223
|
...result.metadata,
|
|
4170
4224
|
status: "failed",
|
|
@@ -4177,7 +4231,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4177
4231
|
message,
|
|
4178
4232
|
diagnostics: [],
|
|
4179
4233
|
request_property_list: {
|
|
4180
|
-
list_id: requestPropertyList
|
|
4234
|
+
list_id: requestPropertyList?.list_id ?? "invalid_reference",
|
|
4181
4235
|
agent_url: diagnosticAgentUrl,
|
|
4182
4236
|
resolution_error: errorCode
|
|
4183
4237
|
}
|
|
@@ -4192,7 +4246,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4192
4246
|
mode,
|
|
4193
4247
|
ok: false,
|
|
4194
4248
|
request_property_list: {
|
|
4195
|
-
list_id: requestPropertyList
|
|
4249
|
+
list_id: requestPropertyList?.list_id,
|
|
4196
4250
|
agent_url: diagnosticAgentUrl,
|
|
4197
4251
|
resolution_error: errorCode
|
|
4198
4252
|
}
|
|
@@ -4202,6 +4256,65 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4202
4256
|
}
|
|
4203
4257
|
}
|
|
4204
4258
|
if (!hasProductPropertyPolicyRules(policy)) return result;
|
|
4259
|
+
if (resolvePublisherProperties && policy.allowedPropertyIdentifiers?.some(
|
|
4260
|
+
(identifier) => identifier.type !== "domain" && identifier.type !== "subdomain"
|
|
4261
|
+
)) {
|
|
4262
|
+
if (!Number.isSafeInteger(maxPublisherLookups) || maxPublisherLookups < 1 || !Number.isSafeInteger(publisherLookupTimeoutMs) || publisherLookupTimeoutMs < 1 || publisherLookupTimeoutMs > 2147483647 || !Number.isSafeInteger(publisherLookupBudgetMs) || publisherLookupBudgetMs < 1 || publisherLookupBudgetMs > 2147483647) {
|
|
4263
|
+
throw new import_errors.ConfigurationError("Publisher lookup limits must be positive bounded integers");
|
|
4264
|
+
}
|
|
4265
|
+
const { validatePublisherDomain } = await import("../identifiers.js");
|
|
4266
|
+
const catalogs = Object.assign(
|
|
4267
|
+
/* @__PURE__ */ Object.create(null),
|
|
4268
|
+
policy.publisherProperties
|
|
4269
|
+
);
|
|
4270
|
+
const domains = new Set(
|
|
4271
|
+
response.products.flatMap(
|
|
4272
|
+
(product) => Array.isArray(product.publisher_properties) ? product.publisher_properties.flatMap(
|
|
4273
|
+
(selector) => selector && typeof selector === "object" && "publisher_domain" in selector ? [selector.publisher_domain] : []
|
|
4274
|
+
) : []
|
|
4275
|
+
)
|
|
4276
|
+
);
|
|
4277
|
+
const hosts = [
|
|
4278
|
+
...new Set(
|
|
4279
|
+
[...domains].flatMap(
|
|
4280
|
+
(domain) => typeof domain === "string" ? [(0, import_property_policy.normalizeDomainForPropertyPolicy)(domain)?.host] : []
|
|
4281
|
+
)
|
|
4282
|
+
)
|
|
4283
|
+
].filter((host) => typeof host === "string" && !Object.hasOwn(catalogs, host));
|
|
4284
|
+
for (const host of hosts) catalogs[host] = void 0;
|
|
4285
|
+
const lookupStartedAt = performance.now();
|
|
4286
|
+
for (const host of hosts.slice(0, maxPublisherLookups)) {
|
|
4287
|
+
(0, import_abort2.throwIfAborted)(taskSignal);
|
|
4288
|
+
const remainingBudgetMs = publisherLookupBudgetMs - (performance.now() - lookupStartedAt);
|
|
4289
|
+
if (remainingBudgetMs <= 0) break;
|
|
4290
|
+
if (!validatePublisherDomain(host).ok || (0, import_net.isLikelyPrivateUrl)(`https://${host}`)) continue;
|
|
4291
|
+
const controller = new AbortController();
|
|
4292
|
+
const signal = taskSignal ? AbortSignal.any([taskSignal, controller.signal]) : controller.signal;
|
|
4293
|
+
let timeout;
|
|
4294
|
+
let budgetExpired = false;
|
|
4295
|
+
try {
|
|
4296
|
+
catalogs[host] = await Promise.race([
|
|
4297
|
+
resolvePublisherProperties(host, { signal }),
|
|
4298
|
+
new Promise((_, reject) => {
|
|
4299
|
+
timeout = setTimeout(
|
|
4300
|
+
() => {
|
|
4301
|
+
if (remainingBudgetMs <= publisherLookupTimeoutMs) budgetExpired = true;
|
|
4302
|
+
controller.abort();
|
|
4303
|
+
reject(new Error("publisher_catalog_timeout"));
|
|
4304
|
+
},
|
|
4305
|
+
Math.min(publisherLookupTimeoutMs, remainingBudgetMs)
|
|
4306
|
+
);
|
|
4307
|
+
})
|
|
4308
|
+
]);
|
|
4309
|
+
} catch {
|
|
4310
|
+
catalogs[host] = void 0;
|
|
4311
|
+
} finally {
|
|
4312
|
+
if (timeout) clearTimeout(timeout);
|
|
4313
|
+
}
|
|
4314
|
+
if (budgetExpired) break;
|
|
4315
|
+
}
|
|
4316
|
+
policy.publisherProperties = catalogs;
|
|
4317
|
+
}
|
|
4205
4318
|
let validation;
|
|
4206
4319
|
try {
|
|
4207
4320
|
validation = (0, import_property_policy.validateProductsAgainstPropertyPolicy)({
|
|
@@ -4225,6 +4338,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4225
4338
|
list_id: resolvedRequestPropertyList.listId,
|
|
4226
4339
|
agent_url: sanitizeDiagnosticUrl(resolvedRequestPropertyList.agentUrl),
|
|
4227
4340
|
identifier_count: resolvedRequestPropertyList.identifierCount,
|
|
4341
|
+
unsupported_identifier_types: resolvedRequestPropertyList.unsupportedIdentifierTypes,
|
|
4228
4342
|
...resolvedRequestPropertyList.cacheValidUntil ? { cache_valid_until: resolvedRequestPropertyList.cacheValidUntil } : {}
|
|
4229
4343
|
}
|
|
4230
4344
|
} : {},
|
|
@@ -4374,7 +4488,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4374
4488
|
waitForCompletion: async (pollInterval, signal) => {
|
|
4375
4489
|
let completed = await submitted.waitForCompletion(pollInterval, signal);
|
|
4376
4490
|
if (completed.success && completed.data) {
|
|
4377
|
-
completed.data = this.
|
|
4491
|
+
completed.data = this.normalizeEstablishedResponse(taskType, completed.data);
|
|
4378
4492
|
}
|
|
4379
4493
|
const terminal = completed.status === "completed" || completed.status === "failed";
|
|
4380
4494
|
try {
|
|
@@ -4405,7 +4519,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4405
4519
|
(0, import_match.attachMatch)({
|
|
4406
4520
|
success: true,
|
|
4407
4521
|
status: "completed",
|
|
4408
|
-
data: this.
|
|
4522
|
+
data: this.normalizeEstablishedResponse(taskType, taskInfo.result),
|
|
4409
4523
|
metadata: {
|
|
4410
4524
|
taskId: taskInfo.taskId,
|
|
4411
4525
|
taskName: taskInfo.taskType,
|
|
@@ -4481,8 +4595,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4481
4595
|
}
|
|
4482
4596
|
/**
|
|
4483
4597
|
* Adapt a request for the detected server wire version and the seller's
|
|
4484
|
-
* AdCP protocol version. Applies
|
|
4485
|
-
* to a v2 server, then applies protocol-version adapters (e.g. stripping
|
|
4598
|
+
* AdCP protocol version. Applies protocol-version adapters (e.g. stripping
|
|
4486
4599
|
* 3.1-only fields for a 3.0 seller). Returns the adapted params and any
|
|
4487
4600
|
* drift log entries describing what was changed.
|
|
4488
4601
|
*
|
|
@@ -4490,22 +4603,14 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4490
4603
|
* current call's tool schemas can be supplied without cross-tenant caching.
|
|
4491
4604
|
*/
|
|
4492
4605
|
adaptRequest(taskType, params, serverVersion, debugLogs, perCallToolSchemas, perCallCapabilities) {
|
|
4493
|
-
const driftLogs = [];
|
|
4494
|
-
let adapted = params;
|
|
4495
4606
|
if (serverVersion !== "v3") {
|
|
4496
|
-
|
|
4497
|
-
if (pair) adapted = pair.adaptRequest(adapted);
|
|
4607
|
+
throw new import_errors.VersionUnsupportedError(taskType, "version", "v2", this.agent.agent_uri);
|
|
4498
4608
|
}
|
|
4609
|
+
const driftLogs = [];
|
|
4610
|
+
let adapted = params;
|
|
4499
4611
|
const toolSchema = (perCallToolSchemas ?? this.cachedToolSchemas)?.get(taskType);
|
|
4500
4612
|
if (toolSchema && Object.keys(toolSchema).length > 0) {
|
|
4501
4613
|
const declaredFields = new Set(Object.keys(toolSchema));
|
|
4502
|
-
const adapterAliases = [["brand_manifest", "brand"]];
|
|
4503
|
-
for (const [adapterField, schemaField] of adapterAliases) {
|
|
4504
|
-
if (adapted[adapterField] !== void 0 && !declaredFields.has(adapterField) && declaredFields.has(schemaField) && adapted[schemaField] === void 0 && valueMatchesSchemaType(adapted[adapterField], toolSchema[schemaField])) {
|
|
4505
|
-
adapted[schemaField] = adapted[adapterField];
|
|
4506
|
-
delete adapted[adapterField];
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
4614
|
const envelopeFields = import_adcp.ADCP_ENVELOPE_FIELDS;
|
|
4510
4615
|
const filtered = {};
|
|
4511
4616
|
const schemaStripped = [];
|
|
@@ -4553,67 +4658,19 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4553
4658
|
}
|
|
4554
4659
|
return { params: adapted, driftLogs };
|
|
4555
4660
|
}
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
*
|
|
4569
|
-
* Returns an early empty result if the request requires v3 features
|
|
4570
|
-
* that the server doesn't support. This treats "products matching unsupported
|
|
4571
|
-
* capability" as an empty result set rather than an error.
|
|
4572
|
-
*
|
|
4573
|
-
* @returns TaskResult with empty data if v3 features are unsupported, null to proceed normally
|
|
4574
|
-
*/
|
|
4575
|
-
async getEarlyResultForUnsupportedFeatures(taskType, params, options) {
|
|
4576
|
-
if (taskType !== "get_products") {
|
|
4577
|
-
return null;
|
|
4578
|
-
}
|
|
4579
|
-
const capabilities = await this.getCapabilities(options);
|
|
4580
|
-
if (capabilities.version === "v3") {
|
|
4581
|
-
return null;
|
|
4582
|
-
}
|
|
4583
|
-
const usesUnsupportedFeature = (
|
|
4584
|
-
// required_features: content_standards requires contentStandards
|
|
4585
|
-
params.filters?.required_features?.includes("content_standards") && !capabilities.features.contentStandards
|
|
4586
|
-
);
|
|
4587
|
-
if (!usesUnsupportedFeature) {
|
|
4588
|
-
return null;
|
|
4661
|
+
normalizeEstablishedResponse(taskType, data) {
|
|
4662
|
+
if (!data) return data;
|
|
4663
|
+
switch (taskType) {
|
|
4664
|
+
case "get_products":
|
|
4665
|
+
return (0, import_pricing_adapter.normalizeGetProductsResponse)(data);
|
|
4666
|
+
case "create_media_buy":
|
|
4667
|
+
case "update_media_buy":
|
|
4668
|
+
return (0, import_creative_adapter.normalizeMediaBuyResponse)(data);
|
|
4669
|
+
case "list_creative_formats":
|
|
4670
|
+
return (0, import_format_renders.normalizeFormatsResponse)(data);
|
|
4671
|
+
default:
|
|
4672
|
+
return data;
|
|
4589
4673
|
}
|
|
4590
|
-
console.warn(
|
|
4591
|
-
`[AdCP] v3-only features not supported by server "${this.agent.id}" (${capabilities.version}). Returning empty results.`
|
|
4592
|
-
);
|
|
4593
|
-
const emptyResponse = {
|
|
4594
|
-
products: [],
|
|
4595
|
-
property_list_applied: false
|
|
4596
|
-
};
|
|
4597
|
-
return {
|
|
4598
|
-
success: true,
|
|
4599
|
-
status: "completed",
|
|
4600
|
-
data: emptyResponse,
|
|
4601
|
-
metadata: {
|
|
4602
|
-
taskId: `early_${Date.now()}`,
|
|
4603
|
-
taskName: taskType,
|
|
4604
|
-
agent: {
|
|
4605
|
-
id: this.agent.id,
|
|
4606
|
-
name: this.agent.name,
|
|
4607
|
-
protocol: this.normalizedAgent.protocol
|
|
4608
|
-
},
|
|
4609
|
-
responseTimeMs: 0,
|
|
4610
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4611
|
-
clarificationRounds: 0,
|
|
4612
|
-
status: "completed",
|
|
4613
|
-
serverVersion: capabilities.version,
|
|
4614
|
-
serverVersionSynthetic: capabilities._synthetic
|
|
4615
|
-
}
|
|
4616
|
-
};
|
|
4617
4674
|
}
|
|
4618
4675
|
// ====== MEDIA BUY TASKS ======
|
|
4619
4676
|
/**
|
|
@@ -4713,6 +4770,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4713
4770
|
}
|
|
4714
4771
|
}
|
|
4715
4772
|
const conditionalSnapshot = skipCacheRead ? void 0 : cache?.read(cacheScope, cacheParams, true);
|
|
4773
|
+
const productEvidence = this.usesScopedDiscoveryTransport(
|
|
4774
|
+
effectiveOptions
|
|
4775
|
+
) ? void 0 : {
|
|
4776
|
+
scopeKey: this.getCapabilityEvidenceScope().scopeKey,
|
|
4777
|
+
accountScope: this.canonicalAccountScope(account),
|
|
4778
|
+
expiresAt: Date.now() + (0, import_agent_discovery_cache.resolveAgentDiscoveryTtlMs)(this.config.discoveryCache?.ttlMs)
|
|
4779
|
+
};
|
|
4716
4780
|
const result = await this.executeAndHandle(
|
|
4717
4781
|
"get_products",
|
|
4718
4782
|
"onGetProductsStatusChange",
|
|
@@ -4725,7 +4789,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4725
4789
|
projectionCatalogs: projectionCatalogs ?? this.config.projectionCatalogs
|
|
4726
4790
|
});
|
|
4727
4791
|
const authoritativeProducts = Array.isArray(data.products) ? data.products : response.products;
|
|
4728
|
-
this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts);
|
|
4792
|
+
this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts, productEvidence);
|
|
4729
4793
|
const { _message: _dropLegacyMessage, ...canonical } = response;
|
|
4730
4794
|
void _dropLegacyMessage;
|
|
4731
4795
|
return { ...canonical, projection: { diagnostics } };
|
|
@@ -4736,7 +4800,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4736
4800
|
);
|
|
4737
4801
|
const finishCache = async (completed) => {
|
|
4738
4802
|
if (!cache) return completed;
|
|
4739
|
-
const cachedResult = cache.write(cacheScope, cacheParams, completed, conditionalSnapshot)
|
|
4803
|
+
const cachedResult = cache.write(cacheScope, cacheParams, completed, conditionalSnapshot, (materialized) => {
|
|
4804
|
+
this.rememberCanonicalProductRoutes(materialized.data?.products ?? [], account, void 0, productEvidence);
|
|
4805
|
+
});
|
|
4740
4806
|
if (cachedResult.success && cachedResult.status === "completed") {
|
|
4741
4807
|
if (!skipCacheRead && cacheParams.if_wholesale_feed_version === void 0 && cacheParams.if_pricing_version === void 0 && cachedResult.data.unchanged === true) {
|
|
4742
4808
|
return this.getProducts(params, inputHandler, {
|
|
@@ -4914,7 +4980,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4914
4980
|
if (hasCreativeFormatData) {
|
|
4915
4981
|
this.validateBeforeCreativeCapabilityProbe("create_media_buy", params, taskOptions);
|
|
4916
4982
|
}
|
|
4917
|
-
const wireMode = hasCreativeFormatData ? await this.
|
|
4983
|
+
const wireMode = hasCreativeFormatData ? await this.resolveCreativeWireMode(
|
|
4984
|
+
"create_media_buy",
|
|
4985
|
+
taskOptions,
|
|
4986
|
+
true,
|
|
4987
|
+
() => this.productOptionsSupportCanonicalWire("create_media_buy", params, [], options)
|
|
4988
|
+
) : "canonical";
|
|
4918
4989
|
const wireParams = params;
|
|
4919
4990
|
const result = await this.executeAndHandle(
|
|
4920
4991
|
"create_media_buy",
|
|
@@ -5002,7 +5073,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5002
5073
|
if (hasCreativeFormatData) {
|
|
5003
5074
|
this.validateBeforeCreativeCapabilityProbe("update_media_buy", params, taskOptions);
|
|
5004
5075
|
}
|
|
5005
|
-
const wireMode = hasCreativeFormatData ? await this.
|
|
5076
|
+
const wireMode = hasCreativeFormatData ? await this.resolveCreativeWireMode(
|
|
5077
|
+
"update_media_buy",
|
|
5078
|
+
taskOptions,
|
|
5079
|
+
true,
|
|
5080
|
+
() => this.productOptionsSupportCanonicalWire("update_media_buy", params, [], options)
|
|
5081
|
+
) : "canonical";
|
|
5006
5082
|
const result = await this.executeAndHandle(
|
|
5007
5083
|
"update_media_buy",
|
|
5008
5084
|
"onUpdateMediaBuyStatusChange",
|
|
@@ -5091,7 +5167,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5091
5167
|
projectionCatalogs ?? this.config.projectionCatalogs
|
|
5092
5168
|
);
|
|
5093
5169
|
this.validateBeforeCreativeCapabilityProbe("sync_creatives", params, taskOptions);
|
|
5094
|
-
const wireMode = await this.resolveCreativeFormatWireMode("sync_creatives", taskOptions);
|
|
5095
5170
|
const configuredSelectorContainers = [
|
|
5096
5171
|
...creativeFormatProjection?.selectorContainers ?? []
|
|
5097
5172
|
];
|
|
@@ -5103,10 +5178,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5103
5178
|
const assignmentPackageContainers = Array.isArray(params.assignments) ? params.assignments.flatMap(
|
|
5104
5179
|
(assignment) => typeof assignment.package_id === "string" && !configuredPackageIds.has(assignment.package_id) ? [{ package_id: assignment.package_id }] : []
|
|
5105
5180
|
) : [];
|
|
5181
|
+
const selectorContainers = [...configuredSelectorContainers, ...assignmentPackageContainers];
|
|
5182
|
+
const wireMode = await this.resolveCreativeWireMode(
|
|
5183
|
+
"sync_creatives",
|
|
5184
|
+
taskOptions,
|
|
5185
|
+
true,
|
|
5186
|
+
() => this.productOptionsSupportCanonicalWire("sync_creatives", params, selectorContainers, options)
|
|
5187
|
+
);
|
|
5106
5188
|
const wireParams = this.projectUndeclaredFormatOptions(
|
|
5107
5189
|
(0, import_creative_delivery.projectSyncCreativesForDelivery)(
|
|
5108
5190
|
params,
|
|
5109
|
-
|
|
5191
|
+
selectorContainers,
|
|
5110
5192
|
wireMode,
|
|
5111
5193
|
effectiveLegacyFormatConverter,
|
|
5112
5194
|
effectiveCanonicalFormatLegacyResolver
|
|
@@ -5146,16 +5228,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5146
5228
|
* sending a mutation. Discovers capabilities and the current tool's input
|
|
5147
5229
|
* schema, or reuses fresh cached/primed evidence, with this client's wire pin.
|
|
5148
5230
|
*
|
|
5149
|
-
* `unknown`
|
|
5150
|
-
*
|
|
5151
|
-
*
|
|
5231
|
+
* This context-free check returns `unknown` when capabilities and schema do
|
|
5232
|
+
* not establish support. A write to a proven 3.1 seller can still select
|
|
5233
|
+
* canonical delivery from matching seller-advertised product options;
|
|
5234
|
+
* otherwise projection requires an unambiguous legacy reference.
|
|
5152
5235
|
* Conflicting evidence and unproven support with a 3.2+ buyer pin throw
|
|
5153
5236
|
* `CreativeFormatCapabilityError`, just as they do during a write.
|
|
5154
5237
|
*/
|
|
5155
5238
|
async resolveCreativeFormatWireMode(taskType, options) {
|
|
5156
5239
|
return this.resolveCreativeWireMode(taskType, options, true);
|
|
5157
5240
|
}
|
|
5158
|
-
async resolveCreativeWireMode(taskType, options, canRediscover) {
|
|
5241
|
+
async resolveCreativeWireMode(taskType, options, canRediscover, matchingProductOptions) {
|
|
5159
5242
|
const discoveryContext = {};
|
|
5160
5243
|
const capabilities = await this.getCapabilities({
|
|
5161
5244
|
...options,
|
|
@@ -5174,13 +5257,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5174
5257
|
`Seller capability and ${taskType} input schema disagree about canonical creative support`
|
|
5175
5258
|
);
|
|
5176
5259
|
}
|
|
5177
|
-
|
|
5260
|
+
let resolved = declared !== "unknown" ? declared : schema;
|
|
5261
|
+
if (resolved === "unknown" && (0, import_creative_delivery.canUseProductOptionsForCreativeWire)(capabilities, wireRelease) && matchingProductOptions?.()) {
|
|
5262
|
+
resolved = "canonical";
|
|
5263
|
+
}
|
|
5178
5264
|
const release = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(wireRelease.trim());
|
|
5179
5265
|
const canonicalRequiredByBuyerPin = release !== null && (Number(release[1]) > 3 || Number(release[1]) === 3 && Number(release[2]) >= 2);
|
|
5180
5266
|
if (resolved === "unknown" && canonicalRequiredByBuyerPin) {
|
|
5181
5267
|
if (canRediscover && !usesScopedFetch && this.normalizedAgent.protocol === "mcp" && this.capabilitiesFromSharedCache && toolSchemas?.has(taskType) && !toolInputSchemasByProperties.has(toolSchemas)) {
|
|
5182
5268
|
await this.invalidateDiscoveryCache(options);
|
|
5183
|
-
return this.resolveCreativeWireMode(taskType, options, false);
|
|
5269
|
+
return this.resolveCreativeWireMode(taskType, options, false, matchingProductOptions);
|
|
5184
5270
|
}
|
|
5185
5271
|
throw new import_creative_delivery.CreativeFormatCapabilityError(
|
|
5186
5272
|
`Cannot prove which AdCP release the seller serves for ${taskType}; a 3.2+ client will not guess a legacy creative wire shape`
|
|
@@ -5188,6 +5274,112 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5188
5274
|
}
|
|
5189
5275
|
return resolved;
|
|
5190
5276
|
}
|
|
5277
|
+
/** Product evidence applies to this request only; it must never prime a tool-wide capability. */
|
|
5278
|
+
productOptionsSupportCanonicalWire(taskType, request, selectorContainers = [], options) {
|
|
5279
|
+
if (!isPlainRecord(request) || this.usesScopedDiscoveryTransport(options)) return false;
|
|
5280
|
+
const scopeKey = this.getCapabilityEvidenceScope().scopeKey;
|
|
5281
|
+
const accountScope = this.canonicalAccountScope(request.account);
|
|
5282
|
+
const optionRef = (value) => {
|
|
5283
|
+
if (!isPlainRecord(value) || typeof value.format_option_id !== "string" || !value.format_option_id) {
|
|
5284
|
+
return void 0;
|
|
5285
|
+
}
|
|
5286
|
+
if (typeof value.publisher_domain === "string") {
|
|
5287
|
+
return {
|
|
5288
|
+
scope: "publisher",
|
|
5289
|
+
publisher_domain: value.publisher_domain,
|
|
5290
|
+
format_option_id: value.format_option_id
|
|
5291
|
+
};
|
|
5292
|
+
}
|
|
5293
|
+
if (value.scope !== void 0 && value.scope !== "product") return void 0;
|
|
5294
|
+
return { scope: "product", format_option_id: value.format_option_id };
|
|
5295
|
+
};
|
|
5296
|
+
const accepts = (container, creative, depth = 0) => {
|
|
5297
|
+
if (depth > 32) return false;
|
|
5298
|
+
if (Array.isArray(container.selector_containers)) {
|
|
5299
|
+
return container.selector_containers.length > 0 && container.selector_containers.every((nested) => accepts(nested, creative, depth + 1));
|
|
5300
|
+
}
|
|
5301
|
+
const refs = Array.isArray(container.format_option_refs) ? container.format_option_refs.map(optionRef) : [];
|
|
5302
|
+
if (refs.some((ref) => ref === void 0)) return false;
|
|
5303
|
+
const creativeRef = isPlainRecord(creative) ? optionRef(creative.format_option_ref) : void 0;
|
|
5304
|
+
if (isPlainRecord(creative) && creative.format_option_ref !== void 0 && !creativeRef) return false;
|
|
5305
|
+
const isSellerDeclaration = (value) => {
|
|
5306
|
+
if (!isPlainRecord(value) || (0, import_legacy_metadata.sellerDeclaredFormatOption)(value) !== true || (0, import_legacy_metadata.isSynthesizedFormatOption)(value)) {
|
|
5307
|
+
return false;
|
|
5308
|
+
}
|
|
5309
|
+
const evidence2 = (0, import_legacy_metadata.sellerFormatEvidence)(value);
|
|
5310
|
+
if (!evidence2 || evidence2.scopeKey !== scopeKey || typeof container.product_id === "string" && evidence2.productId !== container.product_id || evidence2.expiresAt <= Date.now() || evidence2.accountScope !== accountScope && evidence2.accountScope !== "none")
|
|
5311
|
+
return false;
|
|
5312
|
+
const ref = optionRef(value);
|
|
5313
|
+
if (ref && (0, import_legacy_routes.formatOptionOriginFromRoutes)(
|
|
5314
|
+
options?.canonicalFormatLegacyResolver,
|
|
5315
|
+
ref,
|
|
5316
|
+
typeof container.product_id === "string" ? container.product_id : void 0
|
|
5317
|
+
)?.seller_declared === false)
|
|
5318
|
+
return false;
|
|
5319
|
+
return !ref || typeof container.product_id !== "string" || this.cachedFormatOptionOrigin(request.account, ref, container.product_id)?.seller_declared !== false;
|
|
5320
|
+
};
|
|
5321
|
+
const declarations = [
|
|
5322
|
+
...(Array.isArray(container.format_options) ? container.format_options : []).filter(isSellerDeclaration),
|
|
5323
|
+
...(0, import_legacy_metadata.selectedFormatOptions)(container).filter(isSellerDeclaration)
|
|
5324
|
+
];
|
|
5325
|
+
if (typeof container.product_id === "string") {
|
|
5326
|
+
for (const ref of [...refs, ...creativeRef ? [creativeRef] : []]) {
|
|
5327
|
+
if (!ref) continue;
|
|
5328
|
+
const route = this.routeForOption(request.account, container.product_id, ref);
|
|
5329
|
+
if (route?.kind === "product" && route.declaration && isSellerDeclaration(route.declaration))
|
|
5330
|
+
declarations.push(route.declaration);
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
const available = declarations.filter((declaration) => declaration.experimental !== true);
|
|
5334
|
+
const matchesRef = (declaration, ref) => {
|
|
5335
|
+
const declaredRef = optionRef(declaration);
|
|
5336
|
+
return declaredRef !== void 0 && (0, import_legacy_routes.sameFormatOptionRef)(declaredRef, ref);
|
|
5337
|
+
};
|
|
5338
|
+
if (!refs.every((ref) => available.some((declaration) => matchesRef(declaration, ref)))) return false;
|
|
5339
|
+
const selected = available.filter(
|
|
5340
|
+
(declaration) => refs.length === 0 || refs.some((ref) => matchesRef(declaration, ref))
|
|
5341
|
+
);
|
|
5342
|
+
if (creative === void 0) return refs.length > 0 && selected.length > 0;
|
|
5343
|
+
if (!isPlainRecord(creative) || typeof creative.format_kind !== "string" || creative.format_id !== void 0)
|
|
5344
|
+
return false;
|
|
5345
|
+
return selected.some(
|
|
5346
|
+
(declaration) => declaration.format_kind === creative.format_kind && (!creativeRef || matchesRef(declaration, creativeRef)) && creativeMatchesProductOption(creative, declaration)
|
|
5347
|
+
);
|
|
5348
|
+
};
|
|
5349
|
+
if (taskType === "sync_creatives") {
|
|
5350
|
+
if (!Array.isArray(request.creatives) || request.creatives.length === 0) return false;
|
|
5351
|
+
const creatives = request.creatives;
|
|
5352
|
+
const assignments = Array.isArray(request.assignments) ? request.assignments : [];
|
|
5353
|
+
if (!assignments.every(
|
|
5354
|
+
(value) => isPlainRecord(value) && typeof value.package_id === "string" && typeof value.creative_id === "string" && creatives.some((creative) => isPlainRecord(creative) && creative.creative_id === value.creative_id)
|
|
5355
|
+
))
|
|
5356
|
+
return false;
|
|
5357
|
+
return creatives.every((creative) => {
|
|
5358
|
+
if (!isPlainRecord(creative)) return false;
|
|
5359
|
+
const assigned = new Set(
|
|
5360
|
+
assignments.flatMap(
|
|
5361
|
+
(value) => isPlainRecord(value) && value.creative_id === creative.creative_id && typeof value.package_id === "string" ? [value.package_id] : []
|
|
5362
|
+
)
|
|
5363
|
+
);
|
|
5364
|
+
const relevant = assigned.size === 0 ? selectorContainers : selectorContainers.filter(
|
|
5365
|
+
(container) => typeof container.package_id === "string" && assigned.has(container.package_id)
|
|
5366
|
+
);
|
|
5367
|
+
return relevant.length > 0 && [...assigned].every((id) => relevant.some((container) => container.package_id === id)) && relevant.every((container) => accepts(container, creative));
|
|
5368
|
+
});
|
|
5369
|
+
}
|
|
5370
|
+
const packages = ["packages", "new_packages"].flatMap((key) => Array.isArray(request[key]) ? request[key] : []);
|
|
5371
|
+
let evidence = false;
|
|
5372
|
+
return packages.length > 0 && packages.every((pkg) => {
|
|
5373
|
+
if (!isPlainRecord(pkg)) return false;
|
|
5374
|
+
const creatives = Array.isArray(pkg.creatives) ? pkg.creatives : [];
|
|
5375
|
+
const hasSelectors = Array.isArray(pkg.format_option_refs) && pkg.format_option_refs.length > 0;
|
|
5376
|
+
if (!hasSelectors && creatives.length === 0) {
|
|
5377
|
+
return pkg.format_kind === void 0 && pkg.format_ids === void 0;
|
|
5378
|
+
}
|
|
5379
|
+
evidence = true;
|
|
5380
|
+
return (!hasSelectors || accepts(pkg)) && creatives.every((creative) => accepts(pkg, creative));
|
|
5381
|
+
}) && evidence;
|
|
5382
|
+
}
|
|
5191
5383
|
/** Validate malformed creative payloads before capability discovery can perform I/O. */
|
|
5192
5384
|
validateBeforeCreativeCapabilityProbe(taskType, params, options) {
|
|
5193
5385
|
if (options.skipIdempotencyAutoInject || options.skipAccountValidation || options.skipRequestValidation) return;
|
|
@@ -6096,11 +6288,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6096
6288
|
capabilityDiscoveryContext.toolSchemas,
|
|
6097
6289
|
capabilityDiscoveryContext.capabilities
|
|
6098
6290
|
);
|
|
6099
|
-
const
|
|
6100
|
-
if (webhookDriftLog)
|
|
6101
|
-
if (serverVersion === "v2") {
|
|
6102
|
-
this.executor.validateAdaptedRequestAgainstV2(taskName, adaptedParams, v25DriftLogs);
|
|
6103
|
-
}
|
|
6291
|
+
const adaptationLogs = [...adaptDriftLogs];
|
|
6292
|
+
if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
|
|
6104
6293
|
const deferredClientContext = {
|
|
6105
6294
|
kind: "single-agent",
|
|
6106
6295
|
taskType: taskName,
|
|
@@ -6130,7 +6319,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6130
6319
|
deferredClientContext
|
|
6131
6320
|
);
|
|
6132
6321
|
if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
|
|
6133
|
-
const postAdapterLogs = [...inputSchemaStripLogs, ...
|
|
6322
|
+
const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
|
|
6134
6323
|
if (postAdapterLogs.length > 0) {
|
|
6135
6324
|
result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
|
|
6136
6325
|
}
|
|
@@ -6320,6 +6509,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6320
6509
|
getProtocol() {
|
|
6321
6510
|
return this.normalizedAgent.protocol;
|
|
6322
6511
|
}
|
|
6512
|
+
/** Resolved MCP endpoint already used by this client; never performs discovery. */
|
|
6513
|
+
getDiscoveredMcpEndpoint() {
|
|
6514
|
+
return this.discoveredEndpoint;
|
|
6515
|
+
}
|
|
6323
6516
|
/**
|
|
6324
6517
|
* Get the canonical base URL for this agent
|
|
6325
6518
|
*
|
|
@@ -6821,7 +7014,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6821
7014
|
* Get agent capabilities, including AdCP version support
|
|
6822
7015
|
*
|
|
6823
7016
|
* For v3 servers, calls get_adcp_capabilities tool.
|
|
6824
|
-
*
|
|
7017
|
+
* Requires AdCP 3 capability discovery; retired AdCP 2 agents are rejected.
|
|
6825
7018
|
*
|
|
6826
7019
|
* @returns Promise resolving to normalized capabilities object
|
|
6827
7020
|
*
|
|
@@ -6858,7 +7051,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6858
7051
|
}
|
|
6859
7052
|
if (!usesScopedFetch && this.cachedCapabilities) {
|
|
6860
7053
|
if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
|
|
6861
|
-
this.
|
|
7054
|
+
this.assertSupportedServer(this.cachedCapabilities);
|
|
6862
7055
|
return this.cachedCapabilities;
|
|
6863
7056
|
}
|
|
6864
7057
|
if (!usesScopedFetch && this.config.discoveryCache) {
|
|
@@ -6942,7 +7135,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6942
7135
|
this.capabilitiesFromSharedCache = true;
|
|
6943
7136
|
this.recordSharedEvidence(key);
|
|
6944
7137
|
if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
|
|
6945
|
-
this.
|
|
7138
|
+
this.assertSupportedServer(installed);
|
|
6946
7139
|
return installed;
|
|
6947
7140
|
}
|
|
6948
7141
|
async discoverCapabilitiesLive(options, usesScopedFetch, discoveryContext) {
|
|
@@ -6992,16 +7185,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6992
7185
|
throw (0, import_abort2.createTimeoutError)(requestTimeoutMs);
|
|
6993
7186
|
}
|
|
6994
7187
|
if (result.success && result.data) {
|
|
6995
|
-
const
|
|
7188
|
+
const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
|
|
7189
|
+
this.assertSupportedServer(capabilities);
|
|
6996
7190
|
if (!usesScopedFetch && !superseded()) {
|
|
6997
|
-
this.cachedCapabilities =
|
|
7191
|
+
this.cachedCapabilities = capabilities;
|
|
6998
7192
|
this.capabilitiesFromSharedCache = false;
|
|
6999
|
-
if (!
|
|
7193
|
+
if (!capabilities._synthetic && this.config.discoveryCache) {
|
|
7000
7194
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7001
7195
|
const stored = await this.writeSharedDiscovery(
|
|
7002
7196
|
options,
|
|
7003
7197
|
{
|
|
7004
|
-
capabilities: structuredClone(
|
|
7198
|
+
capabilities: structuredClone(capabilities),
|
|
7005
7199
|
toolSchemas: Object.fromEntries(discoveredToolSchemas),
|
|
7006
7200
|
toolInputSchemas: Object.fromEntries(discoveredInputSchemas)
|
|
7007
7201
|
},
|
|
@@ -7009,7 +7203,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7009
7203
|
startedAtEpoch
|
|
7010
7204
|
);
|
|
7011
7205
|
if (superseded()) {
|
|
7012
|
-
if (this.cachedCapabilities ===
|
|
7206
|
+
if (this.cachedCapabilities === capabilities) {
|
|
7013
7207
|
this.cachedCapabilities = void 0;
|
|
7014
7208
|
this.cachedToolSchemas = void 0;
|
|
7015
7209
|
this.primedCapabilitiesExpiresAt = void 0;
|
|
@@ -7019,31 +7213,26 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7019
7213
|
}
|
|
7020
7214
|
}
|
|
7021
7215
|
}
|
|
7022
|
-
this.
|
|
7023
|
-
return
|
|
7216
|
+
this.assertSupportedServer(capabilities);
|
|
7217
|
+
return capabilities;
|
|
7024
7218
|
}
|
|
7025
7219
|
if (!advertisesCapabilitiesTool) {
|
|
7026
7220
|
throw new Error("unadvertised official A2A capability probe was not supported");
|
|
7027
7221
|
}
|
|
7028
7222
|
if (result.data && (0, import_capabilities.looksLikeV3Capabilities)(result.data)) {
|
|
7223
|
+
const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
|
|
7224
|
+
this.assertSupportedServer(capabilities);
|
|
7029
7225
|
console.warn(
|
|
7030
7226
|
`[AdCP] Agent "${this.agent.id}" returned a get_adcp_capabilities response that failed validation, but the response is structurally v3-shaped. Treating as v3 (the agent has a wire-shape bug \u2014 that's the thing to fix).`,
|
|
7031
7227
|
{ hasError: !!result.error, hasData: !!result.data }
|
|
7032
7228
|
);
|
|
7033
|
-
const parsed = (0, import_capabilities.parseCapabilitiesResponse)(result.data);
|
|
7034
|
-
const v3Capabilities = {
|
|
7035
|
-
...parsed,
|
|
7036
|
-
version: "v3",
|
|
7037
|
-
majorVersions: parsed.majorVersions.includes(3) ? parsed.majorVersions : [3]
|
|
7038
|
-
};
|
|
7039
|
-
const capabilities2 = (0, import_capabilities.augmentCapabilitiesFromTools)(v3Capabilities, tools);
|
|
7040
7229
|
if (!usesScopedFetch && !superseded()) {
|
|
7041
|
-
this.cachedCapabilities =
|
|
7230
|
+
this.cachedCapabilities = capabilities;
|
|
7042
7231
|
this.capabilitiesFromSharedCache = false;
|
|
7043
7232
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7044
7233
|
}
|
|
7045
|
-
this.
|
|
7046
|
-
return
|
|
7234
|
+
this.assertSupportedServer(capabilities);
|
|
7235
|
+
return capabilities;
|
|
7047
7236
|
}
|
|
7048
7237
|
console.warn(
|
|
7049
7238
|
`[AdCP] Agent "${this.agent.id}" advertises get_adcp_capabilities but the call returned non-success and the response is not v3-shaped \u2014 treating as v3 (synthetic) since the agent has the v3-only discovery tool. This client routes to v3 adapters, but calls reading capability details (idempotency TTL, supported_versions, feature flags) will fail until the agent operator fixes the capabilities endpoint.`,
|
|
@@ -7054,7 +7243,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7054
7243
|
}
|
|
7055
7244
|
);
|
|
7056
7245
|
} catch (error) {
|
|
7057
|
-
if (error instanceof import_errors.AuthenticationRequiredError || error instanceof import_errors.ConfigurationError || error instanceof import_errors.TaskTimeoutError || (0, import_abort.isAbortOrTimeoutError)(error)) {
|
|
7246
|
+
if (error instanceof import_errors.AuthenticationRequiredError || error instanceof import_errors.VersionUnsupportedError || error instanceof import_errors.ConfigurationError || error instanceof import_errors.TaskTimeoutError || (0, import_abort.isAbortOrTimeoutError)(error)) {
|
|
7058
7247
|
throw error;
|
|
7059
7248
|
}
|
|
7060
7249
|
if (advertisesCapabilitiesTool) {
|
|
@@ -7064,26 +7253,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7064
7253
|
}
|
|
7065
7254
|
}
|
|
7066
7255
|
if (advertisesCapabilitiesTool) {
|
|
7067
|
-
const
|
|
7256
|
+
const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.buildSyntheticV3Capabilities)(tools), tools);
|
|
7068
7257
|
if (!usesScopedFetch && !superseded()) {
|
|
7069
|
-
this.cachedCapabilities =
|
|
7258
|
+
this.cachedCapabilities = capabilities;
|
|
7070
7259
|
this.capabilitiesFromSharedCache = false;
|
|
7071
7260
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7072
7261
|
}
|
|
7073
|
-
this.
|
|
7074
|
-
return
|
|
7262
|
+
this.assertSupportedServer(capabilities);
|
|
7263
|
+
return capabilities;
|
|
7075
7264
|
}
|
|
7076
7265
|
}
|
|
7077
|
-
|
|
7078
|
-
`[AdCP] Agent "${this.agent.id}" detected as v2 (no get_adcp_capabilities tool). Tools: [${tools.map((t) => t.name).join(", ")}]`
|
|
7079
|
-
);
|
|
7080
|
-
const capabilities = (0, import_capabilities.buildSyntheticCapabilities)(tools);
|
|
7081
|
-
if (!usesScopedFetch && !superseded()) {
|
|
7082
|
-
this.cachedCapabilities = capabilities;
|
|
7083
|
-
this.capabilitiesFromSharedCache = false;
|
|
7084
|
-
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7085
|
-
}
|
|
7086
|
-
return capabilities;
|
|
7266
|
+
throw new import_errors.VersionUnsupportedError("get_adcp_capabilities", "synthetic", "v2", this.agent.agent_uri);
|
|
7087
7267
|
}
|
|
7088
7268
|
/**
|
|
7089
7269
|
* Return the client-bound scope required by {@link primeCapabilities}.
|
|
@@ -7598,28 +7778,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7598
7778
|
if (!this.config.discoveryCache || !code || !CAPABILITY_STALE_ERROR_CODES.has(code)) return;
|
|
7599
7779
|
await this.invalidateDiscoveryCache(options);
|
|
7600
7780
|
}
|
|
7601
|
-
/**
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
* against an unsupported agent should hear about it loudly.
|
|
7607
|
-
*
|
|
7608
|
-
* Synthetic capabilities (no `get_adcp_capabilities` tool available) don't
|
|
7609
|
-
* trigger the warning — we don't actually know the agent's version, and
|
|
7610
|
-
* shouting at legitimately-unversioned agents would be noise.
|
|
7611
|
-
*
|
|
7612
|
-
* Suppression: `process.env.ADCP_ALLOW_V2 === '1'`.
|
|
7613
|
-
*/
|
|
7614
|
-
maybeWarnV2Sunset(capabilities) {
|
|
7615
|
-
if (this._v2WarningFired) return;
|
|
7616
|
-
if (capabilities.version === "v3") return;
|
|
7617
|
-
if (capabilities._synthetic) return;
|
|
7618
|
-
if (process.env.ADCP_ALLOW_V2 === "1") return;
|
|
7619
|
-
this._v2WarningFired = true;
|
|
7620
|
-
console.warn(
|
|
7621
|
-
`[adcp] Warning: agent ${this.agent.agent_uri} reports v2 capabilities. v2 went unsupported on 2026-04-20 (AdCP 3.0 GA). Upgrade the agent to v3 or set ADCP_ALLOW_V2=1 to suppress this warning. See https://github.com/adcontextprotocol/adcp/issues/2220`
|
|
7622
|
-
);
|
|
7781
|
+
/** Reject retired protocol generations before caching or dispatching. */
|
|
7782
|
+
assertSupportedServer(capabilities) {
|
|
7783
|
+
if (capabilities.version !== "v3" || !capabilities.majorVersions.includes(3)) {
|
|
7784
|
+
throw new import_errors.VersionUnsupportedError("get_adcp_capabilities", "version", capabilities.version, this.agent.agent_uri);
|
|
7785
|
+
}
|
|
7623
7786
|
}
|
|
7624
7787
|
/**
|
|
7625
7788
|
* Warn once per client when `requireSupportedMajor` accepts synthetic v3
|
|
@@ -7640,24 +7803,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7640
7803
|
`[adcp] Warning: agent ${this.agent.agent_uri} advertises get_adcp_capabilities (v3-only) but the call failed. Treating as v3 (synthetic) \u2014 version + idempotency-TTL checks skipped. Calls to getIdempotencyReplayTtlSeconds() will throw until the agent's capabilities endpoint is fixed. Report the wire-shape bug to the agent operator at ${this.agent.agent_uri}.`
|
|
7641
7804
|
);
|
|
7642
7805
|
}
|
|
7643
|
-
/**
|
|
7644
|
-
* Warn once per client when `requireSupportedMajor` routes a synthetic-v2
|
|
7645
|
-
* seller through the v2 adapter — the agent did not expose
|
|
7646
|
-
* `get_adcp_capabilities`, so the version was inferred from `tools/list`.
|
|
7647
|
-
* A compliant v3 seller would declare itself; absence of a declaration is
|
|
7648
|
-
* read as v2. Idempotency-TTL guarantees are unknown for these sellers,
|
|
7649
|
-
* so BYOK retry callers should treat them as such.
|
|
7650
|
-
*
|
|
7651
|
-
* One-shot via `_syntheticV2WarningFired` (matches `maybeWarnV2Sunset`
|
|
7652
|
-
* cadence).
|
|
7653
|
-
*/
|
|
7654
|
-
maybeWarnSyntheticV2() {
|
|
7655
|
-
if (this._syntheticV2WarningFired) return;
|
|
7656
|
-
this._syntheticV2WarningFired = true;
|
|
7657
|
-
console.warn(
|
|
7658
|
-
`[adcp] Warning: agent ${this.agent.agent_uri} does not expose get_adcp_capabilities. Routing as v2 (synthetic) \u2014 idempotency-TTL guarantee is unknown. Ask the agent operator to declare v3 via get_adcp_capabilities if v3 routing is intended. Branch on client.isSyntheticV2() to tighten retry policies for these sellers.`
|
|
7659
|
-
);
|
|
7660
|
-
}
|
|
7661
7806
|
/**
|
|
7662
7807
|
* Detect server AdCP version
|
|
7663
7808
|
*
|
|
@@ -7667,36 +7812,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7667
7812
|
const capabilities = await this.getCapabilities(options);
|
|
7668
7813
|
const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
|
|
7669
7814
|
if (discoveryContext) discoveryContext.capabilities = capabilities;
|
|
7815
|
+
this.assertSupportedServer(capabilities);
|
|
7670
7816
|
return capabilities.version;
|
|
7671
7817
|
}
|
|
7672
|
-
/**
|
|
7673
|
-
* Whether the seller's capabilities are synthesized from `tools/list`
|
|
7674
|
-
* with no authoritative `get_adcp_capabilities` response — i.e. the
|
|
7675
|
-
* dispatcher routes through the v2 adapter and idempotency-TTL is
|
|
7676
|
-
* unknown. Use this to gate retry behavior for sellers whose retry
|
|
7677
|
-
* safety can't be derived from declared capabilities (lower attempt
|
|
7678
|
-
* caps, longer backoff, or fall back to natural-key recovery).
|
|
7679
|
-
*
|
|
7680
|
-
* Returns `false` for declared v2 sellers, declared v3 sellers, and
|
|
7681
|
-
* synthetic v3 sellers (which advertise the v3 discovery tool even
|
|
7682
|
-
* when the call itself failed).
|
|
7683
|
-
*
|
|
7684
|
-
* Caveat for synthetic v3: the predicate returns `false`, but TTL is
|
|
7685
|
-
* still unknown for those sellers — `getIdempotencyReplayTtlSeconds()`
|
|
7686
|
-
* throws until the agent's capabilities endpoint is fixed (issue
|
|
7687
|
-
* #1217). Retry-policy consumers that need a complete "TTL unknown"
|
|
7688
|
-
* gate should additionally check `getCapabilities()._synthetic`.
|
|
7689
|
-
*/
|
|
7690
|
-
async isSyntheticV2() {
|
|
7691
|
-
const capabilities = await this.getCapabilities();
|
|
7692
|
-
return capabilities._synthetic === true && capabilities.version === "v2";
|
|
7693
|
-
}
|
|
7694
7818
|
/**
|
|
7695
7819
|
* Check if server supports a specific AdCP major version
|
|
7696
7820
|
*/
|
|
7697
7821
|
async supportsVersion(version) {
|
|
7698
7822
|
const capabilities = await this.getCapabilities();
|
|
7699
|
-
return capabilities.majorVersions.includes(
|
|
7823
|
+
return version === 3 && capabilities.majorVersions.includes(3);
|
|
7700
7824
|
}
|
|
7701
7825
|
/**
|
|
7702
7826
|
* Return the seller's declared `adcp.idempotency.replay_ttl_seconds`.
|
|
@@ -7707,8 +7831,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7707
7831
|
*
|
|
7708
7832
|
* Fails closed when the seller is v3 but does not declare the field: the
|
|
7709
7833
|
* spec makes the declaration REQUIRED, and silently defaulting to 24h
|
|
7710
|
-
* would mislead buyers about retry safety.
|
|
7711
|
-
* `undefined` instead of a throw — v2 pre-dates the idempotency envelope.
|
|
7834
|
+
* would mislead buyers about retry safety.
|
|
7712
7835
|
*/
|
|
7713
7836
|
async getIdempotencyReplayTtlSeconds() {
|
|
7714
7837
|
const capabilities = await this.getCapabilities();
|
|
@@ -7717,7 +7840,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7717
7840
|
(0, import_capabilities.assertValidIdempotencyReplayTtlSeconds)(capabilities.idempotency.replayTtlSeconds);
|
|
7718
7841
|
return capabilities.idempotency.replayTtlSeconds;
|
|
7719
7842
|
}
|
|
7720
|
-
if (capabilities.version !== "v3") return void 0;
|
|
7721
7843
|
throw new import_errors.ConfigurationError(
|
|
7722
7844
|
`Agent "${this.agent.id}" is v3 but does not declare adcp.idempotency.replay_ttl_seconds. The spec requires this for v3 sellers \u2014 treating the agent as non-compliant rather than defaulting to 24h, which would silently mislead retry-sensitive flows.`,
|
|
7723
7845
|
"adcp.idempotency.replay_ttl_seconds"
|
|
@@ -8028,28 +8150,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
8028
8150
|
* 2. `capabilities.idempotency.replayTtlSeconds` present (spec-required
|
|
8029
8151
|
* for real major-3+ sellers)
|
|
8030
8152
|
*
|
|
8031
|
-
*
|
|
8032
|
-
*
|
|
8033
|
-
* compliant v3 seller would declare itself, so absence of a declaration
|
|
8034
|
-
* is taken as evidence of v2. The dispatcher routes the request through
|
|
8035
|
-
* the v2 wire-shape adapter. A one-time warning surfaces the routing
|
|
8036
|
-
* decision so adopters can audit it; retry-safety (idempotency TTL) is
|
|
8037
|
-
* unknown for these sellers and BYOK callers should treat them as such.
|
|
8038
|
-
*
|
|
8039
|
-
* Per-client `allowV2: true` or, when that's undefined,
|
|
8040
|
-
* `ADCP_ALLOW_V2=1` in the environment bypasses the guard entirely.
|
|
8153
|
+
* Synthetic v3 evidence is accepted only when the agent advertises discovery.
|
|
8154
|
+
* Agents without discovery and AdCP 2-only agents are rejected.
|
|
8041
8155
|
*
|
|
8042
8156
|
* Throws `VersionUnsupportedError` with the specific reason on failure.
|
|
8043
8157
|
*/
|
|
8044
8158
|
async requireSupportedMajor(taskType = "request", options) {
|
|
8045
|
-
if (this.isV2Allowed()) return;
|
|
8046
8159
|
const capabilities = await this.getCapabilities(options);
|
|
8160
|
+
this.assertSupportedServer(capabilities);
|
|
8047
8161
|
if (capabilities._synthetic) {
|
|
8048
|
-
|
|
8049
|
-
this.maybeWarnSyntheticV3();
|
|
8050
|
-
} else {
|
|
8051
|
-
this.maybeWarnSyntheticV2();
|
|
8052
|
-
}
|
|
8162
|
+
this.maybeWarnSyntheticV3();
|
|
8053
8163
|
return;
|
|
8054
8164
|
}
|
|
8055
8165
|
const supportedVersions = capabilities.supportedVersions;
|
|
@@ -8080,10 +8190,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
8080
8190
|
async requireV3(taskType = "request") {
|
|
8081
8191
|
return this.requireSupportedMajor(taskType);
|
|
8082
8192
|
}
|
|
8083
|
-
isV2Allowed() {
|
|
8084
|
-
if (this.config.allowV2 !== void 0) return this.config.allowV2 === true;
|
|
8085
|
-
return process.env.ADCP_ALLOW_V2 === "1";
|
|
8086
|
-
}
|
|
8087
8193
|
// ====== STATIC HELPER METHODS ======
|
|
8088
8194
|
/**
|
|
8089
8195
|
* Query a legacy creative-agent named-format catalog.
|