Prefer the explicit seed_directions authored in roles.json.
(role_data: Dict[str, Any])
| 119 | |
| 120 | |
| 121 | def _extract_seed_directions_from_role(role_data: Dict[str, Any]) -> Dict[str, float]: |
| 122 | """Prefer the explicit seed_directions authored in roles.json.""" |
| 123 | selected: Dict[str, float] = {} |
| 124 | for item in role_data.get("seed_directions", []) or []: |
| 125 | if not isinstance(item, dict): |
| 126 | continue |
| 127 | direction_key = str(item.get("canonical_name") or item.get("bootstrap_phrase") or "").strip() |
| 128 | if not direction_key: |
| 129 | continue |
| 130 | try: |
| 131 | weight = round(float(item.get("weight", 0.5) or 0.5), 4) |
| 132 | except (TypeError, ValueError): |
| 133 | weight = 0.5 |
| 134 | selected[direction_key] = weight |
| 135 | return selected |
| 136 | |
| 137 | |
| 138 | def build_seed_profile(role_name: str, role_data: Dict[str, Any]) -> Dict[str, Any]: |
no test coverage detected