claude-cortex 1.0.0 → 1.1.1

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.
Files changed (79) hide show
  1. package/dashboard/README.md +36 -0
  2. package/dashboard/components.json +22 -0
  3. package/dashboard/eslint.config.mjs +18 -0
  4. package/dashboard/next.config.ts +7 -0
  5. package/dashboard/package-lock.json +7784 -0
  6. package/dashboard/package.json +42 -0
  7. package/dashboard/postcss.config.mjs +7 -0
  8. package/dashboard/public/file.svg +1 -0
  9. package/dashboard/public/globe.svg +1 -0
  10. package/dashboard/public/next.svg +1 -0
  11. package/dashboard/public/vercel.svg +1 -0
  12. package/dashboard/public/window.svg +1 -0
  13. package/dashboard/src/app/favicon.ico +0 -0
  14. package/dashboard/src/app/globals.css +125 -0
  15. package/dashboard/src/app/layout.tsx +35 -0
  16. package/dashboard/src/app/page.tsx +338 -0
  17. package/dashboard/src/components/Providers.tsx +27 -0
  18. package/dashboard/src/components/brain/ActivityPulseSystem.tsx +229 -0
  19. package/dashboard/src/components/brain/BrainMesh.tsx +118 -0
  20. package/dashboard/src/components/brain/BrainRegions.tsx +254 -0
  21. package/dashboard/src/components/brain/BrainScene.tsx +255 -0
  22. package/dashboard/src/components/brain/CategoryLabels.tsx +103 -0
  23. package/dashboard/src/components/brain/CoreSphere.tsx +215 -0
  24. package/dashboard/src/components/brain/DataFlowParticles.tsx +123 -0
  25. package/dashboard/src/components/brain/DataStreamRings.tsx +161 -0
  26. package/dashboard/src/components/brain/ElectronFlow.tsx +323 -0
  27. package/dashboard/src/components/brain/HolographicGrid.tsx +235 -0
  28. package/dashboard/src/components/brain/MemoryLinks.tsx +271 -0
  29. package/dashboard/src/components/brain/MemoryNode.tsx +245 -0
  30. package/dashboard/src/components/brain/NeuralPathways.tsx +441 -0
  31. package/dashboard/src/components/brain/SynapseNodes.tsx +306 -0
  32. package/dashboard/src/components/brain/TimelineControls.tsx +205 -0
  33. package/dashboard/src/components/chip/ChipScene.tsx +497 -0
  34. package/dashboard/src/components/chip/ChipSubstrate.tsx +238 -0
  35. package/dashboard/src/components/chip/CortexCore.tsx +210 -0
  36. package/dashboard/src/components/chip/DataBus.tsx +416 -0
  37. package/dashboard/src/components/chip/MemoryCell.tsx +225 -0
  38. package/dashboard/src/components/chip/MemoryGrid.tsx +328 -0
  39. package/dashboard/src/components/chip/QuantumCell.tsx +316 -0
  40. package/dashboard/src/components/chip/SectionLabel.tsx +113 -0
  41. package/dashboard/src/components/chip/index.ts +14 -0
  42. package/dashboard/src/components/controls/ControlPanel.tsx +100 -0
  43. package/dashboard/src/components/dashboard/StatsPanel.tsx +164 -0
  44. package/dashboard/src/components/debug/ActivityLog.tsx +238 -0
  45. package/dashboard/src/components/debug/DebugPanel.tsx +101 -0
  46. package/dashboard/src/components/debug/QueryTester.tsx +192 -0
  47. package/dashboard/src/components/debug/RelationshipGraph.tsx +403 -0
  48. package/dashboard/src/components/debug/SqlConsole.tsx +313 -0
  49. package/dashboard/src/components/memory/MemoryDetail.tsx +325 -0
  50. package/dashboard/src/components/ui/button.tsx +62 -0
  51. package/dashboard/src/components/ui/card.tsx +92 -0
  52. package/dashboard/src/components/ui/input.tsx +21 -0
  53. package/dashboard/src/hooks/useDebouncedValue.ts +24 -0
  54. package/dashboard/src/hooks/useMemories.ts +276 -0
  55. package/dashboard/src/hooks/useSuggestions.ts +46 -0
  56. package/dashboard/src/lib/category-colors.ts +84 -0
  57. package/dashboard/src/lib/position-algorithm.ts +177 -0
  58. package/dashboard/src/lib/simplex-noise.ts +217 -0
  59. package/dashboard/src/lib/store.ts +88 -0
  60. package/dashboard/src/lib/utils.ts +6 -0
  61. package/dashboard/src/lib/websocket.ts +216 -0
  62. package/dashboard/src/types/memory.ts +73 -0
  63. package/dashboard/tsconfig.json +34 -0
  64. package/dist/api/control.d.ts +27 -0
  65. package/dist/api/control.d.ts.map +1 -0
  66. package/dist/api/control.js +60 -0
  67. package/dist/api/control.js.map +1 -0
  68. package/dist/api/visualization-server.d.ts.map +1 -1
  69. package/dist/api/visualization-server.js +109 -2
  70. package/dist/api/visualization-server.js.map +1 -1
  71. package/dist/index.d.ts +2 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +80 -4
  74. package/dist/index.js.map +1 -1
  75. package/dist/memory/store.d.ts +6 -0
  76. package/dist/memory/store.d.ts.map +1 -1
  77. package/dist/memory/store.js +14 -0
  78. package/dist/memory/store.js.map +1 -1
  79. package/package.json +7 -3
@@ -0,0 +1,441 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * Neural Pathways
5
+ * Visualizes the main axon tracts and dendrite networks in the brain
6
+ * - Major pathways: Glowing tubes connecting brain regions
7
+ * - Dendrite network: Fine branching connections
8
+ * - Electron flow along pathways
9
+ */
10
+
11
+ import { useMemo, useRef } from 'react';
12
+ import { useFrame } from '@react-three/fiber';
13
+ import { Line } from '@react-three/drei';
14
+ import * as THREE from 'three';
15
+
16
+ // Jarvis-style golden/orange color palette
17
+ const JARVIS_GOLD = '#FFD700';
18
+ const JARVIS_ORANGE = '#FF8C00';
19
+ const JARVIS_AMBER = '#FFB347';
20
+ const JARVIS_LIGHT_AMBER = '#FFCC66';
21
+ const JARVIS_CYAN = '#00D4FF'; // Accent color for contrast
22
+
23
+ // Major pathway definitions - Jarvis golden theme
24
+ const MAJOR_PATHWAYS = [
25
+ // Central axis: STM → Episodic → LTM
26
+ {
27
+ id: 'central-forward',
28
+ points: [[0, 0, 3.5], [0, 0.5, 1.5], [0, 0.3, 0]],
29
+ color: JARVIS_GOLD,
30
+ intensity: 1.0,
31
+ label: 'STM → Episodic',
32
+ },
33
+ {
34
+ id: 'central-back',
35
+ points: [[0, 0.3, 0], [0, 0.5, -1.5], [0, 0, -3.5]],
36
+ color: JARVIS_ORANGE,
37
+ intensity: 0.9,
38
+ label: 'Episodic → LTM',
39
+ },
40
+ // Left hemisphere tract
41
+ {
42
+ id: 'left-tract',
43
+ points: [[-2, 0, 2.5], [-2.5, 0.3, 0], [-2, 0, -2.5]],
44
+ color: JARVIS_AMBER,
45
+ intensity: 0.7,
46
+ label: 'Left Hemisphere',
47
+ },
48
+ // Right hemisphere tract
49
+ {
50
+ id: 'right-tract',
51
+ points: [[2, 0, 2.5], [2.5, 0.3, 0], [2, 0, -2.5]],
52
+ color: JARVIS_AMBER,
53
+ intensity: 0.7,
54
+ label: 'Right Hemisphere',
55
+ },
56
+ // Corpus callosum (cross-hemisphere) - cyan accent for visual interest
57
+ {
58
+ id: 'corpus-callosum',
59
+ points: [[-2.5, 0.2, 0], [0, 0.8, 0], [2.5, 0.2, 0]],
60
+ color: JARVIS_CYAN,
61
+ intensity: 0.8,
62
+ label: 'Cross-Hemisphere',
63
+ },
64
+ // Diagonal connections
65
+ {
66
+ id: 'left-frontal',
67
+ points: [[-1.5, 0.5, 2.5], [-2, 0.3, 0.5]],
68
+ color: JARVIS_LIGHT_AMBER,
69
+ intensity: 0.5,
70
+ label: 'Left Frontal',
71
+ },
72
+ {
73
+ id: 'right-frontal',
74
+ points: [[1.5, 0.5, 2.5], [2, 0.3, 0.5]],
75
+ color: JARVIS_LIGHT_AMBER,
76
+ intensity: 0.5,
77
+ label: 'Right Frontal',
78
+ },
79
+ {
80
+ id: 'left-occipital',
81
+ points: [[-1.5, 0.3, -2.5], [-2, 0.2, -0.5]],
82
+ color: JARVIS_ORANGE,
83
+ intensity: 0.5,
84
+ label: 'Left Occipital',
85
+ },
86
+ {
87
+ id: 'right-occipital',
88
+ points: [[1.5, 0.3, -2.5], [2, 0.2, -0.5]],
89
+ color: JARVIS_ORANGE,
90
+ intensity: 0.5,
91
+ label: 'Right Occipital',
92
+ },
93
+ ];
94
+
95
+ interface PathwayProps {
96
+ points: number[][];
97
+ color: string;
98
+ intensity: number;
99
+ electronCount?: number;
100
+ }
101
+
102
+ /**
103
+ * Electron particle traveling along a pathway
104
+ */
105
+ function PathwayElectron({
106
+ curve,
107
+ color,
108
+ speed,
109
+ delay,
110
+ }: {
111
+ curve: THREE.CatmullRomCurve3;
112
+ color: string;
113
+ speed: number;
114
+ delay: number;
115
+ }) {
116
+ const meshRef = useRef<THREE.Mesh>(null);
117
+ const glowRef = useRef<THREE.Mesh>(null);
118
+ const progressRef = useRef(delay);
119
+
120
+ useFrame((_, delta) => {
121
+ if (!meshRef.current) return;
122
+
123
+ progressRef.current += delta * speed * 0.3;
124
+ if (progressRef.current > 1) {
125
+ progressRef.current = 0;
126
+ }
127
+
128
+ const point = curve.getPoint(progressRef.current);
129
+ meshRef.current.position.copy(point);
130
+
131
+ // Fade at endpoints
132
+ const fadeIn = Math.min(progressRef.current * 5, 1);
133
+ const fadeOut = Math.min((1 - progressRef.current) * 5, 1);
134
+ const opacity = fadeIn * fadeOut;
135
+
136
+ (meshRef.current.material as THREE.MeshBasicMaterial).opacity = opacity * 0.95;
137
+
138
+ if (glowRef.current) {
139
+ glowRef.current.position.copy(point);
140
+ (glowRef.current.material as THREE.MeshBasicMaterial).opacity = opacity * 0.4;
141
+ }
142
+ });
143
+
144
+ return (
145
+ <>
146
+ {/* Electron core */}
147
+ <mesh ref={meshRef}>
148
+ <sphereGeometry args={[0.06, 8, 8]} />
149
+ <meshBasicMaterial color={color} transparent opacity={0.9} />
150
+ </mesh>
151
+ {/* Glow */}
152
+ <mesh ref={glowRef}>
153
+ <sphereGeometry args={[0.12, 6, 6]} />
154
+ <meshBasicMaterial
155
+ color={color}
156
+ transparent
157
+ opacity={0.4}
158
+ depthWrite={false}
159
+ />
160
+ </mesh>
161
+ </>
162
+ );
163
+ }
164
+
165
+ /**
166
+ * Single major pathway with tube geometry and electrons
167
+ */
168
+ function MajorPathway({ points, color, intensity, electronCount = 3 }: PathwayProps) {
169
+ const tubeRef = useRef<THREE.Mesh>(null);
170
+
171
+ // Create smooth curve through points
172
+ const { curve, tubeGeometry } = useMemo(() => {
173
+ const vectors = points.map((p) => new THREE.Vector3(p[0], p[1], p[2]));
174
+ const curve = new THREE.CatmullRomCurve3(vectors);
175
+ const tubeGeometry = new THREE.TubeGeometry(curve, 32, 0.08, 8, false);
176
+ return { curve, tubeGeometry };
177
+ }, [points]);
178
+
179
+ // Pulsing glow
180
+ useFrame((state) => {
181
+ if (!tubeRef.current) return;
182
+ const pulse = Math.sin(state.clock.elapsedTime * 2) * 0.2 + 0.8;
183
+ (tubeRef.current.material as THREE.MeshStandardMaterial).emissiveIntensity =
184
+ intensity * pulse * 0.6;
185
+ });
186
+
187
+ // Generate electron delays
188
+ const electrons = useMemo(
189
+ () =>
190
+ Array.from({ length: electronCount }, (_, i) => ({
191
+ delay: i / electronCount,
192
+ speed: 0.8 + Math.random() * 0.4,
193
+ })),
194
+ [electronCount]
195
+ );
196
+
197
+ return (
198
+ <group>
199
+ {/* Tube pathway */}
200
+ <mesh ref={tubeRef} geometry={tubeGeometry}>
201
+ <meshStandardMaterial
202
+ color={color}
203
+ emissive={color}
204
+ emissiveIntensity={intensity * 0.5}
205
+ transparent
206
+ opacity={0.35}
207
+ metalness={0.5}
208
+ roughness={0.3}
209
+ />
210
+ </mesh>
211
+
212
+ {/* Electrons along pathway */}
213
+ {electrons.map((e, i) => (
214
+ <PathwayElectron
215
+ key={i}
216
+ curve={curve}
217
+ color={color}
218
+ speed={e.speed}
219
+ delay={e.delay}
220
+ />
221
+ ))}
222
+ </group>
223
+ );
224
+ }
225
+
226
+ /**
227
+ * Helper to convert spherical to cartesian coordinates
228
+ */
229
+ function sphericalToCartesian(
230
+ r: number,
231
+ theta: number,
232
+ phi: number
233
+ ): [number, number, number] {
234
+ return [
235
+ r * Math.sin(phi) * Math.cos(theta),
236
+ r * Math.cos(phi),
237
+ r * Math.sin(phi) * Math.sin(theta),
238
+ ];
239
+ }
240
+
241
+ /**
242
+ * Dendrite network - fine branching connections
243
+ */
244
+ function DendriteNetwork({ count = 60 }: { count?: number }) {
245
+ const dendrites = useMemo(() => {
246
+ return Array.from({ length: count }, (_, i) => {
247
+ const theta = Math.random() * Math.PI * 2;
248
+ const phi = Math.PI * 0.2 + Math.random() * Math.PI * 0.6; // Avoid poles
249
+ const r = 2.2 + Math.random() * 1.3;
250
+
251
+ const start = sphericalToCartesian(r, theta, phi);
252
+ const end = sphericalToCartesian(
253
+ r + 0.3 + Math.random() * 0.5,
254
+ theta + (Math.random() - 0.5) * 0.4,
255
+ phi + (Math.random() - 0.5) * 0.3
256
+ );
257
+
258
+ // Color based on position (depth) - Jarvis golden variants
259
+ const normalizedZ = (start[2] + 3.5) / 7;
260
+ const color = normalizedZ > 0.6
261
+ ? JARVIS_GOLD // Front - bright gold
262
+ : normalizedZ > 0.4
263
+ ? JARVIS_AMBER // Middle - warm gold
264
+ : JARVIS_ORANGE; // Back - deep orange
265
+
266
+ return { start, end, color, opacity: 0.15 + Math.random() * 0.15 };
267
+ });
268
+ }, [count]);
269
+
270
+ return (
271
+ <group>
272
+ {dendrites.map((d, i) => (
273
+ <Line
274
+ key={i}
275
+ points={[d.start, d.end]}
276
+ color={d.color}
277
+ lineWidth={0.8}
278
+ transparent
279
+ opacity={d.opacity}
280
+ />
281
+ ))}
282
+ </group>
283
+ );
284
+ }
285
+
286
+ /**
287
+ * Junction nodes where pathways meet
288
+ */
289
+ function PathwayJunction({
290
+ position,
291
+ color,
292
+ size = 0.15,
293
+ }: {
294
+ position: [number, number, number];
295
+ color: string;
296
+ size?: number;
297
+ }) {
298
+ const meshRef = useRef<THREE.Mesh>(null);
299
+ const glowRef = useRef<THREE.Mesh>(null);
300
+
301
+ useFrame((state) => {
302
+ if (!meshRef.current) return;
303
+ const pulse = Math.sin(state.clock.elapsedTime * 3) * 0.3 + 0.7;
304
+ meshRef.current.scale.setScalar(size * (1 + pulse * 0.2));
305
+ (meshRef.current.material as THREE.MeshBasicMaterial).opacity = pulse * 0.9;
306
+
307
+ if (glowRef.current) {
308
+ glowRef.current.scale.setScalar(size * 2.5 * (1 + pulse * 0.3));
309
+ (glowRef.current.material as THREE.MeshBasicMaterial).opacity = pulse * 0.3;
310
+ }
311
+ });
312
+
313
+ return (
314
+ <group position={position}>
315
+ <mesh ref={glowRef}>
316
+ <sphereGeometry args={[1, 8, 8]} />
317
+ <meshBasicMaterial
318
+ color={color}
319
+ transparent
320
+ opacity={0.3}
321
+ depthWrite={false}
322
+ />
323
+ </mesh>
324
+ <mesh ref={meshRef}>
325
+ <sphereGeometry args={[1, 12, 12]} />
326
+ <meshBasicMaterial color={color} transparent opacity={0.9} />
327
+ </mesh>
328
+ </group>
329
+ );
330
+ }
331
+
332
+ // Junction positions where pathways meet - Jarvis golden theme
333
+ const JUNCTIONS = [
334
+ { position: [0, 0.5, 1.5] as [number, number, number], color: JARVIS_GOLD },
335
+ { position: [0, 0.3, 0] as [number, number, number], color: JARVIS_AMBER },
336
+ { position: [0, 0.5, -1.5] as [number, number, number], color: JARVIS_ORANGE },
337
+ { position: [-2.5, 0.3, 0] as [number, number, number], color: JARVIS_AMBER },
338
+ { position: [2.5, 0.3, 0] as [number, number, number], color: JARVIS_AMBER },
339
+ { position: [0, 0.8, 0] as [number, number, number], color: JARVIS_CYAN },
340
+ ];
341
+
342
+ /**
343
+ * Main neural pathways component
344
+ */
345
+ export function NeuralPathways() {
346
+ return (
347
+ <group name="neural-pathways">
348
+ {/* Major axon tracts */}
349
+ {MAJOR_PATHWAYS.map((pathway) => (
350
+ <MajorPathway
351
+ key={pathway.id}
352
+ points={pathway.points}
353
+ color={pathway.color}
354
+ intensity={pathway.intensity}
355
+ electronCount={pathway.intensity > 0.7 ? 4 : 2}
356
+ />
357
+ ))}
358
+
359
+ {/* Junction nodes */}
360
+ {JUNCTIONS.map((junction, i) => (
361
+ <PathwayJunction
362
+ key={i}
363
+ position={junction.position}
364
+ color={junction.color}
365
+ size={0.12}
366
+ />
367
+ ))}
368
+
369
+ {/* Fine dendrite network */}
370
+ <DendriteNetwork count={80} />
371
+ </group>
372
+ );
373
+ }
374
+
375
+ /**
376
+ * Dynamic pathway that connects two memory nodes
377
+ */
378
+ export function MemoryConnection({
379
+ startPos,
380
+ endPos,
381
+ strength = 0.5,
382
+ relationship,
383
+ }: {
384
+ startPos: { x: number; y: number; z: number };
385
+ endPos: { x: number; y: number; z: number };
386
+ strength: number;
387
+ relationship: string;
388
+ }) {
389
+ // Jarvis-style golden theme with cyan accent
390
+ const COLORS: Record<string, string> = {
391
+ references: JARVIS_CYAN, // Cyan accent for contrast
392
+ extends: JARVIS_GOLD,
393
+ contradicts: '#FF6B6B', // Keep error red
394
+ related: JARVIS_AMBER,
395
+ };
396
+
397
+ const color = COLORS[relationship] || COLORS.related;
398
+
399
+ const { curve, points } = useMemo(() => {
400
+ const start = new THREE.Vector3(startPos.x, startPos.y, startPos.z);
401
+ const end = new THREE.Vector3(endPos.x, endPos.y, endPos.z);
402
+
403
+ // Create organic curve
404
+ const mid = new THREE.Vector3().lerpVectors(start, end, 0.5);
405
+ const direction = new THREE.Vector3().subVectors(end, start);
406
+ const perpendicular = new THREE.Vector3(
407
+ -direction.y,
408
+ direction.x,
409
+ direction.z * 0.3
410
+ ).normalize();
411
+
412
+ const curveAmount = direction.length() * 0.2 * strength;
413
+ mid.add(perpendicular.multiplyScalar(curveAmount));
414
+
415
+ const curve = new THREE.CatmullRomCurve3([start, mid, end]);
416
+ return { curve, points: curve.getPoints(24) };
417
+ }, [startPos, endPos, strength]);
418
+
419
+ const electronCount = strength > 0.7 ? 3 : strength > 0.4 ? 2 : 1;
420
+
421
+ return (
422
+ <group>
423
+ <Line
424
+ points={points}
425
+ color={color}
426
+ lineWidth={1 + strength * 2}
427
+ transparent
428
+ opacity={0.4 + strength * 0.4}
429
+ />
430
+ {Array.from({ length: electronCount }).map((_, i) => (
431
+ <PathwayElectron
432
+ key={i}
433
+ curve={curve}
434
+ color={color}
435
+ speed={0.8 + strength * 0.5}
436
+ delay={i / electronCount}
437
+ />
438
+ ))}
439
+ </group>
440
+ );
441
+ }