"""Built-in pose library for the shot-builder (port of open-media's public/poses/authoredPoses.json, MIT). Values are the serialized mannequin-js v7 posture format — see harness/plugins/shot_builder.py for the entry table. """ from __future__ import annotations import json from pathlib import Path from typing import Any _POSES: list[dict[str, Any]] = [ { "id": "authored.running-with-right-hand-forward", "name": "running with right hand forward", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[7.2,0.6,-8.4],[34.4],[-6,-6,-0.6],[-5.1,0.3,45.2],[62.4],[10.5,-17,26],[19.1,10.4,-47.8],[35.8],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-9.3,10.4,23.9],[96.8],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.sitting", "name": "sitting", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,62.1],[80.8],[-5.9,-0.1,-8.2],[-1.4,0.7,63.5],[80.1],[6,6,-0.6],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-7,0.6,-5],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.sitting-crossed-leg", "name": "sitting crossed leg", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[-4.3,-15.5,61.6],[80.8],[-5.9,-0.1,-8.2],[0.6,29.2,77],[80.1],[6,6,-0.6],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-7,0.6,-5],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.crossed-arm-standing", "name": "crossed arm standing", "posture": {"version": 7, "data": [[0,0,0],[-150.9,-84.6,-151.2],[-0.3,-0.1,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[-0.5],[6,6,-0.6],[5.9,-16.3,13.3],[115.4],[72.5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[7.6,3.5,7.8],[161.2],[-77.1,-0.7,0],[61,-79.7,44.3,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.shake-hands", "name": "shake hands", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-3,8.1,61.7],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.hand-in-back-pockets", "name": "hand in back pockets", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0.1,-0.1,-2],[0,0,5],[6,0,-1.1],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[14.2,-6.3,-42.3],[76],[5,-87.8,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[50.2,46.4,-74],[123.5],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.sleeping", "name": "sleeping", "posture": {"version": 7, "data": [[0,0,0],[-81.7,-90,0],[0.4,0.4,-2.1],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-7,0.6,-5],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.kneel-down", "name": "kneel down", "posture": {"version": 7, "data": [[0,-3,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,-3.3],[85.3],[0.5,8,65],[-6,0,0],[82.7],[1.7,-25.5,36.7],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-7,0.6,-5],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.kneel-down-praying", "name": "kneel down praying", "posture": {"version": 7, "data": [[0,-3,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,-3.3],[85.3],[0.5,8,65],[-6,0,0],[82.7],[1.7,-25.5,36.7],[-16.7,10.5,84.1],[52.6],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-6.5,9.7,82.5],[61.7],[-43.2,-33.5,6.2],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.arms-wide-open", "name": "arms wide open", "posture": {"version": 7, "data": [[0,0,0],[-174.7,-45.5,171],[0,0,16.9],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[-17.2,82,99.6],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[30.5,-79.6,109.4],[14.2],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.walking-forward", "name": "walking forward", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[2,5.3,-12.5],[2.3],[-6,-6,-0.6],[0.6,6.7,11.9],[0],[6,6,-0.6],[1.8,-5,35.2],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-21,-3.4,-12.5],[2.2],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.raising-hand", "name": "raising hand", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[122.6,66.6,51],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-7,0.6,-5],[15],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.shrugging", "name": "shrugging", "posture": {"version": 7, "data": [[0,0,0],[-174.7,-45.5,171],[0,0,16.9],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[-117.6,77.3,123.8],[97.4],[5,-18.8,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[25.9,-85.9,38.1],[55],[-2.4,13.1,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.thinking-with-right-hand", "name": "thinking with right hand", "posture": {"version": 7, "data": [[0,0,0],[0,-90,0],[0,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[7,-0.6,-5],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-4.3,-14.9,90.7],[121.5],[-8.6,17.9,5.1],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.side-sleeping", "name": "side sleeping", "posture": {"version": 7, "data": [[0,-5.3,-0.1],[75.1,-0.3,52.2],[15.8,1.8,-2.7],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[7.2],[6,6,-0.6],[7,-0.6,-5],[40.7],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[-12.2,-2,5.9],[73.9],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, { "id": "authored.lying-down-hands-wide", "name": "lying down hands wide", "posture": {"version": 7, "data": [[0,0,0],[-177.3,-42.5,-89.5],[0,0,-2],[0,0,5],[6,0,0],[0],[-6,-6,-0.6],[-6,0,0],[0],[6,6,-0.6],[-173,84.7,-104.7],[15],[5,0,0],[-90,70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[171.5,-80.1,-110.3],[14.2],[-5,0,0],[90,-70,75,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10],[0,0,10,0,10,0,10]]}, }, ] # User-added poses live here; they win over builtins on id collisions. _CUSTOM_PATH = Path(__file__).resolve().parents[3] / "skills_builtin" / "shot_poses.json" def list_builtin_poses() -> list[dict[str, Any]]: """[{id, name, category, source}] — frontmatter only, never full postures.""" out = [ {"id": p["id"], "name": p["name"], "category": "authored", "source": "builtin"} for p in _POSES ] custom = _load_custom() known = {p["id"] for p in out} for p in custom: if p.get("id") in known: for row in out: if row["id"] == p["id"]: row["name"] = p.get("name", row["name"]) row["source"] = "custom" else: out.append( { "id": p["id"], "name": p.get("name", p["id"]), "category": p.get("category", "custom"), "source": "custom", } ) return out def get_builtin_pose(pose_id: str) -> dict[str, Any] | None: for p in _load_custom(): if p.get("id") == pose_id: posture = p.get("posture") if isinstance(posture, dict): return posture for p in _POSES: if p["id"] == pose_id: return dict(p["posture"]) return None def _load_custom() -> list[dict[str, Any]]: try: raw = json.loads(_CUSTOM_PATH.read_text(encoding="utf-8")) except (OSError, json.JSONDecodeError): return [] return raw if isinstance(raw, list) else []