Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(memory): align legacy cli-memory-commands test with D17 type mapping + env doc tweaks
diegosouzapweab8b1217138
diff --git a/.env.example b/.env.exampleindex 24d396f050..70bceb8e45 100644--- a/.env.example+++ b/.env.example@@ -1320,3 +1320,4 @@ APP_LOG_TO_FILE=true# MEMORY_STATIC_CACHE_DIR= # default <DATA_DIR>/embeddings# MEMORY_VEC_TOP_K=20 # default top-K for vector search# MEMORY_RRF_K=60 # RRF k constant (sqlite-vec hybrid recipe)+# HF_HUB_ENDPOINT=https://huggingface.co # override Hugging Face Hub base URL for static potion downloadsdiff --git a/docs/reference/ENVIRONMENT.md b/docs/reference/ENVIRONMENT.mdindex c7d86cf066..e422ea15af 100644--- a/docs/reference/ENVIRONMENT.md+++ b/docs/reference/ENVIRONMENT.md@@ -626,6 +626,21 @@ The logging system writes to both stdout and rotated log files. All configuratio| ------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------- || `OMNIROUTE_RTK_TRUST_PROJECT_FILTERS` | unset | Trust project `.rtk/filters.json` without a `.rtk/trust.json` hash. Use only in controlled local development. |+### Memory Engine (plan 21)++Embedding layer, vector store and reranking knobs for the persistent memory subsystem (`src/lib/memory/`).++| Variable | Default | Description |+| ------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------- |+| `MEMORY_EMBEDDING_CACHE_TTL_MS` | `300000` (5 min) | TTL for the in-memory embedding cache (per source/model/dim signature). |+| `MEMORY_EMBEDDING_CACHE_MAX` | `1000` | Max LRU entries kept in the embedding cache. |+| `MEMORY_TRANSFORMERS_MODEL` | `Xenova/all-MiniLM-L6-v2` | HF repo id for the opt-in `@huggingface/transformers` local MiniLM pipeline (~23 MB int8, ~400 MB RAM). |+| `MEMORY_STATIC_MODEL` | `minishlab/potion-base-8M` | HF repo id for the static potion/Model2Vec lookup-table embedder. Downloaded lazily into the cache dir. |+| `MEMORY_STATIC_CACHE_DIR` | `<DATA_DIR>/embeddings` | Directory used to cache the static potion model files. Defaults under `DATA_DIR` when unset. |+| `MEMORY_VEC_TOP_K` | `20` | Default top-K used by the `sqlite-vec` brute-force vector search inside `src/lib/memory/vectorStore.ts`. |+| `MEMORY_RRF_K` | `60` | Reciprocal Rank Fusion constant `k` for hybrid FTS5 + vector retrieval (sqlite-vec recipe). |+| `HF_HUB_ENDPOINT` | `https://huggingface.co` | Override Hugging Face Hub base URL used by `staticPotion.ts` (e.g. mirror endpoint for air-gapped setups). |+### Low-RAM Docker Example```bashdiff --git a/src/app/api/settings/qdrant/embedding-models/route.ts b/src/app/api/settings/qdrant/embedding-models/route.tsindex 5de80a1488..5a5f6eb1d0 100644--- a/src/app/api/settings/qdrant/embedding-models/route.ts+++ b/src/app/api/settings/qdrant/embedding-models/route.ts@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from "next/server";import { isAuthenticated } from "@/shared/utils/apiAuth";import { AI_MODELS } from "@/shared/constants/models";import { getProviderConnections } from "@/lib/db/providers";+import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error.ts";type EmbeddingModelOption = {value: string;@@ -88,6 +89,7 @@ export async function GET(request: NextRequest) {return NextResponse.json({ models: options });} catch (error) {- return NextResponse.json({ error: String(error), models: [] }, { status: 500 });+ const message = sanitizeErrorMessage(error instanceof Error ? error.message : String(error));+ return NextResponse.json({ error: { message }, models: [] }, { status: 500 });}}diff --git a/tests/unit/cli-memory-commands.test.ts b/tests/unit/cli-memory-commands.test.tsindex 7a43742bae..3b6a70d8bf 100644--- a/tests/unit/cli-memory-commands.test.ts+++ b/tests/unit/cli-memory-commands.test.ts@@ -87,13 +87,16 @@ test("runMemorySearch envia q e type na query", async () => {});test("runMemoryAdd envia POST com content e type", async () => {+ // Plan 21 / D17: legacy 'user' type is mapped to canonical 'factual'.let capturedUrl = "";let capturedInit: any = null;const origFetch = globalThis.fetch;globalThis.fetch = ((url: string, init: any) => {capturedUrl = url;capturedInit = init;- return Promise.resolve(makeResp({ id: "mem_new", type: "user", content: "test content" }));+ return Promise.resolve(+ makeResp({ id: "mem_new", type: "factual", content: "test content" })+ );}) as any;const { runMemoryAdd } = await import("../../bin/cli/commands/memory.mjs");@@ -106,7 +109,8 @@ test("runMemoryAdd envia POST com content e type", async () => {assert.equal(capturedInit?.method, "POST");const body = JSON.parse(capturedInit?.body);assert.equal(body.content, "test content");- assert.equal(body.type, "user");+ // Legacy 'user' is remapped to canonical 'factual' by CLI (plan 21 / D17).+ assert.equal(body.type, "factual");});test("runMemoryList retorna items sem q", async () => {