953 bytes, 1 run
created by r2519314175:211, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | // The first end-to-end drive: sign in, connect a model, take a turn with a tool. |
| 2 | import { open, chat, shot, errors, clearMockLog, mockLog } from './harness.mjs'; |
| 3 | |
| 4 | clearMockLog(); |
| 5 | const s = await open({ name: 'smoke' }); |
| 6 | console.log('cfg after connect:', JSON.stringify(s.cfg)); |
| 7 | await shot(s, '01-connected'); |
| 8 | |
| 9 | const t1 = await chat(s, '@text Hello from the mock.'); |
| 10 | console.log('--- plain turn ---\n' + t1.slice(-400)); |
| 11 | await shot(s, '02-plain'); |
| 12 | |
| 13 | const t2 = await chat(s, '@tool file_write {"path":"mock.txt","content":"written by the agent"}'); |
| 14 | console.log('--- tool turn ---\n' + t2.slice(-600)); |
| 15 | await shot(s, '03-tool'); |
| 16 | |
| 17 | const seen = mockLog(); |
| 18 | console.log('\nmock saw', seen.length, 'requests'); |
| 19 | for (const r of seen) { |
| 20 | console.log(' model=%s stream=%s tools=%d msgs=%d roles=%s', |
| 21 | r.model, r.stream, r.tools.length, r.messages.length, |
| 22 | r.messages.map(m => m.role).join(',')); |
| 23 | } |
| 24 | console.log('\nconsole errors:', errors(s)); |
| 25 | await s.close(); |