@camstack/addon-pipeline-orchestrator 1.2.324 → 1.2.325

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/index.js CHANGED
@@ -5418,7 +5418,7 @@ var ZodIssueCode = {
5418
5418
  var ZodFirstPartyTypeKind;
5419
5419
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5420
5420
  //#endregion
5421
- //#region ../types/dist/sleep-DAX0-2v9.mjs
5421
+ //#region ../types/dist/sleep-DRqxtc0C.mjs
5422
5422
  /**
5423
5423
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5424
5424
  * window to float samples (D455).
@@ -8758,6 +8758,10 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8758
8758
  kind: "mutation",
8759
8759
  auth: "admin"
8760
8760
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8761
+ object({
8762
+ code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8763
+ params: record(string(), union([string(), number()])).optional()
8764
+ });
8761
8765
  /**
8762
8766
  * Promise-based timer helpers — used everywhere the codebase needs to
8763
8767
  * wait, back off, or schedule a retry. Before these helpers landed, each
@@ -8783,7 +8787,7 @@ function sleep(ms) {
8783
8787
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
8784
8788
  }
8785
8789
  //#endregion
8786
- //#region ../types/dist/err-msg-DX6i_MY4.mjs
8790
+ //#region ../types/dist/err-msg-DLerKiVO.mjs
8787
8791
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8788
8792
  DeviceType["Camera"] = "camera";
8789
8793
  DeviceType["Hub"] = "hub";
@@ -9033,6 +9037,22 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
9033
9037
  DeviceRole["Nightvision"] = "nightvision";
9034
9038
  DeviceRole["PrivacyMask"] = "privacy-mask";
9035
9039
  DeviceRole["Doorbell"] = "doorbell";
9040
+ /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
9041
+ DeviceRole["CoverBlind"] = "cover-blind";
9042
+ /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
9043
+ DeviceRole["CoverShutter"] = "cover-shutter";
9044
+ /** Exterior awning. HA `device_class: awning`. */
9045
+ DeviceRole["CoverAwning"] = "cover-awning";
9046
+ /** Curtain / drape. HA `device_class: curtain`. */
9047
+ DeviceRole["CoverCurtain"] = "cover-curtain";
9048
+ /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
9049
+ DeviceRole["CoverGarage"] = "cover-garage";
9050
+ /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
9051
+ DeviceRole["CoverGate"] = "cover-gate";
9052
+ /** Door. HA `device_class: door`. A security actuator: exports gate it. */
9053
+ DeviceRole["CoverDoor"] = "cover-door";
9054
+ /** Window. HA `device_class: window`. */
9055
+ DeviceRole["CoverWindow"] = "cover-window";
9036
9056
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
9037
9057
  * real Switch device for UI rendering / export adapters. */
9038
9058
  DeviceRole["BinaryHelper"] = "binary-helper";
@@ -9113,7 +9133,7 @@ function errMsg$2(err) {
9113
9133
  return String(err);
9114
9134
  }
9115
9135
  //#endregion
9116
- //#region ../types/dist/composition-C-WpVYTX.mjs
9136
+ //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9117
9137
  /**
9118
9138
  * The ffmpeg build every CamStack node downloads, per platform and arch.
9119
9139
  *
@@ -13251,7 +13271,8 @@ var ConvertResultSchema = object({
13251
13271
  })).readonly()
13252
13272
  });
13253
13273
  _enum(["new-session", "step-up"]);
13254
- _enum(["en", "it"]);
13274
+ /** The languages the hub's app landing pages are written in (D858). */
13275
+ var AppPageLangSchema = _enum(["en", "it"]);
13255
13276
  /** How a native app starts one login method (D858), as `auth.listLoginMethods` reports it. */
13256
13277
  var AppLoginPathSchema = discriminatedUnion("kind", [object({ kind: literal("native") }), object({
13257
13278
  kind: literal("browser"),
@@ -13748,7 +13769,9 @@ var ConfigTabDeclarationSchema = object({
13748
13769
  var ConfigSectionWithValuesSchema = object({
13749
13770
  id: string(),
13750
13771
  title: string(),
13772
+ titleKey: string().optional(),
13751
13773
  description: string().optional(),
13774
+ descriptionKey: string().optional(),
13752
13775
  style: _enum(["card", "accordion"]).optional(),
13753
13776
  defaultCollapsed: boolean().optional(),
13754
13777
  columns: union([
@@ -17031,6 +17054,9 @@ method(object({
17031
17054
  }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
17032
17055
  kind: "mutation",
17033
17056
  auth: "admin"
17057
+ }), method(object({ deviceId: number().int() }), object({ refs: array(string()).readonly() }), {
17058
+ kind: "mutation",
17059
+ auth: "admin"
17034
17060
  }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
17035
17061
  /**
17036
17062
  * device-history — the ONE mechanism for numeric history (D850).
@@ -38434,6 +38460,38 @@ var DeviceRegisterPayloadSchema = object({
38434
38460
  * omits it and the keyword backstop applies. */
38435
38461
  secretConfigPaths: array(string()).optional()
38436
38462
  });
38463
+ /** One deleted device, kept by device-manager so an addon that missed the
38464
+ * deletion can still learn of it (D865). Written by the delete path ONLY. */
38465
+ var DeviceTombstoneSchema = object({
38466
+ deviceId: number().int().positive(),
38467
+ /** Epoch ms the device was deleted. */
38468
+ deletedAt: number(),
38469
+ /** The addon that owned the device when it was deleted. */
38470
+ providerAddonId: string()
38471
+ });
38472
+ /** Data held for one device that device-manager no longer knows. */
38473
+ var OrphanDeviceDataSchema = object({
38474
+ deviceId: number().int().positive(),
38475
+ /** Rows/files per store (`<addonId>:<store>`). */
38476
+ stores: record(string(), number().int().nonnegative())
38477
+ });
38478
+ var CleanupDeletedDevicesResultSchema = object({
38479
+ /**
38480
+ * `skipped` — the absence check could not be trusted (a device-list read
38481
+ * failed or the two reads disagreed); nothing was listed or deleted.
38482
+ * `dry-run` — `devices` is what a confirmed run would delete.
38483
+ * `cleaned` — `devices` is what was deleted.
38484
+ */
38485
+ status: _enum([
38486
+ "skipped",
38487
+ "dry-run",
38488
+ "cleaned"
38489
+ ]),
38490
+ reason: string().nullable(),
38491
+ devices: array(OrphanDeviceDataSchema),
38492
+ /** Implementers that could not be asked (their stores are not in `devices`). */
38493
+ unreachable: array(string())
38494
+ });
38437
38495
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
38438
38496
  var DevicePersistConfigPayloadSchema = object({
38439
38497
  deviceId: number(),
@@ -38672,6 +38730,9 @@ method(object({
38672
38730
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
38673
38731
  kind: "mutation",
38674
38732
  auth: "admin"
38733
+ }), method(object({ sinceMs: number() }), array(DeviceTombstoneSchema).readonly(), { auth: "admin" }), method(object({ confirm: boolean() }), CleanupDeletedDevicesResultSchema, {
38734
+ kind: "mutation",
38735
+ auth: "admin"
38675
38736
  }), method(object({ integrationId: string() }), object({ removed: number() }), {
38676
38737
  kind: "mutation",
38677
38738
  auth: "admin"
@@ -39134,6 +39195,72 @@ method(object({
39134
39195
  auth: "admin"
39135
39196
  });
39136
39197
  /**
39198
+ * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
39199
+ * so it can delete what it keeps for that device (D865).
39200
+ *
39201
+ * ## Why an event was not enough
39202
+ *
39203
+ * `DeviceUnregistered` is telemetry and may be dropped (D8, D11). An addon that
39204
+ * hung its per-device clean-up on it left durable garbage whenever the event was
39205
+ * lost, the addon was down, or it was restarting at that moment — footage,
39206
+ * analytics rows and settings of device 4483 outlived the device. Loss of this
39207
+ * signal corrupts durable state, so it travels by RPC with a recorded fact
39208
+ * behind it (D8: "if loss would corrupt durable state, use RPC plus a reconcile").
39209
+ *
39210
+ * ## The three pieces
39211
+ *
39212
+ * 1. device-manager records a TOMBSTONE per deleted device
39213
+ * (`deviceManager.listDeletedSince`). The tombstone is written by the delete
39214
+ * path only — a device that is unregistered, offline or whose provider is
39215
+ * restarting is NOT deleted and gets none.
39216
+ * 2. After a delete, device-manager calls `onDeviceRemoved` on EVERY provider of
39217
+ * this collection, one by one, with bounded retries, logged.
39218
+ * 3. An implementer that was down asks `deviceManager.listDeletedSince` at start
39219
+ * (and periodically) and runs its own `onDeviceRemoved` for each tombstone it
39220
+ * may have missed. Reconcile is driven by tombstones, never by "the device is
39221
+ * not in the current list": a failed or partial list read must not destroy data.
39222
+ *
39223
+ * ## Contract for an implementer
39224
+ *
39225
+ * - **Idempotent.** It is called again by a retry, by a reconcile and by the
39226
+ * admin cleanup of data that predates tombstones. A device with nothing left
39227
+ * answers zero counts.
39228
+ * - **One key per store** in `counts`, deleted rows/files per store, so the log
39229
+ * line and the admin dry run can say where the data was.
39230
+ * - **Training datasets are NOT device data** and are never deleted by a hook.
39231
+ * - **Per-device SETTINGS are not hooked.** Configuration lives in the standard
39232
+ * per-device store (`ctx.settings.*DeviceStore`), which device-manager clears
39233
+ * for every addon centrally at delete time. This hook is for device DATA
39234
+ * that is not settings: footage, event media, analytics rows, history.
39235
+ * - A provider that cannot tell is allowed to throw; the caller retries it.
39236
+ *
39237
+ * `listDeviceData` is the read side of the admin "Clean data of deleted devices"
39238
+ * action: which device ids this addon holds data for, and how much per store. It
39239
+ * never deletes. device-manager decides which of those ids are absent from the
39240
+ * fleet, from TWO consistent reads of the device list (D49).
39241
+ */
39242
+ /** What a hook is told about the deletion. */
39243
+ var DeviceRemovedInputSchema = object({
39244
+ deviceId: number().int().positive(),
39245
+ /** Epoch ms the device was deleted (the tombstone's `deletedAt`). */
39246
+ deletedAt: number(),
39247
+ /** The addon that owned the device, as device-manager last knew it. */
39248
+ providerAddonId: string()
39249
+ });
39250
+ /** Rows/files/refs deleted, per store this implementer owns. */
39251
+ var DeviceRemovedResultSchema = object({ counts: record(string(), number().int().nonnegative()) });
39252
+ /** One (store, device) pair an implementer holds data for. */
39253
+ var DeviceDataEntrySchema = object({
39254
+ store: string(),
39255
+ deviceId: number().int().positive(),
39256
+ /** Rows (or files) held for the device in the store. */
39257
+ count: number().int().nonnegative()
39258
+ });
39259
+ method(DeviceRemovedInputSchema, DeviceRemovedResultSchema, {
39260
+ kind: "mutation",
39261
+ auth: "admin"
39262
+ }), method(_void(), array(DeviceDataEntrySchema).readonly(), { auth: "admin" });
39263
+ /**
39137
39264
  * `failure-contribution` — the capability an addon reports its OWN losses
39138
39265
  * through, per camera, with the denominator attached. It stores nothing.
39139
39266
  *
@@ -64702,6 +64829,12 @@ Object.freeze({
64702
64829
  addonId: null,
64703
64830
  access: "create"
64704
64831
  },
64832
+ "deviceManager.cleanupDeletedDevicesData": {
64833
+ capName: "device-manager",
64834
+ capScope: "system",
64835
+ addonId: null,
64836
+ access: "create"
64837
+ },
64705
64838
  "deviceManager.createDevice": {
64706
64839
  capName: "device-manager",
64707
64840
  capScope: "system",
@@ -64882,6 +65015,12 @@ Object.freeze({
64882
65015
  addonId: null,
64883
65016
  access: "view"
64884
65017
  },
65018
+ "deviceManager.listDeletedSince": {
65019
+ capName: "device-manager",
65020
+ capScope: "system",
65021
+ addonId: null,
65022
+ access: "view"
65023
+ },
64885
65024
  "deviceManager.listDeviceIdsByCaps": {
64886
65025
  capName: "device-manager",
64887
65026
  capScope: "system",
@@ -65290,6 +65429,18 @@ Object.freeze({
65290
65429
  addonId: null,
65291
65430
  access: "create"
65292
65431
  },
65432
+ "deviceRemovalHook.listDeviceData": {
65433
+ capName: "device-removal-hook",
65434
+ capScope: "system",
65435
+ addonId: null,
65436
+ access: "view"
65437
+ },
65438
+ "deviceRemovalHook.onDeviceRemoved": {
65439
+ capName: "device-removal-hook",
65440
+ capScope: "system",
65441
+ addonId: null,
65442
+ access: "create"
65443
+ },
65293
65444
  "deviceState.claimFields": {
65294
65445
  capName: "device-state",
65295
65446
  capScope: "system",
@@ -65722,6 +65873,12 @@ Object.freeze({
65722
65873
  addonId: null,
65723
65874
  access: "delete"
65724
65875
  },
65876
+ "keychain.deleteDeviceScope": {
65877
+ capName: "keychain",
65878
+ capScope: "system",
65879
+ addonId: null,
65880
+ access: "delete"
65881
+ },
65725
65882
  "keychain.getState": {
65726
65883
  capName: "keychain",
65727
65884
  capScope: "system",
@@ -71762,6 +71919,11 @@ Object.freeze({
71762
71919
  form: "single",
71763
71920
  optional: false
71764
71921
  }],
71922
+ "deviceRemovalHook.onDeviceRemoved": [{
71923
+ name: "deviceId",
71924
+ form: "single",
71925
+ optional: false
71926
+ }],
71765
71927
  "deviceState.claimFields": [{
71766
71928
  name: "deviceId",
71767
71929
  form: "single",
@@ -71951,6 +72113,11 @@ Object.freeze({
71951
72113
  form: "single",
71952
72114
  optional: false
71953
72115
  }],
72116
+ "keychain.deleteDeviceScope": [{
72117
+ name: "deviceId",
72118
+ form: "single",
72119
+ optional: false
72120
+ }],
71954
72121
  "lawnMowerControl.dock": [{
71955
72122
  name: "deviceId",
71956
72123
  form: "single",
@@ -74299,6 +74466,8 @@ new Set([
74299
74466
  "audio-tools",
74300
74467
  "audio-silence"
74301
74468
  ]);
74469
+ AppPageLangSchema.options;
74470
+ record(string().min(1), string());
74302
74471
  /**
74303
74472
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
74304
74473
  *
@@ -76000,6 +76169,25 @@ var DETAIL_CROP_PADDING_FIELD = {
76000
76169
  default: DEFAULT_DETAIL_CROP_CONVENTION.paddingRatio
76001
76170
  };
76002
76171
  /**
76172
+ * The cadence of the automatic whole-archive face rescore (D866).
76173
+ *
76174
+ * One cluster-wide knob in `pipeline-orchestrator`'s GLOBAL settings, read by
76175
+ * `pipeline-analytics` over the hub-routed `addon-settings` cap on every tick.
76176
+ * It lives here for the same reason the detail-crop convention does: the
76177
+ * writer (orchestrator) and the reader (analytics) are different addons, they
76178
+ * never import each other, and a key copied by hand is how a setting silently
76179
+ * stops arriving.
76180
+ */
76181
+ var FACE_RESCORE_SECTION_ID = "face-rescore";
76182
+ var FACE_RESCORE_INTERVAL_KEY = "faceRescoreIntervalMinutes";
76183
+ /** Slider bounds. `0` is "disabled"; anything in 1..9 is raised to `min`. */
76184
+ var FACE_RESCORE_INTERVAL_FIELD = {
76185
+ min: 0,
76186
+ max: 1440,
76187
+ step: 5,
76188
+ default: 60
76189
+ };
76190
+ /**
76003
76191
  * THE native-frame **lease** knobs — hold depth, RAM budget, demand window and
76004
76192
  * subject-tile budget for the decode worker's native-resolution retention.
76005
76193
  *
@@ -83763,67 +83951,20 @@ function buildRunnerConfig(base, overrides) {
83763
83951
  preRollInferenceFrames: config.preRollInferenceFrames
83764
83952
  };
83765
83953
  }
83766
- var DEVICE_FEATURES_SPEC = {
83767
- collection: "pipeline-orchestrator:device-features",
83768
- columns: [
83769
- {
83770
- name: "deviceId",
83771
- type: "TEXT",
83772
- primaryKey: true,
83773
- notNull: true
83774
- },
83775
- (
83776
- /** The feature name list, verbatim. */
83777
- {
83778
- name: "features",
83779
- type: "JSON",
83780
- notNull: true
83781
- }),
83782
- {
83783
- name: "updatedAt",
83784
- type: "INTEGER",
83785
- notNull: true
83786
- }
83787
- ],
83788
- writeMode: "write-behind",
83789
- keyOf: (row) => String(row.deviceId),
83790
- toValue: (row) => ({
83791
- features: [...row.features],
83792
- updatedAt: row.updatedAt
83793
- }),
83794
- fromRecord: (key, data) => {
83795
- const deviceId = Number(key);
83796
- const raw = data["features"];
83797
- if (!Number.isFinite(deviceId) || !Array.isArray(raw)) return null;
83798
- const features = raw.filter((f) => typeof f === "string");
83799
- if (features.length === 0) return null;
83800
- const updatedAt = Number(data["updatedAt"]);
83801
- return {
83802
- deviceId,
83803
- features,
83804
- updatedAt: Number.isFinite(updatedAt) ? updatedAt : 0,
83805
- restored: true
83806
- };
83807
- },
83808
- deviceIdOf: (row) => row.deviceId
83809
- };
83954
+ //#endregion
83955
+ //#region src/device-features-mirror.ts
83956
+ /** The per-device settings key a device's mirrored features live under. */
83957
+ var DEVICE_FEATURES_KEY = "deviceFeatures";
83810
83958
  var DeviceFeaturesMirror = class {
83811
83959
  /** Process-local fallback, used only when no store was supplied. */
83812
83960
  local = /* @__PURE__ */ new Map();
83813
- durable;
83961
+ settings;
83814
83962
  logger;
83815
83963
  now;
83816
83964
  constructor(deps) {
83817
83965
  this.logger = deps.logger;
83818
83966
  this.now = deps.now ?? (() => Date.now());
83819
- this.durable = deps.store === void 0 ? null : new DurableLedger({
83820
- spec: DEVICE_FEATURES_SPEC,
83821
- store: deps.store,
83822
- logger: deps.logger
83823
- });
83824
- }
83825
- static declare(store) {
83826
- return DurableLedger.declare(store, DEVICE_FEATURES_SPEC);
83967
+ this.settings = deps.settings ?? null;
83827
83968
  }
83828
83969
  /**
83829
83970
  * Seed the mirror from the last session. Call once at boot, after `declare`
@@ -83831,13 +83972,29 @@ var DeviceFeaturesMirror = class {
83831
83972
  * already there when the first read fails.
83832
83973
  */
83833
83974
  async hydrate() {
83834
- if (this.durable === null) return 0;
83835
- const rows = await this.durable.load();
83836
- this.logger.info("device-features mirror restored", { meta: { devices: rows.length } });
83837
- return rows.length;
83975
+ const settings = this.settings;
83976
+ if (settings === null) return 0;
83977
+ const list = settings.listDeviceStoreIds;
83978
+ if (list !== void 0) {
83979
+ const ids = await list.call(settings);
83980
+ const batch = settings.readDeviceStoreBatch;
83981
+ const blobs = batch === void 0 ? new Map(await Promise.all(ids.map(async (id) => [id, await settings.readDeviceStore(id)]))) : await batch.call(settings, ids);
83982
+ for (const [deviceId, blob] of blobs) {
83983
+ const row = rowOf(deviceId, blob[DEVICE_FEATURES_KEY]);
83984
+ if (row !== null) this.local.set(deviceId, row);
83985
+ }
83986
+ }
83987
+ this.logger.info("device-features mirror restored", { meta: { devices: this.local.size } });
83988
+ return this.local.size;
83838
83989
  }
83839
83990
  held(deviceId) {
83840
- return this.durable === null ? this.local.get(deviceId) : this.durable.get(String(deviceId));
83991
+ return this.local.get(deviceId);
83992
+ }
83993
+ async persist(deviceId, features, updatedAt) {
83994
+ await this.settings?.writeDeviceStore(deviceId, { [DEVICE_FEATURES_KEY]: {
83995
+ features: [...features],
83996
+ updatedAt
83997
+ } });
83841
83998
  }
83842
83999
  remember(deviceId, features) {
83843
84000
  const row = {
@@ -83846,20 +84003,19 @@ var DeviceFeaturesMirror = class {
83846
84003
  updatedAt: this.now(),
83847
84004
  restored: false
83848
84005
  };
83849
- if (this.durable === null) {
83850
- this.local.set(deviceId, row);
83851
- return;
83852
- }
83853
- const held = this.durable.get(String(deviceId));
84006
+ const held = this.local.get(deviceId);
84007
+ this.local.set(deviceId, row);
83854
84008
  if (held !== void 0 && !held.restored && sameFeatures(held.features, features)) return;
83855
- this.durable.put(row);
84009
+ this.persist(deviceId, features, row.updatedAt).catch((err) => {
84010
+ this.logger.warn("device-features mirror not persisted", {
84011
+ tags: { deviceId },
84012
+ meta: { error: err instanceof Error ? err.message : String(err) }
84013
+ });
84014
+ });
83856
84015
  }
83857
84016
  drop(deviceId) {
83858
- if (this.durable === null) {
83859
- this.local.delete(deviceId);
83860
- return;
83861
- }
83862
- this.durable.forget(String(deviceId));
84017
+ this.local.delete(deviceId);
84018
+ this.settings?.writeDeviceStore(deviceId, { [DEVICE_FEATURES_KEY]: void 0 });
83863
84019
  }
83864
84020
  /**
83865
84021
  * Resolve a device's features, preferring a fresh read but never letting a
@@ -83908,7 +84064,7 @@ var DeviceFeaturesMirror = class {
83908
84064
  this.drop(deviceId);
83909
84065
  return [];
83910
84066
  }
83911
- /** Drop a device's mirror — call when the device is removed. */
84067
+ /** Drop a device's mirror. (A removed device's settings are cleared centrally, D865.) */
83912
84068
  forget(deviceId) {
83913
84069
  this.drop(deviceId);
83914
84070
  }
@@ -83919,6 +84075,20 @@ function sameFeatures(a, b) {
83919
84075
  const held = new Set(a);
83920
84076
  return b.every((f) => held.has(f));
83921
84077
  }
84078
+ function rowOf(deviceId, raw) {
84079
+ if (typeof raw !== "object" || raw === null) return null;
84080
+ const features = Reflect.get(raw, "features");
84081
+ if (!Array.isArray(features)) return null;
84082
+ const kept = features.filter((f) => typeof f === "string");
84083
+ if (kept.length === 0) return null;
84084
+ const updatedAt = Number(Reflect.get(raw, "updatedAt"));
84085
+ return {
84086
+ deviceId,
84087
+ features: kept,
84088
+ updatedAt: Number.isFinite(updatedAt) ? updatedAt : 0,
84089
+ restored: true
84090
+ };
84091
+ }
83922
84092
  //#endregion
83923
84093
  //#region src/onboard-forwarding-reconcile.ts
83924
84094
  /** The `detectionSources` member that means "this camera's own firmware". */
@@ -84077,9 +84247,10 @@ var DetectionWiringController = class {
84077
84247
  featuresMirror;
84078
84248
  constructor(deps) {
84079
84249
  this.deps = deps;
84250
+ const settings = deps.persistFeatures === true ? deps.ctx().settings : void 0;
84080
84251
  this.featuresMirror = new DeviceFeaturesMirror({
84081
84252
  logger: deps.logger,
84082
- ...deps.featuresStore !== void 0 ? { store: deps.featuresStore } : {}
84253
+ ...settings !== void 0 ? { settings } : {}
84083
84254
  });
84084
84255
  }
84085
84256
  /**
@@ -84088,8 +84259,7 @@ var DetectionWiringController = class {
84088
84259
  * that would have needed it.
84089
84260
  */
84090
84261
  async hydrateFeaturesMirror() {
84091
- if (this.deps.featuresStore === void 0) return;
84092
- await DeviceFeaturesMirror.declare(this.deps.featuresStore);
84262
+ if (this.deps.persistFeatures !== true) return;
84093
84263
  await this.featuresMirror.hydrate();
84094
84264
  }
84095
84265
  /** `activeDetections.get(deviceId)`. */
@@ -94387,7 +94557,7 @@ async function buildOrchestratorControllers(deps) {
94387
94557
  reconcile.scheduleReconcile();
94388
94558
  const detectionWiring = new DetectionWiringController({
94389
94559
  ctx: () => deps.ctx(),
94390
- featuresStore: deps.ctx().api.settingsStore,
94560
+ persistFeatures: true,
94391
94561
  ledger,
94392
94562
  placement,
94393
94563
  audio,
@@ -94607,6 +94777,24 @@ function buildGlobalSettingsSections(options) {
94607
94777
  default: DEFAULT_DETAIL_CROP_CONVENTION.square
94608
94778
  }]
94609
94779
  },
94780
+ {
94781
+ id: FACE_RESCORE_SECTION_ID,
94782
+ title: "Face suggestions",
94783
+ tab: "pipeline",
94784
+ description: "How often the people suggestions on unassigned faces are refreshed against the current gallery. The job only runs when the gallery or the set of unassigned faces changed since the last run; otherwise it does nothing.",
94785
+ fields: [{
94786
+ key: FACE_RESCORE_INTERVAL_KEY,
94787
+ type: "slider",
94788
+ label: "Suggestion refresh interval",
94789
+ description: "0 = off (use the Recompute suggestions button). Values from 1 to 9 run every 10 minutes. The first run happens one interval after the addon starts.",
94790
+ min: FACE_RESCORE_INTERVAL_FIELD.min,
94791
+ max: FACE_RESCORE_INTERVAL_FIELD.max,
94792
+ step: FACE_RESCORE_INTERVAL_FIELD.step,
94793
+ default: FACE_RESCORE_INTERVAL_FIELD.default,
94794
+ showValue: true,
94795
+ unit: "min"
94796
+ }]
94797
+ },
94610
94798
  {
94611
94799
  id: NATIVE_LEASE_SECTION_ID,
94612
94800
  title: "Native frame lease",