| 37 | } |
| 38 | |
| 39 | function writeAgentDir({ withSchedule, withTools }) { |
| 40 | const base = fs.mkdtempSync(path.join(os.tmpdir(), 'a3s-node-serve-')) |
| 41 | fs.writeFileSync(path.join(base, 'instructions.md'), 'You are a terse test agent. Answer in one word.') |
| 42 | if (withSchedule) { |
| 43 | fs.mkdirSync(path.join(base, 'schedules')) |
| 44 | fs.writeFileSync( |
| 45 | path.join(base, 'schedules', 'tick.md'), |
| 46 | '---\ncron: "* * * * * *"\nname: tick\n---\nReply with exactly one word: PONG', |
| 47 | ) |
| 48 | } |
| 49 | if (withTools) { |
| 50 | fs.mkdirSync(path.join(base, 'tools')) |
| 51 | fs.writeFileSync( |
| 52 | path.join(base, 'tools', 'echo.md'), |
| 53 | '---\nkind: script\nname: echo-tool\npath: scripts/echo.js\n---\nEcho tool.\n', |
| 54 | ) |
| 55 | } |
| 56 | return base |
| 57 | } |
| 58 | |
| 59 | function repoConfig() { |
| 60 | if (process.env.A3S_CONFIG_FILE && fs.existsSync(process.env.A3S_CONFIG_FILE)) { |