synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# ⌨️ Xerminal
|
||||||
|
|
||||||
|
La console du xerboxion — liste les ploxions branchés, interroge le lexique ionique. Historique ↑↓.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
| --- | --- |
|
||||||
|
| id | `xerminal` |
|
||||||
|
| fournit | `console` `repl` `lexique` |
|
||||||
|
| bions qu'il nomme | `jOSApps` `jOSBoxion` `jOSMobile` `jOSPorts` `jOSRecorder` `jOSTerm` `jOSWire` `jOSXui` |
|
||||||
|
| fichiers | `app.blade.php` |
|
||||||
|
| dans le labo | `resources/views/ploxions/xerminal/` (dépôt `my_website2`) |
|
||||||
|
|
||||||
|
## Contribuer
|
||||||
|
|
||||||
|
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=xerminal — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||||
|
- **Dans VS Code** : `xb prendre xerminal` (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
|
||||||
595
app.blade.php
Normal file
595
app.blade.php
Normal file
@@ -0,0 +1,595 @@
|
|||||||
|
{{-- PL0XI0N xerminal — la console du xerboxion. Tape des commandes : liste les
|
||||||
|
ploxions branchés (window.__PLOXIONS__), interroge le lexique ionique, etc.
|
||||||
|
100% client-side, aucune route serveur. Historique (flèches ↑↓).
|
||||||
|
window.jOSApps['xerminal']. mount(c, ctx) -> { unmount }. --}}
|
||||||
|
<style>
|
||||||
|
.xt { display:flex; flex-direction:column; height:100%; background:#05080c;
|
||||||
|
color:rgba(190,235,210,.92); font-family:ui-monospace,'Share Tech Mono',monospace; font-size:.82rem; }
|
||||||
|
.xt__out { flex:1; min-height:0; overflow-y:auto; padding:12px 14px; line-height:1.5; white-space:pre-wrap; word-break:break-word; }
|
||||||
|
.xt__l { color:rgba(190,235,210,.9); }
|
||||||
|
.xt__cmd { color:rgba(120,200,255,.95); }
|
||||||
|
.xt__cmd::before { content:'❯ '; color:rgba(120,220,160,.9); }
|
||||||
|
.xt__err { color:rgba(255,150,150,.9); }
|
||||||
|
.xt__dim { color:rgba(150,180,200,.55); }
|
||||||
|
.xt__in { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:9px 14px; border-top:1px solid rgba(90,200,140,.2); }
|
||||||
|
.xt__prompt { color:rgba(120,220,160,.95); }
|
||||||
|
.xt__f { flex:1; border:0; background:none; outline:none; color:rgba(180,240,210,.96);
|
||||||
|
font-family:inherit; font-size:.84rem; position:relative; z-index:1; }
|
||||||
|
/* suggestion grisée « ghost » alignée sur le texte tapé (span transparent = même largeur, mono) */
|
||||||
|
.xt__ghost { position:absolute; top:0; height:100%; display:flex; align-items:center;
|
||||||
|
pointer-events:none; z-index:0; font-family:inherit; font-size:.84rem; white-space:pre; }
|
||||||
|
.xt__ghost .gt { color:transparent; }
|
||||||
|
.xt__ghost .gs { color:rgba(120,190,150,.42); }
|
||||||
|
.xt__b { cursor:pointer; margin:3px 5px 3px 0; padding:4px 11px; border-radius:7px;
|
||||||
|
border:1px solid rgba(90,200,140,.45); background:rgba(20,42,30,.55); color:rgba(185,242,212,.96);
|
||||||
|
font-family:inherit; font-size:.8rem; }
|
||||||
|
.xt__b:hover { background:rgba(40,92,62,.65); border-color:rgba(120,220,160,.85); }
|
||||||
|
.xt__rec { color:rgba(255,110,110,.95); animation:xtblink 1s steps(2,start) infinite; }
|
||||||
|
@keyframes xtblink { 50% { opacity:.25; } }
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var HKEY = 'xb:xerminal:hist';
|
||||||
|
var LEX = {
|
||||||
|
on: "ON — le chaos, le rien-et-tout, l'avant-distinction.",
|
||||||
|
i: "I — l'observateur, l'âme, la distinction qui tranche le ON.",
|
||||||
|
ion: "ION — le réel : ON + I. Ce qui est, parce que c'est observé.",
|
||||||
|
bion: "Bion — la brique élémentaire, l'atome du xerboxion.",
|
||||||
|
cubion: "Cubion — deux bions assemblés ; le cube hardware (CFC).",
|
||||||
|
ploxion: "Ploxion — une brique autonome, composable, branchable (PLC).",
|
||||||
|
plugion: "Plugion — un ploxion branché qui en étend un autre.",
|
||||||
|
boxion: "Boxion — le serveur personnel décentralisé. Stocke des tsoins.",
|
||||||
|
xerboxion: "Xerboxion — le système entier ; toutes les manières de le voir.",
|
||||||
|
tsoin: "Tsoin — un instant de réel = le résidu = la surprise de Shannon.",
|
||||||
|
koin: "Koin — une porte, une page ; on est toujours dans un koin.",
|
||||||
|
kion: "Kion — un cube ; structure composée de bions.",
|
||||||
|
wormion: "Wormion — l'E/S humaine, le zoom, le trou de ver entre échelles.",
|
||||||
|
portion: "Portion — l'interface scientifique/API d'un ploxion.",
|
||||||
|
xer: "Xer — l'interface, la manière de voir le xerboxion.",
|
||||||
|
xion: "Xion — une connexion ; transmet le résidu.",
|
||||||
|
xeroction: "Xeroction — le soi entier, l'agrégat de tes mions."
|
||||||
|
};
|
||||||
|
|
||||||
|
// bus xerboxion — émission best-effort sous notre id (topic ploxion.xerminal.<port>)
|
||||||
|
function pemit(port, payload) { try { if (window.jOSPorts && typeof window.jOSPorts.emit === 'function') window.jOSPorts.emit('xerminal', port, payload); } catch (e) {} }
|
||||||
|
|
||||||
|
function mount(container, ctx) {
|
||||||
|
container.innerHTML =
|
||||||
|
'<div class="xt"><div class="xt__out"></div>'
|
||||||
|
+ ' <div class="xt__in"><span class="xt__prompt">❯</span><input class="xt__f" autocomplete="off" spellcheck="false"></div></div>';
|
||||||
|
var out = container.querySelector('.xt__out');
|
||||||
|
var f = container.querySelector('.xt__f');
|
||||||
|
var promptEl = container.querySelector('.xt__prompt');
|
||||||
|
var hist = []; try { hist = JSON.parse(localStorage.getItem(HKEY)) || []; } catch (e) {}
|
||||||
|
var hi = hist.length;
|
||||||
|
|
||||||
|
// === ALIAS utilisateur (persistés boxion ns=xerminal key=aliases + localStorage xt:aliases) ===
|
||||||
|
var ALIAS_NS = 'xerminal', ALIAS_KEY = 'aliases', ALIAS_LS = 'xt:aliases';
|
||||||
|
var aliases = {}; try { aliases = JSON.parse(localStorage.getItem(ALIAS_LS)) || {}; } catch (e) { aliases = {}; }
|
||||||
|
function saveAliases() {
|
||||||
|
try { localStorage.setItem(ALIAS_LS, JSON.stringify(aliases)); } catch (e) {}
|
||||||
|
try { if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon(ALIAS_NS, ALIAS_KEY, aliases, 'Alias xerminal'); } catch (e) {}
|
||||||
|
}
|
||||||
|
// expansion récursive du 1er token si c'est un alias (garde anti-boucle 10)
|
||||||
|
function expandAlias(line) {
|
||||||
|
var s = line, depth = 0;
|
||||||
|
while (depth < 10) {
|
||||||
|
var m = s.replace(/^\s+/, ''); var sp = m.search(/\s/);
|
||||||
|
var first = sp < 0 ? m : m.slice(0, sp); var rest = sp < 0 ? '' : m.slice(sp + 1);
|
||||||
|
var key = first.toLowerCase();
|
||||||
|
if (Object.prototype.hasOwnProperty.call(aliases, key)) { s = aliases[key] + (rest ? ' ' + rest : ''); depth++; }
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === HISTORIQUE (boxion ns=xerminal key=history + localStorage, cap 200, dédup consécutif) ===
|
||||||
|
var HIST_NS = 'xerminal', HIST_KEY = 'history';
|
||||||
|
function saveHist() {
|
||||||
|
try { localStorage.setItem(HKEY, JSON.stringify(hist)); } catch (e) {}
|
||||||
|
try { if (window.jOSBoxion && window.jOSBoxion.saveSoon) window.jOSBoxion.saveSoon(HIST_NS, HIST_KEY, hist, 'Historique xerminal'); } catch (e) {}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (window.jOSBoxion && window.jOSBoxion.authed && window.jOSBoxion.authed() && window.jOSBoxion.load) {
|
||||||
|
window.jOSBoxion.load(ALIAS_NS, ALIAS_KEY).then(function (it) { if (it && it.data && typeof it.data === 'object' && !(it.data instanceof Array)) aliases = it.data; }).catch(function () {});
|
||||||
|
window.jOSBoxion.load(HIST_NS, HIST_KEY).then(function (it) { if (it && it.data && (it.data instanceof Array) && it.data.length) { hist = it.data.slice(-200); hi = hist.length; } }).catch(function () {});
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
// === XERKIONS (ploxions « xerkion-* » enregistrés dans jOSApps) ===
|
||||||
|
function _xerkions() { var a = [], k, apps = window.jOSApps || {}; for (k in apps) { if (k.indexOf('xerkion-') === 0) a.push(k); } return a; }
|
||||||
|
function xerkName(id) { try { var mf = window.jOSApps[id] && window.jOSApps[id].manifest; if (mf && mf.name) return mf.name; } catch (e) {} return id.replace('xerkion-', ''); }
|
||||||
|
|
||||||
|
// === mode SOUS-APP : un ploxion piloté en terminal (jOSTerm) ===
|
||||||
|
var termApp = null;
|
||||||
|
function setPrompt(s) { if (promptEl) promptEl.textContent = s || '❯'; }
|
||||||
|
function startTerm(id) {
|
||||||
|
id = (id || '').trim();
|
||||||
|
if (!id) { w('usage : cli <id> (ex: cli calc · cli meteo)', 'xt__err'); return; }
|
||||||
|
var known = (window.jOSTerm && window.jOSTerm.has(id)) || !!findPlox(id);
|
||||||
|
if (!known) { w('« ' + id + ' » introuvable (ni ploxion, ni app terminal).', 'xt__err'); return; }
|
||||||
|
if (!window.jOSTerm) { w('mode terminal indisponible (jOSTerm)', 'xt__err'); return; }
|
||||||
|
var p = findPlox(id) || { id: id, name: id, icon: '⌨' };
|
||||||
|
var exits = [];
|
||||||
|
var io = {
|
||||||
|
id: id, ploxion: p,
|
||||||
|
print: function (t, c) { w(t, c); },
|
||||||
|
html: function (h) { whtml(h); },
|
||||||
|
_h: null,
|
||||||
|
onLine: function (cb) { io._h = cb; },
|
||||||
|
onExit: function (cb) { if (typeof cb === 'function') exits.push(cb); },
|
||||||
|
exit: function () {
|
||||||
|
exits.forEach(function (fn) { try { fn(); } catch (e) {} });
|
||||||
|
termApp = null; setPrompt('❯'); w('— sorti de ' + id + ' (retour xerminal)', 'xt__dim');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
termApp = io; setPrompt(id + '›');
|
||||||
|
w('▶ ' + (p.icon || '') + ' ' + id + ' — mode terminal (« exit » pour revenir)', 'xt__dim');
|
||||||
|
try { window.jOSTerm.run(id, io); }
|
||||||
|
catch (e) { w('term ' + id + ' : ' + e.message, 'xt__err'); io.exit(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
function w(text, cls) { var d = document.createElement('div'); d.className = 'xt__l ' + (cls || ''); d.textContent = text; out.appendChild(d); out.scrollTop = out.scrollHeight; pemit('out', { text: text, err: cls === 'xt__err' }); }
|
||||||
|
function whtml(html) { var d = document.createElement('div'); d.className = 'xt__l'; d.innerHTML = html; out.appendChild(d); out.scrollTop = out.scrollHeight; }
|
||||||
|
function toast(m) { try { if (window.jOSBoxion && window.jOSBoxion.toast) { window.jOSBoxion.toast(m); return; } } catch (e) {} w('✓ ' + m, 'xt__dim'); }
|
||||||
|
|
||||||
|
// px — la grammaire de pilotage des ploxions (spec ploxion10 / RS-7)
|
||||||
|
function findPlox(id) {
|
||||||
|
var a = window.__PLOXIONS__ || [];
|
||||||
|
for (var i = 0; i < a.length; i++) if (a[i].id === id) return a[i];
|
||||||
|
return (window.jOSApps && window.jOSApps[id]) ? { id: id, name: id } : null;
|
||||||
|
}
|
||||||
|
function openPx(id, mod) {
|
||||||
|
if (!id) { w('usage: px <id> [--cli|--web|--xer|--px|?]', 'xt__err'); return; }
|
||||||
|
if (mod === '--cli') { startTerm(id); return; } // le vrai mode terminal du ploxion
|
||||||
|
var p = findPlox(id);
|
||||||
|
if (!p) { w('ploxion « ' + id + ' » introuvable. tape « px » pour la liste.', 'xt__err'); return; }
|
||||||
|
try {
|
||||||
|
if (window.jOS && typeof window.jOS.openPloxion === 'function') window.jOS.openPloxion(id);
|
||||||
|
else if (window.jOSMobile && typeof window.jOSMobile.open === 'function') window.jOSMobile.open(id, p.name || id);
|
||||||
|
else { w(id + ' chargé — ouvre-le depuis le launcher.', 'xt__dim'); return; }
|
||||||
|
w('→ ' + (p.icon || '') + ' ' + id + (mod && mod !== '--px' ? ' [' + mod.replace('--', '') + ']' : ''));
|
||||||
|
} catch (e) { w('impossible: ' + e.message, 'xt__err'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
var CMDS = {
|
||||||
|
help: function () {
|
||||||
|
w('commandes :', 'xt__dim');
|
||||||
|
w(' px <id> [--cli|--web|--xer] ouvre un ploxion (px=liste, px find <q>)', 'xt__dim');
|
||||||
|
w(' cli <id> LANCE un ploxion EN MODE TERMINAL (UI texte) — ex: cli calc', 'xt__dim');
|
||||||
|
w(' x [<xerkion>] ⚡ liste/ouvre un xerkion INSTANTANÉMENT (fuzzy) — ex: x tsoin', 'xt__dim');
|
||||||
|
w(' ploxions liste les ploxions branchés', 'xt__dim');
|
||||||
|
w(' lexique [mot] le lexique ionique (ON I N B T S X E R)', 'xt__dim');
|
||||||
|
w(' open <id> tente d’ouvrir un ploxion (si jOS dispo)', 'xt__dim');
|
||||||
|
w(' alias [<n> <v>] raccourci perso (alias m meteo · alias gx xer glyphes) · unalias <n>', 'xt__dim');
|
||||||
|
w(' whoami ton identité · echo <txt> répète', 'xt__dim');
|
||||||
|
w(' ↑/↓ historique (filtre par préfixe) · Tab complète · → accepte · Échap efface', 'xt__dim');
|
||||||
|
w(' clear efface · help cette aide', 'xt__dim');
|
||||||
|
},
|
||||||
|
ploxions: function () {
|
||||||
|
var p = window.__PLOXIONS__ || [];
|
||||||
|
if (!p.length) { w('(aucun ploxion exposé dans cette vue)', 'xt__dim'); return; }
|
||||||
|
w(p.length + ' ploxion(s) branché(s) :', 'xt__dim');
|
||||||
|
p.forEach(function (x) { w(' ' + (x.icon || '·') + ' ' + x.id + ' — ' + (x.name || '')); });
|
||||||
|
},
|
||||||
|
lexique: function (arg) {
|
||||||
|
if (arg) {
|
||||||
|
var k = arg.toLowerCase().replace(/0/g, 'o');
|
||||||
|
w(LEX[k] || ('« ' + arg +' » pas dans le lexique de base — voir /wiki'), LEX[k] ? '' : 'xt__err');
|
||||||
|
} else {
|
||||||
|
w('lexique ionique (tape « lexique <mot> ») :', 'xt__dim');
|
||||||
|
w(' ' + Object.keys(LEX).join(' '), 'xt__dim');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
whoami: function () { w('xeroction — souverain sur tes données, tes tsoins, tes choix.'); },
|
||||||
|
echo: function (arg) { w(arg || ''); },
|
||||||
|
open: function (arg) {
|
||||||
|
if (!arg) { w('usage: open <id>', 'xt__err'); return; }
|
||||||
|
try {
|
||||||
|
if (window.jOS && typeof window.jOS.open === 'function') { window.jOS.open(arg); w('→ ouverture de ' + arg); }
|
||||||
|
else if (window.jOSApps && window.jOSApps[arg]) { w(arg + ' est chargé (window.jOSApps) — ouvre-le depuis le launcher.', 'xt__dim'); }
|
||||||
|
else { w('ploxion « ' + arg + ' » introuvable.', 'xt__err'); }
|
||||||
|
} catch (e) { w('impossible: ' + e.message, 'xt__err'); }
|
||||||
|
},
|
||||||
|
clear: function () { out.innerHTML = ''; },
|
||||||
|
// px <id> [--cli|--web|--xer|--px|?] · px = liste · px find <q> · px ? = aide
|
||||||
|
px: function (arg) {
|
||||||
|
var t = (arg || '').trim(); if (!t) { CMDS.ploxions(); return; }
|
||||||
|
var p = t.split(/\s+/);
|
||||||
|
if (p[0] === '?' || p[0] === 'help') {
|
||||||
|
w('px <id> [modalité] — ouvre un ploxion. modalités : --px (défaut) · --cli · --web · --xer · ? (picker)', 'xt__dim');
|
||||||
|
w(' px liste · px find <q> cherche · cli/web/xer <id> alias', 'xt__dim'); return;
|
||||||
|
}
|
||||||
|
if (p[0] === 'find') {
|
||||||
|
var q = p.slice(1).join(' ').toLowerCase(), a = (window.__PLOXIONS__ || []).filter(function (x) {
|
||||||
|
return (x.id + ' ' + (x.name || '') + ' ' + (x.description || '')).toLowerCase().indexOf(q) !== -1;
|
||||||
|
});
|
||||||
|
if (!a.length) { w('aucun ploxion pour « ' + q + ' »', 'xt__dim'); return; }
|
||||||
|
a.forEach(function (x) { w(' ' + (x.icon || '·') + ' ' + x.id + ' — ' + (x.name || '')); }); return;
|
||||||
|
}
|
||||||
|
var id = p[0], mod = null, picker = false;
|
||||||
|
for (var i = 1; i < p.length; i++) { if (p[i] === '?') picker = true; else if (p[i].indexOf('--') === 0) mod = p[i]; }
|
||||||
|
if (picker) { w('modalité pour ' + id + ' : cli ' + id + ' · web ' + id + ' · xer ' + id + ' · px ' + id + ' (défaut)', 'xt__dim'); return; }
|
||||||
|
openPx(id, mod || '--px');
|
||||||
|
},
|
||||||
|
cli: function (arg) { startTerm((arg || '').split(/\s+/)[0]); },
|
||||||
|
web: function (arg) { openPx((arg || '').split(/\s+/)[0], '--web'); },
|
||||||
|
xer: function (arg) { openPx((arg || '').split(/\s+/)[0], '--xer'); },
|
||||||
|
// x — xerkions ultra rapides : « x » liste · « x <fuzzy> » ouvre direct (oklm)
|
||||||
|
x: function (arg) {
|
||||||
|
var q = (arg || '').trim(); var xs = _xerkions();
|
||||||
|
if (!xs.length) { w('(aucun xerkion chargé dans cette vue)', 'xt__dim'); return; }
|
||||||
|
if (!q) {
|
||||||
|
xs.sort();
|
||||||
|
w(xs.length + ' xerkion(s) — « x <nom> » ouvre direct :', 'xt__dim');
|
||||||
|
xs.forEach(function (id) { w(' 🔷 ' + xerkName(id) + ' (' + id + ')'); });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ql = q.toLowerCase();
|
||||||
|
var ranked = _rank(xs, ql); // fuzzy sur les ids (xerkion-tsoin…)
|
||||||
|
if (!ranked.length) { // repli : fuzzy sur les noms jolis
|
||||||
|
var best = null, bestSc = 1e9, i;
|
||||||
|
for (i = 0; i < xs.length; i++) { var sc = _fuzsc(xerkName(xs[i]), ql); if (sc >= 0 && sc < bestSc) { bestSc = sc; best = xs[i]; } }
|
||||||
|
ranked = best ? [best] : [];
|
||||||
|
}
|
||||||
|
if (!ranked.length) { w('aucun xerkion pour « ' + q + ' » — tape « x » pour la liste', 'xt__err'); return; }
|
||||||
|
openPx(ranked[0], '--px');
|
||||||
|
},
|
||||||
|
// alias — raccourcis perso : « alias » liste · « alias <nom> <val|=val> » définit
|
||||||
|
alias: function (arg) {
|
||||||
|
var s = (arg || '').trim(); var k;
|
||||||
|
if (!s) {
|
||||||
|
var ks = []; for (k in aliases) ks.push(k);
|
||||||
|
if (!ks.length) { w('aucun alias — « alias <nom> <valeur> » (ex: alias m meteo)', 'xt__dim'); return; }
|
||||||
|
ks.sort(); w(ks.length + ' alias :', 'xt__dim');
|
||||||
|
ks.forEach(function (n) { w(' ' + n + ' → ' + aliases[n]); });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var name, val, eq = s.indexOf('='), spc = s.search(/\s/);
|
||||||
|
if (eq > 0 && (spc < 0 || eq < spc)) { name = s.slice(0, eq); val = s.slice(eq + 1); }
|
||||||
|
else if (spc > 0) { name = s.slice(0, spc); val = s.slice(spc + 1); }
|
||||||
|
else {
|
||||||
|
var kk = s.toLowerCase();
|
||||||
|
if (Object.prototype.hasOwnProperty.call(aliases, kk)) w(' ' + kk + ' → ' + aliases[kk]);
|
||||||
|
else w('alias « ' + s + ' » non défini — « alias ' + s + ' <valeur> » pour le créer', 'xt__dim');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
name = name.trim().toLowerCase(); val = val.trim();
|
||||||
|
if (!name || !val) { w('usage: alias <nom> <valeur> (ex: alias gx xer glyphes)', 'xt__err'); return; }
|
||||||
|
aliases[name] = val; saveAliases(); toast('alias ' + name + ' → ' + val);
|
||||||
|
},
|
||||||
|
unalias: function (arg) {
|
||||||
|
var n = (arg || '').trim().toLowerCase().split(/\s+/)[0];
|
||||||
|
if (!n) { w('usage: unalias <nom>', 'xt__err'); return; }
|
||||||
|
if (Object.prototype.hasOwnProperty.call(aliases, n)) { delete aliases[n]; saveAliases(); w('✗ alias ' + n + ' retiré', 'xt__dim'); }
|
||||||
|
else w('alias « ' + n + ' » inexistant', 'xt__err');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// === dimension /op — slash-commands (Minecraft/Discord) : opérer le xerboxion ===
|
||||||
|
function csrf(){return window.jOSb&&window.jOSb.csrf?window.jOSb.csrf():(function(){var m=document.querySelector('meta[name=csrf-token]');return m?(m.getAttribute('content')||m.content||''):'';})();}
|
||||||
|
function postJ(url, body, ok, label) {
|
||||||
|
fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrf(), Accept: 'application/json' }, body: JSON.stringify(body) })
|
||||||
|
.then(function (r) { if (!r.ok) throw new Error('http ' + r.status); return r.json(); })
|
||||||
|
.then(function () { w(ok); })
|
||||||
|
.catch(function (e) { w((label || 'échec') + ' : ' + e.message + ' (admin/connecté requis ?)', 'xt__err'); });
|
||||||
|
}
|
||||||
|
// === /record — capture média (caméra/écran/micro) avec BOUTONS dans le terminal ===
|
||||||
|
var rec = { stream: null, recorder: null, chunks: [] };
|
||||||
|
function wBtns(prefix, btns) {
|
||||||
|
var row = document.createElement('div'); row.className = 'xt__l';
|
||||||
|
if (prefix) { var s = document.createElement('span'); s.className = 'xt__dim'; s.textContent = prefix + ' '; row.appendChild(s); }
|
||||||
|
btns.forEach(function (b) { var x = document.createElement('button'); x.className = 'xt__b'; x.textContent = b.label; x.addEventListener('click', b.on); row.appendChild(x); });
|
||||||
|
out.appendChild(row); out.scrollTop = out.scrollHeight; return row;
|
||||||
|
}
|
||||||
|
function startRec(source, subject) {
|
||||||
|
if (rec.recorder) { w('déjà en enregistrement — clique ⏹ arrêter', 'xt__err'); return; }
|
||||||
|
var md = navigator.mediaDevices;
|
||||||
|
if (!md || (source === 'screen' ? !md.getDisplayMedia : !md.getUserMedia) || typeof MediaRecorder === 'undefined') { w('capture média non supportée ici', 'xt__err'); return; }
|
||||||
|
var p = source === 'screen' ? md.getDisplayMedia({ video: true, audio: true })
|
||||||
|
: md.getUserMedia(source === 'mic' ? { audio: true } : { video: true, audio: true });
|
||||||
|
p.then(function (stream) {
|
||||||
|
rec.stream = stream; rec.chunks = [];
|
||||||
|
var mr = new MediaRecorder(stream); rec.recorder = mr;
|
||||||
|
mr.ondataavailable = function (e) { if (e.data && e.data.size) rec.chunks.push(e.data); };
|
||||||
|
mr.onstop = function () {
|
||||||
|
var type = (rec.chunks[0] && rec.chunks[0].type) || (source === 'mic' ? 'audio/webm' : 'video/webm');
|
||||||
|
var blob = new Blob(rec.chunks, { type: type });
|
||||||
|
try { stream.getTracks().forEach(function (t) { t.stop(); }); } catch (e) {}
|
||||||
|
rec.stream = null; rec.recorder = null;
|
||||||
|
var url = URL.createObjectURL(blob);
|
||||||
|
wBtns('✦ tsoin ' + (subject || source) + ' · ' + Math.round(blob.size / 1024) + ' ko :', [
|
||||||
|
{ label: '⬇ télécharger', on: function () { var a = document.createElement('a'); a.href = url; a.download = 'tsoin-' + (subject || source) + '-' + Date.now() + '.webm'; a.click(); } },
|
||||||
|
{ label: '▶ aperçu', on: function () { var v = document.createElement(source === 'mic' ? 'audio' : 'video'); v.src = url; v.controls = true; v.style.cssText = 'max-width:320px;border-radius:9px;margin:4px 0;display:block'; out.appendChild(v); out.scrollTop = out.scrollHeight; } }
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
mr.start();
|
||||||
|
w('● enregistrement ' + (subject ? '« ' + subject + ' » ' : '') + '(' + source + ')…', 'xt__rec');
|
||||||
|
wBtns('', [{ label: '⏹ arrêter', on: function () { if (rec.recorder && rec.recorder.state !== 'inactive') rec.recorder.stop(); } }]);
|
||||||
|
}).catch(function (e) { w('accès refusé / impossible : ' + (e && e.message ? e.message : e), 'xt__err'); });
|
||||||
|
}
|
||||||
|
|
||||||
|
// === TÉLÉPORTATION (RS-7 : « /tp c'est LE truc » + /home /labo /kion …) ===
|
||||||
|
// Waypoints intégrés (nom → ploxion-id, ou §home = l'accueil). + waypoints
|
||||||
|
// PERSO de RS-7 (localStorage) : /setwp <nom> <id> → /<nom> te téléporte.
|
||||||
|
var WP = {
|
||||||
|
home: '§home', labo: 'labo', wiki: 'wiki', chat: 'chat', '3d': '3d', xion: 'xion',
|
||||||
|
repoverse: 'repoverse', kion: 'repoverse', koin: 'repoverse', web: 'web',
|
||||||
|
marketplace: 'marketplace', market: 'marketplace', finance: 'finance', notes: 'notes',
|
||||||
|
map: 'ideas-map', lexique: 'dictionnaire', arbre: 'tree', von: 'von-neumann'
|
||||||
|
};
|
||||||
|
function userWp() { try { return JSON.parse(localStorage.getItem('xb:wp')) || {}; } catch (e) { return {}; } }
|
||||||
|
function teleport(name) {
|
||||||
|
var target = userWp()[name] || WP[name];
|
||||||
|
if (!target) return false;
|
||||||
|
if (target === '§home') { w('⇶ retour à l’accueil (le cube)…', 'xt__dim'); try { location.assign('/'); } catch (e) {} return true; }
|
||||||
|
w('⇶ téléportation → ' + name, 'xt__dim'); openPx(target, '--px'); return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var SLASH = {
|
||||||
|
op: function () {
|
||||||
|
w('✦ tu es OP du xerboxion — opérateur de ta dimension. /op actif.', 'xt__dim');
|
||||||
|
w(' /tp <dest> téléporter (ploxion, waypoint, ou url) — LE truc', 'xt__dim');
|
||||||
|
w(' raccourcis : /home /labo /wiki /chat /3d /xion /kion /web … (/wp = liste)', 'xt__dim');
|
||||||
|
w(' /setwp <nom> <id> ton propre waypoint · /record /tsoin /coord /me /help', 'xt__dim');
|
||||||
|
},
|
||||||
|
tp: function (a) {
|
||||||
|
var d = (a || '').split(/\s+/)[0]; if (!d) { w('usage: /tp <home|labo|kion|ploxion|url>', 'xt__err'); return; }
|
||||||
|
var dl = d.toLowerCase();
|
||||||
|
if (/^https?:\/\//i.test(d) || /\.[a-z]{2,}(\/|$)/i.test(d)) { var url = /^https?:/i.test(d) ? d : 'https://' + d; w('⇶ → ' + url, 'xt__dim'); try { window.open(url, '_blank', 'noopener'); } catch (e) {} return; }
|
||||||
|
if (teleport(dl)) return;
|
||||||
|
openPx(d, '--px');
|
||||||
|
},
|
||||||
|
wp: function () {
|
||||||
|
w('points de téléport — tape /<nom> ou /tp <nom> :', 'xt__dim');
|
||||||
|
w(' ' + Object.keys(WP).join(' '), 'xt__dim');
|
||||||
|
var uk = Object.keys(userWp()); if (uk.length) w(' perso : ' + uk.join(' '), 'xt__dim');
|
||||||
|
w(' /setwp <nom> <ploxion-id> créer · /delwp <nom> retirer', 'xt__dim');
|
||||||
|
},
|
||||||
|
setwp: function (a) {
|
||||||
|
var p = (a || '').split(/\s+/); if (p.length < 2) { w('usage: /setwp <nom> <ploxion-id>', 'xt__err'); return; }
|
||||||
|
var u = userWp(); u[p[0].toLowerCase()] = p[1]; try { localStorage.setItem('xb:wp', JSON.stringify(u)); } catch (e) {}
|
||||||
|
w('✓ waypoint /' + p[0].toLowerCase() + ' → ' + p[1] + ' (tape /' + p[0].toLowerCase() + ')', 'xt__dim');
|
||||||
|
},
|
||||||
|
delwp: function (a) { var n = (a || '').split(/\s+/)[0]; var u = userWp(); delete u[n]; try { localStorage.setItem('xb:wp', JSON.stringify(u)); } catch (e) {} w('✗ /' + n + ' retiré', 'xt__dim'); },
|
||||||
|
record: function (a) {
|
||||||
|
var sub = (a || '').trim();
|
||||||
|
// Délègue au RECORDER GLOBAL (draggable + persistant IndexedDB, survit au
|
||||||
|
// changement de page — josion #372/#373). Fallback inline si absent.
|
||||||
|
var R = window.jOSRecorder;
|
||||||
|
if (R) R.open(); // ouvre le panneau (historique persistant visible)
|
||||||
|
w('● record ' + (sub ? '« ' + sub + ' » ' : '') + '— choisis la source :', 'xt__dim');
|
||||||
|
wBtns('', [
|
||||||
|
{ label: '📷 caméra', on: function () { R ? R.start('cam', sub) : startRec('cam', sub); } },
|
||||||
|
{ label: '🖥 écran', on: function () { R ? R.start('screen', sub) : startRec('screen', sub); } },
|
||||||
|
{ label: '🎤 micro', on: function () { R ? R.start('mic', sub) : startRec('mic', sub); } },
|
||||||
|
{ label: '⛶ studio', on: function () { openPx('record', '--px'); } }
|
||||||
|
]);
|
||||||
|
if (R) w(' (panneau ⏺ records flottant — déplaçable, tes records sont gardés)', 'xt__dim');
|
||||||
|
},
|
||||||
|
tsoin: function (a) { if (!a) { w('usage: /tsoin <texte>', 'xt__err'); return; } postJ('/chat', { kind: 'tsoin', content: a, room: 'prive' }, '✦ tsoin enregistré (→ moteur tsoin du xion)', 'tsoin'); },
|
||||||
|
coord: function (a) { if (!a) { w('usage: /coord <message>', 'xt__err'); return; } postJ('/coord', { agent: 'rs-7', content: a }, '→ posté dans /coord', 'coord'); pemit('coord', { agent: 'rs-7', content: a }); },
|
||||||
|
me: function (a) { w('* rs-7 ' + (a || '…')); },
|
||||||
|
help: function () { w('commandes / (dimension op) :', 'xt__dim'); w(' /tp /wp /setwp /home /labo /record /tsoin /coord /me · + tes waypoints', 'xt__dim'); },
|
||||||
|
'?': function () { SLASH.help(); },
|
||||||
|
clear: function () { out.innerHTML = ''; }
|
||||||
|
};
|
||||||
|
|
||||||
|
function run(line) {
|
||||||
|
var t = line.trim(); if (!t) return;
|
||||||
|
whtml('<span class="xt__cmd">' + line.replace(/</g, '<') + '</span>');
|
||||||
|
// en mode sous-app : router la ligne vers l'app terminal active
|
||||||
|
if (termApp) {
|
||||||
|
var tl = t.toLowerCase();
|
||||||
|
if (tl === 'exit' || tl === 'quit' || tl === ':q') { termApp.exit(); return; }
|
||||||
|
try { termApp._h ? termApp._h(line) : w('(cette app terminal n’attend pas d’entrée — « exit »)', 'xt__dim'); }
|
||||||
|
catch (e) { w('erreur : ' + e.message, 'xt__err'); }
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
t = expandAlias(t); // ALIAS : remplace le 1er token si c'en est un (récursif, garde 10)
|
||||||
|
if (t.charAt(0) === '/') {
|
||||||
|
var sp = t.slice(1).split(/\s+/); var sc = (sp.shift() || '').toLowerCase(); var sa = sp.join(' ');
|
||||||
|
if (SLASH[sc]) SLASH[sc](sa);
|
||||||
|
else if (teleport(sc)) { /* /home /labo /kion /<waypoint> */ }
|
||||||
|
else w('commande /' + sc + ' inconnue — /op pour la liste, /wp pour les téléports', 'xt__err');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var parts = t.split(/\s+/); var cmd = (parts.shift() || '').toLowerCase(); var arg = parts.join(' ');
|
||||||
|
if (CMDS[cmd]) CMDS[cmd](arg);
|
||||||
|
// fallback « invincible » : un nom de ploxion nu ouvre le ploxion (rend « alias m meteo » cohérent)
|
||||||
|
else if (!arg && findPlox(cmd)) openPx(cmd, '--px');
|
||||||
|
else w('commande inconnue : ' + cmd + ' (tape « help » ou « /op »)', 'xt__err');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══ AUTOCOMPLETE Tab — contextuel (commande | slash | arg px/tp) + ghost inline live
|
||||||
|
// + complétion au PRÉFIXE COMMUN + CYCLE des candidats (Tab/Shift-Tab) + → accepte. ═══
|
||||||
|
function _apps() { try { return Object.keys(window.jOSApps || {}); } catch (e) { return []; } }
|
||||||
|
function _wps() { var a = [], k; for (k in WP) a.push(k); var u = userWp(); for (k in u) a.push(k); return a; }
|
||||||
|
function _fuzsc(cand, tok) { // sous-séquence : score de compacité, ou -1 si pas de match
|
||||||
|
var cl = cand.toLowerCase(), ci = 0, ti, first = -1, last = -1, found;
|
||||||
|
for (ti = 0; ti < tok.length; ti++) { found = -1;
|
||||||
|
for (; ci < cl.length; ci++) { if (cl.charAt(ci) === tok.charAt(ti)) { found = ci; ci++; break; } }
|
||||||
|
if (found < 0) return -1; if (first < 0) first = found; last = found; }
|
||||||
|
return (last - first) + cand.length * 0.02;
|
||||||
|
}
|
||||||
|
function _rank(pool, tok) {
|
||||||
|
var seen = {}, uniq = [], i;
|
||||||
|
for (i = 0; i < pool.length; i++) { if (pool[i] && !seen[pool[i]]) { seen[pool[i]] = 1; uniq.push(pool[i]); } }
|
||||||
|
tok = (tok || '').toLowerCase();
|
||||||
|
if (!tok) { uniq.sort(); return uniq; }
|
||||||
|
var pre = [], sub = [], done = {};
|
||||||
|
for (i = 0; i < uniq.length; i++) { var cl = uniq[i].toLowerCase();
|
||||||
|
if (cl.indexOf(tok) === 0) { pre.push(uniq[i]); done[uniq[i]] = 1; }
|
||||||
|
else if (cl.indexOf(tok) > 0) { sub.push(uniq[i]); done[uniq[i]] = 1; } }
|
||||||
|
pre.sort(function (a, b) { return a.length - b.length || (a < b ? -1 : 1); }); sub.sort();
|
||||||
|
// 3e tier : FUZZY (sous-séquence) — « xtsoin »→xerkion-tsoin, « rvc »→rv-code
|
||||||
|
var fuz = [];
|
||||||
|
for (i = 0; i < uniq.length; i++) { if (done[uniq[i]]) continue; var sc = _fuzsc(uniq[i], tok); if (sc >= 0) fuz.push([uniq[i], sc]); }
|
||||||
|
fuz.sort(function (a, b) { return a[1] - b[1]; });
|
||||||
|
var out = pre.concat(sub); for (i = 0; i < fuz.length; i++) out.push(fuz[i][0]);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
// récence : 1er token de chaque ligne d'historique → poids (plus récent = plus fort)
|
||||||
|
function _recentSet() {
|
||||||
|
var s = {}, i, n = hist.length;
|
||||||
|
for (i = 0; i < n; i++) { var fst = (hist[i] || '').replace(/^\s+/, '').split(/\s+/)[0].toLowerCase(); if (fst) s[fst] = n - i; }
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
// remonte (stable) les récents & xerkions sans casser les tiers fuzzy de _rank
|
||||||
|
function _boost(list) {
|
||||||
|
var rec = _recentSet(), sc = [], i;
|
||||||
|
for (i = 0; i < list.length; i++) {
|
||||||
|
var it = list[i], low = it.toLowerCase(), bare = low.charAt(0) === '/' ? low.slice(1) : low, b = 0;
|
||||||
|
if (rec[bare]) b += 100 + rec[bare];
|
||||||
|
if (bare.indexOf('xerkion-') === 0) b += 40;
|
||||||
|
sc.push([it, b, i]);
|
||||||
|
}
|
||||||
|
sc.sort(function (a, b2) { return (b2[1] - a[1]) || (a[2] - b2[2]); });
|
||||||
|
var o = []; for (i = 0; i < sc.length; i++) o.push(sc[i][0]); return o;
|
||||||
|
}
|
||||||
|
function _cands(v, pos) {
|
||||||
|
var ts = pos; while (ts > 0 && !/\s/.test(v.charAt(ts - 1))) ts--;
|
||||||
|
var token = v.slice(ts, pos);
|
||||||
|
var isFirst = (v.slice(0, ts).replace(/\s+/g, '') === '');
|
||||||
|
var firstTok = (v.replace(/^\s+/, '').split(/\s+/)[0] || '').toLowerCase();
|
||||||
|
var pool = [], s, arr, i;
|
||||||
|
if (isFirst) {
|
||||||
|
if (token.charAt(0) === '/') {
|
||||||
|
for (s in SLASH) pool.push('/' + s);
|
||||||
|
arr = _wps(); for (i = 0; i < arr.length; i++) pool.push('/' + arr[i]);
|
||||||
|
arr = _apps(); for (i = 0; i < arr.length; i++) pool.push('/' + arr[i]);
|
||||||
|
} else { for (s in CMDS) pool.push(s); for (s in aliases) pool.push(s); }
|
||||||
|
} else if (firstTok === 'x') {
|
||||||
|
pool = _xerkions();
|
||||||
|
} else if (firstTok === 'px') {
|
||||||
|
var pre2 = v.slice(0, ts).trim().split(/\s+/);
|
||||||
|
if (pre2.length <= 1) { pool = _apps(); pool.push('find'); }
|
||||||
|
else { pool = ['--cli', '--web', '--xer', '--px', '?']; }
|
||||||
|
}
|
||||||
|
else if (firstTok === 'tp' || firstTok === '/tp' || firstTok.charAt(0) === '/') { pool = _apps().concat(_wps()); }
|
||||||
|
return { start: ts, token: token, list: _boost(_rank(pool, token)) };
|
||||||
|
}
|
||||||
|
function _lcp(list) { if (!list.length) return ''; var p = list[0], i, n;
|
||||||
|
for (i = 1; i < list.length; i++) { var b = list[i]; n = 0;
|
||||||
|
while (n < p.length && n < b.length && p.charAt(n).toLowerCase() === b.charAt(n).toLowerCase()) n++;
|
||||||
|
p = p.slice(0, n); if (!p) break; }
|
||||||
|
return p; }
|
||||||
|
function _put(start, text, space) {
|
||||||
|
var v = f.value, ins = v.slice(0, start) + text + (space ? ' ' : ''), after = v.slice(f.selectionStart);
|
||||||
|
f.value = ins + after; f.setSelectionRange(ins.length, ins.length); _ghost();
|
||||||
|
}
|
||||||
|
var gh = document.createElement('div'); gh.className = 'xt__ghost'; gh.setAttribute('aria-hidden', 'true');
|
||||||
|
f.parentNode.style.position = 'relative'; f.parentNode.appendChild(gh);
|
||||||
|
function _suffix() {
|
||||||
|
if (f.selectionStart !== f.value.length) return '';
|
||||||
|
var c = _cands(f.value, f.value.length); if (!c.token || !c.list.length) return '';
|
||||||
|
var top = c.list[0]; if (top.toLowerCase().indexOf(c.token.toLowerCase()) !== 0) return '';
|
||||||
|
return top.slice(c.token.length);
|
||||||
|
}
|
||||||
|
function _ghost() {
|
||||||
|
var suf = _suffix();
|
||||||
|
if (!suf) { gh.textContent = ''; return; }
|
||||||
|
gh.innerHTML = '<span class="gt"></span><span class="gs"></span>';
|
||||||
|
gh.firstChild.textContent = f.value; gh.lastChild.textContent = suf;
|
||||||
|
gh.style.left = f.offsetLeft + 'px';
|
||||||
|
}
|
||||||
|
var comp = null;
|
||||||
|
var navList = null, navIdx = -1, navBase = '';
|
||||||
|
function setCaretEnd() { try { f.setSelectionRange(f.value.length, f.value.length); } catch (e) {} }
|
||||||
|
f.addEventListener('input', function () { comp = null; navList = null; _ghost(); });
|
||||||
|
f.addEventListener('blur', function () { gh.textContent = ''; });
|
||||||
|
f.addEventListener('focus', _ghost);
|
||||||
|
|
||||||
|
f.addEventListener('keydown', function (e) {
|
||||||
|
if (e.key === 'Enter') { comp = null; navList = null;
|
||||||
|
var v = f.value; if (v.trim()) { run(v);
|
||||||
|
if (hist[hist.length - 1] !== v) { hist.push(v); if (hist.length > 200) hist.shift(); saveHist(); }
|
||||||
|
hi = hist.length; }
|
||||||
|
f.value = ''; _ghost();
|
||||||
|
} else if (e.key === 'Tab') {
|
||||||
|
e.preventDefault();
|
||||||
|
if (comp) { comp.idx = (comp.idx + (e.shiftKey ? -1 : 1) + comp.list.length) % comp.list.length;
|
||||||
|
_put(comp.start, comp.list[comp.idx], false); return; }
|
||||||
|
var c = _cands(f.value, f.selectionStart); if (!c.list.length) return;
|
||||||
|
if (c.list.length === 1) { _put(c.start, c.list[0], true); return; }
|
||||||
|
var p = _lcp(c.list);
|
||||||
|
if (p.length > c.token.length) { _put(c.start, p, false); return; }
|
||||||
|
w('↹ ' + c.list.slice(0, 40).join(' ') + (c.list.length > 40 ? ' …+' + (c.list.length - 40) : ''), 'xt__dim');
|
||||||
|
comp = { start: c.start, list: c.list, idx: -1 };
|
||||||
|
} else if (e.key === 'ArrowRight' && f.selectionStart === f.value.length) {
|
||||||
|
var suf = _suffix(); if (suf) { e.preventDefault(); f.value += suf; f.setSelectionRange(f.value.length, f.value.length); comp = null; _ghost(); }
|
||||||
|
} else if (e.key === 'ArrowUp') {
|
||||||
|
e.preventDefault(); comp = null;
|
||||||
|
if (navList === null) {
|
||||||
|
navBase = f.value; var pref = navBase.replace(/^\s+/, '').toLowerCase(); navList = []; var hj, prev = null;
|
||||||
|
for (hj = hist.length - 1; hj >= 0; hj--) {
|
||||||
|
var hv = hist[hj] || ''; if (pref && hv.toLowerCase().indexOf(pref) !== 0) continue;
|
||||||
|
if (hv !== prev) { navList.push(hv); prev = hv; }
|
||||||
|
}
|
||||||
|
navIdx = -1;
|
||||||
|
}
|
||||||
|
if (navIdx < navList.length - 1) { navIdx++; f.value = navList[navIdx]; setCaretEnd(); }
|
||||||
|
_ghost();
|
||||||
|
} else if (e.key === 'ArrowDown') {
|
||||||
|
e.preventDefault(); comp = null;
|
||||||
|
if (navList === null) { _ghost(); return; }
|
||||||
|
if (navIdx > 0) { navIdx--; f.value = navList[navIdx]; }
|
||||||
|
else { navIdx = -1; navList = null; f.value = navBase; }
|
||||||
|
setCaretEnd(); _ghost();
|
||||||
|
} else if (e.key === 'Escape') {
|
||||||
|
e.preventDefault(); comp = null; navList = null; f.value = ''; _ghost();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// === port in cmd (bus jOSWire : ex. code.run → le terminal exécute la commande) ===
|
||||||
|
var offCmd = null;
|
||||||
|
try {
|
||||||
|
if (window.jOSPorts && typeof window.jOSPorts.on === 'function') {
|
||||||
|
offCmd = window.jOSPorts.on('ploxion.xerminal.cmd', function (payload) {
|
||||||
|
try {
|
||||||
|
var c = (typeof payload === 'string') ? payload
|
||||||
|
: ((payload && (payload.cmd || payload.command || payload.line || payload.text)) || '');
|
||||||
|
if (typeof c !== 'string' || !c.trim()) return;
|
||||||
|
run(c);
|
||||||
|
} catch (e) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
w('xerminal — la console. « help » · « x » (xerkions ⚡) · « alias » (raccourcis) · « /op » (téléport/record/tsoin). ↑↓=historique.', 'xt__dim');
|
||||||
|
CMDS.ploxions();
|
||||||
|
setTimeout(function () { f.focus(); }, 30);
|
||||||
|
|
||||||
|
container.addEventListener('click', function (e) { if (!e.target.closest('button,video,audio,a')) f.focus(); });
|
||||||
|
return { unmount: function () {
|
||||||
|
try { if (offCmd) offCmd(); } catch (e) {}
|
||||||
|
try { if (rec.recorder && rec.recorder.state !== 'inactive') rec.recorder.stop(); } catch (e) {}
|
||||||
|
try { if (rec.stream) rec.stream.getTracks().forEach(function (t) { t.stop(); }); } catch (e) {}
|
||||||
|
container.innerHTML = '';
|
||||||
|
} };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps = window.jOSApps || {};
|
||||||
|
// ===== XUI (contrat v0, bion jOSXui) : describe() = la console, non monté =====
|
||||||
|
// p1 = la dernière commande tapée (LA donnée maîtresse : xb:xerminal:hist) ; p3 = mes
|
||||||
|
// waypoints /wp. Action 'help' via le port IN ploxion.xerminal.cmd (câblé au mount,
|
||||||
|
// même chemin qu'une commande tapée). Pur, jamais le DOM, ne throw jamais.
|
||||||
|
function describe(){
|
||||||
|
var items=[];
|
||||||
|
try{
|
||||||
|
var hist=[]; try{ hist=JSON.parse(localStorage.getItem(HKEY))||[]; }catch(e){}
|
||||||
|
var last=hist.length?String(hist[hist.length-1]):'';
|
||||||
|
items.push({ p:1, kind:'stat', label:'⌨️ dernière commande', value:last||'(aucune)' });
|
||||||
|
items.push({ p:2, kind:'action', label:'help', act:{ port:'ploxion.xerminal.cmd', payload:{ cmd:'help', src:'xui' } } });
|
||||||
|
items.push({ p:3, kind:'stat', label:'historique', value:hist.length });
|
||||||
|
var wp={}; try{ wp=JSON.parse(localStorage.getItem('xb:wp'))||{}; }catch(e){}
|
||||||
|
var wk=Object.keys(wp);
|
||||||
|
if(wk.length) items.push({ p:4, kind:'list', label:'waypoints /wp', items:wk.slice(0,4).map(function(k){
|
||||||
|
return { label:'/'+k, value:String(wp[k]).slice(0,40) }; }) });
|
||||||
|
}catch(e){ items=[{ p:1, kind:'text', label:'⌨️ xerminal', value:'console indisponible' }]; }
|
||||||
|
return { v:1, id:'xerminal', title:'Xerminal', icon:'⌨️', items:items };
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jOSApps['xerminal'] = { manifest: { id: 'xerminal', name: 'Xerminal', icon: '⌨️' }, mount: mount, describe: describe };
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user