Package-level declarations

Types

Link copied to clipboard
interface NwApi

Abstracts the slice of Apple's Network.framework needed by NwLoom.

Link copied to clipboard
data class NwBytesReceived(val connectionId: NwConnectionId, val bytes: ByteArray)

A chunk of bytes arrived on connectionId. Framing is above this layer.

Link copied to clipboard
data class NwConnectionClosed(val connectionId: NwConnectionId, val reason: String? = null)

The connection connectionId closed.

Link copied to clipboard
value class NwConnectionId(val value: String)

A locally-scoped identifier for one connection managed by NwApi — either an inbound connection accepted while listening, or an outbound connection dialled via NwApi.connect. Opaque and only meaningful to the NwApi instance that produced it.

Link copied to clipboard
data class NwConnectionOpened(val connectionId: NwConnectionId, val endpoint: NwEndpoint?)

A connection was established on connectionId.

Link copied to clipboard
sealed interface NwConnState

The current lifecycle state of one NwApi connection, keyed by NwConnectionId in NwApi.connectionStates. A minimal, total sum type: every tracked connection is in exactly one of these three states, and a state map is the single drop-tolerant signal NwSeam reconciles for both the #1478 path-loss grace timer AND the #1522 terminal-teardown backstop (it unifies the former separate connectionViability boolean map and closedConnections reason map into one — #1539).

Link copied to clipboard
data class NwEndpoint(val id: String, val serviceName: String, val identityResolved: Boolean = true)

A remote endpoint discovered while browsing.

Link copied to clipboard
class NwFramer(maxFrameSize: Int = DEFAULT_MAX_FRAME_SIZE)

Stateful, incremental decoder for the 4-byte-big-endian-length-prefixed frame format produced by encodeFrame (wire-compatible with :kuilt-stream's framed()).

Link copied to clipboard

A physical interface type a path can traverse. Cellular/Wired/Loopback/Other mirror nw_interface_type_t directly; Wi-Fi is split into two so a consumer can tell the "same access point" case from a true peer-to-peer link:

Link copied to clipboard
class NwLoom(api: NwApi, serviceType: String, val selfId: PeerId = freshPeerId(), policy: DeliveryPolicy = DeliveryPolicy.Reliable, random: Random = Random.Default, weaveTimeout: Duration = DEFAULT_WEAVE_TIMEOUT, wovenPathGrace: Duration = DEFAULT_WOVEN_PATH_GRACE) : Loom

Full-mesh Loom over an NwApi — Apple Network.framework's peer-to-peer fabric.

Link copied to clipboard
data class NwPathState(val status: NwPathStatus, val interfaces: Set<NwInterfaceType>, val isExpensive: Boolean, val isConstrained: Boolean, val unsatisfiedReason: NwUnsatisfiedReason?)

A snapshot of the device's current network path, as reported by Apple's NWPathMonitor (nw_path_monitor_*). This is the live environmental signal that turns a seam's us.tractat.kuilt.core.Seam.capability from a once-at-connect seed into a reactive value: as Wi-Fi drops, cellular takes over, or the Local-Network permission is denied, a fresh NwPathState is published and the seam's availability follows.

Link copied to clipboard

The overall reachability of a network path, mirroring nw_path_status_t.

Link copied to clipboard
class NwRoomHost(loom: Loom, sessionConfig: Pattern) : RoomHost

Network.framework room host — the lobby surface for the peer-to-peer fabric.

Link copied to clipboard
data class NwTag(val sessionName: String, val peerKey: String, val roomKey: String) : Tag

A joiner-side Tag for the kuilt-nw (Apple Network.framework) fabric that carries the room's bearer secret.

Link copied to clipboard

Thrown by NwLoom.weave when no peer is reached within the weave timeout — the fabric never wove.

Link copied to clipboard

Why a path is NwPathStatus.Unsatisfied, mirroring nw_path_unsatisfied_reason_t. LocalNetworkDenied is the Local-Network-permission denial — the actionable signal a consumer turns into "grant Local Network access" guidance instead of a silent stall.

Functions

Link copied to clipboard
fun encodeFrame(payload: ByteArray, maxFrameSize: Int = DEFAULT_MAX_FRAME_SIZE): ByteArray

Encode payload as [len_be32][payload] — a 4-byte big-endian length prefix followed by the payload bytes. Byte-identical to what :kuilt-stream's framed() writes via sink.writeInt(frame.size), so the two framings are wire-compatible.