toon-memory 2.9.5 → 2.9.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "2.9.5",
3
+ "version": "2.9.8",
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": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@inquirer/prompts": "^8.5.2",
35
- "@modelcontextprotocol/server": "^2.0.0-beta.3",
35
+ "@modelcontextprotocol/server": "^2.0.0-beta.5",
36
36
  "@toon-format/toon": "^2.3.0",
37
37
  "zod": "^4.4.3"
38
38
  },
@@ -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