@elyxndra/chat
v0.1.0
Published
Elyxndra's chat brain: threads (one JSON file each), profile + chat settings, the built-in system prompt, local chat tools (system info, model-store results, web research/fetch), and the send → stream → tools → continue loop on top of @elyxndra/engine and
Maintainers
Readme
@elyxndra/chat
The chat brain shared by Elyxndra's apps: threads, settings, the built-in
system prompt, local chat tools and the send → stream → tools → continue
loop — on top of @elyxndra/engine (which model is live, its wire spec and
health) and @elyxndra/agent (streaming client, context budget). Host-agnostic,
Node 20+.
import { createEngineRuntime } from "@elyxndra/engine";
import { ChatApp } from "@elyxndra/chat";
const rt = await createEngineRuntime();
const chat = new ChatApp({ runtime: rt });
await chat.init();
chat.on("delta", (id, content, reasoning) => process.stdout.write(content));
chat.on("change", () => {
/* render chat.messages, chat.conversations, chat.isGenerating … */
});
chat.send("Hello");- Threads —
ConversationStore: one pretty-printed JSON file per thread under<app data>/conversations/, a stable format every Elyxndra host reads and writes, so chats carry over between them. Newest-created first, atomic writes. - Settings —
ChatSettings: profile (name, role, style…), system prompt, thinking/effort defaults, tool switches, web-research config; provider keys in the OS credential store. - Prompt —
builtinSystemPrompt(): identity + live model/engine/machine context, regenerated per request. - Tools —
get_system_info,get_model_search_results, plus the agent package'sweb_research/web_fetch(opt-in). - Loop —
ChatApp.send()/regenerateLastReply()/stopGeneration(), tool rounds run concurrently and keep one uninterrupted "generating" state, context auto-trim with engine-calibrated estimates, per-message stats.
Tests: npm test (offline; a fake SSE engine stands in for the model server).
