overmind-mcp 3.3.6 → 3.3.7

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,93 @@ 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
+ HERMES_NATIVE="$OM_HOME/.hermes"
765
+ if [ -d "$HERMES_NATIVE" ] && [ -d "$OM_DIR/hermes" ]; then
766
+ # Les deux existent! C'est le bug dual-path.
767
+ NATIVE_PROFILES=$(find "$HERMES_NATIVE/profiles" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
768
+ OM_PROFILES=$(find "$PROFILES_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
769
+
770
+ if [ "$NATIVE_PROFILES" -gt 0 ] && [ "$OM_PROFILES" -gt 0 ]; then
771
+ warn "DUAL-PATH détecté: ~/.hermes/ ($NATIVE_PROFILES profils) ET ~/.overmind/hermes/ ($OM_PROFILES profils)"
772
+ log "Correction: migration des profils ~/.hermes/ → ~/.overmind/hermes/profiles/ (sans effacer)..."
773
+
774
+ for native_profile in "$HERMES_NATIVE/profiles"/*/; do
775
+ [ -d "$native_profile" ] || continue
776
+ pname=$(basename "$native_profile")
777
+ target="$PROFILES_DIR/$pname"
778
+
779
+ if [ -d "$target" ]; then
780
+ # Le profil existe déjà dans overmind — vérifier quels fichiers manquent
781
+ for file in config.yaml SOUL.md .env .mcp.json profile.yaml workspace.yaml; do
782
+ if [ ! -f "$target/$file" ] && [ -f "$native_profile/$file" ]; then
783
+ log " Copie $pname/$file (manquant dans overmind, présent dans native)"
784
+ cp -p "$native_profile/$file" "$target/$file" 2>/dev/null || true
785
+ fi
786
+ done
787
+ # state.db
788
+ if [ ! -f "$target/state.db" ] && [ -f "$native_profile/state.db" ]; then
789
+ log " Copie $pname/state.db"
790
+ cp -p "$native_profile/state.db" "$target/state.db" 2>/dev/null || true
791
+ fi
792
+ # auth.json
793
+ if [ ! -f "$target/auth.json" ] && [ -f "$native_profile/auth.json" ]; then
794
+ log " Copie $pname/auth.json"
795
+ cp -p "$native_profile/auth.json" "$target/auth.json" 2>/dev/null || true
796
+ fi
797
+ # skills/
798
+ if [ ! -d "$target/skills" ] && [ -d "$native_profile/skills" ]; then
799
+ log " Copie $pname/skills/"
800
+ cp -rp "$native_profile/skills" "$target/" 2>/dev/null || true
801
+ fi
802
+ ok "Profil $pname: fichiers manquants comblés depuis ~/.hermes/"
803
+ else
804
+ # Le profil n'existe pas dans overmind — migration complète
805
+ log " Migration complète: $pname"
806
+ cp -rp "$native_profile" "$target/" 2>/dev/null || true
807
+ ok "Profil $pname migré vers ~/.overmind/hermes/profiles/"
808
+ fi
809
+ done
810
+ ok "Migration dual-path terminée (rien effacé — ~/.hermes/ conservé)"
811
+ elif [ "$NATIVE_PROFILES" -gt 0 ] && [ "$OM_PROFILES" -eq 0 ]; then
812
+ warn "~/.hermes/ a $NATIVE_PROFILES profils, ~/.overmind/hermes/ est vide"
813
+ log "Migration complète des profils..."
814
+ cp -rp "$HERMES_NATIVE/profiles/"* "$PROFILES_DIR/" 2>/dev/null || true
815
+ # Copier aussi config.yaml et auth.json globaux
816
+ [ -f "$HERMES_NATIVE/config.yaml" ] && cp -p "$HERMES_NATIVE/config.yaml" "$OM_DIR/hermes/config.yaml" 2>/dev/null || true
817
+ [ -f "$HERMES_NATIVE/auth.json" ] && cp -p "$HERMES_NATIVE/auth.json" "$OM_DIR/hermes/auth.json" 2>/dev/null || true
818
+ ok "Profils migrés vers ~/.overmind/hermes/profiles/"
819
+ fi
758
820
  fi
759
821
 
760
- # Lister les profils existants
822
+ # ─── 3. Vérifier les symlinks cassés ──────────────────────────
823
+ find "$OM_DIR" -type l 2>/dev/null | while read -r link; do
824
+ if [ ! -e "$link" ]; then
825
+ linkname=$(echo "$link" | sed "s|$OM_DIR/||")
826
+ track_warn "Symlink cassé: ~/.overmind/${linkname} → suppression (lien mort seulement)"
827
+ rm -f "$link" 2>/dev/null || true
828
+ fi
829
+ done
830
+
831
+ # ─── 4. Audit détaillé par profil ─────────────────────────────
761
832
  PROFILE_COUNT=0
762
833
  if [ -d "$PROFILES_DIR" ]; then
763
834
  PROFILE_COUNT=$(find "$PROFILES_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
@@ -767,27 +838,39 @@ if [ "$PROFILE_COUNT" -eq 0 ]; then
767
838
  warn "Aucun profil agent dans ~/.overmind/hermes/profiles/"
768
839
  log "Créez un agent avec: overmind create-agent --name <name> --prompt '...' --runner hermes"
769
840
  else
770
- log "Audit de $PROFILE_COUNT profil(s)..."
841
+ log "Audit + réparation de $PROFILE_COUNT profil(s)..."
771
842
  echo
772
843
 
773
- # Pour chaque profil, vérifier les fichiers requis
774
844
  for profile_path in "$PROFILES_DIR"/*/; do
775
845
  [ -d "$profile_path" ] || continue
776
846
  pname=$(basename "$profile_path")
777
847
  echo -e " ${C}▸ ${pname}${N}"
778
848
 
779
- # Fichiers requis (v3.1)
780
- PROFILE_OK=true
781
-
782
- # config.yaml (OBLIGATOIRE)
849
+ # ── config.yaml (OBLIGATOIRE) ────────────────────────────
783
850
  if [ -f "${profile_path}config.yaml" ]; then
784
- ok "${pname}/config.yaml"
851
+ # Vérifier qu'il contient model.provider et model.model
852
+ if ! grep -q 'model:' "${profile_path}config.yaml" 2>/dev/null; then
853
+ track_warn "${pname}/config.yaml ne contient pas 'model:' → rewrite"
854
+ cat > "${profile_path}config.yaml" <<YAMLEOF
855
+ model:
856
+ provider: minimax-cn
857
+ model: MiniMax-M3
858
+ YAMLEOF
859
+ ok "${pname}/config.yaml corrigé avec defaults"
860
+ else
861
+ ok "${pname}/config.yaml"
862
+ fi
785
863
  else
786
- fail "${pname}/config.yaml MANQUANT"
787
- PROFILE_OK=false
864
+ track_warn "${pname}/config.yaml MANQUANT → création avec defaults"
865
+ cat > "${profile_path}config.yaml" <<YAMLEOF
866
+ model:
867
+ provider: minimax-cn
868
+ model: MiniMax-M3
869
+ YAMLEOF
870
+ ok "${pname}/config.yaml créé"
788
871
  fi
789
872
 
790
- # SOUL.md (prompt système)
873
+ # ── SOUL.md ───────────────────────────────────────────────
791
874
  if [ -f "${profile_path}SOUL.md" ]; then
792
875
  SOUL_SIZE=$(wc -c < "${profile_path}SOUL.md" 2>/dev/null | tr -d ' ')
793
876
  if [ "$SOUL_SIZE" -lt 50 ]; then
@@ -796,111 +879,133 @@ else
796
879
  ok "${pname}/SOUL.md (${SOUL_SIZE} bytes)"
797
880
  fi
798
881
  else
799
- track_warn "${pname}/SOUL.md MANQUANT l'agent n'a pas de prompt système"
882
+ track_warn "${pname}/SOUL.md MANQUANT création placeholder"
883
+ echo "# ${pname}" > "${profile_path}SOUL.md"
884
+ echo "" >> "${profile_path}SOUL.md"
885
+ echo "Tu es un agent Overmind. Réponds aux requêtes de l'utilisateur." >> "${profile_path}SOUL.md"
886
+ ok "${pname}/SOUL.md créé (placeholder)"
800
887
  fi
801
888
 
802
- # .env (secrets du profil)
803
- if [ -f "${profile_path}.env" ]; then
804
- ok "${pname}/.env"
889
+ # ── .env (clés LLM) ───────────────────────────────────────
890
+ if [ ! -f "${profile_path}.env" ]; then
891
+ track_warn "${pname}/.env MANQUANT → création template"
892
+ cat > "${profile_path}.env" <<ENVEOF
893
+ # Credentials pour ${pname}
894
+ # Remplir avec vos clés API
895
+ # MINIMAX_CN_API_KEY=sk-cp-...
896
+ # ANTHROPIC_AUTH_TOKEN=...
897
+ ENVEOF
898
+ chmod 600 "${profile_path}.env" 2>/dev/null || true
899
+ ok "${pname}/.env créé (template)"
805
900
  else
806
- track_warn "${pname}/.env MANQUANT clés LLM manquantes"
901
+ # Vérifier qu'au moins une clé est présente
902
+ if ! grep -qE 'API_KEY|AUTH_TOKEN|SECRET' "${profile_path}.env" 2>/dev/null; then
903
+ track_warn "${pname}/.env ne contient aucune clé API"
904
+ else
905
+ ok "${pname}/.env"
906
+ fi
807
907
  fi
808
908
 
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"
909
+ # ── auth.json stale ───────────────────────────────────────
910
+ if [ -f "${profile_path}auth.json" ]; then
911
+ 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)))
912
+ if [ "$AUTH_AGE" -gt 604800 ]; then
913
+ track_warn "${pname}/auth.json stale (>7j). Peut causer 401/429. Suppression du cache..."
914
+ rm -f "${profile_path}auth.json" 2>/dev/null || true
915
+ ok "${pname}/auth.json supprimé (sera recréé par Hermes au prochain run)"
916
+ else
917
+ ok "${pname}/auth.json (récent)"
918
+ fi
814
919
  fi
815
920
 
816
- # workspace.yaml
817
- if [ -f "${profile_path}workspace.yaml" ]; then
818
- ok "${pname}/workspace.yaml"
921
+ # ── profile.yaml (kanban) ─────────────────────────────────
922
+ if [ ! -f "${profile_path}profile.yaml" ]; then
923
+ track_warn "${pname}/profile.yaml MANQUANT → création"
924
+ cat > "${profile_path}profile.yaml" <<YAMLEOF
925
+ name: "${pname}"
926
+ description: "Agent Overmind"
927
+ model: "$(grep 'model:' "${profile_path}config.yaml" 2>/dev/null | head -1 | awk '{print $2}' || echo 'unknown')"
928
+ workspace: persistent
929
+ created: "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
930
+ YAMLEOF
931
+ ok "${pname}/profile.yaml créé"
819
932
  else
820
- track_warn "${pname}/workspace.yaml MANQUANT — workspace kind inconnu"
933
+ ok "${pname}/profile.yaml"
821
934
  fi
822
935
 
823
- # state.db (sessions)
824
- if [ -f "${profile_path}state.db" ]; then
825
- ok "${pname}/state.db (sessions)"
936
+ # ── workspace.yaml ────────────────────────────────────────
937
+ if [ ! -f "${profile_path}workspace.yaml" ]; then
938
+ log "${D} ${pname}/workspace.yaml → création (persistent)${N}"
939
+ echo "kind: persistent" > "${profile_path}workspace.yaml"
940
+ echo "path: ${profile_path}" >> "${profile_path}workspace.yaml"
941
+ ok "${pname}/workspace.yaml créé"
826
942
  else
827
- log "${D} ${pname}/state.db non créé (sera créé au premier run)${N}"
943
+ ok "${pname}/workspace.yaml"
828
944
  fi
829
945
 
830
- # .mcp.json (MCP servers override)
946
+ # ── .mcp.json (optionnel) ─────────────────────────────────
831
947
  if [ -f "${profile_path}.mcp.json" ]; then
832
- ok "${pname}/.mcp.json (MCP override)"
948
+ ok "${pname}/.mcp.json"
833
949
  else
834
950
  log "${D} ${pname}/.mcp.json absent (utilisera le global)${N}"
835
951
  fi
836
952
 
837
- # skills/ (optionnel)
953
+ # ── state.db ──────────────────────────────────────────────
954
+ if [ -f "${profile_path}state.db" ]; then
955
+ ok "${pname}/state.db"
956
+ else
957
+ log "${D} ${pname}/state.db non créé (sera créé au premier run)${N}"
958
+ fi
959
+
960
+ # ── skills/ (optionnel) ───────────────────────────────────
838
961
  if [ -d "${profile_path}skills" ]; then
839
962
  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
963
+ ok "${pname}/skills/ (${SKILL_COUNT} skill(s))"
843
964
  fi
844
965
 
845
- # memories/ (optionnel)
966
+ # ── memories/ (optionnel) ─────────────────────────────────
846
967
  if [ -f "${profile_path}memories/MEMORY.md" ]; then
847
968
  ok "${pname}/memories/MEMORY.md"
848
969
  fi
849
970
 
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
971
  echo
861
972
  done
862
973
  fi
863
974
 
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
975
+ # ─── 5. Vérifier bridge/agents.json ───────────────────────────
976
+ if [ ! -f "$OM_DIR/bridge/agents.json" ]; then
977
+ log "${D}bridge/agents.json absent création vide${N}"
978
+ echo '{}' > "$OM_DIR/bridge/agents.json" 2>/dev/null || true
979
+ ok "bridge/agents.json créé"
980
+ else
889
981
  SESSION_COUNT=$(grep -c '"id"' "$OM_DIR/bridge/agents.json" 2>/dev/null || echo 0)
890
982
  ok "bridge/agents.json (${SESSION_COUNT} session(s))"
891
- else
892
- log "${D}bridge/agents.json absent (créé au premier run)${N}"
893
983
  fi
894
984
 
895
- # Vérifier .mcp.json global
896
- if [ -f "$OM_DIR/.mcp.json" ]; then
985
+ # ─── 6. Vérifier .mcp.json global ─────────────────────────────
986
+ if [ ! -f "$OM_DIR/.mcp.json" ]; then
987
+ track_warn ".mcp.json global MANQUANT → création minimal"
988
+ cat > "$OM_DIR/.mcp.json" <<MCPEOF
989
+ {
990
+ "mcpServers": {
991
+ "memory": {
992
+ "transport": "httpStream",
993
+ "url": "http://localhost:${MCP_PORT_CORE}/mcp"
994
+ },
995
+ "postgres": {
996
+ "transport": "httpStream",
997
+ "url": "http://localhost:${MCP_PORT_PG}/mcp"
998
+ }
999
+ }
1000
+ }
1001
+ MCPEOF
1002
+ ok ".mcp.json créé"
1003
+ else
897
1004
  MCP_SERVERS=$(grep -c '"transport"' "$OM_DIR/.mcp.json" 2>/dev/null || echo 0)
898
1005
  ok ".mcp.json global (${MCP_SERVERS} serveur(s) MCP)"
899
- else
900
- track_warn ".mcp.json global MANQUANT"
901
1006
  fi
902
1007
 
903
- ok "Audit arborescence terminé"
1008
+ ok "Audit + réparation terminé"
904
1009
 
905
1010
  # ================================================================
906
1011
  # 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.7",
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",