4.0.1's typecheck gate compiled each package internally against
lib: ["ES2022"]. That doesn't catch types that only fail when
*consumer* code (lib: ["DOM"] + exactOptionalPropertyTypes) tries to
assign a native browser type into one of our locally-defined narrower
types. Dispatch hit one such case in @shade/files inline-threshold.ts.
This release adds a tests/consumer-strict/ smoke project to the
pre-publish gate. It compiles a tiny "as if I were a downstream app"
TS file against:
lib: ["ES2022", "DOM", "DOM.Iterable"]
types: ["bun-types"]
exactOptionalPropertyTypes: true
strict: true
paths → packages/*/src/index.ts
scripts/typecheck-all.ts now runs the smoke after per-package checks.
Both must pass before publish:dry / publish:all proceeds.
### Fixed
- @shade/files inline-threshold.ts: MinimalReader<T> rewritten as the
explicit disjoint union { done:false, value:T } | { done:true,
value?: T | undefined } that's assignable from every native reader
shape (bun, DOM, node:stream/web). Fixes the
"ReadableStreamReadResult is not assignable" Dispatch reported.
- @shade/files streams-bridge (client + server): stash setTimeout
return in a local before .unref?.() via { unref?: () => void } cast.
Fluent .unref?.() failed under lib: ["DOM"] (setTimeout returns
number there).
- @shade/sdk background.ts: same setInterval .unref?.() fix.
Wire-compatible. No API shape changed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shade/transport-webrtc
V3.11 — direct peer-to-peer chunk transport for Shade transfers via
RTCDataChannel. Plugs into @shade/transfer's ITransferTransport
contract and wires automatically into @shade/sdk via
shade.configureWebRTC().
import { createShade } from '@shade/sdk';
import { nativeRtcFactory } from '@shade/transport-webrtc';
const shade = await createShade({ prekeyServer });
shade.configureWebRTC({ factory: nativeRtcFactory() });
shade.configureTransfers({ resolveBaseUrl });
await shade.upload({ to: 'bob', input: file }); // → P2P when NAT allows,
// HTTP otherwise.
See docs/webrtc.md for the full guide: NAT-traversal realities, TURN config, glare resolution, wire format, diagnostics, and end-to-end test recipes.
What's inside
WebRtcConnection— one peer connection between two Shade endpoints, driving offer/answer/ICE through Shade's own ratchet.WebRtcConnectionManager— per-peer pool with deterministic glare resolution.WebRtcSignalingChannel— JSON signaling messages multiplexed overShade.send/Shade.onMessage.WebRtcTransferTransport— implementsITransferTransportover the managed DataChannel; ack-correlated by 16-byte requestId tokens.MemoryRtcFactory— in-process WebRTC simulator for tests.nativeRtcFactory()— adapter overglobalThis.RTCPeerConnection(browsers / Deno / Cloudflare Workers).
Adapters
@shade/transport-webrtc ships only the standard-API adapter
(nativeRtcFactory). For Bun / Node, wrap your library of choice
behind the IRtcFactory interface — only createPeerConnection,
createDataChannel, and standard addEventListener are required.
Recommended adapters: