Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: deduplicate tags, sort ring iteration, computeLineDistances for dashed edges
Adam Eivy9d550f146d8d
diff --git a/client/src/components/goals/GoalsTreeView.jsx b/client/src/components/goals/GoalsTreeView.jsxindex d79335a23a..384c8e73df 100644--- a/client/src/components/goals/GoalsTreeView.jsx+++ b/client/src/components/goals/GoalsTreeView.jsx@@ -19,42 +19,46 @@ function GoalEdges({ edges, selectedId }) {const parentGeoRef = useRef();const tagGeoRef = useRef();+ const tagLineRef = useRef();- useEffect(() => {- const setupGeo = (geo, edgeList) => {- if (!geo) return;- if (!edgeList.length) {- geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(0), 3));- geo.setAttribute('color', new THREE.BufferAttribute(new Float32Array(0), 3));- geo.computeBoundingSphere();- return;- }- const count = edgeList.length;- const positions = new Float32Array(count * 6);- const colors = new Float32Array(count * 6);- const tmpColor = new THREE.Color();- edgeList.forEach((e, i) => {- const a = e.sourceNode, b = e.targetNode;- const off = i * 6;- positions[off] = a.x; positions[off + 1] = a.y; positions[off + 2] = a.z;- positions[off + 3] = b.x; positions[off + 4] = b.y; positions[off + 5] = b.z;- const dimmed = selectedId && e.source !== selectedId && e.target !== selectedId;- tmpColor.set(EDGE_COLORS[e.type] || '#6b7280');- const intensity = dimmed ? 0.06 : (e.type === 'parent' ? 0.5 : 0.2);- colors[off] = tmpColor.r * intensity;- colors[off + 1] = tmpColor.g * intensity;- colors[off + 2] = tmpColor.b * intensity;- colors[off + 3] = tmpColor.r * intensity;- colors[off + 4] = tmpColor.g * intensity;- colors[off + 5] = tmpColor.b * intensity;- });- geo.setAttribute('position', new THREE.BufferAttribute(positions, 3));- geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));+ const setupGeo = useCallback((geo, edgeList) => {+ if (!geo) return;+ if (!edgeList.length) {+ geo.setAttribute('position', new THREE.BufferAttribute(new Float32Array(0), 3));+ geo.setAttribute('color', new THREE.BufferAttribute(new Float32Array(0), 3));geo.computeBoundingSphere();- };+ return;+ }+ const count = edgeList.length;+ const positions = new Float32Array(count * 6);+ const colors = new Float32Array(count * 6);+ const tmpColor = new THREE.Color();+ edgeList.forEach((e, i) => {+ const a = e.sourceNode, b = e.targetNode;+ const off = i * 6;+ positions[off] = a.x; positions[off + 1] = a.y; positions[off + 2] = a.z;+ positions[off + 3] = b.x; positions[off + 4] = b.y; positions[off + 5] = b.z;+ const dimmed = selectedId && e.source !== selectedId && e.target !== selectedId;+ tmpColor.set(EDGE_COLORS[e.type] || '#6b7280');+ const intensity = dimmed ? 0.06 : (e.type === 'parent' ? 0.5 : 0.2);+ colors[off] = tmpColor.r * intensity;+ colors[off + 1] = tmpColor.g * intensity;+ colors[off + 2] = tmpColor.b * intensity;+ colors[off + 3] = tmpColor.r * intensity;+ colors[off + 4] = tmpColor.g * intensity;+ colors[off + 5] = tmpColor.b * intensity;+ });+ geo.setAttribute('position', new THREE.BufferAttribute(positions, 3));+ geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));+ geo.computeBoundingSphere();+ }, [selectedId]);++ useEffect(() => {setupGeo(parentGeoRef.current, parentEdges);setupGeo(tagGeoRef.current, tagEdges);- }, [parentEdges, tagEdges, selectedId]);+ // LineDashedMaterial requires computeLineDistances on the LineSegments mesh+ tagLineRef.current?.computeLineDistances();+ }, [parentEdges, tagEdges, setupGeo]);return (<>@@ -62,7 +66,7 @@ function GoalEdges({ edges, selectedId }) {<bufferGeometry ref={parentGeoRef} /><lineBasicMaterial vertexColors /></lineSegments>- <lineSegments>+ <lineSegments ref={tagLineRef}><bufferGeometry ref={tagGeoRef} /><lineDashedMaterial vertexColors dashSize={0.5} gapSize={0.3} /></lineSegments>diff --git a/client/src/components/goals/goalTreeLayout.js b/client/src/components/goals/goalTreeLayout.jsindex 3a23e2dcf4..9991501cdd 100644--- a/client/src/components/goals/goalTreeLayout.js+++ b/client/src/components/goals/goalTreeLayout.js@@ -42,8 +42,8 @@ export function layoutGoalNodes(flatGoals) {const positioned = new Map();- // Position nodes ring by ring- for (const [ringStr, goals] of Object.entries(rings)) {+ // Position nodes ring by ring (sorted so parents at inner rings are positioned first)+ for (const [ringStr, goals] of Object.entries(rings).sort((a, b) => Number(a[0]) - Number(b[0]))) {const ring = Number(ringStr);const radius = ring * RING_RADIUS;const count = goals.length;diff --git a/server/services/identity.js b/server/services/identity.jsindex 6fc5ad7a55..7bd8e5054b 100644--- a/server/services/identity.js+++ b/server/services/identity.js@@ -761,6 +761,10 @@ export async function updateGoal(goalId, updates) {for (const key of allowed) {if (updates[key] !== undefined) goal[key] = updates[key];}+ // Normalize tags: deduplicate and trim+ if (goal.tags) {+ goal.tags = [...new Set(goal.tags.map(t => t.trim()).filter(Boolean))];+ }goal.updatedAt = new Date().toISOString();// Recalculate urgency if horizon changed@@ -815,10 +819,10 @@ export async function getGoalsTree() {}}- // Build tag index+ // Build tag index (deduplicated per tag)const tagIndex = {};for (const goal of goals.goals) {- for (const tag of (goal.tags || [])) {+ for (const tag of new Set(goal.tags || [])) {if (!tagIndex[tag]) tagIndex[tag] = [];tagIndex[tag].push(goal.id);}