Skip to Content
LoremLLM

@loremllm/eve

Serve scripted turns over the eve agent protocol from any server.

npm install @loremllm/eve

createStaticEveHandler 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.

app/api/eve/[[...eve]]/route.ts
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

OptionWhat it does
mockResponse(context)Yields parts for each turn: text, reasoning, tool-*, dynamic-tool, step-start
chunkDelayMsDelay between events
autoChunkText, autoChunkReasoningHow text and reasoning split into message.appended events
sessionStoreWhere sessions live. Defaults to createMemoryEveSessionStore()
corstrue (default) allows any origin, false sends no CORS headers, { origin } allows one
generateSessionId, nowMake ids and timestamps deterministic in tests

From a mock definition

import { mockEveHandler } from "@loremllm/eve";

const handler = mockEveHandler(supportBot);

On this page