overmind-mcp 3.3.6 → 3.3.8

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.
@@ -742,22 +742,128 @@ ok "overmind-mcp: v${OM_VER}"
742
742
  ok "overmind-postgres-mcp: v${PGM_VER}"
743
743
 
744
744
  # ================================================================
745
- # STEP 10/11 — Audit arborescence agents (~/.overmind/hermes/profiles/)
745
+ # STEP 10/11 — Audit + Réparation arborescence agents
746
+ # Détecte ET corrige les mauvaises configs, symlinks cassés,
747
+ # fichiers manquants, env incomplet — SANS RIEN EFFACER.
746
748
  # ================================================================
747
- step "Audit arborescence agents"
749
+ step "Audit + Réparation arborescence agents"
748
750
 
749
751
  PROFILES_DIR="$OM_DIR/hermes/profiles"
750
752
 
751
- if [ ! -d "$PROFILES_DIR" ]; then
752
- warn "Dossier profiles/ absent aucun agent configuré"
753
- log "Création de la structure canonique..."
754
- mkdir -p "$PROFILES_DIR" "$OM_DIR/hermes/distributions" "$OM_DIR/bridge/wrappers" 2>/dev/null || true
755
- ok "Structure ~/.overmind/hermes/ créée"
756
- else
757
- ok "Dossier profiles/ trouvé"
753
+ # ─── 1. Vérifier la structure globale ─────────────────────────
754
+ for check_dir in "bridge/wrappers" "logs" "hermes/profiles" "hermes/distributions"; do
755
+ if [ ! -d "$OM_DIR/$check_dir" ]; then
756
+ track_warn "~/.overmind/${check_dir}/ MANQUANT création"
757
+ mkdir -p "$OM_DIR/$check_dir" 2>/dev/null || true
758
+ else
759
+ ok "~/.overmind/${check_dir}/"
760
+ fi
761
+ done
762
+
763
+ # ─── 2. Détecter le dual-path ~/.hermes vs ~/.overmind/hermes ─
764
+ # SOLUTION DÉFINITIVE: remplacer ~/.hermes/ par un SYMLINK vers ~/.overmind/hermes/
765
+ # Comme ça, peu importe qui écrit dans ~/.hermes/ (agent, humain, CLI),
766
+ # ça atterrit TOUJOURS dans ~/.overmind/hermes/.
767
+ HERMES_NATIVE="$OM_HOME/.hermes"
768
+
769
+ if [ -d "$HERMES_NATIVE" ] && [ ! -L "$HERMES_NATIVE" ]; then
770
+ # ~/.hermes/ existe ET n'est pas un symlink → c'est un vrai dossier
771
+ NATIVE_PROFILES=$(find "$HERMES_NATIVE/profiles" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
772
+ warn "DUAL-PATH détecté: ~/.hermes/ est un vrai dossier ($NATIVE_PROFILES profils)"
773
+ log "Migration → symlink: ~/.hermes/ → ~/.overmind/hermes/ (sans rien effacer)..."
774
+
775
+ # 1. Créer ~/.overmind/hermes/ si vide
776
+ mkdir -p "$PROFILES_DIR" "$OM_DIR/hermes/distributions" 2>/dev/null || true
777
+
778
+ # 2. Copier TOUS les fichiers de ~/.hermes/ vers ~/.overmind/hermes/ (sans écraser)
779
+ if [ "$NATIVE_PROFILES" -gt 0 ]; then
780
+ for native_profile in "$HERMES_NATIVE/profiles"/*/; do
781
+ [ -d "$native_profile" ] || continue
782
+ pname=$(basename "$native_profile")
783
+ target="$PROFILES_DIR/$pname"
784
+
785
+ if [ -d "$target" ]; then
786
+ # Profil existe déjà → combler les fichiers manquants uniquement
787
+ for file in config.yaml SOUL.md .env .mcp.json profile.yaml workspace.yaml auth.json state.db; do
788
+ if [ ! -f "$target/$file" ] && [ -f "$native_profile/$file" ]; then
789
+ cp -p "$native_profile/$file" "$target/$file" 2>/dev/null || true
790
+ log " Copie $pname/$file"
791
+ fi
792
+ done
793
+ for subdir in skills memories cron hooks; do
794
+ if [ ! -d "$target/$subdir" ] && [ -d "$native_profile/$subdir" ]; then
795
+ cp -rp "$native_profile/$subdir" "$target/" 2>/dev/null || true
796
+ log " Copie $pname/$subdir/"
797
+ fi
798
+ done
799
+ ok "Profil $pname: synchronisé"
800
+ else
801
+ # Profil n'existe pas → migration complète
802
+ cp -rp "$native_profile" "$target/" 2>/dev/null || true
803
+ ok "Profil $pname migré"
804
+ fi
805
+ done
806
+ fi
807
+
808
+ # 3. Copier les fichiers globaux (config.yaml, auth.json, .env)
809
+ for global_file in config.yaml auth.json .env .mcp.json; do
810
+ if [ -f "$HERMES_NATIVE/$global_file" ] && [ ! -f "$OM_DIR/hermes/$global_file" ]; then
811
+ cp -p "$HERMES_NATIVE/$global_file" "$OM_DIR/hermes/$global_file" 2>/dev/null || true
812
+ log " Copie globale: $global_file"
813
+ fi
814
+ done
815
+
816
+ # 4. Backup ~/.hermes/ → ~/.hermes.backup.YYYYMMDD (ne pas effacer!)
817
+ BACKUP_NAME="$HERMES_NATIVE.backup.$(date +%Y%m%d%H%M%S)"
818
+ mv "$HERMES_NATIVE" "$BACKUP_NAME" 2>/dev/null || {
819
+ track_warn "Impossible de renommer ~/.hermes/ — permission refusée"
820
+ track_warn "Migration manuelle requise: voir ~/.overmind/docs/MIGRATION_V3.md"
821
+ }
822
+
823
+ # 5. Créer le symlink ~/.hermes → ~/.overmind/hermes
824
+ if [ ! -e "$HERMES_NATIVE" ]; then
825
+ ln -sfn "$OM_DIR/hermes" "$HERMES_NATIVE" 2>/dev/null || {
826
+ track_warn "Impossible de créer le symlink ~/.hermes/ → ~/.overmind/hermes/"
827
+ track_warn "Faites manuellement: ln -sfn ~/.overmind/hermes ~/.hermes"
828
+ }
829
+ if [ -L "$HERMES_NATIVE" ]; then
830
+ ok "Symlink créé: ~/.hermes/ → ~/.overmind/hermes/"
831
+ ok "Backup conservé: $BACKUP_NAME"
832
+ ok "Aucune donnée effacée — backup disponible si rollback nécessaire"
833
+ fi
834
+ fi
835
+
836
+ elif [ -L "$HERMES_NATIVE" ]; then
837
+ # C'est déjà un symlink — vérifier qu'il pointe au bon endroit
838
+ LINK_TARGET=$(readlink "$HERMES_NATIVE" 2>/dev/null)
839
+ if [ "$LINK_TARGET" = "$OM_DIR/hermes" ]; then
840
+ ok "Symlink ~/.hermes/ → ~/.overmind/hermes/ déjà en place"
841
+ else
842
+ warn "Symlink ~/.hermes/ pointe vers $LINK_TARGET (mauvaise cible)"
843
+ log "Correction: ~/.hermes/ → ~/.overmind/hermes/"
844
+ ln -sfn "$OM_DIR/hermes" "$HERMES_NATIVE" 2>/dev/null || true
845
+ ok "Symlink corrigé"
846
+ fi
847
+
848
+ elif [ ! -e "$HERMES_NATIVE" ]; then
849
+ # ~/.hermes/ n'existe pas → créer le symlink directement
850
+ log "Création symlink ~/.hermes/ → ~/.overmind/hermes/"
851
+ ln -sfn "$OM_DIR/hermes" "$HERMES_NATIVE" 2>/dev/null || true
852
+ if [ -L "$HERMES_NATIVE" ]; then
853
+ ok "Symlink créé: ~/.hermes/ → ~/.overmind/hermes/"
854
+ fi
758
855
  fi
759
856
 
760
- # Lister les profils existants
857
+ # ─── 3. Vérifier les symlinks cassés ──────────────────────────
858
+ find "$OM_DIR" -type l 2>/dev/null | while read -r link; do
859
+ if [ ! -e "$link" ]; then
860
+ linkname=$(echo "$link" | sed "s|$OM_DIR/||")
861
+ track_warn "Symlink cassé: ~/.overmind/${linkname} → suppression (lien mort seulement)"
862
+ rm -f "$link" 2>/dev/null || true
863
+ fi
864
+ done
865
+
866
+ # ─── 4. Audit détaillé par profil ─────────────────────────────
761
867
  PROFILE_COUNT=0
762
868
  if [ -d "$PROFILES_DIR" ]; then
763
869
  PROFILE_COUNT=$(find "$PROFILES_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
@@ -767,27 +873,39 @@ if [ "$PROFILE_COUNT" -eq 0 ]; then
767
873
  warn "Aucun profil agent dans ~/.overmind/hermes/profiles/"
768
874
  log "Créez un agent avec: overmind create-agent --name <name> --prompt '...' --runner hermes"
769
875
  else
770
- log "Audit de $PROFILE_COUNT profil(s)..."
876
+ log "Audit + réparation de $PROFILE_COUNT profil(s)..."
771
877
  echo
772
878
 
773
- # Pour chaque profil, vérifier les fichiers requis
774
879
  for profile_path in "$PROFILES_DIR"/*/; do
775
880
  [ -d "$profile_path" ] || continue
776
881
  pname=$(basename "$profile_path")
777
882
  echo -e " ${C}▸ ${pname}${N}"
778
883
 
779
- # Fichiers requis (v3.1)
780
- PROFILE_OK=true
781
-
782
- # config.yaml (OBLIGATOIRE)
884
+ # ── config.yaml (OBLIGATOIRE) ────────────────────────────
783
885
  if [ -f "${profile_path}config.yaml" ]; then
784
- ok "${pname}/config.yaml"
886
+ # Vérifier qu'il contient model.provider et model.model
887
+ if ! grep -q 'model:' "${profile_path}config.yaml" 2>/dev/null; then
888
+ track_warn "${pname}/config.yaml ne contient pas 'model:' → rewrite"
889
+ cat > "${profile_path}config.yaml" <<YAMLEOF
890
+ model:
891
+ provider: minimax-cn
892
+ model: MiniMax-M3
893
+ YAMLEOF
894
+ ok "${pname}/config.yaml corrigé avec defaults"
895
+ else
896
+ ok "${pname}/config.yaml"
897
+ fi
785
898
  else
786
- fail "${pname}/config.yaml MANQUANT"
787
- PROFILE_OK=false
899
+ track_warn "${pname}/config.yaml MANQUANT → création avec defaults"
900
+ cat > "${profile_path}config.yaml" <<YAMLEOF
901
+ model:
902
+ provider: minimax-cn
903
+ model: MiniMax-M3
904
+ YAMLEOF
905
+ ok "${pname}/config.yaml créé"
788
906
  fi
789
907
 
790
- # SOUL.md (prompt système)
908
+ # ── SOUL.md ───────────────────────────────────────────────
791
909
  if [ -f "${profile_path}SOUL.md" ]; then
792
910
  SOUL_SIZE=$(wc -c < "${profile_path}SOUL.md" 2>/dev/null | tr -d ' ')
793
911
  if [ "$SOUL_SIZE" -lt 50 ]; then
@@ -796,111 +914,133 @@ else
796
914
  ok "${pname}/SOUL.md (${SOUL_SIZE} bytes)"
797
915
  fi
798
916
  else
799
- track_warn "${pname}/SOUL.md MANQUANT l'agent n'a pas de prompt système"
917
+ track_warn "${pname}/SOUL.md MANQUANT création placeholder"
918
+ echo "# ${pname}" > "${profile_path}SOUL.md"
919
+ echo "" >> "${profile_path}SOUL.md"
920
+ echo "Tu es un agent Overmind. Réponds aux requêtes de l'utilisateur." >> "${profile_path}SOUL.md"
921
+ ok "${pname}/SOUL.md créé (placeholder)"
800
922
  fi
801
923
 
802
- # .env (secrets du profil)
803
- if [ -f "${profile_path}.env" ]; then
804
- ok "${pname}/.env"
924
+ # ── .env (clés LLM) ───────────────────────────────────────
925
+ if [ ! -f "${profile_path}.env" ]; then
926
+ track_warn "${pname}/.env MANQUANT → création template"
927
+ cat > "${profile_path}.env" <<ENVEOF
928
+ # Credentials pour ${pname}
929
+ # Remplir avec vos clés API
930
+ # MINIMAX_CN_API_KEY=sk-cp-...
931
+ # ANTHROPIC_AUTH_TOKEN=...
932
+ ENVEOF
933
+ chmod 600 "${profile_path}.env" 2>/dev/null || true
934
+ ok "${pname}/.env créé (template)"
805
935
  else
806
- track_warn "${pname}/.env MANQUANT clés LLM manquantes"
936
+ # Vérifier qu'au moins une clé est présente
937
+ if ! grep -qE 'API_KEY|AUTH_TOKEN|SECRET' "${profile_path}.env" 2>/dev/null; then
938
+ track_warn "${pname}/.env ne contient aucune clé API"
939
+ else
940
+ ok "${pname}/.env"
941
+ fi
807
942
  fi
808
943
 
809
- # profile.yaml (kanban — OBLIGATOIRE v3.1)
810
- if [ -f "${profile_path}profile.yaml" ]; then
811
- ok "${pname}/profile.yaml"
812
- else
813
- track_warn "${pname}/profile.yaml MANQUANT kanban router sera aveugle"
944
+ # ── auth.json stale ───────────────────────────────────────
945
+ if [ -f "${profile_path}auth.json" ]; then
946
+ AUTH_AGE=$(($(date +%s) - $(stat -f %m "${profile_path}auth.json" 2>/dev/null || stat -c %Y "${profile_path}auth.json" 2>/dev/null || echo 0)))
947
+ if [ "$AUTH_AGE" -gt 604800 ]; then
948
+ track_warn "${pname}/auth.json stale (>7j). Peut causer 401/429. Suppression du cache..."
949
+ rm -f "${profile_path}auth.json" 2>/dev/null || true
950
+ ok "${pname}/auth.json supprimé (sera recréé par Hermes au prochain run)"
951
+ else
952
+ ok "${pname}/auth.json (récent)"
953
+ fi
814
954
  fi
815
955
 
816
- # workspace.yaml
817
- if [ -f "${profile_path}workspace.yaml" ]; then
818
- ok "${pname}/workspace.yaml"
956
+ # ── profile.yaml (kanban) ─────────────────────────────────
957
+ if [ ! -f "${profile_path}profile.yaml" ]; then
958
+ track_warn "${pname}/profile.yaml MANQUANT → création"
959
+ cat > "${profile_path}profile.yaml" <<YAMLEOF
960
+ name: "${pname}"
961
+ description: "Agent Overmind"
962
+ model: "$(grep 'model:' "${profile_path}config.yaml" 2>/dev/null | head -1 | awk '{print $2}' || echo 'unknown')"
963
+ workspace: persistent
964
+ created: "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
965
+ YAMLEOF
966
+ ok "${pname}/profile.yaml créé"
819
967
  else
820
- track_warn "${pname}/workspace.yaml MANQUANT — workspace kind inconnu"
968
+ ok "${pname}/profile.yaml"
821
969
  fi
822
970
 
823
- # state.db (sessions)
824
- if [ -f "${profile_path}state.db" ]; then
825
- ok "${pname}/state.db (sessions)"
971
+ # ── workspace.yaml ────────────────────────────────────────
972
+ if [ ! -f "${profile_path}workspace.yaml" ]; then
973
+ log "${D} ${pname}/workspace.yaml → création (persistent)${N}"
974
+ echo "kind: persistent" > "${profile_path}workspace.yaml"
975
+ echo "path: ${profile_path}" >> "${profile_path}workspace.yaml"
976
+ ok "${pname}/workspace.yaml créé"
826
977
  else
827
- log "${D} ${pname}/state.db non créé (sera créé au premier run)${N}"
978
+ ok "${pname}/workspace.yaml"
828
979
  fi
829
980
 
830
- # .mcp.json (MCP servers override)
981
+ # ── .mcp.json (optionnel) ─────────────────────────────────
831
982
  if [ -f "${profile_path}.mcp.json" ]; then
832
- ok "${pname}/.mcp.json (MCP override)"
983
+ ok "${pname}/.mcp.json"
833
984
  else
834
985
  log "${D} ${pname}/.mcp.json absent (utilisera le global)${N}"
835
986
  fi
836
987
 
837
- # skills/ (optionnel)
988
+ # ── state.db ──────────────────────────────────────────────
989
+ if [ -f "${profile_path}state.db" ]; then
990
+ ok "${pname}/state.db"
991
+ else
992
+ log "${D} ${pname}/state.db non créé (sera créé au premier run)${N}"
993
+ fi
994
+
995
+ # ── skills/ (optionnel) ───────────────────────────────────
838
996
  if [ -d "${profile_path}skills" ]; then
839
997
  SKILL_COUNT=$(find "${profile_path}skills" -name "SKILL.md" 2>/dev/null | wc -l | tr -d ' ')
840
- if [ "$SKILL_COUNT" -gt 0 ]; then
841
- ok "${pname}/skills/ (${SKILL_COUNT} skill(s))"
842
- fi
998
+ ok "${pname}/skills/ (${SKILL_COUNT} skill(s))"
843
999
  fi
844
1000
 
845
- # memories/ (optionnel)
1001
+ # ── memories/ (optionnel) ─────────────────────────────────
846
1002
  if [ -f "${profile_path}memories/MEMORY.md" ]; then
847
1003
  ok "${pname}/memories/MEMORY.md"
848
1004
  fi
849
1005
 
850
- # auth.json (cache credentials — vérifier pas stale)
851
- if [ -f "${profile_path}auth.json" ]; then
852
- AUTH_AGE=$(($(date +%s) - $(stat -f %m "${profile_path}auth.json" 2>/dev/null || stat -c %Y "${profile_path}auth.json" 2>/dev/null || echo 0)))
853
- if [ "$AUTH_AGE" -gt 604800 ]; then
854
- track_warn "${pname}/auth.json stale (${AUTH_AGE}s — >7j). Peut causer des 401/429."
855
- else
856
- ok "${pname}/auth.json (récent)"
857
- fi
858
- fi
859
-
860
1006
  echo
861
1007
  done
862
1008
  fi
863
1009
 
864
- # Vérifier la structure globale ~/.overmind/
865
- echo -e " ${C}Structure globale:${N}"
866
- for check_dir in "bridge" "logs" "hermes/profiles" "hermes/distributions"; do
867
- if [ -d "$OM_DIR/$check_dir" ]; then
868
- ok "~/.overmind/${check_dir}/"
869
- else
870
- track_warn "~/.overmind/${check_dir}/ MANQUANT"
871
- mkdir -p "$OM_DIR/$check_dir" 2>/dev/null || true
872
- fi
873
- done
874
-
875
- # Vérifier les symlinks cassés (runs/, agents/ legacy)
876
- for legacy_link in "hermes/runs" "hermes/agents" "hermes/sessions"; do
877
- if [ -L "$OM_DIR/$legacy_link" ]; then
878
- if [ ! -e "$OM_DIR/$legacy_link" ]; then
879
- track_warn "Symlink cassé: ~/.overmind/${legacy_link} → suppression"
880
- rm -f "$OM_DIR/$legacy_link" 2>/dev/null || true
881
- else
882
- ok "Symlink legacy: ~/.overmind/${legacy_link} → OK"
883
- fi
884
- fi
885
- done
886
-
887
- # Vérifier bridge/agents.json (sessions runtime)
888
- if [ -f "$OM_DIR/bridge/agents.json" ]; then
1010
+ # ─── 5. Vérifier bridge/agents.json ───────────────────────────
1011
+ if [ ! -f "$OM_DIR/bridge/agents.json" ]; then
1012
+ log "${D}bridge/agents.json absent création vide${N}"
1013
+ echo '{}' > "$OM_DIR/bridge/agents.json" 2>/dev/null || true
1014
+ ok "bridge/agents.json créé"
1015
+ else
889
1016
  SESSION_COUNT=$(grep -c '"id"' "$OM_DIR/bridge/agents.json" 2>/dev/null || echo 0)
890
1017
  ok "bridge/agents.json (${SESSION_COUNT} session(s))"
891
- else
892
- log "${D}bridge/agents.json absent (créé au premier run)${N}"
893
1018
  fi
894
1019
 
895
- # Vérifier .mcp.json global
896
- if [ -f "$OM_DIR/.mcp.json" ]; then
1020
+ # ─── 6. Vérifier .mcp.json global ─────────────────────────────
1021
+ if [ ! -f "$OM_DIR/.mcp.json" ]; then
1022
+ track_warn ".mcp.json global MANQUANT → création minimal"
1023
+ cat > "$OM_DIR/.mcp.json" <<MCPEOF
1024
+ {
1025
+ "mcpServers": {
1026
+ "memory": {
1027
+ "transport": "httpStream",
1028
+ "url": "http://localhost:${MCP_PORT_CORE}/mcp"
1029
+ },
1030
+ "postgres": {
1031
+ "transport": "httpStream",
1032
+ "url": "http://localhost:${MCP_PORT_PG}/mcp"
1033
+ }
1034
+ }
1035
+ }
1036
+ MCPEOF
1037
+ ok ".mcp.json créé"
1038
+ else
897
1039
  MCP_SERVERS=$(grep -c '"transport"' "$OM_DIR/.mcp.json" 2>/dev/null || echo 0)
898
1040
  ok ".mcp.json global (${MCP_SERVERS} serveur(s) MCP)"
899
- else
900
- track_warn ".mcp.json global MANQUANT"
901
1041
  fi
902
1042
 
903
- ok "Audit arborescence terminé"
1043
+ ok "Audit + réparation terminé"
904
1044
 
905
1045
  # ================================================================
906
1046
  # STEP 11/11 — Validation finale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overmind-mcp",
3
- "version": "3.3.6",
3
+ "version": "3.3.8",
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",