@staix/vault-mem-ui 0.0.0-stage → 0.0.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/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +96 -2
- package/THIRD_PARTY_NOTICES.md +164 -0
- package/bin/vmem-ui.ts +26 -0
- package/dist/panel.css +666 -0
- package/dist/panel.js +355 -0
- package/package.json +53 -4
- package/src/client/App.tsx +167 -0
- package/src/client/a11y.ts +54 -0
- package/src/client/acon.ts +46 -0
- package/src/client/components.tsx +243 -0
- package/src/client/data.ts +66 -0
- package/src/client/fake.ts +48 -0
- package/src/client/graph-export.tsx +21 -0
- package/src/client/host.ts +80 -0
- package/src/client/markdown/parse.ts +620 -0
- package/src/client/markdown/render.tsx +270 -0
- package/src/client/panel.css +666 -0
- package/src/client/panel.tsx +66 -0
- package/src/client/prefs.ts +76 -0
- package/src/client/standalone.ts +44 -0
- package/src/client/store.ts +201 -0
- package/src/client/views/assertions.tsx +109 -0
- package/src/client/views/common.ts +15 -0
- package/src/client/views/history.tsx +205 -0
- package/src/client/views/lint.tsx +27 -0
- package/src/client/views/log.tsx +64 -0
- package/src/client/views/note.tsx +128 -0
- package/src/client/views/notes.tsx +34 -0
- package/src/client/views/overview.tsx +74 -0
- package/src/client/views/promote.tsx +112 -0
- package/src/client/views/proposals.tsx +55 -0
- package/src/client/views/settings.tsx +57 -0
- package/src/client/write.ts +144 -0
- package/src/graph/decisionChains.ts +122 -0
- package/src/graph/derive.ts +338 -0
- package/src/graph/export.ts +44 -0
- package/src/graph/insights.ts +254 -0
- package/src/graph/labels.ts +67 -0
- package/src/graph/layout/client.ts +139 -0
- package/src/graph/layout/engine.ts +107 -0
- package/src/graph/layout/fa2.d.ts +8 -0
- package/src/graph/layout/protocol.ts +70 -0
- package/src/graph/layout/worker.ts +132 -0
- package/src/graph/model.ts +230 -0
- package/src/graph/positions.ts +41 -0
- package/src/graph/search.ts +54 -0
- package/src/graph/style.ts +301 -0
- package/src/graph/target.ts +38 -0
- package/src/graph/types.ts +64 -0
- package/src/graph/view/GraphView.tsx +279 -0
- package/src/graph/view/SidePanels.tsx +141 -0
- package/src/graph/view/cache.ts +42 -0
- package/src/graph/view/canvas.ts +309 -0
- package/src/graph/view/graph-snapshot.ts +75 -0
- package/src/graph/view/lod.ts +30 -0
- package/src/graph/view/motion.ts +4 -0
- package/src/graph/view/state.ts +240 -0
- package/src/plugin/assets.ts +33 -0
- package/src/plugin/graph.ts +71 -0
- package/src/plugin/index.ts +23 -0
- package/src/server/cli.ts +99 -0
- package/src/server/host.ts +287 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// Ported from STAIxBWLB/maru@b33341df src/components/graph/graphStyle.ts.
|
|
2
|
+
import type { GraphEdge, GraphEdgeOrigin, GraphNode } from "./model";
|
|
3
|
+
import type { GraphDisplaySettings } from "./types";
|
|
4
|
+
|
|
5
|
+
// dataviz-validated categorical palettes (12 slots, same hue per slot across
|
|
6
|
+
// themes). Light: min adjacent deutan dE 13.3 on #f4f3ee. Dark: 14.8 on
|
|
7
|
+
// #181a18. Slot ORDER is the CVD-safety mechanism; never reorder or cycle.
|
|
8
|
+
const LIGHT_COMMUNITY_COLORS = [
|
|
9
|
+
"#2a78d6", "#eda100", "#008300", "#e34948", "#0894ab", "#eb6834",
|
|
10
|
+
"#4a3aa7", "#6b8e23", "#e87ba4", "#9c6410", "#1baf7a", "#7a4fb5",
|
|
11
|
+
];
|
|
12
|
+
const DARK_COMMUNITY_COLORS = [
|
|
13
|
+
"#3987e5", "#c98500", "#17913a", "#e25b70", "#1a95aa", "#d95926",
|
|
14
|
+
"#9085e9", "#7a9630", "#d55181", "#b07b28", "#199e70", "#a678d8",
|
|
15
|
+
];
|
|
16
|
+
// Origin classes reuse palette slots 0/1/2, whose adjacency carries the
|
|
17
|
+
// palette's guaranteed deutan separation. Workspace and knowledge nodes share
|
|
18
|
+
// their hue with the same-origin edges; cross edges get the third.
|
|
19
|
+
const ORIGIN_SLOTS: Record<GraphEdgeOrigin, number> = {
|
|
20
|
+
workspace: 0, // blue
|
|
21
|
+
knowledge: 2, // green
|
|
22
|
+
cross: 1, // amber
|
|
23
|
+
};
|
|
24
|
+
// Edges are subordinate to nodes: same-origin lines sit closer to the canvas
|
|
25
|
+
// than their nodes, and the boundary-crossing ones stay the loudest.
|
|
26
|
+
const ORIGIN_EDGE_MIX: Record<GraphEdgeOrigin, number> = {
|
|
27
|
+
workspace: 0.6,
|
|
28
|
+
knowledge: 0.6,
|
|
29
|
+
cross: 0.4,
|
|
30
|
+
};
|
|
31
|
+
// Domains map onto palette slots so domain and community coloring share hues.
|
|
32
|
+
const DOMAIN_SLOTS: Record<string, number> = {
|
|
33
|
+
research: 0, // blue
|
|
34
|
+
projects: 5, // orange
|
|
35
|
+
teaching: 2, // green
|
|
36
|
+
operations: 3, // red
|
|
37
|
+
people: 11, // purple
|
|
38
|
+
"ai-practice": 4, // cyan
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export interface GraphTheme {
|
|
42
|
+
bg: string;
|
|
43
|
+
ink: string;
|
|
44
|
+
muted: string;
|
|
45
|
+
line: string;
|
|
46
|
+
accent: string;
|
|
47
|
+
warn: string;
|
|
48
|
+
labelColor: string;
|
|
49
|
+
edge: string;
|
|
50
|
+
edgeStrong: string;
|
|
51
|
+
edgeDim: string;
|
|
52
|
+
nodeBorder: string;
|
|
53
|
+
ghostFill: string;
|
|
54
|
+
dimNode: string;
|
|
55
|
+
dark: boolean;
|
|
56
|
+
communityColors: string[];
|
|
57
|
+
domainColors: Record<string, string>;
|
|
58
|
+
/** Node/legend color per origin class. */
|
|
59
|
+
originColors: Record<GraphEdgeOrigin, string>;
|
|
60
|
+
/** Edge color per origin class — the same hues, mixed toward the canvas. */
|
|
61
|
+
originEdgeColors: Record<GraphEdgeOrigin, string>;
|
|
62
|
+
fallback: string;
|
|
63
|
+
neutralNode: string;
|
|
64
|
+
neutralNodeStrong: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const LIGHT_DEFAULTS = {
|
|
68
|
+
bg: "#f4f3ee",
|
|
69
|
+
ink: "#1f1d18",
|
|
70
|
+
muted: "#69645b",
|
|
71
|
+
line: "#dedbd1",
|
|
72
|
+
accent: "#7c5ce7",
|
|
73
|
+
};
|
|
74
|
+
const DARK_DEFAULTS = {
|
|
75
|
+
bg: "#1e1e1e",
|
|
76
|
+
ink: "#f2f0e8",
|
|
77
|
+
muted: "#8f918c",
|
|
78
|
+
line: "#30322f",
|
|
79
|
+
accent: "#8b5cf6",
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
function colorChannels(color: string): [number, number, number] | null {
|
|
83
|
+
const value = color.trim();
|
|
84
|
+
const shortHex = /^#([0-9a-f]{3})$/i.exec(value);
|
|
85
|
+
const longHex = /^#?([0-9a-f]{6})$/i.exec(value);
|
|
86
|
+
if (shortHex) {
|
|
87
|
+
return shortHex[1]
|
|
88
|
+
.split("")
|
|
89
|
+
.map((digit) => parseInt(`${digit}${digit}`, 16)) as [number, number, number];
|
|
90
|
+
}
|
|
91
|
+
if (longHex) {
|
|
92
|
+
const packed = parseInt(longHex[1], 16);
|
|
93
|
+
return [(packed >> 16) & 0xff, (packed >> 8) & 0xff, packed & 0xff];
|
|
94
|
+
}
|
|
95
|
+
if (/^rgba?\(/i.test(value)) {
|
|
96
|
+
const components = value.match(/[\d.]+/g)?.slice(0, 3).map(Number);
|
|
97
|
+
if (components?.length === 3 && components.every(Number.isFinite)) {
|
|
98
|
+
return components.map((component) => Math.min(255, Math.max(0, component))) as [
|
|
99
|
+
number,
|
|
100
|
+
number,
|
|
101
|
+
number,
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Blend `color` `amount` of the way toward `toward`. Returns opaque hex —
|
|
109
|
+
* Sigma's parseColor only understands hex/rgb(a). */
|
|
110
|
+
function mixColor(color: string, toward: string, amount: number): string {
|
|
111
|
+
const from = colorChannels(color);
|
|
112
|
+
const to = colorChannels(toward);
|
|
113
|
+
if (!from || !to) return color;
|
|
114
|
+
const channel = (index: number) =>
|
|
115
|
+
Math.round(from[index] + (to[index] - from[index]) * amount)
|
|
116
|
+
.toString(16)
|
|
117
|
+
.padStart(2, "0");
|
|
118
|
+
return `#${channel(0)}${channel(1)}${channel(2)}`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function colorLuminance(color: string): number {
|
|
122
|
+
const channels = colorChannels(color);
|
|
123
|
+
if (!channels) return 1;
|
|
124
|
+
const channel = (component: number) => {
|
|
125
|
+
const c = component / 255;
|
|
126
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
127
|
+
};
|
|
128
|
+
return 0.2126 * channel(channels[0])
|
|
129
|
+
+ 0.7152 * channel(channels[1])
|
|
130
|
+
+ 0.0722 * channel(channels[2]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function buildTheme(read: (name: string, fallback: string) => string): GraphTheme {
|
|
134
|
+
const bgProbe = read("--graph-canvas", read("--bg", LIGHT_DEFAULTS.bg));
|
|
135
|
+
const dark = colorLuminance(bgProbe) < 0.5;
|
|
136
|
+
const defaults = dark ? DARK_DEFAULTS : LIGHT_DEFAULTS;
|
|
137
|
+
const bg = read("--graph-canvas", defaults.bg);
|
|
138
|
+
const ink = read("--graph-ink", defaults.ink);
|
|
139
|
+
const line = read("--graph-line", defaults.line);
|
|
140
|
+
const communityColors = dark ? DARK_COMMUNITY_COLORS : LIGHT_COMMUNITY_COLORS;
|
|
141
|
+
const domainColors = Object.fromEntries(
|
|
142
|
+
Object.entries(DOMAIN_SLOTS).map(([domain, slot]) => [domain, communityColors[slot]]),
|
|
143
|
+
);
|
|
144
|
+
const originEntries = Object.entries(ORIGIN_SLOTS) as [GraphEdgeOrigin, number][];
|
|
145
|
+
const originColors = Object.fromEntries(
|
|
146
|
+
originEntries.map(([origin, slot]) => [origin, communityColors[slot]]),
|
|
147
|
+
) as Record<GraphEdgeOrigin, string>;
|
|
148
|
+
const originEdgeColors = Object.fromEntries(
|
|
149
|
+
originEntries.map(([origin, slot]) => [
|
|
150
|
+
origin,
|
|
151
|
+
mixColor(communityColors[slot], bg, ORIGIN_EDGE_MIX[origin]),
|
|
152
|
+
]),
|
|
153
|
+
) as Record<GraphEdgeOrigin, string>;
|
|
154
|
+
return {
|
|
155
|
+
bg,
|
|
156
|
+
ink,
|
|
157
|
+
muted: read("--graph-muted", defaults.muted),
|
|
158
|
+
line,
|
|
159
|
+
accent: read("--graph-accent", defaults.accent),
|
|
160
|
+
warn: dark ? "#d6b070" : "#b8690f",
|
|
161
|
+
labelColor: read(
|
|
162
|
+
"--graph-label-strong",
|
|
163
|
+
dark ? "rgba(242, 240, 232, 0.92)" : "rgba(31, 29, 24, 0.9)",
|
|
164
|
+
),
|
|
165
|
+
// Sigma/WebGL blends thousands of overlapping strokes. Opaque,
|
|
166
|
+
// near-background colors stay restrained on dense graphs more reliably
|
|
167
|
+
// than rgba strings, which some GPU paths flatten too brightly.
|
|
168
|
+
edge: read("--graph-edge", dark ? "#292a29" : "#d8d6cf"),
|
|
169
|
+
edgeStrong: dark ? "#555854" : "#8d8980",
|
|
170
|
+
edgeDim: dark ? "#232423" : "#e7e5df",
|
|
171
|
+
nodeBorder: bg,
|
|
172
|
+
ghostFill: bg,
|
|
173
|
+
dimNode: dark ? "#30332f" : "#dedbd3",
|
|
174
|
+
dark,
|
|
175
|
+
communityColors,
|
|
176
|
+
domainColors,
|
|
177
|
+
originColors,
|
|
178
|
+
originEdgeColors,
|
|
179
|
+
fallback: dark ? "#686b66" : "#aaa69c",
|
|
180
|
+
neutralNode: dark ? "#686b66" : "#aaa69c",
|
|
181
|
+
neutralNodeStrong: dark ? "#d2d5cf" : "#565248",
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let activeTheme: GraphTheme = buildTheme((_name, fallback) => fallback);
|
|
186
|
+
|
|
187
|
+
// Every theme token ends up in Sigma's parseColor, which only understands
|
|
188
|
+
// hex/rgb/rgba; unevaluated tokens like `color-mix(...)` or `var(...)` (as
|
|
189
|
+
// returned by getPropertyValue for custom properties) would silently become
|
|
190
|
+
// opaque black. Only concrete colors may pass through.
|
|
191
|
+
function isConcreteColor(value: string): boolean {
|
|
192
|
+
return /^(#[0-9a-f]{3,8}|rgba?\([^)]*\))$/i.test(value);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function refreshGraphTheme(element?: Element | null): GraphTheme {
|
|
196
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
197
|
+
const style = getComputedStyle(element ?? document.documentElement);
|
|
198
|
+
const resolvedBackground = style.backgroundColor.trim();
|
|
199
|
+
activeTheme = buildTheme((name, fallback) => {
|
|
200
|
+
const value = style.getPropertyValue(name).trim();
|
|
201
|
+
if (name === "--graph-canvas" && !isConcreteColor(value)) {
|
|
202
|
+
return resolvedBackground || fallback;
|
|
203
|
+
}
|
|
204
|
+
return isConcreteColor(value) ? value : fallback;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return activeTheme;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function graphTheme(): GraphTheme {
|
|
211
|
+
return activeTheme;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function nodeRadius(degree: number): number {
|
|
215
|
+
// Keep isolated notes large enough to see and reliably pick on HiDPI/WebGL
|
|
216
|
+
// canvases; degree still adds hierarchy without letting hubs dominate.
|
|
217
|
+
return Math.min(14, Math.max(5, 5 + 1.2 * Math.sqrt(degree)));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function nodeColor(
|
|
221
|
+
node: GraphNode,
|
|
222
|
+
enriched: boolean,
|
|
223
|
+
colorMode: GraphDisplaySettings["colorMode"] = "neutral",
|
|
224
|
+
): string {
|
|
225
|
+
const theme = activeTheme;
|
|
226
|
+
if (node.type === "unresolved") return theme.ghostFill;
|
|
227
|
+
if (colorMode === "neutral") return theme.neutralNode;
|
|
228
|
+
if (colorMode === "origin") {
|
|
229
|
+
return node.origin === "unknown" ? theme.fallback : theme.originColors[node.origin];
|
|
230
|
+
}
|
|
231
|
+
if (colorMode === "community" && enriched && node.community != null) {
|
|
232
|
+
return theme.communityColors[node.community % theme.communityColors.length];
|
|
233
|
+
}
|
|
234
|
+
if (colorMode === "domain" && node.domain) {
|
|
235
|
+
return theme.domainColors[node.domain] ?? theme.fallback;
|
|
236
|
+
}
|
|
237
|
+
return theme.fallback;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function communityColor(community: number): string {
|
|
241
|
+
return activeTheme.communityColors[community % activeTheme.communityColors.length];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function domainColor(domain: string | null): string {
|
|
245
|
+
return domain ? (activeTheme.domainColors[domain] ?? activeTheme.fallback) : activeTheme.fallback;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Stable per-relation edge color: FNV hash into the categorical palette.
|
|
249
|
+
* Body `wiki_link` edges are handled by the caller (they stay neutral). */
|
|
250
|
+
export function relationColor(relation: string): string {
|
|
251
|
+
const palette = activeTheme.communityColors;
|
|
252
|
+
let hash = 2166136261;
|
|
253
|
+
for (let index = 0; index < relation.length; index += 1) {
|
|
254
|
+
hash ^= relation.charCodeAt(index);
|
|
255
|
+
hash = Math.imul(hash, 16777619);
|
|
256
|
+
}
|
|
257
|
+
return palette[(hash >>> 0) % palette.length];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function originColor(origin: GraphEdgeOrigin): string {
|
|
261
|
+
return activeTheme.originColors[origin];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function originEdgeColor(origin: GraphEdgeOrigin): string {
|
|
265
|
+
return activeTheme.originEdgeColors[origin];
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Resting edge color. Origin mode colors every edge by the pair it connects;
|
|
269
|
+
* otherwise the relation-color opt-in still owns frontmatter edges and body
|
|
270
|
+
* `wiki_link` edges stay neutral. Hover/selection reducers override this. */
|
|
271
|
+
export function edgeColor(
|
|
272
|
+
edge: Pick<GraphEdge, "relation" | "fromFrontmatter" | "origin">,
|
|
273
|
+
display: Pick<GraphDisplaySettings, "relationColors" | "colorMode">,
|
|
274
|
+
): string {
|
|
275
|
+
if (display.colorMode === "origin") return activeTheme.originEdgeColors[edge.origin];
|
|
276
|
+
if (display.relationColors && edge.fromFrontmatter) return relationColor(edge.relation);
|
|
277
|
+
return activeTheme.edge;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export function edgeKey(a: string, b: string): string {
|
|
281
|
+
return a < b ? `${a}\u0000${b}` : `${b}\u0000${a}`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export function graphTopologySignature(nodes: GraphNode[], edges: GraphEdge[]): string {
|
|
285
|
+
let hash = 2166136261;
|
|
286
|
+
const add = (value: string) => {
|
|
287
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
288
|
+
hash ^= value.charCodeAt(index);
|
|
289
|
+
hash = Math.imul(hash, 16777619);
|
|
290
|
+
}
|
|
291
|
+
hash ^= 0xff;
|
|
292
|
+
hash = Math.imul(hash, 16777619);
|
|
293
|
+
};
|
|
294
|
+
for (const node of nodes) add(node.id);
|
|
295
|
+
for (const edge of edges) {
|
|
296
|
+
add(edge.source);
|
|
297
|
+
add(edge.target);
|
|
298
|
+
add(edge.relation);
|
|
299
|
+
}
|
|
300
|
+
return `${nodes.length}:${edges.length}:${hash >>> 0}`;
|
|
301
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Ported from STAIxBWLB/maru@b33341df src/lib/graph/target.ts.
|
|
2
|
+
import type { GraphLocalTarget } from "./types";
|
|
3
|
+
import type { GraphNode } from "./model";
|
|
4
|
+
|
|
5
|
+
function normalizeRelPath(value: string): string {
|
|
6
|
+
return value.trim().replace(/\\/g, "/").replace(/^\.\//, "");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function normalizeOwnerPath(value: string | null | undefined): string | null {
|
|
10
|
+
if (!value?.trim()) return null;
|
|
11
|
+
return value.trim().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Resolve a Local target without relying on the collision-prone node id.
|
|
15
|
+
* Paths stay case-sensitive because vaults may live on case-sensitive filesystems.
|
|
16
|
+
* A target with a null owner matches on relPath alone: callers that cannot
|
|
17
|
+
* know the owning workspace (fixtures, older saved views) must still resolve,
|
|
18
|
+
* while the provider stamps an owner on every real node — requiring exact
|
|
19
|
+
* equality against null made every real handoff report the target missing. */
|
|
20
|
+
export function graphNodeMatchesLocalTarget(
|
|
21
|
+
node: GraphNode,
|
|
22
|
+
target: GraphLocalTarget,
|
|
23
|
+
): boolean {
|
|
24
|
+
if (!node.relPath || normalizeRelPath(node.relPath) !== normalizeRelPath(target.relPath)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const targetOwner = normalizeOwnerPath(target.ownerWorkspacePath);
|
|
28
|
+
return targetOwner === null
|
|
29
|
+
|| normalizeOwnerPath(node.ownerWorkspacePath) === targetOwner;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function graphLocalTargetForNode(node: GraphNode): GraphLocalTarget | null {
|
|
33
|
+
if (!node.relPath) return null;
|
|
34
|
+
return {
|
|
35
|
+
ownerWorkspacePath: node.ownerWorkspacePath ?? null,
|
|
36
|
+
relPath: node.relPath,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Graph view settings and the graph input contract.
|
|
2
|
+
// Ported from STAIxBWLB/maru@b33341df src/lib/settings.ts (the graph types only).
|
|
3
|
+
|
|
4
|
+
export type GraphMode = "global" | "local" | "chains";
|
|
5
|
+
|
|
6
|
+
export interface GraphFilterProfile {
|
|
7
|
+
domains: string[];
|
|
8
|
+
/** Node origins to keep; empty = all. Values: "workspace" | "knowledge". */
|
|
9
|
+
origins: string[];
|
|
10
|
+
types: string[];
|
|
11
|
+
relations: string[];
|
|
12
|
+
community: number | null;
|
|
13
|
+
showUnresolved: boolean;
|
|
14
|
+
showGenerated: boolean;
|
|
15
|
+
/** Minimum distinct visible neighbors; 0 = all authored notes. */
|
|
16
|
+
minVisibleNeighbors: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface GraphDisplaySettings {
|
|
20
|
+
arrows: "typed" | "all" | "none";
|
|
21
|
+
labels: "low" | "balanced" | "high";
|
|
22
|
+
colorMode: "neutral" | "domain" | "community" | "origin";
|
|
23
|
+
relationColors: boolean;
|
|
24
|
+
nodeScale: number;
|
|
25
|
+
edgeScale: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GraphLocalTarget {
|
|
29
|
+
ownerWorkspacePath: string | null;
|
|
30
|
+
relPath: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Internal input to the graph model, assembled from the provider's columnar graph snapshot pages.
|
|
35
|
+
*/
|
|
36
|
+
export interface GraphInput {
|
|
37
|
+
nodes: GraphInputNode[];
|
|
38
|
+
edges: GraphInputEdge[];
|
|
39
|
+
/** Community id per node id, when the provider has computed communities. */
|
|
40
|
+
communities?: Record<string, number>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GraphInputNode {
|
|
44
|
+
id: string;
|
|
45
|
+
label: string;
|
|
46
|
+
/** Vault-relative path; null for an unresolved link target. */
|
|
47
|
+
relPath: string | null;
|
|
48
|
+
ownerWorkspacePath?: string | null;
|
|
49
|
+
origin?: "workspace" | "knowledge";
|
|
50
|
+
type?: string | null;
|
|
51
|
+
domain?: string | null;
|
|
52
|
+
/** created / decided_date / date; orders decision chains. */
|
|
53
|
+
date?: string | null;
|
|
54
|
+
/** Last modification time (ISO); drives stale-note detection. */
|
|
55
|
+
updatedAt?: string | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GraphInputEdge {
|
|
59
|
+
source: string;
|
|
60
|
+
target: string;
|
|
61
|
+
/** Frontmatter field name, or "wiki_link" for a body link. */
|
|
62
|
+
relation: string;
|
|
63
|
+
fromFrontmatter: boolean;
|
|
64
|
+
}
|