overmind-mcp 3.2.3 → 3.2.4

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.
@@ -1,192 +1,426 @@
1
1
  #!/usr/bin/env bash
2
2
  # ============================================================
3
- # install-overmind-native.sh
4
- # Installation OverMind-MCP + Postgres-MCP mode NATIF (sans Docker)
5
- # Pour Ubuntu 26.04+ avec PostgreSQL 18 + pgvector + systemd
6
- # Idempotent : peut être ré-exécuté sans casser l'existant.
3
+ # install-overmind-native.sh — Installation NATIVE OverMind-MCP
4
+ # Multi-OS: Linux (apt/dnf/pacman) + macOS (Homebrew)
5
+ # Idempotent: peut être ré-exécuté sans casser l'existant.
6
+ # Anti-cassure: chaque step est gardé, erreurs non-fatales Continuent.
7
7
  # ============================================================
8
8
 
9
- set -euo pipefail
10
-
11
- # ---------- Couleurs ----------
12
- R='\033[0;31m'; G='\033[0;32m'; Y='\033[1;33m'; C='\033[0;36m'; N='\033[0m'
13
-
14
- log() { echo -e "${C}[$(date +%H:%M:%S)]${N} $*"; }
15
- ok() { echo -e "${G}[OK]${N} $*"; }
16
- warn() { echo -e "${Y}[WARN]${N} $*"; }
17
- die() { echo -e "${R}[FAIL]${N} $*"; exit 1; }
9
+ set -uo pipefail # PAS de set -e — on gère les erreurs manuellement
10
+
11
+ # ─── Couleurs + helpers ──────────────────────────────────────
12
+ R='\033[0;31m'; G='\033[0;32m'; Y='\033[1;33m'; C='\033[0;36m'; B='\033[1m'; D='\033[2m'; N='\033[0m'
13
+ STEPS_TOTAL=8
14
+ STEP=0
15
+
16
+ log() { echo -e "${C}[$(date +%H:%M:%S)]${N} ${D}$*${N}"; }
17
+ ok() { echo -e " ${G}✓${N} $*"; }
18
+ warn() { echo -e " ${Y}⚠${N} $*"; }
19
+ fail() { echo -e " ${R}✗${N} $*"; }
20
+ die() { echo -e "${R}[FATAL]${N} $*"; exit 1; }
21
+ step() { STEP=$((STEP+1)); echo; echo -e "${B}${C}━━━ STEP $STEP/$STEPS_TOTAL — $* ━━━${N}"; }
22
+ have() { command -v "$1" >/dev/null 2>&1; }
23
+
24
+ # ─── Détection OS ────────────────────────────────────────────
25
+ OS="$(uname -s)"
26
+ ARCH="$(uname -m)"
27
+ case "$OS" in
28
+ Darwin) OS_NAME="macOS $ARCH";;
29
+ Linux) OS_NAME="Linux $ARCH";;
30
+ *) OS_NAME="$OS $ARCH";;
31
+ esac
32
+ echo
33
+ echo -e "${B}${C}╔════════════════════════════════════════════════════════════╗${N}"
34
+ echo -e "${B}${C}║ 🚀 OverMind-MCP — Installation NATIVE ║${N}"
35
+ echo -e "${B}${C}║ Multi-OS: $OS_NAME$(printf '%*s' $((24-${#OS_NAME})) '')║${N}"
36
+ echo -e "${B}${C}╚════════════════════════════════════════════════════════════╝${N}"
37
+ echo
18
38
 
19
- # ---------- Constantes ----------
39
+ # ─── Détection utilisateur + home ────────────────────────────
20
40
  OM_USER="${SUDO_USER:-$(whoami)}"
21
- # Multi-OS home resolution (Linux: getent, macOS: dscl, fallback: eval ~)
22
- if command -v getent >/dev/null 2>&1; then
41
+ if have getent; then
23
42
  OM_HOME="$(getent passwd "$OM_USER" | cut -d: -f6)"
24
- elif command -v dscl >/dev/null 2>&1; then
43
+ elif have dscl; then
25
44
  OM_HOME="$(dscl . -read "/Users/$OM_USER" NFSHomeDirectory | awk '{print $2}')"
26
45
  else
27
46
  OM_HOME="$(eval echo "~$OM_USER")"
28
47
  fi
29
48
  OM_DIR="$OM_HOME/.overmind"
30
49
  LOG_DIR="$OM_DIR/logs"
50
+
51
+ # ─── Constantes ──────────────────────────────────────────────
31
52
  PG_DB="overmind_memory"
32
53
  PG_PORT=5432
33
54
  MCP_PORT_CORE=3099
34
55
  MCP_PORT_PG=5433
56
+ ERRORS=0
57
+ WARNINGS=0
58
+
59
+ track_error() { fail "$*"; ERRORS=$((ERRORS+1)); }
60
+ track_warn() { warn "$*"; WARNINGS=$((WARNINGS+1)); }
61
+
62
+ # ================================================================
63
+ # STEP 1/8 — Vérifications préalables (root, OS, arch)
64
+ # ================================================================
65
+ step "Vérifications préalables"
66
+
67
+ # Vérifier root/sudo
68
+ if [ "$(id -u)" -ne 0 ]; then
69
+ echo -e " ${Y}ℹ${N} Lancement en mode non-root — sudo requis pour certaines étapes"
70
+ if ! have sudo; then
71
+ die "sudo non disponible. Lancez en root: sudo $0"
72
+ fi
73
+ SUDO="sudo"
74
+ else
75
+ SUDO=""
76
+ fi
77
+ ok "Privilèges: OK (${OM_USER})"
35
78
 
36
- [ "$(id -u)" -ne 0 ] && die "Lancer avec sudo : sudo $0"
37
- [ -z "$OM_USER" ] || [ -z "$OM_HOME" ] && die "Impossible de déterminer l'utilisateur"
79
+ # Vérifier OS supporté
80
+ if [ "$OS" != "Darwin" ] && [ "$OS" != "Linux" ]; then
81
+ die "OS non supporté: $OS. Utilisez le mode Docker: npm i -g overmind-mcp && overmind-postgres-mcp up"
82
+ fi
83
+ ok "OS: $OS_NAME"
84
+
85
+ # ================================================================
86
+ # STEP 2/8 — Node.js + npm
87
+ # ================================================================
88
+ step "Node.js + npm"
89
+
90
+ if ! have node; then
91
+ fail "Node.js non trouvé"
92
+ log "Installation automatique de Node.js LTS..."
93
+ if [ "$OS" = "Darwin" ]; then
94
+ if have brew; then
95
+ brew install node@24 || track_error "brew install node@24 a échoué"
96
+ else
97
+ track_error "Homebrew manquant. Installez Node: https://nodejs.org/"
98
+ fi
99
+ else
100
+ if have curl; then
101
+ curl -fsSL https://deb.nodesource.com/setup_lts.x | $SUDO -E bash - 2>/dev/null || true
102
+ $SUDO apt install -y nodejs 2>/dev/null || track_error "apt install nodejs a échoué"
103
+ else
104
+ track_error "curl manquant pour installer Node.js"
105
+ fi
106
+ fi
107
+ fi
38
108
 
39
- log "Installation pour user=$OM_USER home=$OM_HOME"
109
+ if have node; then
110
+ NODE_VER="$(node -v)"
111
+ NODE_MAJ="${NODE_VER#v}"
112
+ NODE_MAJ="${NODE_MAJ%%.*}"
113
+ ok "Node.js: ${NODE_VER}"
114
+ if [ "$NODE_MAJ" -lt 20 ]; then
115
+ track_error "Node >= 20 requis (vous avez ${NODE_VER})"
116
+ elif [ "$NODE_MAJ" -ge 25 ]; then
117
+ track_warn "Node ${NODE_VER} — overmind-postgres-mcp préfère Node 24"
118
+ if [ -d "$OM_HOME/.nvm" ]; then
119
+ log "Bascule nvm → Node 24..."
120
+ \. "$OM_HOME/.nvm/nvm.sh" 2>/dev/null || true
121
+ nvm install 24 2>/dev/null && nvm use 24 2>/dev/null && hash -r || true
122
+ ok "Node $(node -v) actif via nvm"
123
+ fi
124
+ fi
125
+ else
126
+ die "Node.js toujours manquant après tentative d'installation"
127
+ fi
40
128
 
41
- # ============================================================
42
- # STEP 1/6 — Vérification Node.js + npm
43
- # ============================================================
44
- log "STEP 1/6 : Node.js"
45
- command -v node >/dev/null || die "Node.js manquant : curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt install -y nodejs"
46
- NODE_MAJ=$(node -p "process.versions.node.split('.')[0]")
47
- [ "$NODE_MAJ" -ge 20 ] || die "Node >= 20 requis (vous avez $(node -v))"
48
- ok "Node $(node -v) / npm $(npm -v)"
129
+ if have npm; then
130
+ ok "npm: $(npm -v)"
131
+ else
132
+ die "npm non trouvé"
133
+ fi
49
134
 
50
- # ============================================================
51
- # STEP 2/6 — PostgreSQL + pgvector (multi-OS)
52
- # ============================================================
53
- log "STEP 2/6 : PostgreSQL + pgvector"
135
+ # ================================================================
136
+ # STEP 3/8 — PostgreSQL + pgvector
137
+ # ================================================================
138
+ step "PostgreSQL + pgvector"
54
139
 
55
- OS_TYPE="$(uname -s)"
140
+ PG_INSTALLED=false
141
+ PG_SUPERUSER="postgres"
56
142
 
57
- if [ "$OS_TYPE" = "Darwin" ]; then
58
- # ─── macOS (Homebrew) ───────────────────────────────────────────────
59
- if ! command -v brew >/dev/null 2>&1; then
60
- die "Homebrew non trouvé. Installez-le: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
61
- fi
62
- if ! brew list postgresql@18 >/dev/null 2>&1; then
63
- log "Installation postgresql@18 via brew..."
64
- brew install postgresql@18
143
+ if [ "$OS" = "Darwin" ]; then
144
+ # ─── macOS: Homebrew ─────────────────────────────────────────
145
+ PG_SUPERUSER="$(whoami)"
146
+
147
+ if ! have brew; then
148
+ track_warn "Homebrew non trouvé installez: https://brew.sh"
149
+ track_warn "Bypass: installez Docker et utilisez overmind-postgres-mcp up"
150
+ else
151
+ # PostgreSQL
152
+ if brew list postgresql@18 >/dev/null 2>&1; then
153
+ ok "postgresql@18 déjà installé"
154
+ else
155
+ log "Installation postgresql@18 via brew..."
156
+ brew install postgresql@18 2>/dev/null || {
157
+ track_warn "postgresql@18 non disponible, fallback postgresql@16"
158
+ brew install postgresql@16 2>/dev/null || track_error "brew install postgresql a échoué"
159
+ }
65
160
  fi
66
- if ! brew list pgvector >/dev/null 2>&1; then
67
- log "Installation pgvector via brew..."
68
- brew install pgvector
161
+
162
+ # pgvector
163
+ if brew list pgvector >/dev/null 2>&1; then
164
+ ok "pgvector déjà installé"
165
+ else
166
+ log "Installation pgvector via brew..."
167
+ brew install pgvector 2>/dev/null || track_warn "pgvector non disponible via brew — installez manuellement"
69
168
  fi
169
+
70
170
  # Démarrer le service
71
- brew services start postgresql@18 2>/dev/null || true
171
+ brew services start postgresql@18 2>/dev/null || brew services start postgresql@16 2>/dev/null || true
72
172
  sleep 3
73
- ok "postgresql@18 + pgvector installés via brew"
74
-
75
- elif [ "$OS_TYPE" = "Linux" ]; then
76
- # ─── Linux (apt / yum / pacman) ────────────────────────────────────
77
- if command -v apt >/dev/null 2>&1; then
78
- if ! dpkg -l postgresql-18-pgvector 2>/dev/null | grep -q '^ii'; then
79
- log "Installation postgresql-18-pgvector via apt..."
80
- apt update -qq
81
- DEBIAN_FRONTEND=noninteractive apt install -y postgresql-18-pgvector postgresql-client-18
82
- fi
83
- elif command -v yum >/dev/null 2>&1; then
84
- log "Installation postgresql + pgvector via yum..."
85
- yum install -y postgresql-server postgresql-contrib pgvector
86
- postgresql-setup --initdb 2>/dev/null || true
87
- elif command -v pacman >/dev/null 2>&1; then
88
- log "Installation postgresql + pgvector via pacman..."
89
- pacman -S --noconfirm postgresql pgvector
90
- su - postgres -c "initdb -D /var/lib/postgres/data" 2>/dev/null || true
173
+ PG_INSTALLED=true
174
+ ok "Service PostgreSQL démarré via brew"
175
+ fi
176
+
177
+ elif [ "$OS" = "Linux" ]; then
178
+ # ─── Linux: apt / dnf / pacman ──────────────────────────────
179
+ if have apt; then
180
+ log "Gestionnaire: apt (Debian/Ubuntu)"
181
+ $SUDO apt update -qq 2>/dev/null || true
182
+ if dpkg -l 2>/dev/null | grep -q 'postgresql.*18.*pgvector'; then
183
+ ok "postgresql-18-pgvector déjà installé"
184
+ PG_INSTALLED=true
91
185
  else
92
- die "Gestionnaire de paquets non supporté. Installez PostgreSQL + pgvector manuellement."
186
+ log "Installation postgresql + pgvector..."
187
+ DEBIAN_FRONTEND=noninteractive $SUDO apt install -y postgresql postgresql-contrib 2>/dev/null || track_error "apt install postgresql"
188
+ # pgvector (peut nécessiter un PPA)
189
+ DEBIAN_FRONTEND=noninteractive $SUDO apt install -y postgresql-18-pgvector 2>/dev/null || {
190
+ track_warn "postgresql-18-pgvector non disponible via apt"
191
+ log "Tentative compilation pgvector depuis source..."
192
+ $SUDO apt install -y build-essential postgresql-server-dev-all git 2>/dev/null || true
193
+ (
194
+ cd /tmp && git clone --depth 1 https://github.com/pgvector/pgvector.git 2>/dev/null && \
195
+ cd pgvector && make 2>/dev/null && $SUDO make install 2>/dev/null
196
+ ) || track_warn "Compilation pgvector échouée — voir docs"
197
+ }
198
+ PG_INSTALLED=true
93
199
  fi
94
200
 
95
- # Service systemd
96
- if command -v systemctl >/dev/null 2>&1; then
97
- if ! systemctl is-active --quiet postgresql; then
98
- systemctl enable --now postgresql
99
- fi
100
- ok "postgresql.service: $(systemctl is-active postgresql)"
201
+ elif have dnf; then
202
+ log "Gestionnaire: dnf (Fedora/RHEL)"
203
+ $SUDO dnf install -y postgresql-server postgresql-contrib 2>/dev/null || track_error "dnf install postgresql"
204
+ $SUDO postgresql-setup --initdb 2>/dev/null || true
205
+ PG_INSTALLED=true
206
+ # pgvector
207
+ $SUDO dnf install -y pgvector 2>/dev/null || track_warn "pgvector non disponible via dnf"
208
+
209
+ elif have pacman; then
210
+ log "Gestionnaire: pacman (Arch)"
211
+ $SUDO pacman -S --noconfirm postgresql 2>/dev/null || track_error "pacman install postgresql"
212
+ $SUDO pacman -S --noconfirm pgvector 2>/dev/null || track_warn "pgvector non disponible via pacman"
213
+ $SUDO su - postgres -c "initdb -D /var/lib/postgres/data" 2>/dev/null || true
214
+ PG_INSTALLED=true
215
+
216
+ elif have apk; then
217
+ log "Gestionnaire: apk (Alpine)"
218
+ $SUDO apk add postgresql postgresql-contrib 2>/dev/null || track_error "apk install postgresql"
219
+ PG_INSTALLED=true
220
+
221
+ else
222
+ track_error "Gestionnaire de paquets non supporté. Installez PostgreSQL manuellement."
223
+ fi
224
+
225
+ # Service systemd
226
+ if have systemctl; then
227
+ if ! $SUDO systemctl is-active --quiet postgresql 2>/dev/null; then
228
+ log "Démarrage postgresql.service..."
229
+ $SUDO systemctl enable --now postgresql 2>/dev/null || track_warn "systemctl start postgresql"
230
+ sleep 2
101
231
  fi
232
+ ok "postgresql.service: $($SUDO systemctl is-active postgresql 2>/dev/null || echo '?')"
233
+ fi
102
234
  fi
103
235
 
104
- # DB + extension vector (multi-OS)
105
- PG_SUPERUSER="postgres"
106
- if [ "$OS_TYPE" = "Darwin" ]; then
107
- PG_SUPERUSER="$(whoami)"
108
- fi
236
+ # ================================================================
237
+ # STEP 4/8 — Base de données + extension pgvector
238
+ # ================================================================
239
+ step "Base de données + pgvector"
109
240
 
110
- if ! psql -U "$PG_SUPERUSER" -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
241
+ if [ "$PG_INSTALLED" = "true" ]; then
242
+ sleep 2 # Laisser PG démarrer
243
+
244
+ # Créer la DB si elle n'existe pas
245
+ DB_EXISTS=false
246
+ if [ "$OS" = "Darwin" ]; then
247
+ if psql -U "$PG_SUPERUSER" -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
248
+ DB_EXISTS=true
249
+ fi
250
+ else
251
+ if $SUDO -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
252
+ DB_EXISTS=true
253
+ fi
254
+ fi
255
+
256
+ if [ "$DB_EXISTS" = "false" ]; then
111
257
  log "Création DB $PG_DB..."
112
- createdb -U "$PG_SUPERUSER" "$PG_DB" 2>/dev/null || sudo -u postgres createdb "$PG_DB"
258
+ if [ "$OS" = "Darwin" ]; then
259
+ createdb -U "$PG_SUPERUSER" "$PG_DB" 2>/dev/null || track_warn "createdb échoué"
260
+ else
261
+ $SUDO -u postgres createdb "$PG_DB" 2>/dev/null || track_warn "createdb échoué"
262
+ fi
263
+ else
264
+ ok "DB $PG_DB existe déjà"
265
+ fi
266
+
267
+ # Activer pgvector
268
+ if [ "$OS" = "Darwin" ]; then
269
+ psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || track_warn "CREATE EXTENSION vector échoué"
270
+ PGV="$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo '?')"
271
+ else
272
+ $SUDO -u postgres psql -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || track_warn "CREATE EXTENSION vector échoué"
273
+ PGV="$($SUDO -u postgres psql -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo '?')"
274
+ fi
275
+
276
+ if [ "$PGV" != "?" ]; then
277
+ ok "pgvector v${PGV} activé sur $PG_DB"
278
+ else
279
+ track_warn "pgvector non détecté — extension vector peut nécessiter une installation manuelle"
280
+ fi
281
+
282
+ # Tester la connexion
283
+ if [ "$OS" = "Darwin" ]; then
284
+ if psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
285
+ ok "Connexion PostgreSQL: OK (user=$PG_SUPERUSER)"
286
+ else
287
+ track_warn "Connexion PostgreSQL échouée en local"
288
+ fi
289
+ else
290
+ if $SUDO -u postgres psql -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
291
+ ok "Connexion PostgreSQL: OK (user=postgres)"
292
+ else
293
+ track_warn "Connexion PostgreSQL échouée"
294
+ fi
295
+ fi
296
+ else
297
+ track_warn "PostgreSQL non installé — utilisez Docker: overmind-postgres-mcp up"
113
298
  fi
114
- psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || sudo -u postgres psql -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null
115
- PGV=$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo "?")
116
- ok "DB $PG_DB prête, pgvector v$PGV"
117
299
 
118
- # ============================================================
119
- # STEP 3/6 — Packages npm globaux
120
- # ============================================================
121
- log "STEP 3/6 : npm install -g"
122
- if ! npm list -g overmind-mcp >/dev/null 2>&1; then
123
- npm install -g overmind-mcp@latest
300
+ # ================================================================
301
+ # STEP 5/8 — Packages npm globaux
302
+ # ================================================================
303
+ step "Packages npm globaux"
304
+
305
+ log "Vérification overmind-mcp..."
306
+ if npm list -g overmind-mcp >/dev/null 2>&1; then
307
+ ok "overmind-mcp: $(npm list -g overmind-mcp --depth=0 2>/dev/null | grep overmind-mcp | head -1 | awk -F@ '{print $NF}')"
308
+ else
309
+ log "Installation overmind-mcp..."
310
+ $SUDO npm install -g overmind-mcp@latest 2>/dev/null || npm install -g overmind-mcp@latest 2>/dev/null || track_error "npm install overmind-mcp"
124
311
  fi
125
- if ! npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
126
- npm install -g overmind-postgres-mcp@latest
312
+
313
+ log "Vérification overmind-postgres-mcp..."
314
+ if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
315
+ ok "overmind-postgres-mcp: installé"
316
+ else
317
+ log "Installation overmind-postgres-mcp..."
318
+ $SUDO npm install -g overmind-postgres-mcp@latest 2>/dev/null || npm install -g overmind-postgres-mcp@latest 2>/dev/null || track_warn "overmind-postgres-mcp (non bloquant)"
127
319
  fi
128
- ok "overmind-mcp $(npm list -g overmind-mcp --depth=0 | awk '/overmind-mcp@/ {print $2}')"
129
- ok "overmind-postgres-mcp $(npm list -g overmind-postgres-mcp --depth=0 | awk '/overmind-postgres-mcp@/ {print $2}')"
130
320
 
131
- # ============================================================
132
- # STEP 4/6 — Arborescence + .env
133
- # ============================================================
134
- log "STEP 4/6 : ~/.overmind/"
135
- mkdir -p "$OM_DIR/logs" "$OM_DIR/config"
136
- chown -R "$OM_USER:$OM_USER" "$OM_DIR"
321
+ ok "Packages npm globaux: vérifiés"
322
+
323
+ # ================================================================
324
+ # STEP 6/8 Arborescence ~/.overmind/ + .env
325
+ # ================================================================
326
+ step "Arborescence ~/.overmind/"
137
327
 
138
- if [ ! -f "$OM_DIR/.env" ]; then
139
- log "Création $OM_DIR/.env (template à compléter)..."
140
- cat > "$OM_DIR/.env" <<'EOF'
141
- # OverMind - Configuration principale (mode natif sans Docker)
328
+ mkdir -p "$OM_DIR/logs" "$OM_DIR/config" "$OM_DIR/bridge/wrappers" 2>/dev/null || true
329
+ ok "Dossiers créés: $OM_DIR"
142
330
 
143
- # --- PostgreSQL (apt postgresql-18 + pgvector) ---
331
+ # .env
332
+ ENV_FILE="$OM_DIR/.env"
333
+ ENV_PASSWORD=""
334
+ if [ ! -f "$ENV_FILE" ]; then
335
+ log "Création .env avec password aléatoire..."
336
+ ENV_PASSWORD="$(openssl rand -base64 24 | tr -d '/+=' | head -c 24 2>/dev/null || echo 'overmind_temp_'$RANDOM)"
337
+ cat > "$ENV_FILE" <<ENVEOF
338
+ # OverMind-MCP — Configuration (mode natif)
339
+ # Généré le $(date)
340
+
341
+ # ─── PostgreSQL ───
144
342
  POSTGRES_HOST=127.0.0.1
145
- POSTGRES_PORT=5432
146
- POSTGRES_USER=postgres
147
- POSTGRES_PASSWORD=CHANGEME_PG_PASS
148
- POSTGRES_DATABASE=overmind_memory
343
+ POSTGRES_PORT=${PG_PORT}
344
+ POSTGRES_USER=${PG_SUPERUSER}
345
+ POSTGRES_PASSWORD=${ENV_PASSWORD}
346
+ POSTGRES_DATABASE=${PG_DB}
149
347
  POSTGRES_SSL=false
150
- POSTGRES_MAX_CONNECTIONS=10
151
-
152
- # --- Provider LLM par défaut ---
153
- OVERMIND_DEFAULT_PROVIDER=anthropic
154
348
 
155
- # --- Core ---
349
+ # ─── OverMind Core ───
350
+ OVERMIND_WORKSPACE=${OM_DIR}
156
351
  OVERMIND_MEMORY_TYPE=postgres
157
- MEMORY_HTTP_PORT=3099
352
+ OVERMIND_LOG_LEVEL=info
353
+
354
+ # ─── Ports MCP ───
355
+ MEMORY_HTTP_PORT=${MCP_PORT_CORE}
158
356
  OVERMIND_HTTP_MODE=false
159
- OVERMIND_HTTP_PORT=3099
357
+ OVERMIND_HTTP_PORT=${MCP_PORT_CORE}
160
358
 
161
- # --- Embeddings (Qwen 8B, 4096D) ---
359
+ # ─── Embeddings (Qwen 8B, 4096D) ───
162
360
  OVERMIND_EMBEDDING_DIMENSIONS=4096
163
361
  OVERMIND_EMBEDDING_MODEL=qwen/qwen3-embedding-8b
164
- OVERMIND_EMBEDDING_URL=https://openrouter.ai/api/v1
362
+ # OVERMIND_EMBEDDING_URL=https://openrouter.ai/api/v1
165
363
  # OVERMIND_EMBEDDING_KEY=sk-or-...
166
364
 
167
- # --- Clés LLM (à remplir) ---
365
+ # ─── Clés LLM (à remplir) ───
168
366
  # ANTHROPIC_AUTH_TOKEN=...
169
367
  # ANTHROPIC_BASE_URL=https://api.anthropic.com
170
368
  # ANTHROPIC_MODEL=claude-sonnet-4-6
171
- # MISTRAL_API_KEY=...
172
- # GLM_API_KEY=...
173
- # ELEVENLABS_API_KEY=...
174
- EOF
175
- chown "$OM_USER:$OM_USER" "$OM_DIR/.env"
176
- chmod 600 "$OM_DIR/.env"
177
- warn "Éditer $OM_DIR/.env et remplir POSTGRES_PASSWORD + clés LLM"
369
+ ENVEOF
370
+ chmod 600 "$ENV_FILE" 2>/dev/null || true
371
+ ok ".env créé avec password aléatoire"
372
+ warn "⚠️ POSTGRES_PASSWORD stocké dans $ENV_FILE"
178
373
  else
179
- ok ".env existant conservé"
374
+ ok ".env existant conservé"
375
+ ENV_PASSWORD="$(grep '^POSTGRES_PASSWORD=' "$ENV_FILE" | cut -d= -f2-)"
376
+ if [ -z "$ENV_PASSWORD" ] || echo "$ENV_PASSWORD" | grep -qi 'change'; then
377
+ track_warn "POSTGRES_PASSWORD vide ou 'change_me' dans .env"
378
+ fi
180
379
  fi
181
380
 
182
- # ============================================================
183
- # STEP 5/6 — Systemd units
184
- # ============================================================
185
- log "STEP 5/6 : systemd units"
381
+ # .mcp.json (minimal si absent)
382
+ MCP_FILE="$OM_DIR/.mcp.json"
383
+ if [ ! -f "$MCP_FILE" ]; then
384
+ log "Création .mcp.json..."
385
+ cat > "$MCP_FILE" <<MCPEOF
386
+ {
387
+ "mcpServers": {
388
+ "memory": {
389
+ "transport": "httpStream",
390
+ "url": "http://localhost:${MCP_PORT_CORE}/mcp"
391
+ },
392
+ "postgres": {
393
+ "transport": "httpStream",
394
+ "url": "http://localhost:${MCP_PORT_PG}/mcp"
395
+ }
396
+ }
397
+ }
398
+ MCPEOF
399
+ ok ".mcp.json créé"
400
+ else
401
+ ok ".mcp.json existant"
402
+ fi
403
+
404
+ # Permissions
405
+ if [ "$OS" = "Darwin" ]; then
406
+ chown -R "$OM_USER:staff" "$OM_DIR" 2>/dev/null || true
407
+ else
408
+ chown -R "$OM_USER:$OM_USER" "$OM_DIR" 2>/dev/null || true
409
+ fi
410
+
411
+ # ================================================================
412
+ # STEP 7/8 — Services système (systemd / launchd)
413
+ # ================================================================
414
+ step "Services système"
415
+
416
+ if [ "$OS" = "Linux" ] && have systemctl; then
417
+ # ─── Linux: systemd units ───────────────────────────────────
418
+ NODE_BIN="$(which node)"
419
+ NPM_GLOBAL="$(npm root -g 2>/dev/null || echo /usr/lib/node_modules)"
186
420
 
187
- write_unit() {
188
- local name="$1" port="$2" entry="$3"
189
- cat > "/etc/systemd/system/$name" <<EOF
421
+ write_unit() {
422
+ local name="$1" entry="$2"
423
+ cat > "/etc/systemd/system/$name" <<UNIT
190
424
  [Unit]
191
425
  Description=$name (OverMind)
192
426
  After=network-online.target postgresql.service
@@ -199,71 +433,147 @@ User=$OM_USER
199
433
  Group=$OM_USER
200
434
  WorkingDirectory=$OM_DIR
201
435
  EnvironmentFile=$OM_DIR/.env
202
- ExecStart=/usr/bin/node --max-old-space-size=256 --no-warnings $entry
436
+ ExecStart=$NODE_BIN --max-old-space-size=256 --no-warnings $entry
203
437
  Restart=on-failure
204
438
  RestartSec=5
205
- StandardOutput=append:$LOG_DIR/$name.log
206
- StandardError=append:$LOG_DIR/$name.err
439
+ StandardOutput=append:$LOG_DIR/${name%.service}.log
440
+ StandardError=append:$LOG_DIR/${name%.service}.err
207
441
 
208
442
  [Install]
209
443
  WantedBy=multi-user.target
210
- EOF
211
- }
212
-
213
- write_unit "overmind-mcp.service" "$MCP_PORT_CORE" \
214
- "/usr/lib/node_modules/overmind-mcp/dist/bin/cli.js --transport httpStream --port $MCP_PORT_CORE"
444
+ UNIT
445
+ ok "Unit $name écrit"
446
+ }
447
+
448
+ write_unit "overmind-mcp.service" \
449
+ "$NPM_GLOBAL/overmind-mcp/dist/bin/cli.js --transport httpStream --port $MCP_PORT_CORE"
450
+
451
+ if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
452
+ write_unit "overmind-postgres-mcp.service" \
453
+ "$NPM_GLOBAL/overmind-postgres-mcp/dist/index.js"
454
+ fi
455
+
456
+ $SUDO systemctl daemon-reload
457
+ $SUDO systemctl enable --now overmind-mcp.service 2>/dev/null || track_warn "systemctl enable overmind-mcp"
458
+ ok "overmind-mcp.service: $($SUDO systemctl is-active overmind-mcp.service 2>/dev/null || echo '?')"
459
+
460
+ if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
461
+ $SUDO systemctl enable --now overmind-postgres-mcp.service 2>/dev/null || track_warn "systemctl enable overmind-postgres-mcp"
462
+ ok "overmind-postgres-mcp.service: $($SUDO systemctl is-active overmind-postgres-mcp.service 2>/dev/null || echo '?')"
463
+ fi
464
+
465
+ elif [ "$OS" = "Darwin" ]; then
466
+ # ─── macOS: launchd plist ───────────────────────────────────
467
+ NODE_BIN="$(which node)"
468
+ NPM_GLOBAL="$(npm root -g 2>/dev/null || echo /usr/local/lib/node_modules)"
469
+ LAUNCH_DIR="$OM_HOME/Library/LaunchAgents"
470
+ mkdir -p "$LAUNCH_DIR" 2>/dev/null || true
471
+
472
+ write_plist() {
473
+ local name="$1" entry="$2" port="$3"
474
+ local plist="$LAUNCH_DIR/com.overmind.${name}.plist"
475
+ cat > "$plist" <<PLIST
476
+ <?xml version="1.0" encoding="UTF-8"?>
477
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
478
+ <plist version="1.0">
479
+ <dict>
480
+ <key>Label</key><string>com.overmind.${name}</string>
481
+ <key>ProgramArguments</key>
482
+ <array>
483
+ <string>${NODE_BIN}</string>
484
+ <string>--max-old-space-size=256</string>
485
+ <string>--no-warnings</string>
486
+ <string>${entry}</string>
487
+ <string>--transport</string>
488
+ <string>httpStream</string>
489
+ <string>--port</string>
490
+ <string>${port}</string>
491
+ </array>
492
+ <key>WorkingDirectory</key><string>${OM_DIR}</string>
493
+ <key>EnvironmentVariables</key>
494
+ <dict>
495
+ <key>HOME</key><string>${OM_HOME}</string>
496
+ </dict>
497
+ <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
498
+ <key>StandardOutPath</key><string>${LOG_DIR}/${name}.log</string>
499
+ <key>StandardErrorPath</key><string>${LOG_DIR}/${name}.err</string>
500
+ </dict>
501
+ </plist>
502
+ PLIST
503
+ launchctl bootout gui/$(id -u) "$plist" 2>/dev/null || true
504
+ launchctl bootstrap gui/$(id -u) "$plist" 2>/dev/null || true
505
+ ok "launchd: com.overmind.${name} chargé"
506
+ }
507
+
508
+ write_plist "overmind-mcp" \
509
+ "$NPM_GLOBAL/overmind-mcp/dist/bin/cli.js" "$MCP_PORT_CORE"
510
+
511
+ if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
512
+ write_plist "overmind-postgres-mcp" \
513
+ "$NPM_GLOBAL/overmind-postgres-mcp/dist/index.js" "$MCP_PORT_PG"
514
+ fi
215
515
 
216
- write_unit "overmind-postgres-mcp.service" "$MCP_PORT_PG" \
217
- "/usr/lib/node_modules/overmind-postgres-mcp/dist/index.js"
516
+ else
517
+ warn "OS non Linux/macOS — pas de service système. Démarrez manuellement:"
518
+ echo " node $NPM_GLOBAL/overmind-mcp/dist/bin/cli.js --transport httpStream --port $MCP_PORT_CORE"
519
+ fi
218
520
 
219
- systemctl daemon-reload
220
- systemctl enable --now overmind-mcp.service overmind-postgres-mcp.service
221
- ok "Services activés et démarrés"
521
+ # ================================================================
522
+ # STEP 8/8 Validation finale
523
+ # ================================================================
524
+ step "Validation finale"
222
525
 
223
- # ============================================================
224
- # STEP 6/6 — Validation HTTP
225
- # ============================================================
226
- log "STEP 6/6 : validation"
227
-
228
- sleep 3
229
- test_endpoint() {
230
- local port="$1" name="$2"
231
- local code
232
- code=$(curl -s -o /dev/null -w "%{http_code}" -m 5 \
233
- -H "Accept: application/json, text/event-stream" \
234
- -H "Content-Type: application/json" \
235
- -X POST "http://127.0.0.1:$port/mcp" \
236
- -d '{"jsonrpc":"2.0","method":"tools/list","id":1}' || echo "000")
237
- if [ "$code" = "200" ]; then
238
- ok "$name (port $port) : HTTP 200"
239
- else
240
- warn "$name (port $port) : HTTP $code — voir $LOG_DIR/$name.err"
241
- fi
242
- }
526
+ sleep 3 # Laisser les services démarrer
243
527
 
244
- test_endpoint "$MCP_PORT_CORE" "overmind-mcp"
245
- test_endpoint "$MCP_PORT_PG" "overmind-postgres-mcp"
528
+ # Test MCP :3099
529
+ MCP_CODE="$(curl -s -o /dev/null -w '%{http_code}' -m 5 \
530
+ -H 'Content-Type: application/json' \
531
+ -X POST "http://127.0.0.1:$MCP_PORT_CORE/mcp" \
532
+ -d '{"jsonrpc":"2.0","method":"ping","params":{}}' 2>/dev/null || echo '000')"
533
+ if [ "$MCP_CODE" = "200" ] || [ "$MCP_CODE" = "202" ]; then
534
+ ok "OverMind MCP :${MCP_PORT_CORE} → HTTP ${MCP_CODE}"
535
+ else
536
+ track_warn "OverMind MCP :${MCP_PORT_CORE} → HTTP ${MCP_CODE} (peut nécessiter un redémarrage)"
537
+ fi
246
538
 
247
- # Test SQL direct
248
- if sudo -u postgres psql -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
249
- ok "PostgreSQL $PG_DB accessible en local"
539
+ # Test PostgreSQL
540
+ if [ "$OS" = "Darwin" ]; then
541
+ PG_TEST="$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc 'SELECT 1' 2>/dev/null || echo '0')"
542
+ else
543
+ PG_TEST="$($SUDO -u postgres psql -d "$PG_DB" -tAc 'SELECT 1' 2>/dev/null || echo '0')"
544
+ fi
545
+ if [ "$PG_TEST" = "1" ]; then
546
+ ok "PostgreSQL DB '$PG_DB' → accessible"
250
547
  else
251
- warn "PostgreSQL $PG_DB inaccessible vérifier sudo -u postgres psql"
548
+ track_warn "PostgreSQL DB '$PG_DB' connexion échouée"
252
549
  fi
253
550
 
551
+ # ─── Résumé ──────────────────────────────────────────────────
254
552
  echo
255
- echo -e "${G}============================================================${N}"
256
- echo -e "${G}✅ Installation terminée${N}"
257
- echo -e "${G}============================================================${N}"
553
+ echo -e "${B}═══════════════════════════════════════════════════════════════${N}"
554
+ if [ "$ERRORS" -eq 0 ]; then
555
+ echo -e "${G}${B} ✅ Installation terminée${N} (${WARNINGS} warning(s))"
556
+ else
557
+ echo -e "${Y}${B} ⚠️ Installation terminée avec ${ERRORS} erreur(s)${N}"
558
+ fi
559
+ echo -e "${B}═══════════════════════════════════════════════════════════════${N}"
258
560
  echo
259
- echo "Endpoints (loopback uniquement) :"
260
- echo " overmind-mcp : http://127.0.0.1:$MCP_PORT_CORE"
261
- echo " overmind-postgres-mcp: http://127.0.0.1:$MCP_PORT_PG"
561
+ echo -e "Endpoints (loopback):"
562
+ echo -e " ${C}OverMind MCP${N} → http://127.0.0.1:${MCP_PORT_CORE}"
563
+ echo -e " ${C}OverMind PostgreSQL MCP${N} → http://127.0.0.1:${MCP_PORT_PG}"
262
564
  echo
263
- echo "Pour accès distant, utiliser un tunnel SSH :"
264
- echo " ssh -L 13099:127.0.0.1:$MCP_PORT_CORE -L 15433:127.0.0.1:$MCP_PORT_PG user@host"
565
+ echo -e "Fichiers de config:"
566
+ echo -e " ${D}.env${N} $ENV_FILE"
567
+ echo -e " ${D}.mcp.json${N} $MCP_FILE"
568
+ echo -e " ${D}logs/${N} $LOG_DIR/"
569
+ echo
570
+ if [ -n "$ENV_PASSWORD" ] && [ "$ENV_PASSWORD" != "" ]; then
571
+ echo -e "${Y}⚠️ POSTGRES_PASSWORD généré automatiquement${N}"
572
+ echo -e " Il est stocké dans $ENV_FILE"
573
+ echo -e " Sauvegardez-le dans Keychain/1Password maintenant."
574
+ echo
575
+ fi
576
+ echo -e "Actions restantes:"
577
+ echo -e " 1. Éditer ${C}$ENV_FILE${N} et remplir les clés LLM"
578
+ echo -e " 2. Redémarrer les services (${D}systemctl restart overmind-*${N} ou ${D}launchctl kickstart ${N})"
265
579
  echo
266
- echo "Actions manuelles restantes :"
267
- echo " 1. Éditer $OM_DIR/.env et remplir POSTGRES_PASSWORD + clés LLM"
268
- echo " 2. sudo systemctl restart overmind-mcp overmind-postgres-mcp"
269
- echo " 3. (Optionnel) Créer un user Postgres dédié et restreindre pg_hba.conf"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overmind-mcp",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mémoire (Private Memory Context) et le support pour QwenCli et Nous Hermes. Installation automatique des dépendances Docker (PostgreSQL, pgvector) inclus.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",