feat(agent): hierarchical executor with path resolve, runtime probe, quiet UI
Make Zed Agent closer to Cursor: deterministic DevOps path index, live Traefik port probe before blind edits, stop-after-edit, and quieter Russian progress.
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""Tests for Zed-facing progress UI."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from progress_ui import (
|
||||
execution_banner,
|
||||
format_progress_block,
|
||||
humanize_line,
|
||||
short_path,
|
||||
tool_status,
|
||||
)
|
||||
|
||||
|
||||
class TestProgressUi(unittest.TestCase):
|
||||
def test_humanize_drops_noise(self) -> None:
|
||||
self.assertIsNone(humanize_line("ждём LiteLLM `b-complex` (до 45с)…"))
|
||||
self.assertIsNone(humanize_line("ctx 7358/12000"))
|
||||
self.assertEqual(humanize_line("план…"), "Планирую задачу")
|
||||
self.assertIn(
|
||||
"утверждён",
|
||||
humanize_line("план: утверждён пользователем (3 подзадач)") or "",
|
||||
)
|
||||
|
||||
def test_format_block_numbered(self) -> None:
|
||||
block = format_progress_block(
|
||||
[
|
||||
"план…",
|
||||
"ждём LiteLLM x",
|
||||
"план: утверждён пользователем (3 подзадач)",
|
||||
"agent: план готов → executor с tools (Zed)",
|
||||
]
|
||||
)
|
||||
self.assertIn("**Ход**", block)
|
||||
self.assertIn("1. Планирую задачу", block)
|
||||
self.assertIn("2. План утверждён", block)
|
||||
self.assertNotIn("LiteLLM", block)
|
||||
|
||||
def test_execution_banner_shows_short_path(self) -> None:
|
||||
plan = {
|
||||
"subtasks": [
|
||||
{
|
||||
"paths": [
|
||||
r"C:\Users\alexc\IdeaProjects\eventHub\EventHubDevOps\ift\traefik\dynamic_conf.yml"
|
||||
],
|
||||
"path_source": "index",
|
||||
}
|
||||
]
|
||||
}
|
||||
text = execution_banner(path_mode=False, plan=plan, model="a-medium-code")
|
||||
self.assertIn("**Выполнение**", text)
|
||||
self.assertIn("dynamic_conf.yml", text)
|
||||
self.assertIn("индекс", text)
|
||||
self.assertNotIn("a-medium-code", text)
|
||||
|
||||
def test_short_path_and_tool_status(self) -> None:
|
||||
self.assertEqual(
|
||||
short_path(r"C:\x\EventHubDevOps\ift\traefik\dynamic_conf.yml"),
|
||||
r"ift\traefik\dynamic_conf.yml",
|
||||
)
|
||||
self.assertIn("Читаю", tool_status(["read_file"], path=r"a\b\c.yml"))
|
||||
self.assertIn("Правлю", tool_status(["edit_file"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user