/** * Smoke test: confirms LNbitsService and AgentService are reachable. * Run: pnpm --filter @workspace/api-server run smoke */ import { LNbitsService } from "./lib/lnbits.js"; import { AgentService } from "./lib/agent.js"; async function smokeLnbits(): Promise { const svc = new LNbitsService(); const invoice = await svc.createInvoice(1, "smoke-test"); console.log("✓ LNbits createInvoice:", invoice.paymentHash.slice(0, 16), "..."); const paidBefore = await svc.checkInvoicePaid(invoice.paymentHash); console.log("✓ LNbits checkInvoicePaid (unpaid, expect false):", paidBefore); if (svc.stubMode) { svc.stubMarkPaid(invoice.paymentHash); const paidAfter = await svc.checkInvoicePaid(invoice.paymentHash); console.log("✓ LNbits checkInvoicePaid (after stub mark, expect true):", paidAfter); } } async function smokeAnthropic(): Promise { const svc = new AgentService(); const evalResult = await svc.evaluateRequest("What is 2 + 2?"); console.log("✓ AgentService evaluateRequest:", JSON.stringify(evalResult)); } (async () => { console.log("--- Timmy smoke test ---"); try { await smokeLnbits(); } catch (err) { console.error("✗ LNbits smoke failed:", err); process.exitCode = 1; } try { await smokeAnthropic(); } catch (err) { console.error("✗ Anthropic smoke failed:", err); process.exitCode = 1; } if (!process.exitCode) { console.log("--- All smoke checks passed ---"); } })();