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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,QAAQ,EAAqB,MAAM,EAAqB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CA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CAAC,EAAE,CACjE,CAAC;gBACN,CAAC;gBAAC,MAAM,CAAC;oBACL,6DAA6D;gBACjE,CAAC;YACL,CAAC;QACL,CAAC,CAAC;QACF,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QACvB,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,CAAC;AACL,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * indigo-matter bridge node entry point.
4
+ *
5
+ * Wires the three pieces together — persisted identity, the Matter ServerNode,
6
+ * and the loopback protocol server — and shuts them down cleanly on SIGTERM so
7
+ * launchd restarts are not mistaken for crashes.
8
+ */
9
+ export {};
package/dist/main.js ADDED
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * indigo-matter bridge node entry point.
4
+ *
5
+ * Wires the three pieces together — persisted identity, the Matter ServerNode,
6
+ * and the loopback protocol server — and shuts them down cleanly on SIGTERM so
7
+ * launchd restarts are not mistaken for crashes.
8
+ */
9
+ import { createRequire } from "node:module";
10
+ import { networkInterfaces } from "node:os";
11
+ import { assertMdnsInterface, parseArgs, USAGE } from "./config.js";
12
+ import { BridgeNode, matterJsVersion } from "./node.js";
13
+ import { describeError, describeErrorWithStack, RefuseReason } from "./protocol.js";
14
+ import { identityProblem, loadOrCreateIdentity, mintIdentity, quarantineIdentity, } from "./storage.js";
15
+ import { BridgeWsServer } from "./ws-server.js";
16
+ const bridgeVersion = createRequire(import.meta.url)("../package.json").version;
17
+ /** Give a stalled shutdown this long before we stop being polite about it. */
18
+ const SHUTDOWN_ESCAPE_MS = 10_000;
19
+ function log(message) {
20
+ // stdout; launchd captures it into the plugin's log file.
21
+ console.log(`[bridge] ${new Date().toISOString()} ${message}`);
22
+ }
23
+ /**
24
+ * Label each startup step so a launchd log shows *which* one failed. Without
25
+ * this, "Error: listen EADDRINUSE" could equally be the Matter port or the
26
+ * protocol port.
27
+ */
28
+ async function phase(name, run) {
29
+ try {
30
+ return await run();
31
+ }
32
+ catch (error) {
33
+ log(`Startup failed — ${name}: ${describeErrorWithStack(error)}`);
34
+ throw error;
35
+ }
36
+ }
37
+ async function main() {
38
+ let parsed;
39
+ try {
40
+ parsed = parseArgs(process.argv.slice(2));
41
+ }
42
+ catch (error) {
43
+ log(`Invalid arguments: ${describeError(error)}`);
44
+ process.stderr.write(USAGE);
45
+ process.exit(1);
46
+ }
47
+ if (parsed === "help") {
48
+ process.stdout.write(USAGE);
49
+ return;
50
+ }
51
+ const config = parsed;
52
+ log(`indigo-matter-bridge ${bridgeVersion} (matter.js ${matterJsVersion}, node ${process.version})`);
53
+ if (config.mdnsInterface !== undefined) {
54
+ await phase("mDNS interface check", () => assertMdnsInterface(config.mdnsInterface, Object.keys(networkInterfaces())));
55
+ }
56
+ // Asked BEFORE the identity is loaded, because loading it is what would
57
+ // replace an unusable one — and replacing it mints a new `SerialNumber` and
58
+ // `UniqueID`, which every paired ecosystem reads as a different accessory
59
+ // (E5 / PRD §4.3). A missing file is a first run and answers `undefined`.
60
+ const identityFault = await phase("identity check failed", () => identityProblem(config.storagePath));
61
+ // The two answers take opposite paths, and running the mint unconditionally
62
+ // — as the first cut of E5 did — destroyed the file the refusal below exists
63
+ // to protect, one line before refusing to protect it. `loadOrCreateIdentity`
64
+ // writes through `rename`, so the unusable original was gone by the time
65
+ // anybody was told there had been a problem.
66
+ let identity;
67
+ if (identityFault === undefined) {
68
+ identity = await phase("identity load failed", () => loadOrCreateIdentity(config.storagePath, log));
69
+ }
70
+ else {
71
+ log(`Bridge identity unusable: ${identityFault}`);
72
+ const movedTo = quarantineIdentity(config.storagePath, log);
73
+ if (movedTo !== undefined) {
74
+ log(`Moved the unusable identity to ${movedTo} — repair or restore it, then restart`);
75
+ }
76
+ // In memory only. The node needs *an* identity to build a ServerNode at
77
+ // all (that is what keeps `get_pairing` answering, §1.1), but nothing
78
+ // durable may be written over an identity we could not read: no
79
+ // endpoints are served while refusing, so this one is never anybody's
80
+ // accessory and must not outlive the process.
81
+ identity = mintIdentity();
82
+ log("Using a temporary in-memory bridge identity; NOTHING has been written to identity.json");
83
+ }
84
+ const bridge = new BridgeNode(config, identity, bridgeVersion, log, identityFault === undefined ? undefined : RefuseReason.identityUnreadable);
85
+ await phase(`Matter node start failed (matter port ${config.matterPort}, storage ${config.storagePath})`, () => bridge.start());
86
+ const ws = new BridgeWsServer({
87
+ port: config.wsPort,
88
+ bridge,
89
+ bridgeVersion,
90
+ matterJsVersion,
91
+ log,
92
+ });
93
+ await phase(`protocol WS listen failed (port ${config.wsPort})`, () => ws.listen());
94
+ let shuttingDown = false;
95
+ const shutdown = (signal) => {
96
+ if (shuttingDown) {
97
+ return;
98
+ }
99
+ shuttingDown = true;
100
+ log(`Received ${signal}, shutting down`);
101
+ // Armed before the awaits, so a close that never resolves is still
102
+ // caught. Unref'd: it must not itself hold the loop open. A forced exit
103
+ // is not a clean shutdown, hence exit code 1 — launchd should see the
104
+ // difference. BridgeNode.start() sets `runtime.signals: false`, so
105
+ // matter.js's ProcessManager is not racing us for these signals.
106
+ let pending = "protocol WS close";
107
+ const escapeHatch = setTimeout(() => {
108
+ log(`Shutdown stalled at: ${pending}; forcing exit`);
109
+ process.exit(1);
110
+ }, SHUTDOWN_ESCAPE_MS);
111
+ escapeHatch.unref();
112
+ void (async () => {
113
+ // Separate try blocks: a failing WS close must not skip the Matter
114
+ // close, which is what releases the storage lock.
115
+ try {
116
+ await ws.close();
117
+ }
118
+ catch (error) {
119
+ log(`Error closing protocol WS: ${describeErrorWithStack(error)}`);
120
+ }
121
+ pending = "Matter node close";
122
+ try {
123
+ await bridge.close();
124
+ }
125
+ catch (error) {
126
+ log(`Error closing Matter node: ${describeErrorWithStack(error)}`);
127
+ }
128
+ clearTimeout(escapeHatch);
129
+ log("Shutdown complete");
130
+ // Both closes returned, in order, so everything that is ours is
131
+ // down — and what is left on the loop is not ours to wait for.
132
+ // matter.js 0.17.8's `ServerNode.erase()` (§3.10) leaves a ref'd
133
+ // timer behind that `close()` does not clear, measured at 0.17.8:
134
+ // without this, a perfectly clean shutdown *after a factory reset*
135
+ // would sit until the escape hatch fired and then exit 1, telling
136
+ // launchd a successful stop was a crash. Exit 0 here; the escape
137
+ // hatch still owns every path where a close does NOT return.
138
+ process.exit(0);
139
+ })();
140
+ };
141
+ process.on("SIGTERM", () => shutdown("SIGTERM"));
142
+ process.on("SIGINT", () => shutdown("SIGINT"));
143
+ }
144
+ // A crash must reach the launchd-captured stdout log with its stack, then exit
145
+ // non-zero so launchd restarts us. Silent survival on a broken invariant is the
146
+ // worse outcome: the plugin would see a live socket and a dead bridge.
147
+ process.on("uncaughtException", (error) => {
148
+ log(`Uncaught exception: ${describeErrorWithStack(error)}`);
149
+ process.exit(1);
150
+ });
151
+ process.on("unhandledRejection", (reason) => {
152
+ log(`Unhandled rejection: ${describeErrorWithStack(reason)}`);
153
+ process.exit(1);
154
+ });
155
+ main().catch((error) => {
156
+ log(`Fatal: ${describeErrorWithStack(error)}`);
157
+ // Secondary copy on stderr, for the case where stdout is the thing that broke.
158
+ console.error(`[bridge] fatal: ${describeErrorWithStack(error)}`);
159
+ process.exit(1);
160
+ });
161
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,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B,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC5B,GAAG,CAAC,UAAU,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/C,+EAA+E;IAC/E,OAAO,CAAC,KAAK,CAAC,mBAAmB,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,321 @@
1
+ /**
2
+ * The Matter side of the bridge: a ServerNode with an Aggregator at endpoint 1
3
+ * and one bridged child endpoint per exported Indigo device.
4
+ *
5
+ * The child set is entirely protocol-driven (§3.1-§3.3) and lives in
6
+ * {@link EndpointRegistry}; a node that has never been attached to serves an
7
+ * empty aggregator. Endpoint *numbers* are persisted by matter.js against
8
+ * `Endpoint.id`, so a device that comes back with the same id comes back with
9
+ * the same number — presence in the running set is not what preserves identity.
10
+ *
11
+ * All matter.js coupling lives here, in `endpoints.ts`/`registry.ts` and in
12
+ * main.ts — ADR-0006's binding constraint keeps it out of the Indigo plugin
13
+ * entirely, and this module keeps it out of the protocol layer so the protocol
14
+ * is testable on its own.
15
+ */
16
+ import { ServerNode, version as matterJsVersion } from "@matter/main";
17
+ import type { BridgeConfig } from "./config.js";
18
+ import { type BridgeFacade, type CommandEventData, type CommissioningWindowResult, type DriftEntry, type EndpointSpec, type FabricInfo, type PairingReport, type RemoveFabricResult, type RemoveResult, type StatusReport, type UpsertResult, type WindowClosedReason } from "./protocol.js";
19
+ import { type BridgeIdentity } from "./storage.js";
20
+ /** Test vendor id. Uncertified by design — see ADR-0006 "Attestation cuts both ways". */
21
+ export declare const VENDOR_ID = 65521;
22
+ export declare const PRODUCT_ID = 32768;
23
+ export declare const VENDOR_NAME = "simons-plugins";
24
+ export declare const PRODUCT_NAME = "Indigo Matter Bridge";
25
+ /** A bridge has no hardware. Constant rather than invented, but present rather
26
+ * than absent: ecosystems render the attribute, and an absent one reads blank. */
27
+ export declare const HARDWARE_VERSION = 1;
28
+ export declare const HARDWARE_VERSION_STRING = "1";
29
+ /** PRD §5.3: no hard cap, but past this many exports the log says so. */
30
+ export declare const ENDPOINT_COUNT_WARNING = 100;
31
+ export { matterJsVersion };
32
+ export declare class BridgeNode implements BridgeFacade {
33
+ #private;
34
+ private readonly config;
35
+ private readonly bridgeVersion;
36
+ private readonly log;
37
+ /**
38
+ * @param initialRefusal a refuse-to-start reason decided before the node was
39
+ * built — today only `main.ts`'s unusable-`identity.json` check, which has
40
+ * to happen before the identity is loaded (and therefore before this
41
+ * object can exist) because loading it is what would overwrite it.
42
+ */
43
+ constructor(config: BridgeConfig, identity: BridgeIdentity, bridgeVersion: string, log?: (message: string) => void, initialRefusal?: string);
44
+ /** The identity in force — rebound whenever its commissioning witness moves. */
45
+ private get identity();
46
+ /** Matter wants an integer software version; derive it from the npm semver. */
47
+ private get softwareVersion();
48
+ /**
49
+ * The identity every bridged child publishes on its Bridged Device Basic
50
+ * Information. Derived here, from the same constants and the same
51
+ * `softwareVersion` the root node uses, so the two can never drift.
52
+ */
53
+ private get bridgedIdentity();
54
+ /**
55
+ * Build the node and bring it online. The aggregator is added first so it
56
+ * takes endpoint 1; bridged children land at 2 and up, in the order the
57
+ * first `attach` creates them (and thereafter at whatever number matter.js
58
+ * has persisted against their id).
59
+ */
60
+ start(): Promise<void>;
61
+ /**
62
+ * The PRD §7 refuse-to-start decision, taken once the stack is up and the
63
+ * fabric table is readable.
64
+ *
65
+ * Three conditions, and the asymmetry between them is the whole design.
66
+ * Endpoint numbers only matter to somebody who is *paired*: on a bridge
67
+ * nothing has ever commissioned, a missing or unreadable map costs nothing,
68
+ * so a fresh install must never be blocked by one. Once a fabric exists,
69
+ * both directions of the loss are fatal to identity and neither may be
70
+ * papered over —
71
+ *
72
+ * * fabrics but no usable map: the numbers being served cannot be checked
73
+ * against anything, so a silent re-record would bless whatever matter.js
74
+ * happens to be handing out this boot;
75
+ * * the commissioning witness but no fabrics (PRD §7's "storage missing but
76
+ * previously commissioned"): matter.js's storage has gone, which means its
77
+ * own `Endpoint.id → number` allocation went with it, and every accessory
78
+ * is about to be re-created in every ecosystem the user paired.
79
+ *
80
+ * Refusing is *not* a process exit. The Matter stack stays up so `get_pairing`
81
+ * still answers and the user can see the state, but `attach` is refused, so
82
+ * no endpoint is ever created — which is what actually prevents the
83
+ * duplication. §3.11 is the way out, and it is explicit because it is a
84
+ * decision only the user can take.
85
+ */
86
+ private assertEndpointIdentity;
87
+ /**
88
+ * A commissioned bridge with no `endpoint-map.json` at all: adopt the
89
+ * numbers matter.js has already been persisting, and serve.
90
+ *
91
+ * This is the upgrade path, and it is the common case rather than an edge
92
+ * one — **every** bridge commissioned before E5 shipped has fabrics,
93
+ * endpoints and no map, because the file did not exist. The first cut of E5
94
+ * refused there, which would have stopped serving every already-paired
95
+ * accessory the moment the node was updated.
96
+ *
97
+ * Seeding is legitimate precisely because our map does not allocate
98
+ * anything: matter.js keys the real numbers on `Endpoint.id` in its own
99
+ * store, this file is the independent witness, and writing down numbers
100
+ * that are already true is not blessing anything — the number a
101
+ * not-yet-created endpoint will get is already determined. That is the
102
+ * difference from a **rebuild**, which discards a baseline that disagreed.
103
+ *
104
+ * The baseline starts empty and is filled by the first attach's `check`
105
+ * from the live set. Those live numbers ARE matter.js's persisted ones —
106
+ * it restores each `Endpoint.id`'s number from its own store as the
107
+ * endpoint is created — so the witness this records is the pre-upgrade
108
+ * truth, not a fresh allocation.
109
+ *
110
+ * An earlier cut read matter.js's store directly here, to also cover
111
+ * endpoints it knows about but this attach does not export. It was deleted
112
+ * after verification against a real pre-E5 storage directory: the chain
113
+ * (`root`→`parts`→`aggregator`→`parts`, `contexts()`) enumerates only
114
+ * subcontexts already materialised in memory, and at bootstrap time none
115
+ * are, so it returned an empty list while reporting that it had adopted
116
+ * numbers — a false success in a migration path. The numbers live in flat
117
+ * on-disk keys whose layout is matter.js-internal. Not worth re-deriving:
118
+ * a not-yet-exported endpoint's number is decided by `Endpoint.id`
119
+ * whenever it IS created, so an entry for it buys nothing.
120
+ */
121
+ private bootstrapEndpointMap;
122
+ private refuse;
123
+ /** §1.1 — the reason we are refusing, or `undefined` while serving. */
124
+ endpointMapRefusal(): string | undefined;
125
+ /**
126
+ * Stamp `commissionedAt` the first time a fabric is seen.
127
+ *
128
+ * Written on the *observation* rather than on the commissioning command,
129
+ * because the thing being witnessed is "endpoint numbers now matter to
130
+ * somebody", and that is true of a fabric restored from a backup exactly as
131
+ * it is of one just paired.
132
+ */
133
+ private noteCommissioningWitness;
134
+ /**
135
+ * Adopt a {@link WitnessWrite}'s identity and record (or clear) its warning.
136
+ *
137
+ * The whole point of B1: these writes used to return only the identity, so
138
+ * a caller could not tell a witness that reached disk from one that did not
139
+ * — and both `factory_reset` and the drift baseline report success in a
140
+ * voice that assumes it did.
141
+ */
142
+ private applyWitness;
143
+ /**
144
+ * §5 `fabrics_changed` / `commissioned` / `decommissioned`.
145
+ *
146
+ * One place, because the three are one fact seen at three grains and
147
+ * deriving them separately is how they drift apart. `change` is `undefined`
148
+ * for the callers that only want the transition re-checked — §3.9's last
149
+ * leave and §3.10's erase both move the count without necessarily producing
150
+ * an observable we saw.
151
+ *
152
+ * Never throws: it is called from inside matter.js's own observable and
153
+ * from teardown paths where `fabrics()` legitimately fails.
154
+ */
155
+ private noteFabrics;
156
+ /**
157
+ * The fabric set has just emptied — which means matter.js has already
158
+ * factory-reset itself, whoever caused it.
159
+ *
160
+ * `CommissioningServer` watches `commissioned` and calls `doFactoryReset()`
161
+ * → `erase()` when the last fabric leaves. Our commissioning witness knows
162
+ * nothing about that, so leaving it set makes the very NEXT start see
163
+ * "witness says paired, stack says no fabrics" — the `fabricStorageLost`
164
+ * signature — and refuse to serve anything, telling the user their Matter
165
+ * storage was lost when in fact they deliberately unpaired their last
166
+ * ecosystem.
167
+ *
168
+ * Deliberately here rather than in {@link removeFabric}: §3.9 is only one of
169
+ * the ways to get here. An ecosystem that removes *us* from its side does it
170
+ * too, and that route never touches our command handler at all.
171
+ */
172
+ private noteLastFabricGone;
173
+ /** Print the pairing codes the way an operator (and the plugin log) needs them. */
174
+ logPairing(): void;
175
+ get server(): ServerNode;
176
+ private fabrics;
177
+ private get registry();
178
+ getStatus(): StatusReport;
179
+ /**
180
+ * Compare the live endpoint numbers against the persisted map (PRD §4.3).
181
+ *
182
+ * Run at the end of every operation that can create an endpoint, which is
183
+ * where a number can first be wrong. Report-only by contract: a mismatch
184
+ * populates `StatusReport.drift`, emits §5 `drift_detected` and changes
185
+ * nothing — the map keeps its baseline so the fault keeps being reported
186
+ * rather than being blessed into the truth on the next pass.
187
+ */
188
+ private checkDrift;
189
+ /** §3.1 — reconcile the live endpoint set, then answer with the new status. */
190
+ reconcile(endpoints: readonly EndpointSpec[], replaceAll: boolean): Promise<StatusReport>;
191
+ /** §3.2 */
192
+ upsertEndpoint(spec: EndpointSpec): Promise<UpsertResult>;
193
+ /**
194
+ * §3.3
195
+ *
196
+ * The drift check runs here too, even though a removal creates nothing.
197
+ * matter.js re-allocates while endpoints come and go, and a removal is one
198
+ * of the moments a *surviving* endpoint's number could differ from what the
199
+ * map says — leaving the one operation that reshapes the live set as the
200
+ * only one that never looked would have made that invisible until the next
201
+ * upsert happened to notice.
202
+ */
203
+ removeEndpoint(indigoDeviceId: number): Promise<RemoveResult>;
204
+ /** §3.4 */
205
+ setState(indigoDeviceId: number, states: Record<string, unknown>): Promise<void>;
206
+ /** §3.5 */
207
+ setReachable(indigoDeviceId: number, reachable: boolean): Promise<void>;
208
+ /**
209
+ * PRD §5.3 / Matter 1.5: a changed bridged-node set is a configuration
210
+ * change of the bridge. Bumping the root's `ConfigurationVersion` also
211
+ * covers the children — matter.js's own
212
+ * `BridgedDeviceBasicInformationServer.increaseConfigurationVersion`
213
+ * increments the root as well, so doing it once per batch is both cheaper
214
+ * and truer to "one logical change, one increment".
215
+ */
216
+ private bumpConfigurationVersion;
217
+ /** §5: the sink for `window_closed`, wired up by the protocol server. */
218
+ onWindowClosed(listener: (reason: WindowClosedReason) => void): void;
219
+ /** §5: the sink for `command`. One listener, last registration wins. */
220
+ onCommand(listener: (data: CommandEventData) => void): void;
221
+ /** §5: the sink for `drift_detected`. */
222
+ onDriftDetected(listener: (drift: DriftEntry[]) => void): void;
223
+ /** §5: the sink for `fabrics_changed`. */
224
+ onFabricsChanged(listener: (fabrics: FabricInfo[], change: string) => void): void;
225
+ /** §5: the sink for `commissioned`. */
226
+ onCommissioned(listener: () => void): void;
227
+ /** §5: the sink for `decommissioned`. */
228
+ onDecommissioned(listener: () => void): void;
229
+ /**
230
+ * §3.9 — drop one ecosystem's fabric.
231
+ *
232
+ * Driven through `FabricManager` rather than the `OperationalCredentials`
233
+ * cluster command for the same reason §3.8 avoids `AdministratorCommissioning`:
234
+ * `OperationalCredentialsServer.removeFabric` opens with `assertRemoteActor`,
235
+ * so it cannot be invoked from an offline agent at all.
236
+ *
237
+ * An index with no fabric behind it succeeds — but it succeeds as
238
+ * `{removed: false}`, and that distinction is the whole reason this returns
239
+ * anything. The plugin picks an index out of a `get_pairing` readout that is
240
+ * by definition a moment old, and the way it goes stale is the ecosystem
241
+ * unpairing itself, so "it is already gone" is the request being granted,
242
+ * not refused. Answering `{}` for both made the plugin tell the user "that
243
+ * ecosystem has been unpaired, every accessory has been removed" over a
244
+ * no-op — and, because the early return also skipped {@link noteFabrics},
245
+ * no `fabrics_changed` followed and the ghost row stayed in the plugin's
246
+ * cached list (which is what its picker is built from) forever. Both halves
247
+ * are fixed here: the outcome is reported, and the fabric set is
248
+ * re-published either way so a stale cache is corrected by the very request
249
+ * that tripped over it.
250
+ *
251
+ * **Removing the LAST fabric is a factory reset that we did not perform.**
252
+ * matter.js's `CommissioningServer` watches `commissioned` and, when the
253
+ * final fabric leaves, calls `doFactoryReset()` → `erase()` on its own. Our
254
+ * commissioning witness knows nothing about that, so leaving it set made
255
+ * the very next start see "witness says paired, no fabrics" — the
256
+ * `fabricStorageLost` signature — and refuse to serve anything, telling the
257
+ * user their Matter storage had been lost when in fact they had just
258
+ * unpaired their last ecosystem on purpose. {@link noteLastFabricGone}
259
+ * handles it, from {@link noteFabrics}, so the route where an ecosystem
260
+ * unpairs *us* is covered too.
261
+ */
262
+ removeFabric(fabricIndex: number): Promise<RemoveFabricResult>;
263
+ /** The fabric count, or `null` if server state cannot be read right now. */
264
+ private fabricCountOrNull;
265
+ /**
266
+ * §3.10 — wipe commissioning credentials and start advertising fresh.
267
+ *
268
+ * `ServerNode.erase()` is matter.js 0.17.8's factory reset: it takes the node
269
+ * offline, clears sessions, fabrics, events and the node's storage, then
270
+ * brings it back up if it was up — so re-advertising is not something we
271
+ * have to arrange.
272
+ *
273
+ * The endpoint map is **preserved by default**, which is the whole reason it
274
+ * lives outside the storage context `erase()` wipes: a user who resets to
275
+ * re-pair the same ecosystems should not have their accessory identities
276
+ * scrambled as a side effect. `preserveEndpointNumbers: false` is the
277
+ * explicit "the map itself is what is corrupt" path (PRD §7).
278
+ *
279
+ * The commissioning witness is cleared either way. Leaving it set would make
280
+ * the very next start refuse: witness says paired, `erase()` says no
281
+ * fabrics, which is exactly the fabric-storage-lost signature — and it would
282
+ * be the reset doing it to itself.
283
+ *
284
+ * The live endpoints are deliberately left alone. They are still the set the
285
+ * plugin asked for; what changed is who is allowed to see them.
286
+ */
287
+ factoryReset(preserveEndpointNumbers: boolean): Promise<void>;
288
+ /**
289
+ * §3.11 — adopt the live endpoint numbers as the new persisted map.
290
+ *
291
+ * The way out of the refuse-to-start state, and the only operation that
292
+ * discards a baseline. It renumbers nothing: by the time a user is asked to
293
+ * confirm this, whatever duplication a lost map implies has already happened
294
+ * in the ecosystems. What the rebuild changes is that the node stops
295
+ * refusing and starts telling the truth about the numbers that now exist.
296
+ *
297
+ * When the refusal was `fabricStorageLost` the witness is cleared too —
298
+ * confirming the rebuild is the user accepting that those pairings are gone,
299
+ * and leaving the witness set would refuse again on the next start for a
300
+ * loss they have already acknowledged.
301
+ */
302
+ rebuildEndpointMap(): Promise<StatusReport>;
303
+ getPairing(): PairingReport;
304
+ /**
305
+ * Open an enhanced commissioning window so a further ecosystem can pair.
306
+ * The passcode is ephemeral: matter.js holds only the PAKE verifier, so we
307
+ * derive and keep the display codes ourselves for the window's lifetime.
308
+ *
309
+ * This drives `DeviceCommissioner` rather than the `AdministratorCommissioning`
310
+ * cluster command, because in matter.js 0.17.8 that command asserts a remote
311
+ * authenticated session (it records the requesting fabric in
312
+ * `adminFabricIndex`) and therefore cannot be invoked from an offline agent.
313
+ * The consequence is that the cluster's `windowStatus`/`adminFabricIndex`
314
+ * attributes do not reflect a locally-opened window — a conformance gap for
315
+ * E7 to close, not something the pairing flow depends on.
316
+ */
317
+ openCommissioningWindow(durationSeconds: number): Promise<CommissioningWindowResult>;
318
+ /** End the Matter-side window after ours expired. Never throws. */
319
+ private endMatterCommissioning;
320
+ close(): Promise<void>;
321
+ }