Skip to content

Commit f051711

Browse files
vvillait88claude
andauthored
Release v1.8.0 — typed SessionPollNextSteps + ty type checker (#15)
## Summary - `SessionPollNextSteps` is now a proper TypedDict (was `NotRequired[dict]`). Fields: `action`, `user_message`, `support_email?`, `support_subject?`. - Raises Python floor 3.9 → 3.11 — the code already used `typing.NotRequired` (3.11+). Old floor was misleading. - Adds Astral's `ty` type checker as a dev dep, wired into lefthook pre-push + CI. - Bumps package to 1.8.0 (minor). ## Test plan - [ ] uv sync --frozen --all-extras - [ ] uv run ruff check . && uv run ruff format --check . - [ ] uv run ty check agentscore/ - [ ] uv run pytest tests/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 268c610 commit f051711

8 files changed

Lines changed: 80 additions & 301 deletions

File tree

‎.claude/CLAUDE.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,26 @@ Single-package Python library published to PyPI.
2828

2929
- **uv** — package manager. Use `uv sync`, `uv run`.
3030
- **ruff** — linting + formatting. `uv run ruff check .` and `uv run ruff format --check .`.
31+
- **ty** — type checker (Astral). `uv run ty check agentscore/`.
3132
- **vulture** — dead code detection.
3233
- **pytest** — tests. `uv run pytest tests/`.
33-
- **Lefthook** — git hooks. Pre-commit: ruff. Pre-push: vulture.
34+
- **Lefthook** — git hooks. Pre-commit: ruff. Pre-push: ty + vulture (parallel).
3435

3536
## Key Commands
3637

3738
```bash
3839
uv sync --all-extras
3940
uv run ruff check .
4041
uv run ruff format .
42+
uv run ty check agentscore/
4143
uv run pytest tests/
4244
```
4345

4446
## Workflow
4547

4648
1. Create a branch
4749
2. Make changes
48-
3. Lefthook runs ruff on commit, vulture on push
50+
3. Lefthook runs ruff on commit, ty + vulture on push
4951
4. Open a PR — CI runs automatically
5052
5. Merge (squash)
5153

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
steps:
2121
- uses: useblacksmith/checkout@v1
2222
- uses: astral-sh/setup-uv@v7
23+
- run: uv python install 3.12
2324
- uses: actions/cache@v4
2425
with:
2526
path: |
@@ -30,5 +31,6 @@ jobs:
3031
- run: uv sync --frozen --all-extras
3132
- run: uv run ruff check .
3233
- run: uv run ruff format --check .
34+
- run: uv run ty check agentscore/
3335
- run: uv run vulture . vulture_whitelist.py --min-confidence 80 --exclude .venv
3436
- run: uv run pytest tests/ --cov=agentscore --cov-report=term-missing

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Bootstrap identity for first-time agents:
5656

5757
```python
5858
session = client.create_session()
59-
print(session["verify_url"], session["poll_secret"])
59+
print(session["verify_url"], session["poll_url"], session["poll_secret"])
6060

6161
status = client.poll_session(session["session_id"], session["poll_secret"])
6262
if status["status"] == "verified":

‎agentscore/client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _get_async_client(self) -> httpx.AsyncClient:
7373
)
7474
return self._async_client
7575

76-
def _handle_response(self, response: httpx.Response) -> dict:
76+
def _handle_response(self, response: httpx.Response) -> Any:
7777
if response.status_code == 429:
7878
retry_after = response.headers.get("retry-after", "1")
7979
raise AgentScoreError(

‎agentscore/types.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@ class SessionCreateResponse(TypedDict):
207207
expires_at: str
208208

209209

210+
class SessionPollNextSteps(TypedDict, total=False):
211+
action: str
212+
user_message: str
213+
header_name: str
214+
poll_interval_seconds: int
215+
eta_message: str
216+
# Present when action == "contact_support" (e.g. sanctions "flagged" status).
217+
support_email: str
218+
support_subject: str
219+
220+
210221
class _SessionPollResponseRequired(TypedDict):
211222
session_id: str
212223
status: str
@@ -215,7 +226,7 @@ class _SessionPollResponseRequired(TypedDict):
215226
class SessionPollResponse(_SessionPollResponseRequired, total=False):
216227
operator_token: str
217228
completed_at: str
218-
next_steps: NotRequired[dict]
229+
next_steps: NotRequired[SessionPollNextSteps]
219230
retry_after_seconds: NotRequired[int]
220231
token_ttl_seconds: NotRequired[int]
221232

‎lefthook.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ pre-commit:
99
run: uv run ruff format --check {staged_files}
1010

1111
pre-push:
12+
parallel: true
1213
commands:
14+
ty:
15+
run: uv run ty check agentscore/
1316
vulture:
1417
run: uv run vulture . vulture_whitelist.py --min-confidence 80 --exclude .venv

‎pyproject.toml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "agentscore-py"
7-
version = "1.7.0"
7+
version = "1.8.0"
88
description = "Python client for the AgentScore trust and reputation API"
99
readme = "README.md"
1010
license = "MIT"
11-
requires-python = ">=3.9"
11+
requires-python = ">=3.11"
1212
keywords = ["agentscore", "x402", "erc-8004", "agent", "trust", "reputation", "wallet", "blockchain", "ai-agent", "agentic-payments"]
1313
dependencies = [
1414
"httpx>=0.25.0,<1.0.0",
@@ -42,9 +42,13 @@ packages = ["agentscore"]
4242
[dependency-groups]
4343
dev = [
4444
"ruff>=0.11.0",
45+
"ty>=0.0.32",
4546
"vulture>=2.15",
4647
"pytest-cov>=6.0",
4748
"respx>=0.22.0",
4849
"pytest-asyncio>=1.2.0",
4950
"python-dotenv>=1.2.1",
5051
]
52+
53+
[tool.ty.src]
54+
include = ["agentscore"]

‎uv.lock‎

Lines changed: 51 additions & 294 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)