import { onMount, onCleanup, createSignal } from 'solid-js'; import { createMLStore, type MLStore } from './stores/ml-store'; import { exposeDebugProbe } from './probe/debug-probe'; import bus from './bus'; /** * Root application component for the NISPS immersive app. * Initializes ML store (dual WasmIML instances), runs initial inference, * and exposes debug probe. */ export default function App() { const [status, setStatus] = createSignal('Loading WASM...'); const [ready, setReady] = createSignal(false); let mlStore: MLStore | null = null; onMount(async () => { try { const store = await createMLStore(bus); // Expose store globally for e2e tests (window as any).__nispsStore = store; // Expose bus topics for testing dual IML and mode switching bus.createTopic('ml.imlJoy').emit(store.getImlJoy() as any); bus.createTopic('ml.imlHand').emit(store.getImlHand() as any); const outputs = store.outputs(); const allBounded = Array.from(outputs).every(v => v >= 0 && v <= 1); if (!allBounded) { setStatus('ERROR: outputs out of bounds'); console.error('Unbounded outputs:', outputs); return; } setReady(true); setStatus(`Ready — ${outputs.length} outputs loaded`); // Expose debug probe if ?debug=1 exposeDebugProbe(store); mlStore = store; } catch (err) { setStatus(`Error: ${err}`); console.error('WASM init failed:', err); } }); onCleanup(() => { mlStore?.dispose(); }); return (

MEMLNaut NISPS

{status()}

); }