frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Zapcode: A TypeScript interpreter in Rust for AI agents (2µs start, sandbox)

https://github.com/TheUncharted/zapcode
1•TheUncharted•1h ago

Comments

TheUncharted•1h ago
Hey everyone,

I was inspired by Monty and built Zapcode — an open-source TypeScript subset interpreter in Rust, designed for AI agents that write code instead of chaining tool calls.

The problem: AI agents are better when they write code rather than calling tools one by one. Cloudflare (https://blog.cloudflare.com/code-mode/), Anthropic, HuggingFace, and Pydantic are all pushing this pattern. But running AI-generated code is dangerous and slow — Docker adds 200-500ms cold start, V8 isolates bring ~20MB of binary.

Zapcode takes a different approach: a purpose-built bytecode VM that starts in ~2µs, enforces a deny-by-default sandbox at the language level, and can snapshot execution state to <2KB for later resumption.

Instead of three LLM round-trips:

LLM → tool A → LLM → tool B → LLM → tool C → LLM

The LLM writes one code block:

const a = await getWeather("Tokyo"); const b = await getWeather("Paris"); const flights = await searchFlights(a.temp < b.temp ? "Tokyo" : "Paris", ...);

One LLM call, three tool executions. Intermediate values stay in the code, they never pass back through the model.

Key design decisions:

- TypeScript subset, not full TS. Enough for what LLMs generate (variables, functions, classes, async/await, closures, destructuring, 30+ string methods, 25+ array methods) — not enough to be dangerous (no eval, no import, no require, no fs/net/env).

- Sandbox by construction. The core crate has zero std::fs, zero std::net, zero std::env, zero unsafe blocks. The only way out is external functions you explicitly register — when the VM hits one, it suspends and returns a snapshot. Your code resolves the call, not the guest.

- Snapshot/resume. The VM serializes its entire state to bytes (<2KB typical). You can resume in a different process, on a different machine, days later. This matters for long-running tools (slow API calls, human-in-the-loop approval).

- Embeddable everywhere. Rust, Node.js (napi), Python (PyO3), WebAssembly. No runtime dependencies.

Inspired by Monty (https://github.com/pydantic/monty) which does the same for Python. Zapcode is Monty for TypeScript.

Benchmarks (full pipeline, no caching):

Simple expression: 2.1µs Function call: 4.6µs Loop (100 iter): 77.8µs Fibonacci(10): 138.4µs Snapshot size: <2KB Cold start: ~2µs

Source: https://github.com/TheUncharted/zapcode

Faster Bundler

https://railsatscale.com/2026-03-09-faster-bundler/
1•hahahacorn•30s ago•0 comments

Big Pork attacks California law on caging

https://www.latimes.com/politics/newsletter/2026-03-12/chabria-column-pig-confinement-pork-califo...
1•bilsbie•38s ago•0 comments

A DOGE bro left Social Security with 500M records on a drive and expected pardon

https://www.techdirt.com/2026/03/11/a-doge-bro-allegedly-walked-out-of-social-security-with-500-m...
1•spenvo•57s ago•0 comments

How to Run Local LLMs with Claude Code (Unsloth)

https://unsloth.ai/docs/basics/claude-code
1•armcat•1m ago•0 comments

AI assistants now equal 56% of global search engine volume

https://searchengineland.com/ai-assistants-global-search-engine-volume-study-471118
1•gmays•2m ago•0 comments

What is the strongest open source model for coding against Opus 4.6?

2•eeko_systems•5m ago•0 comments

Whole-Brain Connectomic Graph Model Enables Whole-Body Locomotion Control in Fly

https://arxiv.org/abs/2602.17997
2•sosodev•7m ago•0 comments

Patience – 3Sec Hold Game:)

https://3sec.site/
2•casultra•7m ago•2 comments

Show HN: Homecastr - AI home price forecasts on a map

https://www.homecastr.com/
2•dhardestylewis•8m ago•0 comments

Show HN: DevNode.studio, 100% local dev tools to make back end work faster

https://www.devnode.studio/
2•nyosef26•8m ago•1 comments

Brex tests agents: by committing fraud

https://www.brex.com/journal/articles/simulation-testing-ai-audit-agent
3•brandonbloom•12m ago•0 comments

Cryo FAQ

https://notebook.ldeming.com/whyilovecryo/
3•sebg•13m ago•0 comments

AI Slop: A Slack API Rate Limiting Disaster

https://code.dblock.org/2026/03/12/ai-slop-a-slack-api-rate-limiting-disaster.html
2•dblock•13m ago•0 comments

"You're Right"- What if you gave a web dev from 2006 Claude Code?

https://wiredsis.medium.com/youre-absolutely-right-2f4281e0f950
2•chess•14m ago•0 comments

Illinois introduces OS-level age verification law

https://legiscan.com/IL/bill/SB3977/2025
19•rickcarlino•15m ago•3 comments

Sam Altman Says Intelligence Will Be a Utility

https://gizmodo.com/sam-altman-says-intelligence-will-be-a-utility-and-hes-just-the-man-to-collec...
3•cdrnsf•16m ago•1 comments

Now Is the Time to Eat Their Lunch

https://rodyne.com/?p=3875
2•boznz•16m ago•1 comments

Tanker Sea Owl I Boarded in the Baltic Sea

https://polisen.se/aktuellt/nyheter/nationell/2026/mars/tanker-sea-owl-i-boarded-in-the-baltic-sea/
2•madspindel•17m ago•0 comments

A 4 byte file can bypass permissions in a GraphQL package used for payments

https://medium.com/@caplanmaor/prototype-pollution-in-graphql-upload-minimal-cve-2025-65587-a8648...
2•BambaNugat•17m ago•1 comments

Code Quality in the Age of Coding Agents

https://michaeltimbs.me/blog/code-quality-in-the-age-of-coding-agents/
2•alpaylan•18m ago•0 comments

Ask HN: Does code style matter much anymore?

3•travisgriggs•21m ago•2 comments

DirectX: Bringing Console-Level Developer Tools to Windows

https://devblogs.microsoft.com/directx/directx-bringing-console-level-developer-tools-to-windows/
4•haunter•22m ago•0 comments

DIY: Enigma Machine from a Toilet Paper Tube

https://www.flyingpenguin.com/build-your-own-mini-enigma-machine-from-a-toilet-paper-tube/
2•rolph•22m ago•0 comments

Jones Act Enforcer

https://offshoremarine.org/page/JonesActEnforcer
2•signorovitch•22m ago•1 comments

Turn your best X posts into a portfolio people can browse

https://curio-brown.vercel.app
3•NachikethRamesh•24m ago•0 comments

Women of the Flemish Golden Age

https://news.artnet.com/art-world/meet-the-forgotten-women-of-the-flemish-golden-age-2751227
3•petethomas•24m ago•0 comments

Show HN: Stratum – SQL that branches and beats DuckDB on 35/46 1T benchmarks

https://datahike.io/notes/stratum-analytics-engine/
4•whilo•27m ago•1 comments

Show HN: I rebuilt the "similar movies/TV shows" algorithm on TasteFinder

https://tastefinder.io/
3•tastefinder_io•31m ago•0 comments

Killing the Serialization Tax: 1M Entity Ingestion in 11.8µs with C#

https://intelligentaudio.net/nexus-pulse
2•NexusCore•31m ago•1 comments

Safari web browser bugs: A year in review

https://lapcatsoftware.com/articles/2026/3/6.html
2•zdw•31m ago•0 comments