Spaces:
Paused
Paused
env-builder UX, gateway configurability, and HF Spaces runtime robustness
Browse filesImprove Jupyter security, env-builder UX, gateway configurability, and HF Spaces runtime robustness
Files changed (3)
- env-builder.html+2-1
- env-builder.js+21-6
- start.sh+2-2
907 unmodified lines908909910911912913914907 unmodified lines<span class="pblock-title">📦 Bundle Output</span></div><div class="pblock-body"><textarea id="bundleOut" placeholder="Your encoded bundle will appear here…" readonly spellcheck="false"></textarea><input type="text" id="envLineOut" placeholder="HUGGINGCLAW_ENV_BUNDLE=…" readonly spellcheck="false"><div class="row-btns"><button id="copyBundle" class="btn btn-amber">⎘ Bundle</button>907 unmodified lines908909910911912913914915907 unmodified lines<span class="pblock-title">📦 Bundle Output</span></div><div class="pblock-body"><button id="generateBundle" class="btn btn-amber" style="width:100%;font-size:12.5px;"># Generate Bundle</button><textarea id="bundleOut" placeholder="Click # Generate to build your bundle…" readonly spellcheck="false"></textarea><input type="text" id="envLineOut" placeholder="HUGGINGCLAW_ENV_BUNDLE=…" readonly spellcheck="false"><div class="row-btns"><button id="copyBundle" class="btn btn-amber">⎘ Bundle</button>
2103 unmodified lines21042105210621072108210921105 unmodified lines211621172118211921202121212271 unmodified lines21942195219621972198219922002201220222032204220522062207171 unmodified lines237923802381238223832384238523862387238823892390239118 unmodified lines241024112412241324142415241686 unmodified lines2503250425052506250725082103 unmodified linesreturn control;}function cardHTML(f) {const TAG_META = {critical: { cls: 'badge-critical', lbl: 'critical' },credential: { cls: 'badge-credential', lbl: 'credential' },5 unmodified linesconst tm = TAG_META[f.tag] || TAG_META.optional;const badge = `<span class="badge ${tm.cls}">${tm.lbl}</span>`;return `<div class="env-card" data-row data-group="${esc(f.g)}" data-search="${esc((f.g + ' ' + f.k + ' ' + (f.lbl || '') + ' ' + (f.tag || '')).toLowerCase())}"><div class="card-top"><input type="checkbox" class="card-check" data-check="${esc(f.k)}" ${f.common ? 'data-common="1"' : ''}><div class="card-info">71 unmodified linesreturn obj;}function refresh() {const obj = collect();const keys = Object.keys(obj).sort();const bundle = keys.length ? encodeBundle(Object.fromEntries(keys.map(k => [k, obj[k]]))) : '';$('bundleOut').value = bundle;$('envLineOut').value = bundle ? `HUGGINGCLAW_ENV_BUNDLE=${bundle}` : '';const s = $('summary');if (keys.length) {s.innerHTML = `<strong>${keys.length}</strong> variable${keys.length > 1 ? 's' : ''} selected<div class="sum-keys">${keys.map(k => `<span class="sum-key">${esc(k)}</span>`).join('')}</div>`;171 unmodified linesconst chk = document.querySelector(`[data-check="${CSS.escape(key)}"]`);if (chk) {chk.checked = on;markSelected();}refresh();}function bindFieldEvents() {document.querySelectorAll('[data-check]').forEach(el => el.addEventListener('change', () => { markSelected(); refresh(); }));document.querySelectorAll('[data-key]').forEach(el => el.addEventListener('input', refresh));document.querySelectorAll('[data-toggle]').forEach(btn => btn.addEventListener('click', () => toggleField(btn.dataset.toggle)));document.querySelectorAll('[data-pick-for]').forEach(sel => sel.addEventListener('change', () => handlePickerChange(sel)));18 unmodified lines<span class="sec-count">${items.length}</span><div class="sec-line"></div></div><div class="cards">${items.map(cardHTML).join('')}</div>`;wrap.appendChild(sec);});bindFieldEvents();86 unmodified linesshowToast('Invalid bundle');}};$('copyBundle').onclick = () => copyText($('bundleOut').value);$('copyEnvLine').onclick = () => copyText($('envLineOut').value);$('copyJson').onclick = () => copyText(JSON.stringify(collect(), null, 2));2103 unmodified lines21042105210621072108210921105 unmodified lines211621172118211921202121212271 unmodified lines21942195219621972198219922002201220222032204220522062207220822092210171 unmodified lines23822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240518 unmodified lines242424252426242724282429243086 unmodified lines25172518251925202521252225232103 unmodified linesreturn control;}function cardHTML(f, origIdx = 0) {const TAG_META = {critical: { cls: 'badge-critical', lbl: 'critical' },credential: { cls: 'badge-credential', lbl: 'credential' },5 unmodified linesconst tm = TAG_META[f.tag] || TAG_META.optional;const badge = `<span class="badge ${tm.cls}">${tm.lbl}</span>`;return `<div class="env-card" data-row data-orig-idx="${origIdx}" data-group="${esc(f.g)}" data-search="${esc((f.g + ' ' + f.k + ' ' + (f.lbl || '') + ' ' + (f.tag || '')).toLowerCase())}"><div class="card-top"><input type="checkbox" class="card-check" data-check="${esc(f.k)}" ${f.common ? 'data-common="1"' : ''}><div class="card-info">71 unmodified linesreturn obj;}function generateBundle() {const obj = collect();const keys = Object.keys(obj).sort();const bundle = keys.length ? encodeBundle(Object.fromEntries(keys.map(k => [k, obj[k]]))) : '';$('bundleOut').value = bundle;$('envLineOut').value = bundle ? `HUGGINGCLAW_ENV_BUNDLE=${bundle}` : '';}function refresh() {const obj = collect();const keys = Object.keys(obj).sort();const s = $('summary');if (keys.length) {s.innerHTML = `<strong>${keys.length}</strong> variable${keys.length > 1 ? 's' : ''} selected<div class="sum-keys">${keys.map(k => `<span class="sum-key">${esc(k)}</span>`).join('')}</div>`;171 unmodified linesconst chk = document.querySelector(`[data-check="${CSS.escape(key)}"]`);if (chk) {chk.checked = on;sortSection(inp.closest('[data-row]'));markSelected();}refresh();}function sortSection(cardEl) {const cards = cardEl && cardEl.closest('.cards');if (!cards) return;const all = [...cards.querySelectorAll('[data-row]')];const checked = all.filter(c => c.querySelector('[data-check]')?.checked);const rest = all.filter(c => !c.querySelector('[data-check]')?.checked);rest.sort((a, b) => Number(a.dataset.origIdx) - Number(b.dataset.origIdx));[...checked, ...rest].forEach(c => cards.appendChild(c));}function bindFieldEvents() {document.querySelectorAll('[data-check]').forEach(el => el.addEventListener('change', () => { sortSection(el.closest('[data-row]')); markSelected(); refresh(); }));document.querySelectorAll('[data-key]').forEach(el => el.addEventListener('input', refresh));document.querySelectorAll('[data-toggle]').forEach(btn => btn.addEventListener('click', () => toggleField(btn.dataset.toggle)));document.querySelectorAll('[data-pick-for]').forEach(sel => sel.addEventListener('change', () => handlePickerChange(sel)));18 unmodified lines<span class="sec-count">${items.length}</span><div class="sec-line"></div></div><div class="cards">${items.map((f, i) => cardHTML(f, i)).join('')}</div>`;wrap.appendChild(sec);});bindFieldEvents();86 unmodified linesshowToast('Invalid bundle');}};$('generateBundle').onclick = () => generateBundle();$('copyBundle').onclick = () => copyText($('bundleOut').value);$('copyEnvLine').onclick = () => copyText($('envLineOut').value);$('copyJson').onclick = () => copyText(JSON.stringify(collect(), null, 2));
322 unmodified lines3233243253263273283291323 unmodified lines1653165416551656165716581659322 unmodified lines{"gateway": {"mode": "local","port": 7860,"bind": "lan","auth": {"token": ""1323 unmodified linesstdbuf -oL -eL openclaw "${GATEWAY_ARGS[@]}" 2>&1 | tee -a /home/node/.openclaw/gateway.log &GATEWAY_PID=$!# Poll for the gateway to start listening on 7860. OpenClaw can take 20-30s# on cold start (plugin install + auto-restore). Bail out early if the# pipeline died.GATEWAY_READY_TIMEOUT="${GATEWAY_READY_TIMEOUT:-90}"322 unmodified lines3233243253263273283291323 unmodified lines1653165416551656165716581659322 unmodified lines{"gateway": {"mode": "local","port": "${GATEWAY_PORT}","bind": "lan","auth": {"token": ""1323 unmodified linesstdbuf -oL -eL openclaw "${GATEWAY_ARGS[@]}" 2>&1 | tee -a /home/node/.openclaw/gateway.log &GATEWAY_PID=$!# Poll for the gateway to start listening on ${GATEWAY_PORT}. OpenClaw can take 20-30s# on cold start (plugin install + auto-restore). Bail out early if the# pipeline died.GATEWAY_READY_TIMEOUT="${GATEWAY_READY_TIMEOUT:-90}"
env-builder.html+2-1
env-builder.js+21-6
start.sh+2-2