CI / lint (pull_request) Successful in 3m39s
CI / format (pull_request) Successful in 3m24s
CI / install (pull_request) Successful in 9m4s
CI / typetest (pull_request) Successful in 3m5s
CI / typecheck (pull_request) Successful in 3m20s
CI / node-tests (pull_request) Successful in 3m31s
CI / browser-tests (pull_request) Successful in 5m16s
Give every workspace a README describing what it does, its entry points, and a short usage example, and link them from the root package table. Frame Tailshare in the root README as the application the libraries exist to be composed into, with the other apps as development and testing surfaces. Its own README records what works today and what the open issues intend for it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@webnet/state-transfer
Generic ownership-transfer contract for handing live objects across worker boundaries.
StateTransferable<T> is a single-method interface: transferState(): Promise<T> extracts the transferable state of an object and leaves the local object unusable afterwards. isStateTransferable is a runtime type guard for detecting the interface on an unknown value. The package has no dependencies and no implementations of its own; it exists so packages that need to move live state (sockets, sessions, worker-owned objects) between a worker and its host can agree on one contract without depending on each other.
Usage
import { isStateTransferable, type StateTransferable } from "@webnet/state-transfer"
class Session implements StateTransferable<{ buffer: ArrayBuffer }> {
async transferState() {
return { buffer: new ArrayBuffer(0) }
}
}
async function handOff(x: unknown) {
if (isStateTransferable(x)) {
// x becomes unusable after this call
return x.transferState()
}
}
See also
@webnet/tsconnect-worker— usesStateTransferableto move IPN state across a worker boundary.@webnet/smb2— usesStateTransferablefor connection handoff.