feat: response builders that eliminate media buy traps#526
Merged
Conversation
Add validActionsForStatus() utility that maps MediaBuyStatus to the correct set of buyer actions, eliminating the common trap of forgetting valid_actions in responses. Enhance mediaBuyResponse() with auto-defaults: revision defaults to 1, confirmed_at defaults to now, valid_actions populated from status. Enhance updateMediaBuyResponse() with valid_actions auto-population from status when not explicitly provided. Add cancelMediaBuyResponse() convenience builder that requires canceled_by and revision, auto-sets canceled_at and status/valid_actions. Sync schemas from latest AdCP (reporting_capabilities now required on products, media_buy.reporting removed, object-presence pattern for content_standards/audience_targeting/conversion_tracking). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…umbers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update SDK Quick Reference tables and code examples in build-seller-agent, build-generative-seller-agent, and build-retail-media-agent skills to document validActionsForStatus, cancelMediaBuyResponse, and the auto-defaults on mediaBuyResponse/updateMediaBuyResponse. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validActionsForStatus(status)— mapsMediaBuyStatusto the correct set of buyer actions. Terminal statuses return[], active returns the full set. Exported from@adcp/client/server.mediaBuyResponse()auto-defaults —revision: 1,confirmed_at: now(), andvalid_actionsfrom status when not explicitly provided. Existing callers unaffected (explicit values always win).updateMediaBuyResponse()auto-defaults —valid_actionsfrom status when not explicitly provided.cancelMediaBuyResponse(input)— requirescanceled_byandrevision, auto-setscanceled_at,status: 'canceled',valid_actions: []. Makes it impossible to forget cancellation metadata.reporting_capabilitiesnow required on products,media_buy.reportingremoved from capabilities, object-presence pattern active).These address implementation traps documented in #502 where agent builders were getting response shapes wrong for revision, valid_actions, cancellation metadata, and account setup nesting.
Test plan
🤖 Generated with Claude Code