@loremllm/eve
Serve scripted turns over the eve agent protocol from any server.
npm install @loremllm/evecreateStaticEveHandler returns a (request: Request) => Promise<Response> function. Mount it in a Next.js route handler, Hono, Bun, a service worker, or a stubbed fetch in tests.
import { createStaticEveHandler } from "@loremllm/eve";
const handler = createStaticEveHandler({
chunkDelayMs: [20, 50],
async *mockResponse({ messages }) {
const last = messages.at(-1);
const said = last?.parts.find((part) => part.type === "text")?.text;
yield { type: "text", text: `You said: ${said}` };
},
});
export { handler as GET, handler as POST };mockResponse yields the same parts as @loremllm/ai-sdk, so one generator can back both. Its context matches the AI SDK transport's, except messages is the eve session history.
The handler serves POST /eve/v1/session, POST /eve/v1/session/:id, GET /eve/v1/session/:id/stream and GET /eve/v1/health. See the eve endpoint for the event list. Human-in-the-loop inputResponses turns aren't supported yet.
Options
| Option | What it does |
|---|---|
mockResponse(context) | Yields parts for each turn: text, reasoning, tool-*, dynamic-tool, step-start |
chunkDelayMs | Delay between events |
autoChunkText, autoChunkReasoning | How text and reasoning split into message.appended events |
sessionStore | Where sessions live. Defaults to createMemoryEveSessionStore() |
cors | true (default) allows any origin, false sends no CORS headers, { origin } allows one |
generateSessionId, now | Make ids and timestamps deterministic in tests |
From a mock definition
import { mockEveHandler } from "@loremllm/eve";
const handler = mockEveHandler(supportBot);