Task: Create a Python helper module named tools.py that exposes simple functions for our Android to use with Supabase. Environment: - Use env vars SUPABASE_URL and SUPABASE_SERVICE_KEY. - Use supabase-py v2 (already installed). Create tools.py with the following: 1) get_client() - Returns a Supabase client using env vars. - Raises a clear error if env vars are missing. 2) resolve_agreement_id(agreement_number: str) -> int | None - Looks up agreement.id by agreement_number from the "agreement" table. - Returns None if not found. 3) log_message(agreement_number: str, channel: str, direction: str, text: str) -> dict - Inserts into contact_history: fields: agreement_id, channel, direction, message_text - Uses resolve_agreement_id first. - Returns the inserted row (id, agreement_id, channel, direction, happened_at). 4) open_thread(agreement_number: str, thread_type: str = 'renewal') -> dict - Upserts into open_thread with fields: agreement_number, thread_type, status='open' - If a row exists with status='open', return it; otherwise create one. - Return the row (id, agreement_number, status, created_at). 5) close_thread(agreement_number: str) -> dict | None - Finds the most recent open_thread for this agreement_number with status='open'. - Sets status='closed', updated_at=now(). - Returns the updated row or None if none open. 6) schedule_followup(agreement_number: str, due_at_iso: str, reason: str) -> dict - Inserts into follow_up: fields: agreement_id, due_at (ISO string), reason - Returns the inserted row (id, agreement_id, due_at, reason). 7) book_appt_request(agreement_number: str, preferred_date: str | None = None, preferred_time: str | None = None, notes: str | None = None, channel: str = 'whatsapp', requested_by: str = 'ai') -> dict - Inserts into appointment_request: fields: agreement_id, requested_by, channel, preferred_date, preferred_time, notes - Returns inserted row (id, agreement_id, status, created_at). 8) get_equity_snapshot(agreement_number: str) -> dict | None - Resolve agreement_id, then select from view v_equity_latest where agreement_id = . - Return {agreement_id, snapshot_date, settlement, balloon, true_equity, equity, parity} or None. Implementation notes: - Use concise, defensive error handling: raise ValueError with a helpful message if agreement_number not found. - Keep prints out of the module; return dicts. - Add minimal docstrings and type hints. - Do not modify other files. Deliverable: - Create/overwrite tools.py at the project root. - When done, print: CREATED tools.py