@mcp-b/do-runtime 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +18 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5972b65: Preserve the native `ReadableStream` brand when gating response body reads so Chromium accepts tee branches as `Response` bodies.
|
|
8
|
+
|
|
3
9
|
## 0.1.0 — 2026-08-20
|
|
4
10
|
|
|
5
11
|
- Port workerd-style actor identity, input/output gates, SQLite KV and SQL, alarms, facets, Worker Loader, loopback exports, WebSockets, and gated host primitives to TypeScript.
|
package/dist/index.js
CHANGED
|
@@ -3679,34 +3679,27 @@ function gateResponseBody(ctx, response) {
|
|
|
3679
3679
|
*/
|
|
3680
3680
|
var BYOB_READER_UNGATABLE_MESSAGE = "getReader({ mode: 'byob' }): a BYOB reader cannot be gated by this runtime, because `ReadableStream.getReader` is the only seam it has and a byte stream's `read(view)` returns the caller's own buffer. Read the body through `arrayBuffer()` or a default reader.";
|
|
3681
3681
|
function gateReadableStream(ctx, stream) {
|
|
3682
|
-
const
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3682
|
+
const getReader = stream.getReader.bind(stream);
|
|
3683
|
+
const tee = stream.tee.bind(stream);
|
|
3684
|
+
Object.defineProperties(stream, {
|
|
3685
|
+
getReader: {
|
|
3686
|
+
configurable: true,
|
|
3687
|
+
writable: true,
|
|
3688
|
+
value(options) {
|
|
3688
3689
|
if (options?.mode === "byob") throw new Error(BYOB_READER_UNGATABLE_MESSAGE);
|
|
3689
|
-
return gateReader(ctx,
|
|
3690
|
-
}
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
const [a, b] =
|
|
3690
|
+
return gateReader(ctx, getReader());
|
|
3691
|
+
}
|
|
3692
|
+
},
|
|
3693
|
+
tee: {
|
|
3694
|
+
configurable: true,
|
|
3695
|
+
writable: true,
|
|
3696
|
+
value() {
|
|
3697
|
+
const [a, b] = tee();
|
|
3697
3698
|
return [gateReadableStream(ctx, a), gateReadableStream(ctx, b)];
|
|
3698
|
-
}
|
|
3699
|
-
bound.set(property, tee);
|
|
3700
|
-
return tee;
|
|
3701
|
-
}
|
|
3702
|
-
const value = Reflect.get(subject, property, subject);
|
|
3703
|
-
if (typeof value === "function") {
|
|
3704
|
-
const method = value.bind(subject);
|
|
3705
|
-
bound.set(property, method);
|
|
3706
|
-
return method;
|
|
3699
|
+
}
|
|
3707
3700
|
}
|
|
3708
|
-
|
|
3709
|
-
|
|
3701
|
+
});
|
|
3702
|
+
return stream;
|
|
3710
3703
|
}
|
|
3711
3704
|
function gateReader(ctx, reader) {
|
|
3712
3705
|
return new Proxy(reader, { get(subject, property) {
|