Repository navigation
feat(js): add Python and TypeScript runtime host functions - #2740
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | c145267 | Commit Preview URL Branch Preview URL |
Oct 16 2026, 08:57 PM |
2 tasks done
2 tasks done
2 tasks done
chaliy
added a commit
that referenced
this pull request
Oct 25, 2026
…2776) `runtime-functions.ts` arrived in #2740 without being added to tsconfig's `include`. tsc compiles a reachable import regardless, so it kept emitting `runtime-functions.js` and every local build and `js.yml` run stayed green. Two things broke on that omission. `publish-js.yml` ships a `js-stubs` artifact whose file list is maintained by hand from `include`, so it never gained the file; the test jobs download that artifact instead of running tsc. And `scripts/tests/test_js_publish_files.py`, the guard added after 0.18.2 shipped without `langchain.js`, reads its notion of "tsc output" out of the same `include` -- so the guard was blind to exactly the file missing from it. v0.20.0 therefore published to crates.io and PyPI while all fifteen `Publish JS` test jobs failed on `ERR_MODULE_NOT_FOUND` for runtime-functions.js, which `wrapper.js` (the package `main`) imports on its first line. `release-js` is gated on those jobs, so npm was never reached and both npm packages remain on 0.19.0. Fixes the omission in both tsconfigs, adds the two outputs to the artifact, and closes the guard's blind spot by checking `include` against the sources on disk. Reproduced the failure locally and verified the fix; 181/181 script tests pass, identical tsc error set before and after, all 34 checks green. Does not republish 0.20.0: only a `refs/tags/vX.Y.Z` ref publishes as npm `latest`, so npm needs a patch release. `Publish Web` failed separately on an npm 404 for `@everruns/bashkit-wasm`, which needs an `NPM_TOKEN` rotation. Claude-Session: https://claude.ai/code/session_01RE65s6DTUE7LzZgc1o6Hzi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Node/Bun/Deno applications can register synchronous or asynchronous host functions for embedded Python and TypeScript on Bash, BashTool, and all JavaScript agent adapters. Each execution preserves its caller's AsyncLocalStorage context and supplies an AbortSignal for host I/O. Reset preserves handlers; snapshot restoration accepts fresh callbacks.
Blocking instance access rejects active asynchronous execution, preventing event-loop deadlocks involving host functions, streaming output, and live filesystem handles. Added bounded JSON conversion and explicit callback rows to the capability parity contract; Rust BashTool gains the Python callback builder counterpart.
Why
Extend the shipped Python integration to the native JavaScript SDK and make cross-surface callback gaps explicit. Browser/WASM and C follow in separate PRs.
Before / After
Before: externalFunctions had no callable JavaScript dispatcher; TypeScript runtime options were unavailable. LangChain used synchronous execution internally.
After: Python lookup(21, multiplier=2) and TypeScript await double(21) return 42 through real host callbacks. Local verification: 656 AVA tests and 167 runtime compatibility tests pass, including HTTP request contexts, queued requests, cancellation, timeout/reuse, snapshots, recursive access, worker-thread environments and all agent adapters. A subprocess regression terminates workers with pending or CPU-bound host functions and verifies quiet native teardown; completed ScriptedTool worker shutdown is also covered. Shared JSON codec and Rust tool callback tests pass. CI adds targeted macOS/Windows callback coverage alongside the existing Linux Node/Bun/Deno matrix.
just pre-pr,just test, all-target/all-feature Clippy and the parallel execution benchmark pass locally.Risk
Medium: native callback lifetime and synchronization. Execution-local revocation, weak NAPI dispatchers, bounded queues and blocking-entry guards cover shutdown/cancellation/reentry. Host I/O must observe its signal; application side effects cannot be rolled back.
Checklist