Skip to content

feat(wasm): add Python and TypeScript runtime host functions - #2743

Merged
chaliy merged 8 commits into
mainfrom
feat/browser-runtime-host-functions
Oct 16, 2026
Merged

chaliy merged 8 commits into
mainfrom
feat/browser-runtime-host-functions

Conversation

@chaliy

@chaliy chaliy commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Browser hosts can import @everruns/bashkit-wasm/runtimes to enable embedded Python and TypeScript with synchronous or asynchronous named host functions. Calls preserve each execution's caller context and receive an AbortSignal. Buffered execution, live command pipelines, byte sinks and bounded capture share the same execution-local dispatcher.

The default import keeps its slim binary and transfer-size budgets. Both bundles ship in the same npm archive. Terminal can use the embedded runtimes but rejects host-function registration.

Why

Complete browser callback parity after the Python and native JavaScript SDKs (#2739, #2740), including interaction with live command I/O (#2741), without SharedArrayBuffer or cross-origin isolation.

Before / After

Before: the browser package could not run embedded Python or TypeScript or dispatch their host functions.
After: both runtimes return 42 through asynchronous host callbacks, including HTTP fetch and live byte sinks in Chromium main threads and module workers.

Local verification: 76 slim-package tests, 24 runtime tests, real Chromium main-thread/worker streaming and runtime checks, strict TypeScript declarations, npm archive imports, wasm-target Clippy and package transfer-size gates pass. A regression proves that dropping runtime execution options loses sinks/capture; the integrated dispatcher preserves them. Tests also cover pending-host cancellation/reuse, sink completion/deadlines, caller-context separation, concurrent calls, reset-preserved commands, JSON validation, VFS and persistence. Full local pre-PR checks, all-target/all-feature Clippy, feature-sliced Rust/fail-point tests and the parallel benchmark pass on the combined tree; final CI is running.

Risk

Medium: optional VM bundle and async callbacks. Python host waits use the portable timeout abstraction. ZapCode 1.5.1 uses unsupported standard clocks on browser WASM, so only that target uses a source copy with namespace and platform-clock substitutions; native/WASI retain upstream. CI verifies every upstream source hash, complete file inventory and native version alignment. Deadlines remain enabled. Host I/O must observe cancellation; text observers reject mixed live options before execution.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 6b5cafc Commit Preview URL

Branch Preview URL
Oct 16 2026, 10:57 PM

@chaliy chaliy closed this Oct 16, 2026
@chaliy chaliy reopened this Oct 16, 2026
@chaliy
chaliy force-pushed the feat/browser-runtime-host-functions branch from a1bfb18 to 4a54c8e Compare October 16, 2026 21:58
@chaliy
chaliy merged commit e445e9a into main Oct 16, 2026
56 of 57 checks passed
@chaliy
chaliy deleted the feat/browser-runtime-host-functions branch October 16, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant