@vheins/local-memory-mcp 0.8.29 → 0.8.30

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.
@@ -3,8 +3,8 @@ import { fileURLToPath } from "url";
3
3
  import path from "path";
4
4
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
5
5
  var pkgVersion = "0.1.0";
6
- if ("0.8.29") {
7
- pkgVersion = "0.8.29";
6
+ if ("0.8.30") {
7
+ pkgVersion = "0.8.30";
8
8
  } else {
9
9
  let searchDir = __dirname;
10
10
  for (let i = 0; i < 5; i++) {
@@ -1678,10 +1678,11 @@ var TaskEntity = class extends BaseEntity {
1678
1678
  const added = this.get(`SELECT COUNT(*) as count FROM tasks WHERE repo = ? ${addedDateFilter}`, [
1679
1679
  repo
1680
1680
  ]);
1681
+ const avgDurationMinutes = stats?.avg_duration_seconds ? stats.avg_duration_seconds / 60 : 0;
1681
1682
  return {
1682
1683
  completed: stats?.completed_count || 0,
1683
1684
  tokens: stats?.total_tokens || 0,
1684
- avgDuration: stats?.avg_duration_seconds || 0,
1685
+ avgDuration: avgDurationMinutes,
1685
1686
  added: added?.count || 0
1686
1687
  };
1687
1688
  }
@@ -1823,43 +1824,85 @@ var SystemEntity = class extends BaseEntity {
1823
1824
  const memoryCountRow = this.get("SELECT COUNT(*) as count FROM memories WHERE repo = ?", [
1824
1825
  repo
1825
1826
  ]);
1826
- const taskCountRow = this.get("SELECT COUNT(*) as count FROM tasks WHERE repo = ?", [repo]);
1827
1827
  const lastActivityRow = this.get(
1828
1828
  `SELECT MAX(created_at) as last FROM (SELECT created_at FROM memories WHERE repo = ? UNION ALL SELECT created_at FROM tasks WHERE repo = ? UNION ALL SELECT created_at FROM action_log WHERE repo = ?)`,
1829
1829
  [repo, repo, repo]
1830
1830
  );
1831
+ const taskStatusRows = this.all(
1832
+ "SELECT status, COUNT(*) as count FROM tasks WHERE repo = ? GROUP BY status",
1833
+ [repo]
1834
+ );
1835
+ const taskStatusMap = {};
1836
+ taskStatusRows.forEach((r) => {
1837
+ taskStatusMap[r.status] = r.count;
1838
+ });
1839
+ const taskCount = taskStatusRows.reduce((sum, r) => sum + r.count, 0);
1831
1840
  return {
1832
1841
  repo,
1833
1842
  memoryCount: memoryCountRow?.count ?? 0,
1834
- taskCount: taskCountRow?.count ?? 0,
1843
+ taskCount,
1844
+ inProgressCount: taskStatusMap["in_progress"] ?? 0,
1845
+ pendingCount: taskStatusMap["pending"] ?? 0,
1846
+ blockedCount: taskStatusMap["blocked"] ?? 0,
1847
+ backlogCount: taskStatusMap["backlog"] ?? 0,
1835
1848
  lastActivity: lastActivityRow?.last ?? null
1836
1849
  };
1837
1850
  });
1838
1851
  }
1839
1852
  getDashboardStats(repo) {
1840
- const memoryStats = this.all(
1841
- "SELECT type, COUNT(*) as count FROM memories WHERE repo = ? GROUP BY type",
1853
+ const totalCountRow = this.get("SELECT COUNT(*) as count FROM memories WHERE repo = ?", [repo]);
1854
+ const avgImportanceRow = this.get("SELECT AVG(importance) as avg FROM memories WHERE repo = ?", [
1855
+ repo
1856
+ ]);
1857
+ const totalHitCountRow = this.get(
1858
+ "SELECT SUM(hit_count) as count FROM memories WHERE repo = ?",
1842
1859
  [repo]
1843
1860
  );
1844
- const taskStats = this.all(
1845
- "SELECT status, COUNT(*) as count FROM tasks WHERE repo = ? GROUP BY status",
1861
+ const expiringSoonRow = this.get(
1862
+ "SELECT COUNT(*) as count FROM memories WHERE repo = ? AND expires_at IS NOT NULL AND expires_at > ? AND expires_at <= ?",
1863
+ [repo, (/* @__PURE__ */ new Date()).toISOString(), new Date(Date.now() + 7 * 86400 * 1e3).toISOString()]
1864
+ );
1865
+ const typeStats = this.all(
1866
+ "SELECT type, COUNT(*) as count FROM memories WHERE repo = ? GROUP BY type",
1846
1867
  [repo]
1847
1868
  );
1848
- const recentMemoriesRows = this.all(
1849
- "SELECT * FROM memories WHERE repo = ? ORDER BY created_at DESC LIMIT 5",
1869
+ const byType = {};
1870
+ typeStats.forEach((t) => {
1871
+ byType[t.type] = t.count;
1872
+ });
1873
+ const taskRows = this.all(
1874
+ "SELECT status, COUNT(*) as count FROM tasks WHERE repo = ? GROUP BY status",
1850
1875
  [repo]
1851
1876
  );
1852
- const recentMemories = recentMemoriesRows.map((r) => this.rowToMemoryEntry(r));
1853
- const activeTasksRows = this.all(
1854
- "SELECT * FROM tasks WHERE repo = ? AND status IN ('in_progress', 'pending', 'backlog') ORDER BY priority DESC, created_at ASC LIMIT 5",
1877
+ const taskStats = {
1878
+ total: 0,
1879
+ backlog: 0,
1880
+ pending: 0,
1881
+ in_progress: 0,
1882
+ completed: 0,
1883
+ blocked: 0
1884
+ };
1885
+ taskRows.forEach((r) => {
1886
+ taskStats.total += r.count;
1887
+ if (r.status === "backlog") taskStats.backlog = r.count;
1888
+ else if (r.status === "pending") taskStats.pending = r.count;
1889
+ else if (r.status === "in_progress") taskStats.in_progress = r.count;
1890
+ else if (r.status === "completed") taskStats.completed = r.count;
1891
+ else if (r.status === "blocked") taskStats.blocked = r.count;
1892
+ });
1893
+ const topMemoriesRows = this.all(
1894
+ "SELECT * FROM memories WHERE repo = ? ORDER BY importance DESC, created_at DESC LIMIT 5",
1855
1895
  [repo]
1856
1896
  );
1857
- const activeTasks = activeTasksRows.map((r) => this.rowToTask(r));
1897
+ const topMemories = topMemoriesRows.map((r) => this.rowToMemoryEntry(r));
1858
1898
  return {
1859
- memoryStats,
1899
+ total: totalCountRow?.count ?? 0,
1900
+ avgImportance: (avgImportanceRow?.avg ?? 0).toFixed(1),
1901
+ totalHitCount: totalHitCountRow?.count ?? 0,
1902
+ expiringSoon: expiringSoonRow?.count ?? 0,
1903
+ byType,
1860
1904
  taskStats,
1861
- recentMemories,
1862
- activeTasks
1905
+ topMemories
1863
1906
  };
1864
1907
  }
1865
1908
  getGlobalStats() {