@adcp/sdk 12.1.1 → 13.0.0-rc.0
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/README.md +19 -3
- package/bin/adcp-fuzz.js +3 -1
- package/dist/lib/adapters/content-standards-adapter.d.mts +9 -9
- package/dist/lib/adapters/content-standards-adapter.d.ts +9 -9
- package/dist/lib/adapters/content-standards-adapter.d.ts.map +1 -1
- package/dist/lib/adapters/content-standards-adapter.js +22 -22
- package/dist/lib/adapters/content-standards-adapter.js.map +1 -1
- package/dist/lib/adapters/content-standards-adapter.mjs +18 -18
- package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
- package/dist/lib/adapters/index.d.mts +2 -2
- package/dist/lib/adapters/index.d.ts +2 -2
- package/dist/lib/adapters/index.d.ts.map +1 -1
- package/dist/lib/adapters/index.js +10 -10
- package/dist/lib/adapters/index.js.map +1 -1
- package/dist/lib/adapters/index.mjs +9 -9
- package/dist/lib/adapters/index.mjs.map +1 -1
- package/dist/lib/auth/oauth/provider-cache.d.mts +7 -0
- package/dist/lib/auth/oauth/provider-cache.d.ts +8 -0
- package/dist/lib/auth/oauth/provider-cache.d.ts.map +1 -0
- package/dist/lib/auth/oauth/provider-cache.js +44 -0
- package/dist/lib/auth/oauth/provider-cache.js.map +1 -0
- package/dist/lib/auth/oauth/provider-cache.mjs +19 -0
- package/dist/lib/auth/oauth/provider-cache.mjs.map +1 -0
- package/dist/lib/conformance/invariants/uniformError.js +1 -1
- package/dist/lib/conformance/invariants/uniformError.js.map +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs +1 -1
- package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
- package/dist/lib/conformance/runners.js +1 -1
- package/dist/lib/conformance/runners.js.map +1 -1
- package/dist/lib/conformance/runners.mjs +1 -1
- package/dist/lib/conformance/runners.mjs.map +1 -1
- package/dist/lib/conformance/seeder.js +5 -5
- package/dist/lib/conformance/seeder.js.map +1 -1
- package/dist/lib/conformance/seeder.mjs +5 -5
- package/dist/lib/conformance/seeder.mjs.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.d.mts +26 -29
- package/dist/lib/core/ADCPMultiAgentClient.d.ts +26 -29
- package/dist/lib/core/ADCPMultiAgentClient.d.ts.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.js +27 -19
- package/dist/lib/core/ADCPMultiAgentClient.js.map +1 -1
- package/dist/lib/core/ADCPMultiAgentClient.mjs +27 -19
- package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
- package/dist/lib/core/AgentClient.d.mts +148 -138
- package/dist/lib/core/AgentClient.d.ts +148 -138
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/AgentClient.js +174 -85
- package/dist/lib/core/AgentClient.js.map +1 -1
- package/dist/lib/core/AgentClient.mjs +174 -85
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/AsyncHandler.d.mts +18 -16
- package/dist/lib/core/AsyncHandler.d.ts +18 -16
- package/dist/lib/core/AsyncHandler.d.ts.map +1 -1
- package/dist/lib/core/AsyncHandler.js +22 -1
- package/dist/lib/core/AsyncHandler.js.map +1 -1
- package/dist/lib/core/AsyncHandler.mjs +22 -1
- package/dist/lib/core/AsyncHandler.mjs.map +1 -1
- package/dist/lib/core/ConversationTypes.d.mts +6 -2
- package/dist/lib/core/ConversationTypes.d.ts +6 -2
- package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
- package/dist/lib/core/ConversationTypes.js.map +1 -1
- package/dist/lib/core/CreativeAgentClient.d.mts +41 -17
- package/dist/lib/core/CreativeAgentClient.d.ts +41 -17
- package/dist/lib/core/CreativeAgentClient.d.ts.map +1 -1
- package/dist/lib/core/CreativeAgentClient.js +39 -12
- package/dist/lib/core/CreativeAgentClient.js.map +1 -1
- package/dist/lib/core/CreativeAgentClient.mjs +39 -12
- package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +127 -50
- package/dist/lib/core/SingleAgentClient.d.ts +127 -50
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +1617 -177
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +1627 -177
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/core/TaskExecutor.d.mts +9 -0
- package/dist/lib/core/TaskExecutor.d.ts +9 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +136 -43
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +136 -43
- package/dist/lib/core/TaskExecutor.mjs.map +1 -1
- package/dist/lib/index.d.mts +111 -17
- package/dist/lib/index.d.ts +111 -17
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +94 -94
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +93 -94
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +6 -15
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/index.mjs +6 -16
- package/dist/lib/protocols/index.mjs.map +1 -1
- package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-modern.js +87 -12
- package/dist/lib/protocols/mcp-modern.js.map +1 -1
- package/dist/lib/protocols/mcp-modern.mjs +89 -12
- package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +6 -0
- package/dist/lib/server/create-adcp-server.d.ts +6 -0
- package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
- package/dist/lib/server/create-adcp-server.js +295 -48
- package/dist/lib/server/create-adcp-server.js.map +1 -1
- package/dist/lib/server/create-adcp-server.mjs +301 -50
- package/dist/lib/server/create-adcp-server.mjs.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.d.mts +27 -13
- package/dist/lib/server/decisioning/assembly-helpers.d.ts +27 -13
- package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.js +136 -14
- package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/assembly-helpers.mjs +134 -13
- package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/index.d.mts +13 -12
- package/dist/lib/server/decisioning/index.d.ts +13 -12
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js +6 -0
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/index.mjs +9 -3
- package/dist/lib/server/decisioning/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.d.mts +13 -3
- package/dist/lib/server/decisioning/list-helpers.d.ts +13 -3
- package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.js +13 -3
- package/dist/lib/server/decisioning/list-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/list-helpers.mjs +11 -2
- package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.d.mts +5 -3
- package/dist/lib/server/decisioning/manifest-helpers.d.ts +5 -3
- package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.d.mts +2 -2
- package/dist/lib/server/decisioning/proposal/dispatch.d.ts +2 -2
- package/dist/lib/server/decisioning/proposal/dispatch.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.mts +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.ts +1 -1
- package/dist/lib/server/decisioning/proposal/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.d.mts +3 -2
- package/dist/lib/server/decisioning/proposal/lifecycle.d.ts +3 -2
- package/dist/lib/server/decisioning/proposal/lifecycle.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.d.mts +3 -3
- package/dist/lib/server/decisioning/proposal/mock-manager.d.ts +3 -3
- package/dist/lib/server/decisioning/proposal/mock-manager.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.d.mts +10 -6
- package/dist/lib/server/decisioning/proposal/types.d.ts +10 -6
- package/dist/lib/server/decisioning/proposal/types.d.ts.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.js.map +1 -1
- package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +21 -2
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +21 -2
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +754 -81
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +763 -81
- package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.mts +9 -9
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +9 -9
- package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/content-standards.d.mts +16 -16
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +16 -16
- package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.mts +15 -13
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +15 -13
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative.d.mts +12 -11
- package/dist/lib/server/decisioning/specialisms/creative.d.ts +12 -11
- package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.d.mts +25 -15
- package/dist/lib/server/decisioning/specialisms/sales.d.ts +25 -15
- package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -1
- package/dist/lib/server/index.d.mts +3 -3
- package/dist/lib/server/index.d.ts +3 -3
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +72 -72
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/index.mjs +36 -36
- package/dist/lib/server/index.mjs.map +1 -1
- package/dist/lib/server/legacy/v5/index.d.mts +1 -0
- package/dist/lib/server/legacy/v5/index.d.ts +1 -0
- package/dist/lib/server/legacy/v5/index.d.ts.map +1 -1
- package/dist/lib/server/legacy/v5/index.js +74 -1
- package/dist/lib/server/legacy/v5/index.js.map +1 -1
- package/dist/lib/server/legacy/v5/index.mjs +75 -1
- package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
- package/dist/lib/server/responses.d.mts +2 -2
- package/dist/lib/server/responses.d.ts +2 -2
- package/dist/lib/server/responses.js.map +1 -1
- package/dist/lib/server/responses.mjs.map +1 -1
- package/dist/lib/testing/client.js +1 -1
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/client.mjs +1 -1
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.js +6 -6
- package/dist/lib/testing/scenarios/brand-rights.js.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.mjs +6 -6
- package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
- package/dist/lib/testing/scenarios/creative.js +7 -7
- package/dist/lib/testing/scenarios/creative.js.map +1 -1
- package/dist/lib/testing/scenarios/creative.mjs +7 -7
- package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
- package/dist/lib/testing/scenarios/discovery.js +2 -2
- package/dist/lib/testing/scenarios/discovery.js.map +1 -1
- package/dist/lib/testing/scenarios/discovery.mjs +2 -2
- package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
- package/dist/lib/testing/scenarios/edge-cases.js +11 -11
- package/dist/lib/testing/scenarios/edge-cases.js.map +1 -1
- package/dist/lib/testing/scenarios/edge-cases.mjs +11 -11
- package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
- package/dist/lib/testing/scenarios/governance.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/governance.js +16 -22
- package/dist/lib/testing/scenarios/governance.js.map +1 -1
- package/dist/lib/testing/scenarios/governance.mjs +16 -22
- package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.js +5 -5
- package/dist/lib/testing/scenarios/media-buy.js.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.mjs +5 -5
- package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.js +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.js.map +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.mjs +1 -1
- package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.js +4 -3
- package/dist/lib/testing/scenarios/trusted-match.js.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.mjs +4 -3
- package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.d.mts +3 -4
- package/dist/lib/testing/storyboard/shape-drift-hints.d.ts +3 -4
- package/dist/lib/testing/storyboard/shape-drift-hints.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.js +27 -27
- package/dist/lib/testing/storyboard/shape-drift-hints.js.map +1 -1
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs +27 -27
- package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
- package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/task-map.js +43 -5
- package/dist/lib/testing/storyboard/task-map.js.map +1 -1
- package/dist/lib/testing/storyboard/task-map.mjs +43 -5
- package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
- package/dist/lib/testing/test-helpers.d.mts +2 -2
- package/dist/lib/testing/test-helpers.d.ts +2 -2
- package/dist/lib/testing/test-helpers.js.map +1 -1
- package/dist/lib/testing/test-helpers.mjs.map +1 -1
- package/dist/lib/types/adcp.d.mts +14 -14
- package/dist/lib/types/adcp.d.ts +14 -14
- package/dist/lib/types/adcp.d.ts.map +1 -1
- package/dist/lib/types/adcp.js.map +1 -1
- package/dist/lib/types/adcp.mjs.map +1 -1
- package/dist/lib/types/index.d.mts +2 -2
- package/dist/lib/types/index.d.ts +2 -2
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/index.mjs.map +1 -1
- package/dist/lib/utils/capabilities.d.mts +6 -0
- package/dist/lib/utils/capabilities.d.ts +6 -0
- package/dist/lib/utils/capabilities.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.js +4 -0
- package/dist/lib/utils/capabilities.js.map +1 -1
- package/dist/lib/utils/capabilities.mjs +4 -0
- package/dist/lib/utils/capabilities.mjs.map +1 -1
- package/dist/lib/utils/creative-delivery.d.mts +52 -10
- package/dist/lib/utils/creative-delivery.d.ts +52 -10
- package/dist/lib/utils/creative-delivery.d.ts.map +1 -1
- package/dist/lib/utils/creative-delivery.js +104 -9
- package/dist/lib/utils/creative-delivery.js.map +1 -1
- package/dist/lib/utils/creative-delivery.mjs +104 -8
- package/dist/lib/utils/creative-delivery.mjs.map +1 -1
- package/dist/lib/utils/format-assets.d.mts +41 -38
- package/dist/lib/utils/format-assets.d.ts +41 -38
- package/dist/lib/utils/format-assets.d.ts.map +1 -1
- package/dist/lib/utils/format-assets.js +3 -1
- package/dist/lib/utils/format-assets.js.map +1 -1
- package/dist/lib/utils/format-assets.mjs +3 -1
- package/dist/lib/utils/format-assets.mjs.map +1 -1
- package/dist/lib/utils/index.d.mts +8 -8
- package/dist/lib/utils/index.d.ts +8 -8
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +11 -9
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/index.mjs +9 -8
- package/dist/lib/utils/index.mjs.map +1 -1
- package/dist/lib/utils/preview-utils.d.mts +11 -8
- package/dist/lib/utils/preview-utils.d.ts +11 -8
- package/dist/lib/utils/preview-utils.d.ts.map +1 -1
- package/dist/lib/utils/preview-utils.js +4 -4
- package/dist/lib/utils/preview-utils.js.map +1 -1
- package/dist/lib/utils/preview-utils.mjs +3 -3
- package/dist/lib/utils/preview-utils.mjs.map +1 -1
- package/dist/lib/utils/tool-request-schemas.d.mts +2 -2
- package/dist/lib/utils/tool-request-schemas.d.ts +2 -2
- package/dist/lib/v2/projection/aao-reference-formats.json +492 -0
- package/dist/lib/v2/projection/augment-response.d.mts +31 -11
- package/dist/lib/v2/projection/augment-response.d.ts +31 -11
- package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
- package/dist/lib/v2/projection/augment-response.js +233 -27
- package/dist/lib/v2/projection/augment-response.js.map +1 -1
- package/dist/lib/v2/projection/augment-response.mjs +232 -27
- package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
- package/dist/lib/v2/projection/builders.d.mts +7 -6
- package/dist/lib/v2/projection/builders.d.ts +7 -6
- package/dist/lib/v2/projection/builders.d.ts.map +1 -1
- package/dist/lib/v2/projection/builders.js +11 -8
- package/dist/lib/v2/projection/builders.js.map +1 -1
- package/dist/lib/v2/projection/builders.mjs +9 -6
- package/dist/lib/v2/projection/builders.mjs.map +1 -1
- package/dist/lib/v2/projection/catalog-snapshot.d.mts +47 -0
- package/dist/lib/v2/projection/catalog-snapshot.d.ts +48 -0
- package/dist/lib/v2/projection/catalog-snapshot.d.ts.map +1 -0
- package/dist/lib/v2/projection/catalog-snapshot.js +291 -0
- package/dist/lib/v2/projection/catalog-snapshot.js.map +1 -0
- package/dist/lib/v2/projection/catalog-snapshot.mjs +265 -0
- package/dist/lib/v2/projection/catalog-snapshot.mjs.map +1 -0
- package/dist/lib/v2/projection/catalog.d.mts +23 -2
- package/dist/lib/v2/projection/catalog.d.ts +23 -2
- package/dist/lib/v2/projection/catalog.d.ts.map +1 -1
- package/dist/lib/v2/projection/catalog.js +34 -10
- package/dist/lib/v2/projection/catalog.js.map +1 -1
- package/dist/lib/v2/projection/catalog.mjs +33 -10
- package/dist/lib/v2/projection/catalog.mjs.map +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +157 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts +158 -0
- package/dist/lib/v2/projection/creative-delivery.d.ts.map +1 -0
- package/dist/lib/v2/projection/creative-delivery.js +967 -0
- package/dist/lib/v2/projection/creative-delivery.js.map +1 -0
- package/dist/lib/v2/projection/creative-delivery.mjs +941 -0
- package/dist/lib/v2/projection/creative-delivery.mjs.map +1 -0
- package/dist/lib/v2/projection/index.d.mts +8 -6
- package/dist/lib/v2/projection/index.d.ts +8 -6
- package/dist/lib/v2/projection/index.d.ts.map +1 -1
- package/dist/lib/v2/projection/index.js +26 -4
- package/dist/lib/v2/projection/index.js.map +1 -1
- package/dist/lib/v2/projection/index.mjs +28 -4
- package/dist/lib/v2/projection/index.mjs.map +1 -1
- package/dist/lib/v2/projection/legacy-metadata.d.mts +21 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +22 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts.map +1 -0
- package/dist/lib/v2/projection/legacy-metadata.js +73 -0
- package/dist/lib/v2/projection/legacy-metadata.js.map +1 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +45 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs.map +1 -0
- package/dist/lib/v2/projection/types.d.mts +29 -23
- package/dist/lib/v2/projection/types.d.ts +29 -23
- package/dist/lib/v2/projection/types.d.ts.map +1 -1
- package/dist/lib/v2/projection/types.js.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.mts +29 -6
- package/dist/lib/v2/projection/v1-to-v2.d.ts +29 -6
- package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +218 -9
- package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
- package/dist/lib/v2/projection/v1-to-v2.mjs +219 -10
- package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.d.mts +31 -2
- package/dist/lib/v2/projection/v2-to-v1.d.ts +31 -2
- package/dist/lib/v2/projection/v2-to-v1.d.ts.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.js +138 -7
- package/dist/lib/v2/projection/v2-to-v1.js.map +1 -1
- package/dist/lib/v2/projection/v2-to-v1.mjs +135 -6
- package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
- package/dist/lib/v2/projection/write-side.d.mts +12 -13
- package/dist/lib/v2/projection/write-side.d.ts +12 -13
- package/dist/lib/v2/projection/write-side.d.ts.map +1 -1
- package/dist/lib/v2/projection/write-side.js +16 -12
- package/dist/lib/v2/projection/write-side.js.map +1 -1
- package/dist/lib/v2/projection/write-side.mjs +16 -12
- package/dist/lib/v2/projection/write-side.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/docs/guides/BUILD-AN-AGENT.md +7 -2
- package/docs/guides/PREVIEW-ASSET-DURABILITY.md +6 -2
- package/docs/llms.txt +1 -0
- package/examples/README.md +1 -1
- package/examples/batch-preview-test.ts +3 -3
- package/examples/conversation-client.ts +2 -2
- package/examples/debug-preview-response.ts +1 -1
- package/examples/decisioning-platform-broadcast-tv.ts +10 -4
- package/examples/decisioning-platform-mock-seller.ts +16 -9
- package/examples/decisioning-platform-programmatic.ts +18 -7
- package/examples/error-compliant-server.ts +26 -16
- package/examples/generative-creative-demo.ts +7 -19
- package/examples/hello_creative_adapter_ad_server.ts +37 -16
- package/examples/hello_creative_adapter_template.ts +12 -10
- package/examples/hello_seller_adapter_guaranteed.ts +52 -23
- package/examples/hello_seller_adapter_multi_tenant.ts +6 -3
- package/examples/hello_seller_adapter_non_guaranteed.ts +54 -26
- package/examples/hello_seller_adapter_proposal_mode.ts +40 -14
- package/examples/hello_seller_adapter_social.ts +2 -7
- package/examples/inspect-card-formats.ts +1 -1
- package/examples/simple-getting-started.ts +1 -1
- package/examples/test-helpers-demo.ts +1 -1
- package/package.json +2 -2
- package/skills/build-decisioning-creative-template/SKILL.md +11 -11
- package/skills/build-decisioning-platform/advanced/REFERENCE.md +8 -2
|
@@ -2,6 +2,8 @@ import { SingleAgentClient } from './SingleAgentClient.mjs';
|
|
|
2
2
|
import type { SingleAgentClientConfig } from './SingleAgentClient.mjs';
|
|
3
3
|
import type { InputHandler, TaskOptions } from './ConversationTypes.mjs';
|
|
4
4
|
import type { ListCreativeFormatsRequest, ListCreativesRequest, ListCreativesResponse, Format } from '../types/tools.generated.mjs';
|
|
5
|
+
import type { CanonicalListCreativesRequest, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery.mjs';
|
|
6
|
+
import type { LegacyFormatConverter } from '../v2/projection/v1-to-v2.mjs';
|
|
5
7
|
/**
|
|
6
8
|
* Configuration for CreativeAgentClient
|
|
7
9
|
*/
|
|
@@ -12,12 +14,19 @@ export interface CreativeAgentClientConfig extends SingleAgentClientConfig {
|
|
|
12
14
|
protocol?: 'mcp' | 'a2a';
|
|
13
15
|
/** Authentication token if required */
|
|
14
16
|
authToken?: string;
|
|
17
|
+
/** Migration converter for seller-specific legacy creative references. */
|
|
18
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
15
19
|
}
|
|
20
|
+
export type CreativeAgentListTaskOptions = TaskOptions & {
|
|
21
|
+
/** Convert a seller-specific legacy creative reference that the bundled registry cannot map. */
|
|
22
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
23
|
+
};
|
|
16
24
|
/**
|
|
17
25
|
* Creative Agent Client - Specialized client for interacting with creative agents
|
|
18
26
|
*
|
|
19
|
-
* Creative agents provide creative
|
|
20
|
-
*
|
|
27
|
+
* Creative agents provide creative assembly and reusable creative-library services.
|
|
28
|
+
* Creative-library reads are canonical by default: each creative is identified by
|
|
29
|
+
* `format_kind` and, when applicable, `format_option_ref`.
|
|
21
30
|
*
|
|
22
31
|
* @example
|
|
23
32
|
* ```typescript
|
|
@@ -26,26 +35,30 @@ export interface CreativeAgentClientConfig extends SingleAgentClientConfig {
|
|
|
26
35
|
* agentUrl: 'https://creative.adcontextprotocol.org/mcp'
|
|
27
36
|
* });
|
|
28
37
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* const banner = formats.find(f => f.format_id.id === 'display_300x250_image');
|
|
38
|
+
* const { creatives } = await creativeAgent.listCreatives({
|
|
39
|
+
* filters: { statuses: ['approved'] }
|
|
40
|
+
* });
|
|
41
|
+
* const images = creatives.filter(creative => creative.format_kind === 'image');
|
|
34
42
|
* ```
|
|
35
43
|
*/
|
|
36
44
|
export declare class CreativeAgentClient {
|
|
37
45
|
private client;
|
|
38
46
|
private agentUrl;
|
|
47
|
+
private legacyFormatConverter?;
|
|
39
48
|
constructor(config: CreativeAgentClientConfig);
|
|
40
49
|
/**
|
|
41
|
-
* List
|
|
50
|
+
* List a creative agent's legacy named-format catalog.
|
|
51
|
+
*
|
|
52
|
+
* Canonical applications should discover seller-supported declarations through
|
|
53
|
+
* `AgentClient.getProducts()` and use `format_options[]`. This method exists for
|
|
54
|
+
* migration tooling that must inspect the old creative-agent catalog.
|
|
42
55
|
*
|
|
43
56
|
* @param params - Optional filtering parameters
|
|
44
57
|
* @returns Promise resolving to array of creative formats
|
|
45
58
|
*
|
|
46
59
|
* @example
|
|
47
60
|
* ```typescript
|
|
48
|
-
* const formats = await creativeAgent.
|
|
61
|
+
* const formats = await creativeAgent.listFormatsLegacy();
|
|
49
62
|
*
|
|
50
63
|
* // Find by dimensions
|
|
51
64
|
* const banners = formats.filter(f =>
|
|
@@ -53,8 +66,10 @@ export declare class CreativeAgentClient {
|
|
|
53
66
|
* f.renders?.[0]?.dimensions?.height === 250
|
|
54
67
|
* );
|
|
55
68
|
* ```
|
|
69
|
+
*
|
|
70
|
+
* @deprecated Canonical applications discover `format_options[]` through seller products.
|
|
56
71
|
*/
|
|
57
|
-
|
|
72
|
+
listFormatsLegacy(params?: ListCreativeFormatsRequest): Promise<LegacyCreativeFormat[]>;
|
|
58
73
|
/**
|
|
59
74
|
* Find formats by dimensions
|
|
60
75
|
*
|
|
@@ -65,10 +80,10 @@ export declare class CreativeAgentClient {
|
|
|
65
80
|
* @example
|
|
66
81
|
* ```typescript
|
|
67
82
|
* // Find all 300x250 formats
|
|
68
|
-
* const mediumRectangles = await creativeAgent.
|
|
83
|
+
* const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);
|
|
69
84
|
* ```
|
|
70
85
|
*/
|
|
71
|
-
|
|
86
|
+
findLegacyByDimensions(width: number, height: number): Promise<LegacyCreativeFormat[]>;
|
|
72
87
|
/**
|
|
73
88
|
* Find format by ID
|
|
74
89
|
*
|
|
@@ -77,18 +92,18 @@ export declare class CreativeAgentClient {
|
|
|
77
92
|
*
|
|
78
93
|
* @example
|
|
79
94
|
* ```typescript
|
|
80
|
-
* const format = await creativeAgent.
|
|
95
|
+
* const format = await creativeAgent.findLegacyById('display_300x250_image');
|
|
81
96
|
* if (format) {
|
|
82
97
|
* console.log(`Found: ${format.name}`);
|
|
83
98
|
* }
|
|
84
99
|
* ```
|
|
85
100
|
*/
|
|
86
|
-
|
|
101
|
+
findLegacyById(formatId: string): Promise<LegacyCreativeFormat | undefined>;
|
|
87
102
|
/**
|
|
88
103
|
* List creatives in the agent's library
|
|
89
104
|
*
|
|
90
105
|
* @param params - Optional filtering, sorting, and pagination parameters
|
|
91
|
-
* @returns Promise resolving to
|
|
106
|
+
* @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)
|
|
92
107
|
*
|
|
93
108
|
* @example
|
|
94
109
|
* ```typescript
|
|
@@ -96,9 +111,18 @@ export declare class CreativeAgentClient {
|
|
|
96
111
|
* filters: { statuses: ['approved'], has_variables: true },
|
|
97
112
|
* include_variables: true
|
|
98
113
|
* });
|
|
114
|
+
* const imageCreatives = result.creatives.filter(
|
|
115
|
+
* creative => creative.format_kind === 'image'
|
|
116
|
+
* );
|
|
99
117
|
* ```
|
|
100
118
|
*/
|
|
101
|
-
listCreatives(params?:
|
|
119
|
+
listCreatives(params?: CanonicalListCreativesRequest, inputHandler?: InputHandler, options?: CreativeAgentListTaskOptions): Promise<CanonicalListCreativesResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Return the unprojected creative-library wire response.
|
|
122
|
+
*
|
|
123
|
+
* @deprecated Compatibility-only escape hatch for migration and protocol tooling.
|
|
124
|
+
*/
|
|
125
|
+
listCreativesLegacy(params?: ListCreativesRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<ListCreativesResponse>;
|
|
102
126
|
/**
|
|
103
127
|
* Get the agent URL
|
|
104
128
|
*/
|
|
@@ -114,7 +138,7 @@ export declare class CreativeAgentClient {
|
|
|
114
138
|
* Extends the official Format type from the schema with an additional
|
|
115
139
|
* agent_url field for convenience when working with creative agents.
|
|
116
140
|
*/
|
|
117
|
-
export interface
|
|
141
|
+
export interface LegacyCreativeFormat extends Format {
|
|
118
142
|
/** Base URL of the creative agent that provides this format */
|
|
119
143
|
agent_url: string;
|
|
120
144
|
}
|
|
@@ -2,6 +2,8 @@ import { SingleAgentClient } from './SingleAgentClient';
|
|
|
2
2
|
import type { SingleAgentClientConfig } from './SingleAgentClient';
|
|
3
3
|
import type { InputHandler, TaskOptions } from './ConversationTypes';
|
|
4
4
|
import type { ListCreativeFormatsRequest, ListCreativesRequest, ListCreativesResponse, Format } from '../types/tools.generated';
|
|
5
|
+
import type { CanonicalListCreativesRequest, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery';
|
|
6
|
+
import type { LegacyFormatConverter } from '../v2/projection/v1-to-v2';
|
|
5
7
|
/**
|
|
6
8
|
* Configuration for CreativeAgentClient
|
|
7
9
|
*/
|
|
@@ -12,12 +14,19 @@ export interface CreativeAgentClientConfig extends SingleAgentClientConfig {
|
|
|
12
14
|
protocol?: 'mcp' | 'a2a';
|
|
13
15
|
/** Authentication token if required */
|
|
14
16
|
authToken?: string;
|
|
17
|
+
/** Migration converter for seller-specific legacy creative references. */
|
|
18
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
15
19
|
}
|
|
20
|
+
export type CreativeAgentListTaskOptions = TaskOptions & {
|
|
21
|
+
/** Convert a seller-specific legacy creative reference that the bundled registry cannot map. */
|
|
22
|
+
legacyFormatConverter?: LegacyFormatConverter;
|
|
23
|
+
};
|
|
16
24
|
/**
|
|
17
25
|
* Creative Agent Client - Specialized client for interacting with creative agents
|
|
18
26
|
*
|
|
19
|
-
* Creative agents provide creative
|
|
20
|
-
*
|
|
27
|
+
* Creative agents provide creative assembly and reusable creative-library services.
|
|
28
|
+
* Creative-library reads are canonical by default: each creative is identified by
|
|
29
|
+
* `format_kind` and, when applicable, `format_option_ref`.
|
|
21
30
|
*
|
|
22
31
|
* @example
|
|
23
32
|
* ```typescript
|
|
@@ -26,26 +35,30 @@ export interface CreativeAgentClientConfig extends SingleAgentClientConfig {
|
|
|
26
35
|
* agentUrl: 'https://creative.adcontextprotocol.org/mcp'
|
|
27
36
|
* });
|
|
28
37
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* const banner = formats.find(f => f.format_id.id === 'display_300x250_image');
|
|
38
|
+
* const { creatives } = await creativeAgent.listCreatives({
|
|
39
|
+
* filters: { statuses: ['approved'] }
|
|
40
|
+
* });
|
|
41
|
+
* const images = creatives.filter(creative => creative.format_kind === 'image');
|
|
34
42
|
* ```
|
|
35
43
|
*/
|
|
36
44
|
export declare class CreativeAgentClient {
|
|
37
45
|
private client;
|
|
38
46
|
private agentUrl;
|
|
47
|
+
private legacyFormatConverter?;
|
|
39
48
|
constructor(config: CreativeAgentClientConfig);
|
|
40
49
|
/**
|
|
41
|
-
* List
|
|
50
|
+
* List a creative agent's legacy named-format catalog.
|
|
51
|
+
*
|
|
52
|
+
* Canonical applications should discover seller-supported declarations through
|
|
53
|
+
* `AgentClient.getProducts()` and use `format_options[]`. This method exists for
|
|
54
|
+
* migration tooling that must inspect the old creative-agent catalog.
|
|
42
55
|
*
|
|
43
56
|
* @param params - Optional filtering parameters
|
|
44
57
|
* @returns Promise resolving to array of creative formats
|
|
45
58
|
*
|
|
46
59
|
* @example
|
|
47
60
|
* ```typescript
|
|
48
|
-
* const formats = await creativeAgent.
|
|
61
|
+
* const formats = await creativeAgent.listFormatsLegacy();
|
|
49
62
|
*
|
|
50
63
|
* // Find by dimensions
|
|
51
64
|
* const banners = formats.filter(f =>
|
|
@@ -53,8 +66,10 @@ export declare class CreativeAgentClient {
|
|
|
53
66
|
* f.renders?.[0]?.dimensions?.height === 250
|
|
54
67
|
* );
|
|
55
68
|
* ```
|
|
69
|
+
*
|
|
70
|
+
* @deprecated Canonical applications discover `format_options[]` through seller products.
|
|
56
71
|
*/
|
|
57
|
-
|
|
72
|
+
listFormatsLegacy(params?: ListCreativeFormatsRequest): Promise<LegacyCreativeFormat[]>;
|
|
58
73
|
/**
|
|
59
74
|
* Find formats by dimensions
|
|
60
75
|
*
|
|
@@ -65,10 +80,10 @@ export declare class CreativeAgentClient {
|
|
|
65
80
|
* @example
|
|
66
81
|
* ```typescript
|
|
67
82
|
* // Find all 300x250 formats
|
|
68
|
-
* const mediumRectangles = await creativeAgent.
|
|
83
|
+
* const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);
|
|
69
84
|
* ```
|
|
70
85
|
*/
|
|
71
|
-
|
|
86
|
+
findLegacyByDimensions(width: number, height: number): Promise<LegacyCreativeFormat[]>;
|
|
72
87
|
/**
|
|
73
88
|
* Find format by ID
|
|
74
89
|
*
|
|
@@ -77,18 +92,18 @@ export declare class CreativeAgentClient {
|
|
|
77
92
|
*
|
|
78
93
|
* @example
|
|
79
94
|
* ```typescript
|
|
80
|
-
* const format = await creativeAgent.
|
|
95
|
+
* const format = await creativeAgent.findLegacyById('display_300x250_image');
|
|
81
96
|
* if (format) {
|
|
82
97
|
* console.log(`Found: ${format.name}`);
|
|
83
98
|
* }
|
|
84
99
|
* ```
|
|
85
100
|
*/
|
|
86
|
-
|
|
101
|
+
findLegacyById(formatId: string): Promise<LegacyCreativeFormat | undefined>;
|
|
87
102
|
/**
|
|
88
103
|
* List creatives in the agent's library
|
|
89
104
|
*
|
|
90
105
|
* @param params - Optional filtering, sorting, and pagination parameters
|
|
91
|
-
* @returns Promise resolving to
|
|
106
|
+
* @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)
|
|
92
107
|
*
|
|
93
108
|
* @example
|
|
94
109
|
* ```typescript
|
|
@@ -96,9 +111,18 @@ export declare class CreativeAgentClient {
|
|
|
96
111
|
* filters: { statuses: ['approved'], has_variables: true },
|
|
97
112
|
* include_variables: true
|
|
98
113
|
* });
|
|
114
|
+
* const imageCreatives = result.creatives.filter(
|
|
115
|
+
* creative => creative.format_kind === 'image'
|
|
116
|
+
* );
|
|
99
117
|
* ```
|
|
100
118
|
*/
|
|
101
|
-
listCreatives(params?:
|
|
119
|
+
listCreatives(params?: CanonicalListCreativesRequest, inputHandler?: InputHandler, options?: CreativeAgentListTaskOptions): Promise<CanonicalListCreativesResponse>;
|
|
120
|
+
/**
|
|
121
|
+
* Return the unprojected creative-library wire response.
|
|
122
|
+
*
|
|
123
|
+
* @deprecated Compatibility-only escape hatch for migration and protocol tooling.
|
|
124
|
+
*/
|
|
125
|
+
listCreativesLegacy(params?: ListCreativesRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<ListCreativesResponse>;
|
|
102
126
|
/**
|
|
103
127
|
* Get the agent URL
|
|
104
128
|
*/
|
|
@@ -114,7 +138,7 @@ export declare class CreativeAgentClient {
|
|
|
114
138
|
* Extends the official Format type from the schema with an additional
|
|
115
139
|
* agent_url field for convenience when working with creative agents.
|
|
116
140
|
*/
|
|
117
|
-
export interface
|
|
141
|
+
export interface LegacyCreativeFormat extends Format {
|
|
118
142
|
/** Base URL of the creative agent that provides this format */
|
|
119
143
|
agent_url: string;
|
|
120
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreativeAgentClient.d.ts","sourceRoot":"","sources":["../../../src/lib/core/CreativeAgentClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB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;;;;;OAYG;IACG,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAW5F;;;;;;;;;;;;;OAaG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAKjF;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CACjB,MAAM,GAAE,6BAAkC,EAC1C,YAAY,CAAC,EAAE,YAAY,EAC3B,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAc1C;;;;OAIG;IACG,mBAAmB,CACvB,MAAM,GAAE,oBAAyB,EACjC,YAAY,CAAC,EAAE,YAAY,EAC3B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAUjC;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,SAAS,IAAI,iBAAiB;CAG/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,MAAM;IAClD,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,yBAAyB,GAAG,mBAAmB,CAEhG;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;IACnC,6CAA6C;;IAE7C,mDAAmD;;CAE3C,CAAC"}
|
|
@@ -27,6 +27,7 @@ var import_SingleAgentClient = require('./SingleAgentClient.js');
|
|
|
27
27
|
class CreativeAgentClient {
|
|
28
28
|
client;
|
|
29
29
|
agentUrl;
|
|
30
|
+
legacyFormatConverter;
|
|
30
31
|
constructor(config) {
|
|
31
32
|
const agentConfig = {
|
|
32
33
|
id: config.agentUrl.replace(/https?:\/\//, "").replace(/\//g, "_"),
|
|
@@ -37,16 +38,21 @@ class CreativeAgentClient {
|
|
|
37
38
|
};
|
|
38
39
|
this.client = new import_SingleAgentClient.SingleAgentClient(agentConfig, config);
|
|
39
40
|
this.agentUrl = config.agentUrl;
|
|
41
|
+
this.legacyFormatConverter = config.legacyFormatConverter;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
|
-
* List
|
|
44
|
+
* List a creative agent's legacy named-format catalog.
|
|
45
|
+
*
|
|
46
|
+
* Canonical applications should discover seller-supported declarations through
|
|
47
|
+
* `AgentClient.getProducts()` and use `format_options[]`. This method exists for
|
|
48
|
+
* migration tooling that must inspect the old creative-agent catalog.
|
|
43
49
|
*
|
|
44
50
|
* @param params - Optional filtering parameters
|
|
45
51
|
* @returns Promise resolving to array of creative formats
|
|
46
52
|
*
|
|
47
53
|
* @example
|
|
48
54
|
* ```typescript
|
|
49
|
-
* const formats = await creativeAgent.
|
|
55
|
+
* const formats = await creativeAgent.listFormatsLegacy();
|
|
50
56
|
*
|
|
51
57
|
* // Find by dimensions
|
|
52
58
|
* const banners = formats.filter(f =>
|
|
@@ -54,9 +60,11 @@ class CreativeAgentClient {
|
|
|
54
60
|
* f.renders?.[0]?.dimensions?.height === 250
|
|
55
61
|
* );
|
|
56
62
|
* ```
|
|
63
|
+
*
|
|
64
|
+
* @deprecated Canonical applications discover `format_options[]` through seller products.
|
|
57
65
|
*/
|
|
58
|
-
async
|
|
59
|
-
const result = await this.client.
|
|
66
|
+
async listFormatsLegacy(params = {}) {
|
|
67
|
+
const result = await this.client.listCreativeFormatsLegacy(params);
|
|
60
68
|
if (!result.success || !result.data) {
|
|
61
69
|
throw new Error(`Failed to list creative formats: ${result.error || "Unknown error"}`);
|
|
62
70
|
}
|
|
@@ -75,11 +83,11 @@ class CreativeAgentClient {
|
|
|
75
83
|
* @example
|
|
76
84
|
* ```typescript
|
|
77
85
|
* // Find all 300x250 formats
|
|
78
|
-
* const mediumRectangles = await creativeAgent.
|
|
86
|
+
* const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);
|
|
79
87
|
* ```
|
|
80
88
|
*/
|
|
81
|
-
async
|
|
82
|
-
const allFormats = await this.
|
|
89
|
+
async findLegacyByDimensions(width, height) {
|
|
90
|
+
const allFormats = await this.listFormatsLegacy();
|
|
83
91
|
return allFormats.filter(
|
|
84
92
|
(f) => f.renders?.some((r) => {
|
|
85
93
|
if (!("dimensions" in r) || !r.dimensions) return false;
|
|
@@ -96,21 +104,21 @@ class CreativeAgentClient {
|
|
|
96
104
|
*
|
|
97
105
|
* @example
|
|
98
106
|
* ```typescript
|
|
99
|
-
* const format = await creativeAgent.
|
|
107
|
+
* const format = await creativeAgent.findLegacyById('display_300x250_image');
|
|
100
108
|
* if (format) {
|
|
101
109
|
* console.log(`Found: ${format.name}`);
|
|
102
110
|
* }
|
|
103
111
|
* ```
|
|
104
112
|
*/
|
|
105
|
-
async
|
|
106
|
-
const allFormats = await this.
|
|
113
|
+
async findLegacyById(formatId) {
|
|
114
|
+
const allFormats = await this.listFormatsLegacy();
|
|
107
115
|
return allFormats.find((f) => f.format_id.id === formatId);
|
|
108
116
|
}
|
|
109
117
|
/**
|
|
110
118
|
* List creatives in the agent's library
|
|
111
119
|
*
|
|
112
120
|
* @param params - Optional filtering, sorting, and pagination parameters
|
|
113
|
-
* @returns Promise resolving to
|
|
121
|
+
* @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)
|
|
114
122
|
*
|
|
115
123
|
* @example
|
|
116
124
|
* ```typescript
|
|
@@ -118,10 +126,29 @@ class CreativeAgentClient {
|
|
|
118
126
|
* filters: { statuses: ['approved'], has_variables: true },
|
|
119
127
|
* include_variables: true
|
|
120
128
|
* });
|
|
129
|
+
* const imageCreatives = result.creatives.filter(
|
|
130
|
+
* creative => creative.format_kind === 'image'
|
|
131
|
+
* );
|
|
121
132
|
* ```
|
|
122
133
|
*/
|
|
123
134
|
async listCreatives(params = {}, inputHandler, options) {
|
|
124
|
-
const
|
|
135
|
+
const { legacyFormatConverter, ...taskOptions } = options ?? {};
|
|
136
|
+
const result = await this.client.listCreatives(params, inputHandler, {
|
|
137
|
+
...taskOptions,
|
|
138
|
+
legacyFormatConverter: legacyFormatConverter ?? this.legacyFormatConverter
|
|
139
|
+
});
|
|
140
|
+
if (!result.success || !result.data) {
|
|
141
|
+
throw new Error(`Failed to list creatives: ${result.error || "Unknown error"}`);
|
|
142
|
+
}
|
|
143
|
+
return result.data;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Return the unprojected creative-library wire response.
|
|
147
|
+
*
|
|
148
|
+
* @deprecated Compatibility-only escape hatch for migration and protocol tooling.
|
|
149
|
+
*/
|
|
150
|
+
async listCreativesLegacy(params = {}, inputHandler, options) {
|
|
151
|
+
const result = await this.client.listCreativesLegacy(params, inputHandler, options);
|
|
125
152
|
if (!result.success || !result.data) {
|
|
126
153
|
throw new Error(`Failed to list creatives: ${result.error || "Unknown error"}`);
|
|
127
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/core/CreativeAgentClient.ts"],"sourcesContent":["// Creative Agent Client - First-class support for creative agents\n\nimport { SingleAgentClient } from './SingleAgentClient';\nimport type { SingleAgentClientConfig } from './SingleAgentClient';\nimport type { InputHandler, TaskOptions } from './ConversationTypes';\nimport type { AgentConfig } from '../types';\nimport type { FormatReferenceStructuredObject as FormatID } from '../types/core.generated';\nimport type {\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n ListCreativesRequest,\n ListCreativesResponse,\n Format,\n} from '../types/tools.generated';\n\n/**\n * Configuration for CreativeAgentClient\n */\nexport interface CreativeAgentClientConfig extends SingleAgentClientConfig {\n /** Creative agent URL */\n agentUrl: string;\n /** Protocol to use (defaults to 'mcp') */\n protocol?: 'mcp' | 'a2a';\n /** Authentication token if required */\n authToken?: string;\n}\n\n/**\n * Creative Agent Client - Specialized client for interacting with creative agents\n *\n * Creative agents provide creative format catalogs and creative assembly services.\n * This client provides a simplified interface for common creative agent operations.\n *\n * @example\n * ```typescript\n * // Standard creative agent\n * const creativeAgent = new CreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n *\n * // List available formats\n * const formats = await creativeAgent.listFormats();\n *\n * // Find specific format\n * const banner = formats.find(f => f.format_id.id === 'display_300x250_image');\n * ```\n */\nexport class CreativeAgentClient {\n private client: SingleAgentClient;\n private agentUrl: string;\n\n constructor(config: CreativeAgentClientConfig) {\n const agentConfig: AgentConfig = {\n id: config.agentUrl.replace(/https?:\\/\\//, '').replace(/\\//g, '_'),\n name: 'Creative Agent',\n agent_uri: config.agentUrl,\n protocol: config.protocol || 'mcp',\n ...(config.authToken && { auth_token: config.authToken }),\n };\n\n this.client = new SingleAgentClient(agentConfig, config);\n this.agentUrl = config.agentUrl;\n }\n\n /**\n * List all available creative formats\n *\n * @param params - Optional filtering parameters\n * @returns Promise resolving to array of creative formats\n *\n * @example\n * ```typescript\n * const formats = await creativeAgent.listFormats();\n *\n * // Find by dimensions\n * const banners = formats.filter(f =>\n * f.renders?.[0]?.dimensions?.width === 300 &&\n * f.renders?.[0]?.dimensions?.height === 250\n * );\n * ```\n */\n async listFormats(params: ListCreativeFormatsRequest = {}): Promise<CreativeFormat[]> {\n const result = await this.client.listCreativeFormats(params);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creative formats: ${result.error || 'Unknown error'}`);\n }\n\n // Enrich formats with agent_url for convenience\n return (result.data.formats || []).map(format => ({\n ...format,\n agent_url: this.agentUrl,\n }));\n }\n\n /**\n * Find formats by dimensions\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n * @returns Promise resolving to matching formats\n *\n * @example\n * ```typescript\n * // Find all 300x250 formats\n * const mediumRectangles = await creativeAgent.findByDimensions(300, 250);\n * ```\n */\n async findByDimensions(width: number, height: number): Promise<CreativeFormat[]> {\n const allFormats = await this.listFormats();\n return allFormats.filter(f =>\n f.renders?.some(r => {\n if (!('dimensions' in r) || !r.dimensions) return false;\n const dims = r.dimensions as { width?: number; height?: number };\n return dims.width === width && dims.height === height;\n })\n );\n }\n\n /**\n * Find format by ID\n *\n * @param formatId - Format ID to search for\n * @returns Promise resolving to matching format or undefined\n *\n * @example\n * ```typescript\n * const format = await creativeAgent.findById('display_300x250_image');\n * if (format) {\n * console.log(`Found: ${format.name}`);\n * }\n * ```\n */\n async findById(formatId: string): Promise<CreativeFormat | undefined> {\n const allFormats = await this.listFormats();\n return allFormats.find(f => f.format_id.id === formatId);\n }\n\n /**\n * List creatives in the agent's library\n *\n * @param params - Optional filtering, sorting, and pagination parameters\n * @returns Promise resolving to the list creatives response\n *\n * @example\n * ```typescript\n * const result = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'], has_variables: true },\n * include_variables: true\n * });\n * ```\n */\n async listCreatives(\n params: ListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: TaskOptions\n ): Promise<ListCreativesResponse> {\n const result = await this.client.listCreatives(params, inputHandler, options);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Get the agent URL\n */\n getAgentUrl(): string {\n return this.agentUrl;\n }\n\n /**\n * Get the underlying single-agent client for advanced operations\n */\n getClient(): SingleAgentClient {\n return this.client;\n }\n}\n\n/**\n * Creative format definition.\n *\n * Extends the official Format type from the schema with an additional\n * agent_url field for convenience when working with creative agents.\n */\nexport interface CreativeFormat extends Format {\n /** Base URL of the creative agent that provides this format */\n agent_url: string;\n}\n\n/**\n * Factory function to create a creative agent client\n *\n * @param config - Creative agent configuration\n * @returns Configured CreativeAgentClient instance\n *\n * @example\n * ```typescript\n * const creativeAgent = createCreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n * ```\n */\nexport function createCreativeAgentClient(config: CreativeAgentClientConfig): CreativeAgentClient {\n return new CreativeAgentClient(config);\n}\n\n/**\n * Standard creative agent URLs\n */\nexport const STANDARD_CREATIVE_AGENTS = {\n /** Official AdCP reference creative agent */\n ADCP_REFERENCE: 'https://creative.adcontextprotocol.org/mcp',\n /** Official Ad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MAAM,CAAC,EAAE,WAAY,QAAO;AAClD,cAAM,OAAO,EAAE;AACf,eAAO,KAAK,UAAU,SAAS,KAAK,WAAW;AAAA,MACjD,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,SAAS,UAAuD;AACpE,UAAM,aAAa,MAAM,KAAK,YAAY;AAC1C,WAAO,WAAW,KAAK,OAAK,EAAE,UAAU,OAAO,QAAQ;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,cACJ,SAA+B,CAAC,GAChC,cACA,SACgC;AAChC,UAAM,SAAS,MAAM,KAAK,OAAO,cAAc,QAAQ,cAAc,OAAO;AAE5E,QAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;AACnC,YAAM,IAAI,MAAM,6BAA6B,OAAO,SAAS,eAAe,EAAE;AAAA,IAChF;AAEA,WAAO,OAAO;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAsB;AACpB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,YAA+B;AAC7B,WAAO,KAAK;AAAA,EACd;AACF;AA0BO,SAAS,0BAA0B,QAAwD;AAChG,SAAO,IAAI,oBAAoB,MAAM;AACvC;AAKO,MAAM,2BAA2B;AAAA;AAAA,EAEtC,gBAAgB;AAAA;AAAA,EAEhB,oBAAoB;AACtB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/core/CreativeAgentClient.ts"],"sourcesContent":["// Creative Agent Client - First-class support for creative agents\n\nimport { SingleAgentClient } from './SingleAgentClient';\nimport type { SingleAgentClientConfig } from './SingleAgentClient';\nimport type { InputHandler, TaskOptions } from './ConversationTypes';\nimport type { AgentConfig } from '../types';\nimport type {\n ListCreativeFormatsRequest,\n ListCreativesRequest,\n ListCreativesResponse,\n Format,\n} from '../types/tools.generated';\nimport type { CanonicalListCreativesRequest, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery';\nimport type { LegacyFormatConverter } from '../v2/projection/v1-to-v2';\n\n/**\n * Configuration for CreativeAgentClient\n */\nexport interface CreativeAgentClientConfig extends SingleAgentClientConfig {\n /** Creative agent URL */\n agentUrl: string;\n /** Protocol to use (defaults to 'mcp') */\n protocol?: 'mcp' | 'a2a';\n /** Authentication token if required */\n authToken?: string;\n /** Migration converter for seller-specific legacy creative references. */\n legacyFormatConverter?: LegacyFormatConverter;\n}\n\nexport type CreativeAgentListTaskOptions = TaskOptions & {\n /** Convert a seller-specific legacy creative reference that the bundled registry cannot map. */\n legacyFormatConverter?: LegacyFormatConverter;\n};\n\n/**\n * Creative Agent Client - Specialized client for interacting with creative agents\n *\n * Creative agents provide creative assembly and reusable creative-library services.\n * Creative-library reads are canonical by default: each creative is identified by\n * `format_kind` and, when applicable, `format_option_ref`.\n *\n * @example\n * ```typescript\n * // Standard creative agent\n * const creativeAgent = new CreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n *\n * const { creatives } = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'] }\n * });\n * const images = creatives.filter(creative => creative.format_kind === 'image');\n * ```\n */\nexport class CreativeAgentClient {\n private client: SingleAgentClient;\n private agentUrl: string;\n private legacyFormatConverter?: LegacyFormatConverter;\n\n constructor(config: CreativeAgentClientConfig) {\n const agentConfig: AgentConfig = {\n id: config.agentUrl.replace(/https?:\\/\\//, '').replace(/\\//g, '_'),\n name: 'Creative Agent',\n agent_uri: config.agentUrl,\n protocol: config.protocol || 'mcp',\n ...(config.authToken && { auth_token: config.authToken }),\n };\n\n this.client = new SingleAgentClient(agentConfig, config);\n this.agentUrl = config.agentUrl;\n this.legacyFormatConverter = config.legacyFormatConverter;\n }\n\n /**\n * List a creative agent's legacy named-format catalog.\n *\n * Canonical applications should discover seller-supported declarations through\n * `AgentClient.getProducts()` and use `format_options[]`. This method exists for\n * migration tooling that must inspect the old creative-agent catalog.\n *\n * @param params - Optional filtering parameters\n * @returns Promise resolving to array of creative formats\n *\n * @example\n * ```typescript\n * const formats = await creativeAgent.listFormatsLegacy();\n *\n * // Find by dimensions\n * const banners = formats.filter(f =>\n * f.renders?.[0]?.dimensions?.width === 300 &&\n * f.renders?.[0]?.dimensions?.height === 250\n * );\n * ```\n *\n * @deprecated Canonical applications discover `format_options[]` through seller products.\n */\n async listFormatsLegacy(params: ListCreativeFormatsRequest = {}): Promise<LegacyCreativeFormat[]> {\n const result = await this.client.listCreativeFormatsLegacy(params);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creative formats: ${result.error || 'Unknown error'}`);\n }\n\n // Enrich formats with agent_url for convenience\n return (result.data.formats || []).map(format => ({\n ...format,\n agent_url: this.agentUrl,\n }));\n }\n\n /**\n * Find formats by dimensions\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n * @returns Promise resolving to matching formats\n *\n * @example\n * ```typescript\n * // Find all 300x250 formats\n * const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);\n * ```\n */\n async findLegacyByDimensions(width: number, height: number): Promise<LegacyCreativeFormat[]> {\n const allFormats = await this.listFormatsLegacy();\n return allFormats.filter(f =>\n f.renders?.some(r => {\n if (!('dimensions' in r) || !r.dimensions) return false;\n const dims = r.dimensions as { width?: number; height?: number };\n return dims.width === width && dims.height === height;\n })\n );\n }\n\n /**\n * Find format by ID\n *\n * @param formatId - Format ID to search for\n * @returns Promise resolving to matching format or undefined\n *\n * @example\n * ```typescript\n * const format = await creativeAgent.findLegacyById('display_300x250_image');\n * if (format) {\n * console.log(`Found: ${format.name}`);\n * }\n * ```\n */\n async findLegacyById(formatId: string): Promise<LegacyCreativeFormat | undefined> {\n const allFormats = await this.listFormatsLegacy();\n return allFormats.find(f => f.format_id.id === formatId);\n }\n\n /**\n * List creatives in the agent's library\n *\n * @param params - Optional filtering, sorting, and pagination parameters\n * @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)\n *\n * @example\n * ```typescript\n * const result = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'], has_variables: true },\n * include_variables: true\n * });\n * const imageCreatives = result.creatives.filter(\n * creative => creative.format_kind === 'image'\n * );\n * ```\n */\n async listCreatives(\n params: CanonicalListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: CreativeAgentListTaskOptions\n ): Promise<CanonicalListCreativesResponse> {\n const { legacyFormatConverter, ...taskOptions } = options ?? {};\n const result = await this.client.listCreatives(params, inputHandler, {\n ...taskOptions,\n legacyFormatConverter: legacyFormatConverter ?? this.legacyFormatConverter,\n });\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Return the unprojected creative-library wire response.\n *\n * @deprecated Compatibility-only escape hatch for migration and protocol tooling.\n */\n async listCreativesLegacy(\n params: ListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: TaskOptions\n ): Promise<ListCreativesResponse> {\n const result = await this.client.listCreativesLegacy(params, inputHandler, options);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Get the agent URL\n */\n getAgentUrl(): string {\n return this.agentUrl;\n }\n\n /**\n * Get the underlying single-agent client for advanced operations\n */\n getClient(): SingleAgentClient {\n return this.client;\n }\n}\n\n/**\n * Creative format definition.\n *\n * Extends the official Format type from the schema with an additional\n * agent_url field for convenience when working with creative agents.\n */\nexport interface LegacyCreativeFormat extends Format {\n /** Base URL of the creative agent that provides this format */\n agent_url: string;\n}\n\n/**\n * Factory function to create a creative agent client\n *\n * @param config - Creative agent configuration\n * @returns Configured CreativeAgentClient instance\n *\n * @example\n * ```typescript\n * const creativeAgent = createCreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n * ```\n */\nexport function createCreativeAgentClient(config: CreativeAgentClientConfig): CreativeAgentClient {\n return new CreativeAgentClient(config);\n}\n\n/**\n * Standard creative agent URLs\n */\nexport const STANDARD_CREATIVE_AGENTS = {\n /** Official AdCP reference creative agent */\n ADCP_REFERENCE: 'https://creative.adcontextprotocol.org/mcp',\n /** Official AdCP reference creative agent (A2A) */\n ADCP_REFERENCE_A2A: 'https://creative.adcontextprotocol.org/a2a',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,+BAAkC;AAoD3B,MAAM,oBAAoB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAAmC;AAC7C,UAAM,cAA2B;AAAA,MAC/B,IAAI,OAAO,SAAS,QAAQ,eAAe,EAAE,EAAE,QAAQ,OAAO,GAAG;AAAA,MACjE,MAAM;AAAA,MACN,WAAW,OAAO;AAAA,MAClB,UAAU,OAAO,YAAY;AAAA,MAC7B,GAAI,OAAO,aAAa,EAAE,YAAY,OAAO,UAAU;AAAA,IACzD;AAEA,SAAK,SAAS,IAAI,2CAAkB,aAAa,MAAM;AACvD,SAAK,WAAW,OAAO;AACvB,SAAK,wBAAwB,OAAO;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBA,MAAM,kBAAkB,SAAqC,CAAC,GAAoC;AAChG,UAAM,SAAS,MAAM,KAAK,OAAO,0BAA0B,MAAM;AAEjE,QAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;AACnC,YAAM,IAAI,MAAM,oCAAoC,OAAO,SAAS,eAAe,EAAE;AAAA,IACvF;AAGA,YAAQ,OAAO,KAAK,WAAW,CAAC,GAAG,IAAI,aAAW;AAAA,MAChD,GAAG;AAAA,MACH,WAAW,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,KAAK,OAAO,oBAAoB,QAAQ,cAAc,OAAO;AAElF,QAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;AACnC,YAAM,IAAI,MAAM,6BAA6B,OAAO,SAAS,eAAe,EAAE;AAAA,IAChF;AAEA,WAAO,OAAO;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAsB;AACpB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,YAA+B;AAC7B,WAAO,KAAK;AAAA,EACd;AACF;AA0BO,SAAS,0BAA0B,QAAwD;AAChG,SAAO,IAAI,oBAAoB,MAAM;AACvC;AAKO,MAAM,2BAA2B;AAAA;AAAA,EAEtC,gBAAgB;AAAA;AAAA,EAEhB,oBAAoB;AACtB;","names":[]}
|
|
@@ -2,6 +2,7 @@ import { SingleAgentClient } from "./SingleAgentClient.mjs";
|
|
|
2
2
|
class CreativeAgentClient {
|
|
3
3
|
client;
|
|
4
4
|
agentUrl;
|
|
5
|
+
legacyFormatConverter;
|
|
5
6
|
constructor(config) {
|
|
6
7
|
const agentConfig = {
|
|
7
8
|
id: config.agentUrl.replace(/https?:\/\//, "").replace(/\//g, "_"),
|
|
@@ -12,16 +13,21 @@ class CreativeAgentClient {
|
|
|
12
13
|
};
|
|
13
14
|
this.client = new SingleAgentClient(agentConfig, config);
|
|
14
15
|
this.agentUrl = config.agentUrl;
|
|
16
|
+
this.legacyFormatConverter = config.legacyFormatConverter;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
|
-
* List
|
|
19
|
+
* List a creative agent's legacy named-format catalog.
|
|
20
|
+
*
|
|
21
|
+
* Canonical applications should discover seller-supported declarations through
|
|
22
|
+
* `AgentClient.getProducts()` and use `format_options[]`. This method exists for
|
|
23
|
+
* migration tooling that must inspect the old creative-agent catalog.
|
|
18
24
|
*
|
|
19
25
|
* @param params - Optional filtering parameters
|
|
20
26
|
* @returns Promise resolving to array of creative formats
|
|
21
27
|
*
|
|
22
28
|
* @example
|
|
23
29
|
* ```typescript
|
|
24
|
-
* const formats = await creativeAgent.
|
|
30
|
+
* const formats = await creativeAgent.listFormatsLegacy();
|
|
25
31
|
*
|
|
26
32
|
* // Find by dimensions
|
|
27
33
|
* const banners = formats.filter(f =>
|
|
@@ -29,9 +35,11 @@ class CreativeAgentClient {
|
|
|
29
35
|
* f.renders?.[0]?.dimensions?.height === 250
|
|
30
36
|
* );
|
|
31
37
|
* ```
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Canonical applications discover `format_options[]` through seller products.
|
|
32
40
|
*/
|
|
33
|
-
async
|
|
34
|
-
const result = await this.client.
|
|
41
|
+
async listFormatsLegacy(params = {}) {
|
|
42
|
+
const result = await this.client.listCreativeFormatsLegacy(params);
|
|
35
43
|
if (!result.success || !result.data) {
|
|
36
44
|
throw new Error(`Failed to list creative formats: ${result.error || "Unknown error"}`);
|
|
37
45
|
}
|
|
@@ -50,11 +58,11 @@ class CreativeAgentClient {
|
|
|
50
58
|
* @example
|
|
51
59
|
* ```typescript
|
|
52
60
|
* // Find all 300x250 formats
|
|
53
|
-
* const mediumRectangles = await creativeAgent.
|
|
61
|
+
* const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);
|
|
54
62
|
* ```
|
|
55
63
|
*/
|
|
56
|
-
async
|
|
57
|
-
const allFormats = await this.
|
|
64
|
+
async findLegacyByDimensions(width, height) {
|
|
65
|
+
const allFormats = await this.listFormatsLegacy();
|
|
58
66
|
return allFormats.filter(
|
|
59
67
|
(f) => f.renders?.some((r) => {
|
|
60
68
|
if (!("dimensions" in r) || !r.dimensions) return false;
|
|
@@ -71,21 +79,21 @@ class CreativeAgentClient {
|
|
|
71
79
|
*
|
|
72
80
|
* @example
|
|
73
81
|
* ```typescript
|
|
74
|
-
* const format = await creativeAgent.
|
|
82
|
+
* const format = await creativeAgent.findLegacyById('display_300x250_image');
|
|
75
83
|
* if (format) {
|
|
76
84
|
* console.log(`Found: ${format.name}`);
|
|
77
85
|
* }
|
|
78
86
|
* ```
|
|
79
87
|
*/
|
|
80
|
-
async
|
|
81
|
-
const allFormats = await this.
|
|
88
|
+
async findLegacyById(formatId) {
|
|
89
|
+
const allFormats = await this.listFormatsLegacy();
|
|
82
90
|
return allFormats.find((f) => f.format_id.id === formatId);
|
|
83
91
|
}
|
|
84
92
|
/**
|
|
85
93
|
* List creatives in the agent's library
|
|
86
94
|
*
|
|
87
95
|
* @param params - Optional filtering, sorting, and pagination parameters
|
|
88
|
-
* @returns Promise resolving to
|
|
96
|
+
* @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)
|
|
89
97
|
*
|
|
90
98
|
* @example
|
|
91
99
|
* ```typescript
|
|
@@ -93,10 +101,29 @@ class CreativeAgentClient {
|
|
|
93
101
|
* filters: { statuses: ['approved'], has_variables: true },
|
|
94
102
|
* include_variables: true
|
|
95
103
|
* });
|
|
104
|
+
* const imageCreatives = result.creatives.filter(
|
|
105
|
+
* creative => creative.format_kind === 'image'
|
|
106
|
+
* );
|
|
96
107
|
* ```
|
|
97
108
|
*/
|
|
98
109
|
async listCreatives(params = {}, inputHandler, options) {
|
|
99
|
-
const
|
|
110
|
+
const { legacyFormatConverter, ...taskOptions } = options ?? {};
|
|
111
|
+
const result = await this.client.listCreatives(params, inputHandler, {
|
|
112
|
+
...taskOptions,
|
|
113
|
+
legacyFormatConverter: legacyFormatConverter ?? this.legacyFormatConverter
|
|
114
|
+
});
|
|
115
|
+
if (!result.success || !result.data) {
|
|
116
|
+
throw new Error(`Failed to list creatives: ${result.error || "Unknown error"}`);
|
|
117
|
+
}
|
|
118
|
+
return result.data;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Return the unprojected creative-library wire response.
|
|
122
|
+
*
|
|
123
|
+
* @deprecated Compatibility-only escape hatch for migration and protocol tooling.
|
|
124
|
+
*/
|
|
125
|
+
async listCreativesLegacy(params = {}, inputHandler, options) {
|
|
126
|
+
const result = await this.client.listCreativesLegacy(params, inputHandler, options);
|
|
100
127
|
if (!result.success || !result.data) {
|
|
101
128
|
throw new Error(`Failed to list creatives: ${result.error || "Unknown error"}`);
|
|
102
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/core/CreativeAgentClient.ts"],"sourcesContent":["// Creative Agent Client - First-class support for creative agents\n\nimport { SingleAgentClient } from './SingleAgentClient';\nimport type { SingleAgentClientConfig } from './SingleAgentClient';\nimport type { InputHandler, TaskOptions } from './ConversationTypes';\nimport type { AgentConfig } from '../types';\nimport type { FormatReferenceStructuredObject as FormatID } from '../types/core.generated';\nimport type {\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n ListCreativesRequest,\n ListCreativesResponse,\n Format,\n} from '../types/tools.generated';\n\n/**\n * Configuration for CreativeAgentClient\n */\nexport interface CreativeAgentClientConfig extends SingleAgentClientConfig {\n /** Creative agent URL */\n agentUrl: string;\n /** Protocol to use (defaults to 'mcp') */\n protocol?: 'mcp' | 'a2a';\n /** Authentication token if required */\n authToken?: string;\n}\n\n/**\n * Creative Agent Client - Specialized client for interacting with creative agents\n *\n * Creative agents provide creative format catalogs and creative assembly services.\n * This client provides a simplified interface for common creative agent operations.\n *\n * @example\n * ```typescript\n * // Standard creative agent\n * const creativeAgent = new CreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n *\n * // List available formats\n * const formats = await creativeAgent.listFormats();\n *\n * // Find specific format\n * const banner = formats.find(f => f.format_id.id === 'display_300x250_image');\n * ```\n */\nexport class CreativeAgentClient {\n private client: SingleAgentClient;\n private agentUrl: string;\n\n constructor(config: CreativeAgentClientConfig) {\n const agentConfig: AgentConfig = {\n id: config.agentUrl.replace(/https?:\\/\\//, '').replace(/\\//g, '_'),\n name: 'Creative Agent',\n agent_uri: config.agentUrl,\n protocol: config.protocol || 'mcp',\n ...(config.authToken && { auth_token: config.authToken }),\n };\n\n this.client = new SingleAgentClient(agentConfig, config);\n this.agentUrl = config.agentUrl;\n }\n\n /**\n * List all available creative formats\n *\n * @param params - Optional filtering parameters\n * @returns Promise resolving to array of creative formats\n *\n * @example\n * ```typescript\n * const formats = await creativeAgent.listFormats();\n *\n * // Find by dimensions\n * const banners = formats.filter(f =>\n * f.renders?.[0]?.dimensions?.width === 300 &&\n * f.renders?.[0]?.dimensions?.height === 250\n * );\n * ```\n */\n async listFormats(params: ListCreativeFormatsRequest = {}): Promise<CreativeFormat[]> {\n const result = await this.client.listCreativeFormats(params);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creative formats: ${result.error || 'Unknown error'}`);\n }\n\n // Enrich formats with agent_url for convenience\n return (result.data.formats || []).map(format => ({\n ...format,\n agent_url: this.agentUrl,\n }));\n }\n\n /**\n * Find formats by dimensions\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n * @returns Promise resolving to matching formats\n *\n * @example\n * ```typescript\n * // Find all 300x250 formats\n * const mediumRectangles = await creativeAgent.findByDimensions(300, 250);\n * ```\n */\n async findByDimensions(width: number, height: number): Promise<CreativeFormat[]> {\n const allFormats = await this.listFormats();\n return allFormats.filter(f =>\n f.renders?.some(r => {\n if (!('dimensions' in r) || !r.dimensions) return false;\n const dims = r.dimensions as { width?: number; height?: number };\n return dims.width === width && dims.height === height;\n })\n );\n }\n\n /**\n * Find format by ID\n *\n * @param formatId - Format ID to search for\n * @returns Promise resolving to matching format or undefined\n *\n * @example\n * ```typescript\n * const format = await creativeAgent.findById('display_300x250_image');\n * if (format) {\n * console.log(`Found: ${format.name}`);\n * }\n * ```\n */\n async findById(formatId: string): Promise<CreativeFormat | undefined> {\n const allFormats = await this.listFormats();\n return allFormats.find(f => f.format_id.id === formatId);\n }\n\n /**\n * List creatives in the agent's library\n *\n * @param params - Optional filtering, sorting, and pagination parameters\n * @returns Promise resolving to the list creatives response\n *\n * @example\n * ```typescript\n * const result = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'], has_variables: true },\n * include_variables: true\n * });\n * ```\n */\n async listCreatives(\n params: ListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: TaskOptions\n ): Promise<ListCreativesResponse> {\n const result = await this.client.listCreatives(params, inputHandler, options);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Get the agent URL\n */\n getAgentUrl(): string {\n return this.agentUrl;\n }\n\n /**\n * Get the underlying single-agent client for advanced operations\n */\n getClient(): SingleAgentClient {\n return this.client;\n }\n}\n\n/**\n * Creative format definition.\n *\n * Extends the official Format type from the schema with an additional\n * agent_url field for convenience when working with creative agents.\n */\nexport interface CreativeFormat extends Format {\n /** Base URL of the creative agent that provides this format */\n agent_url: string;\n}\n\n/**\n * Factory function to create a creative agent client\n *\n * @param config - Creative agent configuration\n * @returns Configured CreativeAgentClient instance\n *\n * @example\n * ```typescript\n * const creativeAgent = createCreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n * ```\n */\nexport function createCreativeAgentClient(config: CreativeAgentClientConfig): CreativeAgentClient {\n return new CreativeAgentClient(config);\n}\n\n/**\n * Standard creative agent URLs\n */\nexport const STANDARD_CREATIVE_AGENTS = {\n /** Official AdCP reference creative agent */\n ADCP_REFERENCE: 'https://creative.adcontextprotocol.org/mcp',\n /** Official AdCP reference creative agent (A2A) */\n ADCP_REFERENCE_A2A: 'https://creative.adcontextprotocol.org/a2a',\n} as const;\n"],"mappings":"AAEA,SAAS,yBAAyB;AA6C3B,MAAM,oBAAoB;AAAA,EACvB;AAAA,EACA;AAAA,EAER,YAAY,QAAmC;AAC7C,UAAM,cAA2B;AAAA,MAC/B,IAAI,OAAO,SAAS,QAAQ,eAAe,EAAE,EAAE,QAAQ,OAAO,GAAG;AAAA,MACjE,MAAM;AAAA,MACN,WAAW,OAAO;AAAA,MAClB,UAAU,OAAO,YAAY;AAAA,MAC7B,GAAI,OAAO,aAAa,EAAE,YAAY,OAAO,UAAU;AAAA,IACzD;AAEA,SAAK,SAAS,IAAI,kB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gC;AAChC,UAAM,SAAS,MAAM,KAAK,OAAO,cAAc,QAAQ,cAAc,OAAO;AAE5E,QAAI,CAAC,OAAO,WAAW,CAAC,OAAO,MAAM;AACnC,YAAM,IAAI,MAAM,6BAA6B,OAAO,SAAS,eAAe,EAAE;AAAA,IAChF;AAEA,WAAO,OAAO;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,cAAsB;AACpB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,YAA+B;AAC7B,WAAO,KAAK;AAAA,EACd;AACF;AA0BO,SAAS,0BAA0B,QAAwD;AAChG,SAAO,IAAI,oBAAoB,MAAM;AACvC;AAKO,MAAM,2BAA2B;AAAA;AAAA,EAEtC,gBAAgB;AAAA;AAAA,EAEhB,oBAAoB;AACtB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/core/CreativeAgentClient.ts"],"sourcesContent":["// Creative Agent Client - First-class support for creative agents\n\nimport { SingleAgentClient } from './SingleAgentClient';\nimport type { SingleAgentClientConfig } from './SingleAgentClient';\nimport type { InputHandler, TaskOptions } from './ConversationTypes';\nimport type { AgentConfig } from '../types';\nimport type {\n ListCreativeFormatsRequest,\n ListCreativesRequest,\n ListCreativesResponse,\n Format,\n} from '../types/tools.generated';\nimport type { CanonicalListCreativesRequest, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery';\nimport type { LegacyFormatConverter } from '../v2/projection/v1-to-v2';\n\n/**\n * Configuration for CreativeAgentClient\n */\nexport interface CreativeAgentClientConfig extends SingleAgentClientConfig {\n /** Creative agent URL */\n agentUrl: string;\n /** Protocol to use (defaults to 'mcp') */\n protocol?: 'mcp' | 'a2a';\n /** Authentication token if required */\n authToken?: string;\n /** Migration converter for seller-specific legacy creative references. */\n legacyFormatConverter?: LegacyFormatConverter;\n}\n\nexport type CreativeAgentListTaskOptions = TaskOptions & {\n /** Convert a seller-specific legacy creative reference that the bundled registry cannot map. */\n legacyFormatConverter?: LegacyFormatConverter;\n};\n\n/**\n * Creative Agent Client - Specialized client for interacting with creative agents\n *\n * Creative agents provide creative assembly and reusable creative-library services.\n * Creative-library reads are canonical by default: each creative is identified by\n * `format_kind` and, when applicable, `format_option_ref`.\n *\n * @example\n * ```typescript\n * // Standard creative agent\n * const creativeAgent = new CreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n *\n * const { creatives } = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'] }\n * });\n * const images = creatives.filter(creative => creative.format_kind === 'image');\n * ```\n */\nexport class CreativeAgentClient {\n private client: SingleAgentClient;\n private agentUrl: string;\n private legacyFormatConverter?: LegacyFormatConverter;\n\n constructor(config: CreativeAgentClientConfig) {\n const agentConfig: AgentConfig = {\n id: config.agentUrl.replace(/https?:\\/\\//, '').replace(/\\//g, '_'),\n name: 'Creative Agent',\n agent_uri: config.agentUrl,\n protocol: config.protocol || 'mcp',\n ...(config.authToken && { auth_token: config.authToken }),\n };\n\n this.client = new SingleAgentClient(agentConfig, config);\n this.agentUrl = config.agentUrl;\n this.legacyFormatConverter = config.legacyFormatConverter;\n }\n\n /**\n * List a creative agent's legacy named-format catalog.\n *\n * Canonical applications should discover seller-supported declarations through\n * `AgentClient.getProducts()` and use `format_options[]`. This method exists for\n * migration tooling that must inspect the old creative-agent catalog.\n *\n * @param params - Optional filtering parameters\n * @returns Promise resolving to array of creative formats\n *\n * @example\n * ```typescript\n * const formats = await creativeAgent.listFormatsLegacy();\n *\n * // Find by dimensions\n * const banners = formats.filter(f =>\n * f.renders?.[0]?.dimensions?.width === 300 &&\n * f.renders?.[0]?.dimensions?.height === 250\n * );\n * ```\n *\n * @deprecated Canonical applications discover `format_options[]` through seller products.\n */\n async listFormatsLegacy(params: ListCreativeFormatsRequest = {}): Promise<LegacyCreativeFormat[]> {\n const result = await this.client.listCreativeFormatsLegacy(params);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creative formats: ${result.error || 'Unknown error'}`);\n }\n\n // Enrich formats with agent_url for convenience\n return (result.data.formats || []).map(format => ({\n ...format,\n agent_url: this.agentUrl,\n }));\n }\n\n /**\n * Find formats by dimensions\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n * @returns Promise resolving to matching formats\n *\n * @example\n * ```typescript\n * // Find all 300x250 formats\n * const mediumRectangles = await creativeAgent.findLegacyByDimensions(300, 250);\n * ```\n */\n async findLegacyByDimensions(width: number, height: number): Promise<LegacyCreativeFormat[]> {\n const allFormats = await this.listFormatsLegacy();\n return allFormats.filter(f =>\n f.renders?.some(r => {\n if (!('dimensions' in r) || !r.dimensions) return false;\n const dims = r.dimensions as { width?: number; height?: number };\n return dims.width === width && dims.height === height;\n })\n );\n }\n\n /**\n * Find format by ID\n *\n * @param formatId - Format ID to search for\n * @returns Promise resolving to matching format or undefined\n *\n * @example\n * ```typescript\n * const format = await creativeAgent.findLegacyById('display_300x250_image');\n * if (format) {\n * console.log(`Found: ${format.name}`);\n * }\n * ```\n */\n async findLegacyById(formatId: string): Promise<LegacyCreativeFormat | undefined> {\n const allFormats = await this.listFormatsLegacy();\n return allFormats.find(f => f.format_id.id === formatId);\n }\n\n /**\n * List creatives in the agent's library\n *\n * @param params - Optional filtering, sorting, and pagination parameters\n * @returns Promise resolving to canonical creatives (`format_kind`, never `format_id`)\n *\n * @example\n * ```typescript\n * const result = await creativeAgent.listCreatives({\n * filters: { statuses: ['approved'], has_variables: true },\n * include_variables: true\n * });\n * const imageCreatives = result.creatives.filter(\n * creative => creative.format_kind === 'image'\n * );\n * ```\n */\n async listCreatives(\n params: CanonicalListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: CreativeAgentListTaskOptions\n ): Promise<CanonicalListCreativesResponse> {\n const { legacyFormatConverter, ...taskOptions } = options ?? {};\n const result = await this.client.listCreatives(params, inputHandler, {\n ...taskOptions,\n legacyFormatConverter: legacyFormatConverter ?? this.legacyFormatConverter,\n });\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Return the unprojected creative-library wire response.\n *\n * @deprecated Compatibility-only escape hatch for migration and protocol tooling.\n */\n async listCreativesLegacy(\n params: ListCreativesRequest = {},\n inputHandler?: InputHandler,\n options?: TaskOptions\n ): Promise<ListCreativesResponse> {\n const result = await this.client.listCreativesLegacy(params, inputHandler, options);\n\n if (!result.success || !result.data) {\n throw new Error(`Failed to list creatives: ${result.error || 'Unknown error'}`);\n }\n\n return result.data;\n }\n\n /**\n * Get the agent URL\n */\n getAgentUrl(): string {\n return this.agentUrl;\n }\n\n /**\n * Get the underlying single-agent client for advanced operations\n */\n getClient(): SingleAgentClient {\n return this.client;\n }\n}\n\n/**\n * Creative format definition.\n *\n * Extends the official Format type from the schema with an additional\n * agent_url field for convenience when working with creative agents.\n */\nexport interface LegacyCreativeFormat extends Format {\n /** Base URL of the creative agent that provides this format */\n agent_url: string;\n}\n\n/**\n * Factory function to create a creative agent client\n *\n * @param config - Creative agent configuration\n * @returns Configured CreativeAgentClient instance\n *\n * @example\n * ```typescript\n * const creativeAgent = createCreativeAgentClient({\n * agentUrl: 'https://creative.adcontextprotocol.org/mcp'\n * });\n * ```\n */\nexport function createCreativeAgentClient(config: CreativeAgentClientConfig): CreativeAgentClient {\n return new CreativeAgentClient(config);\n}\n\n/**\n * Standard creative agent URLs\n */\nexport const STANDARD_CREATIVE_AGENTS = {\n /** Official AdCP reference creative agent */\n ADCP_REFERENCE: 'https://creative.adcontextprotocol.org/mcp',\n /** Official AdCP reference creative agent (A2A) */\n ADCP_REFERENCE_A2A: 'https://creative.adcontextprotocol.org/a2a',\n} as const;\n"],"mappings":"AAEA,SAAS,yBAAyB;AAoD3B,MAAM,oBAAoB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAAmC;AAC7C,UAAM,cAA2B;AAAA,MAC/B,IAAI,OAAO,SAAS,QAAQ,eAAe,EAAE,EAAE,QAAQ,OAAO,GAAG;AAAA,M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