@owlmeans/socket 0.1.18-rc.16 → 0.1.18-rc.18

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/README.md CHANGED
@@ -12,7 +12,7 @@ Shared WebSocket connection types and message protocol for OwlMeans real-time co
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/socket@^0.1.18-rc.8
15
+ bun add @owlmeans/socket@^0.1.18-rc.18
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -91,7 +91,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
91
91
  your project's skill store (`.agents/skills/`):
92
92
 
93
93
  ```sh
94
- npx @owlmeans/agent-skills@^0.1.18-rc.19
94
+ npx @owlmeans/agent-skills@^0.1.18-rc.21
95
95
  ```
96
96
 
97
97
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/socket",
4
- "version": "0.1.18-rc.16",
5
- "generatedAt": "2026-09-12T13:53:04.957Z",
4
+ "version": "0.1.18-rc.18",
5
+ "generatedAt": "2026-09-15T12:21:31.919Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/socket
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/socket": "^0.1.18-rc.16"` in `dependencies`
11
+ **Install:** `"@owlmeans/socket": "^0.1.18-rc.18"` in `dependencies`
12
12
 
13
13
  Contracts and one implementation-free connection model. It knows nothing about WebSockets: the
14
14
  browser side is `@owlmeans/client-socket`, the Fastify side `@owlmeans/server-socket`, and each
@@ -26,6 +26,8 @@ that make it concrete. Both halves of an application therefore speak the same fr
26
26
  | `MessageType` | `Call` `Result` `Error` `Request` `Response` `Event` `Message` `Auth` `System` |
27
27
  | `isMessage` / `isEventMessage` / `isCallMessage` / `isAuthMessage` | Type guards — `isMessage(msg, true)` excludes system frames, `isEventMessage(msg, true)` keeps only them |
28
28
  | `ConnectionListener` / `CallHendler` / `RequestHandler` / `CallResolver` | The callback shapes |
29
+ | `SocketSystemEvent` | The `event` values a `MessageType.System` frame carries — see below |
30
+ | `SOCKET_HEARTBEAT_TIMEOUT_CODE` | `4000` — the close code `client-socket`'s carrier uses when it force-closes a socket that has gone silent |
29
31
  | `SocketError` and subclasses | `SocketInitializationError`, `SocketConnectionError`, `SocketUnauthorized`, `SocketUnsupported`, `SocketTimeout`, `SocketMessageError`, `SocketMessageMalformed` — all registered with `ResilientError` |
30
32
  | `CALL_TIMEOUT` | 60 000 ms, the fallback when neither the message nor `connection.defaultCallTimeout` says |
31
33
 
@@ -77,8 +79,24 @@ connection.listen(async message => {
77
79
  ```
78
80
 
79
81
  Both carriers emit exactly that frame — `MessageType.System`, `event: 'close'`, payload
80
- `{ code }` — when the socket closes. Nothing else reports a disconnect, so any subscription a
81
- handler opened is released there.
82
+ `{ code }` — when the socket closes for good. Nothing else reports a TERMINAL disconnect, so any
83
+ subscription a handler opened is released there.
84
+
85
+ **`SocketSystemEvent`** is the full vocabulary a `MessageType.System` frame's `event` can carry —
86
+ `client-socket`'s reconnecting carrier is what emits the other four:
87
+
88
+ | Event | Meaning |
89
+ |---|---|
90
+ | `close` | The connection is gone for good — see above |
91
+ | `disconnected` | The socket dropped and a retry IS scheduled (client-socket only) — `{ code }` |
92
+ | `reconnecting` | Before each retry attempt (client-socket only) — `{ attempt, delay }` |
93
+ | `reconnected` | A retry succeeded, same `Connection` model (client-socket only) — `{ attempts }` |
94
+ | `lost` | The retry budget elapsed with no success, immediately followed by `close` (client-socket only) |
95
+
96
+ `close` is the only one of the five a plain carrier with no retry logic (like `server-socket`, or
97
+ `client-socket` itself with `reconnect: false`) will ever emit — a listener written against `close`
98
+ alone, before reconnect support existed, still sees exactly the frame it always did once a
99
+ reconnecting carrier's retries give up.
82
100
 
83
101
  ## What the model expects of a carrier
84
102
 
package/build/consts.d.ts CHANGED
@@ -10,4 +10,26 @@ export declare enum MessageType {
10
10
  System = "system"
11
11
  }
12
12
  export declare const CALL_TIMEOUT = 60000;
13
+ /**
14
+ * System frames a carrier synthesises around the lifecycle of the underlying transport.
15
+ *
16
+ * `Close` keeps its original meaning: the connection is gone for good — a client-initiated
17
+ * close, a terminal server code, or a reconnect budget exhausted. A drop the carrier intends to
18
+ * retry is reported as `Disconnected` instead, so a listener that only knew about `close` before
19
+ * this carried reconnect support still sees exactly the frame it always did once retries give up.
20
+ */
21
+ export declare enum SocketSystemEvent {
22
+ Close = "close",
23
+ Disconnected = "disconnected",
24
+ Reconnecting = "reconnecting",
25
+ Reconnected = "reconnected",
26
+ Lost = "lost"
27
+ }
28
+ /**
29
+ * The close code a carrier uses when it drops a socket itself — a missed heartbeat pong within
30
+ * `pongTimeout`, catching a half-open TCP connection long before the OS would notice one.
31
+ * Reserved in the 4000–4999 private-use range so it is never confused with a code either
32
+ * endpoint's own WebSocket stack could produce.
33
+ */
34
+ export declare const SOCKET_HEARTBEAT_TIMEOUT_CODE = 4000;
13
35
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,YAAY,QAAQ,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,YAAY,QAAQ,CAAA;AAEjC;;;;;;;GAOG;AACH,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,IAAI,SAAS;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAA"}
package/build/consts.js CHANGED
@@ -11,4 +11,27 @@ export var MessageType;
11
11
  MessageType["System"] = "system";
12
12
  })(MessageType || (MessageType = {}));
13
13
  export const CALL_TIMEOUT = 60000;
14
+ /**
15
+ * System frames a carrier synthesises around the lifecycle of the underlying transport.
16
+ *
17
+ * `Close` keeps its original meaning: the connection is gone for good — a client-initiated
18
+ * close, a terminal server code, or a reconnect budget exhausted. A drop the carrier intends to
19
+ * retry is reported as `Disconnected` instead, so a listener that only knew about `close` before
20
+ * this carried reconnect support still sees exactly the frame it always did once retries give up.
21
+ */
22
+ export var SocketSystemEvent;
23
+ (function (SocketSystemEvent) {
24
+ SocketSystemEvent["Close"] = "close";
25
+ SocketSystemEvent["Disconnected"] = "disconnected";
26
+ SocketSystemEvent["Reconnecting"] = "reconnecting";
27
+ SocketSystemEvent["Reconnected"] = "reconnected";
28
+ SocketSystemEvent["Lost"] = "lost";
29
+ })(SocketSystemEvent || (SocketSystemEvent = {}));
30
+ /**
31
+ * The close code a carrier uses when it drops a socket itself — a missed heartbeat pong within
32
+ * `pongTimeout`, catching a half-open TCP connection long before the OS would notice one.
33
+ * Reserved in the 4000–4999 private-use range so it is never confused with a code either
34
+ * endpoint's own WebSocket stack could produce.
35
+ */
36
+ export const SOCKET_HEARTBEAT_TIMEOUT_CODE = 4000;
14
37
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,WAUX;AAVD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAVW,WAAW,KAAX,WAAW,QAUtB;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAA"}
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,WAUX;AAVD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAVW,WAAW,KAAX,WAAW,QAUtB;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAA;AAEjC;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,kDAA6B,CAAA;IAC7B,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;IAC3B,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/socket",
3
- "version": "0.1.18-rc.16",
3
+ "version": "0.1.18-rc.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -21,9 +21,9 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@owlmeans/auth": "^0.1.18-rc.16",
25
- "@owlmeans/basic-ids": "^0.1.18-rc.16",
26
- "@owlmeans/error": "^0.1.18-rc.15"
24
+ "@owlmeans/auth": "^0.1.18-rc.18",
25
+ "@owlmeans/basic-ids": "^0.1.18-rc.18",
26
+ "@owlmeans/error": "^0.1.18-rc.17"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@owlmeans/dep-config": "workspace:*",
package/src/consts.ts CHANGED
@@ -12,3 +12,27 @@ export enum MessageType {
12
12
  }
13
13
 
14
14
  export const CALL_TIMEOUT = 60000
15
+
16
+ /**
17
+ * System frames a carrier synthesises around the lifecycle of the underlying transport.
18
+ *
19
+ * `Close` keeps its original meaning: the connection is gone for good — a client-initiated
20
+ * close, a terminal server code, or a reconnect budget exhausted. A drop the carrier intends to
21
+ * retry is reported as `Disconnected` instead, so a listener that only knew about `close` before
22
+ * this carried reconnect support still sees exactly the frame it always did once retries give up.
23
+ */
24
+ export enum SocketSystemEvent {
25
+ Close = 'close',
26
+ Disconnected = 'disconnected',
27
+ Reconnecting = 'reconnecting',
28
+ Reconnected = 'reconnected',
29
+ Lost = 'lost'
30
+ }
31
+
32
+ /**
33
+ * The close code a carrier uses when it drops a socket itself — a missed heartbeat pong within
34
+ * `pongTimeout`, catching a half-open TCP connection long before the OS would notice one.
35
+ * Reserved in the 4000–4999 private-use range so it is never confused with a code either
36
+ * endpoint's own WebSocket stack could produce.
37
+ */
38
+ export const SOCKET_HEARTBEAT_TIMEOUT_CODE = 4000