@adcp/sdk 16.0.0-beta.8 → 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 +3 -0
- package/bin/adcp.js +10 -13
- 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 +19 -112
- package/dist/lib/core/SingleAgentClient.d.ts +19 -112
- package/dist/lib/core/SingleAgentClient.js +270 -252
- package/dist/lib/core/SingleAgentClient.mjs +275 -253
- 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/index.d.mts +4 -4
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +0 -14
- package/dist/lib/index.mjs +0 -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/legacy-purchase-continuation.d.mts +2 -2
- package/dist/lib/media-buy/legacy-purchase-continuation.d.ts +2 -2
- package/dist/lib/protocols/index.js +14 -22
- package/dist/lib/protocols/index.mjs +5 -13
- package/dist/lib/registry/types.d.mts +3 -2
- package/dist/lib/registry/types.d.ts +3 -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/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/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;
|
|
@@ -1125,12 +1160,8 @@ class SingleAgentClient {
|
|
|
1125
1160
|
// shared invalidation epoch of that key when the evidence was obtained
|
|
1126
1161
|
sharedEvidenceKey;
|
|
1127
1162
|
// discoveryCache key the local capability cache was obtained under
|
|
1128
|
-
_v2WarningFired = false;
|
|
1129
|
-
// Gate: emit the v2-sunset warning once per client instance
|
|
1130
1163
|
_syntheticV3WarningFired = false;
|
|
1131
1164
|
// Gate: emit the synthetic-v3 warning once per client instance
|
|
1132
|
-
_syntheticV2WarningFired = false;
|
|
1133
|
-
// Gate: emit the synthetic-v2 warning once per client instance
|
|
1134
1165
|
productPolicyRequestParamsByTask = /* @__PURE__ */ new Map();
|
|
1135
1166
|
canonicalCreativeTaskAssociations = /* @__PURE__ */ new Map();
|
|
1136
1167
|
previewCreativeHandlersByTask = /* @__PURE__ */ new Map();
|
|
@@ -1401,7 +1432,7 @@ class SingleAgentClient {
|
|
|
1401
1432
|
}
|
|
1402
1433
|
}
|
|
1403
1434
|
}
|
|
1404
|
-
rememberCanonicalProductRoutes(products, account, authoritativeProducts) {
|
|
1435
|
+
rememberCanonicalProductRoutes(products, account, authoritativeProducts, evidence) {
|
|
1405
1436
|
this.invalidateCanonicalProductRoutes(authoritativeProducts ?? products, account);
|
|
1406
1437
|
const accountScope = this.canonicalAccountScope(account);
|
|
1407
1438
|
const declaredOptions = authoritativeProducts ? this.sellerDeclaredFormatOptions(authoritativeProducts) : void 0;
|
|
@@ -1421,12 +1452,15 @@ class SingleAgentClient {
|
|
|
1421
1452
|
const refs = (0, import_legacy_metadata.legacyFormatRefsForDeclaration)(option);
|
|
1422
1453
|
const declared = declaredOptions ? declaredOptions.get(product.product_id)?.some((declaredRef) => this.sameCanonicalOptionRef(declaredRef, ref)) : (0, import_legacy_metadata.sellerDeclaredFormatOption)(option);
|
|
1423
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 });
|
|
1424
1457
|
this.rememberCanonicalLegacyRoute(this.canonicalLegacyRouteKey(account, product.product_id, ref), {
|
|
1425
1458
|
kind: "product",
|
|
1426
1459
|
accountScope,
|
|
1427
1460
|
productId: product.product_id,
|
|
1428
1461
|
optionRef: ref,
|
|
1429
1462
|
refs,
|
|
1463
|
+
...declared === true && (0, import_legacy_metadata.sellerFormatEvidence)(option) ? { declaration: (0, import_legacy_metadata.structuredCloneWithLegacyCreativeMetadata)(option) } : {},
|
|
1430
1464
|
...declared === false ? { undeclaredSelector: (0, import_legacy_routes.undeclaredFormatOptionSelector)(option) } : {}
|
|
1431
1465
|
});
|
|
1432
1466
|
}
|
|
@@ -3408,7 +3442,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3408
3442
|
/**
|
|
3409
3443
|
* Execute task and call appropriate handler on completion
|
|
3410
3444
|
*
|
|
3411
|
-
*
|
|
3445
|
+
* Adapts requests for maintained AdCP 3 releases and normalizes product responses.
|
|
3412
3446
|
*/
|
|
3413
3447
|
async executeAndHandle(taskType, handlerName, params, inputHandler, options, transformCompletedResponse, legacyFormatConverter, canonicalRequest, projectionCatalogs) {
|
|
3414
3448
|
const requestParamsSnapshot = structuredClone(params);
|
|
@@ -3453,11 +3487,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3453
3487
|
await this.requireSupportedMajor(taskType, options);
|
|
3454
3488
|
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3455
3489
|
}
|
|
3456
|
-
const earlyResult = await this.getEarlyResultForUnsupportedFeatures(taskType, normalizedParams, options);
|
|
3457
|
-
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3458
|
-
if (earlyResult) {
|
|
3459
|
-
return (0, import_match.attachMatch)(earlyResult);
|
|
3460
|
-
}
|
|
3461
3490
|
const agent = await this.ensureEndpointDiscovered(options);
|
|
3462
3491
|
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3463
3492
|
if (!options?.skipIdempotencyAutoInject && !options?.skipAccountValidation && !options?.skipRequestValidation && !options?.preserveGovernedPayload) {
|
|
@@ -3496,11 +3525,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3496
3525
|
capabilityDiscoveryContext.toolSchemas,
|
|
3497
3526
|
capabilityDiscoveryContext.capabilities
|
|
3498
3527
|
);
|
|
3499
|
-
const
|
|
3500
|
-
if (webhookDriftLog)
|
|
3501
|
-
if (serverVersion === "v2") {
|
|
3502
|
-
this.executor.validateAdaptedRequestAgainstV2(taskType, adaptedParams, v25DriftLogs);
|
|
3503
|
-
}
|
|
3528
|
+
const adaptationLogs = [...adaptDriftLogs];
|
|
3529
|
+
if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
|
|
3504
3530
|
const canonicalInputHandler = this.canonicalCreativeInputHandler(
|
|
3505
3531
|
taskType,
|
|
3506
3532
|
inputHandler,
|
|
@@ -3547,7 +3573,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3547
3573
|
);
|
|
3548
3574
|
(0, import_abort2.throwIfAborted)(effectiveOptions?.signal);
|
|
3549
3575
|
if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
|
|
3550
|
-
const postAdapterLogs = [...inputSchemaStripLogs, ...
|
|
3576
|
+
const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
|
|
3551
3577
|
if (postAdapterLogs.length > 0) {
|
|
3552
3578
|
result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
|
|
3553
3579
|
}
|
|
@@ -3643,7 +3669,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3643
3669
|
const rawSubmittedWaitForCompletion = result.submitted?.waitForCompletion;
|
|
3644
3670
|
const finalizerLegacyFormatConverter = legacyFormatConverter ?? this.resolveLegacyFormatConverter(void 0, context.projectionCatalogs);
|
|
3645
3671
|
if (result.success && result.data) {
|
|
3646
|
-
result.data = this.
|
|
3672
|
+
result.data = this.normalizeEstablishedResponse(taskType, result.data);
|
|
3647
3673
|
}
|
|
3648
3674
|
result = this.wrapProductPolicySubmittedContinuation(
|
|
3649
3675
|
result,
|
|
@@ -3789,7 +3815,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3789
3815
|
};
|
|
3790
3816
|
}
|
|
3791
3817
|
projectCanonicalCreativeData(taskType, data, transform, legacyFormatConverter) {
|
|
3792
|
-
let projected = this.
|
|
3818
|
+
let projected = this.normalizeEstablishedResponse(taskType, data);
|
|
3793
3819
|
const record = projected && typeof projected === "object" ? projected : void 0;
|
|
3794
3820
|
const canProjectRead = taskType === "get_products" ? Array.isArray(record?.products) : taskType === "list_creatives" ? Array.isArray(record?.creatives) : true;
|
|
3795
3821
|
if (transform && canProjectRead) {
|
|
@@ -4462,7 +4488,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4462
4488
|
waitForCompletion: async (pollInterval, signal) => {
|
|
4463
4489
|
let completed = await submitted.waitForCompletion(pollInterval, signal);
|
|
4464
4490
|
if (completed.success && completed.data) {
|
|
4465
|
-
completed.data = this.
|
|
4491
|
+
completed.data = this.normalizeEstablishedResponse(taskType, completed.data);
|
|
4466
4492
|
}
|
|
4467
4493
|
const terminal = completed.status === "completed" || completed.status === "failed";
|
|
4468
4494
|
try {
|
|
@@ -4493,7 +4519,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4493
4519
|
(0, import_match.attachMatch)({
|
|
4494
4520
|
success: true,
|
|
4495
4521
|
status: "completed",
|
|
4496
|
-
data: this.
|
|
4522
|
+
data: this.normalizeEstablishedResponse(taskType, taskInfo.result),
|
|
4497
4523
|
metadata: {
|
|
4498
4524
|
taskId: taskInfo.taskId,
|
|
4499
4525
|
taskName: taskInfo.taskType,
|
|
@@ -4569,8 +4595,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4569
4595
|
}
|
|
4570
4596
|
/**
|
|
4571
4597
|
* Adapt a request for the detected server wire version and the seller's
|
|
4572
|
-
* AdCP protocol version. Applies
|
|
4573
|
-
* to a v2 server, then applies protocol-version adapters (e.g. stripping
|
|
4598
|
+
* AdCP protocol version. Applies protocol-version adapters (e.g. stripping
|
|
4574
4599
|
* 3.1-only fields for a 3.0 seller). Returns the adapted params and any
|
|
4575
4600
|
* drift log entries describing what was changed.
|
|
4576
4601
|
*
|
|
@@ -4578,22 +4603,14 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4578
4603
|
* current call's tool schemas can be supplied without cross-tenant caching.
|
|
4579
4604
|
*/
|
|
4580
4605
|
adaptRequest(taskType, params, serverVersion, debugLogs, perCallToolSchemas, perCallCapabilities) {
|
|
4581
|
-
const driftLogs = [];
|
|
4582
|
-
let adapted = params;
|
|
4583
4606
|
if (serverVersion !== "v3") {
|
|
4584
|
-
|
|
4585
|
-
if (pair) adapted = pair.adaptRequest(adapted);
|
|
4607
|
+
throw new import_errors.VersionUnsupportedError(taskType, "version", "v2", this.agent.agent_uri);
|
|
4586
4608
|
}
|
|
4609
|
+
const driftLogs = [];
|
|
4610
|
+
let adapted = params;
|
|
4587
4611
|
const toolSchema = (perCallToolSchemas ?? this.cachedToolSchemas)?.get(taskType);
|
|
4588
4612
|
if (toolSchema && Object.keys(toolSchema).length > 0) {
|
|
4589
4613
|
const declaredFields = new Set(Object.keys(toolSchema));
|
|
4590
|
-
const adapterAliases = [["brand_manifest", "brand"]];
|
|
4591
|
-
for (const [adapterField, schemaField] of adapterAliases) {
|
|
4592
|
-
if (adapted[adapterField] !== void 0 && !declaredFields.has(adapterField) && declaredFields.has(schemaField) && adapted[schemaField] === void 0 && valueMatchesSchemaType(adapted[adapterField], toolSchema[schemaField])) {
|
|
4593
|
-
adapted[schemaField] = adapted[adapterField];
|
|
4594
|
-
delete adapted[adapterField];
|
|
4595
|
-
}
|
|
4596
|
-
}
|
|
4597
4614
|
const envelopeFields = import_adcp.ADCP_ENVELOPE_FIELDS;
|
|
4598
4615
|
const filtered = {};
|
|
4599
4616
|
const schemaStripped = [];
|
|
@@ -4641,67 +4658,19 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4641
4658
|
}
|
|
4642
4659
|
return { params: adapted, driftLogs };
|
|
4643
4660
|
}
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
*
|
|
4657
|
-
* Returns an early empty result if the request requires v3 features
|
|
4658
|
-
* that the server doesn't support. This treats "products matching unsupported
|
|
4659
|
-
* capability" as an empty result set rather than an error.
|
|
4660
|
-
*
|
|
4661
|
-
* @returns TaskResult with empty data if v3 features are unsupported, null to proceed normally
|
|
4662
|
-
*/
|
|
4663
|
-
async getEarlyResultForUnsupportedFeatures(taskType, params, options) {
|
|
4664
|
-
if (taskType !== "get_products") {
|
|
4665
|
-
return null;
|
|
4666
|
-
}
|
|
4667
|
-
const capabilities = await this.getCapabilities(options);
|
|
4668
|
-
if (capabilities.version === "v3") {
|
|
4669
|
-
return null;
|
|
4670
|
-
}
|
|
4671
|
-
const usesUnsupportedFeature = (
|
|
4672
|
-
// required_features: content_standards requires contentStandards
|
|
4673
|
-
params.filters?.required_features?.includes("content_standards") && !capabilities.features.contentStandards
|
|
4674
|
-
);
|
|
4675
|
-
if (!usesUnsupportedFeature) {
|
|
4676
|
-
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;
|
|
4677
4673
|
}
|
|
4678
|
-
console.warn(
|
|
4679
|
-
`[AdCP] v3-only features not supported by server "${this.agent.id}" (${capabilities.version}). Returning empty results.`
|
|
4680
|
-
);
|
|
4681
|
-
const emptyResponse = {
|
|
4682
|
-
products: [],
|
|
4683
|
-
property_list_applied: false
|
|
4684
|
-
};
|
|
4685
|
-
return {
|
|
4686
|
-
success: true,
|
|
4687
|
-
status: "completed",
|
|
4688
|
-
data: emptyResponse,
|
|
4689
|
-
metadata: {
|
|
4690
|
-
taskId: `early_${Date.now()}`,
|
|
4691
|
-
taskName: taskType,
|
|
4692
|
-
agent: {
|
|
4693
|
-
id: this.agent.id,
|
|
4694
|
-
name: this.agent.name,
|
|
4695
|
-
protocol: this.normalizedAgent.protocol
|
|
4696
|
-
},
|
|
4697
|
-
responseTimeMs: 0,
|
|
4698
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4699
|
-
clarificationRounds: 0,
|
|
4700
|
-
status: "completed",
|
|
4701
|
-
serverVersion: capabilities.version,
|
|
4702
|
-
serverVersionSynthetic: capabilities._synthetic
|
|
4703
|
-
}
|
|
4704
|
-
};
|
|
4705
4674
|
}
|
|
4706
4675
|
// ====== MEDIA BUY TASKS ======
|
|
4707
4676
|
/**
|
|
@@ -4801,6 +4770,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4801
4770
|
}
|
|
4802
4771
|
}
|
|
4803
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
|
+
};
|
|
4804
4780
|
const result = await this.executeAndHandle(
|
|
4805
4781
|
"get_products",
|
|
4806
4782
|
"onGetProductsStatusChange",
|
|
@@ -4813,7 +4789,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4813
4789
|
projectionCatalogs: projectionCatalogs ?? this.config.projectionCatalogs
|
|
4814
4790
|
});
|
|
4815
4791
|
const authoritativeProducts = Array.isArray(data.products) ? data.products : response.products;
|
|
4816
|
-
this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts);
|
|
4792
|
+
this.rememberCanonicalProductRoutes(response.products, account, authoritativeProducts, productEvidence);
|
|
4817
4793
|
const { _message: _dropLegacyMessage, ...canonical } = response;
|
|
4818
4794
|
void _dropLegacyMessage;
|
|
4819
4795
|
return { ...canonical, projection: { diagnostics } };
|
|
@@ -4824,7 +4800,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4824
4800
|
);
|
|
4825
4801
|
const finishCache = async (completed) => {
|
|
4826
4802
|
if (!cache) return completed;
|
|
4827
|
-
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
|
+
});
|
|
4828
4806
|
if (cachedResult.success && cachedResult.status === "completed") {
|
|
4829
4807
|
if (!skipCacheRead && cacheParams.if_wholesale_feed_version === void 0 && cacheParams.if_pricing_version === void 0 && cachedResult.data.unchanged === true) {
|
|
4830
4808
|
return this.getProducts(params, inputHandler, {
|
|
@@ -5002,7 +4980,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5002
4980
|
if (hasCreativeFormatData) {
|
|
5003
4981
|
this.validateBeforeCreativeCapabilityProbe("create_media_buy", params, taskOptions);
|
|
5004
4982
|
}
|
|
5005
|
-
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";
|
|
5006
4989
|
const wireParams = params;
|
|
5007
4990
|
const result = await this.executeAndHandle(
|
|
5008
4991
|
"create_media_buy",
|
|
@@ -5090,7 +5073,12 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5090
5073
|
if (hasCreativeFormatData) {
|
|
5091
5074
|
this.validateBeforeCreativeCapabilityProbe("update_media_buy", params, taskOptions);
|
|
5092
5075
|
}
|
|
5093
|
-
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";
|
|
5094
5082
|
const result = await this.executeAndHandle(
|
|
5095
5083
|
"update_media_buy",
|
|
5096
5084
|
"onUpdateMediaBuyStatusChange",
|
|
@@ -5179,7 +5167,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5179
5167
|
projectionCatalogs ?? this.config.projectionCatalogs
|
|
5180
5168
|
);
|
|
5181
5169
|
this.validateBeforeCreativeCapabilityProbe("sync_creatives", params, taskOptions);
|
|
5182
|
-
const wireMode = await this.resolveCreativeFormatWireMode("sync_creatives", taskOptions);
|
|
5183
5170
|
const configuredSelectorContainers = [
|
|
5184
5171
|
...creativeFormatProjection?.selectorContainers ?? []
|
|
5185
5172
|
];
|
|
@@ -5191,10 +5178,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5191
5178
|
const assignmentPackageContainers = Array.isArray(params.assignments) ? params.assignments.flatMap(
|
|
5192
5179
|
(assignment) => typeof assignment.package_id === "string" && !configuredPackageIds.has(assignment.package_id) ? [{ package_id: assignment.package_id }] : []
|
|
5193
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
|
+
);
|
|
5194
5188
|
const wireParams = this.projectUndeclaredFormatOptions(
|
|
5195
5189
|
(0, import_creative_delivery.projectSyncCreativesForDelivery)(
|
|
5196
5190
|
params,
|
|
5197
|
-
|
|
5191
|
+
selectorContainers,
|
|
5198
5192
|
wireMode,
|
|
5199
5193
|
effectiveLegacyFormatConverter,
|
|
5200
5194
|
effectiveCanonicalFormatLegacyResolver
|
|
@@ -5234,16 +5228,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5234
5228
|
* sending a mutation. Discovers capabilities and the current tool's input
|
|
5235
5229
|
* schema, or reuses fresh cached/primed evidence, with this client's wire pin.
|
|
5236
5230
|
*
|
|
5237
|
-
* `unknown`
|
|
5238
|
-
*
|
|
5239
|
-
*
|
|
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.
|
|
5240
5235
|
* Conflicting evidence and unproven support with a 3.2+ buyer pin throw
|
|
5241
5236
|
* `CreativeFormatCapabilityError`, just as they do during a write.
|
|
5242
5237
|
*/
|
|
5243
5238
|
async resolveCreativeFormatWireMode(taskType, options) {
|
|
5244
5239
|
return this.resolveCreativeWireMode(taskType, options, true);
|
|
5245
5240
|
}
|
|
5246
|
-
async resolveCreativeWireMode(taskType, options, canRediscover) {
|
|
5241
|
+
async resolveCreativeWireMode(taskType, options, canRediscover, matchingProductOptions) {
|
|
5247
5242
|
const discoveryContext = {};
|
|
5248
5243
|
const capabilities = await this.getCapabilities({
|
|
5249
5244
|
...options,
|
|
@@ -5262,13 +5257,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5262
5257
|
`Seller capability and ${taskType} input schema disagree about canonical creative support`
|
|
5263
5258
|
);
|
|
5264
5259
|
}
|
|
5265
|
-
|
|
5260
|
+
let resolved = declared !== "unknown" ? declared : schema;
|
|
5261
|
+
if (resolved === "unknown" && (0, import_creative_delivery.canUseProductOptionsForCreativeWire)(capabilities, wireRelease) && matchingProductOptions?.()) {
|
|
5262
|
+
resolved = "canonical";
|
|
5263
|
+
}
|
|
5266
5264
|
const release = /^v?(\d+)\.(\d+)(?:\.|-|$)/.exec(wireRelease.trim());
|
|
5267
5265
|
const canonicalRequiredByBuyerPin = release !== null && (Number(release[1]) > 3 || Number(release[1]) === 3 && Number(release[2]) >= 2);
|
|
5268
5266
|
if (resolved === "unknown" && canonicalRequiredByBuyerPin) {
|
|
5269
5267
|
if (canRediscover && !usesScopedFetch && this.normalizedAgent.protocol === "mcp" && this.capabilitiesFromSharedCache && toolSchemas?.has(taskType) && !toolInputSchemasByProperties.has(toolSchemas)) {
|
|
5270
5268
|
await this.invalidateDiscoveryCache(options);
|
|
5271
|
-
return this.resolveCreativeWireMode(taskType, options, false);
|
|
5269
|
+
return this.resolveCreativeWireMode(taskType, options, false, matchingProductOptions);
|
|
5272
5270
|
}
|
|
5273
5271
|
throw new import_creative_delivery.CreativeFormatCapabilityError(
|
|
5274
5272
|
`Cannot prove which AdCP release the seller serves for ${taskType}; a 3.2+ client will not guess a legacy creative wire shape`
|
|
@@ -5276,6 +5274,112 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5276
5274
|
}
|
|
5277
5275
|
return resolved;
|
|
5278
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
|
+
}
|
|
5279
5383
|
/** Validate malformed creative payloads before capability discovery can perform I/O. */
|
|
5280
5384
|
validateBeforeCreativeCapabilityProbe(taskType, params, options) {
|
|
5281
5385
|
if (options.skipIdempotencyAutoInject || options.skipAccountValidation || options.skipRequestValidation) return;
|
|
@@ -6184,11 +6288,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6184
6288
|
capabilityDiscoveryContext.toolSchemas,
|
|
6185
6289
|
capabilityDiscoveryContext.capabilities
|
|
6186
6290
|
);
|
|
6187
|
-
const
|
|
6188
|
-
if (webhookDriftLog)
|
|
6189
|
-
if (serverVersion === "v2") {
|
|
6190
|
-
this.executor.validateAdaptedRequestAgainstV2(taskName, adaptedParams, v25DriftLogs);
|
|
6191
|
-
}
|
|
6291
|
+
const adaptationLogs = [...adaptDriftLogs];
|
|
6292
|
+
if (webhookDriftLog) adaptationLogs.push(webhookDriftLog);
|
|
6192
6293
|
const deferredClientContext = {
|
|
6193
6294
|
kind: "single-agent",
|
|
6194
6295
|
taskType: taskName,
|
|
@@ -6218,7 +6319,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6218
6319
|
deferredClientContext
|
|
6219
6320
|
);
|
|
6220
6321
|
if (!result.success) await this.invalidateDiscoveryOnCapabilityError(result.adcpError?.code, effectiveOptions);
|
|
6221
|
-
const postAdapterLogs = [...inputSchemaStripLogs, ...
|
|
6322
|
+
const postAdapterLogs = [...inputSchemaStripLogs, ...adaptationLogs];
|
|
6222
6323
|
if (postAdapterLogs.length > 0) {
|
|
6223
6324
|
result.debug_logs = [...result.debug_logs ?? [], ...postAdapterLogs];
|
|
6224
6325
|
}
|
|
@@ -6408,6 +6509,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6408
6509
|
getProtocol() {
|
|
6409
6510
|
return this.normalizedAgent.protocol;
|
|
6410
6511
|
}
|
|
6512
|
+
/** Resolved MCP endpoint already used by this client; never performs discovery. */
|
|
6513
|
+
getDiscoveredMcpEndpoint() {
|
|
6514
|
+
return this.discoveredEndpoint;
|
|
6515
|
+
}
|
|
6411
6516
|
/**
|
|
6412
6517
|
* Get the canonical base URL for this agent
|
|
6413
6518
|
*
|
|
@@ -6909,7 +7014,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6909
7014
|
* Get agent capabilities, including AdCP version support
|
|
6910
7015
|
*
|
|
6911
7016
|
* For v3 servers, calls get_adcp_capabilities tool.
|
|
6912
|
-
*
|
|
7017
|
+
* Requires AdCP 3 capability discovery; retired AdCP 2 agents are rejected.
|
|
6913
7018
|
*
|
|
6914
7019
|
* @returns Promise resolving to normalized capabilities object
|
|
6915
7020
|
*
|
|
@@ -6946,7 +7051,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6946
7051
|
}
|
|
6947
7052
|
if (!usesScopedFetch && this.cachedCapabilities) {
|
|
6948
7053
|
if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
|
|
6949
|
-
this.
|
|
7054
|
+
this.assertSupportedServer(this.cachedCapabilities);
|
|
6950
7055
|
return this.cachedCapabilities;
|
|
6951
7056
|
}
|
|
6952
7057
|
if (!usesScopedFetch && this.config.discoveryCache) {
|
|
@@ -7030,7 +7135,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7030
7135
|
this.capabilitiesFromSharedCache = true;
|
|
7031
7136
|
this.recordSharedEvidence(key);
|
|
7032
7137
|
if (discoveryContext) discoveryContext.toolSchemas = this.cachedToolSchemas;
|
|
7033
|
-
this.
|
|
7138
|
+
this.assertSupportedServer(installed);
|
|
7034
7139
|
return installed;
|
|
7035
7140
|
}
|
|
7036
7141
|
async discoverCapabilitiesLive(options, usesScopedFetch, discoveryContext) {
|
|
@@ -7080,16 +7185,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7080
7185
|
throw (0, import_abort2.createTimeoutError)(requestTimeoutMs);
|
|
7081
7186
|
}
|
|
7082
7187
|
if (result.success && result.data) {
|
|
7083
|
-
const
|
|
7188
|
+
const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.parseCapabilitiesResponse)(result.data), tools);
|
|
7189
|
+
this.assertSupportedServer(capabilities);
|
|
7084
7190
|
if (!usesScopedFetch && !superseded()) {
|
|
7085
|
-
this.cachedCapabilities =
|
|
7191
|
+
this.cachedCapabilities = capabilities;
|
|
7086
7192
|
this.capabilitiesFromSharedCache = false;
|
|
7087
|
-
if (!
|
|
7193
|
+
if (!capabilities._synthetic && this.config.discoveryCache) {
|
|
7088
7194
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7089
7195
|
const stored = await this.writeSharedDiscovery(
|
|
7090
7196
|
options,
|
|
7091
7197
|
{
|
|
7092
|
-
capabilities: structuredClone(
|
|
7198
|
+
capabilities: structuredClone(capabilities),
|
|
7093
7199
|
toolSchemas: Object.fromEntries(discoveredToolSchemas),
|
|
7094
7200
|
toolInputSchemas: Object.fromEntries(discoveredInputSchemas)
|
|
7095
7201
|
},
|
|
@@ -7097,7 +7203,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7097
7203
|
startedAtEpoch
|
|
7098
7204
|
);
|
|
7099
7205
|
if (superseded()) {
|
|
7100
|
-
if (this.cachedCapabilities ===
|
|
7206
|
+
if (this.cachedCapabilities === capabilities) {
|
|
7101
7207
|
this.cachedCapabilities = void 0;
|
|
7102
7208
|
this.cachedToolSchemas = void 0;
|
|
7103
7209
|
this.primedCapabilitiesExpiresAt = void 0;
|
|
@@ -7107,31 +7213,26 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7107
7213
|
}
|
|
7108
7214
|
}
|
|
7109
7215
|
}
|
|
7110
|
-
this.
|
|
7111
|
-
return
|
|
7216
|
+
this.assertSupportedServer(capabilities);
|
|
7217
|
+
return capabilities;
|
|
7112
7218
|
}
|
|
7113
7219
|
if (!advertisesCapabilitiesTool) {
|
|
7114
7220
|
throw new Error("unadvertised official A2A capability probe was not supported");
|
|
7115
7221
|
}
|
|
7116
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);
|
|
7117
7225
|
console.warn(
|
|
7118
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).`,
|
|
7119
7227
|
{ hasError: !!result.error, hasData: !!result.data }
|
|
7120
7228
|
);
|
|
7121
|
-
const parsed = (0, import_capabilities.parseCapabilitiesResponse)(result.data);
|
|
7122
|
-
const v3Capabilities = {
|
|
7123
|
-
...parsed,
|
|
7124
|
-
version: "v3",
|
|
7125
|
-
majorVersions: parsed.majorVersions.includes(3) ? parsed.majorVersions : [3]
|
|
7126
|
-
};
|
|
7127
|
-
const capabilities2 = (0, import_capabilities.augmentCapabilitiesFromTools)(v3Capabilities, tools);
|
|
7128
7229
|
if (!usesScopedFetch && !superseded()) {
|
|
7129
|
-
this.cachedCapabilities =
|
|
7230
|
+
this.cachedCapabilities = capabilities;
|
|
7130
7231
|
this.capabilitiesFromSharedCache = false;
|
|
7131
7232
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7132
7233
|
}
|
|
7133
|
-
this.
|
|
7134
|
-
return
|
|
7234
|
+
this.assertSupportedServer(capabilities);
|
|
7235
|
+
return capabilities;
|
|
7135
7236
|
}
|
|
7136
7237
|
console.warn(
|
|
7137
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.`,
|
|
@@ -7142,7 +7243,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7142
7243
|
}
|
|
7143
7244
|
);
|
|
7144
7245
|
} catch (error) {
|
|
7145
|
-
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)) {
|
|
7146
7247
|
throw error;
|
|
7147
7248
|
}
|
|
7148
7249
|
if (advertisesCapabilitiesTool) {
|
|
@@ -7152,26 +7253,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7152
7253
|
}
|
|
7153
7254
|
}
|
|
7154
7255
|
if (advertisesCapabilitiesTool) {
|
|
7155
|
-
const
|
|
7256
|
+
const capabilities = (0, import_capabilities.augmentCapabilitiesFromTools)((0, import_capabilities.buildSyntheticV3Capabilities)(tools), tools);
|
|
7156
7257
|
if (!usesScopedFetch && !superseded()) {
|
|
7157
|
-
this.cachedCapabilities =
|
|
7258
|
+
this.cachedCapabilities = capabilities;
|
|
7158
7259
|
this.capabilitiesFromSharedCache = false;
|
|
7159
7260
|
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7160
7261
|
}
|
|
7161
|
-
this.
|
|
7162
|
-
return
|
|
7262
|
+
this.assertSupportedServer(capabilities);
|
|
7263
|
+
return capabilities;
|
|
7163
7264
|
}
|
|
7164
7265
|
}
|
|
7165
|
-
|
|
7166
|
-
`[AdCP] Agent "${this.agent.id}" detected as v2 (no get_adcp_capabilities tool). Tools: [${tools.map((t) => t.name).join(", ")}]`
|
|
7167
|
-
);
|
|
7168
|
-
const capabilities = (0, import_capabilities.buildSyntheticCapabilities)(tools);
|
|
7169
|
-
if (!usesScopedFetch && !superseded()) {
|
|
7170
|
-
this.cachedCapabilities = capabilities;
|
|
7171
|
-
this.capabilitiesFromSharedCache = false;
|
|
7172
|
-
this.recordSharedEvidence(this.sharedDiscoveryKey(options));
|
|
7173
|
-
}
|
|
7174
|
-
return capabilities;
|
|
7266
|
+
throw new import_errors.VersionUnsupportedError("get_adcp_capabilities", "synthetic", "v2", this.agent.agent_uri);
|
|
7175
7267
|
}
|
|
7176
7268
|
/**
|
|
7177
7269
|
* Return the client-bound scope required by {@link primeCapabilities}.
|
|
@@ -7686,28 +7778,11 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7686
7778
|
if (!this.config.discoveryCache || !code || !CAPABILITY_STALE_ERROR_CODES.has(code)) return;
|
|
7687
7779
|
await this.invalidateDiscoveryCache(options);
|
|
7688
7780
|
}
|
|
7689
|
-
/**
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
* against an unsupported agent should hear about it loudly.
|
|
7695
|
-
*
|
|
7696
|
-
* Synthetic capabilities (no `get_adcp_capabilities` tool available) don't
|
|
7697
|
-
* trigger the warning — we don't actually know the agent's version, and
|
|
7698
|
-
* shouting at legitimately-unversioned agents would be noise.
|
|
7699
|
-
*
|
|
7700
|
-
* Suppression: `process.env.ADCP_ALLOW_V2 === '1'`.
|
|
7701
|
-
*/
|
|
7702
|
-
maybeWarnV2Sunset(capabilities) {
|
|
7703
|
-
if (this._v2WarningFired) return;
|
|
7704
|
-
if (capabilities.version === "v3") return;
|
|
7705
|
-
if (capabilities._synthetic) return;
|
|
7706
|
-
if (process.env.ADCP_ALLOW_V2 === "1") return;
|
|
7707
|
-
this._v2WarningFired = true;
|
|
7708
|
-
console.warn(
|
|
7709
|
-
`[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`
|
|
7710
|
-
);
|
|
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
|
+
}
|
|
7711
7786
|
}
|
|
7712
7787
|
/**
|
|
7713
7788
|
* Warn once per client when `requireSupportedMajor` accepts synthetic v3
|
|
@@ -7728,24 +7803,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7728
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}.`
|
|
7729
7804
|
);
|
|
7730
7805
|
}
|
|
7731
|
-
/**
|
|
7732
|
-
* Warn once per client when `requireSupportedMajor` routes a synthetic-v2
|
|
7733
|
-
* seller through the v2 adapter — the agent did not expose
|
|
7734
|
-
* `get_adcp_capabilities`, so the version was inferred from `tools/list`.
|
|
7735
|
-
* A compliant v3 seller would declare itself; absence of a declaration is
|
|
7736
|
-
* read as v2. Idempotency-TTL guarantees are unknown for these sellers,
|
|
7737
|
-
* so BYOK retry callers should treat them as such.
|
|
7738
|
-
*
|
|
7739
|
-
* One-shot via `_syntheticV2WarningFired` (matches `maybeWarnV2Sunset`
|
|
7740
|
-
* cadence).
|
|
7741
|
-
*/
|
|
7742
|
-
maybeWarnSyntheticV2() {
|
|
7743
|
-
if (this._syntheticV2WarningFired) return;
|
|
7744
|
-
this._syntheticV2WarningFired = true;
|
|
7745
|
-
console.warn(
|
|
7746
|
-
`[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.`
|
|
7747
|
-
);
|
|
7748
|
-
}
|
|
7749
7806
|
/**
|
|
7750
7807
|
* Detect server AdCP version
|
|
7751
7808
|
*
|
|
@@ -7755,36 +7812,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7755
7812
|
const capabilities = await this.getCapabilities(options);
|
|
7756
7813
|
const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
|
|
7757
7814
|
if (discoveryContext) discoveryContext.capabilities = capabilities;
|
|
7815
|
+
this.assertSupportedServer(capabilities);
|
|
7758
7816
|
return capabilities.version;
|
|
7759
7817
|
}
|
|
7760
|
-
/**
|
|
7761
|
-
* Whether the seller's capabilities are synthesized from `tools/list`
|
|
7762
|
-
* with no authoritative `get_adcp_capabilities` response — i.e. the
|
|
7763
|
-
* dispatcher routes through the v2 adapter and idempotency-TTL is
|
|
7764
|
-
* unknown. Use this to gate retry behavior for sellers whose retry
|
|
7765
|
-
* safety can't be derived from declared capabilities (lower attempt
|
|
7766
|
-
* caps, longer backoff, or fall back to natural-key recovery).
|
|
7767
|
-
*
|
|
7768
|
-
* Returns `false` for declared v2 sellers, declared v3 sellers, and
|
|
7769
|
-
* synthetic v3 sellers (which advertise the v3 discovery tool even
|
|
7770
|
-
* when the call itself failed).
|
|
7771
|
-
*
|
|
7772
|
-
* Caveat for synthetic v3: the predicate returns `false`, but TTL is
|
|
7773
|
-
* still unknown for those sellers — `getIdempotencyReplayTtlSeconds()`
|
|
7774
|
-
* throws until the agent's capabilities endpoint is fixed (issue
|
|
7775
|
-
* #1217). Retry-policy consumers that need a complete "TTL unknown"
|
|
7776
|
-
* gate should additionally check `getCapabilities()._synthetic`.
|
|
7777
|
-
*/
|
|
7778
|
-
async isSyntheticV2() {
|
|
7779
|
-
const capabilities = await this.getCapabilities();
|
|
7780
|
-
return capabilities._synthetic === true && capabilities.version === "v2";
|
|
7781
|
-
}
|
|
7782
7818
|
/**
|
|
7783
7819
|
* Check if server supports a specific AdCP major version
|
|
7784
7820
|
*/
|
|
7785
7821
|
async supportsVersion(version) {
|
|
7786
7822
|
const capabilities = await this.getCapabilities();
|
|
7787
|
-
return capabilities.majorVersions.includes(
|
|
7823
|
+
return version === 3 && capabilities.majorVersions.includes(3);
|
|
7788
7824
|
}
|
|
7789
7825
|
/**
|
|
7790
7826
|
* Return the seller's declared `adcp.idempotency.replay_ttl_seconds`.
|
|
@@ -7795,8 +7831,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7795
7831
|
*
|
|
7796
7832
|
* Fails closed when the seller is v3 but does not declare the field: the
|
|
7797
7833
|
* spec makes the declaration REQUIRED, and silently defaulting to 24h
|
|
7798
|
-
* would mislead buyers about retry safety.
|
|
7799
|
-
* `undefined` instead of a throw — v2 pre-dates the idempotency envelope.
|
|
7834
|
+
* would mislead buyers about retry safety.
|
|
7800
7835
|
*/
|
|
7801
7836
|
async getIdempotencyReplayTtlSeconds() {
|
|
7802
7837
|
const capabilities = await this.getCapabilities();
|
|
@@ -7805,7 +7840,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7805
7840
|
(0, import_capabilities.assertValidIdempotencyReplayTtlSeconds)(capabilities.idempotency.replayTtlSeconds);
|
|
7806
7841
|
return capabilities.idempotency.replayTtlSeconds;
|
|
7807
7842
|
}
|
|
7808
|
-
if (capabilities.version !== "v3") return void 0;
|
|
7809
7843
|
throw new import_errors.ConfigurationError(
|
|
7810
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.`,
|
|
7811
7845
|
"adcp.idempotency.replay_ttl_seconds"
|
|
@@ -8116,28 +8150,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
8116
8150
|
* 2. `capabilities.idempotency.replayTtlSeconds` present (spec-required
|
|
8117
8151
|
* for real major-3+ sellers)
|
|
8118
8152
|
*
|
|
8119
|
-
*
|
|
8120
|
-
*
|
|
8121
|
-
* compliant v3 seller would declare itself, so absence of a declaration
|
|
8122
|
-
* is taken as evidence of v2. The dispatcher routes the request through
|
|
8123
|
-
* the v2 wire-shape adapter. A one-time warning surfaces the routing
|
|
8124
|
-
* decision so adopters can audit it; retry-safety (idempotency TTL) is
|
|
8125
|
-
* unknown for these sellers and BYOK callers should treat them as such.
|
|
8126
|
-
*
|
|
8127
|
-
* Per-client `allowV2: true` or, when that's undefined,
|
|
8128
|
-
* `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.
|
|
8129
8155
|
*
|
|
8130
8156
|
* Throws `VersionUnsupportedError` with the specific reason on failure.
|
|
8131
8157
|
*/
|
|
8132
8158
|
async requireSupportedMajor(taskType = "request", options) {
|
|
8133
|
-
if (this.isV2Allowed()) return;
|
|
8134
8159
|
const capabilities = await this.getCapabilities(options);
|
|
8160
|
+
this.assertSupportedServer(capabilities);
|
|
8135
8161
|
if (capabilities._synthetic) {
|
|
8136
|
-
|
|
8137
|
-
this.maybeWarnSyntheticV3();
|
|
8138
|
-
} else {
|
|
8139
|
-
this.maybeWarnSyntheticV2();
|
|
8140
|
-
}
|
|
8162
|
+
this.maybeWarnSyntheticV3();
|
|
8141
8163
|
return;
|
|
8142
8164
|
}
|
|
8143
8165
|
const supportedVersions = capabilities.supportedVersions;
|
|
@@ -8168,10 +8190,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
8168
8190
|
async requireV3(taskType = "request") {
|
|
8169
8191
|
return this.requireSupportedMajor(taskType);
|
|
8170
8192
|
}
|
|
8171
|
-
isV2Allowed() {
|
|
8172
|
-
if (this.config.allowV2 !== void 0) return this.config.allowV2 === true;
|
|
8173
|
-
return process.env.ADCP_ALLOW_V2 === "1";
|
|
8174
|
-
}
|
|
8175
8193
|
// ====== STATIC HELPER METHODS ======
|
|
8176
8194
|
/**
|
|
8177
8195
|
* Query a legacy creative-agent named-format catalog.
|