claude-cortex 1.0.0 → 1.1.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.
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,238 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * Chip Substrate
5
+ * The base silicon die with grid texture, borders, and corner pins
6
+ */
7
+
8
+ import { useMemo, useRef } from 'react';
9
+ import { useFrame } from '@react-three/fiber';
10
+ import * as THREE from 'three';
11
+
12
+ interface ChipSubstrateProps {
13
+ width?: number;
14
+ height?: number;
15
+ position?: [number, number, number];
16
+ }
17
+
18
+ // Shared geometries for performance
19
+ const PIN_GEOMETRY = new THREE.SphereGeometry(0.15, 8, 8);
20
+ const PIN_MATERIAL = new THREE.MeshStandardMaterial({
21
+ color: '#9ca3af',
22
+ metalness: 0.8,
23
+ roughness: 0.2,
24
+ });
25
+
26
+ export function ChipSubstrate({
27
+ width = 16,
28
+ height = 12,
29
+ position = [0, 0, 0],
30
+ }: ChipSubstrateProps) {
31
+ const gridRef = useRef<THREE.LineSegments>(null);
32
+
33
+ // Create substrate plane with grid texture
34
+ const substrateMaterial = useMemo(() => {
35
+ return new THREE.MeshStandardMaterial({
36
+ color: '#1a1a2e',
37
+ metalness: 0.1,
38
+ roughness: 0.8,
39
+ side: THREE.DoubleSide,
40
+ });
41
+ }, []);
42
+
43
+ // Create grid lines
44
+ const gridGeometry = useMemo(() => {
45
+ const points: THREE.Vector3[] = [];
46
+ const gridSpacing = 0.5;
47
+ const halfWidth = width / 2;
48
+ const halfHeight = height / 2;
49
+
50
+ // Vertical lines
51
+ for (let x = -halfWidth; x <= halfWidth; x += gridSpacing) {
52
+ points.push(new THREE.Vector3(x, -halfHeight, 0.01));
53
+ points.push(new THREE.Vector3(x, halfHeight, 0.01));
54
+ }
55
+
56
+ // Horizontal lines
57
+ for (let y = -halfHeight; y <= halfHeight; y += gridSpacing) {
58
+ points.push(new THREE.Vector3(-halfWidth, y, 0.01));
59
+ points.push(new THREE.Vector3(halfWidth, y, 0.01));
60
+ }
61
+
62
+ const geometry = new THREE.BufferGeometry().setFromPoints(points);
63
+ return geometry;
64
+ }, [width, height]);
65
+
66
+ // Create border lines
67
+ const borderGeometry = useMemo(() => {
68
+ const halfWidth = width / 2;
69
+ const halfHeight = height / 2;
70
+ const inset = 0.3;
71
+
72
+ const points = [
73
+ // Outer border
74
+ new THREE.Vector3(-halfWidth, -halfHeight, 0.02),
75
+ new THREE.Vector3(halfWidth, -halfHeight, 0.02),
76
+ new THREE.Vector3(halfWidth, -halfHeight, 0.02),
77
+ new THREE.Vector3(halfWidth, halfHeight, 0.02),
78
+ new THREE.Vector3(halfWidth, halfHeight, 0.02),
79
+ new THREE.Vector3(-halfWidth, halfHeight, 0.02),
80
+ new THREE.Vector3(-halfWidth, halfHeight, 0.02),
81
+ new THREE.Vector3(-halfWidth, -halfHeight, 0.02),
82
+ // Inner border (etched)
83
+ new THREE.Vector3(-halfWidth + inset, -halfHeight + inset, 0.02),
84
+ new THREE.Vector3(halfWidth - inset, -halfHeight + inset, 0.02),
85
+ new THREE.Vector3(halfWidth - inset, -halfHeight + inset, 0.02),
86
+ new THREE.Vector3(halfWidth - inset, halfHeight - inset, 0.02),
87
+ new THREE.Vector3(halfWidth - inset, halfHeight - inset, 0.02),
88
+ new THREE.Vector3(-halfWidth + inset, halfHeight - inset, 0.02),
89
+ new THREE.Vector3(-halfWidth + inset, halfHeight - inset, 0.02),
90
+ new THREE.Vector3(-halfWidth + inset, -halfHeight + inset, 0.02),
91
+ ];
92
+
93
+ return new THREE.BufferGeometry().setFromPoints(points);
94
+ }, [width, height]);
95
+
96
+ // Section divider positions (for STM, Episodic, LTM sections)
97
+ const sectionDividers = useMemo(() => {
98
+ const halfWidth = width / 2;
99
+ const sectionHeight = height / 3;
100
+ const halfHeight = height / 2;
101
+
102
+ return [
103
+ // Top divider (between STM and Episodic)
104
+ {
105
+ y: halfHeight - sectionHeight,
106
+ points: [
107
+ new THREE.Vector3(-halfWidth + 0.3, halfHeight - sectionHeight, 0.02),
108
+ new THREE.Vector3(halfWidth - 0.3, halfHeight - sectionHeight, 0.02),
109
+ ],
110
+ },
111
+ // Bottom divider (between Episodic and LTM)
112
+ {
113
+ y: -halfHeight + sectionHeight,
114
+ points: [
115
+ new THREE.Vector3(-halfWidth + 0.3, -halfHeight + sectionHeight, 0.02),
116
+ new THREE.Vector3(halfWidth - 0.3, -halfHeight + sectionHeight, 0.02),
117
+ ],
118
+ },
119
+ ];
120
+ }, [width, height]);
121
+
122
+ // Corner pin positions
123
+ const pinPositions = useMemo(() => {
124
+ const halfWidth = width / 2;
125
+ const halfHeight = height / 2;
126
+ const offset = 0.5;
127
+
128
+ return [
129
+ [-halfWidth + offset, halfHeight - offset, 0.1],
130
+ [halfWidth - offset, halfHeight - offset, 0.1],
131
+ [-halfWidth + offset, -halfHeight + offset, 0.1],
132
+ [halfWidth - offset, -halfHeight + offset, 0.1],
133
+ ] as [number, number, number][];
134
+ }, [width, height]);
135
+
136
+ // Subtle grid pulse animation
137
+ useFrame((state) => {
138
+ if (gridRef.current) {
139
+ const material = gridRef.current.material as THREE.LineBasicMaterial;
140
+ material.opacity = 0.08 + Math.sin(state.clock.elapsedTime * 0.5) * 0.02;
141
+ }
142
+ });
143
+
144
+ return (
145
+ <group position={position}>
146
+ {/* Main substrate plane */}
147
+ <mesh rotation={[-Math.PI / 2, 0, 0]}>
148
+ <planeGeometry args={[width, height]} />
149
+ <primitive object={substrateMaterial} />
150
+ </mesh>
151
+
152
+ {/* Grid overlay */}
153
+ <lineSegments ref={gridRef} rotation={[-Math.PI / 2, 0, 0]}>
154
+ <primitive object={gridGeometry} />
155
+ <lineBasicMaterial color="#2d3748" opacity={0.1} transparent />
156
+ </lineSegments>
157
+
158
+ {/* Border lines */}
159
+ <lineSegments rotation={[-Math.PI / 2, 0, 0]}>
160
+ <primitive object={borderGeometry} />
161
+ <lineBasicMaterial color="#4a5568" linewidth={2} />
162
+ </lineSegments>
163
+
164
+ {/* Section dividers */}
165
+ {sectionDividers.map((divider, i) => (
166
+ <lineSegments key={i} rotation={[-Math.PI / 2, 0, 0]}>
167
+ <bufferGeometry>
168
+ <primitive
169
+ object={
170
+ new THREE.BufferAttribute(
171
+ new Float32Array(divider.points.flatMap((p) => [p.x, p.y, p.z])),
172
+ 3
173
+ )
174
+ }
175
+ attach="attributes-position"
176
+ />
177
+ </bufferGeometry>
178
+ <lineBasicMaterial color="#4a5568" opacity={0.6} transparent />
179
+ </lineSegments>
180
+ ))}
181
+
182
+ {/* Corner pins */}
183
+ {pinPositions.map((pos, i) => (
184
+ <mesh key={i} position={pos} geometry={PIN_GEOMETRY} material={PIN_MATERIAL} />
185
+ ))}
186
+
187
+ {/* Decorative edge traces */}
188
+ <EdgeTraces width={width} height={height} />
189
+ </group>
190
+ );
191
+ }
192
+
193
+ // Decorative circuit traces along edges
194
+ function EdgeTraces({ width, height }: { width: number; height: number }) {
195
+ const traces = useMemo(() => {
196
+ const halfWidth = width / 2;
197
+ const halfHeight = height / 2;
198
+ const traceLength = 1.5;
199
+ const points: THREE.Vector3[] = [];
200
+
201
+ // Top edge traces
202
+ for (let i = 0; i < 6; i++) {
203
+ const x = -halfWidth + 2 + i * 2;
204
+ points.push(new THREE.Vector3(x, halfHeight - 0.1, 0.02));
205
+ points.push(new THREE.Vector3(x, halfHeight - 0.1 - traceLength * 0.3, 0.02));
206
+ }
207
+
208
+ // Bottom edge traces
209
+ for (let i = 0; i < 6; i++) {
210
+ const x = -halfWidth + 2 + i * 2;
211
+ points.push(new THREE.Vector3(x, -halfHeight + 0.1, 0.02));
212
+ points.push(new THREE.Vector3(x, -halfHeight + 0.1 + traceLength * 0.3, 0.02));
213
+ }
214
+
215
+ // Left edge traces
216
+ for (let i = 0; i < 4; i++) {
217
+ const y = -halfHeight + 2 + i * 2.5;
218
+ points.push(new THREE.Vector3(-halfWidth + 0.1, y, 0.02));
219
+ points.push(new THREE.Vector3(-halfWidth + 0.1 + traceLength * 0.3, y, 0.02));
220
+ }
221
+
222
+ // Right edge traces
223
+ for (let i = 0; i < 4; i++) {
224
+ const y = -halfHeight + 2 + i * 2.5;
225
+ points.push(new THREE.Vector3(halfWidth - 0.1, y, 0.02));
226
+ points.push(new THREE.Vector3(halfWidth - 0.1 - traceLength * 0.3, y, 0.02));
227
+ }
228
+
229
+ return new THREE.BufferGeometry().setFromPoints(points);
230
+ }, [width, height]);
231
+
232
+ return (
233
+ <lineSegments rotation={[-Math.PI / 2, 0, 0]}>
234
+ <primitive object={traces} />
235
+ <lineBasicMaterial color="#FFB347" opacity={0.3} transparent />
236
+ </lineSegments>
237
+ );
238
+ }
@@ -0,0 +1,210 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * Cortex Core
5
+ * Central processing element with pulsing golden glow
6
+ * The focal point of the memory chip
7
+ */
8
+
9
+ import { useRef, useMemo } from 'react';
10
+ import { useFrame } from '@react-three/fiber';
11
+ import { Html } from '@react-three/drei';
12
+ import * as THREE from 'three';
13
+
14
+ interface CortexCoreProps {
15
+ position?: [number, number, number];
16
+ size?: number;
17
+ activity?: number; // 0-1, affects pulse intensity
18
+ showLabel?: boolean;
19
+ }
20
+
21
+ export function CortexCore({
22
+ position = [0, 0, 0],
23
+ size = 2,
24
+ activity = 0.5,
25
+ showLabel = true,
26
+ }: CortexCoreProps) {
27
+ const coreRef = useRef<THREE.Mesh>(null);
28
+ const glow1Ref = useRef<THREE.Mesh>(null);
29
+ const glow2Ref = useRef<THREE.Mesh>(null);
30
+ const glow3Ref = useRef<THREE.Mesh>(null);
31
+
32
+ // Core material - bright gold center
33
+ const coreMaterial = useMemo(() => {
34
+ return new THREE.MeshStandardMaterial({
35
+ color: '#FFD700',
36
+ emissive: '#FFD700',
37
+ emissiveIntensity: 0.8,
38
+ metalness: 0.3,
39
+ roughness: 0.4,
40
+ });
41
+ }, []);
42
+
43
+ // Glow materials - progressively fainter
44
+ const glowMaterials = useMemo(() => {
45
+ return [
46
+ new THREE.MeshBasicMaterial({
47
+ color: '#FFD700',
48
+ transparent: true,
49
+ opacity: 0.4,
50
+ side: THREE.BackSide,
51
+ }),
52
+ new THREE.MeshBasicMaterial({
53
+ color: '#FFB347',
54
+ transparent: true,
55
+ opacity: 0.2,
56
+ side: THREE.BackSide,
57
+ }),
58
+ new THREE.MeshBasicMaterial({
59
+ color: '#FF8C00',
60
+ transparent: true,
61
+ opacity: 0.1,
62
+ side: THREE.BackSide,
63
+ }),
64
+ ];
65
+ }, []);
66
+
67
+ // Animate pulse
68
+ useFrame((state) => {
69
+ const time = state.clock.elapsedTime;
70
+ const basePulse = Math.sin(time * 2) * 0.5 + 0.5;
71
+ const activityBoost = activity * 0.3;
72
+
73
+ // Core pulse
74
+ if (coreRef.current) {
75
+ const material = coreRef.current.material as THREE.MeshStandardMaterial;
76
+ material.emissiveIntensity = 0.6 + basePulse * 0.4 + activityBoost;
77
+ }
78
+
79
+ // Glow layers pulse with phase offset
80
+ if (glow1Ref.current) {
81
+ const mat = glow1Ref.current.material as THREE.MeshBasicMaterial;
82
+ mat.opacity = 0.3 + basePulse * 0.2 + activityBoost * 0.5;
83
+ glow1Ref.current.scale.setScalar(1 + basePulse * 0.05);
84
+ }
85
+
86
+ if (glow2Ref.current) {
87
+ const phase2 = Math.sin(time * 2 + 0.5) * 0.5 + 0.5;
88
+ const mat = glow2Ref.current.material as THREE.MeshBasicMaterial;
89
+ mat.opacity = 0.15 + phase2 * 0.1 + activityBoost * 0.3;
90
+ glow2Ref.current.scale.setScalar(1 + phase2 * 0.03);
91
+ }
92
+
93
+ if (glow3Ref.current) {
94
+ const phase3 = Math.sin(time * 2 + 1) * 0.5 + 0.5;
95
+ const mat = glow3Ref.current.material as THREE.MeshBasicMaterial;
96
+ mat.opacity = 0.08 + phase3 * 0.05 + activityBoost * 0.2;
97
+ glow3Ref.current.scale.setScalar(1 + phase3 * 0.02);
98
+ }
99
+ });
100
+
101
+ return (
102
+ <group position={position}>
103
+ {/* Core block - rounded rectangle */}
104
+ <mesh ref={coreRef} material={coreMaterial}>
105
+ <boxGeometry args={[size, size * 0.6, 0.3]} />
106
+ </mesh>
107
+
108
+ {/* Inner detail - circuit pattern */}
109
+ <CoreCircuitPattern size={size} />
110
+
111
+ {/* Glow layer 1 */}
112
+ <mesh ref={glow1Ref}>
113
+ <boxGeometry args={[size * 1.1, size * 0.7, 0.4]} />
114
+ <primitive object={glowMaterials[0]} />
115
+ </mesh>
116
+
117
+ {/* Glow layer 2 */}
118
+ <mesh ref={glow2Ref}>
119
+ <boxGeometry args={[size * 1.3, size * 0.85, 0.5]} />
120
+ <primitive object={glowMaterials[1]} />
121
+ </mesh>
122
+
123
+ {/* Glow layer 3 */}
124
+ <mesh ref={glow3Ref}>
125
+ <boxGeometry args={[size * 1.5, size, 0.6]} />
126
+ <primitive object={glowMaterials[2]} />
127
+ </mesh>
128
+
129
+ {/* Activity indicator dot */}
130
+ <ActivityIndicator activity={activity} size={size} />
131
+
132
+ {/* Label */}
133
+ {showLabel && (
134
+ <Html
135
+ position={[0, -size * 0.45, 0.2]}
136
+ center
137
+ style={{
138
+ pointerEvents: 'none',
139
+ userSelect: 'none',
140
+ }}
141
+ >
142
+ <div className="text-[10px] font-mono text-amber-400/80 whitespace-nowrap tracking-wider">
143
+ CORTEX CORE
144
+ </div>
145
+ </Html>
146
+ )}
147
+ </group>
148
+ );
149
+ }
150
+
151
+ // Circuit pattern on core surface
152
+ function CoreCircuitPattern({ size }: { size: number }) {
153
+ const linesGeometry = useMemo(() => {
154
+ const points: THREE.Vector3[] = [];
155
+ const halfSize = size / 2;
156
+ const z = 0.16;
157
+
158
+ // Horizontal lines
159
+ for (let i = -2; i <= 2; i++) {
160
+ const y = i * 0.12;
161
+ points.push(new THREE.Vector3(-halfSize * 0.7, y, z));
162
+ points.push(new THREE.Vector3(halfSize * 0.7, y, z));
163
+ }
164
+
165
+ // Vertical lines
166
+ for (let i = -4; i <= 4; i++) {
167
+ const x = i * 0.18;
168
+ points.push(new THREE.Vector3(x, -size * 0.2, z));
169
+ points.push(new THREE.Vector3(x, size * 0.2, z));
170
+ }
171
+
172
+ return new THREE.BufferGeometry().setFromPoints(points);
173
+ }, [size]);
174
+
175
+ return (
176
+ <lineSegments>
177
+ <primitive object={linesGeometry} />
178
+ <lineBasicMaterial color="#8B6914" opacity={0.5} transparent />
179
+ </lineSegments>
180
+ );
181
+ }
182
+
183
+ // Pulsing activity indicator
184
+ function ActivityIndicator({ activity, size }: { activity: number; size: number }) {
185
+ const dotRef = useRef<THREE.Mesh>(null);
186
+
187
+ useFrame((state) => {
188
+ if (dotRef.current) {
189
+ const pulse = Math.sin(state.clock.elapsedTime * 4) * 0.5 + 0.5;
190
+ const scale = 0.8 + pulse * 0.4 + activity * 0.3;
191
+ dotRef.current.scale.setScalar(scale);
192
+
193
+ const material = dotRef.current.material as THREE.MeshBasicMaterial;
194
+ material.opacity = 0.6 + pulse * 0.4;
195
+ }
196
+ });
197
+
198
+ const isActive = activity > 0.1;
199
+
200
+ return (
201
+ <mesh ref={dotRef} position={[size * 0.35, size * 0.2, 0.2]}>
202
+ <circleGeometry args={[0.08, 16]} />
203
+ <meshBasicMaterial
204
+ color={isActive ? '#22c55e' : '#6b7280'}
205
+ transparent
206
+ opacity={0.8}
207
+ />
208
+ </mesh>
209
+ );
210
+ }