Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai> Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai> Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai> Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai> Co-Authored-By: Clément Siriex <clement.sirieix@mistral.ai> Co-Authored-By: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-Authored-By: Thaddee Tyl <thaddee.tyl@gmail.com> Co-Authored-By: David Brochart <david.brochart@gmail.com> Co-Authored-By: Joseph Guhlin <joseph.guhlin@gmail.com> Co-Authored-By: Thomas Kenbeek <thomaskenbeek@gmail.com> Co-Authored-By: Remenby31 <baptiste.cruvellier31@gmail.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from textual.widgets import Static
|
|
|
|
from vibe.core.agents import AgentProfile, AgentSafety, BuiltinAgentName
|
|
|
|
AGENT_ICONS: dict[str, str] = {
|
|
BuiltinAgentName.DEFAULT: "⏵",
|
|
BuiltinAgentName.PLAN: "⏸",
|
|
BuiltinAgentName.ACCEPT_EDITS: "⏵⏵",
|
|
BuiltinAgentName.AUTO_APPROVE: "⏵⏵⏵",
|
|
}
|
|
|
|
SAFETY_CLASSES: dict[AgentSafety, str] = {
|
|
AgentSafety.SAFE: "agent-safe",
|
|
AgentSafety.NEUTRAL: "agent-neutral",
|
|
AgentSafety.DESTRUCTIVE: "agent-destructive",
|
|
AgentSafety.YOLO: "agent-yolo",
|
|
}
|
|
|
|
|
|
class AgentIndicator(Static):
|
|
def __init__(self, profile: AgentProfile) -> None:
|
|
super().__init__(markup=False)
|
|
self.can_focus = False
|
|
self.profile = profile
|
|
self._update_display()
|
|
|
|
def _update_display(self) -> None:
|
|
icon = AGENT_ICONS.get(self.profile.name, "")
|
|
name = self.profile.display_name.lower()
|
|
self.update(f"{icon}{' ' if icon else ''}{name} agent (shift+tab to cycle)")
|
|
|
|
for safety_class in SAFETY_CLASSES.values():
|
|
self.remove_class(safety_class)
|
|
|
|
self.add_class(SAFETY_CLASSES[self.profile.safety])
|
|
|
|
def set_profile(self, profile: AgentProfile) -> None:
|
|
self.profile = profile
|
|
self._update_display()
|