@camstack/addon-provider-gree 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
@@ -1,7 +1,7 @@
1
1
  import { createSocket } from "dgram";
2
2
  import { createCipheriv, createDecipheriv } from "crypto";
3
3
  import { EventEmitter } from "events";
4
- //#region ../types/dist/event-category-ZyX6jcse.mjs
4
+ //#region ../types/dist/event-category-BVDXG4tB.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -618,6 +618,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
618
618
  * pull-reconcile from the provider's `getStatus` on reconnect. */
619
619
  EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
620
620
  EventCategory["BackupCompleted"] = "backup.completed";
621
+ /**
622
+ * A whole backup RUN finished — every destination attempted, win or lose.
623
+ *
624
+ * `backup.completed` fires once per DESTINATION, which is the right grain for
625
+ * a progress UI and the wrong one for a notification: an operator with three
626
+ * destinations would be told three times. And a run where two of three
627
+ * destinations succeeded is not a clean success — a single "backup
628
+ * completed" that hid the failed one would be a lie, so the count of each is
629
+ * carried here and the message says both.
630
+ *
631
+ * Emitted by the backup orchestrator only after the destination loop, so a
632
+ * run that dies during the BUILD phase produces no completion at all.
633
+ */
634
+ EventCategory["BackupRunCompleted"] = "backup.run-completed";
621
635
  EventCategory["BackupRestored"] = "backup.restored";
622
636
  EventCategory["NotificationDispatched"] = "notification.dispatched";
623
637
  EventCategory["NotificationFailed"] = "notification.failed";
@@ -5348,7 +5362,7 @@ var ZodIssueCode = {
5348
5362
  var ZodFirstPartyTypeKind;
5349
5363
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5350
5364
  //#endregion
5351
- //#region ../types/dist/sleep-DBKu2-U5.mjs
5365
+ //#region ../types/dist/sleep-BDR76Ykr.mjs
5352
5366
  /**
5353
5367
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5354
5368
  * window to float samples (D455).
@@ -11492,6 +11506,87 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
11492
11506
  auth: "admin"
11493
11507
  }), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
11494
11508
  DeviceType.Camera;
11509
+ /**
11510
+ * The signals a device can emit to WAKE its own stream.
11511
+ *
11512
+ * A camera whose stream is built on demand sleeps until something asks for it,
11513
+ * and "something" cannot be a consumer that is merely attached — a Frigate-style
11514
+ * puller holds a session open for ever, and treating that as demand would keep
11515
+ * a battery camera awake for ever, which is the whole thing the battery is for
11516
+ * (D173). So the wake has to come from the CAMERA: an event it noticed by
11517
+ * itself, with no stream running.
11518
+ *
11519
+ * ## The vocabulary is the PROVIDER'S, not ours
11520
+ *
11521
+ * Like `consumables`, this cap declares no vocabulary of its own. A provider
11522
+ * names each signal with a `code` it chooses and a `label` an operator reads.
11523
+ * Reolink offers motion and camera-native detection; another provider may offer
11524
+ * a tamper, a doorbell press, a PIR, or something no camera in this fleet has
11525
+ * yet. A fixed enum here would mean every new signal is a framework release.
11526
+ *
11527
+ * It is deliberately NOT derived from the caps a device already binds. Whether
11528
+ * a camera CAN push firmware motion is expressed by `motionSources` containing
11529
+ * `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
11530
+ * binding — but both answer "what drives the detection pipeline", which is a
11531
+ * different question from "what may wake a sleeping stream". A camera can do
11532
+ * the first and not be trusted with the second, and the operator picks per
11533
+ * camera. Two questions, two authorities.
11534
+ *
11535
+ * ## Availability is not permission
11536
+ *
11537
+ * `listSignals` says what the device CAN emit. Whether a given signal actually
11538
+ * wakes the stream is the operator's per-camera choice, held by the broker
11539
+ * alongside the cooldown — see the stream-broker cap's wake settings. A
11540
+ * provider declaring a signal is not a provider enabling it.
11541
+ */
11542
+ /** One signal a device can emit. */
11543
+ var StreamSignalSchema = object({
11544
+ /** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
11545
+ code: string().min(1),
11546
+ /** What an operator reads in the picker. The provider's own wording. */
11547
+ label: string().min(1),
11548
+ /**
11549
+ * Whether the provider recommends this signal ON when a camera is first set
11550
+ * up. A provider knows which of its signals are cheap and reliable; an
11551
+ * operator should not have to discover that by trial. Reolink recommends
11552
+ * both of its own.
11553
+ */
11554
+ recommended: boolean()
11555
+ });
11556
+ var StreamSignalsStatusSchema = object({
11557
+ signals: array(StreamSignalSchema),
11558
+ lastFetchedAt: number()
11559
+ });
11560
+ var streamSignalsCapability = {
11561
+ name: "stream-signals",
11562
+ scope: "device",
11563
+ deviceNative: true,
11564
+ mode: "singleton",
11565
+ deviceTypes: Object.values(DeviceType),
11566
+ runtimeState: StreamSignalsStatusSchema,
11567
+ /**
11568
+ * Runtime-state durability: **session** — mirrored in RAM, never written.
11569
+ *
11570
+ * The slice holds what the DEVICE says it can emit. That is a probed fact,
11571
+ * not an operator choice: the provider re-declares it on every registration,
11572
+ * so losing it loses nothing and persisting it would freeze an answer the
11573
+ * camera is entitled to change. Measured the same day on the sibling case —
11574
+ * `native-object-detection.supportedClasses` was persisted, and a firmware
11575
+ * class the camera really detected stayed missing for the life of the row
11576
+ * because the fix could not reach it.
11577
+ *
11578
+ * See `RuntimeStateDurability`. Enforced by
11579
+ * `scripts/check-runtime-state-durability.ts`.
11580
+ */
11581
+ durability: "session",
11582
+ methods: {
11583
+ /**
11584
+ * What this device can emit. Empty is a valid and common answer — most
11585
+ * cameras have nothing to offer here, and an empty list is what makes the
11586
+ * broker's picker show nothing rather than a false choice.
11587
+ */
11588
+ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
11589
+ };
11495
11590
  /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
11496
11591
  var StreamFormatSchema = _enum([
11497
11592
  "webrtc",
@@ -11888,6 +11983,22 @@ var EgressTranscodeSchema = object({
11888
11983
  camStreamId: string().nullable()
11889
11984
  });
11890
11985
  method(object({
11986
+ deviceId: number().int().nonnegative(),
11987
+ /** The provider's signal code. */
11988
+ code: string().min(1),
11989
+ /** Ms epoch. Absent ⇒ now. */
11990
+ at: number().optional()
11991
+ }), object({
11992
+ /** Whether the broker acted on it, and if not, why. */
11993
+ accepted: boolean(),
11994
+ reason: _enum([
11995
+ "woke",
11996
+ "hold-extended",
11997
+ "not-enabled",
11998
+ "no-consumer",
11999
+ "unknown-code"
12000
+ ])
12001
+ }), { kind: "mutation" }), method(object({
11891
12002
  deviceId: number().int().nonnegative(),
11892
12003
  camStreamId: string().min(1),
11893
12004
  kind: CamStreamKindSchema,
@@ -12142,6 +12253,16 @@ var PickStreamRequirementsSchema = object({
12142
12253
  acceptCodecs: array(StreamCodecSchema).readonly().optional(),
12143
12254
  /** Minimum vertical resolution. Streams shorter than this are dropped. */
12144
12255
  minHeight: number().int().positive().optional(),
12256
+ /**
12257
+ * Maximum vertical resolution. Streams TALLER than this are dropped.
12258
+ *
12259
+ * A consumer can have a ceiling as real as its floor: Alexa documents
12260
+ * 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
12261
+ * Without this the ceiling had to be re-implemented by every caller — and
12262
+ * one caller implementing it privately is how a second scoring authority
12263
+ * gets born.
12264
+ */
12265
+ maxHeight: number().int().positive().optional(),
12145
12266
  /** Minimum horizontal resolution. */
12146
12267
  minWidth: number().int().positive().optional(),
12147
12268
  /**
@@ -12158,7 +12279,22 @@ var PickStreamRequirementsSchema = object({
12158
12279
  * transcoded" guard: if the device is already serving the consumer's
12159
12280
  * codec end-to-end, there's nothing to optimise.
12160
12281
  */
12161
- requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
12282
+ requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
12283
+ /**
12284
+ * Whether a stream the consumer CANNOT decode may still be picked, on the
12285
+ * understanding that it will be transcoded.
12286
+ *
12287
+ * Default `false` — today's behaviour, and the right one for a bypass
12288
+ * question ("is there a stream I can forward untouched?"). Set `true` to
12289
+ * ask the larger question: "what is the best stream for me, transcoding if
12290
+ * I must?" A stream that satisfies `acceptCodecs` always outranks one that
12291
+ * does not, so a passthrough is never lost to a transcode; the answer says
12292
+ * which it is in {@link PickedCamStreamSchema.transcodes}.
12293
+ *
12294
+ * This is what lets one picker serve both the bypass and the full source
12295
+ * choice, instead of a consumer scoring privately when the bypass misses.
12296
+ */
12297
+ allowTranscode: boolean().optional()
12162
12298
  }).readonly();
12163
12299
  var PickStreamPreferencesSchema = object({
12164
12300
  /**
@@ -12172,12 +12308,32 @@ var PickStreamPreferencesSchema = object({
12172
12308
  * picks the tallest stream; `'lowest'` picks the shortest (used by
12173
12309
  * memory-constrained consumers / Apple Home guest sessions).
12174
12310
  */
12175
- resolutionPreference: _enum(["highest", "lowest"]).optional()
12311
+ resolutionPreference: _enum(["highest", "lowest"]).optional(),
12312
+ /**
12313
+ * The height the consumer actually wants to DELIVER.
12314
+ *
12315
+ * Not a constraint — an ordering. With it set, the SMALLEST stream at or
12316
+ * above the target wins, and only if nothing reaches it does the tallest
12317
+ * take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
12318
+ * a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
12319
+ * express that: it says "as big as possible", which is a different wish.
12320
+ *
12321
+ * Ignored when absent, so every existing caller keeps its ordering.
12322
+ */
12323
+ targetHeight: number().int().positive().optional()
12176
12324
  }).readonly();
12177
12325
  var PickedCamStreamSchema = object({
12178
12326
  camStreamId: string(),
12179
12327
  codec: string().optional(),
12180
12328
  resolution: CamStreamResolutionSchema.optional(),
12329
+ /**
12330
+ * Whether serving this stream requires a decode + re-encode.
12331
+ *
12332
+ * `false` is a stream the consumer can take as it stands. Only ever `true`
12333
+ * when the caller asked for it with `allowTranscode`, so a caller that did
12334
+ * not ask cannot be handed a cost it never agreed to pay.
12335
+ */
12336
+ transcodes: boolean(),
12181
12337
  /** One-line explanation of why this stream won — for logs / debug UI. */
12182
12338
  reason: string()
12183
12339
  });
@@ -16694,6 +16850,8 @@ var NcSystemEventKindSchema = _enum([
16694
16850
  "device-enabled",
16695
16851
  "device-battery-low",
16696
16852
  "device-battery-normal",
16853
+ "device-consumable-low",
16854
+ "device-consumable-normal",
16697
16855
  "stream-online",
16698
16856
  "stream-offline",
16699
16857
  "node-online",
@@ -16712,6 +16870,7 @@ var NcSystemEventKindSchema = _enum([
16712
16870
  "addon-updated",
16713
16871
  "server-updated",
16714
16872
  "export-completed",
16873
+ "backup-completed",
16715
16874
  "camera-online",
16716
16875
  "camera-offline",
16717
16876
  "camera-disabled",
@@ -18034,6 +18193,48 @@ var NcAlarmConfigSchema = object({
18034
18193
  settings: NcAlarmSettingsSchema,
18035
18194
  coverage: array(NcAlarmModeCoverageSchema)
18036
18195
  });
18196
+ /**
18197
+ * ONE rule's demand on ONE camera's clip ring.
18198
+ *
18199
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
18200
+ * camera, so the answer stays a faithful description of the rules and the
18201
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
18202
+ * lives. A camera that appears in no ask is being told **nothing** — which is
18203
+ * a different thing from never having been told, and only the envelope
18204
+ * (`rulesLoaded`) can tell those apart.
18205
+ */
18206
+ var NcClipRetentionAskSchema = object({
18207
+ /**
18208
+ * The camera this ask is about. **Absent = every camera**, which is what a
18209
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
18210
+ * asking everywhere.
18211
+ */
18212
+ deviceId: number().int().nonnegative().optional(),
18213
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
18214
+ * needs nothing produces no ask at all. */
18215
+ seconds: number().min(0).max(60),
18216
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
18217
+ * assigned, which is what the cut defaults to. */
18218
+ profile: CamProfileSchema.optional(),
18219
+ /** Who is asking — so a retention the operator did not expect names a rule. */
18220
+ ruleId: string(),
18221
+ ruleName: string(),
18222
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
18223
+ reason: _enum(["window", "occupancy"])
18224
+ });
18225
+ /**
18226
+ * The whole answer, with the one bit that keeps absence from reading as zero.
18227
+ *
18228
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
18229
+ * once. A centre that is up but has not read its rules yet answers with an
18230
+ * empty ask list that means nothing at all — applying it would drop every
18231
+ * camera's ring to zero for the first events after a restart, which is the
18232
+ * footage this mechanism exists to keep.
18233
+ */
18234
+ var NcClipRetentionPlanSchema = object({
18235
+ rulesLoaded: boolean(),
18236
+ asks: array(NcClipRetentionAskSchema).readonly()
18237
+ });
18037
18238
  method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), method(object({ ruleId: string() }), object({ rule: NcRuleSchema.nullable() }), { auth: "admin" }), method(object({ rule: NcRuleInputSchema }), object({ rule: NcRuleSchema }), {
18038
18239
  kind: "mutation",
18039
18240
  auth: "admin",
@@ -18054,7 +18255,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18054
18255
  }), object({ success: literal(true) }), {
18055
18256
  kind: "mutation",
18056
18257
  auth: "admin"
18057
- }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18258
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18058
18259
  deviceId: number().int(),
18059
18260
  muted: boolean()
18060
18261
  }), object({ success: literal(true) }), {
@@ -20628,6 +20829,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
20628
20829
  * solid is this track", cheaper than re-deriving it from a trajectory. */
20629
20830
  framesMatched: number().int()
20630
20831
  })).readonly() });
20832
+ /**
20833
+ * The long-term series a camera produces. A closed union so a typo cannot
20834
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
20835
+ * is an alias of this, not a second list.
20836
+ */
20837
+ var AnalyticsLtsSeriesSchema = _enum([
20838
+ "motion",
20839
+ "audio-dbfs",
20840
+ "battery",
20841
+ "occupancy"
20842
+ ]);
20843
+ /**
20844
+ * One closed 5-minute bucket of a long-term series.
20845
+ *
20846
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
20847
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
20848
+ * that exists at all was measured; a bucket that is absent was not, which is a
20849
+ * different claim from zero and the reason this is a sparse series.
20850
+ */
20851
+ var LtsBucketSchema = object({
20852
+ scope: string(),
20853
+ bucketStart: number().int(),
20854
+ samples: number().int().nonnegative(),
20855
+ sum: number(),
20856
+ min: number(),
20857
+ max: number()
20858
+ });
20631
20859
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
20632
20860
  deviceId: number(),
20633
20861
  trackId: string()
@@ -20674,6 +20902,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20674
20902
  kinds: array(string()).optional(),
20675
20903
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
20676
20904
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
20905
+ deviceId: number(),
20906
+ series: AnalyticsLtsSeriesSchema,
20907
+ /** Omit for EVERY scope of this series in the range. */
20908
+ scope: string().optional(),
20909
+ from: number(),
20910
+ to: number(),
20911
+ limit: number().int().positive().optional()
20912
+ }), array(LtsBucketSchema).readonly()), method(object({
20677
20913
  deviceId: number(),
20678
20914
  since: number(),
20679
20915
  until: number(),
@@ -21292,6 +21528,14 @@ var MotionSourceEnum = _enum([
21292
21528
  */
21293
21529
  var MotionSourcesSchema = array(MotionSourceEnum);
21294
21530
  /**
21531
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
21532
+ * post-analysis already tags every detection with (`DetectionSource`) rather
21533
+ * than a second spelling of the same two ideas — the value an operator picks
21534
+ * here is the value that comes back on the track, the overlay and the debug
21535
+ * row.
21536
+ */
21537
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
21538
+ /**
21295
21539
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
21296
21540
  * so cap-side consumers (the orchestrator forward, the runner addon's
21297
21541
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -21442,6 +21686,35 @@ var RunnerCameraConfigSchema = object({
21442
21686
  * events; the orchestrator forwards to `reportMotion`.
21443
21687
  */
21444
21688
  motionSources: MotionSourcesSchema.default(["analyzer"]),
21689
+ /**
21690
+ * WHICH root detector runs for this camera. The detection counterpart of
21691
+ * {@link motionSources}, same shape and same discipline: a per-camera list
21692
+ * of sources the system understands, vendor-agnostic, owned here.
21693
+ *
21694
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
21695
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
21696
+ * here. Its boxes reach post-analysis on the same
21697
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
21698
+ * track gets the same tracker, the same overlay and the same detail
21699
+ * subtree (face / plate / embedding).
21700
+ *
21701
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
21702
+ * run, and that is where a camera with a usable onboard detector buys back
21703
+ * its share of the accelerator. It saves the root inference, not the decode
21704
+ * — the detail subtree still needs pixels to cut crops from.
21705
+ *
21706
+ * A camera whose onboard detections carry no geometry cannot serve as a root
21707
+ * step at all (there is nothing to track), and the cap that knows this says
21708
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
21709
+ * every battery camera: the boxes ride a sub-stream a battery camera never
21710
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
21711
+ * worth exactly what it already is — a wake signal with a class.
21712
+ *
21713
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
21714
+ * vendor never turns a detector on for the operator, and neither does a
21715
+ * default.
21716
+ */
21717
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
21445
21718
  pipelineEnabled: boolean().default(true),
21446
21719
  /** Ordered tree of video steps. Absent → runner skips video detection. */
21447
21720
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -21623,7 +21896,47 @@ var RunnerLocalMetricsSchema = object({
21623
21896
  queueDepth: number(),
21624
21897
  frameLazy: FrameLazyMetricsSchema.optional()
21625
21898
  });
21899
+ /**
21900
+ * Pipeline Runner capability — runtime detection workhorse.
21901
+ *
21902
+ * One instance per node. Receives camera assignments from
21903
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
21904
+ * decoded frames, drains motion + detection queues, calls the local
21905
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
21906
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
21907
+ * the bus.
21908
+ *
21909
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
21910
+ * runner has zero knowledge of other agents, no global state, and never
21911
+ * makes assignment decisions itself.
21912
+ */
21913
+ /**
21914
+ * Why a runner declined to look at a camera out of band. Named rather than a
21915
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
21916
+ * already mid-session and one already bursting are four different facts, and a
21917
+ * caller told only "no" cannot tell a protection from a bug.
21918
+ */
21919
+ var OccupancyBurstRefusalSchema = _enum([
21920
+ "not-attached",
21921
+ "battery-asleep",
21922
+ "not-watching",
21923
+ "already-bursting"
21924
+ ]);
21626
21925
  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({
21926
+ deviceId: number(),
21927
+ /** How many frames to collect. The caller sizes this against what its
21928
+ * own confirmation needs; the runner clamps it to the field's range. */
21929
+ frames: number().int().positive().optional(),
21930
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
21931
+ * defend — the periodic one at least has a timer to point at. */
21932
+ reason: string()
21933
+ }), object({
21934
+ started: boolean(),
21935
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
21936
+ }), {
21937
+ auth: "admin",
21938
+ kind: "mutation"
21939
+ }), method(object({
21627
21940
  handle: FrameHandleSchema,
21628
21941
  bbox: NativeCropBboxSchema,
21629
21942
  maxWidth: number().int().positive().optional(),
@@ -23993,10 +24306,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
23993
24306
  }), boolean()), method(object({
23994
24307
  deviceId: number().int().nonnegative(),
23995
24308
  sessionId: string()
23996
- }), object({ pendingRenegotiation: object({
23997
- target: WebrtcStreamTargetSchema,
23998
- epoch: number()
23999
- }).nullable() }));
24309
+ }), object({
24310
+ pendingRenegotiation: object({
24311
+ target: WebrtcStreamTargetSchema,
24312
+ epoch: number()
24313
+ }).nullable(),
24314
+ /**
24315
+ * Whether the session still EXISTS.
24316
+ *
24317
+ * A consumer that holds a resource for the life of a session needs to
24318
+ * be able to ask, because a session does not always end the way it
24319
+ * began. Measured on this hub 2026-09-13: an Echo that got stuck never
24320
+ * sent `SessionDisconnected`, so the Alexa exporter's
24321
+ * `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
24322
+ * H.264 transcode kept running for NOBODY for more than twenty
24323
+ * minutes. The WebRTC session had logged `WebRTC session closed`
24324
+ * minutes earlier — the broker knew; the holder had no way to ask.
24325
+ *
24326
+ * `false` for a session id the provider has never heard of, which is
24327
+ * the same answer as "it ended": either way nothing is holding it up.
24328
+ */
24329
+ alive: boolean()
24330
+ }));
24000
24331
  object({
24001
24332
  /** All accessory children of the parent. */
24002
24333
  childDeviceIds: array(number()).readonly(),
@@ -28435,11 +28766,46 @@ var NativeObjectDetectionStatusSchema = object({
28435
28766
  supportedClasses: array(NativeObjectClassEnum).readonly(),
28436
28767
  /**
28437
28768
  * Whether forwarding of onboard AI detections is enabled for this device.
28438
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
28439
- * churn the tracker, so forwarding stays off until the operator enables it.
28769
+ *
28770
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
28771
+ * camera runs — that is the operator's choice, and it is made where every
28772
+ * other detection choice is made. `geometry` on
28773
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
28774
+ * choice would buy this particular camera.
28440
28775
  */
28441
28776
  enabled: boolean()
28442
28777
  });
28778
+ /**
28779
+ * WHEN a camera's onboard detections carry geometry.
28780
+ *
28781
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
28782
+ * a detection is a trackable subject whenever the camera sees one.
28783
+ * - `while-streaming` — only while some stream of this camera is already open.
28784
+ * The boxes ride the video's own side-channel rather than a feed of their
28785
+ * own, so they cost nothing and they exist only when something is pulling.
28786
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
28787
+ * radio drain, but a camera that is awake is awake precisely because
28788
+ * something is in front of it, and its stream is already being pulled.
28789
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
28790
+ * pipeline needs geometry to make a subject, so such a push reaches the
28791
+ * tracker as motion and no further.
28792
+ *
28793
+ * Reported and not inferred, because the operator's question in front of the
28794
+ * picker is "what do I get", and these are three different answers (D14: the
28795
+ * derived form is only as honest as `getOptions`).
28796
+ */
28797
+ var NativeObjectGeometryEnum = _enum([
28798
+ "boxed",
28799
+ "while-streaming",
28800
+ "flag-only"
28801
+ ]);
28802
+ var NativeObjectDetectionOptionsSchema = object({
28803
+ /** Classes this firmware can detect — the same list the status reports. */
28804
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
28805
+ /** What a detection from this camera carries. */
28806
+ geometry: NativeObjectGeometryEnum
28807
+ });
28808
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
28443
28809
  var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
28444
28810
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
28445
28811
  lastFetchedAt: number() });
@@ -28449,13 +28815,23 @@ var nativeObjectDetectionCapability = {
28449
28815
  deviceNative: true,
28450
28816
  mode: "singleton",
28451
28817
  deviceTypes: [DeviceType.Camera],
28452
- methods: { setEnabled: method(object({
28453
- deviceId: number(),
28454
- enabled: boolean()
28455
- }), _void(), {
28456
- kind: "mutation",
28457
- auth: "admin"
28458
- }) },
28818
+ methods: {
28819
+ getOptions: method(object({ deviceId: number() }), NativeObjectDetectionOptionsSchema),
28820
+ setSettings: method(object({
28821
+ deviceId: number(),
28822
+ settings: NativeObjectDetectionSettingsPatchSchema
28823
+ }), _void(), {
28824
+ kind: "mutation",
28825
+ auth: "admin"
28826
+ }),
28827
+ setEnabled: method(object({
28828
+ deviceId: number(),
28829
+ enabled: boolean()
28830
+ }), _void(), {
28831
+ kind: "mutation",
28832
+ auth: "admin"
28833
+ })
28834
+ },
28459
28835
  events: { onDetected: { data: object({
28460
28836
  deviceId: number(),
28461
28837
  detection: NativeDetectionSchema
@@ -33303,7 +33679,28 @@ var PerScopeBreakdownSchema = object({
33303
33679
  /** Total tracked objects in this scope (frame / zone / unzoned). */
33304
33680
  totalObjects: number().int().nonnegative(),
33305
33681
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
33306
- byClass: record(string(), number().int().nonnegative())
33682
+ byClass: record(string(), number().int().nonnegative()),
33683
+ /**
33684
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
33685
+ * present but not going anywhere (a parked car, a bin, a statue).
33686
+ *
33687
+ * The operator's question about a scene has two halves and they answer
33688
+ * different things: "what is parked here" is stable for hours and must not
33689
+ * flap, while "who is walking through" is the thing an alert is about. One
33690
+ * number could only serve one of them, and `totalObjects` served the first
33691
+ * badly — a passer-by moved it and every occupancy rule saw a change.
33692
+ *
33693
+ * `standing + transient === totalObjects`, always. The total keeps its old
33694
+ * meaning exactly, so no rule written against it changes behaviour.
33695
+ *
33696
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
33697
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
33698
+ * parked objects here" about a camera whose lot is full.
33699
+ */
33700
+ standingObjects: number().int().nonnegative().optional(),
33701
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
33702
+ * same absence rule. */
33703
+ transientObjects: number().int().nonnegative().optional()
33307
33704
  });
33308
33705
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
33309
33706
  zoneId: string(),
@@ -33426,6 +33823,23 @@ var HistoryPointSchema = object({
33426
33823
  * triple covers the three spatial scopes (per-zone, frame-wide,
33427
33824
  * outside-any-zone). Crossing them with `className?` gives the full
33428
33825
  * combinatorial coverage the operator UI requested.
33826
+ *
33827
+ * ## ⚠️ The three history methods are DEPRECATED
33828
+ *
33829
+ * They are served from a 60-MINUTE in-memory ring. It dies with the process,
33830
+ * so after a restart they report nothing about a night that did happen, and any
33831
+ * window past an hour is silently clamped — a caller cannot tell a clamp from
33832
+ * an empty scene. The presets in the occupancy chart existed to hide that
33833
+ * horizon rather than to answer a question.
33834
+ *
33835
+ * Use `pipelineAnalytics.readLongTermSeries({ series: 'occupancy', scope })`
33836
+ * instead. Those rows are already written for every camera, ~60 bytes per
33837
+ * (camera, scope, 5-minute bucket), kept for a year, and survive a restart.
33838
+ * Spell the scope with `occupancyScope(zoneId?, className?)` — the same
33839
+ * function the writer uses, so the two cannot drift.
33840
+ *
33841
+ * The ring stays until these three go, and it is the only thing left reading
33842
+ * it. Do not add a fourth caller.
33429
33843
  */
33430
33844
  var zoneAnalyticsCapability = {
33431
33845
  name: "zone-analytics",
@@ -33915,6 +34329,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
33915
34329
  smoke: smokeCapability,
33916
34330
  streamCatalog: streamCatalogCapability,
33917
34331
  streamParams: streamParamsCapability,
34332
+ streamSignals: streamSignalsCapability,
33918
34333
  switch: switchCapability,
33919
34334
  tamper: tamperCapability,
33920
34335
  temperatureSensor: temperatureSensorCapability,
@@ -37824,12 +38239,24 @@ Object.freeze({
37824
38239
  addonId: null,
37825
38240
  access: "create"
37826
38241
  },
38242
+ "nativeObjectDetection.getOptions": {
38243
+ capName: "native-object-detection",
38244
+ capScope: "device",
38245
+ addonId: null,
38246
+ access: "view"
38247
+ },
37827
38248
  "nativeObjectDetection.setEnabled": {
37828
38249
  capName: "native-object-detection",
37829
38250
  capScope: "device",
37830
38251
  addonId: null,
37831
38252
  access: "create"
37832
38253
  },
38254
+ "nativeObjectDetection.setSettings": {
38255
+ capName: "native-object-detection",
38256
+ capScope: "device",
38257
+ addonId: null,
38258
+ access: "create"
38259
+ },
37833
38260
  "navigation.getFeatures": {
37834
38261
  capName: "navigation",
37835
38262
  capScope: "device",
@@ -38094,6 +38521,12 @@ Object.freeze({
38094
38521
  addonId: null,
38095
38522
  access: "view"
38096
38523
  },
38524
+ "notificationRules.getClipRetentionAsks": {
38525
+ capName: "notification-rules",
38526
+ capScope: "system",
38527
+ addonId: null,
38528
+ access: "view"
38529
+ },
38097
38530
  "notificationRules.getConditionCatalog": {
38098
38531
  capName: "notification-rules",
38099
38532
  capScope: "system",
@@ -38604,6 +39037,12 @@ Object.freeze({
38604
39037
  addonId: null,
38605
39038
  access: "create"
38606
39039
  },
39040
+ "pipelineAnalytics.readLongTermSeries": {
39041
+ capName: "pipeline-analytics",
39042
+ capScope: "device",
39043
+ addonId: null,
39044
+ access: "view"
39045
+ },
38607
39046
  "pipelineAnalytics.rebuildObjectEmbeddings": {
38608
39047
  capName: "pipeline-analytics",
38609
39048
  capScope: "device",
@@ -39276,6 +39715,12 @@ Object.freeze({
39276
39715
  addonId: null,
39277
39716
  access: "create"
39278
39717
  },
39718
+ "pipelineRunner.requestOccupancyBurst": {
39719
+ capName: "pipeline-runner",
39720
+ capScope: "system",
39721
+ addonId: null,
39722
+ access: "create"
39723
+ },
39279
39724
  "pipelineRunner.runDetailSubtree": {
39280
39725
  capName: "pipeline-runner",
39281
39726
  capScope: "system",
@@ -40488,6 +40933,12 @@ Object.freeze({
40488
40933
  addonId: null,
40489
40934
  access: "create"
40490
40935
  },
40936
+ "streamBroker.reportStreamSignal": {
40937
+ capName: "stream-broker",
40938
+ capScope: "system",
40939
+ addonId: null,
40940
+ access: "create"
40941
+ },
40491
40942
  "streamBroker.restartProfile": {
40492
40943
  capName: "stream-broker",
40493
40944
  capScope: "system",
@@ -40572,6 +41023,12 @@ Object.freeze({
40572
41023
  addonId: null,
40573
41024
  access: "create"
40574
41025
  },
41026
+ "streamSignals.listSignals": {
41027
+ capName: "stream-signals",
41028
+ capScope: "device",
41029
+ addonId: null,
41030
+ access: "view"
41031
+ },
40575
41032
  "switch.setState": {
40576
41033
  capName: "switch",
40577
41034
  capScope: "device",
@@ -42044,11 +42501,21 @@ Object.freeze({
42044
42501
  form: "single",
42045
42502
  optional: false
42046
42503
  }],
42504
+ "nativeObjectDetection.getOptions": [{
42505
+ name: "deviceId",
42506
+ form: "single",
42507
+ optional: false
42508
+ }],
42047
42509
  "nativeObjectDetection.setEnabled": [{
42048
42510
  name: "deviceId",
42049
42511
  form: "single",
42050
42512
  optional: false
42051
42513
  }],
42514
+ "nativeObjectDetection.setSettings": [{
42515
+ name: "deviceId",
42516
+ form: "single",
42517
+ optional: false
42518
+ }],
42052
42519
  "navigation.getFeatures": [{
42053
42520
  name: "deviceId",
42054
42521
  form: "single",
@@ -42398,6 +42865,11 @@ Object.freeze({
42398
42865
  form: "single",
42399
42866
  optional: false
42400
42867
  }],
42868
+ "pipelineAnalytics.readLongTermSeries": [{
42869
+ name: "deviceId",
42870
+ form: "single",
42871
+ optional: false
42872
+ }],
42401
42873
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
42402
42874
  name: "deviceId",
42403
42875
  form: "single",
@@ -42588,6 +43060,11 @@ Object.freeze({
42588
43060
  form: "single",
42589
43061
  optional: false
42590
43062
  }],
43063
+ "pipelineRunner.requestOccupancyBurst": [{
43064
+ name: "deviceId",
43065
+ form: "single",
43066
+ optional: false
43067
+ }],
42591
43068
  "pipelineRunner.runDetailSubtree": [{
42592
43069
  name: "deviceId",
42593
43070
  form: "single",
@@ -42944,6 +43421,11 @@ Object.freeze({
42944
43421
  form: "single",
42945
43422
  optional: false
42946
43423
  }],
43424
+ "streamBroker.reportStreamSignal": [{
43425
+ name: "deviceId",
43426
+ form: "single",
43427
+ optional: false
43428
+ }],
42947
43429
  "streamBroker.restartProfile": [{
42948
43430
  name: "deviceId",
42949
43431
  form: "single",