supermemory/packages/memory-graph/src/constants.ts
Prasanna721 543c45a626 fix(mcp): fix broken memory graph and improve UI design (#837)
## Summary
- Fixed memory graph stuck on "Loading graph data..." caused by field name mismatch after package rewrite (`memoryEntries` vs `memories`, `type` vs `documentType`)
- Improved MCP app UI to match console-v2 design: golden derives edges (#FBBF24), edge glow pass, node hover effects, dot mode at low zoom, vertical controls with keyboard shortcuts, expandable legend
- Synced local `memory-graph` edgeDerives constant with published npm version

## Test plan
- [ ] Run `cd apps/mcp && bun run dev`, connect via Claude Desktop
- [ ] Verify graph renders with golden derives edges and blue dashed extends edges
- [ ] Verify node hover/selection glow effects
- [ ] Verify Fit (Z), Center (C), zoom (+/-) keyboard shortcuts
- [ ] Verify legend expands/collapses
2026-04-08 21:21:10 +00:00

66 lines
1.5 KiB
TypeScript

import type { GraphThemeColors } from "./types"
export const MEMORY_BORDER_KEYS = {
forgotten: "memBorderForgotten",
expiring: "memBorderExpiring",
recent: "memBorderRecent",
default: "memStrokeDefault",
} as const
export const FORCE_CONFIG = {
linkStrength: {
docMemory: 0.35,
version: 0.6,
docDocBase: 0.0,
fallback: 0.05,
},
linkDistance: 300,
docMemoryDistance: 180,
chargeStrength: -2000,
collisionRadius: { document: 70, memory: 35 },
collisionStrength: 0.7,
centeringStrength: 0.06,
alphaDecay: 0.025,
alphaMin: 0.001,
velocityDecay: 0.45,
alphaTarget: 0.3,
preSettleTicks: 150,
}
export const GRAPH_SETTINGS = {
console: { initialZoom: 0.8, initialPanX: 0, initialPanY: 0 },
consumer: { initialZoom: 0.5, initialPanX: 400, initialPanY: 300 },
}
export const ANIMATION = {
dimDuration: 1500,
}
export const DEFAULT_COLORS: GraphThemeColors = {
bg: "#0f1419",
docFill: "#1B1F24",
docStroke: "#2A2F36",
docInnerFill: "#13161A",
memFill: "#0D2034",
memFillHover: "#112840",
memStrokeDefault: "#3B73B8",
accent: "#3B73B8",
textPrimary: "#ffffff",
textSecondary: "#e2e8f0",
textMuted: "#94a3b8",
edgeDerives: "#FBBF24",
edgeUpdates: "#A78BFA",
edgeExtends: "#38BDF8",
memBorderForgotten: "#EF4444",
memBorderExpiring: "#F59E0B",
memBorderRecent: "#10B981",
glowColor: "#3B73B8",
iconColor: "#3B73B8",
popoverBg: "#1a1f29",
popoverBorder: "#2A2F36",
popoverTextPrimary: "#ffffff",
popoverTextSecondary: "#e2e8f0",
popoverTextMuted: "#94a3b8",
controlBg: "#1a1f29",
controlBorder: "#2A2F36",
}