@camstack/addon-matter-broker 0.2.100 → 0.2.102

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.
Files changed (3) hide show
  1. package/dist/addon.js +501 -19
  2. package/dist/addon.mjs +501 -19
  3. package/package.json +2 -2
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-ZyX6jcse.mjs
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-DBKu2-U5.mjs
5377
+ //#region ../types/dist/sleep-BDR76Ykr.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,87 @@ 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
+ /**
11629
+ * Runtime-state durability: **session** — mirrored in RAM, never written.
11630
+ *
11631
+ * The slice holds what the DEVICE says it can emit. That is a probed fact,
11632
+ * not an operator choice: the provider re-declares it on every registration,
11633
+ * so losing it loses nothing and persisting it would freeze an answer the
11634
+ * camera is entitled to change. Measured the same day on the sibling case —
11635
+ * `native-object-detection.supportedClasses` was persisted, and a firmware
11636
+ * class the camera really detected stayed missing for the life of the row
11637
+ * because the fix could not reach it.
11638
+ *
11639
+ * See `RuntimeStateDurability`. Enforced by
11640
+ * `scripts/check-runtime-state-durability.ts`.
11641
+ */
11642
+ durability: "session",
11643
+ methods: {
11644
+ /**
11645
+ * What this device can emit. Empty is a valid and common answer — most
11646
+ * cameras have nothing to offer here, and an empty list is what makes the
11647
+ * broker's picker show nothing rather than a false choice.
11648
+ */
11649
+ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
11650
+ };
11556
11651
  /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
11557
11652
  var StreamFormatSchema = _enum([
11558
11653
  "webrtc",
@@ -11949,6 +12044,22 @@ var EgressTranscodeSchema = object({
11949
12044
  camStreamId: string$2().nullable()
11950
12045
  });
11951
12046
  method(object({
12047
+ deviceId: number().int().nonnegative(),
12048
+ /** The provider's signal code. */
12049
+ code: string$2().min(1),
12050
+ /** Ms epoch. Absent ⇒ now. */
12051
+ at: number().optional()
12052
+ }), object({
12053
+ /** Whether the broker acted on it, and if not, why. */
12054
+ accepted: boolean(),
12055
+ reason: _enum([
12056
+ "woke",
12057
+ "hold-extended",
12058
+ "not-enabled",
12059
+ "no-consumer",
12060
+ "unknown-code"
12061
+ ])
12062
+ }), { kind: "mutation" }), method(object({
11952
12063
  deviceId: number().int().nonnegative(),
11953
12064
  camStreamId: string$2().min(1),
11954
12065
  kind: CamStreamKindSchema,
@@ -12203,6 +12314,16 @@ var PickStreamRequirementsSchema = object({
12203
12314
  acceptCodecs: array(StreamCodecSchema).readonly().optional(),
12204
12315
  /** Minimum vertical resolution. Streams shorter than this are dropped. */
12205
12316
  minHeight: number().int().positive().optional(),
12317
+ /**
12318
+ * Maximum vertical resolution. Streams TALLER than this are dropped.
12319
+ *
12320
+ * A consumer can have a ceiling as real as its floor: Alexa documents
12321
+ * 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
12322
+ * Without this the ceiling had to be re-implemented by every caller — and
12323
+ * one caller implementing it privately is how a second scoring authority
12324
+ * gets born.
12325
+ */
12326
+ maxHeight: number().int().positive().optional(),
12206
12327
  /** Minimum horizontal resolution. */
12207
12328
  minWidth: number().int().positive().optional(),
12208
12329
  /**
@@ -12219,7 +12340,22 @@ var PickStreamRequirementsSchema = object({
12219
12340
  * transcoded" guard: if the device is already serving the consumer's
12220
12341
  * codec end-to-end, there's nothing to optimise.
12221
12342
  */
12222
- requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
12343
+ requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
12344
+ /**
12345
+ * Whether a stream the consumer CANNOT decode may still be picked, on the
12346
+ * understanding that it will be transcoded.
12347
+ *
12348
+ * Default `false` — today's behaviour, and the right one for a bypass
12349
+ * question ("is there a stream I can forward untouched?"). Set `true` to
12350
+ * ask the larger question: "what is the best stream for me, transcoding if
12351
+ * I must?" A stream that satisfies `acceptCodecs` always outranks one that
12352
+ * does not, so a passthrough is never lost to a transcode; the answer says
12353
+ * which it is in {@link PickedCamStreamSchema.transcodes}.
12354
+ *
12355
+ * This is what lets one picker serve both the bypass and the full source
12356
+ * choice, instead of a consumer scoring privately when the bypass misses.
12357
+ */
12358
+ allowTranscode: boolean().optional()
12223
12359
  }).readonly();
12224
12360
  var PickStreamPreferencesSchema = object({
12225
12361
  /**
@@ -12233,12 +12369,32 @@ var PickStreamPreferencesSchema = object({
12233
12369
  * picks the tallest stream; `'lowest'` picks the shortest (used by
12234
12370
  * memory-constrained consumers / Apple Home guest sessions).
12235
12371
  */
12236
- resolutionPreference: _enum(["highest", "lowest"]).optional()
12372
+ resolutionPreference: _enum(["highest", "lowest"]).optional(),
12373
+ /**
12374
+ * The height the consumer actually wants to DELIVER.
12375
+ *
12376
+ * Not a constraint — an ordering. With it set, the SMALLEST stream at or
12377
+ * above the target wins, and only if nothing reaches it does the tallest
12378
+ * take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
12379
+ * a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
12380
+ * express that: it says "as big as possible", which is a different wish.
12381
+ *
12382
+ * Ignored when absent, so every existing caller keeps its ordering.
12383
+ */
12384
+ targetHeight: number().int().positive().optional()
12237
12385
  }).readonly();
12238
12386
  var PickedCamStreamSchema = object({
12239
12387
  camStreamId: string$2(),
12240
12388
  codec: string$2().optional(),
12241
12389
  resolution: CamStreamResolutionSchema.optional(),
12390
+ /**
12391
+ * Whether serving this stream requires a decode + re-encode.
12392
+ *
12393
+ * `false` is a stream the consumer can take as it stands. Only ever `true`
12394
+ * when the caller asked for it with `allowTranscode`, so a caller that did
12395
+ * not ask cannot be handed a cost it never agreed to pay.
12396
+ */
12397
+ transcodes: boolean(),
12242
12398
  /** One-line explanation of why this stream won — for logs / debug UI. */
12243
12399
  reason: string$2()
12244
12400
  });
@@ -16772,6 +16928,8 @@ var NcSystemEventKindSchema = _enum([
16772
16928
  "device-enabled",
16773
16929
  "device-battery-low",
16774
16930
  "device-battery-normal",
16931
+ "device-consumable-low",
16932
+ "device-consumable-normal",
16775
16933
  "stream-online",
16776
16934
  "stream-offline",
16777
16935
  "node-online",
@@ -16790,6 +16948,7 @@ var NcSystemEventKindSchema = _enum([
16790
16948
  "addon-updated",
16791
16949
  "server-updated",
16792
16950
  "export-completed",
16951
+ "backup-completed",
16793
16952
  "camera-online",
16794
16953
  "camera-offline",
16795
16954
  "camera-disabled",
@@ -18112,6 +18271,48 @@ var NcAlarmConfigSchema = object({
18112
18271
  settings: NcAlarmSettingsSchema,
18113
18272
  coverage: array(NcAlarmModeCoverageSchema)
18114
18273
  });
18274
+ /**
18275
+ * ONE rule's demand on ONE camera's clip ring.
18276
+ *
18277
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
18278
+ * camera, so the answer stays a faithful description of the rules and the
18279
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
18280
+ * lives. A camera that appears in no ask is being told **nothing** — which is
18281
+ * a different thing from never having been told, and only the envelope
18282
+ * (`rulesLoaded`) can tell those apart.
18283
+ */
18284
+ var NcClipRetentionAskSchema = object({
18285
+ /**
18286
+ * The camera this ask is about. **Absent = every camera**, which is what a
18287
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
18288
+ * asking everywhere.
18289
+ */
18290
+ deviceId: number().int().nonnegative().optional(),
18291
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
18292
+ * needs nothing produces no ask at all. */
18293
+ seconds: number().min(0).max(60),
18294
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
18295
+ * assigned, which is what the cut defaults to. */
18296
+ profile: CamProfileSchema.optional(),
18297
+ /** Who is asking — so a retention the operator did not expect names a rule. */
18298
+ ruleId: string$2(),
18299
+ ruleName: string$2(),
18300
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
18301
+ reason: _enum(["window", "occupancy"])
18302
+ });
18303
+ /**
18304
+ * The whole answer, with the one bit that keeps absence from reading as zero.
18305
+ *
18306
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
18307
+ * once. A centre that is up but has not read its rules yet answers with an
18308
+ * empty ask list that means nothing at all — applying it would drop every
18309
+ * camera's ring to zero for the first events after a restart, which is the
18310
+ * footage this mechanism exists to keep.
18311
+ */
18312
+ var NcClipRetentionPlanSchema = object({
18313
+ rulesLoaded: boolean(),
18314
+ asks: array(NcClipRetentionAskSchema).readonly()
18315
+ });
18115
18316
  method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string$2() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
18116
18317
  kind: "mutation",
18117
18318
  auth: "admin",
@@ -18132,7 +18333,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18132
18333
  }), object({ success: literal(true) }), {
18133
18334
  kind: "mutation",
18134
18335
  auth: "admin"
18135
- }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18336
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18136
18337
  deviceId: number().int(),
18137
18338
  muted: boolean()
18138
18339
  }), object({ success: literal(true) }), {
@@ -20706,6 +20907,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
20706
20907
  * solid is this track", cheaper than re-deriving it from a trajectory. */
20707
20908
  framesMatched: number().int()
20708
20909
  })).readonly() });
20910
+ /**
20911
+ * The long-term series a camera produces. A closed union so a typo cannot
20912
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
20913
+ * is an alias of this, not a second list.
20914
+ */
20915
+ var AnalyticsLtsSeriesSchema = _enum([
20916
+ "motion",
20917
+ "audio-dbfs",
20918
+ "battery",
20919
+ "occupancy"
20920
+ ]);
20921
+ /**
20922
+ * One closed 5-minute bucket of a long-term series.
20923
+ *
20924
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
20925
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
20926
+ * that exists at all was measured; a bucket that is absent was not, which is a
20927
+ * different claim from zero and the reason this is a sparse series.
20928
+ */
20929
+ var LtsBucketSchema = object({
20930
+ scope: string$2(),
20931
+ bucketStart: number().int(),
20932
+ samples: number().int().nonnegative(),
20933
+ sum: number(),
20934
+ min: number(),
20935
+ max: number()
20936
+ });
20709
20937
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
20710
20938
  deviceId: number(),
20711
20939
  trackId: string$2()
@@ -20752,6 +20980,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20752
20980
  kinds: array(string$2()).optional(),
20753
20981
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
20754
20982
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
20983
+ deviceId: number(),
20984
+ series: AnalyticsLtsSeriesSchema,
20985
+ /** Omit for EVERY scope of this series in the range. */
20986
+ scope: string$2().optional(),
20987
+ from: number(),
20988
+ to: number(),
20989
+ limit: number().int().positive().optional()
20990
+ }), array(LtsBucketSchema).readonly()), method(object({
20755
20991
  deviceId: number(),
20756
20992
  since: number(),
20757
20993
  until: number(),
@@ -21370,6 +21606,14 @@ var MotionSourceEnum = _enum([
21370
21606
  */
21371
21607
  var MotionSourcesSchema = array(MotionSourceEnum);
21372
21608
  /**
21609
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
21610
+ * post-analysis already tags every detection with (`DetectionSource`) rather
21611
+ * than a second spelling of the same two ideas — the value an operator picks
21612
+ * here is the value that comes back on the track, the overlay and the debug
21613
+ * row.
21614
+ */
21615
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
21616
+ /**
21373
21617
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
21374
21618
  * so cap-side consumers (the orchestrator forward, the runner addon's
21375
21619
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -21520,6 +21764,35 @@ var RunnerCameraConfigSchema = object({
21520
21764
  * events; the orchestrator forwards to `reportMotion`.
21521
21765
  */
21522
21766
  motionSources: MotionSourcesSchema.default(["analyzer"]),
21767
+ /**
21768
+ * WHICH root detector runs for this camera. The detection counterpart of
21769
+ * {@link motionSources}, same shape and same discipline: a per-camera list
21770
+ * of sources the system understands, vendor-agnostic, owned here.
21771
+ *
21772
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
21773
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
21774
+ * here. Its boxes reach post-analysis on the same
21775
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
21776
+ * track gets the same tracker, the same overlay and the same detail
21777
+ * subtree (face / plate / embedding).
21778
+ *
21779
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
21780
+ * run, and that is where a camera with a usable onboard detector buys back
21781
+ * its share of the accelerator. It saves the root inference, not the decode
21782
+ * — the detail subtree still needs pixels to cut crops from.
21783
+ *
21784
+ * A camera whose onboard detections carry no geometry cannot serve as a root
21785
+ * step at all (there is nothing to track), and the cap that knows this says
21786
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
21787
+ * every battery camera: the boxes ride a sub-stream a battery camera never
21788
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
21789
+ * worth exactly what it already is — a wake signal with a class.
21790
+ *
21791
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
21792
+ * vendor never turns a detector on for the operator, and neither does a
21793
+ * default.
21794
+ */
21795
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
21523
21796
  pipelineEnabled: boolean().default(true),
21524
21797
  /** Ordered tree of video steps. Absent → runner skips video detection. */
21525
21798
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -21701,7 +21974,47 @@ var RunnerLocalMetricsSchema = object({
21701
21974
  queueDepth: number(),
21702
21975
  frameLazy: FrameLazyMetricsSchema.optional()
21703
21976
  });
21977
+ /**
21978
+ * Pipeline Runner capability — runtime detection workhorse.
21979
+ *
21980
+ * One instance per node. Receives camera assignments from
21981
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
21982
+ * decoded frames, drains motion + detection queues, calls the local
21983
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
21984
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
21985
+ * the bus.
21986
+ *
21987
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
21988
+ * runner has zero knowledge of other agents, no global state, and never
21989
+ * makes assignment decisions itself.
21990
+ */
21991
+ /**
21992
+ * Why a runner declined to look at a camera out of band. Named rather than a
21993
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
21994
+ * already mid-session and one already bursting are four different facts, and a
21995
+ * caller told only "no" cannot tell a protection from a bug.
21996
+ */
21997
+ var OccupancyBurstRefusalSchema = _enum([
21998
+ "not-attached",
21999
+ "battery-asleep",
22000
+ "not-watching",
22001
+ "already-bursting"
22002
+ ]);
21704
22003
  method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number()).readonly()), method(object({
22004
+ deviceId: number(),
22005
+ /** How many frames to collect. The caller sizes this against what its
22006
+ * own confirmation needs; the runner clamps it to the field's range. */
22007
+ frames: number().int().positive().optional(),
22008
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
22009
+ * defend — the periodic one at least has a timer to point at. */
22010
+ reason: string$2()
22011
+ }), object({
22012
+ started: boolean(),
22013
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
22014
+ }), {
22015
+ auth: "admin",
22016
+ kind: "mutation"
22017
+ }), method(object({
21705
22018
  handle: FrameHandleSchema,
21706
22019
  bbox: NativeCropBboxSchema,
21707
22020
  maxWidth: number().int().positive().optional(),
@@ -24071,10 +24384,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
24071
24384
  }), boolean()), method(object({
24072
24385
  deviceId: number().int().nonnegative(),
24073
24386
  sessionId: string$2()
24074
- }), object({ pendingRenegotiation: object({
24075
- target: WebrtcStreamTargetSchema,
24076
- epoch: number()
24077
- }).nullable() }));
24387
+ }), object({
24388
+ pendingRenegotiation: object({
24389
+ target: WebrtcStreamTargetSchema,
24390
+ epoch: number()
24391
+ }).nullable(),
24392
+ /**
24393
+ * Whether the session still EXISTS.
24394
+ *
24395
+ * A consumer that holds a resource for the life of a session needs to
24396
+ * be able to ask, because a session does not always end the way it
24397
+ * began. Measured on this hub 2026-09-13: an Echo that got stuck never
24398
+ * sent `SessionDisconnected`, so the Alexa exporter's
24399
+ * `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
24400
+ * H.264 transcode kept running for NOBODY for more than twenty
24401
+ * minutes. The WebRTC session had logged `WebRTC session closed`
24402
+ * minutes earlier — the broker knew; the holder had no way to ask.
24403
+ *
24404
+ * `false` for a session id the provider has never heard of, which is
24405
+ * the same answer as "it ended": either way nothing is holding it up.
24406
+ */
24407
+ alive: boolean()
24408
+ }));
24078
24409
  object({
24079
24410
  /** All accessory children of the parent. */
24080
24411
  childDeviceIds: array(number()).readonly(),
@@ -28530,11 +28861,46 @@ var NativeObjectDetectionStatusSchema = object({
28530
28861
  supportedClasses: array(NativeObjectClassEnum).readonly(),
28531
28862
  /**
28532
28863
  * Whether forwarding of onboard AI detections is enabled for this device.
28533
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
28534
- * churn the tracker, so forwarding stays off until the operator enables it.
28864
+ *
28865
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
28866
+ * camera runs — that is the operator's choice, and it is made where every
28867
+ * other detection choice is made. `geometry` on
28868
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
28869
+ * choice would buy this particular camera.
28535
28870
  */
28536
28871
  enabled: boolean()
28537
28872
  });
28873
+ /**
28874
+ * WHEN a camera's onboard detections carry geometry.
28875
+ *
28876
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
28877
+ * a detection is a trackable subject whenever the camera sees one.
28878
+ * - `while-streaming` — only while some stream of this camera is already open.
28879
+ * The boxes ride the video's own side-channel rather than a feed of their
28880
+ * own, so they cost nothing and they exist only when something is pulling.
28881
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
28882
+ * radio drain, but a camera that is awake is awake precisely because
28883
+ * something is in front of it, and its stream is already being pulled.
28884
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
28885
+ * pipeline needs geometry to make a subject, so such a push reaches the
28886
+ * tracker as motion and no further.
28887
+ *
28888
+ * Reported and not inferred, because the operator's question in front of the
28889
+ * picker is "what do I get", and these are three different answers (D14: the
28890
+ * derived form is only as honest as `getOptions`).
28891
+ */
28892
+ var NativeObjectGeometryEnum = _enum([
28893
+ "boxed",
28894
+ "while-streaming",
28895
+ "flag-only"
28896
+ ]);
28897
+ var NativeObjectDetectionOptionsSchema = object({
28898
+ /** Classes this firmware can detect — the same list the status reports. */
28899
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
28900
+ /** What a detection from this camera carries. */
28901
+ geometry: NativeObjectGeometryEnum
28902
+ });
28903
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
28538
28904
  var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
28539
28905
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
28540
28906
  lastFetchedAt: number() });
@@ -28544,13 +28910,23 @@ var nativeObjectDetectionCapability = {
28544
28910
  deviceNative: true,
28545
28911
  mode: "singleton",
28546
28912
  deviceTypes: [DeviceType.Camera],
28547
- methods: { setEnabled: method(object({
28548
- deviceId: number(),
28549
- enabled: boolean()
28550
- }), _void(), {
28551
- kind: "mutation",
28552
- auth: "admin"
28553
- }) },
28913
+ methods: {
28914
+ getOptions: method(object({ deviceId: number() }), NativeObjectDetectionOptionsSchema),
28915
+ setSettings: method(object({
28916
+ deviceId: number(),
28917
+ settings: NativeObjectDetectionSettingsPatchSchema
28918
+ }), _void(), {
28919
+ kind: "mutation",
28920
+ auth: "admin"
28921
+ }),
28922
+ setEnabled: method(object({
28923
+ deviceId: number(),
28924
+ enabled: boolean()
28925
+ }), _void(), {
28926
+ kind: "mutation",
28927
+ auth: "admin"
28928
+ })
28929
+ },
28554
28930
  events: { onDetected: { data: object({
28555
28931
  deviceId: number(),
28556
28932
  detection: NativeDetectionSchema
@@ -33398,7 +33774,28 @@ var PerScopeBreakdownSchema = object({
33398
33774
  /** Total tracked objects in this scope (frame / zone / unzoned). */
33399
33775
  totalObjects: number().int().nonnegative(),
33400
33776
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
33401
- byClass: record(string$2(), number().int().nonnegative())
33777
+ byClass: record(string$2(), number().int().nonnegative()),
33778
+ /**
33779
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
33780
+ * present but not going anywhere (a parked car, a bin, a statue).
33781
+ *
33782
+ * The operator's question about a scene has two halves and they answer
33783
+ * different things: "what is parked here" is stable for hours and must not
33784
+ * flap, while "who is walking through" is the thing an alert is about. One
33785
+ * number could only serve one of them, and `totalObjects` served the first
33786
+ * badly — a passer-by moved it and every occupancy rule saw a change.
33787
+ *
33788
+ * `standing + transient === totalObjects`, always. The total keeps its old
33789
+ * meaning exactly, so no rule written against it changes behaviour.
33790
+ *
33791
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
33792
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
33793
+ * parked objects here" about a camera whose lot is full.
33794
+ */
33795
+ standingObjects: number().int().nonnegative().optional(),
33796
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
33797
+ * same absence rule. */
33798
+ transientObjects: number().int().nonnegative().optional()
33402
33799
  });
33403
33800
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
33404
33801
  zoneId: string$2(),
@@ -33521,6 +33918,23 @@ var HistoryPointSchema = object({
33521
33918
  * triple covers the three spatial scopes (per-zone, frame-wide,
33522
33919
  * outside-any-zone). Crossing them with `className?` gives the full
33523
33920
  * combinatorial coverage the operator UI requested.
33921
+ *
33922
+ * ## ⚠️ The three history methods are DEPRECATED
33923
+ *
33924
+ * They are served from a 60-MINUTE in-memory ring. It dies with the process,
33925
+ * so after a restart they report nothing about a night that did happen, and any
33926
+ * window past an hour is silently clamped — a caller cannot tell a clamp from
33927
+ * an empty scene. The presets in the occupancy chart existed to hide that
33928
+ * horizon rather than to answer a question.
33929
+ *
33930
+ * Use `pipelineAnalytics.readLongTermSeries({ series: 'occupancy', scope })`
33931
+ * instead. Those rows are already written for every camera, ~60 bytes per
33932
+ * (camera, scope, 5-minute bucket), kept for a year, and survive a restart.
33933
+ * Spell the scope with `occupancyScope(zoneId?, className?)` — the same
33934
+ * function the writer uses, so the two cannot drift.
33935
+ *
33936
+ * The ring stays until these three go, and it is the only thing left reading
33937
+ * it. Do not add a fourth caller.
33524
33938
  */
33525
33939
  var zoneAnalyticsCapability = {
33526
33940
  name: "zone-analytics",
@@ -34010,6 +34424,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
34010
34424
  smoke: smokeCapability,
34011
34425
  streamCatalog: streamCatalogCapability,
34012
34426
  streamParams: streamParamsCapability,
34427
+ streamSignals: streamSignalsCapability,
34013
34428
  switch: switchCapability,
34014
34429
  tamper: tamperCapability,
34015
34430
  temperatureSensor: temperatureSensorCapability,
@@ -37919,12 +38334,24 @@ Object.freeze({
37919
38334
  addonId: null,
37920
38335
  access: "create"
37921
38336
  },
38337
+ "nativeObjectDetection.getOptions": {
38338
+ capName: "native-object-detection",
38339
+ capScope: "device",
38340
+ addonId: null,
38341
+ access: "view"
38342
+ },
37922
38343
  "nativeObjectDetection.setEnabled": {
37923
38344
  capName: "native-object-detection",
37924
38345
  capScope: "device",
37925
38346
  addonId: null,
37926
38347
  access: "create"
37927
38348
  },
38349
+ "nativeObjectDetection.setSettings": {
38350
+ capName: "native-object-detection",
38351
+ capScope: "device",
38352
+ addonId: null,
38353
+ access: "create"
38354
+ },
37928
38355
  "navigation.getFeatures": {
37929
38356
  capName: "navigation",
37930
38357
  capScope: "device",
@@ -38189,6 +38616,12 @@ Object.freeze({
38189
38616
  addonId: null,
38190
38617
  access: "view"
38191
38618
  },
38619
+ "notificationRules.getClipRetentionAsks": {
38620
+ capName: "notification-rules",
38621
+ capScope: "system",
38622
+ addonId: null,
38623
+ access: "view"
38624
+ },
38192
38625
  "notificationRules.getConditionCatalog": {
38193
38626
  capName: "notification-rules",
38194
38627
  capScope: "system",
@@ -38699,6 +39132,12 @@ Object.freeze({
38699
39132
  addonId: null,
38700
39133
  access: "create"
38701
39134
  },
39135
+ "pipelineAnalytics.readLongTermSeries": {
39136
+ capName: "pipeline-analytics",
39137
+ capScope: "device",
39138
+ addonId: null,
39139
+ access: "view"
39140
+ },
38702
39141
  "pipelineAnalytics.rebuildObjectEmbeddings": {
38703
39142
  capName: "pipeline-analytics",
38704
39143
  capScope: "device",
@@ -39371,6 +39810,12 @@ Object.freeze({
39371
39810
  addonId: null,
39372
39811
  access: "create"
39373
39812
  },
39813
+ "pipelineRunner.requestOccupancyBurst": {
39814
+ capName: "pipeline-runner",
39815
+ capScope: "system",
39816
+ addonId: null,
39817
+ access: "create"
39818
+ },
39374
39819
  "pipelineRunner.runDetailSubtree": {
39375
39820
  capName: "pipeline-runner",
39376
39821
  capScope: "system",
@@ -40583,6 +41028,12 @@ Object.freeze({
40583
41028
  addonId: null,
40584
41029
  access: "create"
40585
41030
  },
41031
+ "streamBroker.reportStreamSignal": {
41032
+ capName: "stream-broker",
41033
+ capScope: "system",
41034
+ addonId: null,
41035
+ access: "create"
41036
+ },
40586
41037
  "streamBroker.restartProfile": {
40587
41038
  capName: "stream-broker",
40588
41039
  capScope: "system",
@@ -40667,6 +41118,12 @@ Object.freeze({
40667
41118
  addonId: null,
40668
41119
  access: "create"
40669
41120
  },
41121
+ "streamSignals.listSignals": {
41122
+ capName: "stream-signals",
41123
+ capScope: "device",
41124
+ addonId: null,
41125
+ access: "view"
41126
+ },
40670
41127
  "switch.setState": {
40671
41128
  capName: "switch",
40672
41129
  capScope: "device",
@@ -42139,11 +42596,21 @@ Object.freeze({
42139
42596
  form: "single",
42140
42597
  optional: false
42141
42598
  }],
42599
+ "nativeObjectDetection.getOptions": [{
42600
+ name: "deviceId",
42601
+ form: "single",
42602
+ optional: false
42603
+ }],
42142
42604
  "nativeObjectDetection.setEnabled": [{
42143
42605
  name: "deviceId",
42144
42606
  form: "single",
42145
42607
  optional: false
42146
42608
  }],
42609
+ "nativeObjectDetection.setSettings": [{
42610
+ name: "deviceId",
42611
+ form: "single",
42612
+ optional: false
42613
+ }],
42147
42614
  "navigation.getFeatures": [{
42148
42615
  name: "deviceId",
42149
42616
  form: "single",
@@ -42493,6 +42960,11 @@ Object.freeze({
42493
42960
  form: "single",
42494
42961
  optional: false
42495
42962
  }],
42963
+ "pipelineAnalytics.readLongTermSeries": [{
42964
+ name: "deviceId",
42965
+ form: "single",
42966
+ optional: false
42967
+ }],
42496
42968
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
42497
42969
  name: "deviceId",
42498
42970
  form: "single",
@@ -42683,6 +43155,11 @@ Object.freeze({
42683
43155
  form: "single",
42684
43156
  optional: false
42685
43157
  }],
43158
+ "pipelineRunner.requestOccupancyBurst": [{
43159
+ name: "deviceId",
43160
+ form: "single",
43161
+ optional: false
43162
+ }],
42686
43163
  "pipelineRunner.runDetailSubtree": [{
42687
43164
  name: "deviceId",
42688
43165
  form: "single",
@@ -43039,6 +43516,11 @@ Object.freeze({
43039
43516
  form: "single",
43040
43517
  optional: false
43041
43518
  }],
43519
+ "streamBroker.reportStreamSignal": [{
43520
+ name: "deviceId",
43521
+ form: "single",
43522
+ optional: false
43523
+ }],
43042
43524
  "streamBroker.restartProfile": [{
43043
43525
  name: "deviceId",
43044
43526
  form: "single",