Description
Problem
How to run actual bash (or zsh) or just busybox within JupyterLite?
Any js shell is not sh or ash/hush (busybox) or bash.
Proposed Solution(s)
-
Compile busybox to wasm
-
Rewrite busybox in rust, which probably more cleanly compiles to wasm
-
Build a container2wasm WASM container, test it with wasmtime (TODO: and which other runtimes), and include bash:
https://github.com/ktock/container2wasm- https://medium.com/nttlabs/vscode-container-wasm-57d17dda7caa
So we’ve created an experimental VSCode extension “vscode-container-wasm” which enables to run Linux-based containers within the browser and interact with them via the terminal.
- https://medium.com/nttlabs/vscode-container-wasm-57d17dda7caa
-
https://labs.leaningtech.com/blog/mini-webvm-your-linux-box-from-dockerfile-via-wasm :
-
[WebVM is based on CheerpX: an x86 WASM engine. You] can deploy your own version of WebVM by simply forking the repo on GitHub and editing the included Dockerfile.
- https://github.com/leaningtech/webvm/blob/main/dockerfiles/debian_large
-
A GitHub Actions workflow will automatically deploy it to GitHub pages.
- https://github.com/leaningtech/webvm/blob/main/.github/workflows/deploy.yml
-
Additional context
Browser Support
-
SharedArrayBuffer
- MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#browser_compatibility
- Android Chrome Webview does not support SharedArrayBuffer? (2024-09)
- MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#browser_compatibility
-
HTTP Header:
Cross-Origin-Embedder-Policy: credentialless
- https://html.spec.whatwg.org/multipage/browsers.html#coep-credentialless
- https://fetch.spec.whatwg.org/#cross-origin-resource-policy-internal-check
- https://developer.chrome.com/blog/coep-credentialless-origin-trial
- https://github.com/WICG/credentiallessness
- https://caniuse.com/mdn-http_headers_cross-origin-embedder-policy_credentialless
- Safari and Android Firefox do not support credentialless Cross-Origin-Embedder-Policy (2024-09)
-
File System API
- Creates an in-browser filesystem
- MDN: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API
-
File System Access API
- Extends the File System API to allow access to local files on the client
- Spec: https://wicg.github.io/file-system-access/
- Src: https://github.com/WICG/file-system-access
-
Direct Sockets API
- Spec: https://wicg.github.io/direct-sockets/
- https://chromestatus.com/feature/6398297361088512
-
Availability expectation: Feature is available only in Isolated Web Apps on desktop platforms.
- https://github.com/GoogleChromeLabs/telnet-client
-
- https://github.com/guest271314/direct-sockets-http-ws-server
- Direct Sockets API > Permissions Policy: https://wicg.github.io/direct-sockets/#permissions-policy
- https://developer.chrome.com/docs/apps/reference/socket (legacy; Chrome 33)
- Mozilla's position: Raw Sockets API mozilla/standards-positions#431
- WebRTC or WebSocket relay like https://webvm.io's tailscale vpn relay
-
Ctrl-Shift-p
- Firefox: Ctrl-Shift-p opens a new window and the keyboard shortcut can't yet be unbound; though in the Ctrl-I 'Page Info' dialog there is an option to allow sites to "Override keyboard shortcuts"