// Latency breakdown for the Mastra reply path — find the 120s culprit.
const mark = (l: string, t: number) => console.log(`${l}: ${((Date.now() - t) / 1000).toFixed(1)}s`);

let t = Date.now();
const cfg = await import('../src/mastra/lib/hermesConfig');
mark('import hermesConfig', t);

t = Date.now();
const ctx = cfg.getContext();
mark('getContext (python3 hermes-context.py + Supabase)', t);
console.log('  ctx =', JSON.stringify(ctx));

t = Date.now();
const composeMod = await import('../src/mastra/lib/compose');
mark('import compose (pulls @mastra/core/agent)', t);

const { resolve } = await import('../src/mastra/lib/resolve');
const p = resolve('32465863815');

t = Date.now();
const r = await composeMod.compose(p, ctx, 'salut ce faci');
mark('compose (LLM owl-alpha)', t);
console.log('  reply =', r.reply, '| model =', r.model, '| ok =', r.ok);
console.log('=== TIMING DONE ===');
