"""The session checklist: the model's binding to the checklist extension's `checklist.*` host route (src/albedo/harness/extensions/checklist).""" from __future__ import annotations from typing import cast from albedo_api import Host, PythonApi host: Host class Checklist: """This session's checklist. Items are dicts with id, text, done, and created_at.""" async def add(self, text: str) -> dict: """Add an open item; returns it with its id.""" return cast(dict, await host("checklist.add", {"text": text})) async def items(self) -> list[dict]: """This session's items, open ones first.""" return cast(list[dict], await host("checklist.items", {})) async def check(self, id: int) -> dict: """Check off one of this session's items once it is done. Only the 50 most recently checked items are kept.""" return cast(dict, await host("checklist.check", {"id": id})) def setup(api: PythonApi) -> dict[str, object]: global host host = api.host return {"checklist": Checklist()}