chore: versioning initial du systeme Context Continuity

Code du systeme de memoire multi-LLM sur Trilium :
- trilium_api.py : wrapper trilium-py (notes, labels, relations)
- mcp_server.py : serveur MCP Starlette (19 tools, OAuth + Bearer)
- api_context.py : API REST FastAPI
- trilium_context.py : workflow CLI
- watchdog.sh, start_*.sh : supervision et demarrage
- skills, docs et ontologie associes
Secrets (.env, oauth_state.json) exclus via .gitignore.
This commit is contained in:
2026-06-29 11:02:22 +02:00
commit 01629780f4
26 changed files with 5259 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#!/bin/sh
# Watchdog Context Continuity — verifie API (8765) et MCP (8766),
# relance le service via son start_*.sh s'il ne repond pas sur /health.
# Idempotent : couvre le boot (rien ne tourne) ET le crash.
# Lance par tache planifiee DSM toutes les 5 min.
BASE=/volume1/homes/Master/App/Context_continuity
LOG="$BASE/watchdog.log"
TS=$(date '+%Y-%m-%d %H:%M:%S')
# Verifie /health avec plusieurs essais. Retourne 0 si OK, 1 sinon.
wait_health() {
URL="$1"
TRIES="$2"
i=0
while [ "$i" -lt "$TRIES" ]; do
if curl -s -f -m 5 "$URL" > /dev/null 2>&1; then
return 0
fi
i=$((i + 1))
sleep 3
done
return 1
}
check_and_restart() {
NAME="$1" # libelle (api / mcp)
URL="$2" # url health
STARTER="$3" # script de demarrage
# Premier check rapide (1 essai) : service deja vivant ?
if curl -s -f -m 5 "$URL" > /dev/null 2>&1; then
return 0
fi
# Service muet : on relance
echo "$TS [$NAME] KO sur $URL — relance via $STARTER" >> "$LOG"
sh "$BASE/$STARTER"
# Verification avec patience (jusqu'a 5 essais = ~15s, le demarrage uvicorn peut etre lent)
if wait_health "$URL" 5; then
echo "$TS [$NAME] relance OK" >> "$LOG"
else
echo "$TS [$NAME] ECHEC relance — toujours muet apres ~15s" >> "$LOG"
fi
}
check_and_restart "api" "http://127.0.0.1:8765/api/health" "start_api.sh"
check_and_restart "mcp" "http://127.0.0.1:8766/health" "start_mcp.sh"