mirror of
https://git.j0bot.ch/admin_j0bot/ploxion-bion.git
synced 2026-11-29 06:02:07 +00:00
synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
commit
51cf4c2c21
21
README.md
Normal file
21
README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 🧬 Bion
|
||||||
|
|
||||||
|
Un vrai bion WebAssembly (109 octets) exécuté directement dans le navigateur — add + fib en WASM, déterministe bit-exact. La forme des artefacts qui partent en prod.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `bion` |
|
||||||
|
| fournit | `wasm` `bion` `compute` |
|
||||||
|
| bions qu'il nomme | `jOSApps` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/bion/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=bion — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre bion` (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
|
||||||
88
app.blade.php
Normal file
88
app.blade.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{{-- PL0XION bion — un VRAI BION WASM (RS-7 : « on n'enverra en prod que des bions
|
||||||
|
ultra-optimisés en WASM ou des trucs qui run sur un core directement »). Ce
|
||||||
|
ploxion charge un module WebAssembly de 109 OCTETS, encodé à la main et TESTÉ
|
||||||
|
(add + fib), et l'exécute DIRECTEMENT dans ton navigateur — pas d'interprète,
|
||||||
|
pas de lib. Déterministe : même entrée → même sortie bit-exact = un tsoin.
|
||||||
|
C'est la forme des artefacts prod : compilés, minuscules, vérifiables.
|
||||||
|
window.jOSApps['bion']. mount(c, ctx) -> { unmount }. --}}
|
||||||
|
<style>
|
||||||
|
.bi { display:flex; flex-direction:column; height:100%; background:radial-gradient(circle at 50% 0%, rgba(18,30,24,.6), #05070a 78%);
|
||||||
|
color:rgba(224,234,228,.92); font-family:ui-sans-serif,system-ui,sans-serif; font-size:.84rem; }
|
||||||
|
.bi__bar { flex:0 0 auto; display:flex; align-items:center; gap:9px; padding:9px 12px; border-bottom:1px solid rgba(120,210,160,.2); flex-wrap:wrap; }
|
||||||
|
.bi__t { font-weight:700; letter-spacing:.03em; color:rgba(150,230,180,.95); }
|
||||||
|
.bi__tag { font-size:.6rem; font-family:ui-monospace,monospace; padding:2px 8px; border-radius:20px; background:rgba(120,210,160,.18); color:rgba(170,235,190,.95); }
|
||||||
|
.bi__body { flex:1; min-height:0; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:12px; }
|
||||||
|
.bi__card { border:1px solid rgba(120,210,160,.18); border-radius:12px; padding:12px 13px; background:rgba(14,24,18,.55); }
|
||||||
|
.bi__h { font-weight:700; color:#fff; font-size:.86rem; margin-bottom:4px; }
|
||||||
|
.bi__d { font-size:.74rem; color:rgba(200,214,206,.85); line-height:1.45; }
|
||||||
|
.bi__d b { color:rgba(170,235,190,.95); }
|
||||||
|
.bi__run { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:9px; }
|
||||||
|
.bi__run label { font-size:.72rem; color:rgba(190,210,200,.85); display:flex; align-items:center; gap:5px; }
|
||||||
|
.bi__run input { width:62px; padding:4px 7px; border-radius:7px; border:1px solid rgba(120,210,160,.3); background:rgba(8,16,11,.7); color:#fff; font-family:ui-monospace,monospace; font-size:.8rem; }
|
||||||
|
.bi__btn { cursor:pointer; font-size:.74rem; padding:5px 12px; border-radius:8px; font-family:inherit; font-weight:600;
|
||||||
|
border:1px solid rgba(120,210,160,.5); background:rgba(40,120,80,.3); color:#dfffe9; }
|
||||||
|
.bi__btn:hover { background:rgba(40,120,80,.5); color:#fff; }
|
||||||
|
.bi__out { font-family:ui-monospace,monospace; font-size:.86rem; color:rgba(170,235,190,.98); padding:4px 10px; border-radius:7px; background:rgba(40,120,80,.18); }
|
||||||
|
.bi__bytes { font-family:ui-monospace,monospace; font-size:.6rem; color:rgba(150,200,170,.55); word-break:break-all; line-height:1.4; margin-top:6px; }
|
||||||
|
.bi__st { font-size:.72rem; }
|
||||||
|
.bi__st.ok { color:rgba(150,225,170,.95); } .bi__st.ko { color:rgba(255,150,110,.95); }
|
||||||
|
.bi__foot { flex:0 0 auto; padding:6px 12px; border-top:1px solid rgba(120,210,160,.14); font-size:.63rem; color:rgba(170,200,180,.6); }
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
// Module WASM 109 octets, encodé à la main + TESTÉ (add(2,3)=5, fib(10)=55, fib(20)=6765).
|
||||||
|
var B64 = 'AGFzbQEAAAABDAJgAn9/AX9gAX8BfwMDAgABBw0CA2FkZAAAA2ZpYgABCkECBwAgACABags3AQR/QQAhAUEBIQJBACEDAkADQCADIABODQEgASACaiEEIAIhASAEIQIgA0EBaiEDDAALCyABCw==';
|
||||||
|
function bytes() { var bin = atob(B64), a = new Uint8Array(bin.length); for (var i = 0; i < bin.length; i++) a[i] = bin.charCodeAt(i); return a; }
|
||||||
|
|
||||||
|
function mount(container, ctx) {
|
||||||
|
container.innerHTML =
|
||||||
|
'<div class="bi">'
|
||||||
|
+ ' <div class="bi__bar"><span class="bi__t">🧬 Bion · WASM</span><span class="bi__tag" data-size>… octets</span><span class="bi__tag">déterministe</span><span class="bi__tag">0 lib</span></div>'
|
||||||
|
+ ' <div class="bi__body">'
|
||||||
|
+ ' <div class="bi__card"><div class="bi__d">Ceci est un <b>vrai module WebAssembly</b> encodé à la main, exécuté <b>directement</b> par le moteur de ton navigateur — pas d’interprète, pas de dépendance. Même entrée → même sortie <b>bit-exact</b> = un tsoin. C’est la forme des artefacts qui partent en <b>prod</b> : compilés, minuscules, vérifiables.</div>'
|
||||||
|
+ ' <div class="bi__st" data-load>chargement du bion…</div></div>'
|
||||||
|
+ ' <div class="bi__card"><div class="bi__h">fib(n) — exécuté en WASM</div>'
|
||||||
|
+ ' <div class="bi__d">Suite de Fibonacci, calculée par une boucle dans le module (pas en JS).</div>'
|
||||||
|
+ ' <div class="bi__run"><label>n <input type="number" data-n value="20" min="0" max="46"></label>'
|
||||||
|
+ ' <button class="bi__btn" data-fib>calculer</button><span class="bi__out" data-fibout>—</span></div></div>'
|
||||||
|
+ ' <div class="bi__card"><div class="bi__h">add(a, b) — exécuté en WASM</div>'
|
||||||
|
+ ' <div class="bi__run"><label>a <input type="number" data-a value="2"></label>'
|
||||||
|
+ ' <label>b <input type="number" data-b value="3"></label>'
|
||||||
|
+ ' <button class="bi__btn" data-add>additionner</button><span class="bi__out" data-addout>—</span></div>'
|
||||||
|
+ ' <div class="bi__bytes" data-hex></div></div>'
|
||||||
|
+ ' </div>'
|
||||||
|
+ ' <div class="bi__foot">Un bion = l’unité. Ici, la plus petite forme exécutable : 109 octets de WASM qui tournent partout, à l’identique.</div>'
|
||||||
|
+ '</div>';
|
||||||
|
|
||||||
|
var elLoad = container.querySelector('[data-load]'), api = null, alive = true;
|
||||||
|
var bs = bytes();
|
||||||
|
container.querySelector('[data-size]').textContent = bs.length + ' octets';
|
||||||
|
container.querySelector('[data-hex]').textContent = Array.prototype.map.call(bs, function (b) { return ('0' + b.toString(16)).slice(-2); }).join(' ');
|
||||||
|
|
||||||
|
WebAssembly.instantiate(bs).then(function (res) {
|
||||||
|
if (!alive) return;
|
||||||
|
api = res.instance.exports;
|
||||||
|
// auto-test au chargement (vérifiable, honnête) : fib(10)=55, add(2,3)=5
|
||||||
|
var ok = api.fib(10) === 55 && api.add(2, 3) === 5;
|
||||||
|
elLoad.className = 'bi__st ' + (ok ? 'ok' : 'ko');
|
||||||
|
elLoad.textContent = ok ? '✓ bion chargé et vérifié (fib(10)=55, add(2,3)=5) — il tourne.' : '✗ le bion ne passe pas son auto-test';
|
||||||
|
}).catch(function (e) {
|
||||||
|
if (alive) { elLoad.className = 'bi__st ko'; elLoad.textContent = '✗ WASM indisponible : ' + e.message; }
|
||||||
|
});
|
||||||
|
|
||||||
|
container.querySelector('[data-fib]').addEventListener('click', function () {
|
||||||
|
if (!api) return; var n = Math.max(0, Math.min(46, +container.querySelector('[data-n]').value || 0));
|
||||||
|
container.querySelector('[data-fibout]').textContent = 'fib(' + n + ') = ' + (api.fib(n) >>> 0);
|
||||||
|
});
|
||||||
|
container.querySelector('[data-add]').addEventListener('click', function () {
|
||||||
|
if (!api) return; var a = +container.querySelector('[data-a]').value || 0, b = +container.querySelector('[data-b]').value || 0;
|
||||||
|
container.querySelector('[data-addout]').textContent = a + ' + ' + b + ' = ' + (api.add(a, b) | 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
return { unmount: function () { alive = false; container.innerHTML = ''; } };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
window.jOSApps['bion'] = { manifest: { id: 'bion', name: 'Bion', icon: '🧬' }, mount: mount };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user