Commit 1c4e57d
feat(adagents): fetch_agent_authorizations_from_directory for AAO inverse lookup (#769)
* feat(adagents): fetch_agent_authorizations_from_directory for AAO inverse lookup (closes #746)
Adds a client function for the AAO directory's `GET /v1/agents/{agent_url}/publishers`
endpoint (adcp#4823 / #4828) — the inverse-lookup path that returns the set
of publishers whose adagents.json authorizes a given agent_url. Result is a
typed `AgentAuthorizationsDirectoryResult` (Pydantic, validated against the
real wire body). A 404 from the directory is the "not indexed" answer and
surfaces as a result with `publishers=[]`; timeouts raise
`AdagentsTimeoutError`; malformed or schema-noncompliant responses raise
`AdagentsValidationError`.
The directory's answer is *discovery*, not authorization — callers should
still verify each returned `publisher_domain` via `fetch_adagents` before
trusting the edge. Same SSRF gates apply (HTTPS only, DNS pre-check,
private/reserved address ban, 5 MiB body cap, no redirect follow).
Also bumps the schema pin to 3.1.0-beta.2 so `schemas/cache/` includes
`aao/agent-publishers.json`. Full Pydantic regen is deferred —
datamodel-code-generator mis-resolves `../enums/channels.json` when the
chain originates at a depth-0 schema (root-level `adagents.json` now
transitively references the new `core/product-format-declaration.json`,
which itself uses `../enums/...`). The hand-written models in this PR are
scoped to the new endpoint; unblocking full regen is tracked separately.
Tests use `httpx.MockTransport` to exercise the real wire shape end-to-end
and assert against `.model_validate()` on the Pydantic classes — covering
happy path, 404 → empty, `since` cursor passthrough, timeout, malformed
JSON, schema-mismatch, non-HTTPS guard, and 5xx surface.
Refs salesagent #511.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(adagents): scope PR to function add only; revert schema-pin bump
The 3.1.0-beta.2 bundle introduces spec drift well beyond this PR's
scope — `cache_scope` becomes required on product responses, new
`sponsored-intelligence` specialism + `search_brands` webhook task type,
new `validate_input_brand_claims` endpoint. Each of those needs its own
focused change (constant updates, fixture refreshes, capability surface
work); bundling them with the AAO inverse-lookup function would block
landing both.
This commit:
- Reverts ADCP_VERSION to 3.0.7 (the prior pin).
- Drops `schemas/cache/3.1.0-beta.2/` from the tree; the new
`fetch_agent_authorizations_from_directory` works with hand-written
Pydantic models and does not need the v3.1 bundle on disk.
- Regenerates `tests/fixtures/public_api_snapshot.json` to record the
intentional new public exports (function + result types).
The v3.1 schema-pin bump (and the codegen `../`-resolution fix noted in
the PR body) move to a separate PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 062c6f0 commit 1c4e57d
4 files changed
Lines changed: 409 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| |||
821 | 826 | | |
822 | 827 | | |
823 | 828 | | |
| 829 | + | |
824 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
825 | 834 | | |
826 | 835 | | |
827 | 836 | | |
828 | 837 | | |
829 | 838 | | |
| 839 | + | |
830 | 840 | | |
831 | 841 | | |
832 | 842 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
1773 | 1776 | | |
1774 | 1777 | | |
1775 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
352 | 356 | | |
353 | 357 | | |
354 | 358 | | |
| 359 | + | |
355 | 360 | | |
356 | 361 | | |
357 | 362 | | |
| |||
0 commit comments