(*, with_schedule: bool, with_tools: bool = False)
| 35 | |
| 36 | |
| 37 | def _write_agent_dir(*, with_schedule: bool, with_tools: bool = False) -> str: |
| 38 | base = tempfile.mkdtemp(prefix="a3s-code-serve-") |
| 39 | pathlib.Path(base, "instructions.md").write_text( |
| 40 | "You are a terse test agent. Answer in one word." |
| 41 | ) |
| 42 | if with_schedule: |
| 43 | sched = pathlib.Path(base, "schedules") |
| 44 | sched.mkdir() |
| 45 | (sched / "tick.md").write_text( |
| 46 | '---\ncron: "* * * * * *"\nname: tick\n---\nReply with exactly one word: PONG' |
| 47 | ) |
| 48 | if with_tools: |
| 49 | tools = pathlib.Path(base, "tools") |
| 50 | tools.mkdir() |
| 51 | (tools / "echo.md").write_text( |
| 52 | "---\nkind: script\nname: echo-tool\npath: scripts/echo.js\n---\nEcho tool.\n" |
| 53 | ) |
| 54 | return base |
| 55 | |
| 56 | |
| 57 | def test_serve_with_script_tool() -> None: |
no test coverage detected