@camstack/system 1.2.248 → 1.2.249
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/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +143 -2
- package/dist/builtins/snapshot/index.mjs +143 -2
- package/dist/builtins/snapshot/snapshot-durable-store.d.ts +32 -0
- package/dist/builtins/snapshot/snapshot.addon.d.ts +19 -0
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-C8v6cK8N.mjs → dist-B67DC-Ss.mjs} +1 -1
- package/dist/{dist-CpXBoZOv.js → dist-DluLUTzR.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{retired-settings-keys-1sEBolVU.js → retired-settings-keys-VcrnwKN0.js} +1 -1
- package/dist/{retired-settings-keys-Dv044bmH.mjs → retired-settings-keys-oN5dGOi5.mjs} +1 -1
- 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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { A as addonPagesCapability, Cn as EventCategory, Xt as errMsg, Zt as BaseAddon } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, M as addonWidgetsCapability, Xt as errMsg, Zt as BaseAddon } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, N as alertsCapability, Xt as errMsg, Zt as BaseAddon, n as AlertSchema, un as createEvent } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, F as backupCapability, Ut as storageOccupancyCapability, Zt as BaseAddon, xt as mayWriteToLocation } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-B67DC-Ss.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-
|
|
3
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
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-B67DC-Ss.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-
|
|
7
|
-
const require_retired_settings_keys = require("../../retired-settings-keys-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.js");
|
|
7
|
+
const require_retired_settings_keys = require("../../retired-settings-keys-VcrnwKN0.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-
|
|
2
|
-
import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-
|
|
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-B67DC-Ss.mjs";
|
|
2
|
+
import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-oN5dGOi5.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
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-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-B67DC-Ss.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-
|
|
3
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, Xt as errMsg, Zt as BaseAddon, un as createEvent, y as RecordingStatusSchema } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
2
|
+
import { Kt as userManagementCapability, P as authProviderCapability, Zt as BaseAddon, k as UserRecordSchema, r as ApiKeyRecordSchema, w as ScopedTokenSchema } from "../../dist-B67DC-Ss.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-
|
|
3
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, Zt as BaseAddon, ht as localNetworkCapability } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
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-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
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-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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-
|
|
1
|
+
import { Cn as EventCategory, Zt as BaseAddon } from "../../dist-B67DC-Ss.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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.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
|
-
|
|
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);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Bt as snapshotCapability, Cn as EventCategory, G as deriveBatteryPresence, Gt as streamQualityLabel, I as bareAddonId, L as batteryCapability, Xt as errMsg, Zt as BaseAddon, gn as nodePin, i as BatteryStatusSchema, rn as DeviceType, tn as DeviceFeature } from "../../dist-
|
|
1
|
+
import { Bt as snapshotCapability, Cn as EventCategory, G as deriveBatteryPresence, Gt as streamQualityLabel, I as bareAddonId, L as batteryCapability, Xt as errMsg, Zt as BaseAddon, gn as nodePin, i as BatteryStatusSchema, rn as DeviceType, tn as DeviceFeature } from "../../dist-B67DC-Ss.mjs";
|
|
2
2
|
import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CZPvteq2.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { signExpiringUrl, verifyExpiringUrl } from "@camstack/types/node";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { promises } from "node:fs";
|
|
6
8
|
import { execFile } from "node:child_process";
|
|
7
9
|
import sharp from "sharp";
|
|
8
10
|
//#region src/builtins/snapshot/snapshot-cache.ts
|
|
@@ -123,6 +125,105 @@ var SnapshotCache = class {
|
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
//#endregion
|
|
128
|
+
//#region src/builtins/snapshot/snapshot-durable-store.ts
|
|
129
|
+
/**
|
|
130
|
+
* The last good frame per camera, on disk, so it outlives the process.
|
|
131
|
+
*
|
|
132
|
+
* ## Why
|
|
133
|
+
*
|
|
134
|
+
* The snapshot cache is RAM-only and says so: *"after a hub restart this
|
|
135
|
+
* legitimately answers nothing and the generated card is the picture"*. That is
|
|
136
|
+
* accurate and it is also the whole defect, because the cameras that most need
|
|
137
|
+
* a cached frame are the ones that can never be asked for a fresh one. A
|
|
138
|
+
* sleeping battery camera refuses every snapshot that does not carry `force`,
|
|
139
|
+
* and the sentry deliberately never passes it — forcing would wake the very
|
|
140
|
+
* camera the window exists so as not to disturb.
|
|
141
|
+
*
|
|
142
|
+
* Measured 2026-09-17: the baby monitor showed the courtesy card all morning.
|
|
143
|
+
* Nothing was broken. Three server updates had emptied the cache, and the
|
|
144
|
+
* camera had been asleep since.
|
|
145
|
+
*
|
|
146
|
+
* ## Shape
|
|
147
|
+
*
|
|
148
|
+
* One file per device under the addon's OWN private directory (`ctx.dataDir` —
|
|
149
|
+
* `<nodeDataDir>/addons-data/<addonId>`, which the addon owns exclusively), and
|
|
150
|
+
* it is overwritten rather than appended: what is wanted is A recent frame, not
|
|
151
|
+
* a history. A history here would grow without a reaper and compete with the
|
|
152
|
+
* recordings for the same disk.
|
|
153
|
+
*
|
|
154
|
+
* Writes are THROTTLED per device. Snapshots are captured far more often than a
|
|
155
|
+
* process restarts, and persisting every one buys nothing — one recent frame is
|
|
156
|
+
* the entire value.
|
|
157
|
+
*
|
|
158
|
+
* Nothing here throws. The caller already has its picture; persistence is a
|
|
159
|
+
* bonus for the NEXT boot, and a disk that refuses must never cost a snapshot
|
|
160
|
+
* that succeeded. A frame that cannot be read is reported ABSENT, never as an
|
|
161
|
+
* error and never as an empty buffer — absent is the truth and the courtesy
|
|
162
|
+
* card is the correct answer to it.
|
|
163
|
+
*/
|
|
164
|
+
/** One recent frame is the value; a newer one is not worth the disk. */
|
|
165
|
+
var DEFAULT_MIN_INTERVAL_MS = 6e4;
|
|
166
|
+
/** Its own subdirectory, so the addon's other state is never mistaken for a frame. */
|
|
167
|
+
var SUBDIR = "last-frame";
|
|
168
|
+
var SnapshotDurableStore = class {
|
|
169
|
+
dir;
|
|
170
|
+
minIntervalMs;
|
|
171
|
+
now;
|
|
172
|
+
/** Last write per device, so the throttle survives without touching disk. */
|
|
173
|
+
lastWriteMs = /* @__PURE__ */ new Map();
|
|
174
|
+
constructor(options) {
|
|
175
|
+
this.dir = join(options.dataDir, SUBDIR);
|
|
176
|
+
this.minIntervalMs = options.minIntervalMs ?? DEFAULT_MIN_INTERVAL_MS;
|
|
177
|
+
this.now = options.now ?? (() => Date.now());
|
|
178
|
+
}
|
|
179
|
+
/** @returns whether the frame was written. `false` is throttled or refused. */
|
|
180
|
+
async put(deviceId, jpeg) {
|
|
181
|
+
if (jpeg.length === 0) return false;
|
|
182
|
+
const at = this.now();
|
|
183
|
+
const previous = this.lastWriteMs.get(deviceId);
|
|
184
|
+
if (previous !== void 0 && at - previous < this.minIntervalMs) return false;
|
|
185
|
+
try {
|
|
186
|
+
await promises.mkdir(this.dir, { recursive: true });
|
|
187
|
+
const target = this.pathFor(deviceId);
|
|
188
|
+
const staging = `${target}.writing`;
|
|
189
|
+
await promises.writeFile(staging, jpeg);
|
|
190
|
+
await promises.rename(staging, target);
|
|
191
|
+
this.lastWriteMs.set(deviceId, at);
|
|
192
|
+
return true;
|
|
193
|
+
} catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/** The frame from a previous process, or `null` — which is a real answer. */
|
|
198
|
+
async get(deviceId) {
|
|
199
|
+
return (await this.getDated(deviceId))?.jpeg ?? null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The frame WITH the moment it was captured.
|
|
203
|
+
*
|
|
204
|
+
* The age travels with it because everything downstream decides on age, and
|
|
205
|
+
* a frame restored from disk that claims to be new is worse than no frame:
|
|
206
|
+
* it would satisfy a freshness gate it has no right to pass. The file's own
|
|
207
|
+
* mtime is the honest answer — it is when this frame was written.
|
|
208
|
+
*/
|
|
209
|
+
async getDated(deviceId) {
|
|
210
|
+
try {
|
|
211
|
+
const path = this.pathFor(deviceId);
|
|
212
|
+
const [jpeg, stat] = await Promise.all([promises.readFile(path), promises.stat(path)]);
|
|
213
|
+
if (jpeg.length === 0) return null;
|
|
214
|
+
return {
|
|
215
|
+
jpeg,
|
|
216
|
+
capturedAtMs: stat.mtimeMs
|
|
217
|
+
};
|
|
218
|
+
} catch {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
pathFor(deviceId) {
|
|
223
|
+
return join(this.dir, `${String(deviceId)}.jpg`);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
126
227
|
//#region src/builtins/snapshot/snapshot-coalescing.ts
|
|
127
228
|
/**
|
|
128
229
|
* Pure, side-effect-free coalescing / stale-while-revalidate / bounded-pool
|
|
@@ -942,6 +1043,26 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
|
|
|
942
1043
|
*/
|
|
943
1044
|
/** Cameras resting after a native miss — see `snapshot-fatigue.ts`. */
|
|
944
1045
|
fatigue = new NativeSnapshotFatigue();
|
|
1046
|
+
/**
|
|
1047
|
+
* The last good frame per camera, on disk, so it outlives the process.
|
|
1048
|
+
*
|
|
1049
|
+
* The cache above is RAM-only and the cameras that most need it are the ones
|
|
1050
|
+
* that can never be asked for a fresh frame: a sleeping battery camera
|
|
1051
|
+
* refuses every snapshot without `force`, and the background callers that
|
|
1052
|
+
* would want one deliberately never pass it. Measured 2026-09-17 — the baby
|
|
1053
|
+
* monitor showed the courtesy card all morning because three server updates
|
|
1054
|
+
* had emptied this cache and the camera had been asleep since.
|
|
1055
|
+
*/
|
|
1056
|
+
durableStore = null;
|
|
1057
|
+
/**
|
|
1058
|
+
* Built on first use, never in a field initializer: `ctx` does not exist
|
|
1059
|
+
* until `initialize()`, and reading it at construction throws
|
|
1060
|
+
* "ctx accessed before initialize()" for the whole addon.
|
|
1061
|
+
*/
|
|
1062
|
+
get durable() {
|
|
1063
|
+
this.durableStore ??= new SnapshotDurableStore({ dataDir: this.ctx.dataDir });
|
|
1064
|
+
return this.durableStore;
|
|
1065
|
+
}
|
|
945
1066
|
cache = new SnapshotCache({ onEvict: (deviceId, streamId, reason) => {
|
|
946
1067
|
this.ctx.logger.debug("snapshot cache evicted", {
|
|
947
1068
|
tags: { deviceId },
|
|
@@ -1605,7 +1726,8 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
|
|
|
1605
1726
|
ageMs: hit ? now - hit.ts : null
|
|
1606
1727
|
}
|
|
1607
1728
|
});
|
|
1608
|
-
|
|
1729
|
+
const base = hit ?? await this.durableEntry(deviceId);
|
|
1730
|
+
return await this.stateImage(deviceId, state.reason, deviceName, base);
|
|
1609
1731
|
}
|
|
1610
1732
|
const effectiveMaxAgeMs = Math.min(maximumCacheAgeMs, Math.max(0, effectiveMaxAgeS(prefs, isBatteryDevice) * 1e3));
|
|
1611
1733
|
const decision = decideSnapshotServe({
|
|
@@ -1760,6 +1882,7 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
|
|
|
1760
1882
|
ts: now,
|
|
1761
1883
|
streamId: effectiveStreamId ?? null
|
|
1762
1884
|
});
|
|
1885
|
+
this.durable.put(deviceId, Buffer.from(result.base64, "base64"));
|
|
1763
1886
|
return {
|
|
1764
1887
|
ok: true,
|
|
1765
1888
|
image: result
|
|
@@ -1807,6 +1930,7 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
|
|
|
1807
1930
|
ts: now,
|
|
1808
1931
|
streamId: effectiveStreamId ?? null
|
|
1809
1932
|
});
|
|
1933
|
+
this.durable.put(deviceId, Buffer.from(fallback.base64, "base64"));
|
|
1810
1934
|
return {
|
|
1811
1935
|
ok: true,
|
|
1812
1936
|
image: fallback
|
|
@@ -2272,6 +2396,23 @@ var SnapshotAddon = class SnapshotAddon extends BaseAddon {
|
|
|
2272
2396
|
* the answer by itself; if it cannot be decoded, fall back to the generated
|
|
2273
2397
|
* courtesy background rather than leaking an unlabelled stale frame.
|
|
2274
2398
|
*/
|
|
2399
|
+
/** The persisted frame as a cache entry, with its real age. */
|
|
2400
|
+
async durableEntry(deviceId) {
|
|
2401
|
+
const dated = await this.durable.getDated(deviceId);
|
|
2402
|
+
if (dated === null) return void 0;
|
|
2403
|
+
this.ctx.logger.debug("snapshot: serving the frame kept from a previous process", {
|
|
2404
|
+
tags: { deviceId },
|
|
2405
|
+
meta: { ageMs: Date.now() - dated.capturedAtMs }
|
|
2406
|
+
});
|
|
2407
|
+
return {
|
|
2408
|
+
data: {
|
|
2409
|
+
base64: dated.jpeg.toString("base64"),
|
|
2410
|
+
contentType: "image/jpeg"
|
|
2411
|
+
},
|
|
2412
|
+
ts: dated.capturedAtMs,
|
|
2413
|
+
streamId: null
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2275
2416
|
async stateImage(deviceId, reason, deviceName, hit) {
|
|
2276
2417
|
const resolvedName = deviceName ?? `#${String(deviceId)}`;
|
|
2277
2418
|
if (!hit) return await this.courtesyImage(deviceId, reason, resolvedName);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface SnapshotDurableStoreOptions {
|
|
2
|
+
/** `ctx.dataDir` — the addon's exclusive directory. */
|
|
3
|
+
readonly dataDir: string;
|
|
4
|
+
readonly minIntervalMs?: number;
|
|
5
|
+
/** Injectable for tests; `Date.now` otherwise. */
|
|
6
|
+
readonly now?: () => number;
|
|
7
|
+
}
|
|
8
|
+
export declare class SnapshotDurableStore {
|
|
9
|
+
private readonly dir;
|
|
10
|
+
private readonly minIntervalMs;
|
|
11
|
+
private readonly now;
|
|
12
|
+
/** Last write per device, so the throttle survives without touching disk. */
|
|
13
|
+
private readonly lastWriteMs;
|
|
14
|
+
constructor(options: SnapshotDurableStoreOptions);
|
|
15
|
+
/** @returns whether the frame was written. `false` is throttled or refused. */
|
|
16
|
+
put(deviceId: number, jpeg: Buffer): Promise<boolean>;
|
|
17
|
+
/** The frame from a previous process, or `null` — which is a real answer. */
|
|
18
|
+
get(deviceId: number): Promise<Buffer | null>;
|
|
19
|
+
/**
|
|
20
|
+
* The frame WITH the moment it was captured.
|
|
21
|
+
*
|
|
22
|
+
* The age travels with it because everything downstream decides on age, and
|
|
23
|
+
* a frame restored from disk that claims to be new is worse than no frame:
|
|
24
|
+
* it would satisfy a freshness gate it has no right to pass. The file's own
|
|
25
|
+
* mtime is the honest answer — it is when this frame was written.
|
|
26
|
+
*/
|
|
27
|
+
getDated(deviceId: number): Promise<{
|
|
28
|
+
jpeg: Buffer;
|
|
29
|
+
capturedAtMs: number;
|
|
30
|
+
} | null>;
|
|
31
|
+
private pathFor;
|
|
32
|
+
}
|
|
@@ -38,6 +38,23 @@ export declare class SnapshotAddon extends BaseAddon<SnapshotAddonConfig> {
|
|
|
38
38
|
*/
|
|
39
39
|
/** Cameras resting after a native miss — see `snapshot-fatigue.ts`. */
|
|
40
40
|
private readonly fatigue;
|
|
41
|
+
/**
|
|
42
|
+
* The last good frame per camera, on disk, so it outlives the process.
|
|
43
|
+
*
|
|
44
|
+
* The cache above is RAM-only and the cameras that most need it are the ones
|
|
45
|
+
* that can never be asked for a fresh frame: a sleeping battery camera
|
|
46
|
+
* refuses every snapshot without `force`, and the background callers that
|
|
47
|
+
* would want one deliberately never pass it. Measured 2026-09-17 — the baby
|
|
48
|
+
* monitor showed the courtesy card all morning because three server updates
|
|
49
|
+
* had emptied this cache and the camera had been asleep since.
|
|
50
|
+
*/
|
|
51
|
+
private durableStore;
|
|
52
|
+
/**
|
|
53
|
+
* Built on first use, never in a field initializer: `ctx` does not exist
|
|
54
|
+
* until `initialize()`, and reading it at construction throws
|
|
55
|
+
* "ctx accessed before initialize()" for the whole addon.
|
|
56
|
+
*/
|
|
57
|
+
private get durable();
|
|
41
58
|
private readonly cache;
|
|
42
59
|
/** Card-sized derivatives of the frames above, keyed by width and validated
|
|
43
60
|
* against the source frame's timestamp. */
|
|
@@ -487,6 +504,8 @@ export declare class SnapshotAddon extends BaseAddon<SnapshotAddonConfig> {
|
|
|
487
504
|
* the answer by itself; if it cannot be decoded, fall back to the generated
|
|
488
505
|
* courtesy background rather than leaking an unlabelled stale frame.
|
|
489
506
|
*/
|
|
507
|
+
/** The persisted frame as a cache entry, with its real age. */
|
|
508
|
+
private durableEntry;
|
|
490
509
|
private stateImage;
|
|
491
510
|
/**
|
|
492
511
|
* Single-trip device lookup against device-manager — memoized for
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let node_fs_promises = require("node:fs/promises");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wt as storageProviderCapability, Zt as BaseAddon, nt as filesystemBrowseCapability } from "../../dist-
|
|
1
|
+
import { Wt as storageProviderCapability, Zt as BaseAddon, nt as filesystemBrowseCapability } from "../../dist-B67DC-Ss.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
Binary file
|
|
Binary file
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.js");
|
|
7
7
|
const require_hub_cap_forward = require("../../hub-cap-forward-DmHNjbB0.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cn as EventCategory, Ct as modeMayWrite, D as StorageLocationTypeSchema, E as StorageLocationModeSchema, Ht as storageMigrationCapability, Mt as resolveLocationMode, O as StorageMigrationJobSchema, Rt as settingsStoreCapability, T as StorageCleanupJobSchema, Vt as storageCapability, Yt as withLocationMode, Zt as BaseAddon, _ as REDACTED_SECRET, _n as parseJsonObject, bt as mayReadLocation, et as evictionPolicyOfLocation, it as gbToBytes, m as LegacyStorageLocationDefaultSchema, pt as legacyModeOf, st as isLocationEnabled, xt as mayWriteToLocation, z as collectSecretConfigKeys } from "../../dist-
|
|
1
|
+
import { Cn as EventCategory, Ct as modeMayWrite, D as StorageLocationTypeSchema, E as StorageLocationModeSchema, Ht as storageMigrationCapability, Mt as resolveLocationMode, O as StorageMigrationJobSchema, Rt as settingsStoreCapability, T as StorageCleanupJobSchema, Vt as storageCapability, Yt as withLocationMode, Zt as BaseAddon, _ as REDACTED_SECRET, _n as parseJsonObject, bt as mayReadLocation, et as evictionPolicyOfLocation, it as gbToBytes, m as LegacyStorageLocationDefaultSchema, pt as legacyModeOf, st as isLocationEnabled, xt as mayWriteToLocation, z as collectSecretConfigKeys } from "../../dist-B67DC-Ss.mjs";
|
|
2
2
|
import { t as HUB_CAP_FWD_ACTION } from "../../hub-cap-forward-BdT320dq.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.js");
|
|
7
7
|
//#region src/builtins/system-config/system-config.addon.ts
|
|
8
8
|
/**
|
|
9
9
|
* Built-in `system-config` addon — Phase 4 of the settings redesign.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Xt as errMsg, Zt as BaseAddon, mn as hydrateSchema } from "../../dist-
|
|
1
|
+
import { Xt as errMsg, Zt as BaseAddon, mn as hydrateSchema } from "../../dist-B67DC-Ss.mjs";
|
|
2
2
|
//#region src/builtins/system-config/system-config.addon.ts
|
|
3
3
|
/**
|
|
4
4
|
* Built-in `system-config` addon — Phase 4 of the settings redesign.
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-DluLUTzR.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
let node_path = require("node:path");
|
|
9
9
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-
|
|
1
|
+
import { Zt as BaseAddon, _t as logDestinationCapability } from "../../dist-B67DC-Ss.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
import * as path$1 from "node:path";
|
|
4
4
|
import path from "node:path";
|
|
@@ -8999,7 +8999,7 @@ var streamBrokerCapability = {
|
|
|
8999
8999
|
* - the signal is ENABLED for this camera (the operator's per-camera
|
|
9000
9000
|
* choice — a camera may declare a signal the operator does not want
|
|
9001
9001
|
* waking anything), and
|
|
9002
|
-
* - a consumer is actually attached and waiting on the
|
|
9002
|
+
* - a consumer is actually attached and waiting on the sentry. Waking
|
|
9003
9003
|
* a camera nobody is watching is the one thing a battery camera must
|
|
9004
9004
|
* never do, and a signal arriving with no consumer is exactly that.
|
|
9005
9005
|
*
|
|
@@ -8999,7 +8999,7 @@ var streamBrokerCapability = {
|
|
|
8999
8999
|
* - the signal is ENABLED for this camera (the operator's per-camera
|
|
9000
9000
|
* choice — a camera may declare a signal the operator does not want
|
|
9001
9001
|
* waking anything), and
|
|
9002
|
-
* - a consumer is actually attached and waiting on the
|
|
9002
|
+
* - a consumer is actually attached and waiting on the sentry. Waking
|
|
9003
9003
|
* a camera nobody is watching is the one thing a battery camera must
|
|
9004
9004
|
* never do, and a signal arriving with no consumer is exactly that.
|
|
9005
9005
|
*
|
package/dist/index.js
CHANGED
|
@@ -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-
|
|
3
|
+
const require_dist = require("./dist-DluLUTzR.js");
|
|
4
4
|
const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
|
|
5
5
|
require("./builtins/alerts/index.js");
|
|
6
6
|
const require_formatter = require("./formatter-DqAKDlvN.js");
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $t as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Cn as EventCategory$1, Ft as scopesAllowAddon, It as scopesAllowDeviceCap, Nt as resolveMethodAuth, Ot as procedureAuthKey, Qt as DATAPLANE_SECRET_HEADER$1, Tt as objectInputDeclaresAddonId, Xt as errMsg$1, _n as parseJsonObject, an as ReadinessTimeoutError, at as isArrayOutputSchema, bn as resolveCapMount, cn as asNumber, ct as isObjectInput, dn as emitDownForOwnedCaps, dt as isVoidInput, en as DEVICE_STATUS_METHOD, ft as kebabToCamel, g as METHOD_ACCESS_MAP, in as ReadinessRegistry, j as addonSettingsCapability, ln as asString$1, mt as lifecycleJobSchema, ot as isCollectionArrayMethod, p as LOG_LEVEL_RANK, pn as expandCapMethods, sn as asJsonObject$1, t as ALL_CAPABILITY_DEFINITIONS, tt as extractNestedAddonId, un as createEvent, v as RUNTIME_DEFAULTS, vn as parseJsonUnknown, vt as logLevelAtMost, xn as scopeKey, yn as readinessKey, yt as looseSchema } from "./dist-
|
|
2
|
+
import { $t as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Cn as EventCategory$1, Ft as scopesAllowAddon, It as scopesAllowDeviceCap, Nt as resolveMethodAuth, Ot as procedureAuthKey, Qt as DATAPLANE_SECRET_HEADER$1, Tt as objectInputDeclaresAddonId, Xt as errMsg$1, _n as parseJsonObject, an as ReadinessTimeoutError, at as isArrayOutputSchema, bn as resolveCapMount, cn as asNumber, ct as isObjectInput, dn as emitDownForOwnedCaps, dt as isVoidInput, en as DEVICE_STATUS_METHOD, ft as kebabToCamel, g as METHOD_ACCESS_MAP, in as ReadinessRegistry, j as addonSettingsCapability, ln as asString$1, mt as lifecycleJobSchema, ot as isCollectionArrayMethod, p as LOG_LEVEL_RANK, pn as expandCapMethods, sn as asJsonObject$1, t as ALL_CAPABILITY_DEFINITIONS, tt as extractNestedAddonId, un as createEvent, v as RUNTIME_DEFAULTS, vn as parseJsonUnknown, vt as logLevelAtMost, xn as scopeKey, yn as readinessKey, yt as looseSchema } from "./dist-B67DC-Ss.mjs";
|
|
3
3
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
4
4
|
import "./builtins/alerts/index.mjs";
|
|
5
5
|
import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
|