11 Commits

Author SHA1 Message Date
Codex Local c5f921243e feat: wire vLLM + TEI embedding backend
- LLM_API_KEY support across all LLM calls
- TEI embedding server (bge-m3, :9500)
- Hierarchical AGENTS.md documentation
- CLAUDE.md updated for new architecture
2026-04-08 09:41:51 +02:00
L'électron rare 0e56602f35 feat: lots 515-520 — mascarade full integration (/v1/chat/completions, agents, KB, providers, orchestrate)
Lot 515: llm-client uses /v1/chat/completions (OpenAI-compat, public, no auth)
  - All models routed through mascarade (not just non-Ollama)
  - RouteLLM still skips mascarade for trivial messages
Lot 516: /agent list|run — list and execute mascarade agents from chat
Lot 517: /kb search — query mascarade knowledge base
Lot 518: /provider list|metrics — view LLM providers + routing metrics
Lot 519: /orchestrate — multi-agent parallel orchestration
Lot 520: Deploy

196 commands. 2 test regressions (smoke test mock incompatible with new routing, RAG pre-existing).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 02:38:41 +01:00
L'électron rare 7c39e91e94 lot-20: deep audit, refactoring, UI Minitel, Discord bot, storage tests
Refactoring:
- ws-chat.ts 1449→803 LOC + 3 modules (ws-ollama, ws-multimodal, ws-persona-router)
- app.ts 1325→664 LOC + 4 route files (session, personas, node-engine, chat-history)

Security (9 P0/P1 fixes):
- PDF handler semaphore double-release
- Path traversal voice-sample (3 endpoints)
- Analytics endpoint auth (ops:read)
- crypto.randomBytes for createId
- Timing-safe verifyPassword
- applyPatches type guard
- ErrorBoundary React
- Accessibility role=log
- Async I/O (writeFileSync→fsp.writeFile)

UI Minitel globale:
- MinitelFrame wraps tout (login inclus)
- Animation modem à l'ouverture
- Pseudo sans auth, easter egg 3615 ULLA
- Barre fonctionnelle Sommaire/Chat/Retour/Personas/Fin
- Menu sommaire overlay, PersonaList arborescente par modèle
- Responsive 4 breakpoints (480/768/1200/1600px)

Infrastructure:
- SearXNG dans docker-compose (profile v2)
- Discord Pharmacius bot (scripts/discord-pharmacius.js + profile discord)
- Perf middleware + /api/v2/perf endpoint
- ops/v2/perf-monitor.js TUI
- scripts/bench-embeddings.js

Tests:
- Storage package: 50 tests (mock pool, 0→50 coverage)
- Total: 173 tests, 0 fail

Audit: 0 security findings, 20 perf patterns, debt score 80/100

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 13:42:04 +01:00
L'électron rare adb84c8d2c phase-6: Docling PDF, SearXNG search, SDXL Lightning 4step
## PDF extraction: Docling remplace pdf-parse
- scripts/extract_pdf_docling.py: Docling → Markdown (fallback PyMuPDF)
- ws-chat.ts: PDF → temp file → Python script → JSON result
- Suppression lazy import pdf-parse

## Recherche web: SearXNG first
- SearXNG (localhost:8889) interrogé en premier
- Fallback DuckDuckGo JSON API si SearXNG indisponible
- SEARXNG_URL configurable via .env

## ComfyUI: SDXL Lightning 4step
- 4 steps au lieu de 20 → génération ~2-3s sur RTX 4090
- Checkpoint configurable via COMFYUI_CHECKPOINT
- dpmpp_sde + karras scheduler (optimisé lightning)

## Dockerfile
- extract_pdf_docling.py copié dans l'image

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:29:37 +01:00
L'électron rare 33b5f20737 feat: /imagine ComfyUI + Sherlock (web) + Picasso (images)
## ComfyUI intégration
- generateImage(): workflow SDXL txt2img via ComfyUI API (port 8188)
- /imagine <description>: génère une image, broadcast base64 PNG
- Poll /history pour completion, timeout 120s
- Images affichées inline dans le chat (max 512px)

## Nouvelles personas
- Sherlock (mistral:7b): détective, recherche web, analyse de sources
- Picasso (qwen3.5:9b): artiste visuel, propose des prompts /imagine

## Pharmacius routing enrichi
- Recherche web → @Sherlock
- Création image → @Picasso

## Frontend
- ChatMsg: imageData/imageMime fields + type "image"
- ChatMessage: rendu inline <img> base64
- Tab completion: /imagine ajouté

Total: 25 personas + Pharmacius = 26

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:22:34 +01:00
L'électron rare 97060f7fc1 feat: chat texte nettoyé, inter-persona @mention, upgrade qwen3:8b
## Chat texte nettoyé
- MIC/TTS retirés (déplacés dans #/voice)
- Upload fichiers + replay audio conservés
- Interface texte pure

## Inter-persona dialogue
- Personas peuvent @mentionner d'autres personas
- Persona mentionnée répond automatiquement (délai 2s)
- Profondeur max 3 pour éviter boucles infinies
- Ex: Schaeffer dit "comme @Radigue le disait..." → Radigue répond

## Upgrade modèles
- Personas: qwen3:4b → qwen3:8b (2x perf, 5.2 GB)
- Vision: minicpm-v → qwen3-vl:8b (Qwen3 VL, 6.1 GB)
- .env.example: VISION_MODEL=qwen3-vl:8b recommandé

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:06:43 +01:00
L'électron rare ccf376b1b8 lot-14.3: historique conversations, vision minicpm-v, config
## Historique conversations
- GET /api/v2/chat/history : liste dates avec count/size
- GET /api/v2/chat/history/:date : messages paginés (limit/offset)
- ChatHistory.tsx : date picker, log viewer IRC-style, recherche texte
- Nav: lien "Historique" ajouté

## Vision
- ws-chat.ts: VISION_MODEL configurable (défaut: minicpm-v)
- minicpm-v installé sur Ollama (vrai modèle vision)
- .env.example: VISION_MODEL documenté

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:01:29 +01:00
L'électron rare 7108abe338 lot-13: Ollama import, training dashboard React, GPU passthrough
## Intégration Ollama
- scripts/ollama-import-adapter.sh : import LoRA adapter → modèle Ollama
  (Modelfile FROM/ADAPTER, ollama create, vérification)
- scripts/ollama-import.js : wrapper Node.js CLI
- Worker deploy_api : exécution réelle via ollama-import-adapter.sh

## Dashboard Training React
- TrainingDashboard.tsx : overview cards, runs table, quick actions
- api.ts : getTrainingRuns() + getDPOStats()
- App.tsx : route #/training
- Nav.tsx : lien Training (admin/operator)

## GPU Passthrough Docker
- docker-compose.yml : deploy.resources.reservations.devices (nvidia)
- Volume venv host monté read-only dans le worker
- Dockerfile : bash ajouté, scripts Python copiés dans l'image

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 18:41:09 +01:00
L'électron rare 7b5c3fa795 lot-12: training pipeline réel (Unsloth/TRL + eval)
## Scripts Python
- scripts/train_unsloth.py: wrapper Unsloth/TRL pour fine-tuning LoRA/QLoRA
  Supporte JSONL multi-format (instruction/output, messages, text)
  Output JSON sur stdout avec métriques (loss, duration)
- scripts/eval_model.py: évaluation modèle sur set de prompts
  Score F1 token overlap, support adapter LoRA
  Output JSON détaillé (réponses, scores, tokens)

## Worker V2
- Training nodes (lora_training, qlora_training): exécution réelle via
  child_process → train_unsloth.py (fallback stub si dry-run)
- Evaluation nodes (benchmark, prompt_test): exécution réelle via
  child_process → eval_model.py (fallback stub si pas de prompts)
- Config: PYTHON_BIN, SCRIPTS_DIR, TRAINING_TIMEOUT_MS

## Prérequis serveur (kxkm-ai)
- Python 3.12 + venv avec PyTorch 2.10+cu128, Unsloth 2026.3.4,
  TRL 0.24.0, transformers 5.2, peft 0.18, bitsandbytes 0.49

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:34:47 +01:00
L'électron rare 71bdb8f418 fix: V2 API port mapping (V2_API_PORT=4180, not PORT=3334)
The V2 API server reads V2_API_PORT (default 4180), not PORT.
Fix docker-compose port mapping and healthcheck accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 14:50:16 +01:00
L'électron rare 0113fd33d6 ops: docker-compose Ollama natif, .env.example, .gitignore secrets
- Ollama devient un profil optionnel (--profile ollama), par défaut
  les containers utilisent l'Ollama natif du host via extra_hosts
- OLLAMA_URL configurable via .env (défaut: host.docker.internal:11434)
- Variables admin (ADMIN_BOOTSTRAP_TOKEN, ADMIN_ALLOWED_SUBNETS) ajoutées
  au service V2 api
- .env.example créé avec toutes les variables documentées
- .gitignore: .env et .env.* exclus pour protéger les secrets

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 13:53:14 +01:00