synchro du labo (0bf0da65) : README.md, app.blade.php

This commit is contained in:
cloudion
2026-11-03 22:42:22 +00:00
commit b251443c2c
2 changed files with 276 additions and 0 deletions

21
README.md Normal file
View File

@@ -0,0 +1,21 @@
# 📥 Réception
Reçois des ploxions d'autres LLM : parse, valide, teste en bac à sable, n'accepte que les bons.
| | |
| --- | --- |
| id | `reception` |
| fournit | `reception` `intake` `validation` |
| bions qu'il nomme | `jOSApps` `jOSForge` |
| fichiers | `README.md` `app.blade.php` |
| dans le labo | `resources/views/ploxions/reception/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=reception — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre reception` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

255
app.blade.php Normal file
View File

@@ -0,0 +1,255 @@
{{-- PL0XI0N reception — la STATION DE RÉCEPTION des ploxions venus d'AUTRES LLM
(RS-7 : « prépare-toi à recevoir des ploxions d'autres LLM, c'est pas beau à
voir mais courage »). On colle ce qu'un LLM a produit (specs JSON au format
PLOXION-SPEC §9, même bordélique/markdown) → PARSING TOLÉRANT → VALIDATION
contre le contrat → TEST EN BAC À SABLE (materialize + mount + unmount isolés,
sans polluer) → TRIAGE → on n'ACCEPTE (forge via jOSForge) que ceux qui passent.
La porte d'entrée du xerboxion : rien d'invalide n'entre. 100% client-side.
window.jOSApps['reception']. mount->{unmount}. --}}
<style>
.rc { display:flex; flex-direction:column; height:100%; background:#0a0c10; color:#e7eaf2; font-family:ui-sans-serif,system-ui,sans-serif; font-size:.82rem; }
.rc__bar { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid rgba(120,200,180,.2); }
.rc__t { font-weight:700; color:rgba(150,230,200,.95); } .rc__sub { font-size:.66rem; color:rgba(180,210,200,.6); }
.rc__body { flex:1; min-height:0; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:12px; }
.rc__card { border:1px solid rgba(120,200,180,.22); border-radius:12px; padding:11px; background:rgba(255,255,255,.02); }
.rc__h { font-size:.64rem; text-transform:uppercase; letter-spacing:.05em; color:rgba(150,220,200,.65); margin-bottom:7px; }
.rc textarea { width:100%; box-sizing:border-box; min-height:130px; resize:vertical; background:rgba(0,0,0,.34); border:1px solid rgba(120,200,180,.3);
border-radius:9px; color:#dff; padding:9px; font:0.72rem ui-monospace,monospace; outline:none; }
.rc__row { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.rc__b { cursor:pointer; font-size:.76rem; padding:6px 14px; border-radius:8px; border:1px solid rgba(120,210,180,.55); background:rgba(30,90,70,.4); color:#cffce8; font-weight:700; }
.rc__b:hover { background:rgba(40,120,90,.5); }
.rc__b.ghost { background:none; border-color:rgba(150,180,200,.3); color:rgba(210,225,230,.8); font-weight:600; }
.rc__stat { font-size:.66rem; color:rgba(180,210,200,.6); margin-left:auto; font-family:ui-monospace,monospace; }
.rc__it { display:flex; align-items:center; gap:9px; padding:8px 10px; border:1px solid rgba(120,200,180,.16); border-radius:9px; background:rgba(16,24,22,.5); margin-bottom:6px; }
.rc__ig { font-size:1.2rem; } .rc__in { font-weight:600; } .rc__id { font-size:.6rem; color:rgba(180,210,200,.55); font-family:ui-monospace,monospace; }
.rc__v { font-size:.6rem; padding:1px 8px; border-radius:11px; border:1px solid; white-space:nowrap; }
.rc__v.ok { color:#9fe8c4; border-color:rgba(120,230,170,.5); } .rc__v.warn { color:#ffd98a; border-color:rgba(240,200,120,.45); } .rc__v.bad { color:#ff9a9a; border-color:rgba(255,140,140,.45); }
.rc__sp { flex:1; } .rc__why { font-size:.62rem; color:rgba(200,210,210,.55); }
.rc__acc { cursor:pointer; font-size:.68rem; padding:3px 11px; border-radius:7px; border:1px solid rgba(120,210,180,.55); background:rgba(40,110,80,.35); color:#cffce8; }
.rc__acc[disabled] { opacity:.4; cursor:default; }
.rc__empty { font-size:.72rem; color:rgba(190,210,205,.45); text-align:center; padding:14px; }
</style>
<script>
(function () {
'use strict';
function esc(s) { return window.jOSb.esc(s); }
function mount(container, ctx) {
var F = window.jOSForge;
var cand = []; // candidats analysés
container.innerHTML =
'<div class="rc">'
+ ' <div class="rc__bar"><span class="rc__t">📥 Réception</span><span class="rc__sub">— ploxions d\'autres LLM (PLOXION-SPEC §9)</span></div>'
+ ' <div class="rc__body">'
+ ' <div class="rc__card"><div class="rc__h">colle ce qu\'un LLM a produit (spec, tableau de specs, JSONL ou array PHP — même en bloc ```)</div>'
+ ' <textarea data-in placeholder=\'[{"name":"Mon Ploxion","icon":"✦","template":"horloge","params":{}}, …]\'></textarea>'
+ ' <div class="rc__row"><button class="rc__b" data-scan>🔎 analyser</button>'
+ ' <button class="rc__b ghost" data-accept-all>✓ accepter tous les valides</button>'
+ ' <span class="rc__stat" data-stat></span></div></div>'
+ ' <div class="rc__card"><div class="rc__h">triage</div><div data-list><div class="rc__empty">colle des ploxions et clique « analyser »</div></div></div>'
+ ' </div>'
+ '</div>';
var elIn = container.querySelector('[data-in]'), elList = container.querySelector('[data-list]'), elStat = container.querySelector('[data-stat]');
if (!F) { elList.innerHTML = '<div class="rc__empty">moteur de forge (jOSForge) indisponible.</div>'; return { unmount: function () { container.innerHTML = ''; } }; }
// ---- array PHP → objet (RS-7 a collé du ['id' => 'x', 'members' => [...]] et on
// répondait « rien de valide » ; maintenant on convertit). Tokenise (chaînes
// 'simples'/"doubles" avec échappements) puis recompose : un groupe [ ] ou
// array( ) qui contient => à SA profondeur devient un objet, sinon un tableau.
// Virgules traînantes tolérées, barewords → strings, wrap [] si pas de crochets.
function phpToJson(raw) {
var s = String(raw || '').trim()
.replace(/^<\?php\s*/i, '')
.replace(/^(return|echo)\s+/i, '')
.replace(/^\$[A-Za-z_]\w*\s*=\s*/, '')
.replace(/;\s*$/, '');
if (s.indexOf('=>') < 0) return null; // pas un array PHP associatif
var toks = [], i = 0, n = s.length, DQ = { n: '\n', t: '\t', r: '\r', '"': '"', '\\': '\\', '/': '/', '$': '$' };
while (i < n) {
var c = s.charAt(i);
if (c === "'" || c === '"') { // chaîne (échappements gérés)
var q = c, buf = ''; i++;
while (i < n && s.charAt(i) !== q) {
if (s.charAt(i) === '\\' && i + 1 < n) {
var e2 = s.charAt(i + 1);
if (q === "'") buf += (e2 === "'" || e2 === '\\') ? e2 : '\\' + e2;
else buf += (DQ[e2] != null ? DQ[e2] : '\\' + e2);
i += 2;
} else { buf += s.charAt(i); i++; }
}
if (i >= n) return null; // chaîne jamais fermée
i++; toks.push({ t: 'str', v: buf }); continue;
}
if (s.substr(i, 2) === '=>') { toks.push({ t: 'arrow' }); i += 2; continue; }
var am = /^array\s*\(/i.exec(s.slice(i));
if (am) { toks.push({ t: 'open' }); i += am[0].length; continue; }
if (c === '[' || c === '(') { toks.push({ t: 'open' }); i++; continue; }
if (c === ']' || c === ')') { toks.push({ t: 'close' }); i++; continue; }
if (c === ',') { toks.push({ t: 'comma' }); i++; continue; }
if (/\s/.test(c)) { i++; continue; }
var mm = /^[^,\[\]()\s]+/.exec(s.slice(i)); // atome : nombre, true/false/null, bareword
if (!mm) return null;
toks.push({ t: 'atom', v: mm[0] }); i += mm[0].length;
}
if (!toks.length) return null;
if (toks[0].t !== 'open') { toks.unshift({ t: 'open' }); toks.push({ t: 'close' }); } // wrap si à nu
var pos = 0;
function val() {
var tk = toks[pos];
if (!tk) throw new Error('fin inattendue');
if (tk.t === 'open') return group();
if (tk.t === 'str') { pos++; return JSON.stringify(tk.v); }
if (tk.t === 'atom') {
pos++; var a = tk.v.toLowerCase();
if (a === 'true' || a === 'false') return a;
if (a === 'null') return 'null';
if (/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(tk.v)) return tk.v;
return JSON.stringify(tk.v); // bareword → string
}
throw new Error('token inattendu');
}
function group() {
pos++; // consomme le open
var ents = [], isObj = false;
while (toks[pos] && toks[pos].t !== 'close') {
if (toks[pos].t === 'comma') { pos++; continue; } // virgules traînantes/doubles OK
var v = val(), k = null;
if (toks[pos] && toks[pos].t === 'arrow') { pos++; isObj = true; k = (v.charAt(0) === '"') ? v : JSON.stringify(v); v = val(); }
ents.push({ k: k, v: v });
}
if (!toks[pos]) throw new Error('groupe non fermé');
pos++; // consomme le close
if (!isObj) return '[' + ents.map(function (e) { return e.v; }).join(',') + ']';
var auto = 0; // clés implicites PHP (mix 'k' => v et v)
return '{' + ents.map(function (e) { return (e.k != null ? e.k : JSON.stringify(String(auto++))) + ':' + e.v; }).join(',') + '}';
}
try {
var vals = [];
while (pos < toks.length) { // tolère plusieurs arrays collés à la suite
if (toks[pos].t === 'comma') { pos++; continue; }
vals.push(JSON.parse(val()));
}
if (!vals.length) return null;
return vals.length === 1 ? vals[0] : vals;
} catch (e) { return null; }
}
// ---- normalisation : une spec « cubion » (id/name + members, le format que collent
// les autres LLM) → template cubion de la forge (grille auto : 2 côte-à-côte,
// 4 en quadrants… la forme est la nature). Si pas exploitable, on rend tel quel
// et le triage expliquera POURQUOI.
function normalize(s) {
if (!s || typeof s !== 'object' || s.template || !Array.isArray(s.members)) return s;
if (!s.id && !s.name) return s;
var ids = s.members.map(function (m) { return typeof m === 'string' ? m : ((m && (m.id || m.ploxion || m.app)) || ''); })
.map(function (x) { return String(x).trim(); }).filter(Boolean);
if (!ids.length) return s;
var cols = Math.min(4, Math.ceil(Math.sqrt(ids.length))), rows = Math.min(4, Math.ceil(ids.length / cols));
return {
id: s.id, name: s.name || s.id, icon: s.icon || '▦',
desc: s.description || s.desc || ('cubion : ' + ids.join(' + ')),
template: 'cubion',
params: { cols: cols, rows: rows, cells: ids.map(function (id, k) { return { x: k % cols, y: Math.floor(k / cols), ploxion: id }; }) }
};
}
// ---- parsing TOLÉRANT (le messy : fences markdown, tableau, objet, JSONL, array PHP) ----
function parse(raw) {
raw = (raw || '').trim();
raw = raw.replace(/^```[a-zA-Z]*\s*/g, '').replace(/```\s*$/g, '').trim(); // enlève les fences
var out = [];
try {
var j = JSON.parse(raw);
if (Array.isArray(j)) out = j;
else if (j && Array.isArray(j.ploxions)) out = j.ploxions;
else if (j && Array.isArray(j.specs)) out = j.specs;
else if (j && typeof j === 'object') out = [j];
} catch (e) {
// JSONL : un objet JSON par ligne
raw.split('\n').forEach(function (l) { l = l.trim().replace(/,$/, ''); if (l.charAt(0) === '{') { try { var o = JSON.parse(l); if (o && typeof o === 'object') out.push(o); } catch (e2) {} } });
}
if (!out.length) { // dernier recours : array PHP
var p = phpToJson(raw);
if (p) {
if (Array.isArray(p)) out = p;
else if (Array.isArray(p.ploxions)) out = p.ploxions;
else if (Array.isArray(p.specs)) out = p.specs;
else out = [p];
}
}
return out.filter(function (x) { return x && typeof x === 'object'; }).map(normalize);
}
// ---- TEST BAC À SABLE : materialize + mount + unmount, isolé, nettoyé ----
function sandbox(spec) {
if (!spec.name && !spec.id) return { ok: false, reason: 'ni name ni id' };
if (!spec.template) return { ok: false, reason: Array.isArray(spec.members) ? 'on dirait un cubion (members présents) mais aucun id de ploxion exploitable dedans' : 'template manquant (ex: "template":"horloge" — ou "members":[…] pour un cubion)' };
if (spec.template === 'custom') return { ok: false, warn: true, reason: 'custom — nécessite un app.blade.php (pas forgeable ici)' };
if (F.templates().indexOf(spec.template) < 0) return { ok: false, reason: 'template inconnu : ' + spec.template };
var tid = '__rcpt-' + Math.random().toString(36).slice(2, 9), hidden = null;
try {
var clone = JSON.parse(JSON.stringify(spec)); clone.id = tid;
if (!F.materialize(clone)) throw new Error('materialize a échoué');
var app = window.jOSApps[tid];
if (!app || typeof app.mount !== 'function') throw new Error('aucun mount enregistré');
hidden = document.createElement('div'); hidden.style.cssText = 'position:absolute;left:-99999px;top:0;width:320px;height:220px'; document.body.appendChild(hidden);
var inst = app.mount(hidden, { win: { app: tid }, config: spec.params || {} });
if (!inst || typeof inst.unmount !== 'function') { try { inst && inst.unmount && inst.unmount(); } catch (e) {} throw new Error('mount ne renvoie pas { unmount }'); }
inst.unmount();
var note = null;
if (spec.template === 'cubion') { // cubion valide, mais on signale les membres pas encore branchés ICI
var miss = ((spec.params && spec.params.cells) || []).map(function (cl) { return cl && cl.ploxion; })
.filter(function (idp) { return idp && !(window.jOSApps || {})[idp]; });
if (miss.length) note = 'membres pas encore branchés ici : ' + miss.join(', ');
}
return note ? { ok: true, reason: note } : { ok: true };
} catch (e) { return { ok: false, reason: (e && e.message) || 'erreur au montage' }; }
finally {
if (hidden) try { hidden.remove(); } catch (e) {}
try { delete window.jOSApps[tid]; } catch (e) {}
if (window.__PLOXIONS__) window.__PLOXIONS__ = window.__PLOXIONS__.filter(function (x) { return x.id !== tid; });
}
}
function scan() {
var specs = parse(elIn.value);
if (!specs.length) {
cand = [];
// erreur UTILE : si ça ressemble à du PHP, on dit ce qui coince au lieu de « rien de valide »
elStat.textContent = /=>/.test(elIn.value || '')
? 'on dirait un array PHP — la conversion a échoué (quote jamais fermée ou crochet manquant ?)'
: 'rien de valide à parser';
render(); return;
}
cand = specs.map(function (s) { var v = sandbox(s); return { spec: s, v: v, accepted: false }; });
var ok = cand.filter(function (c) { return c.v.ok; }).length;
elStat.textContent = cand.length + ' reçus · ' + ok + ' valides · ' + (cand.length - ok) + ' rejetés';
render();
}
function accept(c) {
if (!c.v.ok || c.accepted) return;
try { F.add(JSON.parse(JSON.stringify(c.spec))); c.accepted = true; render(); } catch (e) {}
}
function render() {
if (!cand.length) { elList.innerHTML = '<div class="rc__empty">colle des ploxions et clique « analyser »</div>'; return; }
elList.innerHTML = cand.map(function (c, i) {
var s = c.spec, v = c.v, cls = v.ok ? 'ok' : (v.warn ? 'warn' : 'bad'), tag = v.ok ? '✓ valide' : (v.warn ? '⚠ à la main' : '✗ rejeté');
return '<div class="rc__it"><span class="rc__ig">' + esc(s.icon || '✦') + '</span>'
+ '<div><div class="rc__in">' + esc(s.name || s.id || '?') + '</div><div class="rc__id">' + esc(s.template || '∅') + (v.reason ? ' · <span class="rc__why">' + esc(v.reason) + '</span>' : '') + '</div></div>'
+ '<span class="rc__sp"></span><span class="rc__v ' + cls + '">' + tag + '</span>'
+ (v.ok ? '<button class="rc__acc" data-acc="' + i + '"' + (c.accepted ? ' disabled' : '') + '>' + (c.accepted ? '✓ accepté' : 'accepter') + '</button>' : '')
+ '</div>';
}).join('');
elList.querySelectorAll('[data-acc]').forEach(function (b) { b.addEventListener('click', function () { accept(cand[+b.getAttribute('data-acc')]); }); });
}
container.querySelector('[data-scan]').addEventListener('click', scan);
container.querySelector('[data-accept-all]').addEventListener('click', function () { cand.forEach(accept); });
return { unmount: function () { container.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps['reception'] = { manifest: { id: 'reception', name: 'Réception', icon: '📥' }, mount: mount };
})();
</script>