@statewalker/webrun-streams-libp2p 0.6.0 → 0.7.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/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { deserialize, serialize } from "@statewalker/webrun-msgpack";
2
+ import { connect as connect$1, overPorts, serve as serve$1 } from "@statewalker/webrun-rpc";
1
3
  import { deserializeError, newNativePortMux, serializeError } from "@statewalker/webrun-streams";
2
4
  //#region src/duplex-over-stream.ts
3
5
  const TYPE_DATA = 0;
@@ -17,6 +19,10 @@ const TYPE_ERROR = 2;
17
19
  * the transfer would complete anyway; a peer slower than that is
18
20
  * indistinguishable from one that has stopped reading altogether. Override via
19
21
  * `drainTimeoutMs` when a deployment knows better.
22
+ *
23
+ * Also the default stall bound of the port protocol (`connect`, `serve`,
24
+ * `serveConnections`, `libp2pPortMux`): a write on a call's stream that has
25
+ * waited for drain this long resets the stream (statewalker/webrun-wire#195).
20
26
  */
21
27
  const DEFAULT_DRAIN_TIMEOUT_MS = 3e5;
22
28
  /**
@@ -46,6 +52,9 @@ const DEFAULT_DRAIN_TIMEOUT_MS = 3e5;
46
52
  * of sixty.
47
53
  *
48
54
  * Exported so a deployment that knows its links can lower it deliberately.
55
+ *
56
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
57
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
49
58
  */
50
59
  const DEFAULT_CLOSE_TIMEOUT_MS = DEFAULT_DRAIN_TIMEOUT_MS;
51
60
  /**
@@ -85,6 +94,9 @@ const textDecoder = new TextDecoder();
85
94
  * JSON-serialised `Error`). Normal end-of-input is signalled by libp2p's
86
95
  * `close()`. The frame layer exists so we can preserve `Error` fidelity
87
96
  * across the wire (yamux's native stream reset only carries "stream reset").
97
+ *
98
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
99
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
88
100
  */
89
101
  async function* duplexOverStream(stream, input, opts = {}) {
90
102
  let peerEndedCalled = false;
@@ -476,6 +488,15 @@ function decodeVarint(buf, start) {
476
488
  throw new Error("decodeVarint: truncated");
477
489
  }
478
490
  //#endregion
491
+ //#region src/shared.ts
492
+ /**
493
+ * The protocol id `connect`/`serve` are configured with unless told otherwise.
494
+ * Their calls negotiate `portProtocolOf(protocol)` (with `/window`); the id
495
+ * itself is the deprecated protocol, still served and dialled as a fallback
496
+ * for one release (statewalker/webrun-wire#153).
497
+ */
498
+ const DEFAULT_PROTOCOL = "/webrun-streams/1.0.0";
499
+ //#endregion
479
500
  //#region src/stream-gate.ts
480
501
  const streamGates = /* @__PURE__ */ new WeakMap();
481
502
  function streamGateFor(node, peer) {
@@ -534,8 +555,7 @@ async function openGatedStream(node, peer, proto, dialOptions) {
534
555
  return node.dialProtocol(peer, protocols, dialOptions);
535
556
  }
536
557
  //#endregion
537
- //#region src/connect-serve.ts
538
- const DEFAULT_PROTOCOL = "/webrun-streams/1.0.0";
558
+ //#region src/legacy-connect-serve.ts
539
559
  /**
540
560
  * Builds the options object passed to `node.dialProtocol`/`node.handle`,
541
561
  * omitting any field the caller didn't supply rather than setting it to
@@ -557,8 +577,10 @@ function definedOptions(fields) {
557
577
  /**
558
578
  * Caller-side: each `call(input)` opens a new libp2p `Stream` via
559
579
  * `node.dialProtocol(peer, [protocol])` and runs the call over it.
580
+ *
581
+ * @deprecated See the module comment.
560
582
  */
561
- const connect = async ({ node, peer, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxOutboundStreams, runOnLimitedConnection }) => {
583
+ const legacyConnect = async ({ node, peer, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxOutboundStreams, runOnLimitedConnection }) => {
562
584
  const proto = protocol ?? "/webrun-streams/1.0.0";
563
585
  const dialOptions = definedOptions({
564
586
  maxOutboundStreams,
@@ -606,16 +628,12 @@ const connect = async ({ node, peer, protocol, drainTimeoutMs, readHighWaterByte
606
628
  };
607
629
  };
608
630
  /**
609
- * Server-side: registers `node.handle(protocol, ...)`. Each inbound stream is
610
- * wrapped as a `Duplex` and handed to `handler`. Identity-unaware; use
611
- * `serveConnections` when the handler needs to know who is calling.
612
- */
613
- const serve = async (params, handler) => serveConnections(params, () => handler);
614
- /**
615
- * Like `serve`, but the handler is built per inbound stream and is told which
616
- * peer libp2p proved on that connection.
631
+ * Server-side: registers `node.handle(protocol, ...)`. The handler is built per
632
+ * inbound stream and is told which peer libp2p proved on that connection.
633
+ *
634
+ * @deprecated See the module comment.
617
635
  */
618
- async function serveConnections({ node, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection }, makeHandler) {
636
+ async function legacyServeConnections({ node, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection }, makeHandler) {
619
637
  const proto = protocol ?? "/webrun-streams/1.0.0";
620
638
  const handleOptions = definedOptions({
621
639
  maxInboundStreams,
@@ -758,8 +776,9 @@ const DEFAULT_MAX_MESSAGE_BYTES = 67108864;
758
776
  * as on a `MessagePort`. Every message the peer sent before closing is
759
777
  * delivered before `signal` aborts. `postMessage` hands the frame to
760
778
  * `stream.send()` and does not wait for room; libp2p buffers up to the
761
- * stream's `maxWriteBufferLength`, past which it resets the stream. A sender
762
- * that must wait awaits `whenDrained()`.
779
+ * stream's `maxWriteBufferLength` (unbounded with yamux), past which it
780
+ * resets the stream. A sender that must wait checks `needsDrain` and awaits
781
+ * `whenDrained()`, as a windowed native port does.
763
782
  */
764
783
  function messageTargetOverStream(stream, { maxMessageBytes = DEFAULT_MAX_MESSAGE_BYTES } = {}) {
765
784
  const listeners = /* @__PURE__ */ new Set();
@@ -836,6 +855,9 @@ function messageTargetOverStream(stream, { maxMessageBytes = DEFAULT_MAX_MESSAGE
836
855
  get bufferedAmount() {
837
856
  return stream.writeBufferLength;
838
857
  },
858
+ get needsDrain() {
859
+ return stream.writableNeedsDrain === true && !life.signal.aborted;
860
+ },
839
861
  whenDrained() {
840
862
  if (!stream.writableNeedsDrain || life.signal.aborted) return Promise.resolve();
841
863
  return new Promise((resolve) => {
@@ -899,12 +921,21 @@ const DEFAULT_PORT_STREAM_LIMIT = 1024;
899
921
  * `connect()`. `meta` is not sent: the protocol says what a port is for.
900
922
  */
901
923
  async function libp2pPortMux(options) {
924
+ return openLibp2pPortMux(options, DEFAULT_PORT_STREAM_LIMIT);
925
+ }
926
+ /**
927
+ * {@link libp2pPortMux}, with `streamLimit` as the default of both stream
928
+ * limits; `undefined` leaves libp2p's own defaults (what `connect`/`serve`
929
+ * have always passed through). Internal.
930
+ */
931
+ async function openLibp2pPortMux(options, streamLimit) {
902
932
  const { node, peer, codec, onPort, maxMessageBytes, runOnLimitedConnection } = options;
903
- const maxInboundStreams = options.maxInboundStreams ?? 1024;
904
- const maxOutboundStreams = options.maxOutboundStreams ?? 1024;
933
+ const maxInboundStreams = options.maxInboundStreams ?? streamLimit;
934
+ const maxOutboundStreams = options.maxOutboundStreams ?? streamLimit;
905
935
  const protocol = options.protocol ?? "/webrun-ports/1.0.0";
906
936
  const maxMessageSize = options.maxMessageSize ?? 262144;
907
937
  const { window } = options;
938
+ const drainTimeoutMs = options.drainTimeoutMs ?? 3e5;
908
939
  const windowProtocol = windowProtocolOf(protocol);
909
940
  /**
910
941
  * A stream as a channel: framed bytes, and a reset to break it off (the peer hears it). The
@@ -915,7 +946,8 @@ async function libp2pPortMux(options) {
915
946
  fail: (reason) => stream.abort(reason),
916
947
  ...window !== void 0 && stream.protocol === windowProtocol ? { window: "agreed" } : {}
917
948
  });
918
- const dialOptions = { maxOutboundStreams };
949
+ const dialOptions = {};
950
+ if (maxOutboundStreams !== void 0) dialOptions.maxOutboundStreams = maxOutboundStreams;
919
951
  if (runOnLimitedConnection !== void 0) dialOptions.runOnLimitedConnection = runOnLimitedConnection;
920
952
  let handled = false;
921
953
  const control = newNativePortMux({
@@ -924,6 +956,7 @@ async function libp2pPortMux(options) {
924
956
  maxMessageSize,
925
957
  onPort,
926
958
  window,
959
+ drainTimeoutMs,
927
960
  async open(signal) {
928
961
  if (!peer) throw new Error("webrun-streams-libp2p: openPort needs `peer`");
929
962
  const stream = await openGatedStream(node, peer, window !== void 0 ? [windowProtocol, protocol] : protocol, {
@@ -939,10 +972,9 @@ async function libp2pPortMux(options) {
939
972
  }
940
973
  });
941
974
  if (onPort) {
942
- const handleOptions = {
943
- maxInboundStreams,
944
- maxOutboundStreams
945
- };
975
+ const handleOptions = {};
976
+ if (maxInboundStreams !== void 0) handleOptions.maxInboundStreams = maxInboundStreams;
977
+ if (maxOutboundStreams !== void 0) handleOptions.maxOutboundStreams = maxOutboundStreams;
946
978
  if (runOnLimitedConnection !== void 0) handleOptions.runOnLimitedConnection = runOnLimitedConnection;
947
979
  const served = window !== void 0 ? [protocol, windowProtocol] : [protocol];
948
980
  await node.handle(served, (stream, connection) => {
@@ -960,4 +992,239 @@ async function libp2pPortMux(options) {
960
992
  return control.mux;
961
993
  }
962
994
  //#endregion
963
- export { DEFAULT_CLOSE_TIMEOUT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_MAX_FRAME_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_PORT_MAX_MESSAGE_SIZE, DEFAULT_PORT_PROTOCOL, DEFAULT_PORT_STREAM_LIMIT, DEFAULT_PROTOCOL, PeerGoneError, connect, duplexOverStream, libp2pPortMux, messageTargetOverStream, serve, serveConnections };
995
+ //#region src/connect-serve.ts
996
+ /**
997
+ * 4 MiB: the port window `connect`/`serve` grant unless told otherwise — the
998
+ * most one call moves per round trip, and the most a producer runs ahead of a
999
+ * consumer that stopped reading (statewalker/webrun-wire#153).
1000
+ *
1001
+ * A call moves at most `window / RTT`, so the window should be at least the
1002
+ * link's bandwidth-delay product: 4 MiB covers 200 Mbit/s at 100 ms
1003
+ * (2.5 MB). Raise it for faster or longer links; lower it (not below 64 KiB)
1004
+ * to bound memory per call more tightly where the BDP is small — a window far
1005
+ * above the bottleneck's queue only adds latency (bufferbloat).
1006
+ */
1007
+ const DEFAULT_WINDOW = 4194304;
1008
+ /**
1009
+ * The protocol a call's stream negotiates for `connect`/`serve` configured
1010
+ * with `protocol`: `protocol` with `/ports` appended, and `/window` after it
1011
+ * when both ends run the window (always, between two releases from this one
1012
+ * on). `protocol` itself is the deprecated protocol, still served, and dialled
1013
+ * when a peer refuses this one.
1014
+ */
1015
+ function portProtocolOf(protocol) {
1016
+ return `${protocol}/ports`;
1017
+ }
1018
+ /** What a call's messages are on the wire: msgpack, as `webrun-rpc`'s stream tier posts them. */
1019
+ const codec = {
1020
+ encode: serialize,
1021
+ decode: deserialize
1022
+ };
1023
+ /**
1024
+ * Caller-side: each `call(input)` is one port of a windowed native port mux
1025
+ * (`libp2pPortMux`): one libp2p stream negotiating {@link portProtocolOf}
1026
+ * `protocol` with `/window`, over which `webrun-rpc`'s stream tier runs the
1027
+ * call, pipelining up to the server's window per round trip. Streams are
1028
+ * opened through the early-stream gate, so a burst of calls on a fresh
1029
+ * connection does not kill its muxer.
1030
+ *
1031
+ * Against an older server, which refuses that protocol, the call falls back to
1032
+ * the deprecated protocol on `protocol` itself, and the node remembers that
1033
+ * for the connection, so later calls to that peer dial it directly. The
1034
+ * fallback is removed in the next release.
1035
+ */
1036
+ const connect = async (params) => {
1037
+ const { node, peer, maxFrameBytes, maxOutboundStreams, runOnLimitedConnection } = params;
1038
+ const protocol = params.protocol ?? "/webrun-streams/1.0.0";
1039
+ const ports = await connect$1({
1040
+ mux: overPorts(() => openLibp2pPortMux({
1041
+ node,
1042
+ peer,
1043
+ codec,
1044
+ protocol: portProtocolOf(protocol),
1045
+ window: params.window ?? 4194304,
1046
+ drainTimeoutMs: params.drainTimeoutMs,
1047
+ maxMessageBytes: maxFrameBytes,
1048
+ maxOutboundStreams,
1049
+ runOnLimitedConnection
1050
+ }, void 0)),
1051
+ timeout: params.timeout
1052
+ });
1053
+ const legacy = await legacyConnect({
1054
+ node,
1055
+ peer,
1056
+ protocol,
1057
+ drainTimeoutMs: params.drainTimeoutMs,
1058
+ readHighWaterBytes: params.readHighWaterBytes,
1059
+ maxFrameBytes,
1060
+ maxOutboundStreams,
1061
+ runOnLimitedConnection
1062
+ });
1063
+ const call = (input) => {
1064
+ if (isLegacyPeer(node, peer, protocol)) return legacy.call(input);
1065
+ return withFallback(ports.call(input), () => legacy.call(input), (err) => {
1066
+ if (!isUnsupportedProtocol(err)) return false;
1067
+ markLegacyPeer(node, peer, protocol);
1068
+ return true;
1069
+ });
1070
+ };
1071
+ return {
1072
+ call,
1073
+ async close() {
1074
+ await Promise.allSettled([ports.close(), legacy.close()]);
1075
+ }
1076
+ };
1077
+ };
1078
+ /**
1079
+ * Server-side: serves each call as one port of a windowed native port mux
1080
+ * (`<protocol>/ports`, with and without `/window`), and runs `handler` on it.
1081
+ * Older callers are still answered on `protocol` itself, the deprecated
1082
+ * protocol, until the next release. Identity-unaware; use `serveConnections`
1083
+ * when the handler needs to know who is calling.
1084
+ */
1085
+ const serve = async (params, handler) => serveConnections(params, () => handler);
1086
+ /**
1087
+ * Like `serve`, but the handler is built per call and is told which peer
1088
+ * libp2p proved on the connection the call came on.
1089
+ */
1090
+ async function serveConnections(params, makeHandler) {
1091
+ const { node, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection } = params;
1092
+ const protocol = params.protocol ?? "/webrun-streams/1.0.0";
1093
+ let arriving;
1094
+ const stopPorts = await serve$1({
1095
+ mux: overPorts((onPort) => openLibp2pPortMux({
1096
+ node,
1097
+ codec,
1098
+ protocol: portProtocolOf(protocol),
1099
+ window: params.window ?? 4194304,
1100
+ drainTimeoutMs: params.drainTimeoutMs,
1101
+ maxMessageBytes: maxFrameBytes,
1102
+ maxInboundStreams,
1103
+ maxOutboundStreams,
1104
+ runOnLimitedConnection,
1105
+ onPort: onPort && ((port, info) => {
1106
+ arriving = info;
1107
+ try {
1108
+ return onPort(port, info);
1109
+ } finally {
1110
+ arriving = void 0;
1111
+ }
1112
+ })
1113
+ }, void 0)),
1114
+ timeout: params.timeout
1115
+ }, (input) => {
1116
+ const info = arriving;
1117
+ if (!info) throw new Error("webrun-streams-libp2p: a call arrived without its connection");
1118
+ return makeHandler({ remotePeer: info.remotePeer })(input);
1119
+ });
1120
+ let stopLegacy;
1121
+ try {
1122
+ stopLegacy = await legacyServeConnections({
1123
+ node,
1124
+ protocol,
1125
+ drainTimeoutMs: params.drainTimeoutMs,
1126
+ readHighWaterBytes: params.readHighWaterBytes,
1127
+ maxFrameBytes,
1128
+ maxInboundStreams,
1129
+ maxOutboundStreams,
1130
+ runOnLimitedConnection
1131
+ }, makeHandler);
1132
+ } catch (err) {
1133
+ await stopPorts();
1134
+ throw err;
1135
+ }
1136
+ let torn = false;
1137
+ return async () => {
1138
+ if (torn) return;
1139
+ torn = true;
1140
+ await Promise.all([stopPorts(), stopLegacy()]);
1141
+ };
1142
+ }
1143
+ /** Whether `err` says the peer speaks none of the protocols dialled. */
1144
+ function isUnsupportedProtocol(err) {
1145
+ return err instanceof Error && err.name === "UnsupportedProtocolError";
1146
+ }
1147
+ /**
1148
+ * `primary`, except that when its first `next()` rejects with an error
1149
+ * `fallBack` accepts — the port protocol refused, before any of the input was
1150
+ * read — the call runs on `fallback()` instead. `return()` and `throw()` go
1151
+ * straight to the current call, so a consumer that gives up on a pending
1152
+ * `next()` is heard at once, as by the call itself.
1153
+ */
1154
+ function withFallback(primary, fallback, fallBack) {
1155
+ let current = primary;
1156
+ let settled = false;
1157
+ const wrapped = {
1158
+ async next(...args) {
1159
+ if (settled) return current.next(...args);
1160
+ try {
1161
+ const result = await current.next(...args);
1162
+ settled = true;
1163
+ return result;
1164
+ } catch (err) {
1165
+ if (settled || !fallBack(err)) {
1166
+ settled = true;
1167
+ throw err;
1168
+ }
1169
+ settled = true;
1170
+ current = fallback();
1171
+ return current.next(...args);
1172
+ }
1173
+ },
1174
+ return(value) {
1175
+ settled = true;
1176
+ return current.return(value);
1177
+ },
1178
+ throw(error) {
1179
+ settled = true;
1180
+ return current.throw(error);
1181
+ },
1182
+ [Symbol.asyncIterator]() {
1183
+ return wrapped;
1184
+ }
1185
+ };
1186
+ const asyncDispose = Symbol.asyncDispose;
1187
+ if (asyncDispose) Object.defineProperty(wrapped, asyncDispose, {
1188
+ value: async () => {
1189
+ await wrapped.return(void 0);
1190
+ },
1191
+ configurable: true,
1192
+ writable: true
1193
+ });
1194
+ return wrapped;
1195
+ }
1196
+ /**
1197
+ * Peers known to refuse the port protocol, per local node, by peer and
1198
+ * protocol: the connection the refusal came on (`null` when the node cannot
1199
+ * tell), so a peer that restarts upgraded is probed again on its next
1200
+ * connection.
1201
+ */
1202
+ const legacyPeers = /* @__PURE__ */ new WeakMap();
1203
+ const legacyKey = (peer, protocol) => `${peer.toString()} ${protocol}`;
1204
+ function isLegacyPeer(node, peer, protocol) {
1205
+ const peers = legacyPeers.get(node);
1206
+ const mark = peers?.get(legacyKey(peer, protocol));
1207
+ if (!mark) return false;
1208
+ if (mark.connection == null || mark.connection.status === "open") return true;
1209
+ peers?.delete(legacyKey(peer, protocol));
1210
+ return false;
1211
+ }
1212
+ function markLegacyPeer(node, peer, protocol) {
1213
+ let peers = legacyPeers.get(node);
1214
+ if (!peers) {
1215
+ peers = /* @__PURE__ */ new Map();
1216
+ legacyPeers.set(node, peers);
1217
+ }
1218
+ peers.set(legacyKey(peer, protocol), { connection: connectionTo(node, peer) });
1219
+ }
1220
+ /**
1221
+ * The open connection to `peer`, when `node` can list its connections (a
1222
+ * narrow stand-in may offer only `dialProtocol`).
1223
+ */
1224
+ function connectionTo(node, peer) {
1225
+ if (typeof node.getConnections !== "function") return null;
1226
+ const target = peer.toString();
1227
+ return node.getConnections().find((c) => c.status === "open" && (c.remotePeer.toString() === target || c.remoteAddr.toString() === target || target.endsWith(`/p2p/${c.remotePeer.toString()}`))) ?? null;
1228
+ }
1229
+ //#endregion
1230
+ export { DEFAULT_CLOSE_TIMEOUT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_MAX_FRAME_BYTES, DEFAULT_MAX_MESSAGE_BYTES, DEFAULT_PORT_MAX_MESSAGE_SIZE, DEFAULT_PORT_PROTOCOL, DEFAULT_PORT_STREAM_LIMIT, DEFAULT_PROTOCOL, DEFAULT_WINDOW, PeerGoneError, connect, duplexOverStream, libp2pPortMux, messageTargetOverStream, portProtocolOf, serve, serveConnections };
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The deprecated protocol of `connect`/`serve` (statewalker/webrun-wire#153):
3
+ * one call per libp2p stream on `protocol` itself, framed by
4
+ * `duplexOverStream`, with its own flow control (yamux pause/resume and a
5
+ * paced reader). Releases up to 0.6.0 spoke only this.
6
+ *
7
+ * Kept for one release as a compatibility shim on both ends: `serve` still
8
+ * answers old callers on it, and `connect` falls back to it against an old
9
+ * server. Removed in the release after the one that introduced the port
10
+ * protocol, together with `duplexOverStream`.
11
+ *
12
+ * @deprecated Use `connect`/`serve`, which run over the windowed native port mux.
13
+ */
14
+ import type { Libp2p, PeerId } from "@libp2p/interface";
15
+ import type { Multiaddr } from "@multiformats/multiaddr";
16
+ import type { Connect } from "@statewalker/webrun-streams";
17
+ import { type ServeConnectionsHandler } from "./shared.js";
18
+ /** @deprecated See the module comment. */
19
+ export interface LegacyConnectParams {
20
+ node: Libp2p;
21
+ peer: PeerId | Multiaddr;
22
+ /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
23
+ protocol?: string;
24
+ /**
25
+ * How long to wait for a backpressured stream to drain before dropping the
26
+ * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes).
27
+ */
28
+ drainTimeoutMs?: number;
29
+ /**
30
+ * Response bytes held while the caller is not reading before the stream is
31
+ * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
32
+ */
33
+ readHighWaterBytes?: number;
34
+ /**
35
+ * The largest frame payload accepted from the peer; past it, or on a
36
+ * malformed frame header, the call fails and the stream is aborted. See
37
+ * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
38
+ */
39
+ maxFrameBytes?: number;
40
+ /**
41
+ * How many outgoing streams for this protocol libp2p allows to be open at
42
+ * the same time on one connection; passed through to `node.dialProtocol`.
43
+ * Left unset, libp2p's own default (64) applies.
44
+ */
45
+ maxOutboundStreams?: number;
46
+ /**
47
+ * Opt-in to dialing over a connection with limits on how much data can be
48
+ * transferred or how long it can be open for (e.g. a relayed circuit);
49
+ * passed through to `node.dialProtocol`. Left unset, libp2p refuses to open
50
+ * this protocol's stream on such a connection — this package does not
51
+ * decide that trade-off for the caller, it only exposes the knob.
52
+ */
53
+ runOnLimitedConnection?: boolean;
54
+ }
55
+ /** @deprecated See the module comment. */
56
+ export interface LegacyServeParams {
57
+ node: Libp2p;
58
+ /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
59
+ protocol?: string;
60
+ /**
61
+ * How long to wait for a backpressured stream to drain before dropping the
62
+ * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes). This is the only
63
+ * bound on a peer that requests something and then stops reading without
64
+ * closing, since the caller-side `.return`/abort escape does not exist here.
65
+ */
66
+ drainTimeoutMs?: number;
67
+ /**
68
+ * Request bytes held while the handler is not reading before the stream is
69
+ * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
70
+ */
71
+ readHighWaterBytes?: number;
72
+ /**
73
+ * The largest frame payload accepted from the peer; past it, or on a
74
+ * malformed frame header, the call fails and the stream is aborted. See
75
+ * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
76
+ */
77
+ maxFrameBytes?: number;
78
+ /**
79
+ * How many incoming streams for this protocol libp2p allows to be open at
80
+ * the same time on one connection; passed through to `node.handle`. Left
81
+ * unset, libp2p's own default (32) applies — past it, a new inbound stream
82
+ * is reset rather than queued, so a caller that opens one stream per
83
+ * in-flight request will start seeing rejected calls above that count.
84
+ */
85
+ maxInboundStreams?: number;
86
+ /**
87
+ * How many outgoing streams for this protocol libp2p allows to be open at
88
+ * the same time on one connection; passed through to `node.handle`. Left
89
+ * unset, libp2p's own default (64) applies.
90
+ */
91
+ maxOutboundStreams?: number;
92
+ /**
93
+ * Opt-in to accepting streams for this protocol over a connection with
94
+ * limits on how much data can be transferred or how long it can be open
95
+ * for (e.g. a relayed circuit); passed through to `node.handle`. Left
96
+ * unset, libp2p refuses to open this protocol's stream on such a
97
+ * connection — this package does not decide that trade-off for the
98
+ * consumer, it only exposes the knob.
99
+ */
100
+ runOnLimitedConnection?: boolean;
101
+ }
102
+ /**
103
+ * Caller-side: each `call(input)` opens a new libp2p `Stream` via
104
+ * `node.dialProtocol(peer, [protocol])` and runs the call over it.
105
+ *
106
+ * @deprecated See the module comment.
107
+ */
108
+ export declare const legacyConnect: Connect<LegacyConnectParams>;
109
+ /**
110
+ * Server-side: registers `node.handle(protocol, ...)`. The handler is built per
111
+ * inbound stream and is told which peer libp2p proved on that connection.
112
+ *
113
+ * @deprecated See the module comment.
114
+ */
115
+ export declare function legacyServeConnections({ node, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection, }: LegacyServeParams, makeHandler: ServeConnectionsHandler): Promise<() => Promise<void>>;
116
+ //# sourceMappingURL=legacy-connect-serve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-connect-serve.d.ts","sourceRoot":"","sources":["../src/legacy-connect-serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAGV,MAAM,EACN,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAOnE,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG7E,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM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  whenDrained(): Promise<void>;
22
+ /**
23
+ * Whether the stream needs to drain before it takes more (libp2p's
24
+ * `writableNeedsDrain`: the muxer's send window is spent and bytes are
25
+ * piling up in the write buffer). A windowed native port sends nothing
26
+ * while it is `true` (statewalker/webrun-wire#195).
27
+ */
28
+ readonly needsDrain: boolean;
22
29
  /** `signal` again, on the target: `webrun-rpc`'s `getPortCloseSignal` reads it from a port. */
23
30
  readonly closeSignal: AbortSignal;
24
31
  };
@@ -57,8 +64,9 @@ export declare const DEFAULT_MAX_MESSAGE_BYTES: number;
57
64
  * as on a `MessagePort`. Every message the peer sent before closing is
58
65
  * delivered before `signal` aborts. `postMessage` hands the frame to
59
66
  * `stream.send()` and does not wait for room; libp2p buffers up to the
60
- * stream's `maxWriteBufferLength`, past which it resets the stream. A sender
61
- * that must wait awaits `whenDrained()`.
67
+ * stream's `maxWriteBufferLength` (unbounded with yamux), past which it
68
+ * resets the stream. A sender that must wait checks `needsDrain` and awaits
69
+ * `whenDrained()`, as a windowed native port does.
62
70
  */
63
71
  export declare function messageTargetOverStream(stream: Stream, { maxMessageBytes }?: MessageTargetOverStreamOptions): StreamMessageTarget;
64
72
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"message-target-over-stream.d.ts","sourceRoot":"","sources":["../src/message-target-over-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,mBAAmB,CAAC;AAUlE,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,EAAE;QACN,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC5D,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAC/D,oEAAoE;Q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AC;QACvB,2CAA2C;QAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC;;;WAGG;QACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B;;;;;WAKG;QACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B,+FAA+F;QAC/F,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;KACnC,CAAC;IACF;;;;;;;OAOG;IACH,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,mDAAmD;AACnD,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,EAAE,eAA2C,EAAE,GAAE,8BAAmC,GACnF,mBAAmB,CAsHrB"}
@@ -65,10 +65,24 @@ export interface Libp2pPortMuxOptions {
65
65
  * negotiates `protocol` and runs as before. 1-4 MiB is a reasonable range:
66
66
  * the most one call moves per round trip, and the most a producer runs
67
67
  * ahead of a consumer that stopped reading.
68
+ *
69
+ * A windowed port never runs further ahead than min(the peer's window,
70
+ * this window), and sends nothing while its stream needs to drain
71
+ * (statewalker/webrun-wire#195).
68
72
  */
69
73
  window?: number;
74
+ /**
75
+ * How long, in ms, a write on a windowed port may wait for its stream to
76
+ * drain (a peer that stopped reading at the transport) before the stream
77
+ * is reset and the port fails. Only a write blocked on drain counts: a
78
+ * quiet call (an event stream between events) is never timed out. Credit
79
+ * for the peer is held back while the stream needs to drain, and counts
80
+ * too. Default {@link DEFAULT_DRAIN_TIMEOUT_MS} (5 minutes); 0 or `Infinity`:
81
+ * no bound.
82
+ */
83
+ drainTimeoutMs?: number;
70
84
  }
71
- /** A `webrun-rpc` `PortMux` by shape; this package imports nothing from it. */
85
+ /** A `webrun-rpc` `PortMux` by shape; the port mux imports nothing from it. */
72
86
  export interface Libp2pPortMux {
73
87
  openPort(meta?: unknown, options?: {
74
88
  signal?: AbortSignal;
@@ -95,4 +109,10 @@ export interface Libp2pPortMux {
95
109
  * `connect()`. `meta` is not sent: the protocol says what a port is for.
96
110
  */
97
111
  export declare function libp2pPortMux(options: Libp2pPortMuxOptions): Promise<Libp2pPortMux>;
112
+ /**
113
+ * {@link libp2pPortMux}, with `streamLimit` as the default of both stream
114
+ * limits; `undefined` leaves libp2p's own defaults (what `connect`/`serve`
115
+ * have always passed through). Internal.
116
+ */
117
+ export declare function openLibp2pPortMux(options: Libp2pPortMuxOptions, streamLimit: number | undefined): Promise<Libp2pPortMux>;
98
118
  //# sourceMappingURL=port-mux.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"port-mux.d.ts","sourceRoot":"","sources":["../src/port-mux.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,MAAM,EACN,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,6BAA6B,CAAC;AAIrC,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,QAAa,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,o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,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAClF,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAEzF;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,oBAAoB,EAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC,aAAa,CAAC,CAwExB"}
@@ -0,0 +1,26 @@
1
+ import type { PeerId } from "@libp2p/interface";
2
+ import type { Duplex } from "@statewalker/webrun-streams";
3
+ /**
4
+ * The protocol id `connect`/`serve` are configured with unless told otherwise.
5
+ * Their calls negotiate `portProtocolOf(protocol)` (with `/window`); the id
6
+ * itself is the deprecated protocol, still served and dialled as a fallback
7
+ * for one release (statewalker/webrun-wire#153).
8
+ */
9
+ export declare const DEFAULT_PROTOCOL = "/webrun-streams/1.0.0";
10
+ /** What the serving side knows about the connection a call arrived on. */
11
+ export interface ConnectionContext {
12
+ /**
13
+ * The peer id libp2p's Noise handshake proved for this connection. This is
14
+ * the only identity claim on the serving side that cannot be forged by the
15
+ * request payload.
16
+ */
17
+ remotePeer: PeerId;
18
+ }
19
+ /**
20
+ * Builds a handler for one inbound call. Called once per call (one port, or one
21
+ * stream of the deprecated protocol), so the connection stays reachable in the
22
+ * returned Duplex's closure — `Duplex` is bytes-only (ADR-0004) and gains no
23
+ * new parameter.
24
+ */
25
+ export type ServeConnectionsHandler = (context: ConnectionContext) => Duplex;
26
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,CAAC"}