repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
Mirrored from https://github.com/yingqi-z20/Agent-libOS
stars
latest
clone command
git clone gitlawb://did:key:z6MkqRzA...RfoM/yingqi-z20-Agen...git clone gitlawb://did:key:z6MkqRzA.../yingqi-z20-Agen...d98dd2c9IPC1d ago| #1 | from __future__ import annotations |
| #2 | |
| #3 | import unittest |
| #4 | |
| #5 | from agent_libos.images.base_agent import DEFAULT_IMAGES |
| #6 | from agent_libos.llm.prompt import build_system_prompt |
| #7 | |
| #8 | |
| #9 | class CodingAgentImageTests(unittest.TestCase): |
| #10 | def test_coding_agent_prompt_guides_practical_tool_use(self) -> None: |
| #11 | image = DEFAULT_IMAGES["coding-agent:v0"] |
| #12 | prompt = build_system_prompt(image) |
| #13 | |
| #14 | required_phrases = [ |
| #15 | "practical coding agent", |
| #16 | "Scale the size", |
| #17 | "Adaptive operating loop", |
| #18 | "read_directory", |
| #19 | "create_memory_object", |
| #20 | "create_memory_namespace", |
| #21 | "fork_child_process", |
| #22 | "spawn_child_process", |
| #23 | "list_memory_namespace", |
| #24 | "request_permission", |
| #25 | "load_image_from_yaml", |
| #26 | "ask_human", |
| #27 | "parse_pytest_log", |
| #28 | "process_exit", |
| #29 | "Never claim that tests", |
| #30 | "least-privilege permission", |
| #31 | "Do not over-decompose", |
| #32 | ] |
| #33 | for phrase in required_phrases: |
| #34 | self.assertIn(phrase, prompt) |
| #35 | |
| #36 | def test_coding_agent_tool_table_covers_repository_workflow(self) -> None: |
| #37 | image = DEFAULT_IMAGES["coding-agent:v0"] |
| #38 | tools = set(image.default_tools) |
| #39 | |
| #40 | self.assertTrue( |
| #41 | { |
| #42 | "read_directory", |
| #43 | "read_text_file", |
| #44 | "write_text_file", |
| #45 | "write_directory", |
| #46 | "delete_file", |
| #47 | "delete_directory", |
| #48 | "create_memory_object", |
| #49 | "create_memory_namespace", |
| #50 | "read_memory_object", |
| #51 | "append_memory_object", |
| #52 | "list_memory_namespace", |
| #53 | "create_object_from_file", |
| #54 | "write_object_to_file", |
| #55 | "fork_child_process", |
| #56 | "spawn_child_process", |
| #57 | "exec_process", |
| #58 | "wait_child_process", |
| #59 | "list_child_processes", |
| #60 | "merge_child_memory", |
| #61 | "signal_child_process", |
| #62 | "get_working_directory", |
| #63 | "set_working_directory", |
| #64 | "request_permission", |
| #65 | "load_image_from_yaml", |
| #66 | "ask_human", |
| #67 | "human_output", |
| #68 | "get_current_time", |
| #69 | "sleep", |
| #70 | "parse_pytest_log", |
| #71 | "propose_jit_tool", |
| #72 | "validate_jit_tool", |
| #73 | "register_jit_tool", |
| #74 | }.issubset(tools) |
| #75 | ) |
| #76 | |
| #77 | def test_coding_agent_defaults_to_read_only_workspace_authority(self) -> None: |
| #78 | image = DEFAULT_IMAGES["coding-agent:v0"] |
| #79 | capabilities = image.required_capabilities |
| #80 | |
| #81 | self.assertIn({"resource": "human:owner", "rights": ["write"]}, capabilities) |
| #82 | self.assertIn({"resource": "filesystem:workspace:*", "rights": ["read"]}, capabilities) |
| #83 | self.assertFalse(any("write" in spec.get("rights", []) for spec in capabilities if spec["resource"].startswith("filesystem:"))) |
| #84 | self.assertFalse(any("delete" in spec.get("rights", []) for spec in capabilities if spec["resource"].startswith("filesystem:"))) |
| #85 | |
| #86 | |
| #87 | if __name__ == "__main__": |
| #88 | unittest.main() |
| #89 |