@cerefox/memory 0.9.5 → 0.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.
@@ -4,9 +4,19 @@
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/png" href="/app/cerefox_icon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
+ <link
10
+ rel="stylesheet"
11
+ href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"
12
+ />
13
+ <link
14
+ rel="stylesheet"
15
+ href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap"
16
+ />
7
17
  <title>Cerefox</title>
8
- <script type="module" crossorigin src="/app/assets/index-BHVfMLlE.js"></script>
9
- <link rel="stylesheet" crossorigin href="/app/assets/index-DoDJGRih.css">
18
+ <script type="module" crossorigin src="/app/assets/index-LidcEDZ3.js"></script>
19
+ <link rel="stylesheet" crossorigin href="/app/assets/index-CTOQrOUn.css">
10
20
  </head>
11
21
  <body>
12
22
  <div id="root"></div>
@@ -1721,3 +1721,54 @@ AS $$
1721
1721
  AND p.proname = p_name
1722
1722
  );
1723
1723
  $$;
1724
+
1725
+
1726
+
1727
+ -- ─────────────────────────────────────────────────────────────────────────
1728
+ -- Corpus totals (dashboard aggregates)
1729
+ -- ─────────────────────────────────────────────────────────────────────────
1730
+ -- Cheap global aggregates for the dashboard stat strip: total current chunks
1731
+ -- (version_id IS NULL, on non-deleted documents) and total characters across
1732
+ -- active documents. SUM cannot be expressed over the Data API, so it lives
1733
+ -- here as a single STABLE function the /dashboard route calls once.
1734
+
1735
+ CREATE OR REPLACE FUNCTION cerefox_corpus_totals()
1736
+ RETURNS TABLE (total_chunks BIGINT, total_chars BIGINT)
1737
+ LANGUAGE sql
1738
+ STABLE
1739
+ SECURITY DEFINER
1740
+ SET search_path = public, pg_catalog
1741
+ AS $$
1742
+ SELECT
1743
+ (SELECT COUNT(*)
1744
+ FROM cerefox_chunks c
1745
+ JOIN cerefox_documents d ON d.id = c.document_id
1746
+ WHERE c.version_id IS NULL
1747
+ AND d.deleted_at IS NULL)::BIGINT AS total_chunks,
1748
+ (SELECT COALESCE(SUM(total_chars), 0)
1749
+ FROM cerefox_documents
1750
+ WHERE deleted_at IS NULL)::BIGINT AS total_chars;
1751
+ $$;
1752
+
1753
+
1754
+
1755
+ -- ─────────────────────────────────────────────────────────────────────────
1756
+ -- Recent-doc authors (dashboard "Author" column)
1757
+ -- ─────────────────────────────────────────────────────────────────────────
1758
+ -- The latest audit author (+ type) per document, for the given doc ids.
1759
+ -- "Latest editor" — used by the /dashboard recent-docs list so the Author
1760
+ -- column can show who last touched a doc (agent vs human). Read-only.
1761
+
1762
+ CREATE OR REPLACE FUNCTION cerefox_recent_doc_authors(p_doc_ids UUID[])
1763
+ RETURNS TABLE (document_id UUID, author TEXT, author_type TEXT)
1764
+ LANGUAGE sql
1765
+ STABLE
1766
+ SECURITY DEFINER
1767
+ SET search_path = public, pg_catalog
1768
+ AS $$
1769
+ SELECT DISTINCT ON (a.document_id)
1770
+ a.document_id, a.author, a.author_type
1771
+ FROM cerefox_audit_log a
1772
+ WHERE a.document_id = ANY(p_doc_ids)
1773
+ ORDER BY a.document_id, a.created_at DESC;
1774
+ $$;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerefox/memory",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Cerefox — user-owned shared memory for AI agents. The local TypeScript runtime: stdio MCP server in v0.4; CLI binary added in v0.5; in-process web server in v0.6; ingestion pipeline in v0.7.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/fstamatelopoulos/cerefox",