vesper-memory 0.3.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.
- package/.env.example +28 -0
- package/CHANGELOG.md +137 -0
- package/LICENSE +21 -0
- package/README.md +665 -0
- package/config/sqlite-schema.sql +413 -0
- package/dist/benchmark/index.d.ts +18 -0
- package/dist/benchmark/index.d.ts.map +1 -0
- package/dist/benchmark/index.js +19 -0
- package/dist/benchmark/index.js.map +1 -0
- package/dist/benchmark/metrics-collector.d.ts +90 -0
- package/dist/benchmark/metrics-collector.d.ts.map +1 -0
- package/dist/benchmark/metrics-collector.js +196 -0
- package/dist/benchmark/metrics-collector.js.map +1 -0
- package/dist/benchmark/report-generator.d.ts +35 -0
- package/dist/benchmark/report-generator.d.ts.map +1 -0
- package/dist/benchmark/report-generator.js +221 -0
- package/dist/benchmark/report-generator.js.map +1 -0
- package/dist/benchmark/runner.d.ts +30 -0
- package/dist/benchmark/runner.d.ts.map +1 -0
- package/dist/benchmark/runner.js +308 -0
- package/dist/benchmark/runner.js.map +1 -0
- package/dist/benchmark/scenarios/context-recall.d.ts +65 -0
- package/dist/benchmark/scenarios/context-recall.d.ts.map +1 -0
- package/dist/benchmark/scenarios/context-recall.js +180 -0
- package/dist/benchmark/scenarios/context-recall.js.map +1 -0
- package/dist/benchmark/scenarios/index.d.ts +34 -0
- package/dist/benchmark/scenarios/index.d.ts.map +1 -0
- package/dist/benchmark/scenarios/index.js +230 -0
- package/dist/benchmark/scenarios/index.js.map +1 -0
- package/dist/benchmark/statistics.d.ts +125 -0
- package/dist/benchmark/statistics.d.ts.map +1 -0
- package/dist/benchmark/statistics.js +520 -0
- package/dist/benchmark/statistics.js.map +1 -0
- package/dist/benchmark/types.d.ts +458 -0
- package/dist/benchmark/types.d.ts.map +1 -0
- package/dist/benchmark/types.js +297 -0
- package/dist/benchmark/types.js.map +1 -0
- package/dist/cli 2.js +583 -0
- package/dist/cli.d 2.ts +8 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts 2.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +583 -0
- package/dist/cli.js 2.map +1 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/rate-limits.d.ts +76 -0
- package/dist/config/rate-limits.d.ts.map +1 -0
- package/dist/config/rate-limits.js +161 -0
- package/dist/config/rate-limits.js.map +1 -0
- package/dist/config 2/rate-limits.d.ts +76 -0
- package/dist/config 2/rate-limits.d.ts.map +1 -0
- package/dist/config 2/rate-limits.js +161 -0
- package/dist/config 2/rate-limits.js.map +1 -0
- package/dist/consolidation/pipeline.d.ts +52 -0
- package/dist/consolidation/pipeline.d.ts.map +1 -0
- package/dist/consolidation/pipeline.js +193 -0
- package/dist/consolidation/pipeline.js.map +1 -0
- package/dist/consolidation 2/pipeline.d.ts +52 -0
- package/dist/consolidation 2/pipeline.d.ts.map +1 -0
- package/dist/consolidation 2/pipeline.js +193 -0
- package/dist/consolidation 2/pipeline.js.map +1 -0
- package/dist/embeddings/client.d.ts +95 -0
- package/dist/embeddings/client.d.ts.map +1 -0
- package/dist/embeddings/client.js +162 -0
- package/dist/embeddings/client.js.map +1 -0
- package/dist/embeddings 2/client.d.ts +94 -0
- package/dist/embeddings 2/client.d.ts.map +1 -0
- package/dist/embeddings 2/client.js +144 -0
- package/dist/embeddings 2/client.js.map +1 -0
- package/dist/memory-layers/semantic-memory.d.ts +76 -0
- package/dist/memory-layers/semantic-memory.d.ts.map +1 -0
- package/dist/memory-layers/semantic-memory.js +231 -0
- package/dist/memory-layers/semantic-memory.js.map +1 -0
- package/dist/memory-layers/skill-library.d.ts +25 -0
- package/dist/memory-layers/skill-library.d.ts.map +1 -0
- package/dist/memory-layers/skill-library.js +54 -0
- package/dist/memory-layers/skill-library.js.map +1 -0
- package/dist/memory-layers/working-memory.d.ts +57 -0
- package/dist/memory-layers/working-memory.d.ts.map +1 -0
- package/dist/memory-layers/working-memory.js +153 -0
- package/dist/memory-layers/working-memory.js.map +1 -0
- package/dist/memory-layers 2/semantic-memory.d.ts +33 -0
- package/dist/memory-layers 2/semantic-memory.d.ts.map +1 -0
- package/dist/memory-layers 2/semantic-memory.js +114 -0
- package/dist/memory-layers 2/semantic-memory.js.map +1 -0
- package/dist/memory-layers 2/skill-library.d.ts +25 -0
- package/dist/memory-layers 2/skill-library.d.ts.map +1 -0
- package/dist/memory-layers 2/skill-library.js +54 -0
- package/dist/memory-layers 2/skill-library.js.map +1 -0
- package/dist/memory-layers 2/working-memory.d.ts +57 -0
- package/dist/memory-layers 2/working-memory.d.ts.map +1 -0
- package/dist/memory-layers 2/working-memory.js +153 -0
- package/dist/memory-layers 2/working-memory.js.map +1 -0
- package/dist/middleware/auth.d.ts +287 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +610 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware 2/auth.d.ts +287 -0
- package/dist/middleware 2/auth.d.ts.map +1 -0
- package/dist/middleware 2/auth.js +610 -0
- package/dist/middleware 2/auth.js.map +1 -0
- package/dist/monitoring/health.d.ts +241 -0
- package/dist/monitoring/health.d.ts.map +1 -0
- package/dist/monitoring/health.js +649 -0
- package/dist/monitoring/health.js.map +1 -0
- package/dist/monitoring/metrics.d.ts +153 -0
- package/dist/monitoring/metrics.d.ts.map +1 -0
- package/dist/monitoring/metrics.js +349 -0
- package/dist/monitoring/metrics.js.map +1 -0
- package/dist/monitoring 2/health.d.ts +241 -0
- package/dist/monitoring 2/health.d.ts.map +1 -0
- package/dist/monitoring 2/health.js +649 -0
- package/dist/monitoring 2/health.js.map +1 -0
- package/dist/monitoring 2/metrics.d.ts +153 -0
- package/dist/monitoring 2/metrics.d.ts.map +1 -0
- package/dist/monitoring 2/metrics.js +349 -0
- package/dist/monitoring 2/metrics.js.map +1 -0
- package/dist/retrieval/hybrid-search.d.ts +186 -0
- package/dist/retrieval/hybrid-search.d.ts.map +1 -0
- package/dist/retrieval/hybrid-search.js +330 -0
- package/dist/retrieval/hybrid-search.js.map +1 -0
- package/dist/retrieval 2/hybrid-search.d.ts +186 -0
- package/dist/retrieval 2/hybrid-search.d.ts.map +1 -0
- package/dist/retrieval 2/hybrid-search.js +327 -0
- package/dist/retrieval 2/hybrid-search.js.map +1 -0
- package/dist/router/smart-router.d.ts +157 -0
- package/dist/router/smart-router.d.ts.map +1 -0
- package/dist/router/smart-router.js +524 -0
- package/dist/router/smart-router.js.map +1 -0
- package/dist/router 2/smart-router.d.ts +111 -0
- package/dist/router 2/smart-router.d.ts.map +1 -0
- package/dist/router 2/smart-router.js +383 -0
- package/dist/router 2/smart-router.js.map +1 -0
- package/dist/security/rate-limit-middleware.d.ts +119 -0
- package/dist/security/rate-limit-middleware.d.ts.map +1 -0
- package/dist/security/rate-limit-middleware.js +193 -0
- package/dist/security/rate-limit-middleware.js.map +1 -0
- package/dist/security 2/rate-limit-middleware.d.ts +119 -0
- package/dist/security 2/rate-limit-middleware.d.ts.map +1 -0
- package/dist/security 2/rate-limit-middleware.js +193 -0
- package/dist/security 2/rate-limit-middleware.js.map +1 -0
- package/dist/server 2.js +861 -0
- package/dist/server-wrapper 2.js +170 -0
- package/dist/server-wrapper.d 2.ts +12 -0
- package/dist/server-wrapper.d.ts +12 -0
- package/dist/server-wrapper.d.ts 2.map +1 -0
- package/dist/server-wrapper.d.ts.map +1 -0
- package/dist/server-wrapper.js +170 -0
- package/dist/server-wrapper.js 2.map +1 -0
- package/dist/server-wrapper.js.map +1 -0
- package/dist/server.d 2.ts +14 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.d.ts 2.map +1 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +656 -0
- package/dist/server.js 2.map +1 -0
- package/dist/server.js.map +1 -0
- package/dist/synthesis/conflict-detector.d.ts +43 -0
- package/dist/synthesis/conflict-detector.d.ts.map +1 -0
- package/dist/synthesis/conflict-detector.js +125 -0
- package/dist/synthesis/conflict-detector.js.map +1 -0
- package/dist/synthesis 2/conflict-detector.d.ts +43 -0
- package/dist/synthesis 2/conflict-detector.d.ts.map +1 -0
- package/dist/synthesis 2/conflict-detector.js +125 -0
- package/dist/synthesis 2/conflict-detector.js.map +1 -0
- package/dist/utils/monitoring.d.ts +25 -0
- package/dist/utils/monitoring.d.ts.map +1 -0
- package/dist/utils/monitoring.js +41 -0
- package/dist/utils/monitoring.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +97 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +166 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/validation.d.ts +139 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +195 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils 2/monitoring.d.ts +25 -0
- package/dist/utils 2/monitoring.d.ts.map +1 -0
- package/dist/utils 2/monitoring.js +41 -0
- package/dist/utils 2/monitoring.js.map +1 -0
- package/dist/utils 2/rate-limiter.d.ts +97 -0
- package/dist/utils 2/rate-limiter.d.ts.map +1 -0
- package/dist/utils 2/rate-limiter.js +166 -0
- package/dist/utils 2/rate-limiter.js.map +1 -0
- package/dist/utils 2/validation.d.ts +139 -0
- package/dist/utils 2/validation.d.ts.map +1 -0
- package/dist/utils 2/validation.js +195 -0
- package/dist/utils 2/validation.js.map +1 -0
- package/docker-compose.yml +65 -0
- package/embedding-service/Dockerfile +29 -0
- package/embedding-service/README.md +68 -0
- package/embedding-service/requirements.txt +6 -0
- package/embedding-service/server.py +110 -0
- package/package.json +92 -0
- package/scripts/FRESH_INSTALL.md +280 -0
- package/scripts/README.md +101 -0
- package/scripts/ensure-infrastructure.sh +38 -0
- package/scripts/fresh-install-auto.sh +96 -0
- package/scripts/fresh-install.sh +167 -0
- package/scripts/health-check.sh +72 -0
- package/scripts/init-qdrant.ts +201 -0
- package/scripts/postinstall.js +94 -0
- package/scripts/run-accuracy-benchmark.ts +1237 -0
- package/scripts/run-real-benchmark.ts +581 -0
- package/scripts/test-mcp-server.sh +38 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Memory System Scripts
|
|
2
|
+
|
|
3
|
+
This directory contains automation scripts for managing the Memory MCP server infrastructure.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
### `ensure-infrastructure.sh`
|
|
8
|
+
**Purpose**: Automatically starts Docker services (Redis, PostgreSQL, Qdrant) if they're not running.
|
|
9
|
+
|
|
10
|
+
**When it runs**:
|
|
11
|
+
- On every Claude Code session start (via SessionStart hook)
|
|
12
|
+
- Can be run manually anytime
|
|
13
|
+
|
|
14
|
+
**Usage**:
|
|
15
|
+
```bash
|
|
16
|
+
./scripts/ensure-infrastructure.sh
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### `health-check.sh`
|
|
20
|
+
**Purpose**: Comprehensive health check of all Memory system components.
|
|
21
|
+
|
|
22
|
+
**Usage**:
|
|
23
|
+
```bash
|
|
24
|
+
./scripts/health-check.sh
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Checks**:
|
|
28
|
+
- Docker daemon status
|
|
29
|
+
- Redis connectivity
|
|
30
|
+
- PostgreSQL connectivity
|
|
31
|
+
- Qdrant API responsiveness
|
|
32
|
+
- MCP server build artifacts
|
|
33
|
+
- MCP configuration
|
|
34
|
+
|
|
35
|
+
## Auto-Start Configuration
|
|
36
|
+
|
|
37
|
+
The Memory system is configured to start automatically when Claude Code launches:
|
|
38
|
+
|
|
39
|
+
1. **SessionStart Hook** (`~/.claude/settings.json`):
|
|
40
|
+
- Runs `ensure-infrastructure.sh` on every Claude Code session
|
|
41
|
+
- Ensures Docker services are running before MCP server starts
|
|
42
|
+
|
|
43
|
+
2. **MCP Server** (`~/.claude/mcp_config.json`):
|
|
44
|
+
- Claude Code automatically launches `dist/server.js` as a subprocess
|
|
45
|
+
- Server connects to running Docker infrastructure
|
|
46
|
+
|
|
47
|
+
3. **Optional: Boot-time Auto-Start** (`~/Library/LaunchAgents/com.memory.infrastructure.plist`):
|
|
48
|
+
- launchd service to start infrastructure on macOS login
|
|
49
|
+
- Currently created but not loaded (load with `launchctl load`)
|
|
50
|
+
|
|
51
|
+
## Manual Operations
|
|
52
|
+
|
|
53
|
+
### Start infrastructure
|
|
54
|
+
```bash
|
|
55
|
+
cd /Users/fitzy/Documents/MemoryProject
|
|
56
|
+
docker-compose up -d
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Stop infrastructure
|
|
60
|
+
```bash
|
|
61
|
+
docker-compose down
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### View logs
|
|
65
|
+
```bash
|
|
66
|
+
# All services
|
|
67
|
+
docker-compose logs -f
|
|
68
|
+
|
|
69
|
+
# Specific service
|
|
70
|
+
docker-compose logs -f redis
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Restart after changes
|
|
74
|
+
```bash
|
|
75
|
+
npm run build # Rebuild TypeScript
|
|
76
|
+
docker-compose restart # Restart services
|
|
77
|
+
# Then restart Claude Code to reconnect MCP server
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Troubleshooting
|
|
81
|
+
|
|
82
|
+
### MCP server not connecting
|
|
83
|
+
1. Run `./scripts/health-check.sh` to diagnose
|
|
84
|
+
2. Check `docker-compose ps` - all services should show "Up"
|
|
85
|
+
3. Verify build: `ls -la dist/server.js`
|
|
86
|
+
4. Check logs: `tail -f logs/infrastructure.log`
|
|
87
|
+
|
|
88
|
+
### Docker services won't start
|
|
89
|
+
1. Ensure Docker Desktop is running
|
|
90
|
+
2. Check ports 6379, 5432, 6333 are not in use:
|
|
91
|
+
```bash
|
|
92
|
+
lsof -i :6379 # Redis
|
|
93
|
+
lsof -i :5432 # PostgreSQL
|
|
94
|
+
lsof -i :6333 # Qdrant
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Changes to server.ts not taking effect
|
|
98
|
+
```bash
|
|
99
|
+
npm run build # Must rebuild TypeScript
|
|
100
|
+
# Restart Claude Code to reload MCP server
|
|
101
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Ensures Docker services are running for Memory MCP server
|
|
3
|
+
|
|
4
|
+
# Dynamically determine installation directory
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
7
|
+
cd "$PROJECT_DIR" || exit 1
|
|
8
|
+
|
|
9
|
+
# Check if Docker is running
|
|
10
|
+
if ! docker info >/dev/null 2>&1; then
|
|
11
|
+
echo "⚠️ Docker is not running. Please start Docker Desktop."
|
|
12
|
+
exit 0 # Exit gracefully - don't block Claude startup
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# Check if core services are healthy using docker ps directly
|
|
16
|
+
REDIS_HEALTHY=$(docker ps --filter "name=vesper-redis" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
17
|
+
QDRANT_HEALTHY=$(docker ps --filter "name=vesper-qdrant" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
18
|
+
EMBEDDING_HEALTHY=$(docker ps --filter "name=vesper-embedding" --filter "health=healthy" --format "{{.Names}}" | wc -l | tr -d ' ')
|
|
19
|
+
|
|
20
|
+
if [ "$REDIS_HEALTHY" = "0" ] || [ "$QDRANT_HEALTHY" = "0" ] || [ "$EMBEDDING_HEALTHY" = "0" ]; then
|
|
21
|
+
echo "🚀 Starting Memory infrastructure..."
|
|
22
|
+
# Use --no-recreate to avoid conflicts with existing containers
|
|
23
|
+
# Suppress bcrypt hash variable warnings from .env file
|
|
24
|
+
docker-compose up -d --no-recreate 2>&1 | grep -v "is not set. Defaulting" | grep -v "level=warning" || true
|
|
25
|
+
sleep 3 # Give services time to initialize
|
|
26
|
+
echo "✅ Memory infrastructure started"
|
|
27
|
+
else
|
|
28
|
+
echo "✅ Memory infrastructure already running"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Verify build artifacts exist
|
|
32
|
+
if [ ! -f "$PROJECT_DIR/dist/server.js" ]; then
|
|
33
|
+
echo "🔨 Building MCP server..."
|
|
34
|
+
npm run build
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo "✅ Memory system infrastructure ready"
|
|
38
|
+
exit 0
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Vesper Fresh Installation Script (Automated - No Prompts)
|
|
4
|
+
# For CI/CD or automated deployments
|
|
5
|
+
# WARNING: This will delete all data without confirmation
|
|
6
|
+
|
|
7
|
+
set -e # Exit on error
|
|
8
|
+
|
|
9
|
+
# Colors for output
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
|
17
|
+
echo -e "${BLUE}║ Vesper Fresh Installation (Automated) ║${NC}"
|
|
18
|
+
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
|
|
19
|
+
echo ""
|
|
20
|
+
|
|
21
|
+
# Step 1: Stop Docker
|
|
22
|
+
echo -e "${GREEN}[1/10]${NC} Stopping Docker containers..."
|
|
23
|
+
docker-compose down --remove-orphans 2>/dev/null || true
|
|
24
|
+
# Remove any orphaned vesper containers
|
|
25
|
+
docker ps -a | grep vesper | awk '{print $1}' | xargs -r docker rm -f 2>/dev/null || true
|
|
26
|
+
|
|
27
|
+
# Step 2: Remove volumes
|
|
28
|
+
echo -e "${GREEN}[2/10]${NC} Removing Docker volumes..."
|
|
29
|
+
docker volume ls --filter name=memoryproject 2>/dev/null | awk 'NR>1 {print $2}' | xargs -r docker volume rm 2>/dev/null || true
|
|
30
|
+
|
|
31
|
+
# Step 3: Remove networks
|
|
32
|
+
echo -e "${GREEN}[3/10]${NC} Removing Docker networks..."
|
|
33
|
+
docker network ls --filter name=memoryproject 2>/dev/null | awk 'NR>1 {print $2}' | xargs -r docker network rm 2>/dev/null || true
|
|
34
|
+
|
|
35
|
+
# Step 4: Remove Vesper images
|
|
36
|
+
echo -e "${GREEN}[4/10]${NC} Removing Vesper Docker images..."
|
|
37
|
+
docker images --filter reference="*vesper*" --filter reference="*memoryproject*" -q 2>/dev/null | xargs -r docker rmi -f 2>/dev/null || true
|
|
38
|
+
|
|
39
|
+
# Step 5: Remove node modules
|
|
40
|
+
echo -e "${GREEN}[5/10]${NC} Removing node_modules..."
|
|
41
|
+
rm -rf node_modules package-lock.json
|
|
42
|
+
|
|
43
|
+
# Step 6: Remove build artifacts
|
|
44
|
+
echo -e "${GREEN}[6/10]${NC} Removing build artifacts..."
|
|
45
|
+
rm -rf dist/ .cache/ .turbo/ coverage/
|
|
46
|
+
|
|
47
|
+
# Step 7: Clean data
|
|
48
|
+
echo -e "${GREEN}[7/10]${NC} Cleaning data directories..."
|
|
49
|
+
rm -rf data/ logs/ .redis-data/ .postgres-data/ .qdrant-data/
|
|
50
|
+
mkdir -p data logs
|
|
51
|
+
|
|
52
|
+
# Step 8: Clean certificates
|
|
53
|
+
echo -e "${GREEN}[8/10]${NC} Cleaning certificates..."
|
|
54
|
+
find config/ssl -type f ! -name "*.sh" -delete 2>/dev/null || true
|
|
55
|
+
|
|
56
|
+
# Step 9: Install
|
|
57
|
+
echo -e "${GREEN}[9/10]${NC} Installing dependencies..."
|
|
58
|
+
npm install
|
|
59
|
+
|
|
60
|
+
# Step 10: Build
|
|
61
|
+
echo -e "${GREEN}[10/10]${NC} Building project..."
|
|
62
|
+
npm run build
|
|
63
|
+
|
|
64
|
+
echo ""
|
|
65
|
+
echo -e "${GREEN}✓ Automated fresh installation complete!${NC}"
|
|
66
|
+
echo ""
|
|
67
|
+
|
|
68
|
+
# Auto-create .env if it doesn't exist
|
|
69
|
+
if [ ! -f .env ] && [ -f .env.example ]; then
|
|
70
|
+
cp .env.example .env
|
|
71
|
+
echo -e "${GREEN}✓ Created .env from .env.example${NC}"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Auto-generate development certificates if they don't exist
|
|
75
|
+
if [ ! -f config/ssl/server.crt ] && [ -f scripts/generate-dev-certs.sh ]; then
|
|
76
|
+
echo -e "${BLUE}Generating development certificates...${NC}"
|
|
77
|
+
./scripts/generate-dev-certs.sh
|
|
78
|
+
echo -e "${GREEN}✓ Development certificates generated${NC}"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Start services if AUTO_START=true
|
|
82
|
+
if [ "${AUTO_START}" = "true" ]; then
|
|
83
|
+
echo ""
|
|
84
|
+
echo -e "${BLUE}Starting Docker services...${NC}"
|
|
85
|
+
docker-compose up -d
|
|
86
|
+
echo -e "${GREEN}✓ Services started${NC}"
|
|
87
|
+
echo ""
|
|
88
|
+
echo -e "${YELLOW}Check status:${NC} make status"
|
|
89
|
+
else
|
|
90
|
+
echo ""
|
|
91
|
+
echo -e "${YELLOW}To start services:${NC} docker-compose up -d"
|
|
92
|
+
echo -e "${YELLOW}Or run with:${NC} AUTO_START=true npm run fresh-install:auto"
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo ""
|
|
96
|
+
echo -e "${GREEN}Vesper is ready! 🚀${NC}"
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Vesper Fresh Installation Script
|
|
4
|
+
# This script removes all previous installations and starts completely fresh
|
|
5
|
+
# WARNING: This will delete all data, containers, volumes, and build artifacts
|
|
6
|
+
|
|
7
|
+
set -e # Exit on error
|
|
8
|
+
|
|
9
|
+
# Colors for output
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Print banner
|
|
17
|
+
echo -e "${BLUE}"
|
|
18
|
+
echo "╔════════════════════════════════════════════════════════════╗"
|
|
19
|
+
echo "║ Vesper Memory System - Fresh Installation ║"
|
|
20
|
+
echo "║ Complete Cleanup ║"
|
|
21
|
+
echo "╚════════════════════════════════════════════════════════════╝"
|
|
22
|
+
echo -e "${NC}"
|
|
23
|
+
|
|
24
|
+
# Warning prompt
|
|
25
|
+
echo -e "${YELLOW}⚠️ WARNING: This script will:${NC}"
|
|
26
|
+
echo " • Stop and remove ALL Docker containers for Vesper"
|
|
27
|
+
echo " • Delete ALL Docker volumes (all data will be lost)"
|
|
28
|
+
echo " • Remove Docker networks"
|
|
29
|
+
echo " • Delete node_modules and package-lock.json"
|
|
30
|
+
echo " • Delete build artifacts (dist/)"
|
|
31
|
+
echo " • Delete all database files"
|
|
32
|
+
echo " • Delete all logs and temporary files"
|
|
33
|
+
echo ""
|
|
34
|
+
echo -e "${RED} ALL DATA WILL BE PERMANENTLY DELETED!${NC}"
|
|
35
|
+
echo ""
|
|
36
|
+
read -p "Are you sure you want to continue? (yes/no): " -r
|
|
37
|
+
echo
|
|
38
|
+
if [[ ! $REPLY =~ ^[Yy][Ee][Ss]$ ]]
|
|
39
|
+
then
|
|
40
|
+
echo -e "${YELLOW}Installation cancelled.${NC}"
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo ""
|
|
45
|
+
echo -e "${BLUE}Starting fresh installation...${NC}"
|
|
46
|
+
echo ""
|
|
47
|
+
|
|
48
|
+
# Step 1: Stop and remove Docker containers
|
|
49
|
+
echo -e "${GREEN}[1/10]${NC} Stopping Docker containers..."
|
|
50
|
+
if [ -f docker-compose.yml ]; then
|
|
51
|
+
docker-compose down --remove-orphans 2>/dev/null || true
|
|
52
|
+
fi
|
|
53
|
+
# Remove any orphaned vesper containers not in docker-compose
|
|
54
|
+
docker ps -a | grep vesper | awk '{print $1}' | xargs -r docker rm -f 2>/dev/null || true
|
|
55
|
+
echo " ✓ Docker containers stopped"
|
|
56
|
+
|
|
57
|
+
# Step 2: Remove Docker volumes
|
|
58
|
+
echo -e "${GREEN}[2/10]${NC} Removing Docker volumes..."
|
|
59
|
+
docker volume ls --filter name=memoryproject 2>/dev/null | awk 'NR>1 {print $2}' | xargs -r docker volume rm 2>/dev/null || true
|
|
60
|
+
echo " ✓ Docker volumes removed"
|
|
61
|
+
|
|
62
|
+
# Step 3: Remove Docker networks
|
|
63
|
+
echo -e "${GREEN}[3/10]${NC} Removing Docker networks..."
|
|
64
|
+
docker network ls --filter name=memoryproject 2>/dev/null | awk 'NR>1 {print $2}' | xargs -r docker network rm 2>/dev/null || true
|
|
65
|
+
echo " ✓ Docker networks removed"
|
|
66
|
+
|
|
67
|
+
# Step 4: Remove Vesper Docker images
|
|
68
|
+
echo -e "${GREEN}[4/10]${NC} Removing Vesper Docker images..."
|
|
69
|
+
docker images --filter reference="*vesper*" --filter reference="*memoryproject*" -q 2>/dev/null | xargs -r docker rmi -f 2>/dev/null || true
|
|
70
|
+
echo " ✓ Vesper images removed"
|
|
71
|
+
|
|
72
|
+
# Step 5: Remove node_modules and package-lock.json
|
|
73
|
+
echo -e "${GREEN}[5/10]${NC} Removing node_modules and lock files..."
|
|
74
|
+
rm -rf node_modules
|
|
75
|
+
rm -f package-lock.json
|
|
76
|
+
echo " ✓ Node dependencies removed"
|
|
77
|
+
|
|
78
|
+
# Step 6: Remove build artifacts
|
|
79
|
+
echo -e "${GREEN}[6/10]${NC} Removing build artifacts..."
|
|
80
|
+
rm -rf dist/
|
|
81
|
+
rm -rf .cache/
|
|
82
|
+
rm -rf .turbo/
|
|
83
|
+
rm -rf coverage/
|
|
84
|
+
echo " ✓ Build artifacts removed"
|
|
85
|
+
|
|
86
|
+
# Step 7: Remove data directories
|
|
87
|
+
echo -e "${GREEN}[7/10]${NC} Removing data directories..."
|
|
88
|
+
rm -rf data/
|
|
89
|
+
mkdir -p data
|
|
90
|
+
rm -rf logs/
|
|
91
|
+
mkdir -p logs
|
|
92
|
+
rm -rf .redis-data/
|
|
93
|
+
rm -rf .postgres-data/
|
|
94
|
+
rm -rf .qdrant-data/
|
|
95
|
+
echo " ✓ Data directories cleaned"
|
|
96
|
+
|
|
97
|
+
# Step 8: Remove certificate files (except scripts)
|
|
98
|
+
echo -e "${GREEN}[8/10]${NC} Cleaning certificate directories..."
|
|
99
|
+
find config/ssl -type f ! -name "*.sh" -delete 2>/dev/null || true
|
|
100
|
+
echo " ✓ Old certificates removed"
|
|
101
|
+
|
|
102
|
+
# Step 9: Fresh npm install
|
|
103
|
+
echo -e "${GREEN}[9/10]${NC} Installing dependencies (this may take a few minutes)..."
|
|
104
|
+
npm install
|
|
105
|
+
echo " ✓ Dependencies installed"
|
|
106
|
+
|
|
107
|
+
# Step 10: Build the project
|
|
108
|
+
echo -e "${GREEN}[10/10]${NC} Building project..."
|
|
109
|
+
npm run build
|
|
110
|
+
echo " ✓ Project built successfully"
|
|
111
|
+
|
|
112
|
+
echo ""
|
|
113
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
114
|
+
echo -e "${GREEN}✓ Fresh installation complete!${NC}"
|
|
115
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
116
|
+
echo ""
|
|
117
|
+
|
|
118
|
+
# Auto-create .env if it doesn't exist
|
|
119
|
+
if [ ! -f .env ]; then
|
|
120
|
+
echo -e "${YELLOW}⚠️ No .env file found${NC}"
|
|
121
|
+
if [ -f .env.example ]; then
|
|
122
|
+
cp .env.example .env
|
|
123
|
+
echo -e "${GREEN}✓ Created .env from .env.example${NC}"
|
|
124
|
+
else
|
|
125
|
+
echo -e "${RED}✗ .env.example not found${NC}"
|
|
126
|
+
fi
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# Auto-generate development certificates if they don't exist
|
|
130
|
+
if [ ! -f config/ssl/server.crt ] && [ -f scripts/generate-dev-certs.sh ]; then
|
|
131
|
+
echo ""
|
|
132
|
+
echo -e "${BLUE}Generating development certificates...${NC}"
|
|
133
|
+
./scripts/generate-dev-certs.sh
|
|
134
|
+
echo -e "${GREEN}✓ Development certificates generated${NC}"
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
echo ""
|
|
138
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
139
|
+
echo -e "${GREEN}✓ Installation complete!${NC}"
|
|
140
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════${NC}"
|
|
141
|
+
echo ""
|
|
142
|
+
|
|
143
|
+
# Ask if user wants to start services now
|
|
144
|
+
read -p "Would you like to start Docker services now? (yes/no): " -r
|
|
145
|
+
echo
|
|
146
|
+
if [[ $REPLY =~ ^[Yy][Ee][Ss]$ ]]; then
|
|
147
|
+
echo -e "${BLUE}Starting Docker services...${NC}"
|
|
148
|
+
docker-compose up -d
|
|
149
|
+
echo ""
|
|
150
|
+
echo -e "${GREEN}✓ Services started!${NC}"
|
|
151
|
+
echo ""
|
|
152
|
+
echo -e "${YELLOW}Check status with:${NC} ${BLUE}make status${NC}"
|
|
153
|
+
echo -e "${YELLOW}View logs with:${NC} ${BLUE}docker-compose logs -f${NC}"
|
|
154
|
+
else
|
|
155
|
+
echo ""
|
|
156
|
+
echo -e "${YELLOW}To start services later, run:${NC}"
|
|
157
|
+
echo -e " ${BLUE}docker-compose up -d${NC}"
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
echo ""
|
|
161
|
+
echo -e "${YELLOW}Optional next steps:${NC}"
|
|
162
|
+
echo -e " • Run tests: ${BLUE}npm test${NC}"
|
|
163
|
+
echo -e " • Generate API key: ${BLUE}npm run generate-api-key -- --tier unlimited --name 'Development'${NC}"
|
|
164
|
+
echo -e " • Edit .env: ${BLUE}nano .env${NC}"
|
|
165
|
+
echo ""
|
|
166
|
+
echo -e "${GREEN}Vesper is ready! 🚀${NC}"
|
|
167
|
+
echo ""
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Health check for Memory MCP server and dependencies
|
|
3
|
+
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
PROJECT_DIR="/Users/fitzy/Documents/MemoryProject"
|
|
7
|
+
|
|
8
|
+
echo "🔍 Memory System Health Check"
|
|
9
|
+
echo "=============================="
|
|
10
|
+
|
|
11
|
+
# Check Docker
|
|
12
|
+
if ! docker info >/dev/null 2>&1; then
|
|
13
|
+
echo "❌ Docker: Not running"
|
|
14
|
+
exit 1
|
|
15
|
+
else
|
|
16
|
+
echo "✅ Docker: Running"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Check Redis
|
|
20
|
+
if docker-compose -f "$PROJECT_DIR/docker-compose.yml" ps redis | grep -q "Up"; then
|
|
21
|
+
REDIS_PASSWORD="${REDIS_PASSWORD:-MHot0MIuDfST4QUY6g3WVbLzcDEzJ14B}"
|
|
22
|
+
if docker exec memory-redis redis-cli -a "$REDIS_PASSWORD" ping 2>/dev/null | grep -q "PONG"; then
|
|
23
|
+
echo "✅ Redis: Running and responsive"
|
|
24
|
+
else
|
|
25
|
+
echo "⚠️ Redis: Running but not responsive"
|
|
26
|
+
fi
|
|
27
|
+
else
|
|
28
|
+
echo "❌ Redis: Not running"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Check PostgreSQL
|
|
32
|
+
if docker-compose -f "$PROJECT_DIR/docker-compose.yml" ps postgres | grep -q "Up"; then
|
|
33
|
+
if docker exec memory-postgres pg_isready -U postgres 2>/dev/null | grep -q "accepting connections"; then
|
|
34
|
+
echo "✅ PostgreSQL: Running and responsive"
|
|
35
|
+
else
|
|
36
|
+
echo "⚠️ PostgreSQL: Running but not responsive"
|
|
37
|
+
fi
|
|
38
|
+
else
|
|
39
|
+
echo "❌ PostgreSQL: Not running"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Check Qdrant
|
|
43
|
+
if docker-compose -f "$PROJECT_DIR/docker-compose.yml" ps qdrant | grep -q "Up"; then
|
|
44
|
+
if curl -sf http://localhost:6333/healthz >/dev/null 2>&1; then
|
|
45
|
+
echo "✅ Qdrant: Running and responsive"
|
|
46
|
+
else
|
|
47
|
+
echo "⚠️ Qdrant: Running but not responsive"
|
|
48
|
+
fi
|
|
49
|
+
else
|
|
50
|
+
echo "❌ Qdrant: Not running"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Check build artifacts
|
|
54
|
+
if [ -f "$PROJECT_DIR/dist/server.js" ]; then
|
|
55
|
+
echo "✅ MCP Server: Build artifacts present"
|
|
56
|
+
else
|
|
57
|
+
echo "❌ MCP Server: Build artifacts missing (run: npm run build)"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Check MCP config
|
|
61
|
+
if [ -f "/Users/fitzy/.claude/mcp_config.json" ]; then
|
|
62
|
+
if grep -q "memory" "/Users/fitzy/.claude/mcp_config.json"; then
|
|
63
|
+
echo "✅ MCP Config: Memory server configured"
|
|
64
|
+
else
|
|
65
|
+
echo "⚠️ MCP Config: Memory server not configured"
|
|
66
|
+
fi
|
|
67
|
+
else
|
|
68
|
+
echo "❌ MCP Config: Not found"
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
echo ""
|
|
72
|
+
echo "📊 Memory System Status: Ready"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
#!/usr/bin/env npx ts-node --esm
|
|
2
|
+
/**
|
|
3
|
+
* Qdrant Collection Initialization Script
|
|
4
|
+
*
|
|
5
|
+
* Creates the memory-vectors collection with proper configuration:
|
|
6
|
+
* - 1024-dim dense vectors (BGE-large embedding dimension)
|
|
7
|
+
* - Cosine similarity distance metric
|
|
8
|
+
* - Payload indexing for metadata filtering
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* npm run init:qdrant
|
|
12
|
+
*
|
|
13
|
+
* Environment variables:
|
|
14
|
+
* QDRANT_URL - Qdrant server URL (default: http://localhost:6333)
|
|
15
|
+
* QDRANT_API_KEY - API key for authentication (required in production)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { QdrantClient } from "@qdrant/js-client-rest";
|
|
19
|
+
import { config } from "dotenv";
|
|
20
|
+
|
|
21
|
+
// Load environment variables
|
|
22
|
+
config();
|
|
23
|
+
|
|
24
|
+
// Configuration
|
|
25
|
+
const QDRANT_URL = process.env.QDRANT_URL || "http://localhost:6333";
|
|
26
|
+
const QDRANT_API_KEY = process.env.QDRANT_API_KEY;
|
|
27
|
+
const COLLECTION_NAME = "memory-vectors";
|
|
28
|
+
const VECTOR_SIZE = 1024; // BGE-large dimension
|
|
29
|
+
|
|
30
|
+
interface InitResult {
|
|
31
|
+
success: boolean;
|
|
32
|
+
message: string;
|
|
33
|
+
collectionName: string;
|
|
34
|
+
vectorSize: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Initialize Qdrant collection for memory storage
|
|
39
|
+
*/
|
|
40
|
+
async function initializeQdrant(): Promise<InitResult> {
|
|
41
|
+
console.log("Initializing Qdrant collection...");
|
|
42
|
+
console.log(` URL: ${QDRANT_URL}`);
|
|
43
|
+
console.log(` Collection: ${COLLECTION_NAME}`);
|
|
44
|
+
console.log(` Vector Size: ${VECTOR_SIZE}`);
|
|
45
|
+
console.log(` API Key: ${QDRANT_API_KEY ? "configured" : "not configured"}`);
|
|
46
|
+
|
|
47
|
+
// Create client with optional API key
|
|
48
|
+
const clientConfig: { url: string; apiKey?: string } = {
|
|
49
|
+
url: QDRANT_URL,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (QDRANT_API_KEY) {
|
|
53
|
+
clientConfig.apiKey = QDRANT_API_KEY;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const client = new QdrantClient(clientConfig);
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
// Check Qdrant health first
|
|
60
|
+
console.log("\nChecking Qdrant health...");
|
|
61
|
+
const response = await fetch(`${QDRANT_URL}/healthz`);
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
throw new Error(`Qdrant health check failed: ${response.status}`);
|
|
64
|
+
}
|
|
65
|
+
console.log(" Qdrant is healthy");
|
|
66
|
+
|
|
67
|
+
// Check if collection already exists
|
|
68
|
+
console.log("\nChecking existing collections...");
|
|
69
|
+
const collections = await client.getCollections();
|
|
70
|
+
const existingCollection = collections.collections.find(
|
|
71
|
+
(c) => c.name === COLLECTION_NAME
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
if (existingCollection) {
|
|
75
|
+
// Verify configuration matches
|
|
76
|
+
const info = await client.getCollection(COLLECTION_NAME);
|
|
77
|
+
const vectorConfig = info.config.params.vectors;
|
|
78
|
+
|
|
79
|
+
if ("size" in vectorConfig) {
|
|
80
|
+
if (vectorConfig.size !== VECTOR_SIZE) {
|
|
81
|
+
console.warn(
|
|
82
|
+
` WARNING: Existing collection has different vector size: ${vectorConfig.size}`
|
|
83
|
+
);
|
|
84
|
+
console.warn(
|
|
85
|
+
` Expected: ${VECTOR_SIZE}. You may need to recreate the collection.`
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
console.log(
|
|
89
|
+
` Collection '${COLLECTION_NAME}' already exists with correct configuration`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
message: `Collection '${COLLECTION_NAME}' already exists`,
|
|
97
|
+
collectionName: COLLECTION_NAME,
|
|
98
|
+
vectorSize: VECTOR_SIZE,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Create new collection
|
|
103
|
+
console.log(`\nCreating collection '${COLLECTION_NAME}'...`);
|
|
104
|
+
await client.createCollection(COLLECTION_NAME, {
|
|
105
|
+
vectors: {
|
|
106
|
+
size: VECTOR_SIZE,
|
|
107
|
+
distance: "Cosine",
|
|
108
|
+
},
|
|
109
|
+
// Optimize for memory retrieval workload
|
|
110
|
+
optimizers_config: {
|
|
111
|
+
default_segment_number: 2,
|
|
112
|
+
indexing_threshold: 10000,
|
|
113
|
+
},
|
|
114
|
+
// Enable write-ahead logging for durability
|
|
115
|
+
wal_config: {
|
|
116
|
+
wal_capacity_mb: 32,
|
|
117
|
+
wal_segments_ahead: 0,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
console.log(` Collection created successfully`);
|
|
122
|
+
|
|
123
|
+
// Create payload indexes for common query patterns
|
|
124
|
+
console.log("\nCreating payload indexes...");
|
|
125
|
+
|
|
126
|
+
// Index for filtering by timestamp
|
|
127
|
+
await client.createPayloadIndex(COLLECTION_NAME, {
|
|
128
|
+
wait: true, // Wait for index creation to complete
|
|
129
|
+
field_name: "timestamp",
|
|
130
|
+
field_schema: "datetime",
|
|
131
|
+
});
|
|
132
|
+
console.log(" Created index: timestamp (datetime)");
|
|
133
|
+
|
|
134
|
+
// Index for filtering by source
|
|
135
|
+
await client.createPayloadIndex(COLLECTION_NAME, {
|
|
136
|
+
wait: true, // Wait for index creation to complete
|
|
137
|
+
field_name: "source",
|
|
138
|
+
field_schema: "keyword",
|
|
139
|
+
});
|
|
140
|
+
console.log(" Created index: source (keyword)");
|
|
141
|
+
|
|
142
|
+
// Index for filtering by type
|
|
143
|
+
await client.createPayloadIndex(COLLECTION_NAME, {
|
|
144
|
+
wait: true, // Wait for index creation to complete
|
|
145
|
+
field_name: "type",
|
|
146
|
+
field_schema: "keyword",
|
|
147
|
+
});
|
|
148
|
+
console.log(" Created index: type (keyword)");
|
|
149
|
+
|
|
150
|
+
// Verify collection was created
|
|
151
|
+
const verifyInfo = await client.getCollection(COLLECTION_NAME);
|
|
152
|
+
console.log("\nCollection verification:");
|
|
153
|
+
console.log(` Status: ${verifyInfo.status}`);
|
|
154
|
+
console.log(` Points: ${verifyInfo.points_count}`);
|
|
155
|
+
console.log(` Indexed vectors: ${verifyInfo.indexed_vectors_count}`);
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
success: true,
|
|
159
|
+
message: `Collection '${COLLECTION_NAME}' created successfully`,
|
|
160
|
+
collectionName: COLLECTION_NAME,
|
|
161
|
+
vectorSize: VECTOR_SIZE,
|
|
162
|
+
};
|
|
163
|
+
} catch (error) {
|
|
164
|
+
const errorMessage =
|
|
165
|
+
error instanceof Error ? error.message : String(error);
|
|
166
|
+
console.error(`\nError initializing Qdrant: ${errorMessage}`);
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
message: `Failed to initialize: ${errorMessage}`,
|
|
171
|
+
collectionName: COLLECTION_NAME,
|
|
172
|
+
vectorSize: VECTOR_SIZE,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Run if executed directly
|
|
178
|
+
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
|
179
|
+
|
|
180
|
+
if (isMainModule) {
|
|
181
|
+
initializeQdrant()
|
|
182
|
+
.then((result) => {
|
|
183
|
+
console.log("\n" + "=".repeat(50));
|
|
184
|
+
if (result.success) {
|
|
185
|
+
console.log("Qdrant initialization completed successfully");
|
|
186
|
+
console.log(` Collection: ${result.collectionName}`);
|
|
187
|
+
console.log(` Vector size: ${result.vectorSize}`);
|
|
188
|
+
process.exit(0);
|
|
189
|
+
} else {
|
|
190
|
+
console.error("Qdrant initialization failed");
|
|
191
|
+
console.error(` Error: ${result.message}`);
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
.catch((error) => {
|
|
196
|
+
console.error("Unexpected error:", error);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export { initializeQdrant, InitResult };
|