@camstack/system 1.2.218 → 1.2.219
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/addon-runner.js +2 -2
- package/dist/addon-runner.mjs +2 -2
- package/dist/addon-utils.js +2 -2
- package/dist/addon-utils.mjs +2 -2
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/gpu-probe.d.ts +18 -0
- package/dist/builtins/native-metrics/native-metrics-provider.d.ts +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.d.ts +26 -3
- package/dist/builtins/native-metrics/native-metrics.addon.js +1320 -1093
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1320 -1096
- package/dist/builtins/native-metrics/proc-process-table.d.ts +25 -0
- package/dist/builtins/platform-probe/index.js +3 -3
- package/dist/builtins/platform-probe/index.mjs +3 -3
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +23 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/sqlite-storage/wal-checkpoint-policy.d.ts +115 -0
- package/dist/builtins/sqlite-storage/wal-checkpoint-worker.d.ts +1 -0
- package/dist/builtins/sqlite-storage/wal-checkpointer.d.ts +70 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{custom-action-registry-CsONUlhC.mjs → custom-action-registry-B6gOtUWA.mjs} +1 -1
- package/dist/{custom-action-registry-BDwM5qAK.js → custom-action-registry-DKWhaWL1.js} +1 -1
- package/dist/{dist-BOlMCOeT.js → dist-B17W9ngu.js} +2 -2
- package/dist/{dist-DigmGsQS.mjs → dist-Cyz5_i7z.mjs} +2 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.js +31 -36
- package/dist/index.mjs +23 -38
- package/dist/kernel/heap-watch.d.ts +24 -1
- package/dist/kernel/moleculer/mesh-queue-report.d.ts +51 -0
- package/dist/kernel/outbound-queue-watch.d.ts +94 -0
- package/dist/kernel/socket-plane-report.d.ts +75 -4
- package/dist/kernel/transport/cap-routing-hints.d.ts +21 -0
- package/dist/kernel/transport/child-cap-protocol.d.ts +28 -2
- package/dist/kernel/transport/frame-codec.d.ts +49 -0
- package/dist/kernel/transport/local-child-client.d.ts +7 -0
- package/dist/kernel/transport/local-child-registry.d.ts +36 -1
- package/dist/kernel/transport/local-transport.d.ts +45 -2
- package/dist/kernel/transport/socket-channel.d.ts +19 -1
- package/dist/{manifest-system-deps-D--wyMD9.mjs → manifest-system-deps-C7dihwWT.mjs} +1210 -682
- package/dist/{manifest-system-deps-Bo92lg5u.js → manifest-system-deps-g_nK0xsF.js} +1252 -664
- package/dist/process/proc-stat.d.ts +75 -0
- package/dist/process/resource-monitor.d.ts +9 -1
- package/dist/{resource-monitor-CdnzxBLP.js → resource-monitor-LVE1BoLs.js} +42 -23
- package/dist/{resource-monitor-BWmQ5i-o.mjs → resource-monitor-Vp0bPV3U.mjs} +42 -22
- package/dist/{retired-settings-keys-vK_U-CG2.mjs → retired-settings-keys-BCYUrdsA.mjs} +1 -1
- package/dist/{retired-settings-keys-xEAlYnv7.js → retired-settings-keys-CjvB7Etx.js} +1 -1
- package/dist/wal-checkpoint-policy-CAcg63o-.mjs +92 -0
- package/dist/wal-checkpoint-policy-CCJZngds.js +127 -0
- package/dist/wal-checkpoint-worker.js +138 -0
- package/dist/wal-checkpoint-worker.mjs +137 -0
- package/package.json +1 -1
- package/dist/{event-loop-stall-monitor-DM9OAzy8.js → event-loop-stall-monitor-CAsHdMwP.js} +1 -1
- package/dist/{event-loop-stall-monitor-B3CFd9tM.mjs → event-loop-stall-monitor-GPrVvx14.mjs} +1 -1
- package/dist/{tls-DOTmtLCW.mjs → tls-2xbgg78V.mjs} +2 -2
- package/dist/{tls-BxQlomxd.js → tls-BFs4PzoW.js} +2 -2
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { IReadinessRegistryRecord, SystemEvent } from '@camstack/types';
|
|
2
2
|
import { CapUsageCallRecord } from '../moleculer/cap-usage-registry.js';
|
|
3
|
+
import { CapRoutingHints } from './cap-routing-hints.js';
|
|
3
4
|
import { AddonCallInput, CapCallInput, ChildLogMessage, RegisteredChild } from './child-cap-protocol.js';
|
|
4
5
|
import { LocalTransportServer } from './local-transport.js';
|
|
5
6
|
import { SocketTrafficSample } from './socket-traffic.js';
|
|
7
|
+
/**
|
|
8
|
+
* How many child `cap-call-out`s this parent forwarded WITHOUT reading their
|
|
9
|
+
* args (`raw`) against how many it decoded (`decoded`: an inline-args frame,
|
|
10
|
+
* a target that cannot take a payload, or a call that left the sibling path
|
|
11
|
+
* for `onUnownedCall`). Cumulative; the heartbeat reports the window.
|
|
12
|
+
*
|
|
13
|
+
* It exists because raw-forward makes the parent blind to the bytes on
|
|
14
|
+
* purpose, and the one thing it must not be blind to is how often that
|
|
15
|
+
* happens. A plane that says "raw=0" under load is a plane where the
|
|
16
|
+
* negotiation failed, and nothing else would show it.
|
|
17
|
+
*/
|
|
18
|
+
export interface ForwardCensus {
|
|
19
|
+
readonly raw: number;
|
|
20
|
+
readonly decoded: number;
|
|
21
|
+
}
|
|
6
22
|
/**
|
|
7
23
|
* Fan-out mode for parent→child event delivery, from the
|
|
8
24
|
* `CAMSTACK_UDS_EVENT_FANOUT` env (read once at registry construction):
|
|
@@ -104,6 +120,13 @@ export interface LocalChildRegistryOptions {
|
|
|
104
120
|
* which is the one thing the caller took the trouble to say it did not want.
|
|
105
121
|
* It goes to `onUnownedCall`, which resolves the named provider.
|
|
106
122
|
*
|
|
123
|
+
* The third argument is the call's ROUTING HINTS (`{ nodeId?, addonId? }`,
|
|
124
|
+
* `cap-routing-hints.ts`) — the two top-level string fields the parent ever
|
|
125
|
+
* read out of the args — not the args themselves. Under raw-forward the
|
|
126
|
+
* parent does not decode the args at all; the sender lifts the hints, and
|
|
127
|
+
* for a legacy frame the parent lifts them itself. Both modes reach this
|
|
128
|
+
* predicate with the same shape.
|
|
129
|
+
*
|
|
107
130
|
* The array-method bypass above and this one are the same defect seen twice.
|
|
108
131
|
* `broker.getBrokerConfig({id:'ha_001', addonId:'provider-homeassistant'})`
|
|
109
132
|
* from the Home Assistant export was answered by `provider-homematic` — which
|
|
@@ -117,7 +140,7 @@ export interface LocalChildRegistryOptions {
|
|
|
117
140
|
* wiring side injects it, sharing the predicate with the handler that then
|
|
118
141
|
* performs the routing — a rule implemented twice is a rule that drifts.
|
|
119
142
|
*/
|
|
120
|
-
readonly isAddonPinnedCall?: (capName: string, method: string,
|
|
143
|
+
readonly isAddonPinnedCall?: (capName: string, method: string, hints: CapRoutingHints) => boolean;
|
|
121
144
|
/**
|
|
122
145
|
* Per-cap-method bound for UDS cap calls, in ms — read from the cap
|
|
123
146
|
* definition's declared `timeoutMs`. The SAME resolver the remote plane uses
|
|
@@ -199,6 +222,9 @@ export declare class LocalChildRegistry {
|
|
|
199
222
|
/** See {@link LocalChildRegistryOptions.isAggregatedCollectionMethod}. */
|
|
200
223
|
private readonly isAggregatedCollectionMethod?;
|
|
201
224
|
private readonly isAddonPinnedCall?;
|
|
225
|
+
/** See {@link ForwardCensus}. Mutable counters on the hot path, by design. */
|
|
226
|
+
private forwardedRaw;
|
|
227
|
+
private forwardedDecoded;
|
|
202
228
|
/** See {@link LocalChildRegistryOptions.capTimeoutMs}. */
|
|
203
229
|
private readonly capTimeoutMs?;
|
|
204
230
|
/** See {@link LocalChildRegistryOptions.capUsageObserver}. */
|
|
@@ -242,6 +268,15 @@ export declare class LocalChildRegistry {
|
|
|
242
268
|
* pair for the whole process and has no per-socket breakdown.
|
|
243
269
|
*/
|
|
244
270
|
getChildSocketTraffic(childId: string): SocketTrafficSample | null;
|
|
271
|
+
/**
|
|
272
|
+
* Bytes this process has written to a child that the child has not yet
|
|
273
|
+
* taken, live, or `null` when the channel keeps no such reading. Read on
|
|
274
|
+
* every heartbeat probe (D446) — a child that stops draining is the shape
|
|
275
|
+
* of an outbound-queue episode, and the number lives on the channel.
|
|
276
|
+
*/
|
|
277
|
+
getChildQueuedBytes(childId: string): number | null;
|
|
278
|
+
/** Cumulative {@link ForwardCensus} of this parent's `cap-call-out` routing. */
|
|
279
|
+
readForwardCensus(): ForwardCensus;
|
|
245
280
|
/**
|
|
246
281
|
* The regime the counters above were produced under, read once from
|
|
247
282
|
* `CAMSTACK_UDS_EVENT_FANOUT` at construction.
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { SocketTrafficSample } from './socket-traffic.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Wire frame exchanged over a local channel.
|
|
4
|
+
*
|
|
5
|
+
* `pl` is an OPAQUE payload the channel carries beside the envelope and never
|
|
6
|
+
* interprets: the bytes a `req` handler receives as its second argument, or
|
|
7
|
+
* the bytes a {@link PayloadReply} put on a `res`. On the wire it is the
|
|
8
|
+
* frame's last msgpack key (`frame-codec.ts` `encodeFrameHead`), which is
|
|
9
|
+
* what lets a router forward it as a view without decoding it.
|
|
10
|
+
*/
|
|
3
11
|
export type Frame = {
|
|
4
12
|
readonly k: 'req';
|
|
5
13
|
readonly id: number;
|
|
6
14
|
readonly body: unknown;
|
|
15
|
+
readonly pl?: Uint8Array;
|
|
7
16
|
} | {
|
|
8
17
|
readonly k: 'res';
|
|
9
18
|
readonly id: number;
|
|
10
19
|
readonly ok: true;
|
|
11
20
|
readonly body: unknown;
|
|
21
|
+
readonly pl?: Uint8Array;
|
|
12
22
|
} | {
|
|
13
23
|
readonly k: 'res';
|
|
14
24
|
readonly id: number;
|
|
@@ -18,8 +28,27 @@ export type Frame = {
|
|
|
18
28
|
readonly k: 'evt';
|
|
19
29
|
readonly body: unknown;
|
|
20
30
|
};
|
|
21
|
-
|
|
31
|
+
/**
|
|
32
|
+
* A request handler receives the envelope body and, when the request carried
|
|
33
|
+
* one, its opaque payload. It may answer with a plain value or with a
|
|
34
|
+
* {@link PayloadReply}; a plain value travels inline exactly as before.
|
|
35
|
+
*/
|
|
36
|
+
export type RequestHandler = (body: unknown, payload?: Uint8Array) => Promise<unknown>;
|
|
22
37
|
export type EventHandler = (body: unknown) => void;
|
|
38
|
+
/**
|
|
39
|
+
* An answer that carries an opaque payload beside its body.
|
|
40
|
+
*
|
|
41
|
+
* A CLASS rather than a shape so the channel can tell it from a provider's
|
|
42
|
+
* ordinary `{ body, payload }` return value by identity, never by duck-typing:
|
|
43
|
+
* a cap method is free to return an object with those two keys and it must
|
|
44
|
+
* travel inline like any other. `request()` resolves with one of these only
|
|
45
|
+
* when the peer's `res` frame carried a payload.
|
|
46
|
+
*/
|
|
47
|
+
export declare class PayloadReply {
|
|
48
|
+
readonly body: unknown;
|
|
49
|
+
readonly payload: Uint8Array;
|
|
50
|
+
constructor(body: unknown, payload: Uint8Array);
|
|
51
|
+
}
|
|
23
52
|
/** Per-request options a {@link LocalChannel} implementation may honour. */
|
|
24
53
|
export interface LocalRequestOptions {
|
|
25
54
|
/**
|
|
@@ -29,6 +58,13 @@ export interface LocalRequestOptions {
|
|
|
29
58
|
* not cut short.
|
|
30
59
|
*/
|
|
31
60
|
readonly timeoutMs?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Opaque bytes to carry beside `body`. The peer's request handler receives
|
|
63
|
+
* them as its second argument; the channel never reads them. An
|
|
64
|
+
* implementation without a wire (in-process, test doubles) may hand them
|
|
65
|
+
* through as-is.
|
|
66
|
+
*/
|
|
67
|
+
readonly payload?: Uint8Array;
|
|
32
68
|
}
|
|
33
69
|
/** A bidirectional request/response + one-way event channel over one socket. */
|
|
34
70
|
export interface LocalChannel {
|
|
@@ -48,6 +84,13 @@ export interface LocalChannel {
|
|
|
48
84
|
* finds it absent reports the peer as unmeasured rather than as silent.
|
|
49
85
|
*/
|
|
50
86
|
readTraffic?(): SocketTrafficSample;
|
|
87
|
+
/**
|
|
88
|
+
* Bytes written to the peer that it has not yet taken, read live. OPTIONAL
|
|
89
|
+
* for the same reason as {@link readTraffic}: only a real socket has a
|
|
90
|
+
* write queue. A reader that finds it absent reports the peer's queue as
|
|
91
|
+
* unmeasured — never as zero (D393).
|
|
92
|
+
*/
|
|
93
|
+
queuedBytes?(): number;
|
|
51
94
|
}
|
|
52
95
|
/** Parent side: listens and hands a channel per accepted child connection. */
|
|
53
96
|
export interface LocalTransportServer {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Socket } from 'node:net';
|
|
2
|
-
import { LocalChannel, RequestHandler
|
|
2
|
+
import { EventHandler, LocalChannel, RequestHandler } from './local-transport.js';
|
|
3
3
|
import { SocketTrafficSample } from './socket-traffic.js';
|
|
4
4
|
/**
|
|
5
5
|
* Default bound on one UDS request, when the caller names none.
|
|
@@ -16,6 +16,8 @@ export declare const DEFAULT_UDS_REQUEST_TIMEOUT_MS = 60000;
|
|
|
16
16
|
export interface SocketRequestOptions {
|
|
17
17
|
/** Bound in ms; `0` or negative disables the timer entirely. */
|
|
18
18
|
readonly timeoutMs?: number;
|
|
19
|
+
/** Opaque bytes carried beside the body — see `LocalRequestOptions.payload`. */
|
|
20
|
+
readonly payload?: Uint8Array;
|
|
19
21
|
}
|
|
20
22
|
export declare class SocketChannel implements LocalChannel {
|
|
21
23
|
private readonly socket;
|
|
@@ -61,6 +63,22 @@ export declare class SocketChannel implements LocalChannel {
|
|
|
61
63
|
* 22 500 writes/s") and not a total since boot.
|
|
62
64
|
*/
|
|
63
65
|
readTraffic(): SocketTrafficSample;
|
|
66
|
+
/**
|
|
67
|
+
* Bytes handed to the socket that the kernel has not taken yet — the
|
|
68
|
+
* `Writable` buffer plus the write in flight. Read LIVE, never cached: this
|
|
69
|
+
* is the number that says whether the peer is draining what we write, and
|
|
70
|
+
* it is read on every heartbeat probe (D446). An unref'd socket keeps it
|
|
71
|
+
* exactly like a ref'd one, which is why it is read here and not summed
|
|
72
|
+
* over `_getActiveHandles()`.
|
|
73
|
+
*/
|
|
74
|
+
queuedBytes(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Write one frame. With a payload the head and the tail are two `write`
|
|
77
|
+
* calls under `cork()` — the kernel sees one `writev`, and the payload bytes
|
|
78
|
+
* are never copied into the head. A forwarded payload is a view into the
|
|
79
|
+
* frame it arrived on, and that frame's buffer is never mutated, so handing
|
|
80
|
+
* the view to the socket is safe.
|
|
81
|
+
*/
|
|
64
82
|
private send;
|
|
65
83
|
private onData;
|
|
66
84
|
/**
|