@ts-pf/message 0.1.2 → 0.2.0
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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/backpressure.d.ts +83 -0
- package/dist/backpressure.d.ts.map +1 -0
- package/dist/backpressure.js +117 -0
- package/dist/backpressure.js.map +1 -0
- package/dist/duplex.d.ts +25 -2
- package/dist/duplex.d.ts.map +1 -1
- package/dist/duplex.js +81 -25
- package/dist/duplex.js.map +1 -1
- package/dist/error.d.ts +6 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +6 -2
- package/dist/error.js.map +1 -1
- package/dist/frame.d.ts +3 -2
- package/dist/frame.d.ts.map +1 -1
- package/dist/frame.js +7 -6
- package/dist/frame.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/port.d.ts +7 -0
- package/dist/port.d.ts.map +1 -1
- package/dist/port.js +7 -0
- package/dist/port.js.map +1 -1
- package/dist/push-queue.d.ts +28 -0
- package/dist/push-queue.d.ts.map +1 -0
- package/dist/push-queue.js +96 -0
- package/dist/push-queue.js.map +1 -0
- package/dist/session.d.ts +18 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +43 -7
- package/dist/session.js.map +1 -1
- package/dist/stdio.d.ts +7 -0
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +40 -2
- package/dist/stdio.js.map +1 -1
- package/dist/ws.d.ts +19 -1
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +66 -5
- package/dist/ws.js.map +1 -1
- package/package.json +8 -2
- package/skills/ts-pf-message/SKILL.md +17 -2
package/dist/ws.js
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
|
+
import { DEFAULT_HIGH_WATER_MARK } from './backpressure.js';
|
|
1
2
|
const WS_CONNECTING = 0;
|
|
2
3
|
const WS_OPEN = 1;
|
|
3
4
|
const WS_CLOSING = 2;
|
|
4
5
|
const WS_CLOSED = 3;
|
|
5
|
-
|
|
6
|
+
/** WebSockets have no drain event; `bufferedAmount` is polled at this interval while above the mark. */
|
|
7
|
+
const DRAIN_POLL_MS = 10;
|
|
8
|
+
/**
|
|
9
|
+
* A `Duplex` over a `WebSocket`-like socket. `send` returns a drain promise
|
|
10
|
+
* while `socket.bufferedAmount` (when the socket exposes it) or the queue
|
|
11
|
+
* held during `CONNECTING` exceeds `highWaterMark` (default 1 MiB); the
|
|
12
|
+
* promise resolves when it drops back under the mark or the socket closes.
|
|
13
|
+
* `pause` / `resume` are present only when the socket has them.
|
|
14
|
+
*/
|
|
15
|
+
export function createWsDuplex(socket, options = {}) {
|
|
16
|
+
const highWaterMark = options.highWaterMark ?? DEFAULT_HIGH_WATER_MARK;
|
|
6
17
|
const closeHandlers = new Set();
|
|
7
18
|
let closed = socket.readyState === WS_CLOSING || socket.readyState === WS_CLOSED;
|
|
8
19
|
const pending = [];
|
|
20
|
+
let pendingChars = 0;
|
|
21
|
+
let drainWaiters = [];
|
|
22
|
+
let poll;
|
|
23
|
+
const aboveMark = () => socket.bufferedAmount !== undefined && socket.bufferedAmount > highWaterMark;
|
|
24
|
+
const settleDrains = () => {
|
|
25
|
+
if (poll !== undefined) {
|
|
26
|
+
clearInterval(poll);
|
|
27
|
+
poll = undefined;
|
|
28
|
+
}
|
|
29
|
+
const waiters = drainWaiters;
|
|
30
|
+
drainWaiters = [];
|
|
31
|
+
for (const resolve of waiters) {
|
|
32
|
+
resolve();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const waitDrain = () => new Promise((resolve) => {
|
|
36
|
+
drainWaiters.push(resolve);
|
|
37
|
+
});
|
|
38
|
+
const pollDrain = () => {
|
|
39
|
+
if (poll !== undefined) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
poll = setInterval(() => {
|
|
43
|
+
if (closed || !aboveMark()) {
|
|
44
|
+
settleDrains();
|
|
45
|
+
}
|
|
46
|
+
}, DRAIN_POLL_MS);
|
|
47
|
+
};
|
|
9
48
|
const notifyClose = (reason) => {
|
|
10
49
|
for (const handler of [...closeHandlers]) {
|
|
11
50
|
if (reason === undefined) {
|
|
@@ -22,6 +61,7 @@ export function createWsDuplex(socket) {
|
|
|
22
61
|
}
|
|
23
62
|
closed = true;
|
|
24
63
|
pending.length = 0;
|
|
64
|
+
pendingChars = 0;
|
|
25
65
|
socket.removeEventListener('open', onOpen);
|
|
26
66
|
socket.removeEventListener('close', onSocketClose);
|
|
27
67
|
const code = reason === 1002 ? 1002 : 1000;
|
|
@@ -31,6 +71,7 @@ export function createWsDuplex(socket) {
|
|
|
31
71
|
catch {
|
|
32
72
|
// already disconnected
|
|
33
73
|
}
|
|
74
|
+
settleDrains();
|
|
34
75
|
if (reason === undefined || reason === 1002) {
|
|
35
76
|
notifyClose();
|
|
36
77
|
}
|
|
@@ -46,6 +87,13 @@ export function createWsDuplex(socket) {
|
|
|
46
87
|
socket.send(text);
|
|
47
88
|
}
|
|
48
89
|
pending.length = 0;
|
|
90
|
+
pendingChars = 0;
|
|
91
|
+
if (aboveMark()) {
|
|
92
|
+
pollDrain();
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
settleDrains();
|
|
96
|
+
}
|
|
49
97
|
};
|
|
50
98
|
const onSocketClose = () => {
|
|
51
99
|
close();
|
|
@@ -54,20 +102,26 @@ export function createWsDuplex(socket) {
|
|
|
54
102
|
socket.addEventListener('open', onOpen);
|
|
55
103
|
}
|
|
56
104
|
socket.addEventListener('close', onSocketClose);
|
|
57
|
-
|
|
105
|
+
const duplex = {
|
|
58
106
|
send(text) {
|
|
59
107
|
if (closed) {
|
|
60
|
-
return;
|
|
108
|
+
return undefined;
|
|
61
109
|
}
|
|
62
110
|
if (socket.readyState === WS_CONNECTING) {
|
|
63
111
|
pending.push(text);
|
|
64
|
-
|
|
112
|
+
pendingChars += text.length;
|
|
113
|
+
return pendingChars > highWaterMark ? waitDrain() : undefined;
|
|
65
114
|
}
|
|
66
115
|
if (socket.readyState !== WS_OPEN) {
|
|
67
116
|
close();
|
|
68
|
-
return;
|
|
117
|
+
return undefined;
|
|
69
118
|
}
|
|
70
119
|
socket.send(text);
|
|
120
|
+
if (!aboveMark()) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
pollDrain();
|
|
124
|
+
return waitDrain();
|
|
71
125
|
},
|
|
72
126
|
onMessage(handler) {
|
|
73
127
|
const listener = (event) => {
|
|
@@ -95,5 +149,12 @@ export function createWsDuplex(socket) {
|
|
|
95
149
|
},
|
|
96
150
|
close,
|
|
97
151
|
};
|
|
152
|
+
const pause = socket.pause?.bind(socket);
|
|
153
|
+
const resume = socket.resume?.bind(socket);
|
|
154
|
+
if (pause !== undefined && resume !== undefined) {
|
|
155
|
+
duplex.pause = pause;
|
|
156
|
+
duplex.resume = resume;
|
|
157
|
+
}
|
|
158
|
+
return duplex;
|
|
98
159
|
}
|
|
99
160
|
//# sourceMappingURL=ws.js.map
|
package/dist/ws.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AA0B3D,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,OAAO,GAAG,CAAC,CAAA;AACjB,MAAM,UAAU,GAAG,CAAC,CAAA;AACpB,MAAM,SAAS,GAAG,CAAC,CAAA;AAEnB,wGAAwG;AACxG,MAAM,aAAa,GAAG,EAAE,CAAA;AAExB;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAqB,EACrB,UAAsC,EAAE;IAExC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,uBAAuB,CAAA;IACtE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EAAE,CAAC;oBACnC,KAAK,CAAC,IAAI,CAAC,CAAA;oBACX,OAAM;gBACR,CAAC;gBACD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACrB,CAAC,CAAA;YACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;YAC5C,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;YACjD,CAAC,CAAA;QACH,CAAC;QACD,OAAO,CAAC,OAAO;YACb,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YAC1B,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,CAAC,GAAG,EAAE;oBAClB,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC;YACD,OAAO,GAAG,EAAE;gBACV,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC/B,CAAC,CAAA;QACH,CAAC;QACD,KAAK;KACN,CAAA;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-pf/message",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Opt-in JSON text frames and MessageSession for WS, stdio, and MessagePort",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ts-pf",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"ipc"
|
|
17
17
|
],
|
|
18
18
|
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22"
|
|
21
|
+
},
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
21
24
|
"url": "git+https://github.com/crobinson42/ts-pf.git",
|
|
@@ -51,6 +54,9 @@
|
|
|
51
54
|
"lint": "biome check src tests"
|
|
52
55
|
},
|
|
53
56
|
"dependencies": {
|
|
54
|
-
"@ts-pf/protocol": "0.
|
|
57
|
+
"@ts-pf/protocol": "0.2.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^22.15.0"
|
|
55
61
|
}
|
|
56
62
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ts-pf-message
|
|
3
|
-
description: Use when framing ts-pf over JSON text frames with MessageSession, Duplex, createPortDuplex, or
|
|
3
|
+
description: Use when framing ts-pf over JSON text frames with MessageSession, Duplex, createPortDuplex, createWsDuplex, or createPushQueue, or configuring message backpressure. Triggers: @ts-pf/message, MessageSession, encodeFrame, decodeFrame, createStdioDuplex, createMemoryDuplex, createPushQueue, BackpressureOptions, onStall.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# @ts-pf/message
|
|
@@ -20,11 +20,23 @@ import { createStdioDuplex } from '@ts-pf/message/stdio'
|
|
|
20
20
|
|
|
21
21
|
Bindings live in `@ts-pf/message-server` / `@ts-pf/message-client`. Inject a `WebSocket` constructor — do not depend on the `ws` npm package. User owns listen / upgrade / spawn / Worker bootstrap.
|
|
22
22
|
|
|
23
|
+
`errorFromEnvelope({ code, message, data? })` builds a `PFError` with `status` left `undefined` — frames carry no HTTP status and none is synthesized. Switch on `code`.
|
|
24
|
+
|
|
25
|
+
`createPushQueue<T>()` turns frames into an `AsyncIterable<T>` for a custom binding: `push(value, size?)` from the frame callback, `end()` to complete after the buffered values, `fail(error)` to reject the next pull instead. One pending `next()` at a time (one `for await` consumer); `end` / `fail` are one-shot and later calls are ignored. `createPushQueue({ highWaterMark, onPause, onResume })` bounds it: `onPause` once the buffered `size` sum passes the mark, `onResume` once drained to half or on `end` / `fail`; nothing is dropped. The first-party server (streamed input) and client (streamed output) use the same queue.
|
|
26
|
+
|
|
27
|
+
Backpressure is the pipe's job, not the wire's. A `Duplex.send` may return a promise ("above the write high-water mark, do not pull the next item until this resolves"; it must settle on close) and may implement `pause()` / `resume()` (stop delivering `onMessage` while a receiver's per-call queue is over its mark; connection-wide). stdio does both from the Node streams; `createWsDuplex(socket, { highWaterMark })` (default 1 MiB) polls `bufferedAmount` every 10 ms and forwards the socket's `pause` / `resume` when present (npm `ws`); `createPortDuplex` reports nothing (a `MessagePort` has no buffer signal). `createMemoryDuplex({ highWaterMark })` simulates a slow peer in tests.
|
|
28
|
+
|
|
29
|
+
`BackpressureOptions` is the shared `{ highWaterMark?, drainTimeout?, onStall? }` that `HandlerOptions.backpressure` / `LinkOptions.backpressure` take (defaults 1 MiB / 30 s / one `console.warn` on `aborted` only; `false` silences; `0` waits forever; `Infinity` unbounds). `onStall` sees `paused` once per call and `aborted` on timeout; a throw from it is swallowed. The bindings validate it (`TypeError` naming the option) and share an `@internal` per-call drain wait — a custom `Duplex` needs neither.
|
|
30
|
+
|
|
31
|
+
`localFailure` is a deprecated re-export; import it from `@ts-pf/protocol`.
|
|
32
|
+
|
|
23
33
|
## API
|
|
24
34
|
|
|
25
35
|
- `MessageSession`, `Duplex`, `encodeFrame`, `decodeFrame`
|
|
26
36
|
- `createMemoryDuplex`, `createPortDuplex`, `createWsDuplex`, `WebSocketLike`
|
|
27
|
-
- `
|
|
37
|
+
- `createPushQueue`, `PushQueue`, `PushQueueOptions`
|
|
38
|
+
- `BackpressureOptions`, `StallInfo`
|
|
39
|
+
- `errorFromEnvelope`; `localFailure` (deprecated — use `@ts-pf/protocol`)
|
|
28
40
|
- `createStdioDuplex` from `./stdio` only
|
|
29
41
|
|
|
30
42
|
## Pair with
|
|
@@ -38,3 +50,6 @@ Bindings live in `@ts-pf/message-server` / `@ts-pf/message-client`. Inject a `We
|
|
|
38
50
|
- Use this as an HTTP `RpcCodec`.
|
|
39
51
|
- Depend on the `ws` npm package — inject a `WebSocket` constructor.
|
|
40
52
|
- Reconstruct HTTP status from `error.code` on this pipe.
|
|
53
|
+
- Share one `PushQueue` between two `for await` loops — it holds one pending pull.
|
|
54
|
+
- Return a `send` promise that never settles — it must resolve on close, or a stream hangs until `drainTimeout`.
|
|
55
|
+
- Add credit / ack frames for flow control — that is a wire-major change, not a duplex concern.
|