@camstack/system 1.1.18 → 1.1.20
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 +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +57 -51
- package/dist/index.mjs +57 -51
- package/dist/kernel/moleculer/event-bus-core.d.ts +41 -4
- package/dist/kernel/moleculer/event-bus.d.ts +11 -2
- package/dist/kernel/moleculer/process-service.d.ts +1 -1
- package/dist/kernel/transport/child-cap-protocol.d.ts +25 -4
- package/dist/kernel/transport/local-child-client.d.ts +34 -2
- package/dist/kernel/transport/local-child-registry.d.ts +57 -2
- package/dist/kernel/transport/uds-event-bridge.d.ts +10 -0
- package/dist/kernel/transport/uds-event-bus.d.ts +6 -0
- package/dist/{manifest-python-deps-lZd5B4FS.js → manifest-python-deps-PbdHKDpj.js} +315 -117
- package/dist/{manifest-python-deps-DOAh19rY.mjs → manifest-python-deps-X00KVYHa.mjs} +315 -117
- package/dist/notification/notification-service.d.ts +29 -23
- package/package.json +1 -1
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
import { IReadinessRegistryRecord, SystemEvent } from '@camstack/types';
|
|
2
|
+
import { AddonCallInput, CapCallInput, ChildLogMessage, RegisteredChild } from './child-cap-protocol.js';
|
|
1
3
|
import { LocalTransportServer } from './local-transport.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Fan-out mode for parent→child event delivery, from the
|
|
6
|
+
* `CAMSTACK_UDS_EVENT_FANOUT` env (read once at registry construction):
|
|
7
|
+
* - `filter` (default) — apply the subscription gate; a child receives a
|
|
8
|
+
* category only if one of its declared patterns matches.
|
|
9
|
+
* - `shadow` — compute the gate decision + count would-suppresses, but
|
|
10
|
+
* STILL send every event (burn-in: prove zero would-be-starved deliveries).
|
|
11
|
+
* - `broadcast` — ignore the gate entirely (today's behaviour); the operator's
|
|
12
|
+
* one-env rollback without redeploying runners.
|
|
13
|
+
*/
|
|
14
|
+
export type UdsEventFanoutMode = 'filter' | 'shadow' | 'broadcast';
|
|
15
|
+
/** Per-child event fan-out counters (sent = delivered, suppressed = gated/would-gate). */
|
|
16
|
+
export interface ChildEventStats {
|
|
17
|
+
sent: number;
|
|
18
|
+
suppressed: number;
|
|
19
|
+
}
|
|
4
20
|
/**
|
|
5
21
|
* Sentinel prefix used in the no-route error thrown when `cap-call-out` has no
|
|
6
22
|
* local sibling and no `onUnownedCall` fallback. `ipcParentLink` detects this
|
|
@@ -38,6 +54,16 @@ export interface LocalChildRegistryOptions {
|
|
|
38
54
|
* preference is set or the cap is not a singleton.
|
|
39
55
|
*/
|
|
40
56
|
readonly getActiveSingletonAddonId?: (capName: string) => string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Resolve an addonId to its runner/child id — the addon's
|
|
59
|
+
* `execution.group` when it declares one, else the addon id itself
|
|
60
|
+
* (`resolveRunnerId`). Needed so the active-singleton preference (which
|
|
61
|
+
* is expressed as an addonId) can be matched against the registry's
|
|
62
|
+
* candidate CHILD ids: a grouped addon's child id is the group name, not
|
|
63
|
+
* its own id. Omitted → identity (addonId === childId), preserving the
|
|
64
|
+
* solo-runner behaviour for every ungrouped addon.
|
|
65
|
+
*/
|
|
66
|
+
readonly resolveChildIdForAddon?: (addonId: string) => string;
|
|
41
67
|
}
|
|
42
68
|
/**
|
|
43
69
|
* Parent-side authority for local addon-runners reachable over a
|
|
@@ -56,8 +82,15 @@ export declare class LocalChildRegistry {
|
|
|
56
82
|
private readonly onUnownedCall?;
|
|
57
83
|
private readonly logger?;
|
|
58
84
|
private readonly getActiveSingletonAddonId?;
|
|
85
|
+
private readonly resolveChildIdForAddon?;
|
|
59
86
|
/** Tracks capNames already logged as UDS-routed; one INFO line per capName per process. */
|
|
60
87
|
private readonly egressRoutedCaps;
|
|
88
|
+
/** Active event fan-out mode, read once from `CAMSTACK_UDS_EVENT_FANOUT`. */
|
|
89
|
+
private readonly fanoutMode;
|
|
90
|
+
/** Per-child event fan-out counters (sent / suppressed). */
|
|
91
|
+
private readonly childEventStats;
|
|
92
|
+
/** Last pattern-set string logged per child, to dedup the INFO line. */
|
|
93
|
+
private readonly loggedPatternSet;
|
|
61
94
|
/**
|
|
62
95
|
* Accepts either a plain positional `server` argument (backward-compatible)
|
|
63
96
|
* or a full `LocalChildRegistryOptions` object.
|
|
@@ -71,6 +104,28 @@ export declare class LocalChildRegistry {
|
|
|
71
104
|
*/
|
|
72
105
|
constructor(serverOrOptions: LocalTransportServer | LocalChildRegistryOptions, onUnownedCallArg?: (input: CapCallInput) => Promise<unknown>);
|
|
73
106
|
start(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Per-child event fan-out counters (`{ sent, suppressed }`) or `null` if the
|
|
109
|
+
* child has no recorded events yet. Exposed for the starvation-verification
|
|
110
|
+
* surface (shadow burn-in + operator debug).
|
|
111
|
+
*/
|
|
112
|
+
getChildEventStats(childId: string): ChildEventStats | null;
|
|
113
|
+
/**
|
|
114
|
+
* Does `entry` want to receive an event in `category`? Honours the fan-out
|
|
115
|
+
* mode: `broadcast` → always; undeclared patterns (`null`) → always
|
|
116
|
+
* (fail-open); else the child's declared set must match via `matchesPattern`
|
|
117
|
+
* — the SAME function the child's own `deliverShared` map-key gate uses,
|
|
118
|
+
* giving provable delivery parity. `shadow` is handled by the caller (it
|
|
119
|
+
* counts the would-suppress but still sends).
|
|
120
|
+
*
|
|
121
|
+
* NOTE: this gate must NOT consult `RING_BUFFER_DENY_PATTERNS` /
|
|
122
|
+
* `isHighFrequencyCategory` — those are ring-buffer STORAGE policy; a child
|
|
123
|
+
* that explicitly subscribes to a ring-denied category must still RECEIVE it.
|
|
124
|
+
*/
|
|
125
|
+
private childWantsEvent;
|
|
126
|
+
private statsFor;
|
|
127
|
+
/** Deduped INFO line whenever a child's declared pattern set changes. */
|
|
128
|
+
private logPatternSet;
|
|
74
129
|
/**
|
|
75
130
|
* Child id that can service a call to `capName` (optionally addressing
|
|
76
131
|
* `deviceId`), or null.
|
|
@@ -2,6 +2,16 @@ import { IEventBus, SystemEvent } from '@camstack/types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Minimal surface the bridge requires from `LocalChildRegistry`.
|
|
4
4
|
* Structurally typed so tests can provide a fake without any casts.
|
|
5
|
+
*
|
|
6
|
+
* CONTRACT: `broadcastEventToChildren` is SUBSCRIPTION-FILTERED. The registry
|
|
7
|
+
* fans an event only to children whose declared category-pattern set matches
|
|
8
|
+
* `event.category` (mirror of each child's local `SharedBusState.handlers`
|
|
9
|
+
* keys). A child that never declared a set (legacy/undeclared) fails OPEN and
|
|
10
|
+
* receives everything. The `CAMSTACK_UDS_EVENT_FANOUT` env (`filter` default /
|
|
11
|
+
* `shadow` / `broadcast`) is the registry-side kill-switch. The bridge itself
|
|
12
|
+
* needs no per-event logic change — both fan-out call sites here go through the
|
|
13
|
+
* filtered `broadcastEventToChildren`. `sendEventToChild` (targeted push) is
|
|
14
|
+
* NOT filtered — an explicit single-child send expresses intent.
|
|
5
15
|
*/
|
|
6
16
|
export interface ChildEventBroadcaster {
|
|
7
17
|
/**
|
|
@@ -6,10 +6,16 @@ import { IEventBus, SystemEvent } from '@camstack/types';
|
|
|
6
6
|
* - `emitEvent` — fire-and-forget: send a system event to the parent.
|
|
7
7
|
* - `onEvent` — register the single handler for parent→child events.
|
|
8
8
|
* (Only one handler is registered; calling again replaces the previous one.)
|
|
9
|
+
* - `updateEventPatterns` — declare this owner's live category-pattern set to
|
|
10
|
+
* the parent so it can subscription-filter the event fan-out. Called after
|
|
11
|
+
* every subscribe/unsubscribe with the CURRENT key set (full-set replace).
|
|
12
|
+
* Keyed by `ownerId` (the addonId) so multiple buses sharing one client
|
|
13
|
+
* union correctly.
|
|
9
14
|
*/
|
|
10
15
|
export interface UdsEventChannel {
|
|
11
16
|
emitEvent(event: SystemEvent): void;
|
|
12
17
|
onEvent(handler: (event: SystemEvent) => void): void;
|
|
18
|
+
updateEventPatterns(ownerId: string, patterns: readonly string[]): void;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* Create a UDS-backed `IEventBus` for use inside a forked child process.
|