Files
webnet/packages/tsconnect-redux
codingetandClaude f659f230cd
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
docs: add per-package READMEs and position Tailshare as the flagship app
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>
2026-08-14 23:51:59 +00:00
..

@webnet/tsconnect-redux

Redux Toolkit slice and bindings for @webnet/tsconnect IPN state.

buildIpnStore creates an RTK store combining slices for connection state, peers, exit-node selection, login URL, and inbound/outbound/waiting Taildrop file transfers. runWithStore wires an IPN instance's run() notify callbacks (notifyState, notifyNetMap, notifyIncomingFiles, ...) to dispatch the corresponding actions (setState, setNetmap, setIncomingFiles, ...), and wraps ipn.deleteWaitingFile so it also removes the entry from the store. bindFileOpsToStore mirrors a ControlledFileOps implementation's counters (file count, sizes, limits) into the store on every change. A large set of memoized selectors (getIpnState, getPeers, getWaitingFiles, isIpnLockedOut, getIpnSuggestedExitNode, ...) read from the resulting IpnState. This package has no UI framework dependency — @webnet/tsconnect-react layers React hooks and context on top of it, and @webnet/tsconnect-worker uses it to replicate state from a SharedWorker to its clients.

Entry points

Entry point Description
@webnet/tsconnect-redux buildIpnStore, runWithStore, bindFileOpsToStore, slice actions (setState, setNetmap, setExitNode, setLoginUrl, setIncomingFiles, setOutgoingFiles, deleteOutgoingFile, setWaitingFiles, deleteWaitingFile, setFileOpsState), slice selectors (selectIpnState, selectPeers, selectIncomingFiles, selectOutgoingFiles, selectWaitingFiles, selectFileOps), derived selectors (getIpnState, getPeers, getPeerByName, getWaitingFiles, getIncomingFiles, getOutgoingFiles, isIpnLockedOut, getIpnSuggestedExitNode, getLoginUrl, getExitNode, ...), and the IpnState/IpnAction/IpnDispatch/IpnStore/FileOpsState types.

Usage

import { initIPN } from "@webnet/tsconnect"
import { buildIpnStore, runWithStore, getIpnState, getPeers } from "@webnet/tsconnect-redux"

const store = buildIpnStore()
const buildIpn = await initIPN(wasmBytes)
const ipn = buildIpn({ authKey: process.env.TS_AUTHKEY })

runWithStore(ipn, store)

store.subscribe(() => {
  console.log(getIpnState(store.getState()), getPeers(store.getState()))
})

See also