feat(sdk): restore transform callback with placeholder context#1335
feat(sdk): restore transform callback with placeholder context#1335mishushakov wants to merge 1 commit into
Conversation
This reverts commit 0dec3af.
|
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 156c0a9. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from 20f08c4. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.19.2-mishushakov-network-transform-callback.0.tgzCLI ( npm install ./e2b-cli-2.10.1-mishushakov-network-transform-callback.0.tgzPython SDK ( pip install ./e2b-2.20.1+mishushakov.network.transform.callback-py3-none-any.whl |
Summary
transformcallback variant forSandboxNetworkRule(JS + Python): in addition to a static{ headers: ... }object,transformcan be a function receiving a typedSandboxNetworkTransformContextwhose fields (sandboxId,teamId,executionId,identity.jwt/sandbox_id,team_id,execution_id,identity.jwt) are literal placeholder strings (${e2b.sandboxId}, etc.). The callback is invoked at sandbox-creation time; the resolved object — with placeholders intact — goes on the wire, and the egress proxy substitutes them per request.SandboxNetworkTransformContextfrom both SDKs.transformshape. Implemented as a straight revert of the stripping commit so the diff is small and the two PRs land cleanly in order.transform callback resolves sandboxId placeholderin JS,test_transform_callback_resolves_sandbox_idin Python sync + async) are restored but left commented out / disabled until the proxy-side placeholder resolution ships.Example — inject the sandbox's identity JWT (resolved per request)
Notes
${e2b.*}strings.${e2b.sandboxId},${e2b.teamId},${e2b.executionId},${e2b.identity.jwt}substitution before the disabled tests can be re-enabled.Test plan
transform callback resolves sandboxId placeholder(JS) andtest_transform_callback_resolves_sandbox_id(Python sync + async) and verify end-to-end againsthttpbin.e2b.team