Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/smoke.mjs

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.
2import { open, chat, shot, errors, clearMockLog, mockLog } from './harness.mjs';
3
4clearMockLog();
5const s = await open({ name: 'smoke' });
6console.log('cfg after connect:', JSON.stringify(s.cfg));
7await shot(s, '01-connected');
8
9const t1 = await chat(s, '@text Hello from the mock.');
10console.log('--- plain turn ---\n' + t1.slice(-400));
11await shot(s, '02-plain');
12
13const t2 = await chat(s, '@tool file_write {"path":"mock.txt","content":"written by the agent"}');
14console.log('--- tool turn ---\n' + t2.slice(-600));
15await shot(s, '03-tool');
16
17const seen = mockLog();
18console.log('\nmock saw', seen.length, 'requests');
19for (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}
24console.log('\nconsole errors:', errors(s));
25await s.close();