@camstack/addon-provider-hikvision 1.2.109 → 1.2.111

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 +513 -31
  2. package/dist/addon.mjs +513 -31
  3. package/package.json +2 -2
package/dist/addon.mjs CHANGED
@@ -7,7 +7,7 @@ import { networkInterfaces } from "node:os";
7
7
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
8
8
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
9
9
  //#endregion
10
- //#region ../types/dist/event-category-ZyX6jcse.mjs
10
+ //#region ../types/dist/event-category-BVDXG4tB.mjs
11
11
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
12
12
  EventCategory["SystemBoot"] = "system.boot";
13
13
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -624,6 +624,20 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
624
624
  * pull-reconcile from the provider's `getStatus` on reconnect. */
625
625
  EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
626
626
  EventCategory["BackupCompleted"] = "backup.completed";
627
+ /**
628
+ * A whole backup RUN finished — every destination attempted, win or lose.
629
+ *
630
+ * `backup.completed` fires once per DESTINATION, which is the right grain for
631
+ * a progress UI and the wrong one for a notification: an operator with three
632
+ * destinations would be told three times. And a run where two of three
633
+ * destinations succeeded is not a clean success — a single "backup
634
+ * completed" that hid the failed one would be a lie, so the count of each is
635
+ * carried here and the message says both.
636
+ *
637
+ * Emitted by the backup orchestrator only after the destination loop, so a
638
+ * run that dies during the BUILD phase produces no completion at all.
639
+ */
640
+ EventCategory["BackupRunCompleted"] = "backup.run-completed";
627
641
  EventCategory["BackupRestored"] = "backup.restored";
628
642
  EventCategory["NotificationDispatched"] = "notification.dispatched";
629
643
  EventCategory["NotificationFailed"] = "notification.failed";
@@ -5354,7 +5368,7 @@ var ZodIssueCode = {
5354
5368
  var ZodFirstPartyTypeKind;
5355
5369
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5356
5370
  //#endregion
5357
- //#region ../types/dist/sleep-DBKu2-U5.mjs
5371
+ //#region ../types/dist/sleep-BDR76Ykr.mjs
5358
5372
  /**
5359
5373
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5360
5374
  * window to float samples (D455).
@@ -7239,6 +7253,18 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7239
7253
  DeviceRole["GenericNotifier"] = "generic-notifier";
7240
7254
  return DeviceRole;
7241
7255
  }({});
7256
+ function deviceCustomAction(input, output, options) {
7257
+ return {
7258
+ input,
7259
+ output,
7260
+ kind: options?.kind ?? "query",
7261
+ auth: options?.auth ?? "protected",
7262
+ scope: {
7263
+ kind: "device",
7264
+ ...options?.deviceTypes ? { deviceTypes: options.deviceTypes } : {}
7265
+ }
7266
+ };
7267
+ }
7242
7268
  var StaticDirOutputSchema = object({ staticDir: string() });
7243
7269
  var VersionOutputSchema = object({ version: string() });
7244
7270
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
@@ -11767,6 +11793,87 @@ method(ListInputSchema, array(BrokerInfoSchema$1)), method(GetInputSchema, Broke
11767
11793
  auth: "admin"
11768
11794
  }), method(GetStateInputSchema, unknown().nullable()), method(_void(), RegistryStatusSchema);
11769
11795
  DeviceType.Camera;
11796
+ /**
11797
+ * The signals a device can emit to WAKE its own stream.
11798
+ *
11799
+ * A camera whose stream is built on demand sleeps until something asks for it,
11800
+ * and "something" cannot be a consumer that is merely attached — a Frigate-style
11801
+ * puller holds a session open for ever, and treating that as demand would keep
11802
+ * a battery camera awake for ever, which is the whole thing the battery is for
11803
+ * (D173). So the wake has to come from the CAMERA: an event it noticed by
11804
+ * itself, with no stream running.
11805
+ *
11806
+ * ## The vocabulary is the PROVIDER'S, not ours
11807
+ *
11808
+ * Like `consumables`, this cap declares no vocabulary of its own. A provider
11809
+ * names each signal with a `code` it chooses and a `label` an operator reads.
11810
+ * Reolink offers motion and camera-native detection; another provider may offer
11811
+ * a tamper, a doorbell press, a PIR, or something no camera in this fleet has
11812
+ * yet. A fixed enum here would mean every new signal is a framework release.
11813
+ *
11814
+ * It is deliberately NOT derived from the caps a device already binds. Whether
11815
+ * a camera CAN push firmware motion is expressed by `motionSources` containing
11816
+ * `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
11817
+ * binding — but both answer "what drives the detection pipeline", which is a
11818
+ * different question from "what may wake a sleeping stream". A camera can do
11819
+ * the first and not be trusted with the second, and the operator picks per
11820
+ * camera. Two questions, two authorities.
11821
+ *
11822
+ * ## Availability is not permission
11823
+ *
11824
+ * `listSignals` says what the device CAN emit. Whether a given signal actually
11825
+ * wakes the stream is the operator's per-camera choice, held by the broker
11826
+ * alongside the cooldown — see the stream-broker cap's wake settings. A
11827
+ * provider declaring a signal is not a provider enabling it.
11828
+ */
11829
+ /** One signal a device can emit. */
11830
+ var StreamSignalSchema = object({
11831
+ /** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
11832
+ code: string().min(1),
11833
+ /** What an operator reads in the picker. The provider's own wording. */
11834
+ label: string().min(1),
11835
+ /**
11836
+ * Whether the provider recommends this signal ON when a camera is first set
11837
+ * up. A provider knows which of its signals are cheap and reliable; an
11838
+ * operator should not have to discover that by trial. Reolink recommends
11839
+ * both of its own.
11840
+ */
11841
+ recommended: boolean()
11842
+ });
11843
+ var StreamSignalsStatusSchema = object({
11844
+ signals: array(StreamSignalSchema),
11845
+ lastFetchedAt: number()
11846
+ });
11847
+ var streamSignalsCapability = {
11848
+ name: "stream-signals",
11849
+ scope: "device",
11850
+ deviceNative: true,
11851
+ mode: "singleton",
11852
+ deviceTypes: Object.values(DeviceType),
11853
+ runtimeState: StreamSignalsStatusSchema,
11854
+ /**
11855
+ * Runtime-state durability: **session** — mirrored in RAM, never written.
11856
+ *
11857
+ * The slice holds what the DEVICE says it can emit. That is a probed fact,
11858
+ * not an operator choice: the provider re-declares it on every registration,
11859
+ * so losing it loses nothing and persisting it would freeze an answer the
11860
+ * camera is entitled to change. Measured the same day on the sibling case —
11861
+ * `native-object-detection.supportedClasses` was persisted, and a firmware
11862
+ * class the camera really detected stayed missing for the life of the row
11863
+ * because the fix could not reach it.
11864
+ *
11865
+ * See `RuntimeStateDurability`. Enforced by
11866
+ * `scripts/check-runtime-state-durability.ts`.
11867
+ */
11868
+ durability: "session",
11869
+ methods: {
11870
+ /**
11871
+ * What this device can emit. Empty is a valid and common answer — most
11872
+ * cameras have nothing to offer here, and an empty list is what makes the
11873
+ * broker's picker show nothing rather than a false choice.
11874
+ */
11875
+ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
11876
+ };
11770
11877
  /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
11771
11878
  var StreamFormatSchema = _enum([
11772
11879
  "webrtc",
@@ -12163,6 +12270,22 @@ var EgressTranscodeSchema = object({
12163
12270
  camStreamId: string().nullable()
12164
12271
  });
12165
12272
  method(object({
12273
+ deviceId: number().int().nonnegative(),
12274
+ /** The provider's signal code. */
12275
+ code: string().min(1),
12276
+ /** Ms epoch. Absent ⇒ now. */
12277
+ at: number().optional()
12278
+ }), object({
12279
+ /** Whether the broker acted on it, and if not, why. */
12280
+ accepted: boolean(),
12281
+ reason: _enum([
12282
+ "woke",
12283
+ "hold-extended",
12284
+ "not-enabled",
12285
+ "no-consumer",
12286
+ "unknown-code"
12287
+ ])
12288
+ }), { kind: "mutation" }), method(object({
12166
12289
  deviceId: number().int().nonnegative(),
12167
12290
  camStreamId: string().min(1),
12168
12291
  kind: CamStreamKindSchema,
@@ -12417,6 +12540,16 @@ var PickStreamRequirementsSchema = object({
12417
12540
  acceptCodecs: array(StreamCodecSchema).readonly().optional(),
12418
12541
  /** Minimum vertical resolution. Streams shorter than this are dropped. */
12419
12542
  minHeight: number().int().positive().optional(),
12543
+ /**
12544
+ * Maximum vertical resolution. Streams TALLER than this are dropped.
12545
+ *
12546
+ * A consumer can have a ceiling as real as its floor: Alexa documents
12547
+ * 480p to 1080p, and a 4K stream is as unusable to an Echo as a 360p one.
12548
+ * Without this the ceiling had to be re-implemented by every caller — and
12549
+ * one caller implementing it privately is how a second scoring authority
12550
+ * gets born.
12551
+ */
12552
+ maxHeight: number().int().positive().optional(),
12420
12553
  /** Minimum horizontal resolution. */
12421
12554
  minWidth: number().int().positive().optional(),
12422
12555
  /**
@@ -12433,7 +12566,22 @@ var PickStreamRequirementsSchema = object({
12433
12566
  * transcoded" guard: if the device is already serving the consumer's
12434
12567
  * codec end-to-end, there's nothing to optimise.
12435
12568
  */
12436
- requireSiblingCodec: array(StreamCodecSchema).readonly().optional()
12569
+ requireSiblingCodec: array(StreamCodecSchema).readonly().optional(),
12570
+ /**
12571
+ * Whether a stream the consumer CANNOT decode may still be picked, on the
12572
+ * understanding that it will be transcoded.
12573
+ *
12574
+ * Default `false` — today's behaviour, and the right one for a bypass
12575
+ * question ("is there a stream I can forward untouched?"). Set `true` to
12576
+ * ask the larger question: "what is the best stream for me, transcoding if
12577
+ * I must?" A stream that satisfies `acceptCodecs` always outranks one that
12578
+ * does not, so a passthrough is never lost to a transcode; the answer says
12579
+ * which it is in {@link PickedCamStreamSchema.transcodes}.
12580
+ *
12581
+ * This is what lets one picker serve both the bypass and the full source
12582
+ * choice, instead of a consumer scoring privately when the bypass misses.
12583
+ */
12584
+ allowTranscode: boolean().optional()
12437
12585
  }).readonly();
12438
12586
  var PickStreamPreferencesSchema = object({
12439
12587
  /**
@@ -12447,12 +12595,32 @@ var PickStreamPreferencesSchema = object({
12447
12595
  * picks the tallest stream; `'lowest'` picks the shortest (used by
12448
12596
  * memory-constrained consumers / Apple Home guest sessions).
12449
12597
  */
12450
- resolutionPreference: _enum(["highest", "lowest"]).optional()
12598
+ resolutionPreference: _enum(["highest", "lowest"]).optional(),
12599
+ /**
12600
+ * The height the consumer actually wants to DELIVER.
12601
+ *
12602
+ * Not a constraint — an ordering. With it set, the SMALLEST stream at or
12603
+ * above the target wins, and only if nothing reaches it does the tallest
12604
+ * take over. Pulling 1296 lines to draw 720 on a 1280x800 Echo panel costs
12605
+ * a decode and buys nothing, and `resolutionPreference: 'highest'` cannot
12606
+ * express that: it says "as big as possible", which is a different wish.
12607
+ *
12608
+ * Ignored when absent, so every existing caller keeps its ordering.
12609
+ */
12610
+ targetHeight: number().int().positive().optional()
12451
12611
  }).readonly();
12452
12612
  var PickedCamStreamSchema = object({
12453
12613
  camStreamId: string(),
12454
12614
  codec: string().optional(),
12455
12615
  resolution: CamStreamResolutionSchema.optional(),
12616
+ /**
12617
+ * Whether serving this stream requires a decode + re-encode.
12618
+ *
12619
+ * `false` is a stream the consumer can take as it stands. Only ever `true`
12620
+ * when the caller asked for it with `allowTranscode`, so a caller that did
12621
+ * not ask cannot be handed a cost it never agreed to pay.
12622
+ */
12623
+ transcodes: boolean(),
12456
12624
  /** One-line explanation of why this stream won — for logs / debug UI. */
12457
12625
  reason: string()
12458
12626
  });
@@ -12671,18 +12839,6 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
12671
12839
  filePath: string(),
12672
12840
  content: string()
12673
12841
  })) }), { auth: "admin" });
12674
- function deviceCustomAction(input, output, options) {
12675
- return {
12676
- input,
12677
- output,
12678
- kind: options?.kind ?? "query",
12679
- auth: options?.auth ?? "protected",
12680
- scope: {
12681
- kind: "device",
12682
- ...options?.deviceTypes ? { deviceTypes: options.deviceTypes } : {}
12683
- }
12684
- };
12685
- }
12686
12842
  /**
12687
12843
  * `custom-model-registry` — collection cap exposing operator-registered
12688
12844
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -17000,6 +17156,8 @@ var NcSystemEventKindSchema = _enum([
17000
17156
  "device-enabled",
17001
17157
  "device-battery-low",
17002
17158
  "device-battery-normal",
17159
+ "device-consumable-low",
17160
+ "device-consumable-normal",
17003
17161
  "stream-online",
17004
17162
  "stream-offline",
17005
17163
  "node-online",
@@ -17018,6 +17176,7 @@ var NcSystemEventKindSchema = _enum([
17018
17176
  "addon-updated",
17019
17177
  "server-updated",
17020
17178
  "export-completed",
17179
+ "backup-completed",
17021
17180
  "camera-online",
17022
17181
  "camera-offline",
17023
17182
  "camera-disabled",
@@ -18340,6 +18499,48 @@ var NcAlarmConfigSchema = object({
18340
18499
  settings: NcAlarmSettingsSchema,
18341
18500
  coverage: array(NcAlarmModeCoverageSchema)
18342
18501
  });
18502
+ /**
18503
+ * ONE rule's demand on ONE camera's clip ring.
18504
+ *
18505
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
18506
+ * camera, so the answer stays a faithful description of the rules and the
18507
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
18508
+ * lives. A camera that appears in no ask is being told **nothing** — which is
18509
+ * a different thing from never having been told, and only the envelope
18510
+ * (`rulesLoaded`) can tell those apart.
18511
+ */
18512
+ var NcClipRetentionAskSchema = object({
18513
+ /**
18514
+ * The camera this ask is about. **Absent = every camera**, which is what a
18515
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
18516
+ * asking everywhere.
18517
+ */
18518
+ deviceId: number().int().nonnegative().optional(),
18519
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
18520
+ * needs nothing produces no ask at all. */
18521
+ seconds: number().min(0).max(60),
18522
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
18523
+ * assigned, which is what the cut defaults to. */
18524
+ profile: CamProfileSchema.optional(),
18525
+ /** Who is asking — so a retention the operator did not expect names a rule. */
18526
+ ruleId: string(),
18527
+ ruleName: string(),
18528
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
18529
+ reason: _enum(["window", "occupancy"])
18530
+ });
18531
+ /**
18532
+ * The whole answer, with the one bit that keeps absence from reading as zero.
18533
+ *
18534
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
18535
+ * once. A centre that is up but has not read its rules yet answers with an
18536
+ * empty ask list that means nothing at all — applying it would drop every
18537
+ * camera's ring to zero for the first events after a restart, which is the
18538
+ * footage this mechanism exists to keep.
18539
+ */
18540
+ var NcClipRetentionPlanSchema = object({
18541
+ rulesLoaded: boolean(),
18542
+ asks: array(NcClipRetentionAskSchema).readonly()
18543
+ });
18343
18544
  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 }), {
18344
18545
  kind: "mutation",
18345
18546
  auth: "admin",
@@ -18360,7 +18561,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18360
18561
  }), object({ success: literal(true) }), {
18361
18562
  kind: "mutation",
18362
18563
  auth: "admin"
18363
- }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18564
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number().int()).readonly() }), { auth: "admin" }), method(object({
18364
18565
  deviceId: number().int(),
18365
18566
  muted: boolean()
18366
18567
  }), object({ success: literal(true) }), {
@@ -20934,6 +21135,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
20934
21135
  * solid is this track", cheaper than re-deriving it from a trajectory. */
20935
21136
  framesMatched: number().int()
20936
21137
  })).readonly() });
21138
+ /**
21139
+ * The long-term series a camera produces. A closed union so a typo cannot
21140
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
21141
+ * is an alias of this, not a second list.
21142
+ */
21143
+ var AnalyticsLtsSeriesSchema = _enum([
21144
+ "motion",
21145
+ "audio-dbfs",
21146
+ "battery",
21147
+ "occupancy"
21148
+ ]);
21149
+ /**
21150
+ * One closed 5-minute bucket of a long-term series.
21151
+ *
21152
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
21153
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
21154
+ * that exists at all was measured; a bucket that is absent was not, which is a
21155
+ * different claim from zero and the reason this is a sparse series.
21156
+ */
21157
+ var LtsBucketSchema = object({
21158
+ scope: string(),
21159
+ bucketStart: number().int(),
21160
+ samples: number().int().nonnegative(),
21161
+ sum: number(),
21162
+ min: number(),
21163
+ max: number()
21164
+ });
20937
21165
  DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).readonly()), method(object({
20938
21166
  deviceId: number(),
20939
21167
  trackId: string()
@@ -20980,6 +21208,14 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
20980
21208
  kinds: array(string()).optional(),
20981
21209
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
20982
21210
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
21211
+ deviceId: number(),
21212
+ series: AnalyticsLtsSeriesSchema,
21213
+ /** Omit for EVERY scope of this series in the range. */
21214
+ scope: string().optional(),
21215
+ from: number(),
21216
+ to: number(),
21217
+ limit: number().int().positive().optional()
21218
+ }), array(LtsBucketSchema).readonly()), method(object({
20983
21219
  deviceId: number(),
20984
21220
  since: number(),
20985
21221
  until: number(),
@@ -21598,6 +21834,14 @@ var MotionSourceEnum = _enum([
21598
21834
  */
21599
21835
  var MotionSourcesSchema = array(MotionSourceEnum);
21600
21836
  /**
21837
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
21838
+ * post-analysis already tags every detection with (`DetectionSource`) rather
21839
+ * than a second spelling of the same two ideas — the value an operator picks
21840
+ * here is the value that comes back on the track, the overlay and the debug
21841
+ * row.
21842
+ */
21843
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
21844
+ /**
21601
21845
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
21602
21846
  * so cap-side consumers (the orchestrator forward, the runner addon's
21603
21847
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -21748,6 +21992,35 @@ var RunnerCameraConfigSchema = object({
21748
21992
  * events; the orchestrator forwards to `reportMotion`.
21749
21993
  */
21750
21994
  motionSources: MotionSourcesSchema.default(["analyzer"]),
21995
+ /**
21996
+ * WHICH root detector runs for this camera. The detection counterpart of
21997
+ * {@link motionSources}, same shape and same discipline: a per-camera list
21998
+ * of sources the system understands, vendor-agnostic, owned here.
21999
+ *
22000
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
22001
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
22002
+ * here. Its boxes reach post-analysis on the same
22003
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
22004
+ * track gets the same tracker, the same overlay and the same detail
22005
+ * subtree (face / plate / embedding).
22006
+ *
22007
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
22008
+ * run, and that is where a camera with a usable onboard detector buys back
22009
+ * its share of the accelerator. It saves the root inference, not the decode
22010
+ * — the detail subtree still needs pixels to cut crops from.
22011
+ *
22012
+ * A camera whose onboard detections carry no geometry cannot serve as a root
22013
+ * step at all (there is nothing to track), and the cap that knows this says
22014
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
22015
+ * every battery camera: the boxes ride a sub-stream a battery camera never
22016
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
22017
+ * worth exactly what it already is — a wake signal with a class.
22018
+ *
22019
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
22020
+ * vendor never turns a detector on for the operator, and neither does a
22021
+ * default.
22022
+ */
22023
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
21751
22024
  pipelineEnabled: boolean().default(true),
21752
22025
  /** Ordered tree of video steps. Absent → runner skips video detection. */
21753
22026
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -21929,7 +22202,47 @@ var RunnerLocalMetricsSchema = object({
21929
22202
  queueDepth: number(),
21930
22203
  frameLazy: FrameLazyMetricsSchema.optional()
21931
22204
  });
22205
+ /**
22206
+ * Pipeline Runner capability — runtime detection workhorse.
22207
+ *
22208
+ * One instance per node. Receives camera assignments from
22209
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
22210
+ * decoded frames, drains motion + detection queues, calls the local
22211
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
22212
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
22213
+ * the bus.
22214
+ *
22215
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
22216
+ * runner has zero knowledge of other agents, no global state, and never
22217
+ * makes assignment decisions itself.
22218
+ */
22219
+ /**
22220
+ * Why a runner declined to look at a camera out of band. Named rather than a
22221
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
22222
+ * already mid-session and one already bursting are four different facts, and a
22223
+ * caller told only "no" cannot tell a protection from a bug.
22224
+ */
22225
+ var OccupancyBurstRefusalSchema = _enum([
22226
+ "not-attached",
22227
+ "battery-asleep",
22228
+ "not-watching",
22229
+ "already-bursting"
22230
+ ]);
21932
22231
  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({
22232
+ deviceId: number(),
22233
+ /** How many frames to collect. The caller sizes this against what its
22234
+ * own confirmation needs; the runner clamps it to the field's range. */
22235
+ frames: number().int().positive().optional(),
22236
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
22237
+ * defend — the periodic one at least has a timer to point at. */
22238
+ reason: string()
22239
+ }), object({
22240
+ started: boolean(),
22241
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
22242
+ }), {
22243
+ auth: "admin",
22244
+ kind: "mutation"
22245
+ }), method(object({
21933
22246
  handle: FrameHandleSchema,
21934
22247
  bbox: NativeCropBboxSchema,
21935
22248
  maxWidth: number().int().positive().optional(),
@@ -24403,10 +24716,28 @@ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), ar
24403
24716
  }), boolean()), method(object({
24404
24717
  deviceId: number().int().nonnegative(),
24405
24718
  sessionId: string()
24406
- }), object({ pendingRenegotiation: object({
24407
- target: WebrtcStreamTargetSchema,
24408
- epoch: number()
24409
- }).nullable() }));
24719
+ }), object({
24720
+ pendingRenegotiation: object({
24721
+ target: WebrtcStreamTargetSchema,
24722
+ epoch: number()
24723
+ }).nullable(),
24724
+ /**
24725
+ * Whether the session still EXISTS.
24726
+ *
24727
+ * A consumer that holds a resource for the life of a session needs to
24728
+ * be able to ask, because a session does not always end the way it
24729
+ * began. Measured on this hub 2026-09-13: an Echo that got stuck never
24730
+ * sent `SessionDisconnected`, so the Alexa exporter's
24731
+ * `releaseEgressTranscode` never ran, and a 2304x1296 HEVC to 720p
24732
+ * H.264 transcode kept running for NOBODY for more than twenty
24733
+ * minutes. The WebRTC session had logged `WebRTC session closed`
24734
+ * minutes earlier — the broker knew; the holder had no way to ask.
24735
+ *
24736
+ * `false` for a session id the provider has never heard of, which is
24737
+ * the same answer as "it ended": either way nothing is holding it up.
24738
+ */
24739
+ alive: boolean()
24740
+ }));
24410
24741
  object({
24411
24742
  /** All accessory children of the parent. */
24412
24743
  childDeviceIds: array(number()).readonly(),
@@ -28870,11 +29201,46 @@ var NativeObjectDetectionStatusSchema = object({
28870
29201
  supportedClasses: array(NativeObjectClassEnum).readonly(),
28871
29202
  /**
28872
29203
  * Whether forwarding of onboard AI detections is enabled for this device.
28873
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
28874
- * churn the tracker, so forwarding stays off until the operator enables it.
29204
+ *
29205
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
29206
+ * camera runs — that is the operator's choice, and it is made where every
29207
+ * other detection choice is made. `geometry` on
29208
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
29209
+ * choice would buy this particular camera.
28875
29210
  */
28876
29211
  enabled: boolean()
28877
29212
  });
29213
+ /**
29214
+ * WHEN a camera's onboard detections carry geometry.
29215
+ *
29216
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
29217
+ * a detection is a trackable subject whenever the camera sees one.
29218
+ * - `while-streaming` — only while some stream of this camera is already open.
29219
+ * The boxes ride the video's own side-channel rather than a feed of their
29220
+ * own, so they cost nothing and they exist only when something is pulling.
29221
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
29222
+ * radio drain, but a camera that is awake is awake precisely because
29223
+ * something is in front of it, and its stream is already being pulled.
29224
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
29225
+ * pipeline needs geometry to make a subject, so such a push reaches the
29226
+ * tracker as motion and no further.
29227
+ *
29228
+ * Reported and not inferred, because the operator's question in front of the
29229
+ * picker is "what do I get", and these are three different answers (D14: the
29230
+ * derived form is only as honest as `getOptions`).
29231
+ */
29232
+ var NativeObjectGeometryEnum = _enum([
29233
+ "boxed",
29234
+ "while-streaming",
29235
+ "flag-only"
29236
+ ]);
29237
+ var NativeObjectDetectionOptionsSchema = object({
29238
+ /** Classes this firmware can detect — the same list the status reports. */
29239
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
29240
+ /** What a detection from this camera carries. */
29241
+ geometry: NativeObjectGeometryEnum
29242
+ });
29243
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
28878
29244
  var NativeObjectDetectionRuntimeStateSchema = NativeObjectDetectionStatusSchema.extend({
28879
29245
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
28880
29246
  lastFetchedAt: number() });
@@ -28884,13 +29250,23 @@ var nativeObjectDetectionCapability = {
28884
29250
  deviceNative: true,
28885
29251
  mode: "singleton",
28886
29252
  deviceTypes: [DeviceType.Camera],
28887
- methods: { setEnabled: method(object({
28888
- deviceId: number(),
28889
- enabled: boolean()
28890
- }), _void(), {
28891
- kind: "mutation",
28892
- auth: "admin"
28893
- }) },
29253
+ methods: {
29254
+ getOptions: method(object({ deviceId: number() }), NativeObjectDetectionOptionsSchema),
29255
+ setSettings: method(object({
29256
+ deviceId: number(),
29257
+ settings: NativeObjectDetectionSettingsPatchSchema
29258
+ }), _void(), {
29259
+ kind: "mutation",
29260
+ auth: "admin"
29261
+ }),
29262
+ setEnabled: method(object({
29263
+ deviceId: number(),
29264
+ enabled: boolean()
29265
+ }), _void(), {
29266
+ kind: "mutation",
29267
+ auth: "admin"
29268
+ })
29269
+ },
28894
29270
  events: { onDetected: { data: object({
28895
29271
  deviceId: number(),
28896
29272
  detection: NativeDetectionSchema
@@ -34069,7 +34445,28 @@ var PerScopeBreakdownSchema = object({
34069
34445
  /** Total tracked objects in this scope (frame / zone / unzoned). */
34070
34446
  totalObjects: number().int().nonnegative(),
34071
34447
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
34072
- byClass: record(string(), number().int().nonnegative())
34448
+ byClass: record(string(), number().int().nonnegative()),
34449
+ /**
34450
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
34451
+ * present but not going anywhere (a parked car, a bin, a statue).
34452
+ *
34453
+ * The operator's question about a scene has two halves and they answer
34454
+ * different things: "what is parked here" is stable for hours and must not
34455
+ * flap, while "who is walking through" is the thing an alert is about. One
34456
+ * number could only serve one of them, and `totalObjects` served the first
34457
+ * badly — a passer-by moved it and every occupancy rule saw a change.
34458
+ *
34459
+ * `standing + transient === totalObjects`, always. The total keeps its old
34460
+ * meaning exactly, so no rule written against it changes behaviour.
34461
+ *
34462
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
34463
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
34464
+ * parked objects here" about a camera whose lot is full.
34465
+ */
34466
+ standingObjects: number().int().nonnegative().optional(),
34467
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
34468
+ * same absence rule. */
34469
+ transientObjects: number().int().nonnegative().optional()
34073
34470
  });
34074
34471
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
34075
34472
  zoneId: string(),
@@ -34192,6 +34589,23 @@ var HistoryPointSchema = object({
34192
34589
  * triple covers the three spatial scopes (per-zone, frame-wide,
34193
34590
  * outside-any-zone). Crossing them with `className?` gives the full
34194
34591
  * combinatorial coverage the operator UI requested.
34592
+ *
34593
+ * ## ⚠️ The three history methods are DEPRECATED
34594
+ *
34595
+ * They are served from a 60-MINUTE in-memory ring. It dies with the process,
34596
+ * so after a restart they report nothing about a night that did happen, and any
34597
+ * window past an hour is silently clamped — a caller cannot tell a clamp from
34598
+ * an empty scene. The presets in the occupancy chart existed to hide that
34599
+ * horizon rather than to answer a question.
34600
+ *
34601
+ * Use `pipelineAnalytics.readLongTermSeries({ series: 'occupancy', scope })`
34602
+ * instead. Those rows are already written for every camera, ~60 bytes per
34603
+ * (camera, scope, 5-minute bucket), kept for a year, and survive a restart.
34604
+ * Spell the scope with `occupancyScope(zoneId?, className?)` — the same
34605
+ * function the writer uses, so the two cannot drift.
34606
+ *
34607
+ * The ring stays until these three go, and it is the only thing left reading
34608
+ * it. Do not add a fourth caller.
34195
34609
  */
34196
34610
  var zoneAnalyticsCapability = {
34197
34611
  name: "zone-analytics",
@@ -34696,6 +35110,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
34696
35110
  smoke: smokeCapability,
34697
35111
  streamCatalog: streamCatalogCapability,
34698
35112
  streamParams: streamParamsCapability,
35113
+ streamSignals: streamSignalsCapability,
34699
35114
  switch: switchCapability,
34700
35115
  tamper: tamperCapability,
34701
35116
  temperatureSensor: temperatureSensorCapability,
@@ -38823,12 +39238,24 @@ Object.freeze({
38823
39238
  addonId: null,
38824
39239
  access: "create"
38825
39240
  },
39241
+ "nativeObjectDetection.getOptions": {
39242
+ capName: "native-object-detection",
39243
+ capScope: "device",
39244
+ addonId: null,
39245
+ access: "view"
39246
+ },
38826
39247
  "nativeObjectDetection.setEnabled": {
38827
39248
  capName: "native-object-detection",
38828
39249
  capScope: "device",
38829
39250
  addonId: null,
38830
39251
  access: "create"
38831
39252
  },
39253
+ "nativeObjectDetection.setSettings": {
39254
+ capName: "native-object-detection",
39255
+ capScope: "device",
39256
+ addonId: null,
39257
+ access: "create"
39258
+ },
38832
39259
  "navigation.getFeatures": {
38833
39260
  capName: "navigation",
38834
39261
  capScope: "device",
@@ -39093,6 +39520,12 @@ Object.freeze({
39093
39520
  addonId: null,
39094
39521
  access: "view"
39095
39522
  },
39523
+ "notificationRules.getClipRetentionAsks": {
39524
+ capName: "notification-rules",
39525
+ capScope: "system",
39526
+ addonId: null,
39527
+ access: "view"
39528
+ },
39096
39529
  "notificationRules.getConditionCatalog": {
39097
39530
  capName: "notification-rules",
39098
39531
  capScope: "system",
@@ -39603,6 +40036,12 @@ Object.freeze({
39603
40036
  addonId: null,
39604
40037
  access: "create"
39605
40038
  },
40039
+ "pipelineAnalytics.readLongTermSeries": {
40040
+ capName: "pipeline-analytics",
40041
+ capScope: "device",
40042
+ addonId: null,
40043
+ access: "view"
40044
+ },
39606
40045
  "pipelineAnalytics.rebuildObjectEmbeddings": {
39607
40046
  capName: "pipeline-analytics",
39608
40047
  capScope: "device",
@@ -40275,6 +40714,12 @@ Object.freeze({
40275
40714
  addonId: null,
40276
40715
  access: "create"
40277
40716
  },
40717
+ "pipelineRunner.requestOccupancyBurst": {
40718
+ capName: "pipeline-runner",
40719
+ capScope: "system",
40720
+ addonId: null,
40721
+ access: "create"
40722
+ },
40278
40723
  "pipelineRunner.runDetailSubtree": {
40279
40724
  capName: "pipeline-runner",
40280
40725
  capScope: "system",
@@ -41487,6 +41932,12 @@ Object.freeze({
41487
41932
  addonId: null,
41488
41933
  access: "create"
41489
41934
  },
41935
+ "streamBroker.reportStreamSignal": {
41936
+ capName: "stream-broker",
41937
+ capScope: "system",
41938
+ addonId: null,
41939
+ access: "create"
41940
+ },
41490
41941
  "streamBroker.restartProfile": {
41491
41942
  capName: "stream-broker",
41492
41943
  capScope: "system",
@@ -41571,6 +42022,12 @@ Object.freeze({
41571
42022
  addonId: null,
41572
42023
  access: "create"
41573
42024
  },
42025
+ "streamSignals.listSignals": {
42026
+ capName: "stream-signals",
42027
+ capScope: "device",
42028
+ addonId: null,
42029
+ access: "view"
42030
+ },
41574
42031
  "switch.setState": {
41575
42032
  capName: "switch",
41576
42033
  capScope: "device",
@@ -43043,11 +43500,21 @@ Object.freeze({
43043
43500
  form: "single",
43044
43501
  optional: false
43045
43502
  }],
43503
+ "nativeObjectDetection.getOptions": [{
43504
+ name: "deviceId",
43505
+ form: "single",
43506
+ optional: false
43507
+ }],
43046
43508
  "nativeObjectDetection.setEnabled": [{
43047
43509
  name: "deviceId",
43048
43510
  form: "single",
43049
43511
  optional: false
43050
43512
  }],
43513
+ "nativeObjectDetection.setSettings": [{
43514
+ name: "deviceId",
43515
+ form: "single",
43516
+ optional: false
43517
+ }],
43051
43518
  "navigation.getFeatures": [{
43052
43519
  name: "deviceId",
43053
43520
  form: "single",
@@ -43397,6 +43864,11 @@ Object.freeze({
43397
43864
  form: "single",
43398
43865
  optional: false
43399
43866
  }],
43867
+ "pipelineAnalytics.readLongTermSeries": [{
43868
+ name: "deviceId",
43869
+ form: "single",
43870
+ optional: false
43871
+ }],
43400
43872
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
43401
43873
  name: "deviceId",
43402
43874
  form: "single",
@@ -43587,6 +44059,11 @@ Object.freeze({
43587
44059
  form: "single",
43588
44060
  optional: false
43589
44061
  }],
44062
+ "pipelineRunner.requestOccupancyBurst": [{
44063
+ name: "deviceId",
44064
+ form: "single",
44065
+ optional: false
44066
+ }],
43590
44067
  "pipelineRunner.runDetailSubtree": [{
43591
44068
  name: "deviceId",
43592
44069
  form: "single",
@@ -43943,6 +44420,11 @@ Object.freeze({
43943
44420
  form: "single",
43944
44421
  optional: false
43945
44422
  }],
44423
+ "streamBroker.reportStreamSignal": [{
44424
+ name: "deviceId",
44425
+ form: "single",
44426
+ optional: false
44427
+ }],
43946
44428
  "streamBroker.restartProfile": [{
43947
44429
  name: "deviceId",
43948
44430
  form: "single",