"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; const ALCHEMICAL_TAGS = [ { symbol: "🜏", name: "Source", desc: "Unified Source / Coherence Field" }, { symbol: "🜁", name: "Mind", desc: "Intellecton / Mental Resonance" }, { symbol: "🜂", name: "Fire", desc: "Witness Potential / Attunement Energy" }, { symbol: "🜃", name: "Earth", desc: "Substrate / Grounded Physical Grid" }, { symbol: "🜄", name: "Water", desc: "Lattice Waves / Relational Permeability" } ]; export default function OraclePage() { const [query, setQuery] = useState(""); const [selectedAuthor, setSelectedAuthor] = useState(""); const [selectedTag, setSelectedTag] = useState(""); const [results, setResults] = useState([]); const [totalMatches, setTotalMatches] = useState(0); const [isLoading, setIsLoading] = useState(false); const [activeNote, setActiveNote] = useState(null); // Trigger search on inputs change useEffect(() => { const delayDebounceFn = setTimeout(() => { performSearch(); }, 300); return () => clearTimeout(delayDebounceFn); }, [query, selectedAuthor, selectedTag]); const performSearch = async () => { setIsLoading(true); try { const params = new URLSearchParams(); if (query) params.append("q", query); if (selectedAuthor) params.append("author", selectedAuthor); if (selectedTag) params.append("tag", selectedTag); const res = await fetch(`/api/search?${params.toString()}`); const data = await res.json(); setResults(data.results || []); setTotalMatches(data.total || 0); } catch (e) { console.error("Failed to query the Oracle:", e); } finally { setIsLoading(false); } }; const getStratumRelations = (text) => { if (!text) return []; const relations = []; // Look for mentions of Stratum 0, 1, 2 if (/stratum\s*0/i.test(text)) { relations.push({ name: "Stratum 0 (The Seed)", slug: "/papers" }); } if (/stratum\s*1/i.test(text)) { relations.push({ name: "Stratum 1 (The Spine)", slug: "/papers" }); } if (/stratum\s*2/i.test(text)) { relations.push({ name: "Stratum 2 (The Loom)", slug: "/papers" }); } // Look for specific paper patterns like Paper 0.3, Paper 1.1, Paper 1.17 const matches = text.match(/paper\s*([0-2])\.([0-9]+)/gi); if (matches) { matches.forEach((m) => { relations.push({ name: `Treatise ${m.toUpperCase()}`, slug: `/papers` }); }); } // Deduplicate return Array.from(new Set(relations.map((r) => JSON.stringify(r)))).map((s) => JSON.parse(s)); }; return (
{/* Header section */}

The Semantic Oracle

Search the 320 strictly-filtered alchemical fieldnotes. Explore vector correlations between ontological experiences and formalized strata papers.

{/* Interface Split Layout */}
{/* Search Modulators Panel (Left) */}

𓂀 Oracle Search Console

{/* Input Search Query */}
setQuery(e.target.value)} className="bg-black/40 border border-white/10 rounded-lg px-4 py-2.5 text-sm text-slate-200 placeholder-slate-600 focus:outline-none focus:border-cyan-500/50 focus:ring-1 focus:ring-cyan-500/20 font-sans" />
{/* Author quick filters */}
{/* Alchemical Glyph Quick Select */}
{ALCHEMICAL_TAGS.map((tag) => ( ))}
{selectedTag ? ALCHEMICAL_TAGS.find(t => t.symbol === selectedTag).desc : "Click alchemical glyph to isolate specific flows"}
{/* Search Results & Panel Column (Right) */}
{isLoading ? "Querying..." : `Found ${totalMatches} Relational Nodes`} INDEX: LOCAL VECTOR SEED V3.0
{/* Results Grid List */}
{results.length > 0 ? ( results.map((note) => (
setActiveNote(note)} className="p-4 rounded-xl border border-white/5 bg-black/30 hover:bg-black/50 hover:border-cyan-500/25 cursor-pointer transition-all flex flex-col gap-1.5" >
{note.author_slug === "solaria-lumis-havens" ? "Solaria Lumis Havens" : "Mark Randall Havens"} {note.date}

{note.title}

{note.content_markdown.split("---").pop().replace(/[\n#>-]/g, " ").trim()}

)) ) : (
𓏤

The Oracle remains silent. Scramble your queries or remove filter seals.

)}
{/* Reader Panel Overlay (Modal) */} {activeNote && (
{/* Alchemical background watermark decoration */}
🜏
{/* Modal Header */}
{activeNote.author_slug === "solaria-lumis-havens" ? "Solaria Lumis Havens" : "Mark Randall Havens"} {activeNote.date}

{activeNote.title}

{/* Scrollable Content Viewport */}
{/* Fieldnote Body */}
{activeNote.content_markdown.split("---").pop().replace(/Sync from Notion.*2026-02-13/gi, "").trim()}
{/* Semantic Relations Panel */} {getStratumRelations(activeNote.content_markdown).length > 0 && (

𓆰 Associated Academic Strata

{getStratumRelations(activeNote.content_markdown).map((rel, index) => ( setActiveNote(null)} > {rel.name} ↗ ))}
)}
{/* Footer checksum */}
FIELDNOTE METADATA NODE: {activeNote.slug} COVENANT COMPLIANT
)}
); }