@varta-health/client 0.1.0 → 0.2.2
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/CHANGELOG.md +54 -0
- package/README.md +184 -92
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -9
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/panic.d.ts +1 -0
- package/dist/panic.d.ts.map +1 -1
- package/dist/panic.js +28 -11
- package/dist/panic.js.map +1 -1
- package/dist/transport.d.ts +18 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +201 -39
- package/dist/transport.js.map +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,60 @@ All notable changes to the Node.js client live here. Versions follow
|
|
|
4
4
|
[Semantic Versioning](https://semver.org). The wire protocol version is
|
|
5
5
|
governed independently — see `book/src/spec/vlp.md` in the workspace.
|
|
6
6
|
|
|
7
|
+
## [0.2.2] — 2026-05-29
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- First npm publish of `0.2.1` failed with `E404` because the package
|
|
12
|
+
had never been published and the Trusted Publisher binding was
|
|
13
|
+
registered under the wrong npm org. No code changes; version bump to
|
|
14
|
+
republish under the corrected `@varta-health` scope binding.
|
|
15
|
+
|
|
16
|
+
## [0.2.1] — 2026-05-17
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Documentation: corrected npm package name from `@varta/client` to `@varta-health/client` in all README and book documentation.
|
|
21
|
+
|
|
22
|
+
## [0.2.0] — 2026-05-17
|
|
23
|
+
|
|
24
|
+
Lift the two documented v0.1.0 limitations.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `Varta.connectUds(path)` constructor. Reaches API parity with the
|
|
29
|
+
Rust, Python, and Go clients. UDS gives the observer kernel-attested
|
|
30
|
+
peer credentials (`BeatOrigin::KernelAttested`) so Node agents now
|
|
31
|
+
qualify for recovery commands.
|
|
32
|
+
- `panic.installSignalHandlerUds(path)` parallel to the UDP variant.
|
|
33
|
+
Pre-binds a UDS socket at install time so emission is alloc-free
|
|
34
|
+
in the hot path.
|
|
35
|
+
- `UdsTransport` and `UdsUnavailableError` exported from
|
|
36
|
+
`@varta-health/client` for custom-transport authors.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- `UdpTransport` and `SecureUdpTransport` now use connected-mode
|
|
41
|
+
sockets (`dgram.Socket.connect`). ICMP `port unreachable` is routed
|
|
42
|
+
through the socket's error event and surfaces as
|
|
43
|
+
`{ kind: "dropped", reason: DropReason.NoObserver }` on the next
|
|
44
|
+
beat (1–2 beat latency). Previously every send to a dead observer
|
|
45
|
+
reported `Sent`; the agent had no way to observe the failure.
|
|
46
|
+
|
|
47
|
+
### Optional dependency
|
|
48
|
+
|
|
49
|
+
- `node-unix-socket` (`^0.2.7`, MIT, napi-rs prebuilds for
|
|
50
|
+
darwin-x64/arm64 and linux-x64/arm64 gnu+musl). Listed under
|
|
51
|
+
`optionalDependencies` — install never fails on a platform without
|
|
52
|
+
a published prebuild; UDP/secure-UDP work everywhere.
|
|
53
|
+
|
|
54
|
+
### Notes
|
|
55
|
+
|
|
56
|
+
- macOS ICMP propagation is best-effort; peer-gone may stay
|
|
57
|
+
invisible at the agent layer on darwin. Observer-side stall
|
|
58
|
+
detection remains the canonical signal.
|
|
59
|
+
- Windows still unsupported (no AF_UNIX SOCK_DGRAM path).
|
|
60
|
+
|
|
7
61
|
## [0.1.0] — 2026-05-17
|
|
8
62
|
|
|
9
63
|
Initial release. Production client for the Varta health protocol.
|
package/README.md
CHANGED
|
@@ -1,140 +1,232 @@
|
|
|
1
1
|
# Varta — Node.js client
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@varta/client)
|
|
3
|
+
[](https://www.npmjs.com/package/@varta-health/client)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
|
|
6
|
-
Production Node.js client for the [Varta](https://github.com/aramirez087/Varta)
|
|
7
|
-
health protocol. Emits 32-byte VLP heartbeats to a `varta-watch` observer
|
|
8
|
-
over plaintext UDP or ChaCha20-Poly1305-encrypted UDP. Written in
|
|
9
|
-
TypeScript; ships compiled `.js` + `.d.ts`. Zero npm runtime
|
|
10
|
-
dependencies — the AEAD primitives come from Node's built-in
|
|
11
|
-
`node:crypto`.
|
|
6
|
+
Production Node.js client for the [Varta](https://github.com/aramirez087/Varta) health protocol.
|
|
12
7
|
|
|
13
8
|
```bash
|
|
14
|
-
npm install @varta/client
|
|
9
|
+
npm install @varta-health/client
|
|
15
10
|
```
|
|
16
11
|
|
|
12
|
+
Requires Node.js 18 LTS or newer. ESM-only. Ships compiled `.js` + `.d.ts`. AEAD primitives come from Node's built-in `node:crypto`; UDS support is loaded from the optional `node-unix-socket` addon.
|
|
13
|
+
|
|
14
|
+
## What is Varta?
|
|
15
|
+
|
|
16
|
+
Varta is a health protocol for processes running on the same host (or same network segment). Your process calls `agent.beat()` on a fixed schedule — typically every 500 ms. A companion observer (`varta-watch`) watches the socket, detects when beats stop arriving, and fires a configurable recovery command.
|
|
17
|
+
|
|
18
|
+
The wire is 32 bytes per beat. No HTTP, no JSON, no extra packages for the base transport.
|
|
19
|
+
|
|
17
20
|
## Quickstart
|
|
18
21
|
|
|
19
22
|
```ts
|
|
20
|
-
import { Varta, Status } from "@varta/client";
|
|
23
|
+
import { Varta, Status } from "@varta-health/client";
|
|
24
|
+
|
|
25
|
+
// Connect once at startup. path must match --socket on your observer.
|
|
26
|
+
const agent = Varta.connectUds("/var/run/varta.sock");
|
|
21
27
|
|
|
22
|
-
const agent = await Varta.connectUdp("127.0.0.1", 5876);
|
|
23
28
|
setInterval(() => {
|
|
29
|
+
// beat() encodes and sends a 32-byte VLP frame.
|
|
30
|
+
// It never blocks — if the kernel send queue is full it returns { kind: "dropped" }.
|
|
24
31
|
const outcome = agent.beat(Status.Ok);
|
|
32
|
+
|
|
25
33
|
if (outcome.kind === "dropped") {
|
|
26
|
-
//
|
|
27
|
-
//
|
|
34
|
+
// Normal: observer restarted, queue momentarily full.
|
|
35
|
+
// The observer's stall-detection fires if silence lasts too long.
|
|
36
|
+
console.warn(`varta: dropped: ${outcome.reason}`);
|
|
37
|
+
} else if (outcome.kind === "failed") {
|
|
38
|
+
// Abnormal: OS resource exhaustion or socket in bad state.
|
|
39
|
+
console.error(`varta: failed: ${outcome.error.kind}`);
|
|
28
40
|
}
|
|
29
41
|
}, 500);
|
|
30
42
|
```
|
|
31
43
|
|
|
44
|
+
If UDS is not available on your platform, use loopback UDP:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const agent = Varta.connectUdp("127.0.0.1", 5876);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## How it works
|
|
51
|
+
|
|
52
|
+
`beat()` encodes a 32-byte frame (PID, timestamp, status, 32-bit payload, CRC) and sends it to `varta-watch`. The observer tracks the last-seen timestamp per PID. If a PID goes silent longer than `--threshold-ms`, the observer marks it stalled and fires any configured recovery command.
|
|
53
|
+
|
|
54
|
+
No polling. No persistent connection state beyond the socket file descriptor.
|
|
55
|
+
|
|
56
|
+
## Which transport?
|
|
57
|
+
|
|
58
|
+
| Transport | When to use |
|
|
59
|
+
| --------- | ----------- |
|
|
60
|
+
| **UDS** (`Varta.connectUds`) | Same-host deployment. The observer reads kernel peer credentials (`SCM_CREDENTIALS` on Linux, `LOCAL_PEERTOKEN` on macOS), granting `BeatOrigin::KernelAttested` status. **Only kernel-attested beats are eligible for observer-driven recovery commands.** Requires the optional `node-unix-socket` addon. |
|
|
61
|
+
| **UDP** (`Varta.connectUdp`) | Same-host or LAN when UDS is unavailable (or on Windows). Beats are `NetworkUnverified`; recovery is refused by the observer. |
|
|
62
|
+
| **Secure UDP** (`Varta.connectSecureUdp`) | Same use case as UDP, plus ChaCha20-Poly1305 AEAD encryption for beat confidentiality. Still refused for recovery. |
|
|
63
|
+
|
|
64
|
+
For same-host Node.js agents, UDS is the recommended transport. Fall back to UDP only when UDS is unavailable.
|
|
65
|
+
|
|
66
|
+
## Status values
|
|
67
|
+
|
|
68
|
+
`beat()` carries one of three status values. The observer surfaces all three through Prometheus.
|
|
69
|
+
|
|
70
|
+
| Status | When to send |
|
|
71
|
+
| ------ | ------------ |
|
|
72
|
+
| `Status.Ok` | Everything is working normally. Send this the vast majority of the time. |
|
|
73
|
+
| `Status.Degraded` | Running but unhealthy: high error rate, queue backlog, slow dependency. Not treated as a stall — recorded but does not trigger recovery. |
|
|
74
|
+
| `Status.Critical` | About to terminate due to an unrecoverable error. Typically sent by the panic handler, not your main beat loop. |
|
|
75
|
+
|
|
76
|
+
## Beat outcome
|
|
77
|
+
|
|
78
|
+
`beat()` returns a discriminated union. Check `outcome.kind`:
|
|
79
|
+
|
|
80
|
+
| `kind` | Meaning | Recommended action |
|
|
81
|
+
| ------ | ------- | ------------------ |
|
|
82
|
+
| `"sent"` | Frame handed to the kernel. | Nothing. |
|
|
83
|
+
| `"dropped"` | Frame not sent. `outcome.reason` is one of `KernelQueueFull`, `NoObserver`, `PeerGone`, or `StorageFull`. | Log at debug level or ignore. |
|
|
84
|
+
| `"failed"` | Unexpected error (encoding bug, OS resource exhaustion). | Log at warn. Consider calling `agent.reconnect()`. |
|
|
85
|
+
|
|
86
|
+
A `"dropped"` outcome is not a bug. Occasional drops are invisible to the observer — only sustained silence triggers a stall.
|
|
87
|
+
|
|
88
|
+
## Payload field
|
|
89
|
+
|
|
90
|
+
`beat(status, payload?)` accepts an optional 32-bit unsigned integer. The observer stores it verbatim and exposes it in the Prometheus `varta_agent_payload` gauge. Use it to pack any two metrics you want correlated with liveness:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
function packPayload(queueDepth: number, lastErrorCode: number): number {
|
|
94
|
+
// High 16 bits = queue depth. Low 16 bits = error code.
|
|
95
|
+
return ((queueDepth & 0xffff) | ((lastErrorCode & 0xff) << 16)) >>> 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const payload = packPayload(currentQueueLen, lastErrCode);
|
|
99
|
+
const status = lastErrCode !== 0 ? Status.Degraded : Status.Ok;
|
|
100
|
+
agent.beat(status, payload);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The encoding convention is yours to decide. The observer does not interpret the payload field.
|
|
104
|
+
|
|
105
|
+
## Unix Domain Sockets
|
|
106
|
+
|
|
107
|
+
UDS is the canonical same-host transport and the only Node transport eligible for observer-driven recovery.
|
|
108
|
+
|
|
109
|
+
UDS requires the optional `node-unix-socket` addon. Prebuilds are published for:
|
|
110
|
+
|
|
111
|
+
| Platform | Prebuild |
|
|
112
|
+
| -------- | -------- |
|
|
113
|
+
| `darwin-arm64` | ✅ |
|
|
114
|
+
| `darwin-x64` | ✅ |
|
|
115
|
+
| `linux-x64-gnu` | ✅ |
|
|
116
|
+
| `linux-x64-musl` | ✅ |
|
|
117
|
+
| `linux-arm64-gnu` | ✅ |
|
|
118
|
+
| `linux-arm64-musl` | ✅ |
|
|
119
|
+
| `linux-arm-gnueabihf` | ✅ |
|
|
120
|
+
| Windows | — |
|
|
121
|
+
|
|
122
|
+
Installing without the addon (or with `npm install --no-optional`) leaves UDS unavailable; UDP and secure-UDP still work. `Varta.connectUds` throws `UdsUnavailableError` in that case.
|
|
123
|
+
|
|
124
|
+
## Peer-gone detection
|
|
125
|
+
|
|
126
|
+
The UDP and secure-UDP transports use connected-mode sockets. On Linux, the kernel surfaces ICMP `port unreachable` on the next beat as `{ kind: "dropped", reason: DropReason.NoObserver }` (1–2 beat latency). On macOS and BSDs, ICMP propagation is best-effort — the peer-absent condition may stay invisible at the agent layer; the observer's stall-detection metric remains the canonical signal.
|
|
127
|
+
|
|
128
|
+
For UDS, the kernel returns `ECONNREFUSED`/`ENOENT` synchronously, so peer-gone detection is reliable on every platform.
|
|
129
|
+
|
|
130
|
+
## Panic hook
|
|
131
|
+
|
|
132
|
+
Register once at startup. Any uncaught exception, unhandled rejection, or terminating signal (`SIGTERM`/`SIGINT`/`SIGQUIT`/`SIGHUP`) emits a `Critical` beat with `nonce=NONCE_TERMINAL` before the process exits.
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import { panic } from "@varta-health/client";
|
|
136
|
+
|
|
137
|
+
// For UDS deployments:
|
|
138
|
+
panic.installSignalHandlerUds("/var/run/varta.sock");
|
|
139
|
+
|
|
140
|
+
// For UDP deployments:
|
|
141
|
+
// panic.installSignalHandlerUdp("127.0.0.1", 5876);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
All install functions pre-bind their socket at call time — no allocation or DNS resolution happens in the signal handler path.
|
|
145
|
+
|
|
146
|
+
For deferred emission inside an async pipeline:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
await panic.run(async () => {
|
|
150
|
+
await mainLoop(); // any throw inside emits Critical, then re-throws
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Secure UDP
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { readFileSync } from "node:fs";
|
|
158
|
+
import { Varta, Status } from "@varta-health/client";
|
|
159
|
+
|
|
160
|
+
// key must be exactly 32 raw bytes. Load from a Kubernetes secret, Vault, etc.
|
|
161
|
+
const key = readFileSync("/etc/varta/secure.key");
|
|
162
|
+
const agent = Varta.connectSecureUdp("127.0.0.1", 5876, key);
|
|
163
|
+
agent.beat(Status.Ok);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
ChaCha20-Poly1305 and HKDF-SHA256 come from Node's built-in `node:crypto` (Node 15+) — no extra install required.
|
|
167
|
+
|
|
32
168
|
## API parity with `varta-client` (Rust)
|
|
33
169
|
|
|
34
170
|
| Rust | Node.js |
|
|
35
171
|
| --------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
36
|
-
| `Varta::connect(path)` (UDS) |
|
|
172
|
+
| `Varta::connect(path)` (UDS) | `Varta.connectUds(path)` — requires the optional `node-unix-socket` addon |
|
|
37
173
|
| `Varta::connect_udp(addr)` | `Varta.connectUdp(host, port)` |
|
|
38
174
|
| `Varta::connect_secure_udp(addr, key)` | `Varta.connectSecureUdp(host, port, key)` |
|
|
39
175
|
| `Varta::connect_secure_udp_with_master(addr, mkey)` | `Varta.connectSecureUdpWithMaster(host, port, masterKey)` |
|
|
40
|
-
| `Varta::beat(status, payload) -> BeatOutcome` | `
|
|
176
|
+
| `Varta::beat(status, payload) -> BeatOutcome` | `agent.beat(status, payload?) -> BeatOutcome` |
|
|
41
177
|
| `BeatOutcome::{Sent, Dropped, Failed}` | `BeatOutcome` (discriminated union: `{ kind: "sent" \| "dropped" \| "failed" }`) |
|
|
42
178
|
| `DropReason::{KernelQueueFull, NoObserver, PeerGone, StorageFull}` | `DropReason` enum — same four variants |
|
|
43
179
|
| `BeatError { errno, kind }` | `BeatError extends Error` with `errno` and `kind` fields |
|
|
44
180
|
| `classify_send_error` | `classifySendError(err)` |
|
|
45
181
|
| `Varta::reconnect`, `set_reconnect_after` | `reconnect()`, `setReconnectAfter(n)` |
|
|
46
182
|
| `Varta::clock_regressions()`, `fork_recoveries()` | `clockRegressions()`, `forkRecoveries()` — return `bigint` |
|
|
47
|
-
| `install_panic_handler*` | `panic.installSignalHandlerUdp` / `installSignalHandlerSecureUdp`
|
|
183
|
+
| `install_panic_handler*` | `panic.installSignalHandlerUds` / `installSignalHandlerUdp` / `installSignalHandlerSecureUdp` |
|
|
48
184
|
| `panic::run` (defer/recover) | `panic.run(fn)` |
|
|
49
185
|
|
|
50
186
|
## Hard invariants
|
|
51
187
|
|
|
52
188
|
The Node.js client preserves the Rust client's wire-level contract:
|
|
53
189
|
|
|
54
|
-
1. **Non-blocking I/O.** Every socket is non-blocking. A
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
nonce
|
|
190
|
+
1. **Non-blocking I/O.** Every socket is non-blocking. A kernel-queue-full
|
|
191
|
+
send surfaces as `{ kind: "dropped", reason: DropReason.KernelQueueFull }`,
|
|
192
|
+
never a block.
|
|
193
|
+
2. **Per-emission `process.pid`.** No PID caching — forked children report
|
|
194
|
+
their own identity on the next beat. Fork auto-recovery refreshes the
|
|
195
|
+
transport (and, for secure-UDP, re-reads entropy via `crypto.randomBytes`)
|
|
196
|
+
before the frame leaves the child.
|
|
197
|
+
3. **Synchronous nonce reservation.** Secure-UDP's per-emission IV counter
|
|
198
|
+
advances at encode time, before the async `socket.send` call. This
|
|
199
|
+
guarantees nonce uniqueness under concurrent beats: a send callback that
|
|
200
|
+
reports an error burns one nonce slot (harmless — nonces are one-shot by
|
|
201
|
+
design), but two concurrent calls can never share a nonce.
|
|
66
202
|
4. **Wire-format conformance.** The package ships a test that loads
|
|
67
|
-
`tools/vlp-test-vectors.json` (the same fixture the Rust crate
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
## Non-goals (0.1.0)
|
|
73
|
-
|
|
74
|
-
- **Unix Domain Sockets.** Node's stdlib does not expose `AF_UNIX` /
|
|
75
|
-
`SOCK_DGRAM`; only stream-mode `unix:` sockets are reachable from
|
|
76
|
-
`node:net`. Shipping UDS support would require a native addon and
|
|
77
|
-
break the zero-dep posture. For same-host deployments use
|
|
78
|
-
`Varta.connectUdp("127.0.0.1", port)` — loopback is the same
|
|
79
|
-
security domain. If you need authenticated same-host transport,
|
|
80
|
-
use `Varta.connectSecureUdp` against `127.0.0.1` with a key
|
|
81
|
-
configured on the observer.
|
|
82
|
-
- **`accept-degraded-entropy` secure-UDP variant.** Reserved for
|
|
83
|
-
embedded targets that lack `/dev/urandom`; Node itself does not
|
|
84
|
-
run on such targets.
|
|
85
|
-
- **Browser support.** This package targets Node.js ≥ 18 LTS only.
|
|
86
|
-
It uses `node:dgram`, `node:crypto`, `node:os`, and `node:process`.
|
|
203
|
+
`tools/vlp-test-vectors.json` (the same fixture the Rust crate verifies
|
|
204
|
+
against) and asserts byte-equality for every CRC, frame, and AEAD vector.
|
|
205
|
+
Drift between languages is impossible without breaking both test suites in
|
|
206
|
+
the same PR.
|
|
87
207
|
|
|
88
208
|
## Latency note
|
|
89
209
|
|
|
90
|
-
Node cannot match the ~1 µs-per-beat budget of the Rust client.
|
|
91
|
-
Measured cost on a modern x86_64 host is **~5–15 µs per `beat()`**
|
|
92
|
-
including frame allocation, UDP `send`, and outcome dispatch. The
|
|
93
|
-
Node client is intended for tooling, batch jobs, Express/Fastify
|
|
94
|
-
sidecars, and process supervisors — not for tight inner loops
|
|
95
|
-
emitting kilo-beats per second.
|
|
210
|
+
Node cannot match the ~1 µs-per-beat budget of the Rust client. Measured cost on a modern x86_64 host is **~5–15 µs per `beat()`** including frame allocation, send, and outcome dispatch. The Node client is intended for tooling, batch jobs, Express/Fastify sidecars, and process supervisors — not for tight inner loops emitting kilo-beats per second.
|
|
96
211
|
|
|
97
|
-
##
|
|
212
|
+
## Non-goals
|
|
98
213
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const key = readFileSync("/etc/varta/secure.key"); // 32 raw bytes
|
|
104
|
-
const agent = await Varta.connectSecureUdp("127.0.0.1", 5876, key);
|
|
105
|
-
agent.beat(Status.Ok);
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
ChaCha20-Poly1305 and HKDF-SHA256 are stdlib in Node ≥ 15.0; no
|
|
109
|
-
extra install is required.
|
|
110
|
-
|
|
111
|
-
## Panic hook
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
import { panic } from "@varta/client";
|
|
115
|
-
|
|
116
|
-
panic.installSignalHandlerUdp("127.0.0.1", 5876);
|
|
117
|
-
// any uncaught exception, unhandled rejection, or terminating
|
|
118
|
-
// signal (SIGTERM/SIGINT/SIGQUIT/SIGHUP) now emits a Critical beat
|
|
119
|
-
// with nonce=NONCE_TERMINAL before the process exits.
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
For deferred panic emission inside an async pipeline:
|
|
123
|
-
|
|
124
|
-
```ts
|
|
125
|
-
await panic.run(async () => {
|
|
126
|
-
await mainLoop(); // any throw inside emits Critical, then re-throws
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
The handler pre-binds its socket at install time so emission is
|
|
131
|
-
async-signal-safe — no allocation or DNS in the hot path.
|
|
214
|
+
- **Recovery commands for UDP beats.** Only UDS beats are kernel-attested; UDP and secure-UDP beats never trigger observer-driven recovery.
|
|
215
|
+
- **Sub-microsecond latency.** Use the Rust `varta-client` for that.
|
|
216
|
+
- **Native-addon-free UDS.** Node's standard `dgram` module does not support `AF_UNIX`/`SOCK_DGRAM`; the optional `node-unix-socket` addon bridges that gap. If the addon is unavailable, loopback UDP is the correct fallback.
|
|
132
217
|
|
|
133
218
|
## Stability
|
|
134
219
|
|
|
135
|
-
- **Wire format:** VLP v0.2, governed by `book/src/spec/vlp.md` in
|
|
136
|
-
|
|
137
|
-
conformance test suite.
|
|
138
|
-
- **Node API:** 0.x — refinements may land without deprecation
|
|
139
|
-
cycles until 1.0.
|
|
220
|
+
- **Wire format:** VLP v0.2, governed by `book/src/spec/vlp.md` in the workspace. Cross-language byte-equality is enforced by the conformance test suite.
|
|
221
|
+
- **Node API:** 0.x — refinements may land without deprecation cycles until 1.0.
|
|
140
222
|
- **Node version:** 18 LTS minimum. CI runs against Node 18, 20, 22.
|
|
223
|
+
|
|
224
|
+
## See also
|
|
225
|
+
|
|
226
|
+
- [Normative wire spec](../../book/src/spec/vlp.md)
|
|
227
|
+
- [Conformance vectors](../../tools/vlp-test-vectors.json)
|
|
228
|
+
- [Rust agent crate](../../crates/varta-client/)
|
|
229
|
+
- [Go client](../go/)
|
|
230
|
+
- [Python client](../python/)
|
|
231
|
+
- [Observer](../../crates/varta-watch/)
|
|
232
|
+
- [Changelog](CHANGELOG.md)
|
package/dist/client.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class Varta {
|
|
|
14
14
|
private connectPid;
|
|
15
15
|
private forkRecoveriesCount;
|
|
16
16
|
private constructor();
|
|
17
|
+
static connectUds(path: string): Varta;
|
|
17
18
|
static connectUdp(host: string, port: number): Varta;
|
|
18
19
|
static connectSecureUdp(host: string, port: number, key: Buffer): Varta;
|
|
19
20
|
static connectSecureUdpWithMaster(host: string, port: number, masterKey: Buffer): Varta;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqBA,OAAO,EAIL,UAAU,EACV,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqBA,OAAO,EAIL,UAAU,EACV,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,MAAM,EACN,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAyBlB,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAErE;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,mBAAmB,CAAS;IAEpC,OAAO;IAoBP,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAItC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK;IAIpD,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK;IAIvE,MAAM,CAAC,0BAA0B,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,KAAK;IAMR,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,KAAK;IAMrD,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,MAAU,GAAG,WAAW;IA2D1D,SAAS,IAAI,IAAI;IAKjB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAOzC,gBAAgB,IAAI,MAAM;IAM1B,cAAc,IAAI,MAAM;IAIxB,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,SAAS;IAWjB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGvC;AAGD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// event is observable.
|
|
20
20
|
// * Nonce wraps with a single-shot stderr warning, never silently.
|
|
21
21
|
import { BeatError, BeatOutcomes, classifySendError, DropReason, } from "./outcome.js";
|
|
22
|
-
import { SecureUdpTransport, UdpTransport, } from "./transport.js";
|
|
22
|
+
import { SecureUdpTransport, UdpTransport, UdsTransport, } from "./transport.js";
|
|
23
23
|
import { encodeInto, FRAME_BYTES, NONCE_TERMINAL, Status, } from "./vlp.js";
|
|
24
24
|
const U64_MAX = 0xffffffffffffffffn;
|
|
25
25
|
function satAddBig(value, delta) {
|
|
@@ -69,6 +69,14 @@ export class Varta {
|
|
|
69
69
|
this.forkRecoveriesCount = 0n;
|
|
70
70
|
}
|
|
71
71
|
// ─── constructors ─────────────────────────────────────────────
|
|
72
|
+
// Connect to a `varta-watch` observer over a Unix domain datagram
|
|
73
|
+
// socket. Requires the optional `node-unix-socket` addon; raises
|
|
74
|
+
// `UdsUnavailableError` if it could not be loaded (missing prebuild,
|
|
75
|
+
// Windows, etc.). Preferred same-host transport: gives the observer
|
|
76
|
+
// kernel-attested `BeatOrigin` and unlocks recovery eligibility.
|
|
77
|
+
static connectUds(path) {
|
|
78
|
+
return new Varta(new UdsTransport(path));
|
|
79
|
+
}
|
|
72
80
|
static connectUdp(host, port) {
|
|
73
81
|
return new Varta(new UdpTransport(host, port));
|
|
74
82
|
}
|
|
@@ -123,20 +131,14 @@ export class Varta {
|
|
|
123
131
|
this.consecutiveDropped = Math.min(this.consecutiveDropped + 1, Number.MAX_SAFE_INTEGER);
|
|
124
132
|
if (this.reconnectAfter > 0 &&
|
|
125
133
|
this.consecutiveDropped >= this.reconnectAfter) {
|
|
134
|
+
this.consecutiveDropped = 0;
|
|
126
135
|
try {
|
|
127
136
|
this.transport.reconnect();
|
|
128
137
|
}
|
|
129
138
|
catch {
|
|
130
139
|
return outcome;
|
|
131
140
|
}
|
|
132
|
-
|
|
133
|
-
if (retry.kind === "dropped") {
|
|
134
|
-
this.consecutiveDropped = this.reconnectAfter;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.consecutiveDropped = 0;
|
|
138
|
-
}
|
|
139
|
-
return retry;
|
|
141
|
+
return this.sendFrame();
|
|
140
142
|
}
|
|
141
143
|
return outcome;
|
|
142
144
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,6DAA6D;A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"./client.js";
|
|
2
2
|
export { Status, NONCE_TERMINAL, FRAME_BYTES, MAGIC, VERSION, DecodeError, decode, decodeFrame, encode, encodeInto, crc32c, type Frame, type StatusLike, type DecodeErrorKind, } from "./vlp.js";
|
|
3
3
|
export { BeatOutcomes, BeatError, DropReason, classifySendError, isSent, isDropped, isFailed, type BeatOutcome, } from "./outcome.js";
|
|
4
|
-
export { UdpTransport, SecureUdpTransport, type BeatTransport, } from "./transport.js";
|
|
4
|
+
export { UdpTransport, SecureUdpTransport, UdsTransport, UdsUnavailableError, type BeatTransport, } from "./transport.js";
|
|
5
5
|
export * as panic from "./panic.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Public surface of `@varta/client`. See `README.md` for the parity
|
|
1
|
+
// Public surface of `@varta-health/client`. See `README.md` for the parity
|
|
2
2
|
// table against the Rust, Python, and Go clients.
|
|
3
3
|
export { Varta } from "./client.js";
|
|
4
4
|
export { Status, NONCE_TERMINAL, FRAME_BYTES, MAGIC, VERSION, DecodeError, decode, decodeFrame, encode, encodeInto, crc32c, } from "./vlp.js";
|
|
5
5
|
export { BeatOutcomes, BeatError, DropReason, classifySendError, isSent, isDropped, isFailed, } from "./outcome.js";
|
|
6
|
-
export { UdpTransport, SecureUdpTransport, } from "./transport.js";
|
|
6
|
+
export { UdpTransport, SecureUdpTransport, UdsTransport, UdsUnavailableError, } from "./transport.js";
|
|
7
7
|
export * as panic from "./panic.js";
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,kDAAkD;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,EACX,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,MAAM,GAIP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,QAAQ,GAET,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
package/dist/panic.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare class PanicInstallError extends Error {
|
|
|
3
3
|
constructor(kind: string, message: string);
|
|
4
4
|
}
|
|
5
5
|
export declare function installSignalHandlerUdp(host: string, port: number): void;
|
|
6
|
+
export declare function installSignalHandlerUds(path: string): void;
|
|
6
7
|
export declare function installSignalHandlerSecureUdp(host: string, port: number, key: Buffer): void;
|
|
7
8
|
export declare function run(fn: () => void | Promise<void>): Promise<void>;
|
|
8
9
|
//# sourceMappingURL=panic.d.ts.map
|
package/dist/panic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panic.d.ts","sourceRoot":"","sources":["../src/panic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"panic.d.ts","sourceRoot":"","sources":["../src/panic.ts"],"names":[],"mappings":"AAkCA,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAoED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAexE;AAOD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkB1D;AAOD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,IAAI,CA+CN;AAMD,wBAAsB,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMvE"}
|
package/dist/panic.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// async-signal-safe (cerebrum 2026-05-14).
|
|
13
13
|
import { randomBytes } from "node:crypto";
|
|
14
14
|
import { createSocket } from "node:dgram";
|
|
15
|
+
import { UdsTransport, UdsUnavailableError, } from "./transport.js";
|
|
15
16
|
import { encodeShared, KEY_BYTES, deriveIvPrefix, IV_RANDOM_BYTES, SESSION_SALT_BYTES, } from "./vlp_secure.js";
|
|
16
17
|
import { encodeInto, FRAME_BYTES, NONCE_TERMINAL, Status, } from "./vlp.js";
|
|
17
18
|
export class PanicInstallError extends Error {
|
|
@@ -46,8 +47,6 @@ function arm(emit) {
|
|
|
46
47
|
};
|
|
47
48
|
process.on("uncaughtException", (err) => {
|
|
48
49
|
trigger();
|
|
49
|
-
// Re-throw so Node's default crash printer still runs and the
|
|
50
|
-
// process exits with code 1 — preserves Node's standard behaviour.
|
|
51
50
|
setImmediate(() => {
|
|
52
51
|
throw err;
|
|
53
52
|
});
|
|
@@ -61,8 +60,6 @@ function arm(emit) {
|
|
|
61
60
|
for (const sig of FATAL_SIGNALS) {
|
|
62
61
|
process.on(sig, () => {
|
|
63
62
|
trigger();
|
|
64
|
-
// Restore default handler and re-raise so the process exits with
|
|
65
|
-
// the canonical signal-derived code (128 + signum on POSIX).
|
|
66
63
|
process.removeAllListeners(sig);
|
|
67
64
|
process.kill(process.pid, sig);
|
|
68
65
|
});
|
|
@@ -99,6 +96,32 @@ export function installSignalHandlerUdp(host, port) {
|
|
|
99
96
|
});
|
|
100
97
|
}
|
|
101
98
|
// Install a panic emitter that publishes a Critical+NONCE_TERMINAL
|
|
99
|
+
// frame over UDS. Pre-binds a `UdsTransport` at install time so the
|
|
100
|
+
// hot path performs no module load. Throws
|
|
101
|
+
// `PanicInstallError(kind="UdsUnavailable")` if the optional
|
|
102
|
+
// `node-unix-socket` addon is missing.
|
|
103
|
+
export function installSignalHandlerUds(path) {
|
|
104
|
+
let transport;
|
|
105
|
+
try {
|
|
106
|
+
transport = new UdsTransport(path);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
if (err instanceof UdsUnavailableError) {
|
|
110
|
+
throw new PanicInstallError("UdsUnavailable", err.message);
|
|
111
|
+
}
|
|
112
|
+
throw new PanicInstallError("SocketBind", err.message);
|
|
113
|
+
}
|
|
114
|
+
const frame = buildCriticalFrame();
|
|
115
|
+
arm(() => {
|
|
116
|
+
try {
|
|
117
|
+
transport.send(frame);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Best effort.
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// Install a panic emitter that publishes a Critical+NONCE_TERMINAL
|
|
102
125
|
// frame over ChaCha20-Poly1305 AEAD UDP. Fail-closed entropy posture:
|
|
103
126
|
// `crypto.randomBytes(16)` is invoked once at install time; if it
|
|
104
127
|
// throws, `PanicInstallError(kind="EntropyUnavailable")` propagates
|
|
@@ -121,9 +144,6 @@ export function installSignalHandlerSecureUdp(host, port, key) {
|
|
|
121
144
|
catch (err) {
|
|
122
145
|
throw new PanicInstallError("SocketBind", err.message);
|
|
123
146
|
}
|
|
124
|
-
// Capture state by reference inside the closure. `installPid` lets
|
|
125
|
-
// the hook detect post-`fork(2)` execution and re-read entropy
|
|
126
|
-
// before the IV is reused.
|
|
127
147
|
const state = {
|
|
128
148
|
salt,
|
|
129
149
|
installPid: process.pid,
|
|
@@ -137,7 +157,7 @@ export function installSignalHandlerSecureUdp(host, port, key) {
|
|
|
137
157
|
state.salt = randomBytes(SESSION_SALT_BYTES);
|
|
138
158
|
}
|
|
139
159
|
catch {
|
|
140
|
-
return;
|
|
160
|
+
return;
|
|
141
161
|
}
|
|
142
162
|
state.installPid = process.pid;
|
|
143
163
|
state.counter = 0;
|
|
@@ -163,9 +183,6 @@ export async function run(fn) {
|
|
|
163
183
|
await fn();
|
|
164
184
|
}
|
|
165
185
|
catch (err) {
|
|
166
|
-
// Emit by triggering the uncaughtException pathway — re-throws
|
|
167
|
-
// are caught by the armed handler installed via `arm()`. If no
|
|
168
|
-
// handler is installed, the error simply propagates.
|
|
169
186
|
throw err;
|
|
170
187
|
}
|
|
171
188
|
}
|
package/dist/panic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panic.js","sourceRoot":"","sources":["../src/panic.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,kEAAkE;AAClE,8DAA8D;AAC9D,qEAAqE;AACrE,kEAAkE;AAClE,2BAA2B;AAC3B,EAAE;AACF,qEAAqE;AACrE,4DAA4D;AAC5D,kEAAkE;AAClE,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,UAAU,EACV,WAAW,EACX,cAAc,EACd,MAAM,GACP,MAAM,UAAU,CAAC;AAElB,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAS;IACtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,aAAa,GAAqB,CA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AC5E,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC9B,KAAK,CAAC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YACjE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qEAAqE;AACrE,iEAAiE;AACjE,sEAAsE;AACtE,6BAA6B;AAC7B,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,EAA8B;IACtD,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,CAAC;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/transport.d.ts
CHANGED
|
@@ -3,10 +3,26 @@ export interface BeatTransport {
|
|
|
3
3
|
reconnect(): void;
|
|
4
4
|
close(): void;
|
|
5
5
|
}
|
|
6
|
+
export declare class UdsUnavailableError extends Error {
|
|
7
|
+
readonly cause: unknown;
|
|
8
|
+
constructor(cause: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare class UdsTransport implements BeatTransport {
|
|
11
|
+
private socket;
|
|
12
|
+
private readonly path;
|
|
13
|
+
pendingError: NodeJS.ErrnoException | null;
|
|
14
|
+
constructor(path: string);
|
|
15
|
+
private openSocket;
|
|
16
|
+
send(buf: Buffer): void;
|
|
17
|
+
reconnect(): void;
|
|
18
|
+
close(): void;
|
|
19
|
+
}
|
|
6
20
|
export declare class UdpTransport implements BeatTransport {
|
|
7
21
|
private socket;
|
|
8
22
|
private readonly host;
|
|
9
23
|
private readonly port;
|
|
24
|
+
private connected;
|
|
25
|
+
private preConnectQueue;
|
|
10
26
|
pendingError: NodeJS.ErrnoException | null;
|
|
11
27
|
constructor(host: string, port: number);
|
|
12
28
|
private openSocket;
|
|
@@ -24,6 +40,8 @@ export declare class SecureUdpTransport implements BeatTransport {
|
|
|
24
40
|
private ivPrefix;
|
|
25
41
|
private prefixIndex;
|
|
26
42
|
private counter;
|
|
43
|
+
private connected;
|
|
44
|
+
private preConnectQueue;
|
|
27
45
|
pendingError: NodeJS.ErrnoException | null;
|
|
28
46
|
private constructor();
|
|
29
47
|
static shared(host: string, port: number, key: Buffer): SecureUdpTransport;
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,aAAa;IAM5B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,IAAI,IAAI,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;CACf;AAYD,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBACZ,KAAK,EAAE,OAAO;CAS3B;AA6DD,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,YAAY,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,CAAQ;gBAEtC,IAAI,EAAE,MAAM;IAKxB,OAAO,CAAC,UAAU;IAclB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAcvB,SAAS,IAAI,IAAI;IAUjB,KAAK,IAAI,IAAI;CAOd;AAUD,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ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AGjC,oBAAoB,IAAI,MAAM;IAI9B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAkDvB,SAAS,IAAI,IAAI;IAmBjB,KAAK,IAAI,IAAI;CAOd"}
|
package/dist/transport.js
CHANGED
|
@@ -1,30 +1,155 @@
|
|
|
1
|
-
// Beat transport abstractions —
|
|
1
|
+
// Beat transport abstractions — UDS (AF_UNIX/SOCK_DGRAM), plaintext
|
|
2
|
+
// UDP, and ChaCha20-Poly1305-AEAD UDP.
|
|
2
3
|
//
|
|
3
|
-
// UDS
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// platform
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
4
|
+
// The UDS transport relies on the `node-unix-socket` napi-rs addon
|
|
5
|
+
// (listed under `optionalDependencies`). It ships prebuilds for
|
|
6
|
+
// darwin-x64/arm64 and linux-x64/arm64 (gnu + musl); installing on a
|
|
7
|
+
// platform without a published prebuild succeeds with the addon
|
|
8
|
+
// absent, and the UDS transport raises `UdsUnavailableError` at
|
|
9
|
+
// construction. UDP / secure-UDP work on every Node platform with
|
|
10
|
+
// only the stdlib.
|
|
11
|
+
//
|
|
12
|
+
// UDP and secure-UDP use connected-mode sockets (`dgram.Socket.connect`)
|
|
13
|
+
// so the kernel's ICMP `port unreachable` is queued onto the socket's
|
|
14
|
+
// `error` event and surfaces as `DropReason.NoObserver` on a subsequent
|
|
15
|
+
// beat. Pre-`connect` event sends are queued internally by libuv;
|
|
16
|
+
// errors from any source (send callback, recvmsg ICMP, async connect)
|
|
17
|
+
// drain into `pendingError` for the next caller.
|
|
12
18
|
import { randomBytes } from "node:crypto";
|
|
13
19
|
import { createSocket } from "node:dgram";
|
|
20
|
+
import { createRequire } from "node:module";
|
|
14
21
|
import { encodeMaster, encodeShared, IV_RANDOM_BYTES, SESSION_SALT_BYTES, deriveIvPrefix, } from "./vlp_secure.js";
|
|
15
|
-
// Common helper: drain a libuv async error captured on a previous
|
|
16
|
-
// `socket.send` callback. Returns the error if one is queued and
|
|
17
|
-
// clears the slot, or `null` if the slot is empty.
|
|
18
22
|
function takePendingError(holder) {
|
|
19
23
|
const e = holder.pendingError;
|
|
20
24
|
holder.pendingError = null;
|
|
21
25
|
return e;
|
|
22
26
|
}
|
|
23
|
-
// ───
|
|
27
|
+
// ─── UDS (AF_UNIX/SOCK_DGRAM) ──────────────────────────────────
|
|
28
|
+
export class UdsUnavailableError extends Error {
|
|
29
|
+
cause;
|
|
30
|
+
constructor(cause) {
|
|
31
|
+
super("UDS transport requires the optional `node-unix-socket` addon. " +
|
|
32
|
+
"Install it with `npm install node-unix-socket`, or fall back to " +
|
|
33
|
+
"`Varta.connectUdp(\"127.0.0.1\", port)` on platforms without a prebuild.");
|
|
34
|
+
this.name = "UdsUnavailableError";
|
|
35
|
+
this.cause = cause;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// `node-unix-socket`'s `DgramSocket` reports errors without populating
|
|
39
|
+
// `err.code` / `err.errno`. Translate the human-readable message back
|
|
40
|
+
// into the symbolic form that `classifySendError` expects.
|
|
41
|
+
function normalizeUdsError(err) {
|
|
42
|
+
const e = (err instanceof Error ? err : new Error(String(err)));
|
|
43
|
+
if (typeof e.code === "string" && e.code.length > 0)
|
|
44
|
+
return e;
|
|
45
|
+
const msg = (e.message ?? "").toLowerCase();
|
|
46
|
+
if (msg.includes("no such file"))
|
|
47
|
+
e.code = "ENOENT";
|
|
48
|
+
else if (msg.includes("connection refused"))
|
|
49
|
+
e.code = "ECONNREFUSED";
|
|
50
|
+
else if (msg.includes("no buffer space"))
|
|
51
|
+
e.code = "ENOBUFS";
|
|
52
|
+
else if (msg.includes("resource temporarily unavailable"))
|
|
53
|
+
e.code = "EAGAIN";
|
|
54
|
+
else if (msg.includes("would block"))
|
|
55
|
+
e.code = "EWOULDBLOCK";
|
|
56
|
+
else if (msg.includes("no space left"))
|
|
57
|
+
e.code = "ENOSPC";
|
|
58
|
+
else if (msg.includes("broken pipe"))
|
|
59
|
+
e.code = "EPIPE";
|
|
60
|
+
else if (msg.includes("connection reset"))
|
|
61
|
+
e.code = "ECONNRESET";
|
|
62
|
+
else if (msg.includes("transport endpoint is not connected"))
|
|
63
|
+
e.code = "ENOTCONN";
|
|
64
|
+
return e;
|
|
65
|
+
}
|
|
66
|
+
let cachedNodeUnixSocket = null;
|
|
67
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
68
|
+
function loadNodeUnixSocket() {
|
|
69
|
+
if (cachedNodeUnixSocket === "missing") {
|
|
70
|
+
throw new UdsUnavailableError(new Error("module not installed"));
|
|
71
|
+
}
|
|
72
|
+
if (cachedNodeUnixSocket !== null)
|
|
73
|
+
return cachedNodeUnixSocket;
|
|
74
|
+
try {
|
|
75
|
+
// `createRequire` keeps this importable from an ESM build without a
|
|
76
|
+
// top-level `await import` (which would force every consumer to
|
|
77
|
+
// tolerate an async load even when they never touch UDS).
|
|
78
|
+
const mod = requireFromHere("node-unix-socket");
|
|
79
|
+
cachedNodeUnixSocket = mod;
|
|
80
|
+
return mod;
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
cachedNodeUnixSocket = "missing";
|
|
84
|
+
throw new UdsUnavailableError(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export class UdsTransport {
|
|
88
|
+
socket;
|
|
89
|
+
path;
|
|
90
|
+
pendingError = null;
|
|
91
|
+
constructor(path) {
|
|
92
|
+
this.path = path;
|
|
93
|
+
this.socket = this.openSocket();
|
|
94
|
+
}
|
|
95
|
+
openSocket() {
|
|
96
|
+
const { DgramSocket } = loadNodeUnixSocket();
|
|
97
|
+
const s = new DgramSocket();
|
|
98
|
+
// Upstream's `onError` self-closes the socket and re-emits as
|
|
99
|
+
// `error`. Drain into pendingError so the next beat surfaces it,
|
|
100
|
+
// and rely on `reconnect()` to rebuild. Most sendTo failures
|
|
101
|
+
// arrive on the per-call callback (not this event), so this path
|
|
102
|
+
// is rare.
|
|
103
|
+
s.on("error", (err) => {
|
|
104
|
+
this.pendingError = normalizeUdsError(err);
|
|
105
|
+
});
|
|
106
|
+
return s;
|
|
107
|
+
}
|
|
108
|
+
send(buf) {
|
|
109
|
+
const queued = takePendingError(this);
|
|
110
|
+
if (queued !== null)
|
|
111
|
+
throw queued;
|
|
112
|
+
// Copy the caller's scratch buffer before handing off to libuv —
|
|
113
|
+
// matching the UDP transports' guard. The agent reuses a single
|
|
114
|
+
// 32-byte buffer across beats.
|
|
115
|
+
const owned = Buffer.from(buf);
|
|
116
|
+
this.socket.sendTo(owned, 0, owned.length, this.path, (err) => {
|
|
117
|
+
if (err !== null && err !== undefined) {
|
|
118
|
+
this.pendingError = normalizeUdsError(err);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
reconnect() {
|
|
123
|
+
try {
|
|
124
|
+
this.socket.close();
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Already closed — fine.
|
|
128
|
+
}
|
|
129
|
+
this.pendingError = null;
|
|
130
|
+
this.socket = this.openSocket();
|
|
131
|
+
}
|
|
132
|
+
close() {
|
|
133
|
+
try {
|
|
134
|
+
this.socket.close();
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Already closed.
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// ─── Plaintext UDP (connected-mode) ────────────────────────────
|
|
142
|
+
// Bound on how many beats may queue while `socket.connect` is in
|
|
143
|
+
// flight. IPv4 numeric connect completes in one libuv tick, so the
|
|
144
|
+
// queue is normally empty by the second beat; this cap exists only to
|
|
145
|
+
// guard against a `connect` that never fires (peer DNS issues etc.).
|
|
146
|
+
const PRE_CONNECT_QUEUE_LIMIT = 64;
|
|
24
147
|
export class UdpTransport {
|
|
25
148
|
socket;
|
|
26
149
|
host;
|
|
27
150
|
port;
|
|
151
|
+
connected = false;
|
|
152
|
+
preConnectQueue = [];
|
|
28
153
|
pendingError = null;
|
|
29
154
|
constructor(host, port) {
|
|
30
155
|
this.host = host;
|
|
@@ -34,29 +159,49 @@ export class UdpTransport {
|
|
|
34
159
|
openSocket() {
|
|
35
160
|
const family = this.host.includes(":") ? "udp6" : "udp4";
|
|
36
161
|
const s = createSocket(family);
|
|
37
|
-
//
|
|
38
|
-
//
|
|
162
|
+
// ICMP `port unreachable` for a connected dgram socket lands here
|
|
163
|
+
// (libuv's recvmsg path), as do async-connect failures and any
|
|
164
|
+
// out-of-band socket errors. Swallow into pendingError so the next
|
|
165
|
+
// `send()` call surfaces it instead of crashing the process.
|
|
39
166
|
s.on("error", (err) => {
|
|
40
167
|
this.pendingError = err;
|
|
41
168
|
});
|
|
42
169
|
s.unref();
|
|
170
|
+
// Connect for ICMP error propagation. Node's `dgram.Socket.send`
|
|
171
|
+
// rejects the connected-mode (no-port/host) signature while the
|
|
172
|
+
// socket is still CONNECTING; queue pre-connect-event beats and
|
|
173
|
+
// flush them once the `connect` callback fires.
|
|
174
|
+
this.connected = false;
|
|
175
|
+
s.connect(this.port, this.host, () => {
|
|
176
|
+
this.connected = true;
|
|
177
|
+
while (this.preConnectQueue.length > 0) {
|
|
178
|
+
const owned = this.preConnectQueue.shift();
|
|
179
|
+
s.send(owned, (err) => {
|
|
180
|
+
if (err !== null && err !== undefined) {
|
|
181
|
+
this.pendingError = err;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
43
186
|
return s;
|
|
44
187
|
}
|
|
45
188
|
send(buf) {
|
|
46
189
|
const queued = takePendingError(this);
|
|
47
190
|
if (queued !== null)
|
|
48
191
|
throw queued;
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
// fails with `ERR_SOCKET_DGRAM_NOT_CONNECTED`. The libuv callback
|
|
52
|
-
// path still surfaces kernel-level send errors via `pendingError`.
|
|
53
|
-
//
|
|
54
|
-
// Copy the caller's scratch buffer before handing off to libuv:
|
|
55
|
-
// `dgram.Socket.send` does NOT internally copy, and the agent
|
|
56
|
-
// reuses a single 32-byte buffer across beats, so a non-copy
|
|
57
|
-
// would let later beats overwrite earlier in-flight datagrams.
|
|
192
|
+
// Buffer copy: libuv does NOT copy before handing to the kernel,
|
|
193
|
+
// and the caller reuses a single 32-byte scratch buffer.
|
|
58
194
|
const owned = Buffer.from(buf);
|
|
59
|
-
|
|
195
|
+
if (!this.connected) {
|
|
196
|
+
if (this.preConnectQueue.length >= PRE_CONNECT_QUEUE_LIMIT) {
|
|
197
|
+
const e = new Error("UdpTransport: pre-connect queue full");
|
|
198
|
+
e.code = "ENOBUFS";
|
|
199
|
+
throw e;
|
|
200
|
+
}
|
|
201
|
+
this.preConnectQueue.push(owned);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.socket.send(owned, (err) => {
|
|
60
205
|
if (err !== null && err !== undefined) {
|
|
61
206
|
this.pendingError = err;
|
|
62
207
|
}
|
|
@@ -70,6 +215,7 @@ export class UdpTransport {
|
|
|
70
215
|
// Already closed — fine.
|
|
71
216
|
}
|
|
72
217
|
this.pendingError = null;
|
|
218
|
+
this.preConnectQueue = [];
|
|
73
219
|
this.socket = this.openSocket();
|
|
74
220
|
}
|
|
75
221
|
close() {
|
|
@@ -90,6 +236,8 @@ export class SecureUdpTransport {
|
|
|
90
236
|
ivPrefix;
|
|
91
237
|
prefixIndex;
|
|
92
238
|
counter;
|
|
239
|
+
connected = false;
|
|
240
|
+
preConnectQueue = [];
|
|
93
241
|
pendingError = null;
|
|
94
242
|
constructor(host, port, secret) {
|
|
95
243
|
this.host = host;
|
|
@@ -123,6 +271,18 @@ export class SecureUdpTransport {
|
|
|
123
271
|
this.pendingError = err;
|
|
124
272
|
});
|
|
125
273
|
s.unref();
|
|
274
|
+
this.connected = false;
|
|
275
|
+
s.connect(this.port, this.host, () => {
|
|
276
|
+
this.connected = true;
|
|
277
|
+
while (this.preConnectQueue.length > 0) {
|
|
278
|
+
const wire = this.preConnectQueue.shift();
|
|
279
|
+
s.send(wire, (err) => {
|
|
280
|
+
if (err !== null && err !== undefined) {
|
|
281
|
+
this.pendingError = err;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
126
286
|
return s;
|
|
127
287
|
}
|
|
128
288
|
// Test hooks (matching Python `_set_*_for_test` and Go `*ForTest`).
|
|
@@ -142,17 +302,10 @@ export class SecureUdpTransport {
|
|
|
142
302
|
const queued = takePendingError(this);
|
|
143
303
|
if (queued !== null)
|
|
144
304
|
throw queued;
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
// datagrams via libuv async, so multiple concurrent calls would
|
|
150
|
-
// all see the same proposed counter and encrypt distinct
|
|
151
|
-
// plaintexts under the same nonce — that is the classic
|
|
152
|
-
// ChaCha20-Poly1305 nonce-reuse footgun. We reserve and advance
|
|
153
|
-
// synchronously here so every queued frame carries a unique IV;
|
|
154
|
-
// a callback-reported `pendingError` simply burns one nonce
|
|
155
|
-
// slot, which is harmless.
|
|
305
|
+
// IV reservation is synchronous (cerebrum 2026-05-17 §4): every
|
|
306
|
+
// queued frame carries a unique nonce even under concurrent
|
|
307
|
+
// emits. A libuv-reported failure burns a nonce slot — harmless,
|
|
308
|
+
// since nonces are one-shot.
|
|
156
309
|
const ivRandom = Buffer.alloc(IV_RANDOM_BYTES);
|
|
157
310
|
this.ivPrefix.copy(ivRandom, 0, 0, IV_RANDOM_BYTES);
|
|
158
311
|
const counter = this.counter;
|
|
@@ -171,7 +324,16 @@ export class SecureUdpTransport {
|
|
|
171
324
|
else {
|
|
172
325
|
wire = encodeMaster(this.secret.masterKey, process.pid >>> 0, ivRandom, counter, buf);
|
|
173
326
|
}
|
|
174
|
-
|
|
327
|
+
if (!this.connected) {
|
|
328
|
+
if (this.preConnectQueue.length >= PRE_CONNECT_QUEUE_LIMIT) {
|
|
329
|
+
const e = new Error("SecureUdpTransport: pre-connect queue full");
|
|
330
|
+
e.code = "ENOBUFS";
|
|
331
|
+
throw e;
|
|
332
|
+
}
|
|
333
|
+
this.preConnectQueue.push(wire);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
this.socket.send(wire, (err) => {
|
|
175
337
|
if (err !== null && err !== undefined) {
|
|
176
338
|
this.pendingError = err;
|
|
177
339
|
}
|
|
@@ -185,7 +347,7 @@ export class SecureUdpTransport {
|
|
|
185
347
|
// Already closed.
|
|
186
348
|
}
|
|
187
349
|
this.pendingError = null;
|
|
188
|
-
|
|
350
|
+
this.preConnectQueue = [];
|
|
189
351
|
const newSalt = randomBytes(SESSION_SALT_BYTES);
|
|
190
352
|
const newPrefixIndex = 0;
|
|
191
353
|
const newIvPrefix = deriveIvPrefix(newSalt, newPrefixIndex);
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,oEAAoE;AACpE,kEAAkE;AAClE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,qEAAqE;AACrE,+DAA+D;AAC/D,+DAA+D;AAC/D,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAczB,kEAAkE;AAClE,iEAAiE;AACjE,mDAAmD;AACnD,SAAS,gBAAgB,CAAC,MAAsD;IAG9E,MAAM,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC;IAC9B,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,CAAC;AACX,CAAC;AAED,mEAAmE;AAEnE,MAAM,OAAO,YAAY;IACf,MAAM,CAAS;IACN,IAAI,CAAS;IACb,IAAI,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5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED,KAAK;QACH,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varta-health/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Health protocol client for distributed local agents (Varta VLP v0.2).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -68,5 +68,8 @@
|
|
|
68
68
|
"@types/node": "^20.11.0",
|
|
69
69
|
"tsx": "^4.7.0",
|
|
70
70
|
"typescript": "^5.4.0"
|
|
71
|
+
},
|
|
72
|
+
"optionalDependencies": {
|
|
73
|
+
"node-unix-socket": "^0.2.7"
|
|
71
74
|
}
|
|
72
75
|
}
|