@camstack/addon-provider-onvif 1.2.71 → 1.2.73

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
@@ -6448,6 +6448,21 @@ var CameraStreamSchema = object({
6448
6448
  */
6449
6449
  autoEligible: boolean().optional(),
6450
6450
  /**
6451
+ * The profile slot the PUBLISHER says this stream is: `low` for a stream
6452
+ * whose only sensible role is the low-bandwidth one, `high` for a main
6453
+ * stream. Consulted by the broker's automatic ranking
6454
+ * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
6455
+ * an operator's manual assignment still wins, and an absent hint is the
6456
+ * pixel-ranked default every camera had before this field existed.
6457
+ *
6458
+ * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
6459
+ * storage class is written for on its own (`recordings` is high|mid,
6460
+ * `recordingsLow` is low) and the one profile scrub does not read. The robot
6461
+ * camera's single 720p relay is a `low` in every respect except the slot the
6462
+ * heuristic put it in.
6463
+ */
6464
+ profileHint: CamProfileSchema.optional(),
6465
+ /**
6451
6466
  * Transport-specific opaque metadata. The broker passes it through to
6452
6467
  * the source reader without inspecting it. Currently used by
6453
6468
  * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
@@ -7893,7 +7908,22 @@ var RecordingTriggersSchema = object({
7893
7908
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
7894
7909
  * registrare.
7895
7910
  */
7896
- sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7911
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
7912
+ /**
7913
+ * La camera registra per tutta la durata del SEGNALE che lei stessa
7914
+ * pubblica — la cap `recording-signal` (`active: true` mentre il device è in
7915
+ * funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
7916
+ * resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
7917
+ * caduta, così una pulizia di quaranta minuti è UNA clip.
7918
+ *
7919
+ * Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
7920
+ * suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
7921
+ * riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
7922
+ * segnale mai abbassato (un evento perso) non può tenere aperta una
7923
+ * registrazione (D11). Vedi `recorder/addon/band-decision.ts`
7924
+ * (`holdTrigger` / `releaseTrigger`).
7925
+ */
7926
+ deviceSignal: boolean().optional()
7897
7927
  });
7898
7928
  /**
7899
7929
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -11357,6 +11387,8 @@ method(object({
11357
11387
  label: string().optional(),
11358
11388
  deviceFeatures: array(string()).optional(),
11359
11389
  autoEligible: boolean().optional(),
11390
+ /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
11391
+ profileHint: CamProfileSchema.optional(),
11360
11392
  metadata: record(string(), unknown()).optional(),
11361
11393
  /** Required when kind === 'derived' — the source camStreamId the
11362
11394
  * derived broker reads its encoded plane from.
@@ -27893,6 +27925,47 @@ method(object({
27893
27925
  auth: "protected"
27894
27926
  });
27895
27927
  /**
27928
+ * A camera's own "record me NOW" LEVEL — a signal the device raises while
27929
+ * something it knows about is happening (a robot vacuum cleaning, a machine
27930
+ * running, a gate open) and lowers when it stops.
27931
+ *
27932
+ * It is a level, not an edge. The sensor triggers the recorder already listens
27933
+ * to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
27934
+ * post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
27935
+ * still happening" cannot be expressed as an edge plus a post-buffer without
27936
+ * either re-triggering on a timer (polling — D224 forbids the consumer keeping
27937
+ * the fact fresh) or picking a post-buffer long enough to cover every job,
27938
+ * which records the dock for that long after every short one. So the recorder
27939
+ * reads the LEVEL: it records for as long as `active` is true, plus the band's
27940
+ * own post-buffer once it falls.
27941
+ *
27942
+ * Who owns the fact: the PROVIDER of the device, which already reads the state
27943
+ * the signal is derived from (the vacuum's lifecycle state, for Dreame). It
27944
+ * writes this slice on every change; consumers subscribe to the kernel's
27945
+ * `DeviceStateChanged` for it and read it back through
27946
+ * `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
27947
+ * against the device (D224, D8/D11).
27948
+ *
27949
+ * Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
27950
+ * to Home Assistant, HomeKit and the sensor picker as a thing an operator can
27951
+ * bind, and "the camera wants to record" is not a room sensor. It is a fact
27952
+ * about the camera, on the camera.
27953
+ */
27954
+ var RecordingSignalStatusSchema = object({
27955
+ /** True while the device asks to be recorded. */
27956
+ active: boolean(),
27957
+ /**
27958
+ * Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
27959
+ * …). Free text for the log line and the UI badge; the recorder never
27960
+ * branches on it.
27961
+ */
27962
+ reason: string(),
27963
+ /** Ms epoch of the last `active` transition. 0 if never observed. */
27964
+ lastChangedAt: number()
27965
+ });
27966
+ RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
27967
+ DeviceType.Camera, method(object({ deviceId: number() }), RecordingSignalStatusSchema);
27968
+ /**
27896
27969
  * scene-monitor — device-scoped reference-region state cap. An operator marks
27897
27970
  * a rect ROI on a camera frame and names one or more states; the engine
27898
27971
  * (pipeline-analytics, designated post-processing node) reports which state is
@@ -28265,6 +28338,8 @@ var CamStreamDescriptorSchema = object({
28265
28338
  deviceFeatures: array(string()).optional(),
28266
28339
  /** Eligible for automatic profile assignment. Absent = `true`. */
28267
28340
  autoEligible: boolean().optional(),
28341
+ /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
28342
+ profileHint: CamProfileSchema.optional(),
28268
28343
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
28269
28344
  metadata: record(string(), unknown()).optional()
28270
28345
  });
@@ -30015,6 +30090,53 @@ var BaseDeviceProvider = class extends BaseAddon {
30015
30090
  const ids = [...this._permanentRestoreFailures.keys()].join(", ");
30016
30091
  return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
30017
30092
  }
30093
+ /**
30094
+ * A top-level persisted row with NO configuration is a leftover, not a
30095
+ * device — quarantine it instead of dialling it.
30096
+ *
30097
+ * Device 614 was deleted, resurrected as a config-less shell by a write
30098
+ * already in flight (D376), and then dialled at every single boot: eight
30099
+ * `Failed to restore device — bounded retry scheduled` lines in one day,
30100
+ * each one the same Zod refusal on `host` and `password`. The bound was
30101
+ * real, but it is a bound PER PROCESS, and the runner restarts — so nothing
30102
+ * about the row ever stopped costing attempts and log lines.
30103
+ *
30104
+ * No retry can add a configuration that is not there. The row is reported
30105
+ * once, with its `deviceId`, and set aside.
30106
+ *
30107
+ * Top-level only: an accessory child legitimately carries an empty blob (it
30108
+ * lives off its parent), and a hub-adopted child with an emptied blob is
30109
+ * repaired by `healSavedConfig` from its parent instead. Providers that
30110
+ * genuinely create configuration-free top-level devices turn this off.
30111
+ */
30112
+ quarantineConfiglessTopLevelRestores = true;
30113
+ isUnrestorableShell(saved) {
30114
+ if (!this.quarantineConfiglessTopLevelRestores) return false;
30115
+ if (saved.parentDeviceId !== null) return false;
30116
+ const config = saved.config;
30117
+ if (config === void 0) return false;
30118
+ return Object.keys(config).length === 0;
30119
+ }
30120
+ quarantineShell(saved) {
30121
+ this._permanentRestoreFailures.set(saved.id, {
30122
+ deviceId: saved.id,
30123
+ stableId: saved.stableId,
30124
+ type: saved.type,
30125
+ attempts: 0,
30126
+ lastError: "persisted row has no configuration",
30127
+ failedAt: Date.now()
30128
+ });
30129
+ this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
30130
+ tags: {
30131
+ deviceId: saved.id,
30132
+ stableId: saved.stableId
30133
+ },
30134
+ meta: {
30135
+ type: saved.type,
30136
+ provider: this.providerName
30137
+ }
30138
+ });
30139
+ }
30018
30140
  cancelRestoreRetries() {
30019
30141
  this._restoreRetryScheduler?.cancel();
30020
30142
  this._restoreRetryScheduler = null;
@@ -30199,6 +30321,10 @@ var BaseDeviceProvider = class extends BaseAddon {
30199
30321
  });
30200
30322
  return;
30201
30323
  }
30324
+ if (this.isUnrestorableShell(saved)) {
30325
+ this.quarantineShell(saved);
30326
+ return;
30327
+ }
30202
30328
  try {
30203
30329
  await attemptRestore(saved);
30204
30330
  } catch (err) {
@@ -34985,6 +35111,12 @@ Object.freeze({
34985
35111
  addonId: null,
34986
35112
  access: "view"
34987
35113
  },
35114
+ "recordingSignal.getStatus": {
35115
+ capName: "recording-signal",
35116
+ capScope: "device",
35117
+ addonId: null,
35118
+ access: "view"
35119
+ },
34988
35120
  "sceneMonitor.captureReference": {
34989
35121
  capName: "scene-monitor",
34990
35122
  capScope: "device",
@@ -37977,6 +38109,11 @@ Object.freeze({
37977
38109
  form: "single",
37978
38110
  optional: true
37979
38111
  }],
38112
+ "recordingSignal.getStatus": [{
38113
+ name: "deviceId",
38114
+ form: "single",
38115
+ optional: false
38116
+ }],
37980
38117
  "sceneMonitor.captureReference": [{
37981
38118
  name: "deviceId",
37982
38119
  form: "single",
package/dist/addon.mjs CHANGED
@@ -6449,6 +6449,21 @@ var CameraStreamSchema = object({
6449
6449
  */
6450
6450
  autoEligible: boolean().optional(),
6451
6451
  /**
6452
+ * The profile slot the PUBLISHER says this stream is: `low` for a stream
6453
+ * whose only sensible role is the low-bandwidth one, `high` for a main
6454
+ * stream. Consulted by the broker's automatic ranking
6455
+ * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
6456
+ * an operator's manual assignment still wins, and an absent hint is the
6457
+ * pixel-ranked default every camera had before this field existed.
6458
+ *
6459
+ * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
6460
+ * storage class is written for on its own (`recordings` is high|mid,
6461
+ * `recordingsLow` is low) and the one profile scrub does not read. The robot
6462
+ * camera's single 720p relay is a `low` in every respect except the slot the
6463
+ * heuristic put it in.
6464
+ */
6465
+ profileHint: CamProfileSchema.optional(),
6466
+ /**
6452
6467
  * Transport-specific opaque metadata. The broker passes it through to
6453
6468
  * the source reader without inspecting it. Currently used by
6454
6469
  * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
@@ -7894,7 +7909,22 @@ var RecordingTriggersSchema = object({
7894
7909
  * il livello: un contatto trovato già aperto al riavvio del runner non fa
7895
7910
  * registrare.
7896
7911
  */
7897
- sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
7912
+ sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional(),
7913
+ /**
7914
+ * La camera registra per tutta la durata del SEGNALE che lei stessa
7915
+ * pubblica — la cap `recording-signal` (`active: true` mentre il device è in
7916
+ * funzione: un robot che pulisce). È un LIVELLO, non un fronte: la finestra
7917
+ * resta aperta finché il segnale è alto e si chiude `postBufferSec` dopo la
7918
+ * caduta, così una pulizia di quaranta minuti è UNA clip.
7919
+ *
7920
+ * Non nomina un device: il segnale è della camera stessa, tenuto fresco dal
7921
+ * suo provider (D224); il recorder lo ascolta su `DeviceStateChanged` e lo
7922
+ * riconcilia leggendo la slice via RPC, con un tetto oltre il quale un
7923
+ * segnale mai abbassato (un evento perso) non può tenere aperta una
7924
+ * registrazione (D11). Vedi `recorder/addon/band-decision.ts`
7925
+ * (`holdTrigger` / `releaseTrigger`).
7926
+ */
7927
+ deviceSignal: boolean().optional()
7898
7928
  });
7899
7929
  /**
7900
7930
  * Mode of a single recording band — the recorder per-band vocabulary.
@@ -11358,6 +11388,8 @@ method(object({
11358
11388
  label: string().optional(),
11359
11389
  deviceFeatures: array(string()).optional(),
11360
11390
  autoEligible: boolean().optional(),
11391
+ /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
11392
+ profileHint: CamProfileSchema.optional(),
11361
11393
  metadata: record(string(), unknown()).optional(),
11362
11394
  /** Required when kind === 'derived' — the source camStreamId the
11363
11395
  * derived broker reads its encoded plane from.
@@ -27894,6 +27926,47 @@ method(object({
27894
27926
  auth: "protected"
27895
27927
  });
27896
27928
  /**
27929
+ * A camera's own "record me NOW" LEVEL — a signal the device raises while
27930
+ * something it knows about is happening (a robot vacuum cleaning, a machine
27931
+ * running, a gate open) and lowers when it stops.
27932
+ *
27933
+ * It is a level, not an edge. The sensor triggers the recorder already listens
27934
+ * to (`SOURCE_CAP_ACTIVE_FIELD`) fire on a rising edge and record for a fixed
27935
+ * post-buffer; a cleaning lasts forty minutes, and forty minutes of "this is
27936
+ * still happening" cannot be expressed as an edge plus a post-buffer without
27937
+ * either re-triggering on a timer (polling — D224 forbids the consumer keeping
27938
+ * the fact fresh) or picking a post-buffer long enough to cover every job,
27939
+ * which records the dock for that long after every short one. So the recorder
27940
+ * reads the LEVEL: it records for as long as `active` is true, plus the band's
27941
+ * own post-buffer once it falls.
27942
+ *
27943
+ * Who owns the fact: the PROVIDER of the device, which already reads the state
27944
+ * the signal is derived from (the vacuum's lifecycle state, for Dreame). It
27945
+ * writes this slice on every change; consumers subscribe to the kernel's
27946
+ * `DeviceStateChanged` for it and read it back through
27947
+ * `deviceState.getCapSlice` to reconcile — never a second copy, never a poll
27948
+ * against the device (D224, D8/D11).
27949
+ *
27950
+ * Deliberately NOT a `binary` sensor on the camera: a binary sensor is exported
27951
+ * to Home Assistant, HomeKit and the sensor picker as a thing an operator can
27952
+ * bind, and "the camera wants to record" is not a room sensor. It is a fact
27953
+ * about the camera, on the camera.
27954
+ */
27955
+ var RecordingSignalStatusSchema = object({
27956
+ /** True while the device asks to be recorded. */
27957
+ active: boolean(),
27958
+ /**
27959
+ * Why, in the provider's own vocabulary (a vacuum's `cleaning` / `docked`,
27960
+ * …). Free text for the log line and the UI badge; the recorder never
27961
+ * branches on it.
27962
+ */
27963
+ reason: string(),
27964
+ /** Ms epoch of the last `active` transition. 0 if never observed. */
27965
+ lastChangedAt: number()
27966
+ });
27967
+ RecordingSignalStatusSchema.extend({ lastFetchedAt: number() });
27968
+ DeviceType.Camera, method(object({ deviceId: number() }), RecordingSignalStatusSchema);
27969
+ /**
27897
27970
  * scene-monitor — device-scoped reference-region state cap. An operator marks
27898
27971
  * a rect ROI on a camera frame and names one or more states; the engine
27899
27972
  * (pipeline-analytics, designated post-processing node) reports which state is
@@ -28266,6 +28339,8 @@ var CamStreamDescriptorSchema = object({
28266
28339
  deviceFeatures: array(string()).optional(),
28267
28340
  /** Eligible for automatic profile assignment. Absent = `true`. */
28268
28341
  autoEligible: boolean().optional(),
28342
+ /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
28343
+ profileHint: CamProfileSchema.optional(),
28269
28344
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
28270
28345
  metadata: record(string(), unknown()).optional()
28271
28346
  });
@@ -30016,6 +30091,53 @@ var BaseDeviceProvider = class extends BaseAddon {
30016
30091
  const ids = [...this._permanentRestoreFailures.keys()].join(", ");
30017
30092
  return `${this._permanentRestoreFailures.size} device(s) permanently failed restore (deviceIds: ${ids}) — restart the ${this.providerName} provider to retry`;
30018
30093
  }
30094
+ /**
30095
+ * A top-level persisted row with NO configuration is a leftover, not a
30096
+ * device — quarantine it instead of dialling it.
30097
+ *
30098
+ * Device 614 was deleted, resurrected as a config-less shell by a write
30099
+ * already in flight (D376), and then dialled at every single boot: eight
30100
+ * `Failed to restore device — bounded retry scheduled` lines in one day,
30101
+ * each one the same Zod refusal on `host` and `password`. The bound was
30102
+ * real, but it is a bound PER PROCESS, and the runner restarts — so nothing
30103
+ * about the row ever stopped costing attempts and log lines.
30104
+ *
30105
+ * No retry can add a configuration that is not there. The row is reported
30106
+ * once, with its `deviceId`, and set aside.
30107
+ *
30108
+ * Top-level only: an accessory child legitimately carries an empty blob (it
30109
+ * lives off its parent), and a hub-adopted child with an emptied blob is
30110
+ * repaired by `healSavedConfig` from its parent instead. Providers that
30111
+ * genuinely create configuration-free top-level devices turn this off.
30112
+ */
30113
+ quarantineConfiglessTopLevelRestores = true;
30114
+ isUnrestorableShell(saved) {
30115
+ if (!this.quarantineConfiglessTopLevelRestores) return false;
30116
+ if (saved.parentDeviceId !== null) return false;
30117
+ const config = saved.config;
30118
+ if (config === void 0) return false;
30119
+ return Object.keys(config).length === 0;
30120
+ }
30121
+ quarantineShell(saved) {
30122
+ this._permanentRestoreFailures.set(saved.id, {
30123
+ deviceId: saved.id,
30124
+ stableId: saved.stableId,
30125
+ type: saved.type,
30126
+ attempts: 0,
30127
+ lastError: "persisted row has no configuration",
30128
+ failedAt: Date.now()
30129
+ });
30130
+ this.ctx.logger.error("Persisted device row has NO configuration — quarantined: not restored, not retried. Remove it (deviceManager.removeDevice) or re-add the device.", {
30131
+ tags: {
30132
+ deviceId: saved.id,
30133
+ stableId: saved.stableId
30134
+ },
30135
+ meta: {
30136
+ type: saved.type,
30137
+ provider: this.providerName
30138
+ }
30139
+ });
30140
+ }
30019
30141
  cancelRestoreRetries() {
30020
30142
  this._restoreRetryScheduler?.cancel();
30021
30143
  this._restoreRetryScheduler = null;
@@ -30200,6 +30322,10 @@ var BaseDeviceProvider = class extends BaseAddon {
30200
30322
  });
30201
30323
  return;
30202
30324
  }
30325
+ if (this.isUnrestorableShell(saved)) {
30326
+ this.quarantineShell(saved);
30327
+ return;
30328
+ }
30203
30329
  try {
30204
30330
  await attemptRestore(saved);
30205
30331
  } catch (err) {
@@ -34986,6 +35112,12 @@ Object.freeze({
34986
35112
  addonId: null,
34987
35113
  access: "view"
34988
35114
  },
35115
+ "recordingSignal.getStatus": {
35116
+ capName: "recording-signal",
35117
+ capScope: "device",
35118
+ addonId: null,
35119
+ access: "view"
35120
+ },
34989
35121
  "sceneMonitor.captureReference": {
34990
35122
  capName: "scene-monitor",
34991
35123
  capScope: "device",
@@ -37978,6 +38110,11 @@ Object.freeze({
37978
38110
  form: "single",
37979
38111
  optional: true
37980
38112
  }],
38113
+ "recordingSignal.getStatus": [{
38114
+ name: "deviceId",
38115
+ form: "single",
38116
+ optional: false
38117
+ }],
37981
38118
  "sceneMonitor.captureReference": [{
37982
38119
  name: "deviceId",
37983
38120
  form: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-onvif",
3
- "version": "1.2.71",
3
+ "version": "1.2.73",
4
4
  "description": "ONVIF camera device provider addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",