mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 13:22:11 +03:00
* feat(memory): x-omniroute-no-memory opt-out + memory off-by-default + token-cost UI alert PRD-2026-06-19-no-memory-header. The gateway injects up to memorySettings.maxTokens (~2k) of memory (and skills) context into every chat call for memory-enabled keys, inflating tokens+cost ~137x for clients that manage their own context (e.g. Omniflow). Three changes: - A) x-omniroute-no-memory request header (mirrors x-omniroute-no-cache): when truthy (true/1/yes), skip memory+skills injection for that request. New pure helper isNoMemoryRequested() in chatCore/headers.ts; chatCore passes memoryOwnerId=null on opt-out (a null owner disables both injection branches). - B) Memory OFF by default: DEFAULT_MEMORY_SETTINGS.enabled true->false. Enabling injects billed context per request, so it's now an explicit opt-in. Installs that already enabled it keep it; unset installs default off (no migration seeds memoryEnabled). - C) Settings -> Memory shows a token-cost warning callout when memory is enabled (new settings.memoryTokenCostWarning i18n key, interpolating the configured maxTokens). Tests: no-memory-header.test.ts (5, helper truthiness/case/Headers); memory-settings-default and chatcore-memory-skills-injection aligned to the new off-by-default. 65/65 memory+chatcore tests green; typecheck/lint/file-size/i18n(@65) clean. * test(memory): enable memory in memory-tools test (memory now off by default) The full CI unit suite flagged memory-tools.test.ts 'memory search ...' failing after DEFAULT_MEMORY_SETTINGS.enabled flipped to false: omniroute_memory_search routes through retrieveMemories, which returns [] while memory is disabled (enabled:false → maxTokens 0). The memory MCP tools operate within the memory subsystem, so the test now enables memory explicitly (updateSettings + cache invalidation) — the realistic precondition for a client using the tools. Aligns the test to the intentional off-by-default change; assertions unchanged.
28 lines
981 B
TypeScript
28 lines
981 B
TypeScript
import assert from "node:assert/strict";
|
|
import { describe, test } from "node:test";
|
|
import { DEFAULT_MEMORY_SETTINGS } from "../../src/lib/memory/settings.ts";
|
|
|
|
describe("memory settings — DEFAULT_MEMORY_SETTINGS.skillsEnabled", () => {
|
|
test("skillsEnabled defaults to true", () => {
|
|
assert.equal(DEFAULT_MEMORY_SETTINGS.skillsEnabled, true);
|
|
});
|
|
|
|
// PRD-2026-06-19: memory is OFF by default — enabling injects up to maxTokens
|
|
// (~2k) billed context per chat request, so new installs must opt in explicitly.
|
|
test("enabled defaults to false", () => {
|
|
assert.equal(DEFAULT_MEMORY_SETTINGS.enabled, false);
|
|
});
|
|
|
|
test("maxTokens defaults to 2000", () => {
|
|
assert.equal(DEFAULT_MEMORY_SETTINGS.maxTokens, 2000);
|
|
});
|
|
|
|
test("retentionDays defaults to 30", () => {
|
|
assert.equal(DEFAULT_MEMORY_SETTINGS.retentionDays, 30);
|
|
});
|
|
|
|
test('strategy defaults to "hybrid"', () => {
|
|
assert.equal(DEFAULT_MEMORY_SETTINGS.strategy, "hybrid");
|
|
});
|
|
});
|