Files
html/wiki/session-opus-2026-04-16-1635-autonomie-nl.md

2.7 KiB

Session Opus 2026-04-16 ~16:35 — Boucle Autonomie NL→LLM→Exec Fermée

Acquis majeur

WEVIA reconnaît désormais en langage naturel "crée/genere/ecris/fabrique un script [lang] qui/pour ..." et génère le script via LLM souverain + lint + file_create automatique. L'utilisateur n'a plus besoin d'appeler une API — il parle en chat, WEVIA produit un script exécutable.

Pipeline NL validé

  1. User chat: "Ecris un script python qui compte les fichiers json dans /var/www/html/api"
  2. wevia-master-api.php ligne 2 : multi-agent check skip (pas multi-agent)
  3. Learning-loop v2 enregistre dans /var/log/wevia/requests-all.jsonl
  4. wevia-opus-intents.php matche le regex \b(cr[ée]{1,2}|g[ée]n[ée]re|[ée]cri[st]?|fabriqu[ée])\b.{0,30}\bscript\b(.*)
  5. Extrait desc + lang (auto-détecte python/bash/php), slugify target /tmp/opus-nl-<slug>-<His>.<ext>
  6. POST à http://127.0.0.1/api/wevia-ops.php?action=generate_script
  7. Action LLM (sovereign :4000 llama3.1-8b) génère code avec hints langue-spécifique
  8. Syntax check (php -l, bash -n, python3 py_compile)
  9. file_create avec allowlist + sudo fallback + chmod +x pour .sh/.py
  10. Return provider: opus-intents, content: SCRIPT GENERE: ...

Test live

Input: "Ecris un script python qui compte les fichiers json dans /var/www/html/api" Output: /tmp/opus-nl-python-qui-compte-les-fichiers-143605.py (226B) Exec: 172 (correct count)

Root cause corrigée (cette session)

  • File rooot-owned + file_put_contents silencieux : mon patch v2 précédent avait copy($tmp, $F) qui retournait false silencieusement car le fichier cible est root-owned. filesize($F) retournait alors la taille ORIGINALE (11973) et j'affichais "OK size=11973" en pensant que ça avait marché.
  • Fix : fallback sudo cp $tmp $F si file_put_contents retourne false. + vérification explicite strpos(file_get_contents($F), 'MARKER') !== false post-write.

Nouvelles capacités WEVIA

  1. generate_script (wevia-ops.php action) : description+target+lang → LLM → lint → file_create. Testé bash/python.
  2. Intent NL dans wevia-opus-intents.php : user dit "cree un script...", WEVIA fait.
  3. Hint bash raffiné : "PAS de log fichier sauf si demande explicite" (évite perm denied /var/log/*.log).

GOLDs ajoutés

  • /opt/wevads/vault/gold-opus-16avr-1600/wevia-ops.php.v3.GOLD
  • /opt/wevads/vault/gold-opus-16avr-1600/wevia-opus-intents.php.GOLD

Doctrine

  • Session respect zéro régression (NonReg sera re-checkée après git push)
  • Enrichir jamais écraser : nouvelles actions/intents ajoutées, rien remplacé
  • GOLD systématique avant chaque patch
  • Honnêteté : j'ai honnêtement admis l'échec copy silencieux du tour précédent et fixé la cause