Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
Merge main to fix conflicts
Sameer63051c3d2b949fda
diff --cc explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsxindex edc138d2,926ea173..7f10e40b--- a/explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsx+++ b/explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsx@@@ -51,18 -52,13 +52,19 @@@ export function LineageDiagram()document.body.removeChild(anchor);};- useEffect(() => {+ const [prevActiveId, setPrevActiveId] = useState(activeId);+ if (activeId !== prevActiveId) {+ setPrevActiveId(activeId);if (!activeId) {+ setError("");setNodes([]);setEdges([]);- return;}+ }++ useEffect(() => {+ let ignore = false;+ if (!activeId) return;const xLanes = [{ id: "group_agent", type: "group", position: { x: 50, y: 50 }, style: { width: 800, height: 120 } },@@@ -112,16 -110,13 +116,16 @@@style: { stroke: "#58a6ff" }}));- setNodes([...xLanes, ...mappedNodes]);- setEdges(mappedEdges);+ if (!ignore) {+ setNodes([...xLanes, ...mappedNodes]);+ setEdges(mappedEdges);+ }} catch (err) {- console.error(err);+ setError(err instanceof Error ? err.message : "Failed to load lineage.");}};- fetchLineage();+ void fetchLineage();+ return () => { ignore = true; };}, [activeId]);return (diff --cc explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsxindex 71c98961,3c6de057..95d9a478--- a/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx+++ b/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx@@@ -248,15 -248,6 +248,20 @@@ export function OntologyManager()const [rightPanel, setRightPanel] = useState<RightPanel>("none");const [actionMsg, setActionMsg] = useState<{ type: "ok" | "err"; text: string } | null>(null);+ const [prevSearchQ, setPrevSearchQ] = useState(searchQ);+ const [prevStatusFilter, setPrevStatusFilter] = useState(statusFilter);+ if (searchQ !== prevSearchQ || statusFilter !== prevStatusFilter) {+ setPrevSearchQ(searchQ);+ setPrevStatusFilter(statusFilter);+ setLoading(true);+ setActionMsg(null);+ }+++ const flashMsg = useCallback((type: "ok" | "err", text: string) => {++ setActionMsg({ type, text });++ setTimeout(() => setActionMsg(null), 3000);++ }, []);++const fetchRegistry = useCallback(async () => {setLoading(true);setActionMsg(null);@@@ -274,36 -265,17 +279,31 @@@} finally {setLoading(false);}-- }, [searchQ, statusFilter]);++ }, [searchQ, statusFilter, flashMsg]);useEffect(() => {- fetchRegistry();- }, [fetchRegistry]);-- const flashMsg = (type: "ok" | "err", text: string) => {- setActionMsg({ type, text });- setTimeout(() => setActionMsg(null), 3000);- };+ let ignore = false;+ async function fetchInitial() {+ try {+ const params = new URLSearchParams();+ if (searchQ) params.set("q", searchQ);+ const res = await fetch(`/api/ontology/registry?${params}`);+ if (res.ok) {+ const data = await res.json();+ if (!ignore) setEntries(data);+ } else {+ if (!ignore) setEntries([]);+ }+ } catch {+ if (!ignore) setEntries([]);+ } finally {+ if (!ignore) setLoading(false);+ }+ }+ void fetchInitial();+ return () => { ignore = true; };+ }, [searchQ, statusFilter]);- const flashMsg = (type: "ok" | "err", text: string) => {- setActionMsg({ type, text });- setTimeout(() => setActionMsg(null), 3000);- };-const handleToggle = useCallback(async (uri: string) => {try {const res = await fetch(`/api/ontology/${encodeURIComponent(uri)}/toggle`, {diff --cc explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsxindex 37094013,8e8c79c8..e0a911a5--- a/explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsx+++ b/explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsx@@@ -178,31 -178,19 +178,33 @@@ function DetailPanel(const [loading, setLoading] = useState(true);const [error, setError] = useState("");- useEffect(() => {+ const [prevUri, setPrevUri] = useState(uri);+ if (uri !== prevUri) {+ setPrevUri(uri);setLoading(true);setError("");+ setDetail(null);+ }++ useEffect(() => {+ let ignore = false;fetch(`/api/ontology/entity/${encodeURIComponent(uri)}`)- .then((r) => {+ .then(async (r) => {if (!r.ok) throw new Error("Not found");- return r.json();+ const data = await r.json();+ if (r.status === 207) setError(data.message || "Warning: Partial success loading entity.");+ return data;})- .then(setDetail)- .catch((e) => setError(e.message))- .finally(() => setLoading(false));+ .then((data) => {+ if (!ignore) setDetail(data);+ })+ .catch((e) => {+ if (!ignore) setError(e.message);+ })+ .finally(() => {+ if (!ignore) setLoading(false);+ });+ return () => { ignore = true; };}, [uri]);return (diff --cc explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsxindex d9284e64,355770e7..2e5df0ea--- a/explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsx+++ b/explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsx@@@ -77,33 -77,19 +77,35 @@@ function ConceptDetailPanel(const [loading, setLoading] = useState(true);const [error, setError] = useState("");- useEffect(() => {+ const [prevUri, setPrevUri] = useState(uri);+ if (uri !== prevUri) {+ setPrevUri(uri);setLoading(true);setError("");+ setDetail(null);+ }++ useEffect(() => {+ let ignore = false;fetch(`/api/ontology/skos/concept/${encodeURIComponent(uri)}`)- .then((r) => {+ .then(async (r) => {if (!r.ok) throw new Error("Concept not found");- return r.json();+ const data = await r.json();+ if (r.status === 207) setError(data.message || "Warning: Partial success loading concept.");+ return data;})- .then(setDetail)- .catch((e) => setError(e.message))- .finally(() => setLoading(false));+ .then((data) => {+ if (!ignore) setDetail(data);+ })+ .catch((e) => {+ if (!ignore) setError(e.message);+ })+ .finally(() => {+ if (!ignore) setLoading(false);+ });+ return () => {+ ignore = true;+ };}, [uri]);const renderUriList = (label: string, uris: string[]) => {@@@ -338,36 -324,26 +340,46 @@@ function SchemePanel(}) {const [expanded, setExpanded] = useState(true);const [hierarchy, setHierarchy] = useState<ConceptNode[]>([]);- const [loading, setLoading] = useState(false);+ const [loading, setLoading] = useState(expanded);+ const [error, setError] = useState("");+ const [prevExpanded, setPrevExpanded] = useState(expanded);+ const [prevSchemeUri, setPrevSchemeUri] = useState(scheme.uri);+ if (expanded !== prevExpanded || scheme.uri !== prevSchemeUri) {+ setPrevExpanded(expanded);+ setPrevSchemeUri(scheme.uri);+ if (expanded) {+ setLoading(true);++ setError("");+ setHierarchy([]);+ }+ }+useEffect(() => {+ let ignore = false;if (!expanded) return;- setLoading(true);- setError("");fetch(`/api/vocabulary/hierarchy?scheme=${encodeURIComponent(scheme.uri)}`)- .then((r) => (r.ok ? r.json() : []))+ .then(async (r) => {+ if (!r.ok) throw new Error(`HTTP ${r.status}`);+ const data = await r.json();- if (r.status === 207) setError(data.message || "Warning: Partial success loading hierarchy.");++ if (r.status === 207 && !ignore) setError(data.message || "Warning: Partial success loading hierarchy.");+ return data;+ })- .then(setHierarchy)+ .then((data) => {+ if (!ignore) setHierarchy(data);+ })- .catch(() => {- if (!ignore) setHierarchy([]);+ .catch((err) => {- setHierarchy([]);- setError(err instanceof Error ? err.message : "Failed to load hierarchy.");++ if (!ignore) {++ setHierarchy([]);++ setError(err instanceof Error ? err.message : "Failed to load hierarchy.");++ }})- .finally(() => setLoading(false));+ .finally(() => {+ if (!ignore) setLoading(false);+ });+ return () => {+ ignore = true;+ };}, [scheme.uri, expanded]);const totalConcepts = countConcepts(hierarchy);@@@ -446,8 -423,14 +459,13 @@@ export function SKOSVocabularyManager(const [selectedUri, setSelectedUri] = useState<string | null>(null);useEffect(() => {- setLoading(true);fetch("/api/ontology/skos/schemes")- .then((r) => (r.ok ? r.json() : []))+ .then(async (r) => {+ if (!r.ok) throw new Error(`Failed to load schemes (${r.status})`);+ const data = await r.json();+ if (r.status === 207) setError(data.message || "Warning: Partial success loading schemes.");+ return data;+ }).then(setSchemes).catch((e) => setError(e.message)).finally(() => setLoading(false));diff --cc explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsxindex 33f2efec,423383ce..52f72f12--- a/explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsx+++ b/explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsx@@@ -74,36 -83,12 +83,37 @@@ export function VersionsTab()}, []);useEffect(() => {- loadVersions();- loadProposals();- }, [loadVersions, loadProposals]);+ let ignore = false;+ async function fetchInitial() {+ try {+ const [propRes] = await Promise.all([+ fetch("/api/ontology/proposals"),+ ]);+ if (propRes.ok) {+ const propData = await propRes.json();+ if (!ignore) setProposals(propData);+ }+ } catch (e) {+ console.error("Failed to load proposals", e);+ }++ if (!ontologyUri) return;+ try {+ const verRes = await fetch(`/api/ontology/versions/${encodeURIComponent(ontologyUri)}`);+ if (verRes.ok) {+ const verData = await verRes.json();+ if (!ignore) setVersions(verData);+ }+ } catch (e) {+ console.error("Failed to load versions", e);+ }+ }+ void fetchInitial();+ return () => { ignore = true; };+ }, [ontologyUri]);const approveProposal = useCallback(async (proposalId: string) => {+ setError("");try {const response = await fetch(`/api/ontology/proposals/${proposalId}/approve`, {method: "POST",