mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
bad05a2bdc
* Add initial harness console for python * Add textual to project * Add planning and approval flows with list selector * Address PR comments * Fix list selection bug * Fix PR #6312 round 2 review comments - Escape untrusted agent text with rich.markup.escape() in observers (text_output, planning_output, reasoning_display) to prevent markup injection - Remove non-functional 'Always approve' choices from tool_approval.py (framework lacks CreateAlwaysApproveToolResponse support) - Remove textual from root pyproject.toml dev deps (sample-specific) - Add PEP 723 inline script metadata to harness_research.py - Narrow except Exception to except NoMatches in list_selection.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix build error * Fix build errors --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
32 lines
861 B
Python
32 lines
861 B
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
"""Mode-colored horizontal rule."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from textual.reactive import reactive
|
|
from textual.widgets import Static
|
|
|
|
|
|
class PromptRule(Static):
|
|
"""A full-width horizontal rule colored by the current agent mode.
|
|
|
|
Renders a line of '─' characters across the terminal width,
|
|
colored to match the current mode (e.g., cyan for plan, green for execute).
|
|
|
|
Attributes:
|
|
rule_color: Rich color string for the rule (e.g., "cyan", "green").
|
|
"""
|
|
|
|
rule_color: reactive[str] = reactive("cyan")
|
|
|
|
def render(self) -> str:
|
|
"""Render the horizontal rule.
|
|
|
|
Returns:
|
|
Formatted string with Rich markup.
|
|
"""
|
|
color = self.rule_color
|
|
width = self.size.width or 80
|
|
return f"[{color}]{'─' * width}[/{color}]"
|