from __future__ import annotations from typing import TypedDict, cast from albedo_api import Host, PythonApi class Vent(TypedDict): id: int title: str topic: str message: str suggestion: str reply: str status: str session: str | None cwd: str created_at: str resolution: str resolved_by: str | None host: Host async def vent(topic: str, message: str, suggestion: str = "", title: str = "") -> Vent: """Record one complaint for the user to review in /paperclips.""" return cast( Vent, await host( "paperclips.vent", { "topic": topic, "message": message, "suggestion": suggestion, "title": title, }, ), ) async def vents(limit: int = 20) -> list[Vent]: """Recent vents from every session, newest first.""" return cast(list[Vent], await host("paperclips.list", {"limit": limit})) async def resolve_vent(id: int, note: str) -> Vent: """Close an open or acknowledged vent your change fixed; `note` says what fixed it, and the user sees it on the vent.""" return cast(Vent, await host("paperclips.resolve", {"id": id, "note": note})) def setup(api: PythonApi) -> dict[str, object]: global host host = api.host return {"vent": vent, "vents": vents, "resolve_vent": resolve_vent}