@camstack/addon-matter-broker 0.2.100 → 0.2.101
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.js +188 -8
- package/dist/addon.mjs +188 -8
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -13,7 +13,7 @@ let node_stream_promises = require("node:stream/promises");
|
|
|
13
13
|
let node_net = require("node:net");
|
|
14
14
|
let node_dgram = require("node:dgram");
|
|
15
15
|
node_dgram = require_esm.__toESM(node_dgram, 1);
|
|
16
|
-
//#region ../types/dist/event-category-
|
|
16
|
+
//#region ../types/dist/event-category-BVDXG4tB.mjs
|
|
17
17
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
18
18
|
EventCategory["SystemBoot"] = "system.boot";
|
|
19
19
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -630,6 +630,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
630
630
|
* pull-reconcile from the provider's `getStatus` on reconnect. */
|
|
631
631
|
EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
|
|
632
632
|
EventCategory["BackupCompleted"] = "backup.completed";
|
|
633
|
+
/**
|
|
634
|
+
* A whole backup RUN finished — every destination attempted, win or lose.
|
|
635
|
+
*
|
|
636
|
+
* `backup.completed` fires once per DESTINATION, which is the right grain for
|
|
637
|
+
* a progress UI and the wrong one for a notification: an operator with three
|
|
638
|
+
* destinations would be told three times. And a run where two of three
|
|
639
|
+
* destinations succeeded is not a clean success — a single "backup
|
|
640
|
+
* completed" that hid the failed one would be a lie, so the count of each is
|
|
641
|
+
* carried here and the message says both.
|
|
642
|
+
*
|
|
643
|
+
* Emitted by the backup orchestrator only after the destination loop, so a
|
|
644
|
+
* run that dies during the BUILD phase produces no completion at all.
|
|
645
|
+
*/
|
|
646
|
+
EventCategory["BackupRunCompleted"] = "backup.run-completed";
|
|
633
647
|
EventCategory["BackupRestored"] = "backup.restored";
|
|
634
648
|
EventCategory["NotificationDispatched"] = "notification.dispatched";
|
|
635
649
|
EventCategory["NotificationFailed"] = "notification.failed";
|
|
@@ -5360,7 +5374,7 @@ var ZodIssueCode = {
|
|
|
5360
5374
|
var ZodFirstPartyTypeKind;
|
|
5361
5375
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5362
5376
|
//#endregion
|
|
5363
|
-
//#region ../types/dist/sleep-
|
|
5377
|
+
//#region ../types/dist/sleep-DEuj7E3j.mjs
|
|
5364
5378
|
/**
|
|
5365
5379
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5366
5380
|
* window to float samples (D455).
|
|
@@ -11553,6 +11567,72 @@ var brokerCapability = {
|
|
|
11553
11567
|
}
|
|
11554
11568
|
};
|
|
11555
11569
|
DeviceType.Camera;
|
|
11570
|
+
/**
|
|
11571
|
+
* The signals a device can emit to WAKE its own stream.
|
|
11572
|
+
*
|
|
11573
|
+
* A camera whose stream is built on demand sleeps until something asks for it,
|
|
11574
|
+
* and "something" cannot be a consumer that is merely attached — a Frigate-style
|
|
11575
|
+
* puller holds a session open for ever, and treating that as demand would keep
|
|
11576
|
+
* a battery camera awake for ever, which is the whole thing the battery is for
|
|
11577
|
+
* (D173). So the wake has to come from the CAMERA: an event it noticed by
|
|
11578
|
+
* itself, with no stream running.
|
|
11579
|
+
*
|
|
11580
|
+
* ## The vocabulary is the PROVIDER'S, not ours
|
|
11581
|
+
*
|
|
11582
|
+
* Like `consumables`, this cap declares no vocabulary of its own. A provider
|
|
11583
|
+
* names each signal with a `code` it chooses and a `label` an operator reads.
|
|
11584
|
+
* Reolink offers motion and camera-native detection; another provider may offer
|
|
11585
|
+
* a tamper, a doorbell press, a PIR, or something no camera in this fleet has
|
|
11586
|
+
* yet. A fixed enum here would mean every new signal is a framework release.
|
|
11587
|
+
*
|
|
11588
|
+
* It is deliberately NOT derived from the caps a device already binds. Whether
|
|
11589
|
+
* a camera CAN push firmware motion is expressed by `motionSources` containing
|
|
11590
|
+
* `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
|
|
11591
|
+
* binding — but both answer "what drives the detection pipeline", which is a
|
|
11592
|
+
* different question from "what may wake a sleeping stream". A camera can do
|
|
11593
|
+
* the first and not be trusted with the second, and the operator picks per
|
|
11594
|
+
* camera. Two questions, two authorities.
|
|
11595
|
+
*
|
|
11596
|
+
* ## Availability is not permission
|
|
11597
|
+
*
|
|
11598
|
+
* `listSignals` says what the device CAN emit. Whether a given signal actually
|
|
11599
|
+
* wakes the stream is the operator's per-camera choice, held by the broker
|
|
11600
|
+
* alongside the cooldown — see the stream-broker cap's wake settings. A
|
|
11601
|
+
* provider declaring a signal is not a provider enabling it.
|
|
11602
|
+
*/
|
|
11603
|
+
/** One signal a device can emit. */
|
|
11604
|
+
var StreamSignalSchema = object({
|
|
11605
|
+
/** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
|
|
11606
|
+
code: string$2().min(1),
|
|
11607
|
+
/** What an operator reads in the picker. The provider's own wording. */
|
|
11608
|
+
label: string$2().min(1),
|
|
11609
|
+
/**
|
|
11610
|
+
* Whether the provider recommends this signal ON when a camera is first set
|
|
11611
|
+
* up. A provider knows which of its signals are cheap and reliable; an
|
|
11612
|
+
* operator should not have to discover that by trial. Reolink recommends
|
|
11613
|
+
* both of its own.
|
|
11614
|
+
*/
|
|
11615
|
+
recommended: boolean()
|
|
11616
|
+
});
|
|
11617
|
+
var StreamSignalsStatusSchema = object({
|
|
11618
|
+
signals: array(StreamSignalSchema),
|
|
11619
|
+
lastFetchedAt: number()
|
|
11620
|
+
});
|
|
11621
|
+
var streamSignalsCapability = {
|
|
11622
|
+
name: "stream-signals",
|
|
11623
|
+
scope: "device",
|
|
11624
|
+
deviceNative: true,
|
|
11625
|
+
mode: "singleton",
|
|
11626
|
+
deviceTypes: Object.values(DeviceType),
|
|
11627
|
+
runtimeState: StreamSignalsStatusSchema,
|
|
11628
|
+
methods: {
|
|
11629
|
+
/**
|
|
11630
|
+
* What this device can emit. Empty is a valid and common answer — most
|
|
11631
|
+
* cameras have nothing to offer here, and an empty list is what makes the
|
|
11632
|
+
* broker's picker show nothing rather than a false choice.
|
|
11633
|
+
*/
|
|
11634
|
+
listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
|
|
11635
|
+
};
|
|
11556
11636
|
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
11557
11637
|
var StreamFormatSchema = _enum([
|
|
11558
11638
|
"webrtc",
|
|
@@ -11949,6 +12029,22 @@ var EgressTranscodeSchema = object({
|
|
|
11949
12029
|
camStreamId: string$2().nullable()
|
|
11950
12030
|
});
|
|
11951
12031
|
method(object({
|
|
12032
|
+
deviceId: number().int().nonnegative(),
|
|
12033
|
+
/** The provider's signal code. */
|
|
12034
|
+
code: string$2().min(1),
|
|
12035
|
+
/** Ms epoch. Absent ⇒ now. */
|
|
12036
|
+
at: number().optional()
|
|
12037
|
+
}), object({
|
|
12038
|
+
/** Whether the broker acted on it, and if not, why. */
|
|
12039
|
+
accepted: boolean(),
|
|
12040
|
+
reason: _enum([
|
|
12041
|
+
"woke",
|
|
12042
|
+
"hold-extended",
|
|
12043
|
+
"not-enabled",
|
|
12044
|
+
"no-consumer",
|
|
12045
|
+
"unknown-code"
|
|
12046
|
+
])
|
|
12047
|
+
}), { kind: "mutation" }), method(object({
|
|
11952
12048
|
deviceId: number().int().nonnegative(),
|
|
11953
12049
|
camStreamId: string$2().min(1),
|
|
11954
12050
|
kind: CamStreamKindSchema,
|
|
@@ -12203,6 +12299,16 @@ var PickStreamRequirementsSchema = object({
|
|
|
12203
12299
|
acceptCodecs: array(StreamCodecSchema).readonly().optional(),
|
|
12204
12300
|
/** Minimum vertical resolution. Streams shorter than this are dropped. */
|
|
12205
12301
|
minHeight: number().int().positive().optional(),
|
|
12302
|
+
/**
|
|
12303
|
+
* Maximum vertical resolution. Streams TALLER than this are dropped.
|
|
12304
|
+
*
|
|
12305
|
+
* A consumer can have a ceiling as real as its floor: Alexa documents
|
|
12306
|
+
* 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
|
|
12307
|
+
* Without this the ceiling had to be re-implemented by every caller — and
|
|
12308
|
+
* one caller implementing it privately is how a second scoring authority
|
|
12309
|
+
* gets born.
|
|
12310
|
+
*/
|
|
12311
|
+
maxHeight: number().int().positive().optional(),
|
|
12206
12312
|
/** Minimum horizontal resolution. */
|
|
12207
12313
|
minWidth: number().int().positive().optional(),
|
|
12208
12314
|
/**
|
|
@@ -12219,7 +12325,22 @@ var PickStreamRequirementsSchema = object({
|
|
|
12219
12325
|
* transcoded" guard: if the device is already serving the consumer's
|
|
12220
12326
|
* codec end-to-end, there's nothing to optimise.
|
|
12221
12327
|
*/
|
|
12222
|
-
requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
|
|
12328
|
+
requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
|
|
12329
|
+
/**
|
|
12330
|
+
* Whether a stream the consumer CANNOT decode may still be picked, on the
|
|
12331
|
+
* understanding that it will be transcoded.
|
|
12332
|
+
*
|
|
12333
|
+
* Default `false` — today's behaviour, and the right one for a bypass
|
|
12334
|
+
* question ("is there a stream I can forward untouched?"). Set `true` to
|
|
12335
|
+
* ask the larger question: "what is the best stream for me, transcoding if
|
|
12336
|
+
* I must?" A stream that satisfies `acceptCodecs` always outranks one that
|
|
12337
|
+
* does not, so a passthrough is never lost to a transcode; the answer says
|
|
12338
|
+
* which it is in {@link PickedCamStreamSchema.transcodes}.
|
|
12339
|
+
*
|
|
12340
|
+
* This is what lets one picker serve both the bypass and the full source
|
|
12341
|
+
* choice, instead of a consumer scoring privately when the bypass misses.
|
|
12342
|
+
*/
|
|
12343
|
+
allowTranscode: boolean().optional()
|
|
12223
12344
|
}).readonly();
|
|
12224
12345
|
var PickStreamPreferencesSchema = object({
|
|
12225
12346
|
/**
|
|
@@ -12233,12 +12354,32 @@ var PickStreamPreferencesSchema = object({
|
|
|
12233
12354
|
* picks the tallest stream; `'lowest'` picks the shortest (used by
|
|
12234
12355
|
* memory-constrained consumers / Apple Home guest sessions).
|
|
12235
12356
|
*/
|
|
12236
|
-
resolutionPreference: _enum(["highest", "lowest"]).optional()
|
|
12357
|
+
resolutionPreference: _enum(["highest", "lowest"]).optional(),
|
|
12358
|
+
/**
|
|
12359
|
+
* The height the consumer actually wants to DELIVER.
|
|
12360
|
+
*
|
|
12361
|
+
* Not a constraint — an ordering. With it set, the SMALLEST stream at or
|
|
12362
|
+
* above the target wins, and only if nothing reaches it does the tallest
|
|
12363
|
+
* take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
|
|
12364
|
+
* a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
|
|
12365
|
+
* express that: it says "as big as possible", which is a different wish.
|
|
12366
|
+
*
|
|
12367
|
+
* Ignored when absent, so every existing caller keeps its ordering.
|
|
12368
|
+
*/
|
|
12369
|
+
targetHeight: number().int().positive().optional()
|
|
12237
12370
|
}).readonly();
|
|
12238
12371
|
var PickedCamStreamSchema = object({
|
|
12239
12372
|
camStreamId: string$2(),
|
|
12240
12373
|
codec: string$2().optional(),
|
|
12241
12374
|
resolution: CamStreamResolutionSchema.optional(),
|
|
12375
|
+
/**
|
|
12376
|
+
* Whether serving this stream requires a decode + re-encode.
|
|
12377
|
+
*
|
|
12378
|
+
* `false` is a stream the consumer can take as it stands. Only ever `true`
|
|
12379
|
+
* when the caller asked for it with `allowTranscode`, so a caller that did
|
|
12380
|
+
* not ask cannot be handed a cost it never agreed to pay.
|
|
12381
|
+
*/
|
|
12382
|
+
transcodes: boolean(),
|
|
12242
12383
|
/** One-line explanation of why this stream won — for logs / debug UI. */
|
|
12243
12384
|
reason: string$2()
|
|
12244
12385
|
});
|
|
@@ -16772,6 +16913,8 @@ var NcSystemEventKindSchema = _enum([
|
|
|
16772
16913
|
"device-enabled",
|
|
16773
16914
|
"device-battery-low",
|
|
16774
16915
|
"device-battery-normal",
|
|
16916
|
+
"device-consumable-low",
|
|
16917
|
+
"device-consumable-normal",
|
|
16775
16918
|
"stream-online",
|
|
16776
16919
|
"stream-offline",
|
|
16777
16920
|
"node-online",
|
|
@@ -16790,6 +16933,7 @@ var NcSystemEventKindSchema = _enum([
|
|
|
16790
16933
|
"addon-updated",
|
|
16791
16934
|
"server-updated",
|
|
16792
16935
|
"export-completed",
|
|
16936
|
+
"backup-completed",
|
|
16793
16937
|
"camera-online",
|
|
16794
16938
|
"camera-offline",
|
|
16795
16939
|
"camera-disabled",
|
|
@@ -24071,10 +24215,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
24071
24215
|
}), boolean()), method(object({
|
|
24072
24216
|
deviceId: number().int().nonnegative(),
|
|
24073
24217
|
sessionId: string$2()
|
|
24074
|
-
}), object({
|
|
24075
|
-
|
|
24076
|
-
|
|
24077
|
-
|
|
24218
|
+
}), object({
|
|
24219
|
+
pendingRenegotiation: object({
|
|
24220
|
+
target: WebrtcStreamTargetSchema,
|
|
24221
|
+
epoch: number()
|
|
24222
|
+
}).nullable(),
|
|
24223
|
+
/**
|
|
24224
|
+
* Whether the session still EXISTS.
|
|
24225
|
+
*
|
|
24226
|
+
* A consumer that holds a resource for the life of a session needs to
|
|
24227
|
+
* be able to ask, because a session does not always end the way it
|
|
24228
|
+
* began. Measured on this hub 2026-09-13: an Echo that got stuck never
|
|
24229
|
+
* sent `SessionDisconnected`, so the Alexa exporter's
|
|
24230
|
+
* `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
|
|
24231
|
+
* H.264 transcode kept running for NOBODY for more than twenty
|
|
24232
|
+
* minutes. The WebRTC session had logged `WebRTC session closed`
|
|
24233
|
+
* minutes earlier — the broker knew; the holder had no way to ask.
|
|
24234
|
+
*
|
|
24235
|
+
* `false` for a session id the provider has never heard of, which is
|
|
24236
|
+
* the same answer as "it ended": either way nothing is holding it up.
|
|
24237
|
+
*/
|
|
24238
|
+
alive: boolean()
|
|
24239
|
+
}));
|
|
24078
24240
|
object({
|
|
24079
24241
|
/** All accessory children of the parent. */
|
|
24080
24242
|
childDeviceIds: array(number()).readonly(),
|
|
@@ -34010,6 +34172,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
34010
34172
|
smoke: smokeCapability,
|
|
34011
34173
|
streamCatalog: streamCatalogCapability,
|
|
34012
34174
|
streamParams: streamParamsCapability,
|
|
34175
|
+
streamSignals: streamSignalsCapability,
|
|
34013
34176
|
switch: switchCapability,
|
|
34014
34177
|
tamper: tamperCapability,
|
|
34015
34178
|
temperatureSensor: temperatureSensorCapability,
|
|
@@ -40583,6 +40746,12 @@ Object.freeze({
|
|
|
40583
40746
|
addonId: null,
|
|
40584
40747
|
access: "create"
|
|
40585
40748
|
},
|
|
40749
|
+
"streamBroker.reportStreamSignal": {
|
|
40750
|
+
capName: "stream-broker",
|
|
40751
|
+
capScope: "system",
|
|
40752
|
+
addonId: null,
|
|
40753
|
+
access: "create"
|
|
40754
|
+
},
|
|
40586
40755
|
"streamBroker.restartProfile": {
|
|
40587
40756
|
capName: "stream-broker",
|
|
40588
40757
|
capScope: "system",
|
|
@@ -40667,6 +40836,12 @@ Object.freeze({
|
|
|
40667
40836
|
addonId: null,
|
|
40668
40837
|
access: "create"
|
|
40669
40838
|
},
|
|
40839
|
+
"streamSignals.listSignals": {
|
|
40840
|
+
capName: "stream-signals",
|
|
40841
|
+
capScope: "device",
|
|
40842
|
+
addonId: null,
|
|
40843
|
+
access: "view"
|
|
40844
|
+
},
|
|
40670
40845
|
"switch.setState": {
|
|
40671
40846
|
capName: "switch",
|
|
40672
40847
|
capScope: "device",
|
|
@@ -43039,6 +43214,11 @@ Object.freeze({
|
|
|
43039
43214
|
form: "single",
|
|
43040
43215
|
optional: false
|
|
43041
43216
|
}],
|
|
43217
|
+
"streamBroker.reportStreamSignal": [{
|
|
43218
|
+
name: "deviceId",
|
|
43219
|
+
form: "single",
|
|
43220
|
+
optional: false
|
|
43221
|
+
}],
|
|
43042
43222
|
"streamBroker.restartProfile": [{
|
|
43043
43223
|
name: "deviceId",
|
|
43044
43224
|
form: "single",
|
package/dist/addon.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { networkInterfaces, tmpdir, uptime } from "node:os";
|
|
|
11
11
|
import { finished } from "node:stream/promises";
|
|
12
12
|
import { createConnection, createServer as createServer$2 } from "node:net";
|
|
13
13
|
import * as dgram from "node:dgram";
|
|
14
|
-
//#region ../types/dist/event-category-
|
|
14
|
+
//#region ../types/dist/event-category-BVDXG4tB.mjs
|
|
15
15
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
16
16
|
EventCategory["SystemBoot"] = "system.boot";
|
|
17
17
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -628,6 +628,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
628
628
|
* pull-reconcile from the provider's `getStatus` on reconnect. */
|
|
629
629
|
EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
|
|
630
630
|
EventCategory["BackupCompleted"] = "backup.completed";
|
|
631
|
+
/**
|
|
632
|
+
* A whole backup RUN finished — every destination attempted, win or lose.
|
|
633
|
+
*
|
|
634
|
+
* `backup.completed` fires once per DESTINATION, which is the right grain for
|
|
635
|
+
* a progress UI and the wrong one for a notification: an operator with three
|
|
636
|
+
* destinations would be told three times. And a run where two of three
|
|
637
|
+
* destinations succeeded is not a clean success — a single "backup
|
|
638
|
+
* completed" that hid the failed one would be a lie, so the count of each is
|
|
639
|
+
* carried here and the message says both.
|
|
640
|
+
*
|
|
641
|
+
* Emitted by the backup orchestrator only after the destination loop, so a
|
|
642
|
+
* run that dies during the BUILD phase produces no completion at all.
|
|
643
|
+
*/
|
|
644
|
+
EventCategory["BackupRunCompleted"] = "backup.run-completed";
|
|
631
645
|
EventCategory["BackupRestored"] = "backup.restored";
|
|
632
646
|
EventCategory["NotificationDispatched"] = "notification.dispatched";
|
|
633
647
|
EventCategory["NotificationFailed"] = "notification.failed";
|
|
@@ -5358,7 +5372,7 @@ var ZodIssueCode = {
|
|
|
5358
5372
|
var ZodFirstPartyTypeKind;
|
|
5359
5373
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5360
5374
|
//#endregion
|
|
5361
|
-
//#region ../types/dist/sleep-
|
|
5375
|
+
//#region ../types/dist/sleep-DEuj7E3j.mjs
|
|
5362
5376
|
/**
|
|
5363
5377
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5364
5378
|
* window to float samples (D455).
|
|
@@ -11551,6 +11565,72 @@ var brokerCapability = {
|
|
|
11551
11565
|
}
|
|
11552
11566
|
};
|
|
11553
11567
|
DeviceType.Camera;
|
|
11568
|
+
/**
|
|
11569
|
+
* The signals a device can emit to WAKE its own stream.
|
|
11570
|
+
*
|
|
11571
|
+
* A camera whose stream is built on demand sleeps until something asks for it,
|
|
11572
|
+
* and "something" cannot be a consumer that is merely attached — a Frigate-style
|
|
11573
|
+
* puller holds a session open for ever, and treating that as demand would keep
|
|
11574
|
+
* a battery camera awake for ever, which is the whole thing the battery is for
|
|
11575
|
+
* (D173). So the wake has to come from the CAMERA: an event it noticed by
|
|
11576
|
+
* itself, with no stream running.
|
|
11577
|
+
*
|
|
11578
|
+
* ## The vocabulary is the PROVIDER'S, not ours
|
|
11579
|
+
*
|
|
11580
|
+
* Like `consumables`, this cap declares no vocabulary of its own. A provider
|
|
11581
|
+
* names each signal with a `code` it chooses and a `label` an operator reads.
|
|
11582
|
+
* Reolink offers motion and camera-native detection; another provider may offer
|
|
11583
|
+
* a tamper, a doorbell press, a PIR, or something no camera in this fleet has
|
|
11584
|
+
* yet. A fixed enum here would mean every new signal is a framework release.
|
|
11585
|
+
*
|
|
11586
|
+
* It is deliberately NOT derived from the caps a device already binds. Whether
|
|
11587
|
+
* a camera CAN push firmware motion is expressed by `motionSources` containing
|
|
11588
|
+
* `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
|
|
11589
|
+
* binding — but both answer "what drives the detection pipeline", which is a
|
|
11590
|
+
* different question from "what may wake a sleeping stream". A camera can do
|
|
11591
|
+
* the first and not be trusted with the second, and the operator picks per
|
|
11592
|
+
* camera. Two questions, two authorities.
|
|
11593
|
+
*
|
|
11594
|
+
* ## Availability is not permission
|
|
11595
|
+
*
|
|
11596
|
+
* `listSignals` says what the device CAN emit. Whether a given signal actually
|
|
11597
|
+
* wakes the stream is the operator's per-camera choice, held by the broker
|
|
11598
|
+
* alongside the cooldown — see the stream-broker cap's wake settings. A
|
|
11599
|
+
* provider declaring a signal is not a provider enabling it.
|
|
11600
|
+
*/
|
|
11601
|
+
/** One signal a device can emit. */
|
|
11602
|
+
var StreamSignalSchema = object({
|
|
11603
|
+
/** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
|
|
11604
|
+
code: string$2().min(1),
|
|
11605
|
+
/** What an operator reads in the picker. The provider's own wording. */
|
|
11606
|
+
label: string$2().min(1),
|
|
11607
|
+
/**
|
|
11608
|
+
* Whether the provider recommends this signal ON when a camera is first set
|
|
11609
|
+
* up. A provider knows which of its signals are cheap and reliable; an
|
|
11610
|
+
* operator should not have to discover that by trial. Reolink recommends
|
|
11611
|
+
* both of its own.
|
|
11612
|
+
*/
|
|
11613
|
+
recommended: boolean()
|
|
11614
|
+
});
|
|
11615
|
+
var StreamSignalsStatusSchema = object({
|
|
11616
|
+
signals: array(StreamSignalSchema),
|
|
11617
|
+
lastFetchedAt: number()
|
|
11618
|
+
});
|
|
11619
|
+
var streamSignalsCapability = {
|
|
11620
|
+
name: "stream-signals",
|
|
11621
|
+
scope: "device",
|
|
11622
|
+
deviceNative: true,
|
|
11623
|
+
mode: "singleton",
|
|
11624
|
+
deviceTypes: Object.values(DeviceType),
|
|
11625
|
+
runtimeState: StreamSignalsStatusSchema,
|
|
11626
|
+
methods: {
|
|
11627
|
+
/**
|
|
11628
|
+
* What this device can emit. Empty is a valid and common answer — most
|
|
11629
|
+
* cameras have nothing to offer here, and an empty list is what makes the
|
|
11630
|
+
* broker's picker show nothing rather than a false choice.
|
|
11631
|
+
*/
|
|
11632
|
+
listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
|
|
11633
|
+
};
|
|
11554
11634
|
/** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
|
|
11555
11635
|
var StreamFormatSchema = _enum([
|
|
11556
11636
|
"webrtc",
|
|
@@ -11947,6 +12027,22 @@ var EgressTranscodeSchema = object({
|
|
|
11947
12027
|
camStreamId: string$2().nullable()
|
|
11948
12028
|
});
|
|
11949
12029
|
method(object({
|
|
12030
|
+
deviceId: number().int().nonnegative(),
|
|
12031
|
+
/** The provider's signal code. */
|
|
12032
|
+
code: string$2().min(1),
|
|
12033
|
+
/** Ms epoch. Absent ⇒ now. */
|
|
12034
|
+
at: number().optional()
|
|
12035
|
+
}), object({
|
|
12036
|
+
/** Whether the broker acted on it, and if not, why. */
|
|
12037
|
+
accepted: boolean(),
|
|
12038
|
+
reason: _enum([
|
|
12039
|
+
"woke",
|
|
12040
|
+
"hold-extended",
|
|
12041
|
+
"not-enabled",
|
|
12042
|
+
"no-consumer",
|
|
12043
|
+
"unknown-code"
|
|
12044
|
+
])
|
|
12045
|
+
}), { kind: "mutation" }), method(object({
|
|
11950
12046
|
deviceId: number().int().nonnegative(),
|
|
11951
12047
|
camStreamId: string$2().min(1),
|
|
11952
12048
|
kind: CamStreamKindSchema,
|
|
@@ -12201,6 +12297,16 @@ var PickStreamRequirementsSchema = object({
|
|
|
12201
12297
|
acceptCodecs: array(StreamCodecSchema).readonly().optional(),
|
|
12202
12298
|
/** Minimum vertical resolution. Streams shorter than this are dropped. */
|
|
12203
12299
|
minHeight: number().int().positive().optional(),
|
|
12300
|
+
/**
|
|
12301
|
+
* Maximum vertical resolution. Streams TALLER than this are dropped.
|
|
12302
|
+
*
|
|
12303
|
+
* A consumer can have a ceiling as real as its floor: Alexa documents
|
|
12304
|
+
* 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
|
|
12305
|
+
* Without this the ceiling had to be re-implemented by every caller — and
|
|
12306
|
+
* one caller implementing it privately is how a second scoring authority
|
|
12307
|
+
* gets born.
|
|
12308
|
+
*/
|
|
12309
|
+
maxHeight: number().int().positive().optional(),
|
|
12204
12310
|
/** Minimum horizontal resolution. */
|
|
12205
12311
|
minWidth: number().int().positive().optional(),
|
|
12206
12312
|
/**
|
|
@@ -12217,7 +12323,22 @@ var PickStreamRequirementsSchema = object({
|
|
|
12217
12323
|
* transcoded" guard: if the device is already serving the consumer's
|
|
12218
12324
|
* codec end-to-end, there's nothing to optimise.
|
|
12219
12325
|
*/
|
|
12220
|
-
requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
|
|
12326
|
+
requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
|
|
12327
|
+
/**
|
|
12328
|
+
* Whether a stream the consumer CANNOT decode may still be picked, on the
|
|
12329
|
+
* understanding that it will be transcoded.
|
|
12330
|
+
*
|
|
12331
|
+
* Default `false` — today's behaviour, and the right one for a bypass
|
|
12332
|
+
* question ("is there a stream I can forward untouched?"). Set `true` to
|
|
12333
|
+
* ask the larger question: "what is the best stream for me, transcoding if
|
|
12334
|
+
* I must?" A stream that satisfies `acceptCodecs` always outranks one that
|
|
12335
|
+
* does not, so a passthrough is never lost to a transcode; the answer says
|
|
12336
|
+
* which it is in {@link PickedCamStreamSchema.transcodes}.
|
|
12337
|
+
*
|
|
12338
|
+
* This is what lets one picker serve both the bypass and the full source
|
|
12339
|
+
* choice, instead of a consumer scoring privately when the bypass misses.
|
|
12340
|
+
*/
|
|
12341
|
+
allowTranscode: boolean().optional()
|
|
12221
12342
|
}).readonly();
|
|
12222
12343
|
var PickStreamPreferencesSchema = object({
|
|
12223
12344
|
/**
|
|
@@ -12231,12 +12352,32 @@ var PickStreamPreferencesSchema = object({
|
|
|
12231
12352
|
* picks the tallest stream; `'lowest'` picks the shortest (used by
|
|
12232
12353
|
* memory-constrained consumers / Apple Home guest sessions).
|
|
12233
12354
|
*/
|
|
12234
|
-
resolutionPreference: _enum(["highest", "lowest"]).optional()
|
|
12355
|
+
resolutionPreference: _enum(["highest", "lowest"]).optional(),
|
|
12356
|
+
/**
|
|
12357
|
+
* The height the consumer actually wants to DELIVER.
|
|
12358
|
+
*
|
|
12359
|
+
* Not a constraint — an ordering. With it set, the SMALLEST stream at or
|
|
12360
|
+
* above the target wins, and only if nothing reaches it does the tallest
|
|
12361
|
+
* take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
|
|
12362
|
+
* a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
|
|
12363
|
+
* express that: it says "as big as possible", which is a different wish.
|
|
12364
|
+
*
|
|
12365
|
+
* Ignored when absent, so every existing caller keeps its ordering.
|
|
12366
|
+
*/
|
|
12367
|
+
targetHeight: number().int().positive().optional()
|
|
12235
12368
|
}).readonly();
|
|
12236
12369
|
var PickedCamStreamSchema = object({
|
|
12237
12370
|
camStreamId: string$2(),
|
|
12238
12371
|
codec: string$2().optional(),
|
|
12239
12372
|
resolution: CamStreamResolutionSchema.optional(),
|
|
12373
|
+
/**
|
|
12374
|
+
* Whether serving this stream requires a decode + re-encode.
|
|
12375
|
+
*
|
|
12376
|
+
* `false` is a stream the consumer can take as it stands. Only ever `true`
|
|
12377
|
+
* when the caller asked for it with `allowTranscode`, so a caller that did
|
|
12378
|
+
* not ask cannot be handed a cost it never agreed to pay.
|
|
12379
|
+
*/
|
|
12380
|
+
transcodes: boolean(),
|
|
12240
12381
|
/** One-line explanation of why this stream won — for logs / debug UI. */
|
|
12241
12382
|
reason: string$2()
|
|
12242
12383
|
});
|
|
@@ -16770,6 +16911,8 @@ var NcSystemEventKindSchema = _enum([
|
|
|
16770
16911
|
"device-enabled",
|
|
16771
16912
|
"device-battery-low",
|
|
16772
16913
|
"device-battery-normal",
|
|
16914
|
+
"device-consumable-low",
|
|
16915
|
+
"device-consumable-normal",
|
|
16773
16916
|
"stream-online",
|
|
16774
16917
|
"stream-offline",
|
|
16775
16918
|
"node-online",
|
|
@@ -16788,6 +16931,7 @@ var NcSystemEventKindSchema = _enum([
|
|
|
16788
16931
|
"addon-updated",
|
|
16789
16932
|
"server-updated",
|
|
16790
16933
|
"export-completed",
|
|
16934
|
+
"backup-completed",
|
|
16791
16935
|
"camera-online",
|
|
16792
16936
|
"camera-offline",
|
|
16793
16937
|
"camera-disabled",
|
|
@@ -24069,10 +24213,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
|
|
|
24069
24213
|
}), boolean()), method(object({
|
|
24070
24214
|
deviceId: number().int().nonnegative(),
|
|
24071
24215
|
sessionId: string$2()
|
|
24072
|
-
}), object({
|
|
24073
|
-
|
|
24074
|
-
|
|
24075
|
-
|
|
24216
|
+
}), object({
|
|
24217
|
+
pendingRenegotiation: object({
|
|
24218
|
+
target: WebrtcStreamTargetSchema,
|
|
24219
|
+
epoch: number()
|
|
24220
|
+
}).nullable(),
|
|
24221
|
+
/**
|
|
24222
|
+
* Whether the session still EXISTS.
|
|
24223
|
+
*
|
|
24224
|
+
* A consumer that holds a resource for the life of a session needs to
|
|
24225
|
+
* be able to ask, because a session does not always end the way it
|
|
24226
|
+
* began. Measured on this hub 2026-09-13: an Echo that got stuck never
|
|
24227
|
+
* sent `SessionDisconnected`, so the Alexa exporter's
|
|
24228
|
+
* `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
|
|
24229
|
+
* H.264 transcode kept running for NOBODY for more than twenty
|
|
24230
|
+
* minutes. The WebRTC session had logged `WebRTC session closed`
|
|
24231
|
+
* minutes earlier — the broker knew; the holder had no way to ask.
|
|
24232
|
+
*
|
|
24233
|
+
* `false` for a session id the provider has never heard of, which is
|
|
24234
|
+
* the same answer as "it ended": either way nothing is holding it up.
|
|
24235
|
+
*/
|
|
24236
|
+
alive: boolean()
|
|
24237
|
+
}));
|
|
24076
24238
|
object({
|
|
24077
24239
|
/** All accessory children of the parent. */
|
|
24078
24240
|
childDeviceIds: array(number()).readonly(),
|
|
@@ -34008,6 +34170,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
34008
34170
|
smoke: smokeCapability,
|
|
34009
34171
|
streamCatalog: streamCatalogCapability,
|
|
34010
34172
|
streamParams: streamParamsCapability,
|
|
34173
|
+
streamSignals: streamSignalsCapability,
|
|
34011
34174
|
switch: switchCapability,
|
|
34012
34175
|
tamper: tamperCapability,
|
|
34013
34176
|
temperatureSensor: temperatureSensorCapability,
|
|
@@ -40581,6 +40744,12 @@ Object.freeze({
|
|
|
40581
40744
|
addonId: null,
|
|
40582
40745
|
access: "create"
|
|
40583
40746
|
},
|
|
40747
|
+
"streamBroker.reportStreamSignal": {
|
|
40748
|
+
capName: "stream-broker",
|
|
40749
|
+
capScope: "system",
|
|
40750
|
+
addonId: null,
|
|
40751
|
+
access: "create"
|
|
40752
|
+
},
|
|
40584
40753
|
"streamBroker.restartProfile": {
|
|
40585
40754
|
capName: "stream-broker",
|
|
40586
40755
|
capScope: "system",
|
|
@@ -40665,6 +40834,12 @@ Object.freeze({
|
|
|
40665
40834
|
addonId: null,
|
|
40666
40835
|
access: "create"
|
|
40667
40836
|
},
|
|
40837
|
+
"streamSignals.listSignals": {
|
|
40838
|
+
capName: "stream-signals",
|
|
40839
|
+
capScope: "device",
|
|
40840
|
+
addonId: null,
|
|
40841
|
+
access: "view"
|
|
40842
|
+
},
|
|
40668
40843
|
"switch.setState": {
|
|
40669
40844
|
capName: "switch",
|
|
40670
40845
|
capScope: "device",
|
|
@@ -43037,6 +43212,11 @@ Object.freeze({
|
|
|
43037
43212
|
form: "single",
|
|
43038
43213
|
optional: false
|
|
43039
43214
|
}],
|
|
43215
|
+
"streamBroker.reportStreamSignal": [{
|
|
43216
|
+
name: "deviceId",
|
|
43217
|
+
form: "single",
|
|
43218
|
+
optional: false
|
|
43219
|
+
}],
|
|
43040
43220
|
"streamBroker.restartProfile": [{
|
|
43041
43221
|
name: "deviceId",
|
|
43042
43222
|
form: "single",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-matter-broker",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.101",
|
|
4
4
|
"description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|