yuri91
Show HN: Codex CLI compiled to WASM running in the browser
https://browsercode.io/agents/codex
Hi HN! As part of our ongoing work on BrowserPod, an in-browser WebAssembly sandbox, we have significantly expanded what the Rust WebAssembly target can achieve.Our approach proved so robust that we could get the whole Codex CLI (~1.25M lines of Rust, excluding dependencies) to run in the browser, with extremely minimal modifications.Now, Codex CLI by itself could not do much, but BrowserPod...
Beyond WASI: Running any Rust application in the browser with BrowserPod 3.0
A Linux-like kernel in a browser tab – deep dive in the BrowserPod architecture
Currently it supports Node, but we plan to add Python, Ruby, git, and more.
You can see it in action in this demo: https://vitedemo.browserpod.io
More info here: https://labs.leaningtech.com/blog/browserpod-10
Ah and kudos to Syrus and his team for this release. Edge.js's architecture seems to have many similarities with BrowserPod. I see it as proof that we are both going in the right direction!
Show HN: BrowserPod – In-browser Node.js, Vite, and Svelte with full networking
https://vitedemo.browserpod.io
The code runs entirely in the Browser.Inbound and Outbound networking are provided with the help of Cloudflare Workers, and the dev server is reachable from the Internet as long as the tab is open.See https://labs.leaningtech.com/blog/browserpod-annoucement for more info or ask anything here.
Does this mean that eventually in a world where we all use this stuff, no new language/framework/library will ever be able to emerge?
Competing with the existing alternatives will be too hard. You won't even be able to ask real humans for help on platforms like StackOverflow because they will be dead soon.
The second time almost nothing.
The terminal-based https://webvm.io has it pre-installed but the graphical demo running Alpine does not.
Luckily, the package manager also works so you can install it with `apk add curl`
jslinux: 4.7s
wasmer: 1.3s
webvm: 1.2s
It's based on CheerpJ, a JVM that runs in the browser (using JS and Wasm).
Adding AddressSanitizer support to the Cheerp WebAssembly compiler
Does it support networking? (And if so, is it using a proxy to connect to the internet or is it using a virtualized network layer that stays in the browser?)
How is fork implemented? (Asyncify all the code?)
I was looking at the Github org page (https://github.com/wasix-org), but I can't figure out where this stuff is.
As an AI language model, I do not collect personal data directly as I do not have access to user information. However, I understand that OpenAI, the company that developed and manages the platform, has been ordered to temporarily limit the processing of data of Italian users and is under investigation by the Italian Data Protection Authority.
As an AI language model, my purpose is to provide conversational assistance and generate human-like text based on the input provided by the user. My training data is sourced from publicly available text on the internet and does not specifically target any individual or collect personal data.
I understand that OpenAI has been accused of not providing adequate information to users regarding the collection and storage of personal data and not having a legal basis for such collection. I cannot comment on OpenAI's specific policies and practices regarding data collection and storage, as I am not privy to such information.
However, I believe that it is important for companies to prioritize user privacy and to comply with data protection regulations. I hope that OpenAI will take the necessary measures to address the concerns raised by the Italian Data Protection Authority and implement appropriate safeguards to protect the personal data of its users.
What we usually suggest is to compile most of the application to Wasm (which is also the default), and move the parts that most interact with the outside world to JS.
This can actually result in a speedup if it avoids multiple back-and-forths between JS and Wasm, which is common if you use a Browser/JS api from Wasm.
We do include the C (Musl) and C++ (Clang's libcxx) standard libraries.
And we do have some custom LLVM passes to improve code size and performance (See for example [1] and [2]).
But the main selling point in my opinion is the ability to target JavaScript, and (almost) freely mix data and code compiled to either JS or Wasm.
Emscripten can also target JS, but it still retains the linear memory model of Wasm (or X86, Arm, ...), which means that what you get in the end is a big TypedArray and operations on it using basic types.
With Cheerp, code compiled to JS uses an object memory model: a C++ object will become a garbage-collected JS object. While this has some limitations (you can't do unsafe casts and treat your memory like it's a big array, because it isn't), it allows seamless integration with the Browser (or any third-party) APIs:
- You can store a DOM element directly in your C++ objects (instead of doing everything through tables)
- You can directly manipulate JS Strings instead of constantly converting back and forth to C strings
- You can create nice zero-overhead interfaces to use your C++ classes from manually written JS
- Or, you can just write your whole program in C++, including callbacks for DOM events and whatnot
And you can still compile the peformance-sensitive or type-unsafe parts of your code to Wasm (losing access to some convenience in exchange for speed).
You can get an idea from the Pong tutorial [3], although it's a bit of a contrived example to showcase what can be done.
[1] https://medium.com/leaningtech/partialexecuter-reducing-weba...
[2] https://docs.leaningtech.com/cheerp/Cheerp-PreExecuter.html
[3] https://docs.leaningtech.com/cheerp/Cheerp-Tutorial-Mixed-mo...
See "Converting an applet"
CheerpJ does exactly that: it ships a full JVM implementation (including Swing/AWT, Threads, ...) that runs in JS/Wasm inside your browser. The Applet Runner extension detects applets in the page and runs them through CheerpJ.
The example that you list seems to work.
Generating entire modules works, but it has a number of issues.
For example, you need to carefully decide how big your modules are going to be:
- Too small, and you end up compiling many many modules, which eventually crashes the browser if you don't dispose of the old ones
- Too big (many functions batched together), and you have too much latency before your code is available to run
Being able to compile a single function to add to an existing module (or something like that) would help a lot.