toon-memory 1.6.9 → 1.7.0

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
@@ -27696,9 +27696,6 @@ function decrypt(encryptedData, key) {
27696
27696
  decrypted += decipher.final("utf8");
27697
27697
  return decrypted;
27698
27698
  }
27699
- function generateKey() {
27700
- return randomBytes(32).toString("hex");
27701
- }
27702
27699
  function readMemory() {
27703
27700
  ensureMemoryFile();
27704
27701
  const config2 = loadConfig();
@@ -28025,18 +28022,16 @@ server.registerTool(
28025
28022
  if (config2.encrypted) {
28026
28023
  return { content: [{ type: "text", text: "La encriptaci\xF3n ya est\xE1 habilitada" }] };
28027
28024
  }
28028
- const key = generateKey();
28025
+ const key = getKey();
28026
+ if (!key) {
28027
+ return { content: [{ type: "text", text: "\u274C Define TOON_MEMORY_KEY en el entorno antes de encriptar" }] };
28028
+ }
28029
28029
  const data = readFileSync(MEMORY_FILE, "utf-8");
28030
28030
  const encrypted = encrypt(data, key);
28031
28031
  writeFileSync(MEMORY_FILE, encrypted);
28032
28032
  saveConfig({ encrypted: true });
28033
28033
  return {
28034
- content: [{
28035
- type: "text",
28036
- text: `\u{1F510} Encriptaci\xF3n habilitada
28037
- \u26A0\uFE0F Guarda esta clave en TOON_MEMORY_KEY (no se puede recuperar):
28038
- ${key}`
28039
- }]
28034
+ content: [{ type: "text", text: "\u{1F510} Encriptaci\xF3n habilitada" }]
28040
28035
  };
28041
28036
  }
28042
28037
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "1.6.9",
3
+ "version": "1.7.0",
4
4
  "description": "Persistent memory system for AI coding agents using TOON format (40% fewer tokens than JSON)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/mcp/server.ts CHANGED
@@ -656,19 +656,19 @@ server.registerTool(
656
656
  return { content: [{ type: "text" as const, text: "La encriptación ya está habilitada" }] }
657
657
  }
658
658
 
659
- const key = generateKey()
660
- const data = readFileSync(MEMORY_FILE, "utf-8")
659
+ const key = getKey()
660
+ if (!key) {
661
+ return { content: [{ type: "text" as const, text: "❌ Define TOON_MEMORY_KEY en el entorno antes de encriptar" }] }
662
+ }
661
663
 
664
+ const data = readFileSync(MEMORY_FILE, "utf-8")
662
665
  const encrypted = encrypt(data, key)
663
666
  writeFileSync(MEMORY_FILE, encrypted)
664
667
 
665
668
  saveConfig({ encrypted: true })
666
669
 
667
670
  return {
668
- content: [{
669
- type: "text" as const,
670
- text: `🔐 Encriptación habilitada\n⚠️ Guarda esta clave en TOON_MEMORY_KEY (no se puede recuperar):\n${key}`
671
- }],
671
+ content: [{ type: "text" as const, text: "🔐 Encriptación habilitada" }],
672
672
  }
673
673
  }
674
674
  )