Append the active /plan as a system-prompt section so the agent follows it. No plan → returns base unchanged (regression-safe).
(self, base: Any)
| 622 | self._reply(request_id, {"ok": False, "error": str(exc)}) |
| 623 | |
| 624 | def _compose_with_plan(self, base: Any) -> Any: |
| 625 | """Append the active /plan as a system-prompt section so the agent follows |
| 626 | it. No plan → returns base unchanged (regression-safe).""" |
| 627 | try: |
| 628 | from src.plan import get_plan |
| 629 | |
| 630 | plan = get_plan(self.cwd) |
| 631 | if plan and isinstance(base, list): |
| 632 | base = base + [{"type": "text", "text": f"# Current Plan\nFollow this plan set by the user:\n\n{plan}"}] |
| 633 | except Exception: # noqa: BLE001 |
| 634 | logger.debug("[agent-server] plan compose failed", exc_info=True) |
| 635 | # Response language (the original's LanguagePicker, §6). |
| 636 | lang = getattr(self, "_language", None) |
| 637 | if lang and isinstance(base, list): |
| 638 | base = base + [{"type": "text", "text": f"# Response Language\nRespond in {lang} unless the user writes in another language."}] |
| 639 | return base |
| 640 | |
| 641 | def _do_set_mcp_enabled(self, request_id: object, server: object, enabled: object) -> None: |
| 642 | """Enable/disable an MCP server's tools (MCPServerMultiselectDialog). The |