Skip to content

Commit d09309a

Browse files
bokelleyclaude
andcommitted
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>
1 parent dccae2e commit d09309a

666 files changed

Lines changed: 556505 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "A2UI Bound Value",
4+
"description": "A value that can be a literal or bound to a path in the data model",
5+
"oneOf": [
6+
{
7+
"type": "object",
8+
"description": "Literal string value",
9+
"properties": {
10+
"literalString": {
11+
"type": "string",
12+
"description": "Static string value"
13+
}
14+
},
15+
"required": [
16+
"literalString"
17+
],
18+
"additionalProperties": false
19+
},
20+
{
21+
"type": "object",
22+
"description": "Literal number value",
23+
"properties": {
24+
"literalNumber": {
25+
"type": "number",
26+
"description": "Static number value"
27+
}
28+
},
29+
"required": [
30+
"literalNumber"
31+
],
32+
"additionalProperties": false
33+
},
34+
{
35+
"type": "object",
36+
"description": "Literal boolean value",
37+
"properties": {
38+
"literalBoolean": {
39+
"type": "boolean",
40+
"description": "Static boolean value"
41+
}
42+
},
43+
"required": [
44+
"literalBoolean"
45+
],
46+
"additionalProperties": false
47+
},
48+
{
49+
"type": "object",
50+
"description": "Path to data model value",
51+
"properties": {
52+
"path": {
53+
"type": "string",
54+
"description": "JSON pointer path to value in data model (e.g., '/products/0/title')"
55+
}
56+
},
57+
"required": [
58+
"path"
59+
],
60+
"additionalProperties": false
61+
},
62+
{
63+
"type": "object",
64+
"description": "Literal with path binding (sets default and binds)",
65+
"properties": {
66+
"literalString": {
67+
"type": "string"
68+
},
69+
"path": {
70+
"type": "string"
71+
}
72+
},
73+
"required": [
74+
"literalString",
75+
"path"
76+
],
77+
"additionalProperties": false
78+
}
79+
]
80+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "A2UI Component",
4+
"description": "A component in an A2UI surface",
5+
"type": "object",
6+
"properties": {
7+
"id": {
8+
"type": "string",
9+
"description": "Unique identifier for this component within the surface"
10+
},
11+
"parentId": {
12+
"type": "string",
13+
"description": "ID of the parent component (null for root)"
14+
},
15+
"component": {
16+
"type": "object",
17+
"description": "Component definition (keyed by component type)",
18+
"minProperties": 1,
19+
"maxProperties": 1,
20+
"additionalProperties": {
21+
"type": "object",
22+
"description": "Component properties"
23+
}
24+
}
25+
},
26+
"required": [
27+
"id",
28+
"component"
29+
],
30+
"additionalProperties": true
31+
}

0 commit comments

Comments
 (0)