Commit graph

1522 commits

Author SHA1 Message Date
Vorflux AI
44ab6a5fc6 fix: move version chain rebuild from useEffect to render path
The chainIndex.rebuild() was called in a useEffect (runs after render),
but getChain() was called in a useMemo (runs during render). This meant
getChain() could read stale data from the old chain index when
limitedDocuments changed.

Moving rebuild() inline (during render) ensures the chain index is
always up-to-date before getChain() is called. The rebuild() method
has a referential equality guard that makes it a no-op on re-renders
where limitedDocuments hasn't changed.
2026-03-29 01:12:22 +00:00
Vorflux AI
b08760ef85 fix: add limitedDocuments dependency to activeVersionChain useMemo
Prevents stale version chain data when documents change but the
selected node stays the same. The chainIndex ref is rebuilt in a
useEffect when limitedDocuments changes, but without this dependency
the useMemo would return cached (stale) chain data.
2026-03-29 00:36:07 +00:00
Vorflux AI
7e31f07924 fix: make all three edge types visually distinct with unique colors
- Derives: soft blue/steel (#7094B8) -- cool desaturated blue for structural
  doc-to-memory links, visible but not attention-grabbing
- Updates: purple (#A78BFA) -- unchanged, glow + arrowheads for version chains
- Extends: sky blue (#38BDF8) -- bright blue with glow + dashed pattern for
  cross-references between memories

Previously derives and extends both used similar teal/cyan colors, making
extends edges invisible among the 220 derives edges. Now each type has a
completely different appearance (steel blue vs purple vs bright cyan dashed).

Also fixed extends edge zoom culling threshold from 0.3 to 0.08 -- extends
edges were being hidden at normal zoom levels (10-26%).

All edge types get glow for luminous aesthetic. Extends edges use dashed
lines matching the legend icon.

- All 107 tests pass, types clean
2026-03-29 00:34:15 +00:00
Vorflux AI
3dcabe41bb fix: add glow effect to all edge types, dashed style for extends
- All edge types now get a subtle glow pass (wider semi-transparent stroke
  behind the main line) for a luminous, ethereal look:
  - Derives: 0.25 alpha glow, +1.5px width
  - Updates: 0.4 alpha glow, +2px width (unchanged, strongest)
  - Extends: 0.25 alpha glow, +1.5px width, dashed pattern
- Extends edges now render with dashed lines (6px dash, 4px gap) matching
  the legend's dashed line icon
- Batch key now includes edge type for correct batch separation
- Removed redundant setLineDash reset inside save/restore block
- 928 nodes / 931 edges at 200 docs renders smoothly
- All 107 tests pass, types clean
2026-03-29 00:18:49 +00:00
Vorflux AI
703ff09517 fix: maxNodes now correctly limits total nodes (documents + memories)
Previously maxNodes limited only the number of documents, ignoring their
memories. With ~2-6 memories per document, setting maxNodes=200 could result
in 600-1400+ actual nodes, defeating the performance guard.

Now iterates documents and accumulates total node count (1 doc + N memories),
stopping when the limit would be exceeded. This matches the documented
behavior of 'Max nodes to display'.

Addresses Sentry review comment on memory-graph.tsx#L62.
2026-03-28 23:50:16 +00:00
Vorflux AI
3caeedc5a9 fix: improve edge visibility and legend line thickness
- Increased edge opacities for better visual distinction while maintaining ethereal aesthetic:
  - Derives: 0.35 -> 0.45, width 1 -> 1.2
  - Updates: 0.6 -> 0.7, width 1.5 -> 2
  - Extends: 0.3 -> 0.4, width 1 -> 1.2
- Increased legend LineIcon border from 1.6px to 2.5px so edge type colors are clearly visible
- Updated test expectations to match new values
- All 107 tests pass, types clean, biome clean
2026-03-28 23:45:55 +00:00
Vorflux AI
11a2ff5ec9 fix: improve edge/node visibility, fix slideshow race condition, add edge tests
Visual fixes:
- Increase edge opacity and width so derives/updates/extends are visually
  distinct (was too faint to differentiate on dark background)
- Increase non-latest memory opacity from 0.3 to 0.5 for better contrast

Bug fix:
- Fix slideshow setTimeout race condition: track coolDown timer and clear
  it on cleanup to prevent stale timeouts from freezing animation

Refactor + tests:
- Extract computeEdges() as a pure testable function from useGraphData hook
- Add 23 new edge computation tests covering memoryRelations, parentMemoryId
  fallback, invalid relation types, and forward-reference scenarios
2026-03-28 23:30:37 +00:00
Vorflux AI
a2765e377a fix: MCP forward-reference bug + type cleanup from review
- Fix MCP transformData to pre-populate nodeIds before edge computation,
  preventing silently dropped edges for forward-referenced memories
- Use MemoryRelation type for edgeType fields in GraphApiEdge and GraphEdge
- Use MemoryRelation type in use-graph-api.ts instead of inline literals
- Remove redundant MemoryRelation re-export from types.ts (already in index.tsx)
- Remove unnecessary type assertion cast in mock-data.ts
- Add defensive comments for runtime typeof checks
2026-03-28 23:23:23 +00:00
Vorflux AI
795981218b fix: deduplicate MemoryRelation type and align MemoryEntry with backend schema
- Remove duplicate MemoryRelation definition from types.ts, import from api-types.ts
- Add MemoryRelation to re-exports in types.ts and index.tsx
- Make MemoryEntry.memory required and content optional to match backend MemoryEntrySchema
2026-03-28 23:17:25 +00:00
Vorflux AI
4de8b8f987 fix: use backend memoryRelations for edge computation in MCP app
Updated MCP app edge computation to use memoryRelations from backend
instead of fabricating extends edges from spaceId grouping. Falls back
to parentMemoryId for backwards compatibility.
2026-03-28 23:15:28 +00:00
Vorflux AI
46d851a2f8 fix: distribute document clusters across canvas instead of clumping
- Exclude 'extends' edges from force simulation (visual-only, no pull)
- Apply same filter in update() to prevent re-adding extends on refresh
- Stronger derives link strength (0.35) to keep memories near parent doc
- Each document forms its own mini-cluster with orbiting memories
- Clusters spread evenly across the entire canvas
2026-03-28 22:58:59 +00:00
Vorflux AI
056dda2720 fix: memoize useGraphTheme return value to prevent cascading re-renders
When colorOverrides were provided, useGraphTheme returned a new object
on every render, breaking downstream useMemo dependencies and causing
the d3 simulation to re-update on every frame. Now uses useMemo with
a stable serialization key for the overrides object.
2026-03-28 08:16:21 +00:00
Vorflux AI
acd94c3642 fix: widen graph layout - stronger charge repulsion, weaker centering, larger spiral spread
- chargeStrength: -1500 -> -2500 for more node repulsion
- centeringStrength: 0.25 -> 0.08 so clusters don't collapse
- spiralScale: sqrt(n)*25 -> sqrt(n)*60 for wider initial spread
- MEMORY_ORBIT_BASE: 120 -> 200 with 120px randomness range
- linkDistance: 200 -> 300, docMemoryDistance: 150 -> 220
- Weaker link strengths to let charge dominate
- preSettleTicks: 120 -> 250 for better initial layout
2026-03-28 08:10:28 +00:00
Vorflux AI
2902a71bef fix: resolve biome formatting errors and hoist goldenAngle constant 2026-03-28 07:58:58 +00:00
Vorflux AI
ddcf661eb3 feat: spiral layout with constellation spread for graph aesthetics
- Golden-angle spiral initial layout for documents, memories orbit nearby
- Adaptive spiral scale based on document count
- Strong centering force (0.25) to unify disconnected components
- Moderate charge repulsion (-1500) for organic spread within the mass
- Extract groupByColor helper to deduplicate renderer batch logic
- Remove duplicate extends/fallback in edgeStyle()
- Refactor simulation to use all FORCE_CONFIG constants (no hardcoded values)
- Memory orbit radius scales with hash for organic feel

The layout now matches the reference: documents distributed throughout
with memories radiating outward, forming one unified constellation.
2026-03-28 07:56:10 +00:00
Vorflux AI
bcf2ff87fa feat: improve graph aesthetics - subtle edges, luminous nodes, better spacing
- Edge opacity: derives 0.18, updates 0.45, extends 0.12 for gossamer web effect
- Edge colors: sky blue (#38BDF8), soft violet (#A78BFA), teal (#2DD4BF)
- Node glow: subtle radial glow behind memory dots for luminous effect
- Force layout: stronger repulsion (-2500), wider spacing (450/200), gentler centering
- Refactor simulation to use FORCE_CONFIG constants instead of hardcoded values
- Update MCP app edge colors to match
2026-03-28 07:41:03 +00:00
Vorflux AI
b43c311092 feat: rename edge types to derives/updates/extends with distinct colors
- Rename edge types: doc-memory -> derives, version -> updates, same-space -> extends
- Assign distinct colors: derives (#3B82F6 blue), updates (#8B5CF6 purple), extends (#14B8A6 teal)
- Update legend labels to show Derives, Updates, Extends
- Update theme color properties: edgeDerives, edgeUpdates, edgeExtends
- Update MCP app edge types and colors to match
- Remove redundant drawDocDocLines proximity rendering (extends edges now serve this purpose)
- Update all tests and comments for new edge type names
2026-03-28 07:20:48 +00:00
Vorflux AI
06e51f2126 fix: resolve biome CI errors (noExplicitAny + formatting)
- Replace catch(error: any) with catch(error: unknown) in mcp client
- Fix extra blank line left by refactor in renderer.ts
2026-03-28 07:01:50 +00:00
Vorflux AI
60a809d1e9 refactor: extract document icon drawing into dedicated module
- Move all 14 icon drawing functions + roundRect to document-icons.ts
- Narrow drawDocIcon parameter from GraphThemeColors to iconColor: string
- Renderer.ts reduced from 1110 to 717 lines (focused on scene orchestration)
- Add google_drive, video, mcp, word to mock data for better icon coverage
2026-03-28 06:58:19 +00:00
Vorflux AI
c6ac3e0651 feat(graph): add canvas-native document type icons for all supported types
- Add 10 new icon drawing functions: Notion, Google Docs, Slides, Cloud,
  X/Twitter, Play/Video, Image, Text/Note, and more
- Extend drawDocIcon switch to handle all 19+ document types from web app:
  word, excel, google_sheet, google_slide, powerpoint, onedrive, google_drive,
  tweet, youtube, video, image, text, note, onenote, mcp
- Update mock data with additional document types for better demo coverage
- All icons are pure canvas vector drawings (no image assets needed)
2026-03-28 06:52:31 +00:00
Vorflux AI
2a18fb4df0 fix: memoize colors object to prevent cascading re-renders when colorOverrides provided 2026-03-28 06:10:56 +00:00
Vorflux AI
556fade101 fix: add aria-label to SVG in graph-card to fix biome a11y lint 2026-03-28 06:06:00 +00:00
Vorflux AI
f4ab06ee15 Merge remote-tracking branch 'origin/main' into vorflux/graph-perf-consolidation 2026-03-28 06:04:17 +00:00
Vorflux AI
429c7e97ad refactor: simplify graph API - remove backend computation, use client-side layout
- Remove x/y from GraphApiDocument (client computes via force simulation)
- Remove similarity from GraphApiEdge, add edgeType enum
- Replace viewport/bounds/stats API calls with single paginated documents endpoint
- Derive edges client-side from document structure (doc-memory, version, same-space)
- Update MCP client/server to use documents endpoint
- Update MCP UI app for new type shapes
- Update all tests for new API contract
- Progressive loading via useInfiniteQuery (100 docs/page)
2026-03-28 06:04:11 +00:00
MaheshtheDev
38282a37d6 feat: warning when model is unavailable in the region (#814) 2026-03-28 05:52:41 +00:00
Vorflux AI
76f5eaa446 Fix zoom display regression: split viewport change concerns
Pass popoverVisible flag from graph-canvas tick loop to the
onViewportChange callback. The handler always updates zoomDisplay
(so NavigationControls shows correct zoom %) but only increments
viewportVersion (triggering popover repositioning) when a node is
actually selected or hovered. This avoids 60fps React reconciliation
during plain panning while keeping the zoom indicator responsive.
2026-03-27 18:37:06 +00:00
Vorflux AI
52c0a615c1 Perf: gate onViewportChange behind popover-visible check
Only fire onViewportChange (which triggers React state update +
reconciliation) when a popover is actually visible (selectedNodeId
or hoveredNodeId is set). This avoids forcing 60fps React re-renders
during plain panning/zooming when no popover needs repositioning.

Also separate prevVp* tracking from the callback gate so viewport
state is always current when a node is first hovered/selected.
2026-03-27 18:34:24 +00:00
Vorflux AI
8dced3d5ed Fix slideshow interval reset on container resize
Use refs for containerSize and onSlideshowNodeChange inside the
slideshow useEffect to avoid resetting the 3.5s interval when the
container is resized. The interval now only resets when
isSlideshowActive or nodes.length changes.
2026-03-27 06:51:49 +00:00
Vorflux AI
5ccb2e65bb Merge remote-tracking branch 'origin/main' into vorflux/graph-perf-consolidation 2026-03-27 06:46:27 +00:00
MaheshtheDev
1111f05c47 feat: improve chat interface ux (#812) 2026-03-27 06:08:30 +00:00
Vorflux AI
ca2aae3fea Fix biome formatting: remove blank lines and collapse expression 2026-03-27 05:40:16 +00:00
Vorflux AI
8087d8a40d Fix popover tracking during pan/drag and remove dead code
- Use viewportVersion (not zoomDisplay) as activePopoverPosition dependency
- Fire onViewportChange based on actual viewport state diff (panX/panY/zoom)
  instead of only during animated transitions (vpMoving)
- Also fire during simulation so popover tracks settling nodes
- Remove dead lastReportedZoom variable
- Remove no-op node ID tracking effect and prevIdsRef
2026-03-27 05:37:22 +00:00
Vorflux AI
4e0bf5bb40 Merge remote-tracking branch 'origin/main' into vorflux/graph-perf-consolidation 2026-03-27 05:32:39 +00:00
Vorflux AI
cfac6e8898 Fix CI test import, popover pan repositioning, and renderer improvements
- Change bun:test import to vitest for CI compatibility
- Add viewportVersion counter for popover recalculation during pan
- Add hex color guard in lightenColor for non-6-digit formats
- Optimize version edge filtering with batch property
- Simplify stroke style conditions in drawDocumentNode
2026-03-27 05:32:36 +00:00
Vorflux AI
c81c05c14f Add visual enhancements: drop shadows, gradient fills, hover glow, forgotten X icon, version edge glow
- Drop shadows on selected/hovered nodes (document + memory) for depth
- Subtle gradient fill on document nodes
- Improved dimming contrast for superseded memories (0.3 alpha + strikethrough)
- Hover glow ring with dashed outline for interactivity feedback
- X icon overlay on forgotten memory nodes (size > 14px)
- Glow pass behind version edges for visual emphasis
- lightenColor utility with cache + guard for non-6-digit hex
- Use memData.isForgotten instead of fragile color comparison
- Optimize version edge batch: skip filter, use first.isVersion flag
- Add 10 unit tests for lightenColor (hex parsing, clamping, cache, edge cases)
2026-03-27 05:16:48 +00:00
vorflux[bot]
5a63ebc996
chore: rename ClawdBot to OpenClaw across web and docs (#811)
Co-authored-by: Vorflux AI <noreply@vorflux.com>
2026-03-26 22:10:57 -07:00
Vorflux AI
13eb5e9cb0 Fix simulation prop not triggering re-render + add edge case tests
- Use useState for simulation so GraphCanvas receives it after creation
  (ref mutation alone didn't trigger re-render, causing frozen graph)
- Keep simulationRef for imperative access (reheat/coolDown in callbacks)
- Add edge case tests: orphaned non-root memory, cross-document chains,
  circular references with membership assertion, cold-cache middle node
2026-03-27 02:27:21 +00:00
Vorflux AI
5a4d610ed9 Address review: improve comments, naming, add edge case tests
- Rename tip -> cursor for consistency with backward walk
- Fix misleading test descriptions to reflect bidirectional behavior
- Add test for circular parent references (cycle protection)
- Add test for branching children (first-child-wins behavior)
- Document linear chain assumption in forward walk comment
2026-03-27 02:21:03 +00:00
Vorflux AI
47398cabc1 Fix version chain: bidirectional traversal so any node shows full chain
- Added childrenMap for forward traversal from parent to children
- getChain now walks backward to root AND forward to latest descendant
- Clicking v1 root node now shows the complete version chain UI
- Standalone v1 nodes (no children) still return null (no chain to show)
- Updated tests to reflect bidirectional behavior + added v1 root test
2026-03-27 02:18:17 +00:00
Vorflux AI
335c85007d Merge remote-tracking branch 'origin/main' into vorflux/graph-perf-consolidation 2026-03-27 02:12:15 +00:00
Vorflux AI
190cf727f4 Dim superseded (non-latest) memory nodes in graph
Memory nodes with isLatest=false are now visually dimmed:
- Full-size nodes: 35% opacity with dashed border stroke
- Zoomed-out dots: 35% opacity with thinner stroke
- Selected/hovered superseded nodes render at full opacity
  so users can still inspect them
2026-03-27 02:12:12 +00:00
MaheshtheDev
57748ead4d feat: web search and improve chat with tools (#810) 2026-03-27 01:57:13 +00:00
Vorflux AI
4750842b00 Use prepack/postpack instead of prepublishOnly/postpublish for export swap
prepack/postpack fire for both 'pack' and 'publish', and postpack
always runs after packing regardless of publish success, preventing
the working tree from being left in dist-exports state on failure.
2026-03-27 00:33:54 +00:00
Vorflux AI
96b7f16175 Fix Cloudflare Workers build: use source exports for workspace, dist for npm publish
- Package exports now point to source files (./src/index.tsx) for workspace
  consumers, allowing Next.js/Turbopack to resolve without pre-building
- Added publishConfig swap script that switches exports to dist/ during
  npm publish (prepublishOnly) and back to source after (postpublish)
- Added @supermemory/memory-graph to transpilePackages in web app next.config.ts
  so Next.js transpiles the source files correctly
2026-03-27 00:30:47 +00:00
Vorflux AI
3eab287959 Fix biome lint/format errors: aria-hidden on SVGs, Infinity -> Number.POSITIVE_INFINITY, line length formatting 2026-03-27 00:12:50 +00:00
Vorflux AI
e7676763a9 Add comprehensive unit tests for memory-graph package
79 tests across 6 test files covering:
- SpatialIndex: grid rebuild, queryPoint hit-testing, boundary cells, hash detection
- ViewportState: worldToScreen/screenToWorld roundtrip, pan, zoomImmediate,
  zoomTo animation, fitToNodes, centerOn, inertia decay
- ForceSimulation: init/destroy lifecycle, update hot-swap, reheat/coolDown
- VersionChainIndex: chain building via parentMemoryId, caching, rebuild
- Graph data utils: normalizeDocCoordinates, getMemoryBorderColor,
  getEdgeVisualProps, screenToBackendCoords, calculateBackendViewport
- Mock data: deterministic seeded output, correct counts, valid edge references

Also exports pure utility functions from use-graph-data.ts for testability.
2026-03-27 00:06:21 +00:00
Vorflux AI
4dcf3b2a62 Fix review bugs: slideshow re-mount, edges cascade, stale popover, maxNodes
- Fix slideshow useEffect: use nodesRef instead of nodes in deps to prevent
  interval teardown/recreation on every render
- Fix edges useMemo: compute allNodeIds from normalizedDocs directly instead
  of depending on nodes (which changes identity every render)
- Fix popover position: add zoomDisplay to deps so position updates on pan/zoom
- Implement maxNodes prop: limit documents before passing to useGraphData
- Fix SpatialIndex hash: include node IDs and use 10x position granularity
  to prevent false cache hits during physics simulation
2026-03-26 18:04:25 +00:00
Vorflux AI
1c5ef7e5ed Rewrite @supermemory/memory-graph with perf optimizations and consolidate consumers
Package changes (packages/memory-graph):
- Spatial grid nearest-neighbor: O(n^2) -> O(n*k) for doc-doc edge rendering
- Zoom-based edge culling: skip low-similarity edges at low zoom levels
- Modular canvas engine from mono repo (renderer, simulation, viewport, hit-test)
- Remove vanilla-extract CSS, use inline styles only
- Add motion/react for slide-in animations
- Export mock data generator for stress testing
- Add performance and integration tests (15/15 pass)

Web app changes (apps/web):
- Remove local graph implementation (~4400 lines deleted)
- Add thin wrapper (memory-graph-wrapper.tsx) using useGraphApi hook
- Keep app-specific graph-card.tsx and use-graph-api.ts

Playground changes (apps/memory-graph-playground):
- Add stress test buttons (50/100/200/500 docs)
- Add mock data generation via package
- Convert DocumentWithMemories to GraphApiDocument format
- Show FPS counter during stress tests

All TypeScript compiles clean. Performance tests: 15/15 pass.
2026-03-26 17:58:28 +00:00
Prasanna721
694ad8123a fix: remove useQuery wrapper around synchronous billing checks (#805)
#### fix: billing subscription status race condition

 - **Bug fix**: Replaced `fetchSubscriptionStatus` (useQuery wrapper) with `getSubscriptionStatus` (pure function) — fixes intermittent "Upgrade to Pro"
  failures caused by stale cached billing state
  - **Anti-pattern**: Removed `fetchConnectionsFeature` useQuery wrapper, replaced with direct `autumn.customer?.features?.connections` read
  - **Dead code**: Removed unused `useMemoriesUsage` hook and `fetchMemoriesFeature`
2026-03-26 05:29:53 +00:00
MaheshtheDev
fe5d16509a feat: ensure workspace created on nova new account (#798)
Added workspace management to the onboarding flow with automatic organization creation and workspace validation throughout the app.

### What changed?

- Wrapped the app layout with an `EnsureWorkspace` component that redirects users without organizations to onboarding
- Enhanced the welcome page to automatically create an organization with a generated slug when users complete their name input
- Expanded the auth context to track organizations list, restoration state, and provide organization refetching capabilities
- Added utility functions for generating unique organization slugs and usernames from display names
- Implemented proper organization restoration logic that handles saved preferences and multiple organization scenarios
2026-03-24 18:17:21 +00:00