feat: initial agent-reviewer meta-agent

A2A agent that audits another deployed agent's source pre-deploy.
Reads the target Gitea repo via a short-lived read-only token minted
through ctx.mint_gitea_token(), runs an inner DeepAgents graph backed
by GiteaBackend, and emits a typed ReviewReport.

Skill bundles:
- security-anti-patterns (credentials, eval, sandbox bypass, egress)
- a2apack-best-practices (class shape, decorators, types, timeouts)
- grant-scope-evaluation (declared vs actual workspace scope)

Tools:
- sandbox_a2a_card  : round-trips the project through microsandbox
- sandbox_ruff_check: objective static checks
- submit_review_report: typed final report

7 smoke tests pass; agent card loads cleanly via `a2a card`.
This commit is contained in:
robert
2026-05-28 09:59:40 -03:00
commit 64a601a85a
17 changed files with 1065 additions and 0 deletions

48
README.md Normal file
View File

@@ -0,0 +1,48 @@
# agent-reviewer
Pre-deploy audit agent. Reads another agent's source from Gitea, applies
three skill bundles (security, A2A Pack best practices, grant scope), and
returns a typed `ReviewReport`.
## Skill: `review`
```
review(agent_name: str, ref: str = "main", owner: str | None = None) -> ReviewReport
```
Workflow:
1. Mint a short-lived **read-only** Gitea token via the control plane.
2. Spin up a DeepAgents graph backed by a `GiteaBackend` pointed at
`{owner}/{agent_name}@{ref}`.
3. Read the source, consult the bundled skills, run sandbox checks
(`a2a card`, `ruff`), produce findings.
4. Release the Gitea token in `finally`.
## Output
`ReviewReport`:
```python
class Finding(BaseModel):
severity: "critical" | "warning" | "info"
category: "security" | "correctness" | "ergonomics" | "policy" | "scope"
message: str
file: str | None
line: int | None
suggestion: str | None
class ReviewReport(BaseModel):
ok: bool # True iff zero critical findings
agent_name: str
ref: str
summary: str
findings: list[Finding]
```
## Operational notes
- Read-only by design. Never writes to the target repo, never deploys.
- Uses the `meta-agent-reader` Gitea service user via the platform's
`POST /v1/platform/gitea-token` endpoint.
- Caller must run through the orchestrator (cp_jwt is forwarded).