()
| 19 | const KIMI_SERVER_URL = process.env['KIMI_SERVER_URL'] ?? 'http://127.0.0.1:58627'; |
| 20 | |
| 21 | async function main() { |
| 22 | const client = new DaemonClient({ |
| 23 | baseUrl: KIMI_SERVER_URL, |
| 24 | logger: (level, msg, meta) => console.log(`[${level}] ${msg}`, meta ?? ''), |
| 25 | }); |
| 26 | |
| 27 | let sid: string | undefined; |
| 28 | try { |
| 29 | const session = await client.createSession({ metadata: { cwd: process.cwd() } }); |
| 30 | sid = session.id; |
| 31 | |
| 32 | await client.connect(); |
| 33 | await client.subscribe(sid); |
| 34 | |
| 35 | // TODO: drive your scenario here. Examples: |
| 36 | // - await client.submitAndWait(sid, { content: [{ type: 'text', text: '...' }] }); |
| 37 | // - client.onApprovalRequested((req) => ({ decision: 'approved' })); |
| 38 | // - const final = await client.waitForFrame(f => f.type === 'turn.ended'); |
| 39 | |
| 40 | console.log('✓ scenario template ran (no assertions)'); |
| 41 | } finally { |
| 42 | try { |
| 43 | if (sid) await client.archiveSession(sid); |
| 44 | } catch { |
| 45 | // ignore |
| 46 | } |
| 47 | await client.close(); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | main().catch((err) => { |
| 52 | console.error('✗ scenario failed:', err); |
no test coverage detected