Files
aleksey a2d238d92e
CI / build-gateway (push) Failing after 16s
CI / sync-config (push) Failing after 0s
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.
2026-08-13 11:41:27 +03:00

68 lines
2.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""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()