@camstack/addon-ai 0.4.107 → 0.4.108

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.
package/dist/addon.js CHANGED
@@ -5520,7 +5520,7 @@ function number(params) {
5520
5520
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5521
5521
  }
5522
5522
  //#endregion
5523
- //#region ../types/dist/sleep-DEuj7E3j.mjs
5523
+ //#region ../types/dist/sleep-BDR76Ykr.mjs
5524
5524
  /**
5525
5525
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5526
5526
  * window to float samples (D455).
@@ -18131,6 +18131,48 @@ var NcAlarmConfigSchema = object({
18131
18131
  settings: NcAlarmSettingsSchema,
18132
18132
  coverage: array(NcAlarmModeCoverageSchema)
18133
18133
  });
18134
+ /**
18135
+ * ONE rule's demand on ONE camera's clip ring.
18136
+ *
18137
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
18138
+ * camera, so the answer stays a faithful description of the rules and the
18139
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
18140
+ * lives. A camera that appears in no ask is being told **nothing** — which is
18141
+ * a different thing from never having been told, and only the envelope
18142
+ * (`rulesLoaded`) can tell those apart.
18143
+ */
18144
+ var NcClipRetentionAskSchema = object({
18145
+ /**
18146
+ * The camera this ask is about. **Absent = every camera**, which is what a
18147
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
18148
+ * asking everywhere.
18149
+ */
18150
+ deviceId: number$1().int().nonnegative().optional(),
18151
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
18152
+ * needs nothing produces no ask at all. */
18153
+ seconds: number$1().min(0).max(60),
18154
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
18155
+ * assigned, which is what the cut defaults to. */
18156
+ profile: CamProfileSchema.optional(),
18157
+ /** Who is asking — so a retention the operator did not expect names a rule. */
18158
+ ruleId: string(),
18159
+ ruleName: string(),
18160
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
18161
+ reason: _enum(["window", "occupancy"])
18162
+ });
18163
+ /**
18164
+ * The whole answer, with the one bit that keeps absence from reading as zero.
18165
+ *
18166
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
18167
+ * once. A centre that is up but has not read its rules yet answers with an
18168
+ * empty ask list that means nothing at all — applying it would drop every
18169
+ * camera's ring to zero for the first events after a restart, which is the
18170
+ * footage this mechanism exists to keep.
18171
+ */
18172
+ var NcClipRetentionPlanSchema = object({
18173
+ rulesLoaded: boolean(),
18174
+ asks: array(NcClipRetentionAskSchema).readonly()
18175
+ });
18134
18176
  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 }), {
18135
18177
  kind: "mutation",
18136
18178
  auth: "admin",
@@ -18151,7 +18193,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18151
18193
  }), object({ success: literal(true) }), {
18152
18194
  kind: "mutation",
18153
18195
  auth: "admin"
18154
- }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
18196
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
18155
18197
  deviceId: number$1().int(),
18156
18198
  muted: boolean()
18157
18199
  }), object({ success: literal(true) }), {
@@ -20685,6 +20727,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
20685
20727
  * solid is this track", cheaper than re-deriving it from a trajectory. */
20686
20728
  framesMatched: number$1().int()
20687
20729
  })).readonly() });
20730
+ /**
20731
+ * The long-term series a camera produces. A closed union so a typo cannot
20732
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
20733
+ * is an alias of this, not a second list.
20734
+ */
20735
+ var AnalyticsLtsSeriesSchema = _enum([
20736
+ "motion",
20737
+ "audio-dbfs",
20738
+ "battery",
20739
+ "occupancy"
20740
+ ]);
20741
+ /**
20742
+ * One closed 5-minute bucket of a long-term series.
20743
+ *
20744
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
20745
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
20746
+ * that exists at all was measured; a bucket that is absent was not, which is a
20747
+ * different claim from zero and the reason this is a sparse series.
20748
+ */
20749
+ var LtsBucketSchema = object({
20750
+ scope: string(),
20751
+ bucketStart: number$1().int(),
20752
+ samples: number$1().int().nonnegative(),
20753
+ sum: number$1(),
20754
+ min: number$1(),
20755
+ max: number$1()
20756
+ });
20688
20757
  DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).readonly()), method(object({
20689
20758
  deviceId: number$1(),
20690
20759
  trackId: string()
@@ -20731,6 +20800,14 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
20731
20800
  kinds: array(string()).optional(),
20732
20801
  limit: number$1().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
20733
20802
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
20803
+ deviceId: number$1(),
20804
+ series: AnalyticsLtsSeriesSchema,
20805
+ /** Omit for EVERY scope of this series in the range. */
20806
+ scope: string().optional(),
20807
+ from: number$1(),
20808
+ to: number$1(),
20809
+ limit: number$1().int().positive().optional()
20810
+ }), array(LtsBucketSchema).readonly()), method(object({
20734
20811
  deviceId: number$1(),
20735
20812
  since: number$1(),
20736
20813
  until: number$1(),
@@ -21349,6 +21426,14 @@ var MotionSourceEnum = _enum([
21349
21426
  */
21350
21427
  var MotionSourcesSchema = array(MotionSourceEnum);
21351
21428
  /**
21429
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
21430
+ * post-analysis already tags every detection with (`DetectionSource`) rather
21431
+ * than a second spelling of the same two ideas — the value an operator picks
21432
+ * here is the value that comes back on the track, the overlay and the debug
21433
+ * row.
21434
+ */
21435
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
21436
+ /**
21352
21437
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
21353
21438
  * so cap-side consumers (the orchestrator forward, the runner addon's
21354
21439
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -21499,6 +21584,35 @@ var RunnerCameraConfigSchema = object({
21499
21584
  * events; the orchestrator forwards to `reportMotion`.
21500
21585
  */
21501
21586
  motionSources: MotionSourcesSchema.default(["analyzer"]),
21587
+ /**
21588
+ * WHICH root detector runs for this camera. The detection counterpart of
21589
+ * {@link motionSources}, same shape and same discipline: a per-camera list
21590
+ * of sources the system understands, vendor-agnostic, owned here.
21591
+ *
21592
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
21593
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
21594
+ * here. Its boxes reach post-analysis on the same
21595
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
21596
+ * track gets the same tracker, the same overlay and the same detail
21597
+ * subtree (face / plate / embedding).
21598
+ *
21599
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
21600
+ * run, and that is where a camera with a usable onboard detector buys back
21601
+ * its share of the accelerator. It saves the root inference, not the decode
21602
+ * — the detail subtree still needs pixels to cut crops from.
21603
+ *
21604
+ * A camera whose onboard detections carry no geometry cannot serve as a root
21605
+ * step at all (there is nothing to track), and the cap that knows this says
21606
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
21607
+ * every battery camera: the boxes ride a sub-stream a battery camera never
21608
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
21609
+ * worth exactly what it already is — a wake signal with a class.
21610
+ *
21611
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
21612
+ * vendor never turns a detector on for the operator, and neither does a
21613
+ * default.
21614
+ */
21615
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
21502
21616
  pipelineEnabled: boolean().default(true),
21503
21617
  /** Ordered tree of video steps. Absent → runner skips video detection. */
21504
21618
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -21680,7 +21794,47 @@ var RunnerLocalMetricsSchema = object({
21680
21794
  queueDepth: number$1(),
21681
21795
  frameLazy: FrameLazyMetricsSchema.optional()
21682
21796
  });
21797
+ /**
21798
+ * Pipeline Runner capability — runtime detection workhorse.
21799
+ *
21800
+ * One instance per node. Receives camera assignments from
21801
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
21802
+ * decoded frames, drains motion + detection queues, calls the local
21803
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
21804
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
21805
+ * the bus.
21806
+ *
21807
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
21808
+ * runner has zero knowledge of other agents, no global state, and never
21809
+ * makes assignment decisions itself.
21810
+ */
21811
+ /**
21812
+ * Why a runner declined to look at a camera out of band. Named rather than a
21813
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
21814
+ * already mid-session and one already bursting are four different facts, and a
21815
+ * caller told only "no" cannot tell a protection from a bug.
21816
+ */
21817
+ var OccupancyBurstRefusalSchema = _enum([
21818
+ "not-attached",
21819
+ "battery-asleep",
21820
+ "not-watching",
21821
+ "already-bursting"
21822
+ ]);
21683
21823
  method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number$1() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number$1() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number$1()).readonly()), method(object({
21824
+ deviceId: number$1(),
21825
+ /** How many frames to collect. The caller sizes this against what its
21826
+ * own confirmation needs; the runner clamps it to the field's range. */
21827
+ frames: number$1().int().positive().optional(),
21828
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
21829
+ * defend — the periodic one at least has a timer to point at. */
21830
+ reason: string()
21831
+ }), object({
21832
+ started: boolean(),
21833
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
21834
+ }), {
21835
+ auth: "admin",
21836
+ kind: "mutation"
21837
+ }), method(object({
21684
21838
  handle: FrameHandleSchema,
21685
21839
  bbox: NativeCropBboxSchema,
21686
21840
  maxWidth: number$1().int().positive().optional(),
@@ -27149,7 +27303,7 @@ var NativeDetectionSchema = object({
27149
27303
  /** Firmware-provided confidence [0..1]. Reolink pushes don't carry it → undefined. */
27150
27304
  confidence: number$1().min(0).max(1).optional()
27151
27305
  });
27152
- object({
27306
+ var NativeObjectDetectionStatusSchema = object({
27153
27307
  /**
27154
27308
  * Last observed instance per class. Missing entries mean the class
27155
27309
  * is supported but nothing has been seen since the provider started.
@@ -27166,14 +27320,56 @@ object({
27166
27320
  supportedClasses: array(NativeObjectClassEnum).readonly(),
27167
27321
  /**
27168
27322
  * Whether forwarding of onboard AI detections is enabled for this device.
27169
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
27170
- * churn the tracker, so forwarding stays off until the operator enables it.
27323
+ *
27324
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
27325
+ * camera runs — that is the operator's choice, and it is made where every
27326
+ * other detection choice is made. `geometry` on
27327
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
27328
+ * choice would buy this particular camera.
27171
27329
  */
27172
27330
  enabled: boolean()
27173
- }).extend({
27331
+ });
27332
+ /**
27333
+ * WHEN a camera's onboard detections carry geometry.
27334
+ *
27335
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
27336
+ * a detection is a trackable subject whenever the camera sees one.
27337
+ * - `while-streaming` — only while some stream of this camera is already open.
27338
+ * The boxes ride the video's own side-channel rather than a feed of their
27339
+ * own, so they cost nothing and they exist only when something is pulling.
27340
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
27341
+ * radio drain, but a camera that is awake is awake precisely because
27342
+ * something is in front of it, and its stream is already being pulled.
27343
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
27344
+ * pipeline needs geometry to make a subject, so such a push reaches the
27345
+ * tracker as motion and no further.
27346
+ *
27347
+ * Reported and not inferred, because the operator's question in front of the
27348
+ * picker is "what do I get", and these are three different answers (D14: the
27349
+ * derived form is only as honest as `getOptions`).
27350
+ */
27351
+ var NativeObjectGeometryEnum = _enum([
27352
+ "boxed",
27353
+ "while-streaming",
27354
+ "flag-only"
27355
+ ]);
27356
+ var NativeObjectDetectionOptionsSchema = object({
27357
+ /** Classes this firmware can detect — the same list the status reports. */
27358
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
27359
+ /** What a detection from this camera carries. */
27360
+ geometry: NativeObjectGeometryEnum
27361
+ });
27362
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
27363
+ NativeObjectDetectionStatusSchema.extend({
27174
27364
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
27175
27365
  lastFetchedAt: number$1() });
27176
- DeviceType.Camera, method(object({
27366
+ DeviceType.Camera, method(object({ deviceId: number$1() }), NativeObjectDetectionOptionsSchema), method(object({
27367
+ deviceId: number$1(),
27368
+ settings: NativeObjectDetectionSettingsPatchSchema
27369
+ }), _void(), {
27370
+ kind: "mutation",
27371
+ auth: "admin"
27372
+ }), method(object({
27177
27373
  deviceId: number$1(),
27178
27374
  enabled: boolean()
27179
27375
  }), _void(), {
@@ -30972,7 +31168,28 @@ var PerScopeBreakdownSchema = object({
30972
31168
  /** Total tracked objects in this scope (frame / zone / unzoned). */
30973
31169
  totalObjects: number$1().int().nonnegative(),
30974
31170
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
30975
- byClass: record(string(), number$1().int().nonnegative())
31171
+ byClass: record(string(), number$1().int().nonnegative()),
31172
+ /**
31173
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
31174
+ * present but not going anywhere (a parked car, a bin, a statue).
31175
+ *
31176
+ * The operator's question about a scene has two halves and they answer
31177
+ * different things: "what is parked here" is stable for hours and must not
31178
+ * flap, while "who is walking through" is the thing an alert is about. One
31179
+ * number could only serve one of them, and `totalObjects` served the first
31180
+ * badly — a passer-by moved it and every occupancy rule saw a change.
31181
+ *
31182
+ * `standing + transient === totalObjects`, always. The total keeps its old
31183
+ * meaning exactly, so no rule written against it changes behaviour.
31184
+ *
31185
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
31186
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
31187
+ * parked objects here" about a camera whose lot is full.
31188
+ */
31189
+ standingObjects: number$1().int().nonnegative().optional(),
31190
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
31191
+ * same absence rule. */
31192
+ transientObjects: number$1().int().nonnegative().optional()
30976
31193
  });
30977
31194
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
30978
31195
  zoneId: string(),
@@ -33911,12 +34128,24 @@ Object.freeze({
33911
34128
  addonId: null,
33912
34129
  access: "create"
33913
34130
  },
34131
+ "nativeObjectDetection.getOptions": {
34132
+ capName: "native-object-detection",
34133
+ capScope: "device",
34134
+ addonId: null,
34135
+ access: "view"
34136
+ },
33914
34137
  "nativeObjectDetection.setEnabled": {
33915
34138
  capName: "native-object-detection",
33916
34139
  capScope: "device",
33917
34140
  addonId: null,
33918
34141
  access: "create"
33919
34142
  },
34143
+ "nativeObjectDetection.setSettings": {
34144
+ capName: "native-object-detection",
34145
+ capScope: "device",
34146
+ addonId: null,
34147
+ access: "create"
34148
+ },
33920
34149
  "navigation.getFeatures": {
33921
34150
  capName: "navigation",
33922
34151
  capScope: "device",
@@ -34181,6 +34410,12 @@ Object.freeze({
34181
34410
  addonId: null,
34182
34411
  access: "view"
34183
34412
  },
34413
+ "notificationRules.getClipRetentionAsks": {
34414
+ capName: "notification-rules",
34415
+ capScope: "system",
34416
+ addonId: null,
34417
+ access: "view"
34418
+ },
34184
34419
  "notificationRules.getConditionCatalog": {
34185
34420
  capName: "notification-rules",
34186
34421
  capScope: "system",
@@ -34691,6 +34926,12 @@ Object.freeze({
34691
34926
  addonId: null,
34692
34927
  access: "create"
34693
34928
  },
34929
+ "pipelineAnalytics.readLongTermSeries": {
34930
+ capName: "pipeline-analytics",
34931
+ capScope: "device",
34932
+ addonId: null,
34933
+ access: "view"
34934
+ },
34694
34935
  "pipelineAnalytics.rebuildObjectEmbeddings": {
34695
34936
  capName: "pipeline-analytics",
34696
34937
  capScope: "device",
@@ -35363,6 +35604,12 @@ Object.freeze({
35363
35604
  addonId: null,
35364
35605
  access: "create"
35365
35606
  },
35607
+ "pipelineRunner.requestOccupancyBurst": {
35608
+ capName: "pipeline-runner",
35609
+ capScope: "system",
35610
+ addonId: null,
35611
+ access: "create"
35612
+ },
35366
35613
  "pipelineRunner.runDetailSubtree": {
35367
35614
  capName: "pipeline-runner",
35368
35615
  capScope: "system",
@@ -38143,11 +38390,21 @@ Object.freeze({
38143
38390
  form: "single",
38144
38391
  optional: false
38145
38392
  }],
38393
+ "nativeObjectDetection.getOptions": [{
38394
+ name: "deviceId",
38395
+ form: "single",
38396
+ optional: false
38397
+ }],
38146
38398
  "nativeObjectDetection.setEnabled": [{
38147
38399
  name: "deviceId",
38148
38400
  form: "single",
38149
38401
  optional: false
38150
38402
  }],
38403
+ "nativeObjectDetection.setSettings": [{
38404
+ name: "deviceId",
38405
+ form: "single",
38406
+ optional: false
38407
+ }],
38151
38408
  "navigation.getFeatures": [{
38152
38409
  name: "deviceId",
38153
38410
  form: "single",
@@ -38497,6 +38754,11 @@ Object.freeze({
38497
38754
  form: "single",
38498
38755
  optional: false
38499
38756
  }],
38757
+ "pipelineAnalytics.readLongTermSeries": [{
38758
+ name: "deviceId",
38759
+ form: "single",
38760
+ optional: false
38761
+ }],
38500
38762
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
38501
38763
  name: "deviceId",
38502
38764
  form: "single",
@@ -38687,6 +38949,11 @@ Object.freeze({
38687
38949
  form: "single",
38688
38950
  optional: false
38689
38951
  }],
38952
+ "pipelineRunner.requestOccupancyBurst": [{
38953
+ name: "deviceId",
38954
+ form: "single",
38955
+ optional: false
38956
+ }],
38690
38957
  "pipelineRunner.runDetailSubtree": [{
38691
38958
  name: "deviceId",
38692
38959
  form: "single",
package/dist/addon.mjs CHANGED
@@ -5547,7 +5547,7 @@ function number(params) {
5547
5547
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5548
5548
  }
5549
5549
  //#endregion
5550
- //#region ../types/dist/sleep-DEuj7E3j.mjs
5550
+ //#region ../types/dist/sleep-BDR76Ykr.mjs
5551
5551
  /**
5552
5552
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5553
5553
  * window to float samples (D455).
@@ -18158,6 +18158,48 @@ var NcAlarmConfigSchema = object({
18158
18158
  settings: NcAlarmSettingsSchema,
18159
18159
  coverage: array(NcAlarmModeCoverageSchema)
18160
18160
  });
18161
+ /**
18162
+ * ONE rule's demand on ONE camera's clip ring.
18163
+ *
18164
+ * A rule, not a camera: the broker takes the MAX over the asks that reach a
18165
+ * camera, so the answer stays a faithful description of the rules and the
18166
+ * bounding (the byte budget, the broker's own ceiling) stays where the cost
18167
+ * lives. A camera that appears in no ask is being told **nothing** — which is
18168
+ * a different thing from never having been told, and only the envelope
18169
+ * (`rulesLoaded`) can tell those apart.
18170
+ */
18171
+ var NcClipRetentionAskSchema = object({
18172
+ /**
18173
+ * The camera this ask is about. **Absent = every camera**, which is what a
18174
+ * rule with no `conditions.devices` means: it can fire anywhere, so it is
18175
+ * asking everywhere.
18176
+ */
18177
+ deviceId: number$1().int().nonnegative().optional(),
18178
+ /** Seconds of history the rule needs held for it. Never zero — a rule that
18179
+ * needs nothing produces no ask at all. */
18180
+ seconds: number$1().min(0).max(60),
18181
+ /** The profile the rule cuts from, when it named one. Absent = the cheapest
18182
+ * assigned, which is what the cut defaults to. */
18183
+ profile: CamProfileSchema.optional(),
18184
+ /** Who is asking — so a retention the operator did not expect names a rule. */
18185
+ ruleId: string(),
18186
+ ruleName: string(),
18187
+ /** Why this many seconds: the rule's own window, or the occupancy ceiling. */
18188
+ reason: _enum(["window", "occupancy"])
18189
+ });
18190
+ /**
18191
+ * The whole answer, with the one bit that keeps absence from reading as zero.
18192
+ *
18193
+ * `rulesLoaded` is false until the rule ledger has completed a load at least
18194
+ * once. A centre that is up but has not read its rules yet answers with an
18195
+ * empty ask list that means nothing at all — applying it would drop every
18196
+ * camera's ring to zero for the first events after a restart, which is the
18197
+ * footage this mechanism exists to keep.
18198
+ */
18199
+ var NcClipRetentionPlanSchema = object({
18200
+ rulesLoaded: boolean(),
18201
+ asks: array(NcClipRetentionAskSchema).readonly()
18202
+ });
18161
18203
  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 }), {
18162
18204
  kind: "mutation",
18163
18205
  auth: "admin",
@@ -18178,7 +18220,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
18178
18220
  }), object({ success: literal(true) }), {
18179
18221
  kind: "mutation",
18180
18222
  auth: "admin"
18181
- }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
18223
+ }), method(object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(object({}), object({ mutedDeviceIds: array(number$1().int()).readonly() }), { auth: "admin" }), method(object({
18182
18224
  deviceId: number$1().int(),
18183
18225
  muted: boolean()
18184
18226
  }), object({ success: literal(true) }), {
@@ -20712,6 +20754,33 @@ var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
20712
20754
  * solid is this track", cheaper than re-deriving it from a trajectory. */
20713
20755
  framesMatched: number$1().int()
20714
20756
  })).readonly() });
20757
+ /**
20758
+ * The long-term series a camera produces. A closed union so a typo cannot
20759
+ * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
20760
+ * is an alias of this, not a second list.
20761
+ */
20762
+ var AnalyticsLtsSeriesSchema = _enum([
20763
+ "motion",
20764
+ "audio-dbfs",
20765
+ "battery",
20766
+ "occupancy"
20767
+ ]);
20768
+ /**
20769
+ * One closed 5-minute bucket of a long-term series.
20770
+ *
20771
+ * `samples` is how many readings the bucket folded — it is the ACTIVITY for a
20772
+ * series like `motion`, and the confidence for one like `occupancy`. A bucket
20773
+ * that exists at all was measured; a bucket that is absent was not, which is a
20774
+ * different claim from zero and the reason this is a sparse series.
20775
+ */
20776
+ var LtsBucketSchema = object({
20777
+ scope: string(),
20778
+ bucketStart: number$1().int(),
20779
+ samples: number$1().int().nonnegative(),
20780
+ sum: number$1(),
20781
+ min: number$1(),
20782
+ max: number$1()
20783
+ });
20715
20784
  DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).readonly()), method(object({
20716
20785
  deviceId: number$1(),
20717
20786
  trackId: string()
@@ -20758,6 +20827,14 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
20758
20827
  kinds: array(string()).optional(),
20759
20828
  limit: number$1().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
20760
20829
  }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
20830
+ deviceId: number$1(),
20831
+ series: AnalyticsLtsSeriesSchema,
20832
+ /** Omit for EVERY scope of this series in the range. */
20833
+ scope: string().optional(),
20834
+ from: number$1(),
20835
+ to: number$1(),
20836
+ limit: number$1().int().positive().optional()
20837
+ }), array(LtsBucketSchema).readonly()), method(object({
20761
20838
  deviceId: number$1(),
20762
20839
  since: number$1(),
20763
20840
  until: number$1(),
@@ -21376,6 +21453,14 @@ var MotionSourceEnum = _enum([
21376
21453
  */
21377
21454
  var MotionSourcesSchema = array(MotionSourceEnum);
21378
21455
  /**
21456
+ * Which root detectors a camera runs. Deliberately the SAME vocabulary
21457
+ * post-analysis already tags every detection with (`DetectionSource`) rather
21458
+ * than a second spelling of the same two ideas — the value an operator picks
21459
+ * here is the value that comes back on the track, the overlay and the debug
21460
+ * row.
21461
+ */
21462
+ var DetectionSourcesSchema = array(DetectionSourceSchema);
21463
+ /**
21379
21464
  * Input shape for `pipeline-runner.reportMotion` cap method. Exported
21380
21465
  * so cap-side consumers (the orchestrator forward, the runner addon's
21381
21466
  * cap implementation, tests) can reuse the type instead of redeclaring
@@ -21526,6 +21611,35 @@ var RunnerCameraConfigSchema = object({
21526
21611
  * events; the orchestrator forwards to `reportMotion`.
21527
21612
  */
21528
21613
  motionSources: MotionSourcesSchema.default(["analyzer"]),
21614
+ /**
21615
+ * WHICH root detector runs for this camera. The detection counterpart of
21616
+ * {@link motionSources}, same shape and same discipline: a per-camera list
21617
+ * of sources the system understands, vendor-agnostic, owned here.
21618
+ *
21619
+ * - `pipeline` — this runner's own root step on decoded pixels (`steps`).
21620
+ * - `onboard` — the CAMERA's own detector, admitted only when it is named
21621
+ * here. Its boxes reach post-analysis on the same
21622
+ * `PipelineInferenceResult` payload as the pipeline's, so an onboard-born
21623
+ * track gets the same tracker, the same overlay and the same detail
21624
+ * subtree (face / plate / embedding).
21625
+ *
21626
+ * `['onboard']` alone is the REPLACEMENT: this runner's root step does not
21627
+ * run, and that is where a camera with a usable onboard detector buys back
21628
+ * its share of the accelerator. It saves the root inference, not the decode
21629
+ * — the detail subtree still needs pixels to cut crops from.
21630
+ *
21631
+ * A camera whose onboard detections carry no geometry cannot serve as a root
21632
+ * step at all (there is nothing to track), and the cap that knows this says
21633
+ * so on `native-object-detection.getOptions().geometry`. On Reolink that is
21634
+ * every battery camera: the boxes ride a sub-stream a battery camera never
21635
+ * attaches, so such a camera stays on `['pipeline']` and its onboard AI is
21636
+ * worth exactly what it already is — a wake signal with a class.
21637
+ *
21638
+ * Defaults to `['pipeline']`, which is byte-for-byte today's behaviour: a
21639
+ * vendor never turns a detector on for the operator, and neither does a
21640
+ * default.
21641
+ */
21642
+ detectionSources: DetectionSourcesSchema.default(["pipeline"]),
21529
21643
  pipelineEnabled: boolean().default(true),
21530
21644
  /** Ordered tree of video steps. Absent → runner skips video detection. */
21531
21645
  steps: array(PipelineStepInputSchema).readonly().optional(),
@@ -21707,7 +21821,47 @@ var RunnerLocalMetricsSchema = object({
21707
21821
  queueDepth: number$1(),
21708
21822
  frameLazy: FrameLazyMetricsSchema.optional()
21709
21823
  });
21824
+ /**
21825
+ * Pipeline Runner capability — runtime detection workhorse.
21826
+ *
21827
+ * One instance per node. Receives camera assignments from
21828
+ * `addon-pipeline-orchestrator`, subscribes to the local stream-broker for
21829
+ * decoded frames, drains motion + detection queues, calls the local
21830
+ * `motion-detection` and `pipeline-executor` capabilities, and emits typed
21831
+ * `pipeline.inference-result` and `detection.motion-analysis` events on
21832
+ * the bus.
21833
+ *
21834
+ * Distinct from `pipeline-orchestrator` (the hub-side load balancer) — the
21835
+ * runner has zero knowledge of other agents, no global state, and never
21836
+ * makes assignment decisions itself.
21837
+ */
21838
+ /**
21839
+ * Why a runner declined to look at a camera out of band. Named rather than a
21840
+ * bare `false`: a camera asleep on battery (D173), one attached elsewhere, one
21841
+ * already mid-session and one already bursting are four different facts, and a
21842
+ * caller told only "no" cannot tell a protection from a bug.
21843
+ */
21844
+ var OccupancyBurstRefusalSchema = _enum([
21845
+ "not-attached",
21846
+ "battery-asleep",
21847
+ "not-watching",
21848
+ "already-bursting"
21849
+ ]);
21710
21850
  method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mutation" }), method(object({ deviceId: number$1() }), object({ success: literal(true) }), { kind: "mutation" }), method(ReportMotionInputSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), RunnerLocalLoadSchema), method(_void(), RunnerLocalMetricsSchema), method(object({ deviceId: number$1() }), CameraMetricsSchema.nullable()), method(_void(), array(CameraMetricsWithDeviceIdSchema).readonly()), method(_void(), array(number$1()).readonly()), method(object({
21851
+ deviceId: number$1(),
21852
+ /** How many frames to collect. The caller sizes this against what its
21853
+ * own confirmation needs; the runner clamps it to the field's range. */
21854
+ frames: number$1().int().positive().optional(),
21855
+ /** Why, for the log. A burst nobody can attribute is a cost nobody can
21856
+ * defend — the periodic one at least has a timer to point at. */
21857
+ reason: string()
21858
+ }), object({
21859
+ started: boolean(),
21860
+ refusedBecause: OccupancyBurstRefusalSchema.optional()
21861
+ }), {
21862
+ auth: "admin",
21863
+ kind: "mutation"
21864
+ }), method(object({
21711
21865
  handle: FrameHandleSchema,
21712
21866
  bbox: NativeCropBboxSchema,
21713
21867
  maxWidth: number$1().int().positive().optional(),
@@ -27176,7 +27330,7 @@ var NativeDetectionSchema = object({
27176
27330
  /** Firmware-provided confidence [0..1]. Reolink pushes don't carry it → undefined. */
27177
27331
  confidence: number$1().min(0).max(1).optional()
27178
27332
  });
27179
- object({
27333
+ var NativeObjectDetectionStatusSchema = object({
27180
27334
  /**
27181
27335
  * Last observed instance per class. Missing entries mean the class
27182
27336
  * is supported but nothing has been seen since the provider started.
@@ -27193,14 +27347,56 @@ object({
27193
27347
  supportedClasses: array(NativeObjectClassEnum).readonly(),
27194
27348
  /**
27195
27349
  * Whether forwarding of onboard AI detections is enabled for this device.
27196
- * Default FALSE (opt-in, cold-start) — onboard AI pushes are noisy/sparse and
27197
- * churn the tracker, so forwarding stays off until the operator enables it.
27350
+ *
27351
+ * Cold-start OFF on every camera. A vendor does not decide which detector a
27352
+ * camera runs — that is the operator's choice, and it is made where every
27353
+ * other detection choice is made. `geometry` on
27354
+ * {@link NativeObjectDetectionOptionsSchema} is how the form says what the
27355
+ * choice would buy this particular camera.
27198
27356
  */
27199
27357
  enabled: boolean()
27200
- }).extend({
27358
+ });
27359
+ /**
27360
+ * WHEN a camera's onboard detections carry geometry.
27361
+ *
27362
+ * - `boxed` — always. The provider holds a standing channel for the boxes, so
27363
+ * a detection is a trackable subject whenever the camera sees one.
27364
+ * - `while-streaming` — only while some stream of this camera is already open.
27365
+ * The boxes ride the video's own side-channel rather than a feed of their
27366
+ * own, so they cost nothing and they exist only when something is pulling.
27367
+ * On Reolink this is every BATTERY camera: a persistent second feed is real
27368
+ * radio drain, but a camera that is awake is awake precisely because
27369
+ * something is in front of it, and its stream is already being pulled.
27370
+ * - `flag-only` — never. The firmware ships the class and nothing else; the
27371
+ * pipeline needs geometry to make a subject, so such a push reaches the
27372
+ * tracker as motion and no further.
27373
+ *
27374
+ * Reported and not inferred, because the operator's question in front of the
27375
+ * picker is "what do I get", and these are three different answers (D14: the
27376
+ * derived form is only as honest as `getOptions`).
27377
+ */
27378
+ var NativeObjectGeometryEnum = _enum([
27379
+ "boxed",
27380
+ "while-streaming",
27381
+ "flag-only"
27382
+ ]);
27383
+ var NativeObjectDetectionOptionsSchema = object({
27384
+ /** Classes this firmware can detect — the same list the status reports. */
27385
+ supportedClasses: array(NativeObjectClassEnum).readonly(),
27386
+ /** What a detection from this camera carries. */
27387
+ geometry: NativeObjectGeometryEnum
27388
+ });
27389
+ var NativeObjectDetectionSettingsPatchSchema = object({ enabled: boolean().optional() });
27390
+ NativeObjectDetectionStatusSchema.extend({
27201
27391
  /** Required by createRuntimeStateBridge — epoch ms of last refresh. */
27202
27392
  lastFetchedAt: number$1() });
27203
- DeviceType.Camera, method(object({
27393
+ DeviceType.Camera, method(object({ deviceId: number$1() }), NativeObjectDetectionOptionsSchema), method(object({
27394
+ deviceId: number$1(),
27395
+ settings: NativeObjectDetectionSettingsPatchSchema
27396
+ }), _void(), {
27397
+ kind: "mutation",
27398
+ auth: "admin"
27399
+ }), method(object({
27204
27400
  deviceId: number$1(),
27205
27401
  enabled: boolean()
27206
27402
  }), _void(), {
@@ -30999,7 +31195,28 @@ var PerScopeBreakdownSchema = object({
30999
31195
  /** Total tracked objects in this scope (frame / zone / unzoned). */
31000
31196
  totalObjects: number$1().int().nonnegative(),
31001
31197
  /** Per-class count. Keys are macro class names (e.g. `person`, `car`). */
31002
- byClass: record(string(), number$1().int().nonnegative())
31198
+ byClass: record(string(), number$1().int().nonnegative()),
31199
+ /**
31200
+ * Of `totalObjects`, how many are STANDING — objects the census holds,
31201
+ * present but not going anywhere (a parked car, a bin, a statue).
31202
+ *
31203
+ * The operator's question about a scene has two halves and they answer
31204
+ * different things: "what is parked here" is stable for hours and must not
31205
+ * flap, while "who is walking through" is the thing an alert is about. One
31206
+ * number could only serve one of them, and `totalObjects` served the first
31207
+ * badly — a passer-by moved it and every occupancy rule saw a change.
31208
+ *
31209
+ * `standing + transient === totalObjects`, always. The total keeps its old
31210
+ * meaning exactly, so no rule written against it changes behaviour.
31211
+ *
31212
+ * ABSENT means UNKNOWN, never zero (D393): a snapshot from a node older than
31213
+ * this field cannot say, and a reader that folds absence in as 0 reports "no
31214
+ * parked objects here" about a camera whose lot is full.
31215
+ */
31216
+ standingObjects: number$1().int().nonnegative().optional(),
31217
+ /** Of `totalObjects`, how many are passing through. See `standingObjects` —
31218
+ * same absence rule. */
31219
+ transientObjects: number$1().int().nonnegative().optional()
31003
31220
  });
31004
31221
  var ZoneScopeBreakdownSchema = PerScopeBreakdownSchema.extend({
31005
31222
  zoneId: string(),
@@ -33938,12 +34155,24 @@ Object.freeze({
33938
34155
  addonId: null,
33939
34156
  access: "create"
33940
34157
  },
34158
+ "nativeObjectDetection.getOptions": {
34159
+ capName: "native-object-detection",
34160
+ capScope: "device",
34161
+ addonId: null,
34162
+ access: "view"
34163
+ },
33941
34164
  "nativeObjectDetection.setEnabled": {
33942
34165
  capName: "native-object-detection",
33943
34166
  capScope: "device",
33944
34167
  addonId: null,
33945
34168
  access: "create"
33946
34169
  },
34170
+ "nativeObjectDetection.setSettings": {
34171
+ capName: "native-object-detection",
34172
+ capScope: "device",
34173
+ addonId: null,
34174
+ access: "create"
34175
+ },
33947
34176
  "navigation.getFeatures": {
33948
34177
  capName: "navigation",
33949
34178
  capScope: "device",
@@ -34208,6 +34437,12 @@ Object.freeze({
34208
34437
  addonId: null,
34209
34438
  access: "view"
34210
34439
  },
34440
+ "notificationRules.getClipRetentionAsks": {
34441
+ capName: "notification-rules",
34442
+ capScope: "system",
34443
+ addonId: null,
34444
+ access: "view"
34445
+ },
34211
34446
  "notificationRules.getConditionCatalog": {
34212
34447
  capName: "notification-rules",
34213
34448
  capScope: "system",
@@ -34718,6 +34953,12 @@ Object.freeze({
34718
34953
  addonId: null,
34719
34954
  access: "create"
34720
34955
  },
34956
+ "pipelineAnalytics.readLongTermSeries": {
34957
+ capName: "pipeline-analytics",
34958
+ capScope: "device",
34959
+ addonId: null,
34960
+ access: "view"
34961
+ },
34721
34962
  "pipelineAnalytics.rebuildObjectEmbeddings": {
34722
34963
  capName: "pipeline-analytics",
34723
34964
  capScope: "device",
@@ -35390,6 +35631,12 @@ Object.freeze({
35390
35631
  addonId: null,
35391
35632
  access: "create"
35392
35633
  },
35634
+ "pipelineRunner.requestOccupancyBurst": {
35635
+ capName: "pipeline-runner",
35636
+ capScope: "system",
35637
+ addonId: null,
35638
+ access: "create"
35639
+ },
35393
35640
  "pipelineRunner.runDetailSubtree": {
35394
35641
  capName: "pipeline-runner",
35395
35642
  capScope: "system",
@@ -38170,11 +38417,21 @@ Object.freeze({
38170
38417
  form: "single",
38171
38418
  optional: false
38172
38419
  }],
38420
+ "nativeObjectDetection.getOptions": [{
38421
+ name: "deviceId",
38422
+ form: "single",
38423
+ optional: false
38424
+ }],
38173
38425
  "nativeObjectDetection.setEnabled": [{
38174
38426
  name: "deviceId",
38175
38427
  form: "single",
38176
38428
  optional: false
38177
38429
  }],
38430
+ "nativeObjectDetection.setSettings": [{
38431
+ name: "deviceId",
38432
+ form: "single",
38433
+ optional: false
38434
+ }],
38178
38435
  "navigation.getFeatures": [{
38179
38436
  name: "deviceId",
38180
38437
  form: "single",
@@ -38524,6 +38781,11 @@ Object.freeze({
38524
38781
  form: "single",
38525
38782
  optional: false
38526
38783
  }],
38784
+ "pipelineAnalytics.readLongTermSeries": [{
38785
+ name: "deviceId",
38786
+ form: "single",
38787
+ optional: false
38788
+ }],
38527
38789
  "pipelineAnalytics.rebuildObjectEmbeddings": [{
38528
38790
  name: "deviceId",
38529
38791
  form: "single",
@@ -38714,6 +38976,11 @@ Object.freeze({
38714
38976
  form: "single",
38715
38977
  optional: false
38716
38978
  }],
38979
+ "pipelineRunner.requestOccupancyBurst": [{
38980
+ name: "deviceId",
38981
+ form: "single",
38982
+ optional: false
38983
+ }],
38717
38984
  "pipelineRunner.runDetailSubtree": [{
38718
38985
  name: "deviceId",
38719
38986
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-ai",
3
- "version": "0.4.107",
3
+ "version": "0.4.108",
4
4
  "description": "AI addon for CamStack — the `llm` collection provider (cloud, LAN, and camstack-managed local llama.cpp profiles) plus the per-node `llm-runtime` managed executor.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -57,7 +57,7 @@
57
57
  "dev": "vite build --watch",
58
58
  "typecheck": "tsc --noEmit",
59
59
  "test": "vitest run",
60
- "publish": "npm publish --access public"
60
+ "publish:npm": "npm publish --access public"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@camstack/types": "*"