toon-memory 2.9.5 → 2.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mcp/server.js CHANGED
@@ -27828,12 +27828,8 @@ function readMemory() {
27828
27828
  const data = readUnderLock(MEMORY_FILE);
27829
27829
  if (config2.encrypted) {
27830
27830
  const key = getKey();
27831
- if (!key) return "";
27832
- try {
27833
- return decrypt(data, key);
27834
- } catch {
27835
- return "";
27836
- }
27831
+ if (!key) throw new Error("Encryption enabled but TOON_MEMORY_KEY is not set. Run 'npx toon-memory init' or set the env var.");
27832
+ return decrypt(data, key);
27837
27833
  }
27838
27834
  return data;
27839
27835
  }
@@ -27842,7 +27838,7 @@ function writeMemory(content) {
27842
27838
  const config2 = loadConfig();
27843
27839
  if (config2.encrypted) {
27844
27840
  const key = getKey();
27845
- if (!key) return;
27841
+ if (!key) throw new Error("Encryption enabled but TOON_MEMORY_KEY is not set. Run 'npx toon-memory init' or set the env var.");
27846
27842
  const encrypted = encrypt(content, key);
27847
27843
  safeWrite(MEMORY_FILE, encrypted);
27848
27844
  return;
@@ -30184,7 +30180,7 @@ function registerResources(server2) {
30184
30180
 
30185
30181
  // src/mcp/server.ts
30186
30182
  var server = new McpServer(
30187
- { name: "toon-memory", version: "2.9.5" },
30183
+ { name: "toon-memory", version: "2.9.6" },
30188
30184
  { capabilities: { tools: { listChanged: true }, resources: { listChanged: true } } }
30189
30185
  );
30190
30186
  registerResources(server);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "2.9.5",
3
+ "version": "2.9.6",
4
4
  "description": "MCP server giving AI coding agents offline, token-efficient persistent memory — 21 tools, 80% fewer tool calls, recall decisions, patterns, and bugs across sessions. No LLM, no server; works with 15+ agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,6 +14,7 @@ export function safeWrite(file: string, content: string): void {
14
14
  /**
15
15
  * Read memory file, decrypting if encryption is enabled.
16
16
  * Key is read from TOON_MEMORY_KEY env var.
17
+ * @throws if encryption is enabled but no key is available or decryption fails.
17
18
  */
18
19
  export function readMemory(): string {
19
20
  ensureMemoryFile()
@@ -22,12 +23,8 @@ export function readMemory(): string {
22
23
 
23
24
  if (config.encrypted) {
24
25
  const key = getKey()
25
- if (!key) return ""
26
- try {
27
- return decrypt(data, key)
28
- } catch {
29
- return ""
30
- }
26
+ if (!key) throw new Error("Encryption enabled but TOON_MEMORY_KEY is not set. Run 'npx toon-memory init' or set the env var.")
27
+ return decrypt(data, key)
31
28
  }
32
29
 
33
30
  return data
@@ -36,6 +33,7 @@ export function readMemory(): string {
36
33
  /**
37
34
  * Write content to memory file, encrypting if encryption is enabled.
38
35
  * Key is read from TOON_MEMORY_KEY env var.
36
+ * @throws if encryption is enabled but no key is available.
39
37
  */
40
38
  export function writeMemory(content: string): void {
41
39
  ensureMemoryFile()
@@ -43,7 +41,7 @@ export function writeMemory(content: string): void {
43
41
 
44
42
  if (config.encrypted) {
45
43
  const key = getKey()
46
- if (!key) return
44
+ if (!key) throw new Error("Encryption enabled but TOON_MEMORY_KEY is not set. Run 'npx toon-memory init' or set the env var.")
47
45
  const encrypted = encrypt(content, key)
48
46
  safeWrite(MEMORY_FILE, encrypted)
49
47
  return