toon-memory 2.9.4 → 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/dist/cli/setup.js +53 -34
- package/mcp/server.js +4 -8
- package/package.json +1 -1
- package/src/cli/commands.ts +53 -34
- package/src/mcp/memory-io.ts +5 -7
package/dist/cli/setup.js
CHANGED
|
@@ -760,23 +760,31 @@ async function init(scope, agentFilter) {
|
|
|
760
760
|
process.exit(1);
|
|
761
761
|
}
|
|
762
762
|
} else if (process.stdin.isTTY) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
763
|
+
try {
|
|
764
|
+
selected = await promptAgentSelection(agents);
|
|
765
|
+
if (selected.length === 0) {
|
|
766
|
+
console.log("\nNo se seleccionaron agentes. Nada instalado.\n");
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
finalScope = await select({
|
|
770
|
+
message: "Scope:",
|
|
771
|
+
choices: [
|
|
772
|
+
{ name: "Local (project)", value: "local" },
|
|
773
|
+
{ name: "Global (~home)", value: "global" }
|
|
774
|
+
],
|
|
775
|
+
default: finalScope
|
|
776
|
+
});
|
|
777
|
+
const ok = await confirm({ message: "Proceed?", default: true });
|
|
778
|
+
if (!ok) {
|
|
779
|
+
console.log("\nInstallation cancelled.\n");
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
} catch (e) {
|
|
783
|
+
if (e?.name === "ExitPromptError" || e?.message?.includes("SIGINT")) {
|
|
784
|
+
console.log("\nInstallation cancelled.\n");
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
throw e;
|
|
780
788
|
}
|
|
781
789
|
} else {
|
|
782
790
|
selected = agents;
|
|
@@ -1096,23 +1104,34 @@ async function interactiveInstall() {
|
|
|
1096
1104
|
console.log("Run 'toon-memory init [--agent <name>]' for non-interactive installation.\n");
|
|
1097
1105
|
return;
|
|
1098
1106
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1107
|
+
let agents;
|
|
1108
|
+
let selected;
|
|
1109
|
+
let scope;
|
|
1110
|
+
try {
|
|
1111
|
+
agents = detectAgents();
|
|
1112
|
+
selected = await promptAgentSelection(agents);
|
|
1113
|
+
if (selected.length === 0) {
|
|
1114
|
+
console.log("\nNo agents selected. Nothing installed.\n");
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
scope = await select({
|
|
1118
|
+
message: "Scope:",
|
|
1119
|
+
choices: [
|
|
1120
|
+
{ name: "Local (project)", value: "local" },
|
|
1121
|
+
{ name: "Global (~home)", value: "global" }
|
|
1122
|
+
]
|
|
1123
|
+
});
|
|
1124
|
+
const ok = await confirm({ message: "Proceed?", default: true });
|
|
1125
|
+
if (!ok) {
|
|
1126
|
+
console.log("\nInstallation cancelled.\n");
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
} catch (e) {
|
|
1130
|
+
if (e?.name === "ExitPromptError" || e?.message?.includes("SIGINT")) {
|
|
1131
|
+
console.log("\nInstallation cancelled.\n");
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
throw e;
|
|
1116
1135
|
}
|
|
1117
1136
|
console.log(`
|
|
1118
1137
|
Installing (${scope}) \u2014 ${selected.map((a) => a.name).join(", ")}...
|
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)
|
|
27832
|
-
|
|
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)
|
|
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.
|
|
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.
|
|
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": {
|
package/src/cli/commands.ts
CHANGED
|
@@ -69,23 +69,31 @@ export async function init(scope?: string, agentFilter?: string[]): Promise<void
|
|
|
69
69
|
process.exit(1)
|
|
70
70
|
}
|
|
71
71
|
} else if (process.stdin.isTTY) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
try {
|
|
73
|
+
selected = await promptAgentSelection(agents)
|
|
74
|
+
if (selected.length === 0) {
|
|
75
|
+
console.log("\nNo se seleccionaron agentes. Nada instalado.\n")
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
finalScope = await select({
|
|
79
|
+
message: "Scope:",
|
|
80
|
+
choices: [
|
|
81
|
+
{ name: "Local (project)", value: "local" },
|
|
82
|
+
{ name: "Global (~home)", value: "global" }
|
|
83
|
+
],
|
|
84
|
+
default: finalScope as "local" | "global"
|
|
85
|
+
})
|
|
86
|
+
const ok = await confirm({ message: "Proceed?", default: true })
|
|
87
|
+
if (!ok) {
|
|
88
|
+
console.log("\nInstallation cancelled.\n")
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
} catch (e: any) {
|
|
92
|
+
if (e?.name === "ExitPromptError" || e?.message?.includes("SIGINT")) {
|
|
93
|
+
console.log("\nInstallation cancelled.\n")
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
throw e
|
|
89
97
|
}
|
|
90
98
|
} else {
|
|
91
99
|
selected = agents
|
|
@@ -490,25 +498,36 @@ export async function interactiveInstall(): Promise<void> {
|
|
|
490
498
|
return
|
|
491
499
|
}
|
|
492
500
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
501
|
+
let agents: ReturnType<typeof detectAgents>
|
|
502
|
+
let selected: Awaited<ReturnType<typeof promptAgentSelection>>
|
|
503
|
+
let scope: string
|
|
504
|
+
try {
|
|
505
|
+
agents = detectAgents()
|
|
506
|
+
selected = await promptAgentSelection(agents)
|
|
507
|
+
if (selected.length === 0) {
|
|
508
|
+
console.log("\nNo agents selected. Nothing installed.\n")
|
|
509
|
+
return
|
|
510
|
+
}
|
|
499
511
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
512
|
+
scope = await select({
|
|
513
|
+
message: "Scope:",
|
|
514
|
+
choices: [
|
|
515
|
+
{ name: "Local (project)", value: "local" },
|
|
516
|
+
{ name: "Global (~home)", value: "global" }
|
|
517
|
+
]
|
|
518
|
+
})
|
|
507
519
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
520
|
+
const ok = await confirm({ message: "Proceed?", default: true })
|
|
521
|
+
if (!ok) {
|
|
522
|
+
console.log("\nInstallation cancelled.\n")
|
|
523
|
+
return
|
|
524
|
+
}
|
|
525
|
+
} catch (e: any) {
|
|
526
|
+
if (e?.name === "ExitPromptError" || e?.message?.includes("SIGINT")) {
|
|
527
|
+
console.log("\nInstallation cancelled.\n")
|
|
528
|
+
return
|
|
529
|
+
}
|
|
530
|
+
throw e
|
|
512
531
|
}
|
|
513
532
|
|
|
514
533
|
console.log(`\nInstalling (${scope}) — ${selected.map((a) => a.name).join(", ")}...\n`)
|
package/src/mcp/memory-io.ts
CHANGED
|
@@ -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)
|
|
26
|
-
|
|
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)
|
|
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
|