Skip to content

Agent Zero AI framework

Add regression coverage and normalize prompt file endings

linklitiaae3e9137ba9
diff --git a/prompts/fw.intervention.md b/prompts/fw.intervention.md
index 115ce3f2a..91871fcf2 100644
--- a/prompts/fw.intervention.md
+++ b/prompts/fw.intervention.md
@@ -4,4 +4,4 @@
"user_intervention":{{message}},
"attachments":{{attachments}}
}
-```
\ No newline at end of file
+```
diff --git a/prompts/fw.msg_nudge.md b/prompts/fw.msg_nudge.md
index 107fc07fd..3a9e811d1 100644
--- a/prompts/fw.msg_nudge.md
+++ b/prompts/fw.msg_nudge.md
@@ -1 +1 @@
-Nudged - continue
\ No newline at end of file
+Nudged - continue
diff --git a/prompts/fw.msg_reasoning_only.md b/prompts/fw.msg_reasoning_only.md
index 289bfa50f..812f90465 100644
--- a/prompts/fw.msg_reasoning_only.md
+++ b/prompts/fw.msg_reasoning_only.md
@@ -1 +1 @@
-You produced reasoning but no response content. Respond now with a single valid tool-call JSON object exactly as the system prompt requires; do not end a turn without one.
\ No newline at end of file
+You produced reasoning but no response content. Respond now with a single valid tool-call JSON object exactly as the system prompt requires; do not end a turn without one.
diff --git a/prompts/fw.msg_reasoning_only_response.md b/prompts/fw.msg_reasoning_only_response.md
index cf3096e33..40a0dc0b9 100644
--- a/prompts/fw.msg_reasoning_only_response.md
+++ b/prompts/fw.msg_reasoning_only_response.md
@@ -1 +1 @@
-Reasoning-only response detected. Retrying.
\ No newline at end of file
+Reasoning-only response detected. Retrying.
diff --git a/prompts/fw.user_message.md b/prompts/fw.user_message.md
index 078eb5749..3bbfe778e 100644
--- a/prompts/fw.user_message.md
+++ b/prompts/fw.user_message.md
@@ -4,4 +4,4 @@
"user_message":{{message}},
"attachments":{{attachments}}
}
-```
\ No newline at end of file
+```
diff --git a/tests/test_file_tree_indent.py b/tests/test_file_tree_indent.py
new file mode 100644
index 000000000..606547f17
--- /dev/null
+++ b/tests/test_file_tree_indent.py
@@ -0,0 +1,61 @@
+from __future__ import annotations
+
+import os
+import sys
+from pathlib import Path
+
+import pytest
+
+REPO_ROOT = Path(__file__).resolve().parents[1]
+if str(REPO_ROOT) not in sys.path:
+ sys.path.insert(0, str(REPO_ROOT))
+
+from helpers.file_tree import OUTPUT_MODE_INDENT, file_tree
+from helpers.files import create_dir, delete_dir, write_file
+
+
+BASE_TEMP = "tmp/tests/file_tree/indent"
+
+
+def tree_root():
+ rel = BASE_TEMP
+ delete_dir(rel)
+ create_dir(rel)
+ write_file(os.path.join(rel, "top_file.txt"), "a")
+ create_dir(os.path.join(rel, "sub"))
+ write_file(os.path.join(rel, "sub", "nested.txt"), "b")
+ create_dir(os.path.join(rel, "sub", "deep"))
+ write_file(os.path.join(rel, "sub", "deep", "leaf.txt"), "c")
+ yield rel
+ delete_dir(rel)
+
+
+def test_indent_mode_returns_compact_indented_string(tree_root):
+ result = file_tree(tree_root, max_depth=5, output_mode=OUTPUT_MODE_INDENT)
+ assert isinstance(result, str)
+ lines = result.splitlines()
+ # root line ends with path separator and contains the relative path
+ assert lines[0].endswith("/")
+ assert tree_root in lines[0]
+ # top-level file has no indent (folders_first default puts sub/ first)
+ file_line = next(line for line in lines if line.lstrip().startswith("top_file.txt"))
+ assert file_line.startswith(" ") is False
+ # nested file uses 4-space indent per level
+ nested_line = next(line for line in lines if line.lstrip().startswith("nested.txt"))
+ assert nested_line.startswith(" " * 1)
+ leaf_line = next(line for line in lines if line.lstrip().startswith("leaf.txt"))
+ assert leaf_line.startswith(" " * 2)
+
+
+def test_indent_mode_marks_folders_with_trailing_slash(tree_root):
+ result = file_tree(tree_root, max_depth=5, output_mode=OUTPUT_MODE_INDENT)
+ lines = result.splitlines()
+ folder_lines = [line for line in lines if line.rstrip().endswith("/")]
+ assert any("sub/" in line for line in folder_lines)
+ assert any("deep/" in line for line in folder_lines)
+
+
+def test_indent_mode_rejects_unknown_output_mode(tree_root):
+ with pytest.raises(ValueError):
+ file_tree(tree_root, output_mode="bogus")
\ No newline at end of file
diff --git a/tests/test_webui_message_ordering_static.py b/tests/test_webui_message_ordering_static.py
index 34063d979..9d43ac3bd 100644
--- a/tests/test_webui_message_ordering_static.py
+++ b/tests/test_webui_message_ordering_static.py
@@ -119,6 +119,19 @@ def test_utility_prefixed_process_groups_are_not_hidden_from_partial_dom_state()
assert ".show-utility-messages .process-step.message-util" in process_group_css
+def test_unknown_message_types_fall_back_to_draw_message_tool():
+ messages_js = read("webui", "js", "messages.js")
+
+ assert "return drawMessageTool;" in messages_js
+ assert "return drawMessageDefault;" not in messages_js
+
+
+def test_gen_steps_disable_smooth_scrolling():
+ messages_js = read("webui", "js", "messages.js")
+
+ assert 'smooth: code !== "GEN" && !isMassRender()' in messages_js
+
+
def test_message_actions_put_copy_before_speak():
sources = [
read("webui", "js", "messages.js"),