Use capnweb native ReadableStream support for remote Media bindings#12582
Use capnweb native ReadableStream support for remote Media bindings#12582
capnweb native ReadableStream support for remote Media bindings#12582Conversation
🦋 Changeset detectedLatest commit: 712e2eb The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Claude finished @penalosa's task —— View job Changeset Review
The changeset
Based on the PR description and the review discussion between @penalosa and @petebacondarwin, this is described as "mostly just an internal refactoring" with the note that "Previously we 'faked' streams with Media Bindings over fetch, but now they will work properly." Recommendation: If this is purely internal refactoring with no user-facing impact, the changeset should be removed entirely and the PR should be labeled with The current description "Internal refactor to use capnweb's native |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
capnweb native ReadableStream support for remote Media bindings
4d0a95b to
87328d7
Compare
packages/miniflare/src/workers/dispatch-namespace/dispatch-namespace-proxy.worker.ts
Outdated
Show resolved
Hide resolved
packages/miniflare/src/workers/shared/remote-proxy-client.worker.ts
Outdated
Show resolved
Hide resolved
packages/miniflare/src/workers/shared/remote-proxy-client.worker.ts
Outdated
Show resolved
Hide resolved
packages/miniflare/src/workers/shared/remote-proxy-client.worker.ts
Outdated
Show resolved
Hide resolved
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Nice! 😄 looks good to me 🙂
| "wrangler": patch | ||
| --- | ||
|
|
||
| Use capnweb's native ReadableStream support for remote Media and Dispatch Namespace bindings |
There was a problem hiding this comment.
Is there any user facing change here? Or is this PR more of an internal refactoring?
There was a problem hiding this comment.
This is mostly just an internal refactoring. Previously we "faked" streams with Media Bindings over fetch, but now they will work properly. As a consequence, any other JSRPC calls to a remote bings service binding that returns a stream will now also work. I suppose I could remove the changeset? What do you think?
… bindings
This PR updates miniflare to use capnweb's native ReadableStream support
(via workerd entry point) for remote Media and Dispatch Namespace bindings.
Changes:
- Update capnweb to PR 139 (adds Headers/Request/Response + streams support)
- Remove custom Media binding worker - use remote-proxy-client directly
- Simplify dispatch-namespace to use service binding pattern (like Media)
- Add makeRemoteProxyStub() helper for capnweb RPC + fetch interception
- Configure esbuild with workerd conditions for capnweb workers
The dispatch-namespace binding now uses JSRPC with promise pipelining,
so `namespace.get('worker').fetch(request)` works without extra round-trips.
- Add optional workerScript param to remoteProxyClientWorker() - Use remoteProxyClientWorker() in dispatch-namespace plugin (consistency) - Fix protocol downgrade: https→wss, http→ws (was always using ws:)
The refactor into makeRemoteProxyStub dropped the bindingType → MF-Binding-Type forwarding that the AI RPC workaround in ProxyServerWorker depends on.
…b from user worker Move capnweb out of the dispatch namespace extension module (which runs in the user's isolate) into a dedicated proxy worker accessed via service binding. The extension is now a thin shim that delegates .get() calls. Also: simplify extraContext plumbing in remote-proxy-client, revert unrelated worker-ts fixture changes.
…rker, update capnweb to 0.5.0
d3969c4 to
712e2eb
Compare
Use capnweb's native ReadableStream support for remote Media and Dispatch Namespace bindings.
Build configuration
conditions: ["workerd", "worker", "browser"]to esbuild embed-worker plugins so capnweb resolves to its workerd entry pointMedia bindings
binding.worker.ts— Media bindings now useremoteProxyClientWorkerdirectlyevaluateMediaBinding()/isSpecialCaseMediaBindingRequest()HTTP workaround fromProxyServerWorker.tsDispatch namespace bindings
dispatch-namespace-proxy.worker.ts— proxy client that creates capnweb stubs with dispatch optionsdispatch-namespace.worker.tsto delegate to the proxy client via service bindingShared utilities
makeRemoteProxyStub()for creating capnweb-backed Fetcher proxiesremoteProxyClientWorker()script override parameter for custom proxy workersProxyMetadatatype andRemoteBindingEnvfor consistent typingDependencies
^0.5.0via pnpm catalog