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