@ltm-blueverse/alpha-semantic-hub 0.7.0
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.
- package/LICENSE +21 -0
- package/README.md +1674 -0
- package/explorer/README.md +282 -0
- package/explorer/src/App.css +0 -0
- package/explorer/src/App.tsx +2035 -0
- package/explorer/src/ErrorBoundary.tsx +112 -0
- package/explorer/src/ExploreWorkspaceTabs.tsx +29 -0
- package/explorer/src/assets/hero.png +0 -0
- package/explorer/src/assets/react.svg +1 -0
- package/explorer/src/assets/vite.svg +1 -0
- package/explorer/src/explorerCapabilities.ts +24 -0
- package/explorer/src/index.css +71 -0
- package/explorer/src/main.tsx +7 -0
- package/explorer/src/store/edgePairKeys.d.ts +2 -0
- package/explorer/src/store/edgePairKeys.js +7 -0
- package/explorer/src/store/graphStore.ts +183 -0
- package/explorer/src/store/registryStore.ts +78 -0
- package/explorer/src/types.d.ts +16 -0
- package/explorer/src/ui/primitives.css +414 -0
- package/explorer/src/ui/primitives.tsx +170 -0
- package/explorer/src/workspaces/DecisionWorkspace/DecisionWorkspace.tsx +279 -0
- package/explorer/src/workspaces/DiffMergeWorkspace/DiffMergeWorkspace.tsx +121 -0
- package/explorer/src/workspaces/EnrichWorkspace/EntityResolutionTab.tsx +454 -0
- package/explorer/src/workspaces/EnrichWorkspace/RegistryTab.tsx +285 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphCanvas.tsx +2673 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphInspectorPanel.tsx +771 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx +410 -0
- package/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx +3584 -0
- package/explorer/src/workspaces/GraphWorkspace/MarkdownContentViewer.tsx +705 -0
- package/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx +55 -0
- package/explorer/src/workspaces/GraphWorkspace/TimelinePanel.tsx +193 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/clickSelectionBehavior.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/fitViewBehavior.ts +15 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts +25 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/hoverActivationBehavior.ts +15 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/pathHighlightBehavior.ts +52 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts +36 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts +41 -0
- package/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/graphAnalytics.ts +779 -0
- package/explorer/src/workspaces/GraphWorkspace/graphColorLegend.ts +36 -0
- package/explorer/src/workspaces/GraphWorkspace/graphConfig.ts +102 -0
- package/explorer/src/workspaces/GraphWorkspace/graphEntityShape.ts +34 -0
- package/explorer/src/workspaces/GraphWorkspace/graphLoading.ts +84 -0
- package/explorer/src/workspaces/GraphWorkspace/graphSceneLayers.ts +775 -0
- package/explorer/src/workspaces/GraphWorkspace/graphSceneState.ts +2753 -0
- package/explorer/src/workspaces/GraphWorkspace/graphStructureLayer.ts +335 -0
- package/explorer/src/workspaces/GraphWorkspace/graphTheme.ts +1078 -0
- package/explorer/src/workspaces/GraphWorkspace/graphViewCopy.ts +41 -0
- package/explorer/src/workspaces/GraphWorkspace/localGraphTransition.ts +9 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownEditorState.ts +114 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownResourceClient.ts +103 -0
- package/explorer/src/workspaces/GraphWorkspace/markdownUrlSafety.ts +29 -0
- package/explorer/src/workspaces/GraphWorkspace/nodeMarkdownSync.ts +81 -0
- package/explorer/src/workspaces/GraphWorkspace/pluginRegistryPredicates.ts +24 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPlugin.tsx +353 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPluginPhaseC.tsx +522 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/index.ts +16 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/legendPlugin.tsx +120 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/neighborhoodPanelPlugin.tsx +231 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx +142 -0
- package/explorer/src/workspaces/GraphWorkspace/plugins/types.ts +106 -0
- package/explorer/src/workspaces/GraphWorkspace/realtimeGraphAttributes.ts +50 -0
- package/explorer/src/workspaces/GraphWorkspace/scene.ts +79 -0
- package/explorer/src/workspaces/GraphWorkspace/sigmaNativeRendering.ts +421 -0
- package/explorer/src/workspaces/GraphWorkspace/smallGraphLayout.ts +135 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalLifecyclePredicates.ts +31 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalScrubberBounds.ts +46 -0
- package/explorer/src/workspaces/GraphWorkspace/temporalSnapshotGuards.ts +113 -0
- package/explorer/src/workspaces/GraphWorkspace/types.ts +395 -0
- package/explorer/src/workspaces/GraphWorkspace/useLoadGraph.ts +746 -0
- package/explorer/src/workspaces/GraphWorkspace/useMarkdownEditor.ts +177 -0
- package/explorer/src/workspaces/ImportExportWorkspace/ImportExportWorkspace.tsx +196 -0
- package/explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsx +177 -0
- package/explorer/src/workspaces/ManageWorkspace/KGOverviewTab.tsx +291 -0
- package/explorer/src/workspaces/ManageWorkspace/OntologySummaryTab.tsx +346 -0
- package/explorer/src/workspaces/MemoryWorkspace.tsx +464 -0
- package/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx +437 -0
- package/explorer/src/workspaces/OntologyWorkspace/HealthTab.tsx +214 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyEditor.tsx +770 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyLoader.tsx +913 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx +930 -0
- package/explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsx +590 -0
- package/explorer/src/workspaces/OntologyWorkspace/ProposalReview.tsx +429 -0
- package/explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsx +696 -0
- package/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx +363 -0
- package/explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsx +546 -0
- package/explorer/src/workspaces/OntologyWorkspace/api.ts +164 -0
- package/explorer/src/workspaces/OntologyWorkspace/index.tsx +101 -0
- package/explorer/src/workspaces/OntologyWorkspace/ontologyEditorModel.ts +87 -0
- package/explorer/src/workspaces/OntologyWorkspace/ontologyUrlState.ts +94 -0
- package/explorer/src/workspaces/OntologyWorkspace/types.ts +119 -0
- package/explorer/src/workspaces/ReasoningWorkspace.tsx +243 -0
- package/explorer/src/workspaces/SparqlWorkspace/SparqlWorkspace.tsx +271 -0
- package/explorer/src/workspaces/VocabularyWorkspace/ConceptTree.tsx +97 -0
- package/explorer/src/workspaces/VocabularyWorkspace/ImportDropzone.tsx +95 -0
- package/explorer/src/workspaces/VocabularyWorkspace/PropertyPanel.tsx +116 -0
- package/explorer/src/workspaces/VocabularyWorkspace/Sidebar.tsx +112 -0
- package/explorer/src/workspaces/VocabularyWorkspace/VocabularyWorkspace.tsx +70 -0
- package/explorer/src/workspaces/VocabularyWorkspace/queries.ts +52 -0
- package/explorer/src/workspaces/VocabularyWorkspace/types.ts +24 -0
- package/package.json +31 -0
- package/plugins/.claude-plugin/README.md +262 -0
- package/plugins/.claude-plugin/marketplace.json +20 -0
- package/plugins/.claude-plugin/plugin.json +33 -0
- package/plugins/.cline-plugin/README.md +32 -0
- package/plugins/.cline-plugin/marketplace.json +17 -0
- package/plugins/.cline-plugin/plugin.json +35 -0
- package/plugins/.codex-plugin/marketplace.json +21 -0
- package/plugins/.codex-plugin/plugin.json +35 -0
- package/plugins/.continue-plugin/README.md +34 -0
- package/plugins/.continue-plugin/marketplace.json +17 -0
- package/plugins/.continue-plugin/plugin.json +33 -0
- package/plugins/.cursor-plugin/marketplace.json +18 -0
- package/plugins/.cursor-plugin/plugin.json +32 -0
- package/plugins/.openclaw-plugin/README.md +62 -0
- package/plugins/.openclaw-plugin/marketplace.json +18 -0
- package/plugins/.openclaw-plugin/plugin.json +46 -0
- package/plugins/.pi-plugin/README.md +35 -0
- package/plugins/.vscode-plugin/README.md +48 -0
- package/plugins/.vscode-plugin/marketplace.json +17 -0
- package/plugins/.vscode-plugin/plugin.json +35 -0
- package/plugins/.windsurf-plugin/README.md +39 -0
- package/plugins/.windsurf-plugin/marketplace.json +17 -0
- package/plugins/.windsurf-plugin/plugin.json +35 -0
- package/plugins/agents/decision-advisor.md +126 -0
- package/plugins/agents/explainability.md +129 -0
- package/plugins/agents/kg-assistant.md +73 -0
- package/plugins/hooks/hooks.json +12 -0
- package/plugins/skills/causal/SKILL.md +74 -0
- package/plugins/skills/change/SKILL.md +80 -0
- package/plugins/skills/decision/SKILL.md +197 -0
- package/plugins/skills/deduplicate/SKILL.md +41 -0
- package/plugins/skills/embed/SKILL.md +230 -0
- package/plugins/skills/explain/SKILL.md +44 -0
- package/plugins/skills/export/SKILL.md +67 -0
- package/plugins/skills/extract/SKILL.md +93 -0
- package/plugins/skills/ingest/SKILL.md +38 -0
- package/plugins/skills/ontology/SKILL.md +89 -0
- package/plugins/skills/policy/SKILL.md +66 -0
- package/plugins/skills/provenance/SKILL.md +70 -0
- package/plugins/skills/query/SKILL.md +84 -0
- package/plugins/skills/reason/SKILL.md +201 -0
- package/plugins/skills/temporal/SKILL.md +164 -0
- package/plugins/skills/validate/SKILL.md +228 -0
- package/plugins/skills/visualize/SKILL.md +249 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
import { AlertCircle } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
interface ErrorBoundaryProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface ErrorBoundaryState {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
retryCount: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const RETRY_SETTLE_MS = 5000;
|
|
15
|
+
|
|
16
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
17
|
+
private settleTimer: ReturnType<typeof setTimeout> | null = null;
|
|
18
|
+
|
|
19
|
+
constructor(props: ErrorBoundaryProps) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.state = { hasError: false, error: null, retryCount: 0 };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState> {
|
|
25
|
+
return { hasError: true, error };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
29
|
+
console.error("ErrorBoundary caught an error:", error, errorInfo);
|
|
30
|
+
this.clearSettleTimer();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
componentWillUnmount() {
|
|
34
|
+
this.clearSettleTimer();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private clearSettleTimer() {
|
|
38
|
+
if (this.settleTimer !== null) {
|
|
39
|
+
clearTimeout(this.settleTimer);
|
|
40
|
+
this.settleTimer = null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
resetErrorBoundary = () => {
|
|
45
|
+
this.clearSettleTimer();
|
|
46
|
+
this.setState((prev) => ({
|
|
47
|
+
hasError: false,
|
|
48
|
+
error: null,
|
|
49
|
+
retryCount: prev.retryCount + 1
|
|
50
|
+
}));
|
|
51
|
+
// Only clear the retry count once the workspace has stayed error-free for a
|
|
52
|
+
// sustained period, rather than on the next committed render (which can fire
|
|
53
|
+
// while Suspense is still showing its fallback) or immediately on retry
|
|
54
|
+
// (which would allow an unbounded number of clicks on a deterministic crash).
|
|
55
|
+
this.settleTimer = setTimeout(() => {
|
|
56
|
+
this.settleTimer = null;
|
|
57
|
+
this.setState({ retryCount: 0 });
|
|
58
|
+
}, RETRY_SETTLE_MS);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
render() {
|
|
62
|
+
if (this.state.hasError) {
|
|
63
|
+
const maxRetriesReached = this.state.retryCount >= 3;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
className="workspace-loading"
|
|
68
|
+
style={{
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
gap: 12,
|
|
71
|
+
color: 'var(--ws-red)'
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<AlertCircle size={32} style={{ marginBottom: 4, opacity: 0.8 }} />
|
|
75
|
+
<div style={{ fontWeight: 500, fontSize: '15px' }}>
|
|
76
|
+
Something went wrong in this view.
|
|
77
|
+
</div>
|
|
78
|
+
<div style={{ fontSize: '13px', opacity: 0.7, maxWidth: 450, textAlign: 'center', marginBottom: 8, lineHeight: 1.5 }}>
|
|
79
|
+
{maxRetriesReached
|
|
80
|
+
? "This view continues to encounter a critical error. Please switch to another workspace or reload the page to restore functionality."
|
|
81
|
+
: "An unexpected problem occurred while rendering this workspace. Your data is safe, but this view cannot be displayed."}
|
|
82
|
+
</div>
|
|
83
|
+
{!maxRetriesReached ? (
|
|
84
|
+
<button
|
|
85
|
+
className="ws-btn ws-btn--ghost"
|
|
86
|
+
style={{
|
|
87
|
+
borderColor: 'var(--ws-red-soft)',
|
|
88
|
+
color: 'var(--ws-red)'
|
|
89
|
+
}}
|
|
90
|
+
onClick={this.resetErrorBoundary}
|
|
91
|
+
>
|
|
92
|
+
Try Again
|
|
93
|
+
</button>
|
|
94
|
+
) : (
|
|
95
|
+
<button
|
|
96
|
+
className="ws-btn ws-btn--ghost"
|
|
97
|
+
style={{
|
|
98
|
+
borderColor: 'var(--ws-border)',
|
|
99
|
+
color: 'var(--ws-text)'
|
|
100
|
+
}}
|
|
101
|
+
onClick={() => window.location.reload()}
|
|
102
|
+
>
|
|
103
|
+
Reload Application
|
|
104
|
+
</button>
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return this.props.children;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type ExploreView = 'graph' | 'memories' | 'vocabulary';
|
|
2
|
+
|
|
3
|
+
type ExploreWorkspaceTabsProps = {
|
|
4
|
+
activeView: ExploreView;
|
|
5
|
+
agentMemoryAvailable: boolean;
|
|
6
|
+
onSelect: (view: ExploreView) => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function ExploreWorkspaceTabs({
|
|
10
|
+
activeView,
|
|
11
|
+
agentMemoryAvailable,
|
|
12
|
+
onSelect,
|
|
13
|
+
}: ExploreWorkspaceTabsProps) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<button className="workspace-tab" data-active={activeView === 'graph'} onClick={() => onSelect('graph')}>
|
|
17
|
+
Semantic Hub Explorer
|
|
18
|
+
</button>
|
|
19
|
+
{agentMemoryAvailable ? (
|
|
20
|
+
<button className="workspace-tab" data-active={activeView === 'memories'} onClick={() => onSelect('memories')}>
|
|
21
|
+
Memories
|
|
22
|
+
</button>
|
|
23
|
+
) : null}
|
|
24
|
+
<button className="workspace-tab" data-active={activeView === 'vocabulary'} onClick={() => onSelect('vocabulary')}>
|
|
25
|
+
Vocabulary Browser
|
|
26
|
+
</button>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="77" height="47" fill="none" aria-labelledby="vite-logo-title" viewBox="0 0 77 47"><title id="vite-logo-title">Vite</title><style>.parenthesis{fill:#000}@media (prefers-color-scheme:dark){.parenthesis{fill:#fff}}</style><path fill="#9135ff" d="M40.151 45.71c-.663.844-2.02.374-2.02-.699V34.708a2.26 2.26 0 0 0-2.262-2.262H24.493c-.92 0-1.457-1.04-.92-1.788l7.479-10.471c1.07-1.498 0-3.578-1.842-3.578H15.443c-.92 0-1.456-1.04-.92-1.788l9.696-13.576c.213-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.472c-1.07 1.497 0 3.578 1.842 3.578h11.376c.944 0 1.474 1.087.89 1.83L40.153 45.712z"/><mask id="a" width="48" height="47" x="14" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M40.047 45.71c-.663.843-2.02.374-2.02-.699V34.708a2.26 2.26 0 0 0-2.262-2.262H24.389c-.92 0-1.457-1.04-.92-1.788l7.479-10.472c1.07-1.497 0-3.578-1.842-3.578H15.34c-.92 0-1.456-1.04-.92-1.788l9.696-13.575c.213-.297.556-.474.92-.474H53.93c.92 0 1.456 1.04.92 1.788L47.37 13.03c-1.07 1.498 0 3.578 1.842 3.578h11.376c.944 0 1.474 1.088.89 1.831L40.049 45.712z"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#eee6ff" rx="5.508" ry="14.704" transform="rotate(269.814 20.96 11.29)scale(-1 1)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#eee6ff" rx="10.399" ry="29.851" transform="rotate(89.814 -16.902 -8.275)scale(1 -1)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#8900ff" rx="5.508" ry="30.487" transform="rotate(89.814 -19.197 -7.127)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#8900ff" rx="5.508" ry="30.599" transform="rotate(89.814 -25.928 4.177)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#8900ff" rx="5.508" ry="30.599" transform="rotate(89.814 -25.738 5.52)scale(1 -1)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#eee6ff" rx="14.072" ry="22.078" transform="rotate(93.35 31.245 55.578)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#8900ff" rx="3.47" ry="21.501" transform="rotate(89.009 35.419 55.202)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#8900ff" rx="3.47" ry="21.501" transform="rotate(89.009 35.419 55.202)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx="14.592" cy="9.743" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(39.51 14.592 9.743)"/></g><g filter="url(#k)"><ellipse cx="61.728" cy="-5.321" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 61.728 -5.32)"/></g><g filter="url(#l)"><ellipse cx="55.618" cy="7.104" fill="#00c2ff" rx="5.971" ry="9.665" transform="rotate(37.892 55.618 7.104)"/></g><g filter="url(#m)"><ellipse cx="12.326" cy="39.103" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 12.326 39.103)"/></g><g filter="url(#n)"><ellipse cx="12.326" cy="39.103" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 12.326 39.103)"/></g><g filter="url(#o)"><ellipse cx="49.857" cy="30.678" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 49.857 30.678)"/></g><g filter="url(#p)"><ellipse cx="52.623" cy="33.171" fill="#00c2ff" rx="5.971" ry="15.297" transform="rotate(37.892 52.623 33.17)"/></g></g><path d="M6.919 0c-9.198 13.166-9.252 33.575 0 46.789h6.215c-9.25-13.214-9.196-33.623 0-46.789zm62.424 0h-6.215c9.198 13.166 9.252 33.575 0 46.789h6.215c9.25-13.214 9.196-33.623 0-46.789" class="parenthesis"/><defs><filter id="b" width="60.045" height="41.654" x="-5.564" y="16.92" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-40.407" y="-6.762" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-35.435" y="2.801" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-30.84" y="20.8" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-29.307" y="21.949" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="29.961" y="-17.13" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="37.754" y="3.055" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="37.754" y="3.055" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-13.43" y="-22.082" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="34.321" y="-37.644" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="38.847" y="-10.552" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-15.081" y="6.78" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-15.081" y="6.78" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="22.45" y="-1.645" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="32.919" y="11.36" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter></defs></svg>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Fetcher = (
|
|
2
|
+
input: RequestInfo | URL,
|
|
3
|
+
init?: RequestInit,
|
|
4
|
+
) => Promise<Response>;
|
|
5
|
+
|
|
6
|
+
type ExplorerInfo = {
|
|
7
|
+
capabilities?: {
|
|
8
|
+
agent_memory?: boolean;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export async function fetchAgentMemoryAvailability(
|
|
13
|
+
fetcher: Fetcher = fetch,
|
|
14
|
+
): Promise<boolean> {
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetcher('/api/info');
|
|
17
|
+
if (!response.ok) return false;
|
|
18
|
+
|
|
19
|
+
const info = await response.json() as ExplorerInfo;
|
|
20
|
+
return info.capabilities?.agent_memory === true;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* ── AlphaSemanticHub Explorer — Global CSS Reset ── */
|
|
2
|
+
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@500;600;700;800&display=swap');
|
|
4
|
+
|
|
5
|
+
*, *::before, *::after {
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
html, body, #root {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
font-family: 'IBM Plex Sans', 'Space Grotesk', sans-serif;
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
-moz-osx-font-smoothing: grayscale;
|
|
18
|
+
background: #0a0508;
|
|
19
|
+
color: #e8ccd1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Focus ring for accessibility */
|
|
23
|
+
:focus-visible {
|
|
24
|
+
outline: 2px solid rgba(255, 45, 75, 0.6);
|
|
25
|
+
outline-offset: 2px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Scrollbar styling */
|
|
29
|
+
::-webkit-scrollbar {
|
|
30
|
+
width: 6px;
|
|
31
|
+
height: 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
::-webkit-scrollbar-track {
|
|
35
|
+
background: transparent;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
::-webkit-scrollbar-thumb {
|
|
39
|
+
background: rgba(255, 45, 75, 0.25);
|
|
40
|
+
border-radius: 3px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
::-webkit-scrollbar-thumb:hover {
|
|
44
|
+
background: rgba(255, 45, 75, 0.45);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Monospace font for code elements */
|
|
48
|
+
code, pre, .mono {
|
|
49
|
+
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Selection highlight */
|
|
53
|
+
::selection {
|
|
54
|
+
background: rgba(255, 45, 75, 0.3);
|
|
55
|
+
color: #fff;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Spin animation for loaders */
|
|
59
|
+
@keyframes spin {
|
|
60
|
+
from { transform: rotate(0deg); }
|
|
61
|
+
to { transform: rotate(360deg); }
|
|
62
|
+
}
|
|
63
|
+
.animate-spin {
|
|
64
|
+
animation: spin 1s linear infinite;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Skeleton pulse animation for loading placeholders */
|
|
68
|
+
@keyframes skeleton-pulse {
|
|
69
|
+
0%, 100% { opacity: 0.45; }
|
|
70
|
+
50% { opacity: 0.85; }
|
|
71
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import Graph from "graphology";
|
|
2
|
+
import type {
|
|
3
|
+
GraphArrowVisibilityPolicy,
|
|
4
|
+
GraphBadgeKind,
|
|
5
|
+
GraphEdgeVariant,
|
|
6
|
+
GraphEntityShapeVariant,
|
|
7
|
+
GraphLabelVisibilityPolicy,
|
|
8
|
+
GraphNodeShapeVariant,
|
|
9
|
+
} from "../workspaces/GraphWorkspace/graphTheme";
|
|
10
|
+
import { curveGroupForPair, pairRegistryKey } from "./edgePairKeys.js";
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export const graph = new Graph({
|
|
14
|
+
type: "directed",
|
|
15
|
+
multi: true,
|
|
16
|
+
allowSelfLoops: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export interface NodeAttributes {
|
|
22
|
+
|
|
23
|
+
label: string;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
size: number;
|
|
27
|
+
color: string;
|
|
28
|
+
baseColor?: string;
|
|
29
|
+
/** Original semantic color when a display clone bakes interaction styling into baseColor. */
|
|
30
|
+
semanticBaseColor?: string;
|
|
31
|
+
mutedColor?: string;
|
|
32
|
+
glowColor?: string;
|
|
33
|
+
baseSize?: number;
|
|
34
|
+
visualPriority?: number;
|
|
35
|
+
labelPriority?: number;
|
|
36
|
+
semanticGroup?: string;
|
|
37
|
+
strokeColor?: string;
|
|
38
|
+
borderColor?: string;
|
|
39
|
+
borderSize?: number;
|
|
40
|
+
nodeVariant?: GraphNodeShapeVariant;
|
|
41
|
+
nodeShapeVariant?: GraphNodeShapeVariant;
|
|
42
|
+
entityShape?: GraphEntityShapeVariant;
|
|
43
|
+
badgeKind?: GraphBadgeKind;
|
|
44
|
+
badgeCount?: number;
|
|
45
|
+
ringColor?: string;
|
|
46
|
+
haloColor?: string;
|
|
47
|
+
labelVisibilityPolicy?: GraphLabelVisibilityPolicy;
|
|
48
|
+
highlighted?: boolean;
|
|
49
|
+
communityId?: string;
|
|
50
|
+
isCommunityGroup?: boolean;
|
|
51
|
+
memberCount?: number;
|
|
52
|
+
anchorNodeId?: string | null;
|
|
53
|
+
|
|
54
|
+
nodeType: string;
|
|
55
|
+
content: string;
|
|
56
|
+
valid_from?: string | null;
|
|
57
|
+
valid_until?: string | null;
|
|
58
|
+
properties: Record<string, any>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EdgeAttributes {
|
|
62
|
+
edgeId?: string;
|
|
63
|
+
familyId?: string;
|
|
64
|
+
sourceId?: string;
|
|
65
|
+
targetId?: string;
|
|
66
|
+
|
|
67
|
+
size?: number;
|
|
68
|
+
baseSize?: number;
|
|
69
|
+
color?: string;
|
|
70
|
+
baseColor?: string;
|
|
71
|
+
mutedColor?: string;
|
|
72
|
+
type?: string;
|
|
73
|
+
curvature?: number;
|
|
74
|
+
visualPriority?: number;
|
|
75
|
+
edgeFamily?: "line" | "parallel" | "bidirectional" | "path";
|
|
76
|
+
isBidirectional?: boolean;
|
|
77
|
+
curveGroup?: string | null;
|
|
78
|
+
edgeVariant?: GraphEdgeVariant;
|
|
79
|
+
arrowVisibilityPolicy?: GraphArrowVisibilityPolicy;
|
|
80
|
+
relationshipStrength?: number;
|
|
81
|
+
isParallelPair?: boolean;
|
|
82
|
+
parallelIndex?: number;
|
|
83
|
+
parallelCount?: number;
|
|
84
|
+
familySize?: number;
|
|
85
|
+
rawEdgeIds?: string[];
|
|
86
|
+
isAggregated?: boolean;
|
|
87
|
+
aggregateCount?: number;
|
|
88
|
+
dominantEdgeType?: string;
|
|
89
|
+
representativeWeight?: number;
|
|
90
|
+
bundleKind?: "parallel" | "bidirectional" | "community";
|
|
91
|
+
isSmallGraph?: boolean;
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
edgeType: string;
|
|
95
|
+
weight: number;
|
|
96
|
+
properties: Record<string, any>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function normalizeParallelMetadataForPair(source: string, target: string): void {
|
|
100
|
+
const edgeIds: string[] = [];
|
|
101
|
+
graph.forEachDirectedEdge(source, target, (edgeId) => {
|
|
102
|
+
edgeIds.push(String(edgeId));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const pairCount = edgeIds.length;
|
|
106
|
+
const familyCounts = new Map<string, number>();
|
|
107
|
+
edgeIds.forEach((edgeId) => {
|
|
108
|
+
const attrs = graph.getEdgeAttributes(edgeId) as EdgeAttributes;
|
|
109
|
+
const familyId = String(attrs.familyId || edgeId);
|
|
110
|
+
familyCounts.set(familyId, (familyCounts.get(familyId) ?? 0) + 1);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
edgeIds
|
|
114
|
+
.sort((left, right) => {
|
|
115
|
+
const leftAttrs = graph.getEdgeAttributes(left) as EdgeAttributes;
|
|
116
|
+
const rightAttrs = graph.getEdgeAttributes(right) as EdgeAttributes;
|
|
117
|
+
const priorityDelta = Number(rightAttrs.visualPriority ?? 0) - Number(leftAttrs.visualPriority ?? 0);
|
|
118
|
+
if (priorityDelta !== 0) {
|
|
119
|
+
return priorityDelta;
|
|
120
|
+
}
|
|
121
|
+
const weightDelta = Number(rightAttrs.weight ?? 0) - Number(leftAttrs.weight ?? 0);
|
|
122
|
+
if (weightDelta !== 0) {
|
|
123
|
+
return weightDelta;
|
|
124
|
+
}
|
|
125
|
+
return left.localeCompare(right);
|
|
126
|
+
})
|
|
127
|
+
.forEach((edgeId, index) => {
|
|
128
|
+
const attrs = graph.getEdgeAttributes(edgeId) as EdgeAttributes;
|
|
129
|
+
const familyId = String(attrs.familyId || edgeId);
|
|
130
|
+
graph.mergeEdgeAttributes(edgeId, {
|
|
131
|
+
edgeId,
|
|
132
|
+
familyId,
|
|
133
|
+
sourceId: source,
|
|
134
|
+
targetId: target,
|
|
135
|
+
isParallelPair: pairCount > 1,
|
|
136
|
+
parallelIndex: index,
|
|
137
|
+
parallelCount: pairCount,
|
|
138
|
+
familySize: familyCounts.get(familyId) ?? 1,
|
|
139
|
+
curveGroup: curveGroupForPair(source, target),
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
export function batchMergeNodes(
|
|
146
|
+
nodes: { id: string; attributes: NodeAttributes }[]
|
|
147
|
+
): void {
|
|
148
|
+
for (const { id, attributes } of nodes) {
|
|
149
|
+
graph.mergeNode(id, attributes);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export function batchMergeEdges(
|
|
155
|
+
edges: { id: string; familyId?: string; source: string; target: string; attributes: EdgeAttributes }[]
|
|
156
|
+
): void {
|
|
157
|
+
const touchedPairs = new Map<string, { source: string; target: string }>();
|
|
158
|
+
|
|
159
|
+
for (const { id, familyId, source, target, attributes } of edges) {
|
|
160
|
+
if (source === target) continue; // skip self-loops; graph was created with allowSelfLoops: false
|
|
161
|
+
const edgeId = String(attributes.edgeId || id);
|
|
162
|
+
const resolvedFamilyId = String(attributes.familyId || familyId || edgeId);
|
|
163
|
+
|
|
164
|
+
if (graph.hasNode(source) && graph.hasNode(target)) {
|
|
165
|
+
graph.mergeDirectedEdgeWithKey(edgeId, source, target, {
|
|
166
|
+
...attributes,
|
|
167
|
+
edgeId,
|
|
168
|
+
familyId: resolvedFamilyId,
|
|
169
|
+
sourceId: source,
|
|
170
|
+
targetId: target,
|
|
171
|
+
});
|
|
172
|
+
touchedPairs.set(pairRegistryKey(source, target), { source, target });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
touchedPairs.forEach(({ source, target }) => {
|
|
177
|
+
normalizeParallelMetadataForPair(source, target);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function clearGraph(): void {
|
|
182
|
+
graph.clear();
|
|
183
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/store/registryStore.ts
|
|
3
|
+
*
|
|
4
|
+
* Lightweight client-side audit log for all KG / Ontology mutations.
|
|
5
|
+
* No backend required — events are dispatched by each workspace after
|
|
6
|
+
* a successful API call or WebSocket mutation.
|
|
7
|
+
*
|
|
8
|
+
* Any component can call logEvent() from anywhere (including non-React code).
|
|
9
|
+
* React components subscribe via the useRegistry() hook.
|
|
10
|
+
*/
|
|
11
|
+
import { useState, useEffect } from "react";
|
|
12
|
+
|
|
13
|
+
export type RegistryEntryOp =
|
|
14
|
+
| "import"
|
|
15
|
+
| "export"
|
|
16
|
+
| "merge"
|
|
17
|
+
| "add-node"
|
|
18
|
+
| "update-node"
|
|
19
|
+
| "add-edge"
|
|
20
|
+
| "delete"
|
|
21
|
+
| "infer"
|
|
22
|
+
| "vocab-import";
|
|
23
|
+
|
|
24
|
+
export interface RegistryEntry {
|
|
25
|
+
id: string;
|
|
26
|
+
op: RegistryEntryOp;
|
|
27
|
+
timestamp: Date;
|
|
28
|
+
summary: string;
|
|
29
|
+
detail?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type Listener = (entries: readonly RegistryEntry[]) => void;
|
|
33
|
+
|
|
34
|
+
let _entries: RegistryEntry[] = [];
|
|
35
|
+
const _listeners = new Set<Listener>();
|
|
36
|
+
const MAX_ENTRIES = 500;
|
|
37
|
+
|
|
38
|
+
function _notify(): void {
|
|
39
|
+
_listeners.forEach((fn) => fn(_entries));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function logEvent(
|
|
43
|
+
op: RegistryEntryOp,
|
|
44
|
+
summary: string,
|
|
45
|
+
detail?: Record<string, unknown>,
|
|
46
|
+
): void {
|
|
47
|
+
const entry: RegistryEntry = {
|
|
48
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
49
|
+
op,
|
|
50
|
+
timestamp: new Date(),
|
|
51
|
+
summary,
|
|
52
|
+
detail,
|
|
53
|
+
};
|
|
54
|
+
_entries = [entry, ..._entries].slice(0, MAX_ENTRIES);
|
|
55
|
+
_notify();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function clearRegistry(): void {
|
|
59
|
+
_entries = [];
|
|
60
|
+
_notify();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function getRegistryEntries(): readonly RegistryEntry[] {
|
|
64
|
+
return _entries;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function useRegistry(): readonly RegistryEntry[] {
|
|
68
|
+
const [snapshot, setSnapshot] = useState<readonly RegistryEntry[]>(_entries);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
// Sync any events that arrived between render and subscribe
|
|
71
|
+
setSnapshot(_entries);
|
|
72
|
+
_listeners.add(setSnapshot);
|
|
73
|
+
return () => {
|
|
74
|
+
_listeners.delete(setSnapshot);
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
return snapshot;
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module 'vis-timeline/standalone' {
|
|
2
|
+
export class Timeline {
|
|
3
|
+
constructor(container: HTMLElement, items: any, options?: any);
|
|
4
|
+
on(event: string, callback: (properties: any) => void): void;
|
|
5
|
+
destroy(): void;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'vis-data/standalone' {
|
|
10
|
+
export class DataSet<T = any> {
|
|
11
|
+
constructor(data?: T[], options?: any);
|
|
12
|
+
add(data: T | T[]): void;
|
|
13
|
+
update(data: T | T[]): void;
|
|
14
|
+
remove(id: string | number | (string | number)[]): void;
|
|
15
|
+
}
|
|
16
|
+
}
|