@camstack/addon-provider-tuya 0.2.101 → 0.2.103

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
@@ -818,7 +818,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
818
818
  return [...byId.values()];
819
819
  }
820
820
  //#endregion
821
- //#region ../types/dist/event-category-ZyX6jcse.mjs
821
+ //#region ../types/dist/event-category-BVDXG4tB.mjs
822
822
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
823
823
  EventCategory["SystemBoot"] = "system.boot";
824
824
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1435,6 +1435,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1435
1435
  * pull-reconcile from the provider's `getStatus` on reconnect. */
1436
1436
  EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
1437
1437
  EventCategory["BackupCompleted"] = "backup.completed";
1438
+ /**
1439
+ * A whole backup RUN finished — every destination attempted, win or lose.
1440
+ *
1441
+ * `backup.completed` fires once per DESTINATION, which is the right grain for
1442
+ * a progress UI and the wrong one for a notification: an operator with three
1443
+ * destinations would be told three times. And a run where two of three
1444
+ * destinations succeeded is not a clean success — a single "backup
1445
+ * completed" that hid the failed one would be a lie, so the count of each is
1446
+ * carried here and the message says both.
1447
+ *
1448
+ * Emitted by the backup orchestrator only after the destination loop, so a
1449
+ * run that dies during the BUILD phase produces no completion at all.
1450
+ */
1451
+ EventCategory["BackupRunCompleted"] = "backup.run-completed";
1438
1452
  EventCategory["BackupRestored"] = "backup.restored";
1439
1453
  EventCategory["NotificationDispatched"] = "notification.dispatched";
1440
1454
  EventCategory["NotificationFailed"] = "notification.failed";
@@ -6165,7 +6179,7 @@ var ZodIssueCode = {
6165
6179
  var ZodFirstPartyTypeKind;
6166
6180
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6167
6181
  //#endregion
6168
- //#region ../types/dist/sleep-DBKu2-U5.mjs
6182
+ //#region ../types/dist/sleep-BDR76Ykr.mjs
6169
6183
  /**
6170
6184
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6171
6185
  * window to float samples (D455).
@@ -12309,6 +12323,87 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
12309
12323
  auth: "admin"
12310
12324
  }), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
12311
12325
  DeviceType.Camera;
12326
+ /**
12327
+ * The signals a device can emit to WAKE its own stream.
12328
+ *
12329
+ * A camera whose stream is built on demand sleeps until something asks for it,
12330
+ * and "something" cannot be a consumer that is merely attached — a Frigate-style
12331
+ * puller holds a session open for ever, and treating that as demand would keep
12332
+ * a battery camera awake for ever, which is the whole thing the battery is for
12333
+ * (D173). So the wake has to come from the CAMERA: an event it noticed by
12334
+ * itself, with no stream running.
12335
+ *
12336
+ * ## The vocabulary is the PROVIDER'S, not ours
12337
+ *
12338
+ * Like `consumables`, this cap declares no vocabulary of its own. A provider
12339
+ * names each signal with a `code` it chooses and a `label` an operator reads.
12340
+ * Reolink offers motion and camera-native detection; another provider may offer
12341
+ * a tamper, a doorbell press, a PIR, or something no camera in this fleet has
12342
+ * yet. A fixed enum here would mean every new signal is a framework release.
12343
+ *
12344
+ * It is deliberately NOT derived from the caps a device already binds. Whether
12345
+ * a camera CAN push firmware motion is expressed by `motionSources` containing
12346
+ * `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
12347
+ * binding — but both answer "what drives the detection pipeline", which is a
12348
+ * different question from "what may wake a sleeping stream". A camera can do
12349
+ * the first and not be trusted with the second, and the operator picks per
12350
+ * camera. Two questions, two authorities.
12351
+ *
12352
+ * ## Availability is not permission
12353
+ *
12354
+ * `listSignals` says what the device CAN emit. Whether a given signal actually
12355
+ * wakes the stream is the operator's per-camera choice, held by the broker
12356
+ * alongside the cooldown — see the stream-broker cap's wake settings. A
12357
+ * provider declaring a signal is not a provider enabling it.
12358
+ */
12359
+ /** One signal a device can emit. */
12360
+ var StreamSignalSchema = object({
12361
+ /** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
12362
+ code: string().min(1),
12363
+ /** What an operator reads in the picker. The provider's own wording. */
12364
+ label: string().min(1),
12365
+ /**
12366
+ * Whether the provider recommends this signal ON when a camera is first set
12367
+ * up. A provider knows which of its signals are cheap and reliable; an
12368
+ * operator should not have to discover that by trial. Reolink recommends
12369
+ * both of its own.
12370
+ */
12371
+ recommended: boolean()
12372
+ });
12373
+ var StreamSignalsStatusSchema = object({
12374
+ signals: array(StreamSignalSchema),
12375
+ lastFetchedAt: number()
12376
+ });
12377
+ var streamSignalsCapability = {
12378
+ name: "stream-signals",
12379
+ scope: "device",
12380
+ deviceNative: true,
12381
+ mode: "singleton",
12382
+ deviceTypes: Object.values(DeviceType),
12383
+ runtimeState: StreamSignalsStatusSchema,
12384
+ /**
12385
+ * Runtime-state durability: **session** — mirrored in RAM, never written.
12386
+ *
12387
+ * The slice holds what the DEVICE says it can emit. That is a probed fact,
12388
+ * not an operator choice: the provider re-declares it on every registration,
12389
+ * so losing it loses nothing and persisting it would freeze an answer the
12390
+ * camera is entitled to change. Measured the same day on the sibling case —
12391
+ * `native-object-detection.supportedClasses` was persisted, and a firmware
12392
+ * class the camera really detected stayed missing for the life of the row
12393
+ * because the fix could not reach it.
12394
+ *
12395
+ * See `RuntimeStateDurability`. Enforced by
12396
+ * `scripts/check-runtime-state-durability.ts`.
12397
+ */
12398
+ durability: "session",
12399
+ methods: {
12400
+ /**
12401
+ * What this device can emit. Empty is a valid and common answer — most
12402
+ * cameras have nothing to offer here, and an empty list is what makes the
12403
+ * broker's picker show nothing rather than a false choice.
12404
+ */
12405
+ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
12406
+ };
12312
12407
  /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
12313
12408
  var StreamFormatSchema = _enum([
12314
12409
  "webrtc",
@@ -12705,6 +12800,22 @@ var EgressTranscodeSchema = object({
12705
12800
  camStreamId: string().nullable()
12706
12801
  });
12707
12802
  method(object({
12803
+ deviceId: number().int().nonnegative(),
12804
+ /** The provider's signal code. */
12805
+ code: string().min(1),
12806
+ /** Ms epoch. Absent ⇒ now. */
12807
+ at: number().optional()
12808
+ }), object({
12809
+ /** Whether the broker acted on it, and if not, why. */
12810
+ accepted: boolean(),
12811
+ reason: _enum([
12812
+ "woke",
12813
+ "hold-extended",
12814
+ "not-enabled",
12815
+ "no-consumer",
12816
+ "unknown-code"
12817
+ ])
12818
+ }), { kind: "mutation" }), method(object({
12708
12819
  deviceId: number().int().nonnegative(),
12709
12820
  camStreamId: string().min(1),
12710
12821
  kind: CamStreamKindSchema,
@@ -12959,6 +13070,16 @@ var PickStreamRequirementsSchema = object({
12959
13070
  acceptCodecs: array(StreamCodecSchema).readonly().optional(),
12960
13071
  /** Minimum vertical resolution. Streams shorter than this are dropped. */
12961
13072
  minHeight: number().int().positive().optional(),
13073
+ /**
13074
+ * Maximum vertical resolution. Streams TALLER than this are dropped.
13075
+ *
13076
+ * A consumer can have a ceiling as real as its floor: Alexa documents
13077
+ * 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
13078
+ * Without this the ceiling had to be re-implemented by every caller — and
13079
+ * one caller implementing it privately is how a second scoring authority
13080
+ * gets born.
13081
+ */
13082
+ maxHeight: number().int().positive().optional(),
12962
13083
  /** Minimum horizontal resolution. */
12963
13084
  minWidth: number().int().positive().optional(),
12964
13085
  /**
@@ -12975,7 +13096,22 @@ var PickStreamRequirementsSchema = object({
12975
13096
  * transcoded" guard: if the device is already serving the consumer's
12976
13097
  * codec end-to-end, there's nothing to optimise.
12977
13098
  */
12978
- requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
13099
+ requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
13100
+ /**
13101
+ * Whether a stream the consumer CANNOT decode may still be picked, on the
13102
+ * understanding that it will be transcoded.
13103
+ *
13104
+ * Default `false` — today's behaviour, and the right one for a bypass
13105
+ * question ("is there a stream I can forward untouched?"). Set `true` to
13106
+ * ask the larger question: "what is the best stream for me, transcoding if
13107
+ * I must?" A stream that satisfies `acceptCodecs` always outranks one that
13108
+ * does not, so a passthrough is never lost to a transcode; the answer says
13109
+ * which it is in {@link PickedCamStreamSchema.transcodes}.
13110
+ *
13111
+ * This is what lets one picker serve both the bypass and the full source
13112
+ * choice, instead of a consumer scoring privately when the bypass misses.
13113
+ */
13114
+ allowTranscode: boolean().optional()
12979
13115
  }).readonly();
12980
13116
  var PickStreamPreferencesSchema = object({
12981
13117
  /**
@@ -12989,12 +13125,32 @@ var PickStreamPreferencesSchema = object({
12989
13125
  * picks the tallest stream; `'lowest'` picks the shortest (used by
12990
13126
  * memory-constrained consumers / Apple Home guest sessions).
12991
13127
  */
12992
- resolutionPreference: _enum(["highest", "lowest"]).optional()
13128
+ resolutionPreference: _enum(["highest", "lowest"]).optional(),
13129
+ /**
13130
+ * The height the consumer actually wants to DELIVER.
13131
+ *
13132
+ * Not a constraint — an ordering. With it set, the SMALLEST stream at or
13133
+ * above the target wins, and only if nothing reaches it does the tallest
13134
+ * take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
13135
+ * a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
13136
+ * express that: it says "as big as possible", which is a different wish.
13137
+ *
13138
+ * Ignored when absent, so every existing caller keeps its ordering.
13139
+ */
13140
+ targetHeight: number().int().positive().optional()
12993
13141
  }).readonly();
12994
13142
  var PickedCamStreamSchema = object({
12995
13143
  camStreamId: string(),
12996
13144
  codec: string().optional(),
12997
13145
  resolution: CamStreamResolutionSchema.optional(),
13146
+ /**
13147
+ * Whether serving this stream requires a decode + re-encode.
13148
+ *
13149
+ * `false` is a stream the consumer can take as it stands. Only ever `true`
13150
+ * when the caller asked for it with `allowTranscode`, so a caller that did
13151
+ * not ask cannot be handed a cost it never agreed to pay.
13152
+ */
13153
+ transcodes: boolean(),
12998
13154
  /** One-line explanation of why this stream won — for logs / debug UI. */
12999
13155
  reason: string()
13000
13156
  });
@@ -17528,6 +17684,8 @@ var NcSystemEventKindSchema = _enum([
17528
17684
  "device-enabled",
17529
17685
  "device-battery-low",
17530
17686
  "device-battery-normal",
17687
+ "device-consumable-low",
17688
+ "device-consumable-normal",
17531
17689
  "stream-online",
17532
17690
  "stream-offline",
17533
17691
  "node-online",
@@ -17546,6 +17704,7 @@ var NcSystemEventKindSchema = _enum([
17546
17704
  "addon-updated",
17547
17705
  "server-updated",
17548
17706
  "export-completed",
17707
+ "backup-completed",
17549
17708
  "camera-online",
17550
17709
  "camera-offline",
17551
17710
  "camera-disabled",
@@ -18868,6 +19027,48 @@ var NcAlarmConfigSchema = object({
18868
19027
  settings: NcAlarmSettingsSchema,
18869
19028
  coverage: array(NcAlarmModeCoverageSchema)
18870
19029
  });
19030
+ /**
19031
+ * ONE rule's demand on ONE camera's clip ring.
19032
+ *
19033
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
19034
+ * camera, so the answer stays a faithful description of the rules and the
19035
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
19036
+ * lives. A camera that appears in no ask is being told **nothing** — which is
19037
+ * a different thing from never having been told, and only the envelope
19038
+ * (`rulesLoaded`) can tell those apart.
19039
+ */
19040
+ var NcClipRetentionAskSchema = object({
19041
+ /**
19042
+ * The camera this ask is about. **Absent = every camera**, which is what a
19043
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
19044
+ * asking everywhere.
19045
+ */
19046
+ deviceId: number().int().nonnegative().optional(),
19047
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
19048
+ * needs nothing produces no ask at all. */
19049
+ seconds: number().min(0).max(60),
19050
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
19051
+ * assigned, which is what the cut defaults to. */
19052
+ profile: CamProfileSchema.optional(),
19053
+ /** Who is asking — so a retention the operator did not expect names a rule. */
19054
+ ruleId: string(),
19055
+ ruleName: string(),
19056
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
19057
+ reason: _enum(["window", "occupancy"])
19058
+ });
19059
+ /**
19060
+ * The whole answer, with the one bit that keeps absence from reading as zero.
19061
+ *
19062
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
19063
+ * once. A centre that is up but has not read its rules yet answers with an
19064
+ * empty ask list that means nothing at all — applying it would drop every
19065
+ * camera's ring to zero for the first events after a restart, which is the
19066
+ * footage this mechanism exists to keep.
19067
+ */
19068
+ var NcClipRetentionPlanSchema = object({
19069
+ rulesLoaded: boolean(),
19070
+ asks: array(NcClipRetentionAskSchema).readonly()
19071
+ });
18871
19072
  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 }), {
18872
19073
  kind: "mutation",
18873
19074
  auth: "admin",
@@ -18888,7 +19089,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18888
19089
  }), object({ success: literal(true) }), {
18889
19090
  kind: "mutation",
18890
19091
  auth: "admin"
18891
- }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
19092
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18892
19093
  deviceId: number().int(),
18893
19094
  muted: boolean()
18894
19095
  }), object({ success: literal(true) }), {
@@ -21462,6 +21663,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
21462
21663
  * solid is this track", cheaper than re-deriving it from a trajectory. */
21463
21664
  framesMatched: number().int()
21464
21665
  })).readonly() });
21666
+ /**
21667
+ * The long-term series a camera produces. A closed union so a typo cannot
21668
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
21669
+ * is an alias of this, not a second list.
21670
+ */
21671
+ var AnalyticsLtsSeriesSchema = _enum([
21672
+ "motion",
21673
+ "audio-dbfs",
21674
+ "battery",
21675
+ "occupancy"
21676
+ ]);
21677
+ /**
21678
+ * One closed 5-minute bucket of a long-term series.
21679
+ *
21680
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
21681
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
21682
+ * that exists at all was measured; a bucket that is absent was not, which is a
21683
+ * different claim from zero and the reason this is a sparse series.
21684
+ */
21685
+ var LtsBucketSchema = object({
21686
+ scope: string(),
21687
+ bucketStart: number().int(),
21688
+ samples: number().int().nonnegative(),
21689
+ sum: number(),
21690
+ min: number(),
21691
+ max: number()
21692
+ });
21465
21693
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
21466
21694
  deviceId: number(),
21467
21695
  trackId: string()
@@ -21508,6 +21736,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
21508
21736
  kinds: array(string()).optional(),
21509
21737
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
21510
21738
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
21739
+ deviceId: number(),
21740
+ series: AnalyticsLtsSeriesSchema,
21741
+ /** Omit for EVERY scope of this series in the range. */
21742
+ scope: string().optional(),
21743
+ from: number(),
21744
+ to: number(),
21745
+ limit: number().int().positive().optional()
21746
+ }), array(LtsBucketSchema).readonly()), method(object({
21511
21747
  deviceId: number(),
21512
21748
  since: number(),
21513
21749
  until: number(),
@@ -22126,6 +22362,14 @@ var MotionSourceEnum = _enum([
22126
22362
  */
22127
22363
  var MotionSourcesSchema = array(MotionSourceEnum);
22128
22364
  /**
22365
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
22366
+ * post-analysis already tags every detection with (`DetectionSource`) rather
22367
+ * than a second spelling of the same two ideas — the value an operator picks
22368
+ * here is the value that comes back on the track, the overlay and the debug
22369
+ * row.
22370
+ */
22371
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
22372
+ /**
22129
22373
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
22130
22374
  * so cap-side consumers (the orchestrator forward, the runner addon's
22131
22375
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -22276,6 +22520,35 @@ var RunnerCameraConfigSchema = object({
22276
22520
  * events; the orchestrator forwards to `reportMotion`.
22277
22521
  */
22278
22522
  motionSources: MotionSourcesSchema.default(["analyzer"]),
22523
+ /**
22524
+ * WHICH root detector runs for this camera. The detection counterpart of
22525
+ * {@link motionSources}, same shape and same discipline: a per-camera list
22526
+ * of sources the system understands, vendor-agnostic, owned here.
22527
+ *
22528
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
22529
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
22530
+ * here. Its boxes reach post-analysis on the same
22531
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
22532
+ * track gets the same tracker, the same overlay and the same detail
22533
+ * subtree (face / plate / embedding).
22534
+ *
22535
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
22536
+ * run, and that is where a camera with a usable onboard detector buys back
22537
+ * its share of the accelerator. It saves the root inference, not the decode
22538
+ * — the detail subtree still needs pixels to cut crops from.
22539
+ *
22540
+ * A camera whose onboard detections carry no geometry cannot serve as a root
22541
+ * step at all (there is nothing to track), and the cap that knows this says
22542
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
22543
+ * every battery camera: the boxes ride a sub-stream a battery camera never
22544
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
22545
+ * worth exactly what it already is — a wake signal with a class.
22546
+ *
22547
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
22548
+ * vendor never turns a detector on for the operator, and neither does a
22549
+ * default.
22550
+ */
22551
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
22279
22552
  pipelineEnabled: boolean().default(true),
22280
22553
  /** Ordered tree of video steps. Absent → runner skips video detection. */
22281
22554
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -22457,7 +22730,47 @@ var RunnerLocalMetricsSchema = object({
22457
22730
  queueDepth: number(),
22458
22731
  frameLazy: FrameLazyMetricsSchema.optional()
22459
22732
  });
22733
+ /**
22734
+ * Pipeline Runner capability — runtime detection workhorse.
22735
+ *
22736
+ * One instance per node. Receives camera assignments from
22737
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
22738
+ * decoded frames, drains motion + detection queues, calls the local
22739
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
22740
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
22741
+ * the bus.
22742
+ *
22743
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
22744
+ * runner has zero knowledge of other agents, no global state, and never
22745
+ * makes assignment decisions itself.
22746
+ */
22747
+ /**
22748
+ * Why a runner declined to look at a camera out of band. Named rather than a
22749
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
22750
+ * already mid-session and one already bursting are four different facts, and a
22751
+ * caller told only "no" cannot tell a protection from a bug.
22752
+ */
22753
+ var OccupancyBurstRefusalSchema = _enum([
22754
+ "not-attached",
22755
+ "battery-asleep",
22756
+ "not-watching",
22757
+ "already-bursting"
22758
+ ]);
22460
22759
  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({
22760
+ deviceId: number(),
22761
+ /** How many frames to collect. The caller sizes this against what its
22762
+ * own confirmation needs; the runner clamps it to the field's range. */
22763
+ frames: number().int().positive().optional(),
22764
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
22765
+ * defend — the periodic one at least has a timer to point at. */
22766
+ reason: string()
22767
+ }), object({
22768
+ started: boolean(),
22769
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
22770
+ }), {
22771
+ auth: "admin",
22772
+ kind: "mutation"
22773
+ }), method(object({
22461
22774
  handle: FrameHandleSchema,
22462
22775
  bbox: NativeCropBboxSchema,
22463
22776
  maxWidth: number().int().positive().optional(),
@@ -24827,10 +25140,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
24827
25140
  }), boolean()), method(object({
24828
25141
  deviceId: number().int().nonnegative(),
24829
25142
  sessionId: string()
24830
- }), object({ pendingRenegotiation: object({
24831
- target: WebrtcStreamTargetSchema,
24832
- epoch: number()
24833
- }).nullable() }));
25143
+ }), object({
25144
+ pendingRenegotiation: object({
25145
+ target: WebrtcStreamTargetSchema,
25146
+ epoch: number()
25147
+ }).nullable(),
25148
+ /**
25149
+ * Whether the session still EXISTS.
25150
+ *
25151
+ * A consumer that holds a resource for the life of a session needs to
25152
+ * be able to ask, because a session does not always end the way it
25153
+ * began. Measured on this hub 2026-09-13: an Echo that got stuck never
25154
+ * sent `SessionDisconnected`, so the Alexa exporter's
25155
+ * `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
25156
+ * H.264 transcode kept running for NOBODY for more than twenty
25157
+ * minutes. The WebRTC session had logged `WebRTC session closed`
25158
+ * minutes earlier — the broker knew; the holder had no way to ask.
25159
+ *
25160
+ * `false` for a session id the provider has never heard of, which is
25161
+ * the same answer as "it ended": either way nothing is holding it up.
25162
+ */
25163
+ alive: boolean()
25164
+ }));
24834
25165
  object({
24835
25166
  /** All accessory children of the parent. */
24836
25167
  childDeviceIds: array(number()).readonly(),
@@ -29277,11 +29608,46 @@ var NativeObjectDetectionStatusSchema = object({
29277
29608
  supportedClasses: array(NativeObjectClassEnum).readonly(),
29278
29609
  /**
29279
29610
  * Whether forwarding of onboard AI detections is enabled for this device.
29280
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
29281
- * churn the tracker, so forwarding stays off until the operator enables it.
29611
+ *
29612
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
29613
+ * camera runs — that is the operator's choice, and it is made where every
29614
+ * other detection choice is made. `geometry` on
29615
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
29616
+ * choice would buy this particular camera.
29282
29617
  */
29283
29618
  enabled: boolean()
29284
29619
  });
29620
+ /**
29621
+ * WHEN a camera's onboard detections carry geometry.
29622
+ *
29623
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
29624
+ * a detection is a trackable subject whenever the camera sees one.
29625
+ * - `while-streaming` — only while some stream of this camera is already open.
29626
+ * The boxes ride the video's own side-channel rather than a feed of their
29627
+ * own, so they cost nothing and they exist only when something is pulling.
29628
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
29629
+ * radio drain, but a camera that is awake is awake precisely because
29630
+ * something is in front of it, and its stream is already being pulled.
29631
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
29632
+ * pipeline needs geometry to make a subject, so such a push reaches the
29633
+ * tracker as motion and no further.
29634
+ *
29635
+ * Reported and not inferred, because the operator's question in front of the
29636
+ * picker is "what do I get", and these are three different answers (D14: the
29637
+ * derived form is only as honest as `getOptions`).
29638
+ */
29639
+ var NativeObjectGeometryEnum = _enum([
29640
+ "boxed",
29641
+ "while-streaming",
29642
+ "flag-only"
29643
+ ]);
29644
+ var NativeObjectDetectionOptionsSchema = object({
29645
+ /** Classes this firmware can detect — the same list the status reports. */
29646
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
29647
+ /** What a detection from this camera carries. */
29648
+ geometry: NativeObjectGeometryEnum
29649
+ });
29650
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
29285
29651
  var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
29286
29652
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
29287
29653
  lastFetchedAt: number() });
@@ -29291,13 +29657,23 @@ var nativeObjectDetectionCapability = {
29291
29657
  deviceNative: true,
29292
29658
  mode: "singleton",
29293
29659
  deviceTypes: [DeviceType.Camera],
29294
- methods: { setEnabled: method(object({
29295
- deviceId: number(),
29296
- enabled: boolean()
29297
- }), _void(), {
29298
- kind: "mutation",
29299
- auth: "admin"
29300
- }) },
29660
+ methods: {
29661
+ getOptions: method(object({ deviceId: number() }), NativeObjectDetectionOptionsSchema),
29662
+ setSettings: method(object({
29663
+ deviceId: number(),
29664
+ settings: NativeObjectDetectionSettingsPatchSchema
29665
+ }), _void(), {
29666
+ kind: "mutation",
29667
+ auth: "admin"
29668
+ }),
29669
+ setEnabled: method(object({
29670
+ deviceId: number(),
29671
+ enabled: boolean()
29672
+ }), _void(), {
29673
+ kind: "mutation",
29674
+ auth: "admin"
29675
+ })
29676
+ },
29301
29677
  events: { onDetected: { data: object({
29302
29678
  deviceId: number(),
29303
29679
  detection: NativeDetectionSchema
@@ -34145,7 +34521,28 @@ var PerScopeBreakdownSchema = object({
34145
34521
  /** Total tracked objects in this scope (frame / zone / unzoned). */
34146
34522
  totalObjects: number().int().nonnegative(),
34147
34523
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
34148
- byClass: record(string(), number().int().nonnegative())
34524
+ byClass: record(string(), number().int().nonnegative()),
34525
+ /**
34526
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
34527
+ * present but not going anywhere (a parked car, a bin, a statue).
34528
+ *
34529
+ * The operator's question about a scene has two halves and they answer
34530
+ * different things: "what is parked here" is stable for hours and must not
34531
+ * flap, while "who is walking through" is the thing an alert is about. One
34532
+ * number could only serve one of them, and `totalObjects` served the first
34533
+ * badly — a passer-by moved it and every occupancy rule saw a change.
34534
+ *
34535
+ * `standing + transient === totalObjects`, always. The total keeps its old
34536
+ * meaning exactly, so no rule written against it changes behaviour.
34537
+ *
34538
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
34539
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
34540
+ * parked objects here" about a camera whose lot is full.
34541
+ */
34542
+ standingObjects: number().int().nonnegative().optional(),
34543
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
34544
+ * same absence rule. */
34545
+ transientObjects: number().int().nonnegative().optional()
34149
34546
  });
34150
34547
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
34151
34548
  zoneId: string(),
@@ -34268,6 +34665,23 @@ var HistoryPointSchema = object({
34268
34665
  * triple covers the three spatial scopes (per-zone, frame-wide,
34269
34666
  * outside-any-zone). Crossing them with `className?` gives the full
34270
34667
  * combinatorial coverage the operator UI requested.
34668
+ *
34669
+ * ## ⚠️ The three history methods are DEPRECATED
34670
+ *
34671
+ * They are served from a 60-MINUTE in-memory ring. It dies with the process,
34672
+ * so after a restart they report nothing about a night that did happen, and any
34673
+ * window past an hour is silently clamped — a caller cannot tell a clamp from
34674
+ * an empty scene. The presets in the occupancy chart existed to hide that
34675
+ * horizon rather than to answer a question.
34676
+ *
34677
+ * Use `pipelineAnalytics.readLongTermSeries({ series: 'occupancy', scope })`
34678
+ * instead. Those rows are already written for every camera, ~60 bytes per
34679
+ * (camera, scope, 5-minute bucket), kept for a year, and survive a restart.
34680
+ * Spell the scope with `occupancyScope(zoneId?, className?)` — the same
34681
+ * function the writer uses, so the two cannot drift.
34682
+ *
34683
+ * The ring stays until these three go, and it is the only thing left reading
34684
+ * it. Do not add a fourth caller.
34271
34685
  */
34272
34686
  var zoneAnalyticsCapability = {
34273
34687
  name: "zone-analytics",
@@ -34757,6 +35171,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
34757
35171
  smoke: smokeCapability,
34758
35172
  streamCatalog: streamCatalogCapability,
34759
35173
  streamParams: streamParamsCapability,
35174
+ streamSignals: streamSignalsCapability,
34760
35175
  switch: switchCapability,
34761
35176
  tamper: tamperCapability,
34762
35177
  temperatureSensor: temperatureSensorCapability,
@@ -38666,12 +39081,24 @@ Object.freeze({
38666
39081
  addonId: null,
38667
39082
  access: "create"
38668
39083
  },
39084
+ "nativeObjectDetection.getOptions": {
39085
+ capName: "native-object-detection",
39086
+ capScope: "device",
39087
+ addonId: null,
39088
+ access: "view"
39089
+ },
38669
39090
  "nativeObjectDetection.setEnabled": {
38670
39091
  capName: "native-object-detection",
38671
39092
  capScope: "device",
38672
39093
  addonId: null,
38673
39094
  access: "create"
38674
39095
  },
39096
+ "nativeObjectDetection.setSettings": {
39097
+ capName: "native-object-detection",
39098
+ capScope: "device",
39099
+ addonId: null,
39100
+ access: "create"
39101
+ },
38675
39102
  "navigation.getFeatures": {
38676
39103
  capName: "navigation",
38677
39104
  capScope: "device",
@@ -38936,6 +39363,12 @@ Object.freeze({
38936
39363
  addonId: null,
38937
39364
  access: "view"
38938
39365
  },
39366
+ "notificationRules.getClipRetentionAsks": {
39367
+ capName: "notification-rules",
39368
+ capScope: "system",
39369
+ addonId: null,
39370
+ access: "view"
39371
+ },
38939
39372
  "notificationRules.getConditionCatalog": {
38940
39373
  capName: "notification-rules",
38941
39374
  capScope: "system",
@@ -39446,6 +39879,12 @@ Object.freeze({
39446
39879
  addonId: null,
39447
39880
  access: "create"
39448
39881
  },
39882
+ "pipelineAnalytics.readLongTermSeries": {
39883
+ capName: "pipeline-analytics",
39884
+ capScope: "device",
39885
+ addonId: null,
39886
+ access: "view"
39887
+ },
39449
39888
  "pipelineAnalytics.rebuildObjectEmbeddings": {
39450
39889
  capName: "pipeline-analytics",
39451
39890
  capScope: "device",
@@ -40118,6 +40557,12 @@ Object.freeze({
40118
40557
  addonId: null,
40119
40558
  access: "create"
40120
40559
  },
40560
+ "pipelineRunner.requestOccupancyBurst": {
40561
+ capName: "pipeline-runner",
40562
+ capScope: "system",
40563
+ addonId: null,
40564
+ access: "create"
40565
+ },
40121
40566
  "pipelineRunner.runDetailSubtree": {
40122
40567
  capName: "pipeline-runner",
40123
40568
  capScope: "system",
@@ -41330,6 +41775,12 @@ Object.freeze({
41330
41775
  addonId: null,
41331
41776
  access: "create"
41332
41777
  },
41778
+ "streamBroker.reportStreamSignal": {
41779
+ capName: "stream-broker",
41780
+ capScope: "system",
41781
+ addonId: null,
41782
+ access: "create"
41783
+ },
41333
41784
  "streamBroker.restartProfile": {
41334
41785
  capName: "stream-broker",
41335
41786
  capScope: "system",
@@ -41414,6 +41865,12 @@ Object.freeze({
41414
41865
  addonId: null,
41415
41866
  access: "create"
41416
41867
  },
41868
+ "streamSignals.listSignals": {
41869
+ capName: "stream-signals",
41870
+ capScope: "device",
41871
+ addonId: null,
41872
+ access: "view"
41873
+ },
41417
41874
  "switch.setState": {
41418
41875
  capName: "switch",
41419
41876
  capScope: "device",
@@ -42886,11 +43343,21 @@ Object.freeze({
42886
43343
  form: "single",
42887
43344
  optional: false
42888
43345
  }],
43346
+ "nativeObjectDetection.getOptions": [{
43347
+ name: "deviceId",
43348
+ form: "single",
43349
+ optional: false
43350
+ }],
42889
43351
  "nativeObjectDetection.setEnabled": [{
42890
43352
  name: "deviceId",
42891
43353
  form: "single",
42892
43354
  optional: false
42893
43355
  }],
43356
+ "nativeObjectDetection.setSettings": [{
43357
+ name: "deviceId",
43358
+ form: "single",
43359
+ optional: false
43360
+ }],
42894
43361
  "navigation.getFeatures": [{
42895
43362
  name: "deviceId",
42896
43363
  form: "single",
@@ -43240,6 +43707,11 @@ Object.freeze({
43240
43707
  form: "single",
43241
43708
  optional: false
43242
43709
  }],
43710
+ "pipelineAnalytics.readLongTermSeries": [{
43711
+ name: "deviceId",
43712
+ form: "single",
43713
+ optional: false
43714
+ }],
43243
43715
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
43244
43716
  name: "deviceId",
43245
43717
  form: "single",
@@ -43430,6 +43902,11 @@ Object.freeze({
43430
43902
  form: "single",
43431
43903
  optional: false
43432
43904
  }],
43905
+ "pipelineRunner.requestOccupancyBurst": [{
43906
+ name: "deviceId",
43907
+ form: "single",
43908
+ optional: false
43909
+ }],
43433
43910
  "pipelineRunner.runDetailSubtree": [{
43434
43911
  name: "deviceId",
43435
43912
  form: "single",
@@ -43786,6 +44263,11 @@ Object.freeze({
43786
44263
  form: "single",
43787
44264
  optional: false
43788
44265
  }],
44266
+ "streamBroker.reportStreamSignal": [{
44267
+ name: "deviceId",
44268
+ form: "single",
44269
+ optional: false
44270
+ }],
43789
44271
  "streamBroker.restartProfile": [{
43790
44272
  name: "deviceId",
43791
44273
  form: "single",