feat: MCP stdio server + TUI回车发送 + 子Agent无限制 + 安全引擎优化 + diff弹窗绿红背景

- 新增 mcp_server.py: 标准 MCP stdio 传输层入口
- TUI: 回车发送消息,Shift+回车换行 (SendTextArea子类)
- 子Agent: 移除 max_steps=20 限制
- 安全引擎: 移除 ALWAYS_CONFIRM 关键词强制拦截
- code_editor: diff弹窗绿底(+)/红底(-)背景色
This commit is contained in:
shuiyu1123 committed 2026-06-19 00:10:27 +08:00
1 parent b0d9a24003
commit 161ab9d3a8
7 files changed
+294 -49

No files matched your search

+10 -8
View File
@@ -684,13 +684,15 @@ else:
thin_sep = '─' * 70
# ANSI 颜色
R = '\033[31m' # 红
G = '\033[32m' # 绿
R = '\033[31m' # 红字
G = '\033[32m' # 绿字
C = '\033[36m' # 青
B = '\033[1m' # 粗体
D = '\033[2m' # 暗
W = '\033[37m' # 白
N = '\033[0m' # 重置
RBG = '\033[41m\033[97m' # 红底白字
GBG = '\033[42m\033[97m' # 绿底白字
# 构建带颜色的 diff
diff_colored_lines = []
@@ -700,9 +702,9 @@ else:
elif line.startswith('+++') or line.startswith('---'):
diff_colored_lines.append(f"{B}{line}{N}")
elif line.startswith('+'):
diff_colored_lines.append(f"{G}{line}{N}")
diff_colored_lines.append(f"{GBG} {line} {N}")
elif line.startswith('-'):
diff_colored_lines.append(f"{R}{line}{N}")
diff_colored_lines.append(f"{RBG} {line} {N}")
else:
diff_colored_lines.append(line)
diff_colored = '\n'.join(diff_colored_lines) if diff_colored_lines else ' (无差异)'
@@ -845,9 +847,9 @@ else:
elif line.startswith('+++') or line.startswith('---'):
output(f"[bold]{line}[/]")
elif line.startswith('+'):
output(f"[green]{line}[/]")
output(f"[white on green] {line} [/]")
elif line.startswith('-'):
output(f"[red]{line}[/]")
output(f"[white on red] {line} [/]")
else:
output(line)
@@ -871,9 +873,9 @@ else:
elif line.startswith('+++') or line.startswith('---'):
_out(f"{Style.BRIGHT}{line}{Style.RESET_ALL}")
elif line.startswith('+'):
_out(f"{Fore.GREEN}{line}{Style.RESET_ALL}")
_out(f"\033[42m\033[97m {line} {Style.RESET_ALL}")
elif line.startswith('-'):
_out(f"{Fore.RED}{line}{Style.RESET_ALL}")
_out(f"\033[41m\033[97m {line} {Style.RESET_ALL}")
else:
_out(line)
+4 -4
View File
@@ -26,7 +26,7 @@ class SubAgent:
self.created_at = datetime.now().strftime("%H:%M:%S")
self.finished_at = None
self.steps = 0 # 已执行步数
self.max_steps = 20
self.max_steps = float('inf') # 不限制步数
def to_dict(self):
return {
@@ -238,7 +238,7 @@ class Liugin:
if agent.status == "running":
agent.status = "done"
agent.result = "已达到最大步数限制,任务暂停。"
agent.result = "任务执行结束。"
except Exception as e:
agent.status = "failed"
@@ -369,7 +369,7 @@ class Liugin:
f" 名称: {agent.name}",
f" 任务: {agent.task}",
f" 状态: {agent.status}",
f" 步骤: {agent.steps}/{agent.max_steps}",
f" 步骤: {agent.steps}",
f" 创建: {agent.created_at}",
]
if agent.finished_at:
@@ -395,7 +395,7 @@ class Liugin:
return f"错误:未找到 Agent '{agent_id}'"
if agent.status == "running":
return f"Agent {agent.id} 仍在运行中 (步骤 {agent.steps}/{agent.max_steps})"
return f"Agent {agent.id} 仍在运行中 (步骤 {agent.steps})"
if agent.status == "failed":
return f"Agent {agent.id} 执行失败: {agent.error}"