Build a reusable bootstrap summary for future cold starts.
(
profile: Dict[str, Any],
*,
explicit_text: Optional[str] = None,
seed_directions: Optional[List[Dict[str, Any]]] = None,
)
| 295 | ) |
| 296 | return result |
| 297 | |
| 298 | |
| 299 | def _build_role_bootstrap_summary( |
| 300 | profile: Dict[str, Any], |
| 301 | *, |
| 302 | explicit_text: Optional[str] = None, |
| 303 | seed_directions: Optional[List[Dict[str, Any]]] = None, |
| 304 | ) -> str: |
| 305 | """Build a reusable bootstrap summary for future cold starts.""" |
| 306 | cleaned_explicit = re.sub(r"\s+", " ", str(explicit_text or "")).strip() |
| 307 | if cleaned_explicit and cleaned_explicit.lower() not in COLD_START_COMMAND_HINTS: |
| 308 | return cleaned_explicit |
| 309 | |
| 310 | directions = seed_directions or _build_seed_directions(profile) |
| 311 | try: |
| 312 | direction_lexicon = importlib.import_module("config.direction_lexicon") |
| 313 | phrases = [str(entry.get("canonical_name") or "").strip() for entry in directions if entry.get("canonical_name")] |
| 314 | return direction_lexicon.build_bootstrap_summary(phrases, prefer_chinese=False, limit=6) |
| 315 | except Exception: |
| 316 | phrases = [str(entry.get("bootstrap_phrase") or "").strip() for entry in directions if entry.get("bootstrap_phrase")] |
| 317 | if not phrases: |
| 318 | return "" |
| 319 | return f"direction: {', '.join(phrases[:6])}" |
| 320 |
no test coverage detected