Commit 9f53811
fix(ax-discovery): bind agent card URLs to request origin (#114)
The static AGENT_CARD const hardcoded https://x402.aibtc.com everywhere —
url, documentationUrl, openApiUrl, x402Manifest, and 5 topicDocs entries.
The same code is deployed to x402.aibtc.com and x402.aibtc.dev, so
testnet agents fetching x402.aibtc.dev/.well-known/agent.json received
a card pointing entirely at mainnet. Discovery silently routed testnet
traffic to mainnet endpoints.
Convert AGENT_CARD to buildAgentCard(requestUrl) which derives the base
from new URL(requestUrl).origin. The handler at /.well-known/agent.json
now invokes the builder per request. Network binding is automatic — no
env-flag plumbing required.
Closes #113.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6410003 commit 9f53811
1 file changed
Lines changed: 21 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
1504 | | - | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
1505 | 1509 | | |
1506 | 1510 | | |
1507 | 1511 | | |
1508 | 1512 | | |
1509 | 1513 | | |
1510 | | - | |
| 1514 | + | |
1511 | 1515 | | |
1512 | 1516 | | |
1513 | 1517 | | |
1514 | 1518 | | |
1515 | 1519 | | |
1516 | 1520 | | |
1517 | | - | |
1518 | | - | |
| 1521 | + | |
| 1522 | + | |
1519 | 1523 | | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
1524 | 1528 | | |
1525 | 1529 | | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
1531 | 1535 | | |
1532 | 1536 | | |
1533 | 1537 | | |
| |||
1746 | 1750 | | |
1747 | 1751 | | |
1748 | 1752 | | |
1749 | | - | |
| 1753 | + | |
| 1754 | + | |
1750 | 1755 | | |
1751 | 1756 | | |
1752 | 1757 | | |
| |||
1836 | 1841 | | |
1837 | 1842 | | |
1838 | 1843 | | |
1839 | | - | |
| 1844 | + | |
1840 | 1845 | | |
1841 | 1846 | | |
1842 | 1847 | | |
0 commit comments