indigo-matter-bridge 0.5.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/README.md +100 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +91 -0
- package/dist/config.js.map +1 -0
- package/dist/endpoint-map.d.ts +216 -0
- package/dist/endpoint-map.js +433 -0
- package/dist/endpoint-map.js.map +1 -0
- package/dist/endpoints.d.ts +353 -0
- package/dist/endpoints.js +1373 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/main.d.ts +9 -0
- package/dist/main.js +161 -0
- package/dist/main.js.map +1 -0
- package/dist/node.d.ts +321 -0
- package/dist/node.js +946 -0
- package/dist/node.js.map +1 -0
- package/dist/protocol.d.ts +341 -0
- package/dist/protocol.js +156 -0
- package/dist/protocol.js.map +1 -0
- package/dist/reconcile.d.ts +65 -0
- package/dist/reconcile.js +163 -0
- package/dist/reconcile.js.map +1 -0
- package/dist/registry.d.ts +122 -0
- package/dist/registry.js +314 -0
- package/dist/registry.js.map +1 -0
- package/dist/storage.d.ts +175 -0
- package/dist/storage.js +343 -0
- package/dist/storage.js.map +1 -0
- package/dist/window.d.ts +57 -0
- package/dist/window.js +107 -0
- package/dist/window.js.map +1 -0
- package/dist/ws-server.d.ts +54 -0
- package/dist/ws-server.js +349 -0
- package/dist/ws-server.js.map +1 -0
- package/package.json +47 -0
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,kBA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AS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;QACvF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;IAC1F,CAAC;IAED,mEAAmE;IAC3D,sBAAsB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO;QACX,CAAC;QACD,KAAK,MAAM,CAAC,GAAG;aACV,GAAG,CAAC,kBAAkB,CAAC;aACvB,gBAAgB,EAAE;aAClB,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the plugin ⇄ bridge-node local protocol (BRIDGE_PROTOCOL.md).
|
|
3
|
+
*
|
|
4
|
+
* This module is deliberately free of matter.js imports: it is the contract,
|
|
5
|
+
* and both the WebSocket server and its tests depend on it without dragging in
|
|
6
|
+
* a Matter stack.
|
|
7
|
+
*/
|
|
8
|
+
/** Protocol version this node speaks. Skew fails closed on both peers (§2). */
|
|
9
|
+
export declare const PROTOCOL_VERSION = 1;
|
|
10
|
+
/** Seconds a connection may sit past the handshake without attaching (§2). */
|
|
11
|
+
export declare const UNATTACHED_TIMEOUT_MS = 10000;
|
|
12
|
+
/**
|
|
13
|
+
* Enhanced commissioning window bounds, in seconds (§3.8).
|
|
14
|
+
*
|
|
15
|
+
* Matter caps `CommissioningTimeout` at 900s and floors it at 180s. The cap is
|
|
16
|
+
* ours to enforce: matter.js 0.17.8's `DeviceCommissioner` builds a
|
|
17
|
+
* `STANDARD_COMMISSIONING_TIMEOUT` timer but never starts it, so nothing on the
|
|
18
|
+
* Matter side would close a longer window.
|
|
19
|
+
*/
|
|
20
|
+
export declare const WINDOW_DURATION_MIN_SECONDS = 180;
|
|
21
|
+
export declare const WINDOW_DURATION_MAX_SECONDS = 900;
|
|
22
|
+
export declare const WINDOW_DURATION_DEFAULT_SECONDS = 900;
|
|
23
|
+
/** The complete `error_code` domain for protocol version 1 (§1.1). */
|
|
24
|
+
export declare const ErrorCode: {
|
|
25
|
+
readonly unknownCommand: "unknown_command";
|
|
26
|
+
readonly malformedArgs: "malformed_args";
|
|
27
|
+
readonly versionMismatch: "version_mismatch";
|
|
28
|
+
readonly notAttached: "not_attached";
|
|
29
|
+
readonly unknownDevice: "unknown_device";
|
|
30
|
+
readonly unknownRole: "unknown_role";
|
|
31
|
+
readonly roleChange: "role_change";
|
|
32
|
+
readonly massRemovalRefused: "mass_removal_refused";
|
|
33
|
+
readonly endpointMapInvalid: "endpoint_map_invalid";
|
|
34
|
+
readonly commissioningWindowFailed: "commissioning_window_failed";
|
|
35
|
+
readonly internal: "internal";
|
|
36
|
+
};
|
|
37
|
+
export type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
38
|
+
/** The bare frame the node sends on every new connection, before `attach` (§2). */
|
|
39
|
+
export interface HandshakeFrame {
|
|
40
|
+
protocolVersion: number;
|
|
41
|
+
bridgeVersion: string;
|
|
42
|
+
matterJsVersion: string;
|
|
43
|
+
}
|
|
44
|
+
/** plugin → node (§1). */
|
|
45
|
+
export interface RequestFrame {
|
|
46
|
+
message_id: string;
|
|
47
|
+
command: string;
|
|
48
|
+
args?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
/** node → plugin, success (§1). */
|
|
51
|
+
export interface SuccessFrame {
|
|
52
|
+
message_id: string;
|
|
53
|
+
result: unknown;
|
|
54
|
+
}
|
|
55
|
+
/** node → plugin, failure (§1). */
|
|
56
|
+
export interface ErrorFrame {
|
|
57
|
+
message_id: string;
|
|
58
|
+
error_code: ErrorCodeValue;
|
|
59
|
+
details: string;
|
|
60
|
+
}
|
|
61
|
+
/** §5 `window_closed` — why the enhanced commissioning window ended. */
|
|
62
|
+
export type WindowClosedReason = "expired" | "commissioned";
|
|
63
|
+
/**
|
|
64
|
+
* The complete §5 event name domain. `window_closed` and `command` are emitted
|
|
65
|
+
* today; the rest arrive with fabric/drift reporting. The whole set is declared
|
|
66
|
+
* here so the fixture mirror can catch a misspelt name at compile time rather
|
|
67
|
+
* than shipping an event the plugin logs as unknown and drops.
|
|
68
|
+
*/
|
|
69
|
+
export declare const EventName: {
|
|
70
|
+
readonly command: "command";
|
|
71
|
+
readonly fabricsChanged: "fabrics_changed";
|
|
72
|
+
readonly commissioned: "commissioned";
|
|
73
|
+
readonly decommissioned: "decommissioned";
|
|
74
|
+
readonly windowClosed: "window_closed";
|
|
75
|
+
readonly driftDetected: "drift_detected";
|
|
76
|
+
};
|
|
77
|
+
export type EventNameValue = (typeof EventName)[keyof typeof EventName];
|
|
78
|
+
/** node → plugin, unsolicited (§1). */
|
|
79
|
+
export interface EventFrame {
|
|
80
|
+
event: EventNameValue;
|
|
81
|
+
data: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The v1 role enum (§4.2) — the TypeScript mirror of `bridge_protocol.ROLES`.
|
|
85
|
+
* Typing `EndpointSummary.role` as this rather than `string` is what makes a
|
|
86
|
+
* typo in a golden frame or a summary a compile error on this side.
|
|
87
|
+
*/
|
|
88
|
+
export declare const Role: {
|
|
89
|
+
readonly onOffPlugInUnit: "onOffPlugInUnit";
|
|
90
|
+
readonly onOffLight: "onOffLight";
|
|
91
|
+
readonly dimmableLight: "dimmableLight";
|
|
92
|
+
readonly colorTemperatureLight: "colorTemperatureLight";
|
|
93
|
+
readonly extendedColorLight: "extendedColorLight";
|
|
94
|
+
readonly windowCovering: "windowCovering";
|
|
95
|
+
readonly doorLock: "doorLock";
|
|
96
|
+
readonly occupancySensor: "occupancySensor";
|
|
97
|
+
readonly contactSensor: "contactSensor";
|
|
98
|
+
readonly temperatureSensor: "temperatureSensor";
|
|
99
|
+
readonly humiditySensor: "humiditySensor";
|
|
100
|
+
readonly lightSensor: "lightSensor";
|
|
101
|
+
readonly pressureSensor: "pressureSensor";
|
|
102
|
+
readonly flowSensor: "flowSensor";
|
|
103
|
+
readonly thermostat: "thermostat";
|
|
104
|
+
};
|
|
105
|
+
export type RoleValue = (typeof Role)[keyof typeof Role];
|
|
106
|
+
/** Runtime membership test for the §4.2 role enum — the `unknown_role` gate. */
|
|
107
|
+
export declare function isRole(value: unknown): value is RoleValue;
|
|
108
|
+
/**
|
|
109
|
+
* §3.1's opt-in for a reconcile that would empty the live endpoint set. The
|
|
110
|
+
* literal is named because both the guard and its refusal message quote it.
|
|
111
|
+
*/
|
|
112
|
+
export declare const INTENT_REPLACE_ALL = "replace_all";
|
|
113
|
+
/**
|
|
114
|
+
* The only commands accepted while the node is in the `endpoint_map_invalid`
|
|
115
|
+
* refuse-to-start state (§1.1).
|
|
116
|
+
*
|
|
117
|
+
* `attach` is deliberately *not* here. A node that cannot vouch for its own
|
|
118
|
+
* endpoint numbers must not create endpoints — creating them is precisely how a
|
|
119
|
+
* lost map duplicates every accessory in every paired ecosystem — so the
|
|
120
|
+
* reconcile that would create them is refused like everything else. The three
|
|
121
|
+
* that remain are the ones a user needs to see the damage (`get_status`), keep
|
|
122
|
+
* pairing readable (`get_pairing`), and choose the way out (§3.11).
|
|
123
|
+
*
|
|
124
|
+
* **`factory_reset` is not here either, and that is a decision rather than an
|
|
125
|
+
* oversight.** It is arguably a legitimate exit — `preserveEndpointNumbers:
|
|
126
|
+
* false` would discard the corrupt map along with everything else — but it is
|
|
127
|
+
* strictly the bigger hammer: it destroys every ecosystem pairing, which §3.11
|
|
128
|
+
* does not, and §3.11 already exits every refusal state there is. Admitting a
|
|
129
|
+
* pairing-wiping command *alongside* a non-destructive one that solves the same
|
|
130
|
+
* problem invites a user staring at a scary error to reach for the wrong one.
|
|
131
|
+
* It is not a dead end: once §3.11 has run the node serves normally and
|
|
132
|
+
* `factory_reset` is available like any other command, so the sequence costs
|
|
133
|
+
* one extra step and nothing else.
|
|
134
|
+
*/
|
|
135
|
+
export declare const RECOVERY_COMMANDS: ReadonlySet<string>;
|
|
136
|
+
/** The `details` tail every `endpoint_map_invalid` refusal carries (§1.1). */
|
|
137
|
+
export declare const ENDPOINT_MAP_INVALID_SUFFIX = "; only get_status, get_pairing and rebuild_endpoint_map are accepted";
|
|
138
|
+
/**
|
|
139
|
+
* Why the node is refusing. Kept as distinct reasons rather than one string
|
|
140
|
+
* because they need different remedies: an unreadable map is fixed by §3.11,
|
|
141
|
+
* while lost fabric storage is fixed by restoring a backup — and §3.11 there
|
|
142
|
+
* means "accept that the pairings are gone".
|
|
143
|
+
*/
|
|
144
|
+
export declare const RefuseReason: {
|
|
145
|
+
/**
|
|
146
|
+
* `endpoint-map.json` is present but not usable.
|
|
147
|
+
*
|
|
148
|
+
* There is deliberately **no** reason for a map that is merely *absent* on a
|
|
149
|
+
* commissioned bridge: matter.js owns the numbers and this file is only the
|
|
150
|
+
* witness, so a missing witness renumbers nothing — it is bootstrapped from
|
|
151
|
+
* matter.js's own persisted allocation instead (see `refuseReasonFor`).
|
|
152
|
+
* Every pre-E5 install is in that state, and refusing there would have taken
|
|
153
|
+
* working exports offline on upgrade to fix a file that never existed.
|
|
154
|
+
*/
|
|
155
|
+
readonly mapUnreadable: "endpoint map is unreadable";
|
|
156
|
+
/** The commissioning witness says paired; matter.js says no fabrics (PRD §7). */
|
|
157
|
+
readonly fabricStorageLost: string;
|
|
158
|
+
/** `identity.json` is present but unusable — a new one would change our serial. */
|
|
159
|
+
readonly identityUnreadable: "the bridge identity file is present but unreadable";
|
|
160
|
+
};
|
|
161
|
+
export type RefuseReasonValue = (typeof RefuseReason)[keyof typeof RefuseReason];
|
|
162
|
+
/** The full `details` for an `endpoint_map_invalid` refusal. */
|
|
163
|
+
export declare function endpointMapInvalidDetails(reason: string): string;
|
|
164
|
+
/** §4.1 — the desired state of one exported device, as the plugin declares it. */
|
|
165
|
+
export interface EndpointSpec {
|
|
166
|
+
indigoDeviceId: number;
|
|
167
|
+
role: RoleValue;
|
|
168
|
+
label: string;
|
|
169
|
+
reachable: boolean;
|
|
170
|
+
/** Role-specific state keys (§4.2). Values are Indigo-natural units. */
|
|
171
|
+
states: Record<string, unknown>;
|
|
172
|
+
/** Role-specific extras (e.g. window-covering polarity). Unused by E3 roles. */
|
|
173
|
+
options: Record<string, unknown>;
|
|
174
|
+
}
|
|
175
|
+
/** §3.2 */
|
|
176
|
+
export interface UpsertResult {
|
|
177
|
+
endpointNumber: number;
|
|
178
|
+
}
|
|
179
|
+
/** §3.3 */
|
|
180
|
+
export interface RemoveResult {
|
|
181
|
+
removed: boolean;
|
|
182
|
+
}
|
|
183
|
+
/** §5 `command` — the `data` of an ecosystem-originated action. */
|
|
184
|
+
export interface CommandEventData extends Record<string, unknown> {
|
|
185
|
+
indigoDeviceId: number;
|
|
186
|
+
command: string;
|
|
187
|
+
args: Record<string, unknown>;
|
|
188
|
+
}
|
|
189
|
+
/** §4.3 */
|
|
190
|
+
export interface FabricInfo {
|
|
191
|
+
fabricIndex: number;
|
|
192
|
+
label: string;
|
|
193
|
+
vendorId: number;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* §3.9's answer — what the removal actually DID, not merely that it returned.
|
|
197
|
+
*
|
|
198
|
+
* `remove_fabric` used to answer `{}` whether it dropped a fabric or found
|
|
199
|
+
* nothing at the index, and the plugin then told the user "that ecosystem has
|
|
200
|
+
* been unpaired. Every accessory has been removed" over a node-side no-op. The
|
|
201
|
+
* stale-index case is not an edge: the plugin's picker is built from a CACHED
|
|
202
|
+
* fabric list, so an ecosystem that unpaired *us* between the last event and
|
|
203
|
+
* the dialog opening is the designed way to land here.
|
|
204
|
+
*
|
|
205
|
+
* `remaining` is `null` — never a number — when the count could not be read.
|
|
206
|
+
* The fabric set is legitimately mid-rebuild after a last-fabric leave
|
|
207
|
+
* (matter.js factory-resets itself), and reporting a made-up `0` there would
|
|
208
|
+
* be the same class of lie this type exists to end.
|
|
209
|
+
*/
|
|
210
|
+
export interface RemoveFabricResult {
|
|
211
|
+
/** False when there was no fabric at that index: the request was already true. */
|
|
212
|
+
removed: boolean;
|
|
213
|
+
/** Fabrics the node holds now, or `null` when the count could not be read. */
|
|
214
|
+
remaining: number | null;
|
|
215
|
+
}
|
|
216
|
+
/** §4.3 */
|
|
217
|
+
export interface StatusReport {
|
|
218
|
+
commissioned: boolean;
|
|
219
|
+
fabrics: FabricInfo[];
|
|
220
|
+
endpointCount: number;
|
|
221
|
+
endpoints: EndpointSummary[];
|
|
222
|
+
drift: DriftEntry[];
|
|
223
|
+
/**
|
|
224
|
+
* Whether `drift` is an answer or an absence.
|
|
225
|
+
*
|
|
226
|
+
* `drift: []` alone is ambiguous, and the two readings could not be further
|
|
227
|
+
* apart: "checked, nothing has moved" versus "there is no persisted map to
|
|
228
|
+
* check against yet". Since E5 this is `true` once the detector has run
|
|
229
|
+
* against a persisted baseline, and `false` before — on a fresh install,
|
|
230
|
+
* and on any status read before the first reconcile.
|
|
231
|
+
*/
|
|
232
|
+
driftChecked: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Persistence failures the node has hit and cannot fix on its own.
|
|
235
|
+
*
|
|
236
|
+
* The node's only other channel is stdout, and in this milestone it is
|
|
237
|
+
* **started by hand** — so stdout is a terminal that was closed hours ago.
|
|
238
|
+
* A map that could not be written, a commissioning witness that could not
|
|
239
|
+
* be cleared, an identity that could not be saved: each of those is exactly
|
|
240
|
+
* the class of fault this milestone exists to make visible, and each would
|
|
241
|
+
* otherwise be visible nowhere at all. `get_status` is polled by the
|
|
242
|
+
* plugin's watchdog, so this is the one path to a user's log.
|
|
243
|
+
*
|
|
244
|
+
* Empty is the normal state. Entries are current, not historical: a warning
|
|
245
|
+
* disappears the moment the operation it describes succeeds.
|
|
246
|
+
*/
|
|
247
|
+
warnings: string[];
|
|
248
|
+
}
|
|
249
|
+
export interface EndpointSummary {
|
|
250
|
+
indigoDeviceId: number;
|
|
251
|
+
endpointNumber: number;
|
|
252
|
+
role: RoleValue;
|
|
253
|
+
}
|
|
254
|
+
export interface DriftEntry {
|
|
255
|
+
uniqueId: string;
|
|
256
|
+
expected: number;
|
|
257
|
+
actual: number;
|
|
258
|
+
}
|
|
259
|
+
/** §3.7 */
|
|
260
|
+
export interface PairingReport {
|
|
261
|
+
commissioned: boolean;
|
|
262
|
+
windowOpen: boolean;
|
|
263
|
+
windowExpiresAt: string | null;
|
|
264
|
+
manualPairingCode: string | null;
|
|
265
|
+
qrPairingCode: string | null;
|
|
266
|
+
fabrics: FabricInfo[];
|
|
267
|
+
}
|
|
268
|
+
/** §3.8 */
|
|
269
|
+
export interface CommissioningWindowResult {
|
|
270
|
+
manualPairingCode: string;
|
|
271
|
+
qrPairingCode: string;
|
|
272
|
+
windowExpiresAt: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The slice of bridge behaviour the protocol server needs. Keeping it an
|
|
276
|
+
* interface is what lets the protocol tests run without a live Matter stack.
|
|
277
|
+
*/
|
|
278
|
+
export interface BridgeFacade {
|
|
279
|
+
getStatus(): StatusReport;
|
|
280
|
+
getPairing(): PairingReport;
|
|
281
|
+
openCommissioningWindow(durationSeconds: number): Promise<CommissioningWindowResult>;
|
|
282
|
+
/**
|
|
283
|
+
* §3.1's reconcile. `replaceAll` is the parsed `intent: "replace_all"`; the
|
|
284
|
+
* mass-removal guard lives behind this seam because only the implementation
|
|
285
|
+
* knows the live set.
|
|
286
|
+
*/
|
|
287
|
+
reconcile(endpoints: readonly EndpointSpec[], replaceAll: boolean): Promise<StatusReport>;
|
|
288
|
+
/** §3.2 — create-or-update. Rejects a role change with `role_change` (§4.1). */
|
|
289
|
+
upsertEndpoint(spec: EndpointSpec): Promise<UpsertResult>;
|
|
290
|
+
/** §3.3 — idempotent; `{removed: false}` for a device with no live endpoint. */
|
|
291
|
+
removeEndpoint(indigoDeviceId: number): Promise<RemoveResult>;
|
|
292
|
+
/** §3.4 — local (offline-context) writes, so they do not echo as `command`. */
|
|
293
|
+
setState(indigoDeviceId: number, states: Record<string, unknown>): Promise<void>;
|
|
294
|
+
/** §3.5 — Bridged Device Basic Information `Reachable`. */
|
|
295
|
+
setReachable(indigoDeviceId: number, reachable: boolean): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Register the sink for `window_closed` (§3.8/§5). One listener, last
|
|
298
|
+
* registration wins — this seam is what lets the protocol server emit the
|
|
299
|
+
* event without importing the Matter stack, and lets tests fire it.
|
|
300
|
+
*/
|
|
301
|
+
onWindowClosed(listener: (reason: WindowClosedReason) => void): void;
|
|
302
|
+
/** The same seam for §5 `command`, emitted when an ecosystem acts. */
|
|
303
|
+
onCommand(listener: (data: CommandEventData) => void): void;
|
|
304
|
+
/** The same seam for §5 `drift_detected` (§4.3). */
|
|
305
|
+
onDriftDetected(listener: (drift: DriftEntry[]) => void): void;
|
|
306
|
+
/**
|
|
307
|
+
* The same seam for §5 `fabrics_changed`. Fires on every pairing or
|
|
308
|
+
* unpairing the Matter stack observes, including the ones §3.9 and §3.10
|
|
309
|
+
* cause themselves — a fabric the *plugin* removed still changed the set,
|
|
310
|
+
* and the plugin's readout has no other way to learn it landed.
|
|
311
|
+
*/
|
|
312
|
+
onFabricsChanged(listener: (fabrics: FabricInfo[], change: string) => void): void;
|
|
313
|
+
/** §5 `commissioned` — the fabric count went from zero to non-zero. */
|
|
314
|
+
onCommissioned(listener: () => void): void;
|
|
315
|
+
/** §5 `decommissioned` — the last fabric went (§3.9's final leave, §3.10). */
|
|
316
|
+
onDecommissioned(listener: () => void): void;
|
|
317
|
+
/**
|
|
318
|
+
* The reason this node is refusing everything outside
|
|
319
|
+
* {@link RECOVERY_COMMANDS}, or `undefined` when it is serving normally.
|
|
320
|
+
*
|
|
321
|
+
* A getter rather than a constructor flag because §3.11 clears it: the
|
|
322
|
+
* protocol server reads it per frame, so the command that fixes the state
|
|
323
|
+
* takes effect on the very next one.
|
|
324
|
+
*/
|
|
325
|
+
endpointMapRefusal(): string | undefined;
|
|
326
|
+
/** §3.9 — drop one ecosystem's fabric. */
|
|
327
|
+
removeFabric(fabricIndex: number): Promise<RemoveFabricResult>;
|
|
328
|
+
/** §3.10 — wipe commissioning credentials and advertise fresh. */
|
|
329
|
+
factoryReset(preserveEndpointNumbers: boolean): Promise<void>;
|
|
330
|
+
/** §3.11 — adopt the live endpoint numbers as the new persisted map. */
|
|
331
|
+
rebuildEndpointMap(): Promise<StatusReport>;
|
|
332
|
+
}
|
|
333
|
+
/** A protocol-level failure a command handler can throw to shape its response. */
|
|
334
|
+
export declare class ProtocolError extends Error {
|
|
335
|
+
readonly code: ErrorCodeValue;
|
|
336
|
+
constructor(code: ErrorCodeValue, details: string);
|
|
337
|
+
}
|
|
338
|
+
/** The human-readable message for an unknown throwable — what `details` carries. */
|
|
339
|
+
export declare function describeError(error: unknown): string;
|
|
340
|
+
/** The same, with a stack when there is one — for the log, never for the wire. */
|
|
341
|
+
export declare function describeErrorWithStack(error: unknown): string;
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the plugin ⇄ bridge-node local protocol (BRIDGE_PROTOCOL.md).
|
|
3
|
+
*
|
|
4
|
+
* This module is deliberately free of matter.js imports: it is the contract,
|
|
5
|
+
* and both the WebSocket server and its tests depend on it without dragging in
|
|
6
|
+
* a Matter stack.
|
|
7
|
+
*/
|
|
8
|
+
/** Protocol version this node speaks. Skew fails closed on both peers (§2). */
|
|
9
|
+
export const PROTOCOL_VERSION = 1;
|
|
10
|
+
/** Seconds a connection may sit past the handshake without attaching (§2). */
|
|
11
|
+
export const UNATTACHED_TIMEOUT_MS = 10_000;
|
|
12
|
+
/**
|
|
13
|
+
* Enhanced commissioning window bounds, in seconds (§3.8).
|
|
14
|
+
*
|
|
15
|
+
* Matter caps `CommissioningTimeout` at 900s and floors it at 180s. The cap is
|
|
16
|
+
* ours to enforce: matter.js 0.17.8's `DeviceCommissioner` builds a
|
|
17
|
+
* `STANDARD_COMMISSIONING_TIMEOUT` timer but never starts it, so nothing on the
|
|
18
|
+
* Matter side would close a longer window.
|
|
19
|
+
*/
|
|
20
|
+
export const WINDOW_DURATION_MIN_SECONDS = 180;
|
|
21
|
+
export const WINDOW_DURATION_MAX_SECONDS = 900;
|
|
22
|
+
export const WINDOW_DURATION_DEFAULT_SECONDS = 900;
|
|
23
|
+
/** The complete `error_code` domain for protocol version 1 (§1.1). */
|
|
24
|
+
export const ErrorCode = {
|
|
25
|
+
unknownCommand: "unknown_command",
|
|
26
|
+
malformedArgs: "malformed_args",
|
|
27
|
+
versionMismatch: "version_mismatch",
|
|
28
|
+
notAttached: "not_attached",
|
|
29
|
+
unknownDevice: "unknown_device",
|
|
30
|
+
unknownRole: "unknown_role",
|
|
31
|
+
roleChange: "role_change",
|
|
32
|
+
massRemovalRefused: "mass_removal_refused",
|
|
33
|
+
endpointMapInvalid: "endpoint_map_invalid",
|
|
34
|
+
commissioningWindowFailed: "commissioning_window_failed",
|
|
35
|
+
internal: "internal",
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The complete §5 event name domain. `window_closed` and `command` are emitted
|
|
39
|
+
* today; the rest arrive with fabric/drift reporting. The whole set is declared
|
|
40
|
+
* here so the fixture mirror can catch a misspelt name at compile time rather
|
|
41
|
+
* than shipping an event the plugin logs as unknown and drops.
|
|
42
|
+
*/
|
|
43
|
+
export const EventName = {
|
|
44
|
+
command: "command",
|
|
45
|
+
fabricsChanged: "fabrics_changed",
|
|
46
|
+
commissioned: "commissioned",
|
|
47
|
+
decommissioned: "decommissioned",
|
|
48
|
+
windowClosed: "window_closed",
|
|
49
|
+
driftDetected: "drift_detected",
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The v1 role enum (§4.2) — the TypeScript mirror of `bridge_protocol.ROLES`.
|
|
53
|
+
* Typing `EndpointSummary.role` as this rather than `string` is what makes a
|
|
54
|
+
* typo in a golden frame or a summary a compile error on this side.
|
|
55
|
+
*/
|
|
56
|
+
export const Role = {
|
|
57
|
+
onOffPlugInUnit: "onOffPlugInUnit",
|
|
58
|
+
onOffLight: "onOffLight",
|
|
59
|
+
dimmableLight: "dimmableLight",
|
|
60
|
+
colorTemperatureLight: "colorTemperatureLight",
|
|
61
|
+
extendedColorLight: "extendedColorLight",
|
|
62
|
+
windowCovering: "windowCovering",
|
|
63
|
+
doorLock: "doorLock",
|
|
64
|
+
occupancySensor: "occupancySensor",
|
|
65
|
+
contactSensor: "contactSensor",
|
|
66
|
+
temperatureSensor: "temperatureSensor",
|
|
67
|
+
humiditySensor: "humiditySensor",
|
|
68
|
+
lightSensor: "lightSensor",
|
|
69
|
+
pressureSensor: "pressureSensor",
|
|
70
|
+
flowSensor: "flowSensor",
|
|
71
|
+
thermostat: "thermostat",
|
|
72
|
+
};
|
|
73
|
+
/** Runtime membership test for the §4.2 role enum — the `unknown_role` gate. */
|
|
74
|
+
export function isRole(value) {
|
|
75
|
+
return typeof value === "string" && Object.prototype.hasOwnProperty.call(Role, value);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* §3.1's opt-in for a reconcile that would empty the live endpoint set. The
|
|
79
|
+
* literal is named because both the guard and its refusal message quote it.
|
|
80
|
+
*/
|
|
81
|
+
export const INTENT_REPLACE_ALL = "replace_all";
|
|
82
|
+
/**
|
|
83
|
+
* The only commands accepted while the node is in the `endpoint_map_invalid`
|
|
84
|
+
* refuse-to-start state (§1.1).
|
|
85
|
+
*
|
|
86
|
+
* `attach` is deliberately *not* here. A node that cannot vouch for its own
|
|
87
|
+
* endpoint numbers must not create endpoints — creating them is precisely how a
|
|
88
|
+
* lost map duplicates every accessory in every paired ecosystem — so the
|
|
89
|
+
* reconcile that would create them is refused like everything else. The three
|
|
90
|
+
* that remain are the ones a user needs to see the damage (`get_status`), keep
|
|
91
|
+
* pairing readable (`get_pairing`), and choose the way out (§3.11).
|
|
92
|
+
*
|
|
93
|
+
* **`factory_reset` is not here either, and that is a decision rather than an
|
|
94
|
+
* oversight.** It is arguably a legitimate exit — `preserveEndpointNumbers:
|
|
95
|
+
* false` would discard the corrupt map along with everything else — but it is
|
|
96
|
+
* strictly the bigger hammer: it destroys every ecosystem pairing, which §3.11
|
|
97
|
+
* does not, and §3.11 already exits every refusal state there is. Admitting a
|
|
98
|
+
* pairing-wiping command *alongside* a non-destructive one that solves the same
|
|
99
|
+
* problem invites a user staring at a scary error to reach for the wrong one.
|
|
100
|
+
* It is not a dead end: once §3.11 has run the node serves normally and
|
|
101
|
+
* `factory_reset` is available like any other command, so the sequence costs
|
|
102
|
+
* one extra step and nothing else.
|
|
103
|
+
*/
|
|
104
|
+
export const RECOVERY_COMMANDS = new Set([
|
|
105
|
+
"get_status",
|
|
106
|
+
"get_pairing",
|
|
107
|
+
"rebuild_endpoint_map",
|
|
108
|
+
]);
|
|
109
|
+
/** The `details` tail every `endpoint_map_invalid` refusal carries (§1.1). */
|
|
110
|
+
export const ENDPOINT_MAP_INVALID_SUFFIX = "; only get_status, get_pairing and rebuild_endpoint_map are accepted";
|
|
111
|
+
/**
|
|
112
|
+
* Why the node is refusing. Kept as distinct reasons rather than one string
|
|
113
|
+
* because they need different remedies: an unreadable map is fixed by §3.11,
|
|
114
|
+
* while lost fabric storage is fixed by restoring a backup — and §3.11 there
|
|
115
|
+
* means "accept that the pairings are gone".
|
|
116
|
+
*/
|
|
117
|
+
export const RefuseReason = {
|
|
118
|
+
/**
|
|
119
|
+
* `endpoint-map.json` is present but not usable.
|
|
120
|
+
*
|
|
121
|
+
* There is deliberately **no** reason for a map that is merely *absent* on a
|
|
122
|
+
* commissioned bridge: matter.js owns the numbers and this file is only the
|
|
123
|
+
* witness, so a missing witness renumbers nothing — it is bootstrapped from
|
|
124
|
+
* matter.js's own persisted allocation instead (see `refuseReasonFor`).
|
|
125
|
+
* Every pre-E5 install is in that state, and refusing there would have taken
|
|
126
|
+
* working exports offline on upgrade to fix a file that never existed.
|
|
127
|
+
*/
|
|
128
|
+
mapUnreadable: "endpoint map is unreadable",
|
|
129
|
+
/** The commissioning witness says paired; matter.js says no fabrics (PRD §7). */
|
|
130
|
+
fabricStorageLost: "this bridge was commissioned but its Matter fabric storage is gone, so every endpoint " +
|
|
131
|
+
"number would be reallocated",
|
|
132
|
+
/** `identity.json` is present but unusable — a new one would change our serial. */
|
|
133
|
+
identityUnreadable: "the bridge identity file is present but unreadable",
|
|
134
|
+
};
|
|
135
|
+
/** The full `details` for an `endpoint_map_invalid` refusal. */
|
|
136
|
+
export function endpointMapInvalidDetails(reason) {
|
|
137
|
+
return `${reason}${ENDPOINT_MAP_INVALID_SUFFIX}`;
|
|
138
|
+
}
|
|
139
|
+
/** A protocol-level failure a command handler can throw to shape its response. */
|
|
140
|
+
export class ProtocolError extends Error {
|
|
141
|
+
code;
|
|
142
|
+
constructor(code, details) {
|
|
143
|
+
super(details);
|
|
144
|
+
this.code = code;
|
|
145
|
+
this.name = "ProtocolError";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** The human-readable message for an unknown throwable — what `details` carries. */
|
|
149
|
+
export function describeError(error) {
|
|
150
|
+
return error instanceof Error ? error.message : String(error);
|
|
151
|
+
}
|
|
152
|
+
/** The same, with a stack when there is one — for the log, never for the wire. */
|
|
153
|
+
export function describeErrorWithStack(error) {
|
|
154
|
+
return error instanceof Error ? (error.stack ?? error.message) : String(error);
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAEnD,sEAAsE;AACtE,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,gBAAgB;IAC/B,eAAe,EAAE,kBAAkB;IACnC,WAAW,EAAE,cAAc;IAC3B,aAAa,EAAE,gBAAgB;IAC/B,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,aAAa;IACzB,kBAAkB,EAAE,sBAAsB;IAC1C,kBAAkB,EAAE,sBAAsB;IAC1C,yBAAyB,EAAE,6BAA6B;IACxD,QAAQ,EAAE,UAAU;CACd,CAAC;AAkCX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;CACzB,CAAC;AAUX;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,eAAe;IAC9B,qBAAqB,EAAE,uBAAuB;I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,GAAJ,IAAI,CAAgB;QAI7B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAChC,CAAC;CACJ;AAED,oFAAoF;AACpF,MAAM,UAAU,aAAa,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACjD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Argument parsing and the reconcile planner for the endpoint-CRUD commands
|
|
3
|
+
* (BRIDGE_PROTOCOL §3.1-§3.5, §4.1).
|
|
4
|
+
*
|
|
5
|
+
* Deliberately matter.js-free, like `protocol.ts`: every §1.1 refusal the
|
|
6
|
+
* endpoint commands can produce — `malformed_args`, `unknown_role`,
|
|
7
|
+
* `mass_removal_refused` — is decided here, so the decisions are unit-testable
|
|
8
|
+
* without a Matter stack and the WebSocket server and the test double reach the
|
|
9
|
+
* same verdicts from the same code.
|
|
10
|
+
*/
|
|
11
|
+
import { type EndpointSpec, type RoleValue } from "./protocol.js";
|
|
12
|
+
/**
|
|
13
|
+
* §1.1 gate for the identity key. Every endpoint command carries one, and it is
|
|
14
|
+
* always the same refusal, so it is one function rather than four copies.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseDeviceId(value: unknown): number;
|
|
17
|
+
/**
|
|
18
|
+
* Parse one wire `EndpointSpec` (§4.1).
|
|
19
|
+
*
|
|
20
|
+
* A role outside the §4.2 enum is `unknown_role`, not `malformed_args`: §1.1
|
|
21
|
+
* gives it its own code precisely so the plugin can tell "you sent nonsense"
|
|
22
|
+
* from "this node is older than your role vocabulary".
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseEndpointSpec(value: unknown): EndpointSpec;
|
|
25
|
+
/** Parse the `endpoints` array of an `attach` (§3.1). */
|
|
26
|
+
export declare function parseEndpointSpecs(value: unknown): EndpointSpec[];
|
|
27
|
+
/** §3.9: the fabric to drop. `fabricIndex` is a 1-based Matter fabric index. */
|
|
28
|
+
export declare function parseFabricIndex(value: unknown): number;
|
|
29
|
+
/**
|
|
30
|
+
* §3.10: whether a factory reset keeps `endpoint-map.json`.
|
|
31
|
+
*
|
|
32
|
+
* Absent means `true` — the §6.6 rule that destructive operations cannot happen
|
|
33
|
+
* as a default. Discarding endpoint identity is the destructive half of this
|
|
34
|
+
* command, so it takes an explicit `false`; a client that omits the flag gets
|
|
35
|
+
* the reset it asked for and keeps the identities it did not mention.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parsePreserveEndpointNumbers(value: unknown): boolean;
|
|
38
|
+
/** §3.1: the opt-in that makes emptying the endpoint set deliberate. */
|
|
39
|
+
export declare function parseReplaceAll(intent: unknown): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* What an `attach` reconcile has to do to the live endpoint set.
|
|
42
|
+
*
|
|
43
|
+
* `recreate` is the role-change case: §4.1 rejects a role change through
|
|
44
|
+
* `upsert_endpoint`, but `attach` is a *full reconcile* from the peer that owns
|
|
45
|
+
* the export set (§6.2), and failing the whole attach would leave the plugin no
|
|
46
|
+
* way to correct a role at all. So attach removes and re-adds instead. It is
|
|
47
|
+
* still an accessory-identity change in every paired ecosystem, hence its own
|
|
48
|
+
* bucket and its own log line rather than hiding inside `update`.
|
|
49
|
+
*/
|
|
50
|
+
export interface ReconcilePlan {
|
|
51
|
+
create: EndpointSpec[];
|
|
52
|
+
update: EndpointSpec[];
|
|
53
|
+
recreate: EndpointSpec[];
|
|
54
|
+
remove: number[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Diff the desired set against the live one, enforcing the §3.1 mass-removal
|
|
58
|
+
* guard.
|
|
59
|
+
*
|
|
60
|
+
* The guard is about the *effect*, not the literal empty array: an `attach`
|
|
61
|
+
* carrying a completely disjoint device set would also remove every live
|
|
62
|
+
* endpoint, and that is just as much "every exported accessory disappears from
|
|
63
|
+
* every paired ecosystem" as `endpoints: []` is.
|
|
64
|
+
*/
|
|
65
|
+
export declare function planReconcile(live: ReadonlyMap<number, RoleValue>, desired: readonly EndpointSpec[], replaceAll: boolean): ReconcilePlan;
|