| 1 | from __future__ import annotations |
| 2 | |
| 3 | from plugins._desktop.helpers import desktop_state |
| 4 | |
| 5 | |
| 6 | def build_context(context_id: str = "") -> str: |
| 7 | if not desktop_state.session_manifest_exists(): |
| 8 | return "" |
| 9 | try: |
| 10 | return desktop_state.compact_prompt_context( |
| 11 | desktop_state.collect_state(include_screenshot=False, context_id=context_id), |
| 12 | ) |
| 13 | except Exception as exc: |
| 14 | return ( |
| 15 | "[DESKTOP STATE]\n" |
| 16 | f"- unavailable={exc}\n" |
| 17 | "- next=Open the Desktop surface manually, then run plugins/_desktop/skills/linux-desktop/scripts/desktopctl.sh observe --json." |
| 18 | ) |