toon-memory 2.9.2 → 2.9.5

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/README.md CHANGED
@@ -173,6 +173,7 @@ memory_remember # Save important decisions
173
173
  | `memory_suggest` | Find related entries for a given context |
174
174
  | `memory_encrypt` | Enable AES-256-GCM encryption |
175
175
  | `memory_decrypt` | Disable encryption |
176
+ | `memory_backup` | Create timestamped backup of memory file (auto-prunes to 10 most recent) |
176
177
  | `memory_captured` | List activity auto-captured by hooks (opt-in) or clear the log |
177
178
  | `memory_consolidate` | Merge-dedup entries: same-key entries are merged (tags union, max confidence, latest date), then exact-content duplicates removed (deterministic, no LLM) |
178
179
  | `memory_sessions` | Show active agent sessions (branch, files, last-seen) and soft conflicts for parallel work |
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
- selected = await promptAgentSelection(agents);
764
- if (selected.length === 0) {
765
- console.log("\nNo se seleccionaron agentes. Nada instalado.\n");
766
- return;
767
- }
768
- finalScope = await select({
769
- message: "Scope:",
770
- choices: [
771
- { name: "Local (project)", value: "local" },
772
- { name: "Global (~home)", value: "global" }
773
- ],
774
- default: finalScope
775
- });
776
- const ok = await confirm({ message: "Proceed?", default: true });
777
- if (!ok) {
778
- console.log("\nInstallation cancelled.\n");
779
- return;
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
- const agents = detectAgents();
1100
- const selected = await promptAgentSelection(agents);
1101
- if (selected.length === 0) {
1102
- console.log("\nNo agents selected. Nothing installed.\n");
1103
- return;
1104
- }
1105
- const scope = await select({
1106
- message: "Scope:",
1107
- choices: [
1108
- { name: "Local (project)", value: "local" },
1109
- { name: "Global (~home)", value: "global" }
1110
- ]
1111
- });
1112
- const ok = await confirm({ message: "Proceed?", default: true });
1113
- if (!ok) {
1114
- console.log("\nInstallation cancelled.\n");
1115
- return;
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
@@ -27863,7 +27863,7 @@ var isExpiredLocal = (ttl) => {
27863
27863
  function importance(e) {
27864
27864
  const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
27865
27865
  const days = (Date.now() - (/* @__PURE__ */ new Date(`${e.date || today}T00:00:00`)).getTime()) / 864e5;
27866
- const recency = Math.max(0, 30 - days) / 30;
27866
+ const recency = Math.min(1, Math.max(0, 30 - days) / 30);
27867
27867
  const freq = Math.min(1, e.accessed / 5);
27868
27868
  return recency * 0.6 + freq * 0.4;
27869
27869
  }
@@ -30184,7 +30184,7 @@ function registerResources(server2) {
30184
30184
 
30185
30185
  // src/mcp/server.ts
30186
30186
  var server = new McpServer(
30187
- { name: "toon-memory", version: "2.9.2" },
30187
+ { name: "toon-memory", version: "2.9.5" },
30188
30188
  { capabilities: { tools: { listChanged: true }, resources: { listChanged: true } } }
30189
30189
  );
30190
30190
  registerResources(server);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toon-memory",
3
- "version": "2.9.2",
3
+ "version": "2.9.5",
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": {
@@ -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
- selected = await promptAgentSelection(agents)
73
- if (selected.length === 0) {
74
- console.log("\nNo se seleccionaron agentes. Nada instalado.\n")
75
- return
76
- }
77
- finalScope = await select({
78
- message: "Scope:",
79
- choices: [
80
- { name: "Local (project)", value: "local" },
81
- { name: "Global (~home)", value: "global" }
82
- ],
83
- default: finalScope as "local" | "global"
84
- })
85
- const ok = await confirm({ message: "Proceed?", default: true })
86
- if (!ok) {
87
- console.log("\nInstallation cancelled.\n")
88
- return
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
- const agents = detectAgents()
494
- const selected = await promptAgentSelection(agents)
495
- if (selected.length === 0) {
496
- console.log("\nNo agents selected. Nothing installed.\n")
497
- return
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
- const scope = await select({
501
- message: "Scope:",
502
- choices: [
503
- { name: "Local (project)", value: "local" },
504
- { name: "Global (~home)", value: "global" }
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
- const ok = await confirm({ message: "Proceed?", default: true })
509
- if (!ok) {
510
- console.log("\nInstallation cancelled.\n")
511
- return
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/lib/utils.ts CHANGED
@@ -17,7 +17,7 @@ export function importance(e: { date: string; accessed: number }): number {
17
17
  const today = new Date().toISOString().split("T")[0]
18
18
  const days =
19
19
  (Date.now() - new Date(`${e.date || today}T00:00:00`).getTime()) / 86400000
20
- const recency = Math.max(0, 30 - days) / 30
20
+ const recency = Math.min(1, Math.max(0, 30 - days) / 30)
21
21
  const freq = Math.min(1, e.accessed / 5)
22
22
  return recency * 0.6 + freq * 0.4
23
23
  }