feat: flatten payment_required_header to kwargs; delete PaymentRequiredHeaderInput - #36
Merged
Merged
Conversation
…erInput
Drops the wrapper for the x402 PAYMENT-REQUIRED header builder:
- payment_required_header(PaymentRequiredHeaderInput(x402_version=..., accepts=..., resource=...))
→ payment_required_header(*, x402_version, accepts, resource=None)
Internal callers updated:
- challenge/respond_402.py — drops the wrapper-bridge introduced in 303a;
respond_402's public `x402: dict` kwarg now flows straight through.
- payment/headers.py — build_payment_headers' x402 branch
- discovery/probe.py — discovery probe's PAYMENT-REQUIRED header
Deleted from public exports: PaymentRequiredHeaderInput.
Tests: 1031 passed / 3 skipped, 95.04% coverage. ty + ruff clean.
Vulture: only the known false positives remain (string-form cast + Protocol
method param in untouched modules).
Co-Authored-By: Claude Opus 4.7 (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
Drops the wrapper for
payment_required_header— the x402 PAYMENT-REQUIRED header builder.payment_required_header(PaymentRequiredHeaderInput(x402_version=..., accepts=..., resource=...))payment_required_header(*, x402_version, accepts, resource=None)Also drops the wrapper-bridge
respond_402carried since #32 — its publicx402: dictkwarg now flows straight topayment_required_header(**x402)without re-wrapping.Internal callers updated
challenge/respond_402.pypayment/headers.py(build_payment_headersx402 branch)discovery/probe.py(discovery probe PAYMENT-REQUIRED header)Deleted from exports
PaymentRequiredHeaderInput.Test plan
uv run pytest tests/— 1031 passed / 3 skipped, 95.04% coverageuv run ty check agentscore_commerce/— cleanuv run ruff check . && uv run ruff format .— cleanuv run vulture agentscore_commerce/ --min-confidence 80— only the known string-cast / Protocol-param false positives remain (unchanged from main)