/**
 * Smoke test — run with: npx tsx lib/chat/__test__/smoke.ts
 * No LLM provider needed: the loop should fail-fast with a clear message
 * when no Anthropic/OpenAI key is configured.
 */

import { runTurn } from '../agent-loop';
import { createSession, deleteSession } from '../session-store';

async function main() {
  const s = createSession({ title: 'smoke test' });
  console.log('Created session', s.id.slice(0, 8));

  const events: string[] = [];
  const r = await runTurn({
    sessionId: s.id,
    userText: 'hi',
    callbacks: {
      onEvent: (e) => events.push(e.type + (e.data?.error ? ': ' + String(e.data.error).slice(0, 80) : '')),
    },
  });

  console.log('Result:', r);
  console.log('Events:', events);

  deleteSession(s.id);
  console.log('Cleaned up.');
}

main();
