@camstack/system 1.2.248 → 1.2.250

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 (53) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  21. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  23. package/dist/builtins/local-network/local-network.addon.js +1 -1
  24. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  25. package/dist/builtins/loki-logging/index.js +1 -1
  26. package/dist/builtins/loki-logging/index.mjs +1 -1
  27. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  29. package/dist/builtins/platform-probe/index.js +1 -1
  30. package/dist/builtins/platform-probe/index.mjs +1 -1
  31. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  33. package/dist/builtins/snapshot/index.js +143 -2
  34. package/dist/builtins/snapshot/index.mjs +143 -2
  35. package/dist/builtins/snapshot/snapshot-durable-store.d.ts +32 -0
  36. package/dist/builtins/snapshot/snapshot.addon.d.ts +19 -0
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  43. package/dist/builtins/system-config/system-config.addon.js +1 -1
  44. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  45. package/dist/builtins/winston-logging/index.js +1 -1
  46. package/dist/builtins/winston-logging/index.mjs +1 -1
  47. package/dist/{dist-C8v6cK8N.mjs → dist-BHlcm97I.mjs} +179 -7
  48. package/dist/{dist-CpXBoZOv.js → dist-BW7x4kAI.js} +179 -7
  49. package/dist/index.js +1 -1
  50. package/dist/index.mjs +1 -1
  51. package/dist/{retired-settings-keys-1sEBolVU.js → retired-settings-keys-CeaYCDU4.js} +1 -1
  52. package/dist/{retired-settings-keys-Dv044bmH.mjs → retired-settings-keys-lPlv147H.mjs} +1 -1
  53. package/package.json +1 -1
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { A as addonPagesCapability, Cn as EventCategory, Xt as errMsg, Zt as BaseAddon } from "../../dist-C8v6cK8N.mjs";
1
+ import { A as addonPagesCapability, Cn as EventCategory, Xt as errMsg, Zt as BaseAddon } from "../../dist-BHlcm97I.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, M as addonWidgetsCapability, Xt as errMsg, Zt as BaseAddon } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, M as addonWidgetsCapability, Xt as errMsg, Zt as BaseAddon } from "../../dist-BHlcm97I.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  //#region src/builtins/alerts/prune-policy.ts
8
8
  /**
9
9
  * Ids older than `cutoffMs`, oldest first.
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, N as alertsCapability, Xt as errMsg, Zt as BaseAddon, n as AlertSchema, un as createEvent } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, N as alertsCapability, Xt as errMsg, Zt as BaseAddon, n as AlertSchema, un as createEvent } from "../../dist-BHlcm97I.mjs";
2
2
  //#region src/builtins/alerts/prune-policy.ts
3
3
  /**
4
4
  * Ids older than `cutoffMs`, oldest first.
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let buffer = require("buffer");
9
9
  let node_fs_promises = require("node:fs/promises");
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, F as backupCapability, Ut as storageOccupancyCapability, Zt as BaseAddon, xt as mayWriteToLocation } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, F as backupCapability, Ut as storageOccupancyCapability, Zt as BaseAddon, xt as mayWriteToLocation } from "../../dist-BHlcm97I.mjs";
2
2
  import { randomBytes, randomUUID } from "node:crypto";
3
3
  import { Buffer as Buffer$1 } from "buffer";
4
4
  import * as fsp from "node:fs/promises";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/console-logging/console-destination.ts
9
9
  var LEVEL_RANK = {
@@ -1,4 +1,4 @@
1
- import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-C8v6cK8N.mjs";
1
+ import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-BHlcm97I.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/console-logging/console-destination.ts
4
4
  var LEVEL_RANK = {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CpXBoZOv.js");
3
+ const require_dist = require("../../dist-BW7x4kAI.js");
4
4
  let node_crypto = require("node:crypto");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  node_fs_promises = require_chunk.__toESM(node_fs_promises);
@@ -1,4 +1,4 @@
1
- import { B as coreBlockAddonId, H as coreBlocksCapability, V as coreBlockIdFromAddonId, Xt as errMsg, Zt as BaseAddon, c as CORE_BLOCK_ADDON_PREFIX, d as DeclaredDevices, l as CoreBlockSchema, s as CORE_BLOCKS_ADDON_ID } from "../../dist-C8v6cK8N.mjs";
1
+ import { B as coreBlockAddonId, H as coreBlocksCapability, V as coreBlockIdFromAddonId, Xt as errMsg, Zt as BaseAddon, c as CORE_BLOCK_ADDON_PREFIX, d as DeclaredDevices, l as CoreBlockSchema, s as CORE_BLOCKS_ADDON_ID } from "../../dist-BHlcm97I.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as fs from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
7
- const require_retired_settings_keys = require("../../retired-settings-keys-1sEBolVU.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
+ const require_retired_settings_keys = require("../../retired-settings-keys-CeaYCDU4.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let _camstack_types_node = require("@camstack/types/node");
10
10
  //#region src/builtins/device-manager/adoption-job-engine.ts
@@ -1,5 +1,5 @@
1
- import { C as STREAM_PROFILE_META, Cn as EventCategory, Et as parseStreamParamsFormPatch, J as deviceStatusCapability, K as deviceManagerCapability, Pt as runtimeStatePolicyFor, Q as enumerateSchemaFields, R as buildStreamParamsConfigSchema, Sn as sleep$1, Xt as errMsg, Z as enumerateItemArrayFields, Zt as BaseAddon, a as CAMERA_SWITCH_ORDER, f as DeviceStatusSchema, gt as locationIconKey, h as LocationIconIdSchema, hn as isDeviceConfigCap, jt as resolveContainerPrimaryChild, nn as DeviceRole, o as CAP_NAMES_WITH_STATUS, on as WELL_KNOWN_TAB_MAP, q as deviceStateCapability, rn as DeviceType, t as ALL_CAPABILITY_DEFINITIONS, tn as DeviceFeature, wt as normalizeUnit, zt as siteZoneKey } from "../../dist-C8v6cK8N.mjs";
2
- import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-Dv044bmH.mjs";
1
+ import { C as STREAM_PROFILE_META, Cn as EventCategory, Et as parseStreamParamsFormPatch, J as deviceStatusCapability, K as deviceManagerCapability, Pt as runtimeStatePolicyFor, Q as enumerateSchemaFields, R as buildStreamParamsConfigSchema, Sn as sleep$1, Xt as errMsg, Z as enumerateItemArrayFields, Zt as BaseAddon, a as CAMERA_SWITCH_ORDER, f as DeviceStatusSchema, gt as locationIconKey, h as LocationIconIdSchema, hn as isDeviceConfigCap, jt as resolveContainerPrimaryChild, nn as DeviceRole, o as CAP_NAMES_WITH_STATUS, on as WELL_KNOWN_TAB_MAP, q as deviceStateCapability, rn as DeviceType, t as ALL_CAPABILITY_DEFINITIONS, tn as DeviceFeature, wt as normalizeUnit, zt as siteZoneKey } from "../../dist-BHlcm97I.mjs";
2
+ import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-lPlv147H.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { canonicalDeviceFingerprint } from "@camstack/types/node";
5
5
  //#region src/builtins/device-manager/adoption-job-engine.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  //#region src/builtins/doorbell/trigger-engine.ts
8
8
  /**
9
9
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -1,4 +1,4 @@
1
- import { $ as evaluateSensorEdge, Cn as EventCategory, I as bareAddonId, Xt as errMsg, Y as doorbellCapability, Zt as BaseAddon, b as SOURCE_CAPS, lt as isSameAddonId, rn as DeviceType, un as createEvent, ut as isSourceCap, x as SOURCE_DEVICE_TYPES } from "../../dist-C8v6cK8N.mjs";
1
+ import { $ as evaluateSensorEdge, Cn as EventCategory, I as bareAddonId, Xt as errMsg, Y as doorbellCapability, Zt as BaseAddon, b as SOURCE_CAPS, lt as isSameAddonId, rn as DeviceType, un as createEvent, ut as isSourceCap, x as SOURCE_DEVICE_TYPES } from "../../dist-BHlcm97I.mjs";
2
2
  //#region src/builtins/doorbell/trigger-engine.ts
3
3
  /**
4
4
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
9
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,4 +1,4 @@
1
- import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-C8v6cK8N.mjs";
1
+ import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-BHlcm97I.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
4
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CpXBoZOv.js");
3
+ const require_dist = require("../../dist-BW7x4kAI.js");
4
4
  //#region src/builtins/liveness-monitor/liveness-checks.ts
5
5
  var NO_DEVICES = "liveness:no-devices";
6
6
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, Xt as errMsg, Zt as BaseAddon, un as createEvent, y as RecordingStatusSchema } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, Xt as errMsg, Zt as BaseAddon, un as createEvent, y as RecordingStatusSchema } from "../../dist-BHlcm97I.mjs";
2
2
  //#region src/builtins/liveness-monitor/liveness-checks.ts
3
3
  var NO_DEVICES = "liveness:no-devices";
4
4
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  node_crypto = require_chunk.__toESM(node_crypto);
9
9
  let crypto$1 = require("crypto");
@@ -1,5 +1,5 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Kt as userManagementCapability, P as authProviderCapability, Zt as BaseAddon, k as UserRecordSchema, r as ApiKeyRecordSchema, w as ScopedTokenSchema } from "../../dist-C8v6cK8N.mjs";
2
+ import { Kt as userManagementCapability, P as authProviderCapability, Zt as BaseAddon, k as UserRecordSchema, r as ApiKeyRecordSchema, w as ScopedTokenSchema } from "../../dist-BHlcm97I.mjs";
3
3
  import * as crypto$2 from "node:crypto";
4
4
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
5
5
  import nodeCrypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CpXBoZOv.js");
3
+ const require_dist = require("../../dist-BW7x4kAI.js");
4
4
  const require_tls = require("../../tls-BFs4PzoW.js");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, Zt as BaseAddon, ht as localNetworkCapability } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, Zt as BaseAddon, ht as localNetworkCapability } from "../../dist-BHlcm97I.mjs";
2
2
  import { S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, i as writeExtraSans, l as reissueTlsLeaf, n as readTlsAccessStatus, o as validateUploadedTls, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, y as applyLanHttp } from "../../tls-2xbgg78V.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  //#region src/builtins/loki-logging/loki-payload.ts
8
8
  /**
9
9
  * Loki rejects a label name that is not a valid Prometheus label
@@ -1,4 +1,4 @@
1
- import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-C8v6cK8N.mjs";
1
+ import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-BHlcm97I.mjs";
2
2
  //#region src/builtins/loki-logging/loki-payload.ts
3
3
  /**
4
4
  * Loki rejects a label name that is not a valid Prometheus label
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_fs = require("node:fs");
9
9
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,4 +1,4 @@
1
- import { At as resolveBucketMs, Cn as EventCategory, St as metricsProviderCapability, Xt as errMsg, Zt as BaseAddon, kt as reducePoints, rt as foldSnapshotByFunction, un as createEvent } from "../../dist-C8v6cK8N.mjs";
1
+ import { At as resolveBucketMs, Cn as EventCategory, St as metricsProviderCapability, Xt as errMsg, Zt as BaseAddon, kt as reducePoints, rt as foldSnapshotByFunction, un as createEvent } from "../../dist-BHlcm97I.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import * as fs from "node:fs";
4
4
  import { constants, readFileSync } from "node:fs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  let node_fs = require("node:fs");
8
8
  node_fs = require_chunk.__toESM(node_fs);
9
9
  let node_child_process = require("node:child_process");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Cn as EventCategory, Dt as platformProbeCapability, Lt as scoreRuntimes, X as enumerateInferenceDevices, Xt as errMsg, Zt as BaseAddon, fn as emitReadiness } from "../../dist-C8v6cK8N.mjs";
2
+ import { Cn as EventCategory, Dt as platformProbeCapability, Lt as scoreRuntimes, X as enumerateInferenceDevices, Xt as errMsg, Zt as BaseAddon, fn as emitReadiness } from "../../dist-BHlcm97I.mjs";
3
3
  import * as fs from "node:fs";
4
4
  import { execFile } from "node:child_process";
5
5
  import * as os from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { Cn as EventCategory, Zt as BaseAddon } from "../../dist-C8v6cK8N.mjs";
1
+ import { Cn as EventCategory, Zt as BaseAddon } from "../../dist-BHlcm97I.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,11 +3,13 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CpXBoZOv.js");
6
+ const require_dist = require("../../dist-BW7x4kAI.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-Cqs7GkOV.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
10
10
  let _camstack_types_node = require("@camstack/types/node");
11
+ let node_path = require("node:path");
12
+ let node_fs = require("node:fs");
11
13
  let node_child_process = require("node:child_process");
12
14
  let sharp = require("sharp");
13
15
  sharp = require_chunk.__toESM(sharp);
@@ -129,6 +131,105 @@ var SnapshotCache = class {
129
131
  }
130
132
  };
131
133
  //#endregion
134
+ //#region src/builtins/snapshot/snapshot-durable-store.ts
135
+ /**
136
+ * The last good frame per camera, on disk, so it outlives the process.
137
+ *
138
+ * ## Why
139
+ *
140
+ * The snapshot cache is RAM-only and says so: *"after a hub restart this
141
+ * legitimately answers nothing and the generated card is the picture"*. That is
142
+ * accurate and it is also the whole defect, because the cameras that most need
143
+ * a cached frame are the ones that can never be asked for a fresh one. A
144
+ * sleeping battery camera refuses every snapshot that does not carry `force`,
145
+ * and the sentry deliberately never passes it — forcing would wake the very
146
+ * camera the window exists so as not to disturb.
147
+ *
148
+ * Measured 2026-09-17: the baby monitor showed the courtesy card all morning.
149
+ * Nothing was broken. Three server updates had emptied the cache, and the
150
+ * camera had been asleep since.
151
+ *
152
+ * ## Shape
153
+ *
154
+ * One file per device under the addon's OWN private directory (`ctx.dataDir` —
155
+ * `<nodeDataDir>/addons-data/<addonId>`, which the addon owns exclusively), and
156
+ * it is overwritten rather than appended: what is wanted is A recent frame, not
157
+ * a history. A history here would grow without a reaper and compete with the
158
+ * recordings for the same disk.
159
+ *
160
+ * Writes are THROTTLED per device. Snapshots are captured far more often than a
161
+ * process restarts, and persisting every one buys nothing — one recent frame is
162
+ * the entire value.
163
+ *
164
+ * Nothing here throws. The caller already has its picture; persistence is a
165
+ * bonus for the NEXT boot, and a disk that refuses must never cost a snapshot
166
+ * that succeeded. A frame that cannot be read is reported ABSENT, never as an
167
+ * error and never as an empty buffer — absent is the truth and the courtesy
168
+ * card is the correct answer to it.
169
+ */
170
+ /** One recent frame is the value; a newer one is not worth the disk. */
171
+ var DEFAULT_MIN_INTERVAL_MS = 6e4;
172
+ /** Its own subdirectory, so the addon's other state is never mistaken for a frame. */
173
+ var SUBDIR = "last-frame";
174
+ var SnapshotDurableStore = class {
175
+ dir;
176
+ minIntervalMs;
177
+ now;
178
+ /** Last write per device, so the throttle survives without touching disk. */
179
+ lastWriteMs = /* @__PURE__ */ new Map();
180
+ constructor(options) {
181
+ this.dir = (0, node_path.join)(options.dataDir, SUBDIR);
182
+ this.minIntervalMs = options.minIntervalMs ?? DEFAULT_MIN_INTERVAL_MS;
183
+ this.now = options.now ?? (() => Date.now());
184
+ }
185
+ /** @returns whether the frame was written. `false` is throttled or refused. */
186
+ async put(deviceId, jpeg) {
187
+ if (jpeg.length === 0) return false;
188
+ const at = this.now();
189
+ const previous = this.lastWriteMs.get(deviceId);
190
+ if (previous !== void 0 && at - previous < this.minIntervalMs) return false;
191
+ try {
192
+ await node_fs.promises.mkdir(this.dir, { recursive: true });
193
+ const target = this.pathFor(deviceId);
194
+ const staging = `${target}.writing`;
195
+ await node_fs.promises.writeFile(staging, jpeg);
196
+ await node_fs.promises.rename(staging, target);
197
+ this.lastWriteMs.set(deviceId, at);
198
+ return true;
199
+ } catch {
200
+ return false;
201
+ }
202
+ }
203
+ /** The frame from a previous process, or `null` — which is a real answer. */
204
+ async get(deviceId) {
205
+ return (await this.getDated(deviceId))?.jpeg ?? null;
206
+ }
207
+ /**
208
+ * The frame WITH the moment it was captured.
209
+ *
210
+ * The age travels with it because everything downstream decides on age, and
211
+ * a frame restored from disk that claims to be new is worse than no frame:
212
+ * it would satisfy a freshness gate it has no right to pass. The file's own
213
+ * mtime is the honest answer — it is when this frame was written.
214
+ */
215
+ async getDated(deviceId) {
216
+ try {
217
+ const path = this.pathFor(deviceId);
218
+ const [jpeg, stat] = await Promise.all([node_fs.promises.readFile(path), node_fs.promises.stat(path)]);
219
+ if (jpeg.length === 0) return null;
220
+ return {
221
+ jpeg,
222
+ capturedAtMs: stat.mtimeMs
223
+ };
224
+ } catch {
225
+ return null;
226
+ }
227
+ }
228
+ pathFor(deviceId) {
229
+ return (0, node_path.join)(this.dir, `${String(deviceId)}.jpg`);
230
+ }
231
+ };
232
+ //#endregion
132
233
  //#region src/builtins/snapshot/snapshot-coalescing.ts
133
234
  /**
134
235
  * Pure, side-effect-free coalescing / stale-while-revalidate / bounded-pool
@@ -948,6 +1049,26 @@ var SnapshotAddon = class SnapshotAddon extends require_dist.BaseAddon {
948
1049
  */
949
1050
  /** Cameras resting after a native miss — see `snapshot-fatigue.ts`. */
950
1051
  fatigue = new NativeSnapshotFatigue();
1052
+ /**
1053
+ * The last good frame per camera, on disk, so it outlives the process.
1054
+ *
1055
+ * The cache above is RAM-only and the cameras that most need it are the ones
1056
+ * that can never be asked for a fresh frame: a sleeping battery camera
1057
+ * refuses every snapshot without `force`, and the background callers that
1058
+ * would want one deliberately never pass it. Measured 2026-09-17 — the baby
1059
+ * monitor showed the courtesy card all morning because three server updates
1060
+ * had emptied this cache and the camera had been asleep since.
1061
+ */
1062
+ durableStore = null;
1063
+ /**
1064
+ * Built on first use, never in a field initializer: `ctx` does not exist
1065
+ * until `initialize()`, and reading it at construction throws
1066
+ * "ctx accessed before initialize()" for the whole addon.
1067
+ */
1068
+ get durable() {
1069
+ this.durableStore ??= new SnapshotDurableStore({ dataDir: this.ctx.dataDir });
1070
+ return this.durableStore;
1071
+ }
951
1072
  cache = new SnapshotCache({ onEvict: (deviceId, streamId, reason) => {
952
1073
  this.ctx.logger.debug("snapshot cache evicted", {
953
1074
  tags: { deviceId },
@@ -1611,7 +1732,8 @@ var SnapshotAddon = class SnapshotAddon extends require_dist.BaseAddon {
1611
1732
  ageMs: hit ? now - hit.ts : null
1612
1733
  }
1613
1734
  });
1614
- return await this.stateImage(deviceId, state.reason, deviceName, hit);
1735
+ const base = hit ?? await this.durableEntry(deviceId);
1736
+ return await this.stateImage(deviceId, state.reason, deviceName, base);
1615
1737
  }
1616
1738
  const effectiveMaxAgeMs = Math.min(maximumCacheAgeMs, Math.max(0, effectiveMaxAgeS(prefs, isBatteryDevice) * 1e3));
1617
1739
  const decision = decideSnapshotServe({
@@ -1766,6 +1888,7 @@ var SnapshotAddon = class SnapshotAddon extends require_dist.BaseAddon {
1766
1888
  ts: now,
1767
1889
  streamId: effectiveStreamId ?? null
1768
1890
  });
1891
+ this.durable.put(deviceId, Buffer.from(result.base64, "base64"));
1769
1892
  return {
1770
1893
  ok: true,
1771
1894
  image: result
@@ -1813,6 +1936,7 @@ var SnapshotAddon = class SnapshotAddon extends require_dist.BaseAddon {
1813
1936
  ts: now,
1814
1937
  streamId: effectiveStreamId ?? null
1815
1938
  });
1939
+ this.durable.put(deviceId, Buffer.from(fallback.base64, "base64"));
1816
1940
  return {
1817
1941
  ok: true,
1818
1942
  image: fallback
@@ -2278,6 +2402,23 @@ var SnapshotAddon = class SnapshotAddon extends require_dist.BaseAddon {
2278
2402
  * the answer by itself; if it cannot be decoded, fall back to the generated
2279
2403
  * courtesy background rather than leaking an unlabelled stale frame.
2280
2404
  */
2405
+ /** The persisted frame as a cache entry, with its real age. */
2406
+ async durableEntry(deviceId) {
2407
+ const dated = await this.durable.getDated(deviceId);
2408
+ if (dated === null) return void 0;
2409
+ this.ctx.logger.debug("snapshot: serving the frame kept from a previous process", {
2410
+ tags: { deviceId },
2411
+ meta: { ageMs: Date.now() - dated.capturedAtMs }
2412
+ });
2413
+ return {
2414
+ data: {
2415
+ base64: dated.jpeg.toString("base64"),
2416
+ contentType: "image/jpeg"
2417
+ },
2418
+ ts: dated.capturedAtMs,
2419
+ streamId: null
2420
+ };
2421
+ }
2281
2422
  async stateImage(deviceId, reason, deviceName, hit) {
2282
2423
  const resolvedName = deviceName ?? `#${String(deviceId)}`;
2283
2424
  if (!hit) return await this.courtesyImage(deviceId, reason, resolvedName);