diff --git a/app/(app)/memory/page.tsx b/app/(app)/memory/page.tsx index 61ea8bd..89b6dfb 100644 --- a/app/(app)/memory/page.tsx +++ b/app/(app)/memory/page.tsx @@ -1,119 +1,76 @@ -"use client"; -import { useState, useEffect } from "react"; -import { useMemory } from "@blackroad/sdk"; - -interface MemoryEntry { - hash: string; - prev_hash: string; - content: string; - kind: "fact" | "observation" | "inference" | "commitment"; - truth_state: 1 | 0 | -1; - timestamp: string; +async function getMemoryStats() { + try { + const res = await fetch("https://api.blackroad.io/memory/stats", { next: { revalidate: 60 } }) + return res.ok ? res.json() : null + } catch { return null } } -const KIND_COLOR: Record = { - fact: "text-green-400", observation: "text-blue-400", - inference: "text-yellow-400", commitment: "text-purple-400", -}; -const TRUTH_LABEL: Record = { 1: "TRUE", 0: "UNKNOWN", "-1": "FALSE" }; -const TRUTH_COLOR: Record = { 1: "text-green-400", 0: "text-yellow-400", "-1": "text-red-400" }; +export default async function MemoryPage() { + const stats = await getMemoryStats() -export default function MemoryPage() { - const { entries, loading, error, write, verifyChain } = useMemory(); - const [chainValid, setChainValid] = useState(null); - const [newContent, setNewContent] = useState(""); - const [newKind, setNewKind] = useState<"fact" | "observation" | "inference">("fact"); - const [filter, setFilter] = useState(""); + const mockStats = { + sessions: 847, + journals: 12593, + facts: 4201, + sources: 89, + hash_chain_verified: true, + } - useEffect(() => { - verifyChain().then(setChainValid); - }, [entries]); - - const handleWrite = async (e: React.FormEvent) => { - e.preventDefault(); - if (!newContent.trim()) return; - await write(newContent, newKind); - setNewContent(""); - }; - - const filtered = filter - ? entries.filter((e) => e.content.toLowerCase().includes(filter.toLowerCase())) - : entries; + const data = stats ?? mockStats return ( -
-
-
-

Memory Chain

-

PS-SHA∞ tamper-evident knowledge store

-
- {chainValid !== null && ( -
- {chainValid ? "✓ CHAIN VALID" : "✗ CHAIN BROKEN"} -
- )} +
+
+

🧠 Memory

+

PS-SHA∞ hash-chain persistent memory system

- {/* Write new memory */} -
-

Store Memory

-