@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.
- 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-BHlcm97I.mjs} +179 -7
- package/dist/{dist-CpXBoZOv.js → dist-BW7x4kAI.js} +179 -7
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{retired-settings-keys-1sEBolVU.js → retired-settings-keys-CeaYCDU4.js} +1 -1
- package/dist/{retired-settings-keys-Dv044bmH.mjs → retired-settings-keys-lPlv147H.mjs} +1 -1
- package/package.json +1 -1
|
@@ -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-BHlcm97I.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-BW7x4kAI.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-BHlcm97I.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-BW7x4kAI.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-BHlcm97I.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-BW7x4kAI.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-BHlcm97I.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-BW7x4kAI.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-BHlcm97I.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";
|
|
@@ -690,7 +690,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
690
690
|
return EventCategory;
|
|
691
691
|
}({});
|
|
692
692
|
//#endregion
|
|
693
|
-
//#region ../types/dist/sleep-
|
|
693
|
+
//#region ../types/dist/sleep-B1y0Fo1U.mjs
|
|
694
694
|
/**
|
|
695
695
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
696
696
|
* window to float samples (D455).
|
|
@@ -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
|
*
|
|
@@ -32804,14 +32804,81 @@ var privacyMaskCapability = {
|
|
|
32804
32804
|
* whether persisting is worth a SQLite commit. */
|
|
32805
32805
|
volatileStateFields: ["lastFetchedAt"]
|
|
32806
32806
|
};
|
|
32807
|
+
/**
|
|
32808
|
+
* What a preset id DOES on this camera.
|
|
32809
|
+
*
|
|
32810
|
+
* On several PTZ firmwares the preset namespace is shared: low ids are stored
|
|
32811
|
+
* positions, a reserved band triggers camera FUNCTIONS. The dispensa camera
|
|
32812
|
+
* (Hikvision) returns its own reserved band in the preset list, named by the
|
|
32813
|
+
* firmware:
|
|
32814
|
+
*
|
|
32815
|
+
* 34 Back to origin · 39 Day mode · 40 Night mode · 46 Day/Night Auto Mode
|
|
32816
|
+
* 92 Set manual limits · 93 Save manual limits · 94 Remote reboot
|
|
32817
|
+
* 95 Call OSD menu
|
|
32818
|
+
*
|
|
32819
|
+
* We used to hand all of these to the UI as ordinary presets. Saving over one
|
|
32820
|
+
* is what produced `PUT /ISAPI/PTZCtrl/channels/1/presets/34 -> HTTP 500`: the
|
|
32821
|
+
* camera refusing to let "Back to origin" be overwritten, surfaced to the
|
|
32822
|
+
* operator as a transport failure.
|
|
32823
|
+
*
|
|
32824
|
+
* A function preset stays fully usable as a DESTINATION -- `goToPreset('34')`
|
|
32825
|
+
* is the single most useful thing that camera can do. Only `savePreset` and
|
|
32826
|
+
* `deletePreset` are gated.
|
|
32827
|
+
*/
|
|
32828
|
+
var PtzPresetFunctionSchema = z.enum([
|
|
32829
|
+
"home",
|
|
32830
|
+
"day-mode",
|
|
32831
|
+
"night-mode",
|
|
32832
|
+
"day-night-auto",
|
|
32833
|
+
"set-limits",
|
|
32834
|
+
"save-limits",
|
|
32835
|
+
"reboot",
|
|
32836
|
+
"osd-menu"
|
|
32837
|
+
]);
|
|
32807
32838
|
var PtzPresetSchema = z.object({
|
|
32808
32839
|
id: z.string(),
|
|
32809
|
-
name: z.string()
|
|
32840
|
+
name: z.string(),
|
|
32841
|
+
/**
|
|
32842
|
+
* The firmware function this id performs, when the provider KNOWS the id is
|
|
32843
|
+
* reserved. `null` = an ordinary stored position, OR a reserved id this
|
|
32844
|
+
* provider does not recognise -- the two are told apart by `writable`.
|
|
32845
|
+
*/
|
|
32846
|
+
fn: PtzPresetFunctionSchema.nullable(),
|
|
32847
|
+
/**
|
|
32848
|
+
* Whether `savePreset` / `deletePreset` may target this id. A provider sets
|
|
32849
|
+
* it false only for a band it KNOWS is reserved; where the firmware is not
|
|
32850
|
+
* documented it stays true and a refusal comes from the camera, named.
|
|
32851
|
+
*/
|
|
32852
|
+
writable: z.boolean()
|
|
32810
32853
|
});
|
|
32854
|
+
/**
|
|
32855
|
+
* Where the head is pointing -- per axis, and `null` when the driver cannot
|
|
32856
|
+
* read it.
|
|
32857
|
+
*
|
|
32858
|
+
* It used to be three REQUIRED numbers, which left a provider that cannot read
|
|
32859
|
+
* position no way to say so. All four said `0`:
|
|
32860
|
+
*
|
|
32861
|
+
* reolink `return { pan: 0, tilt: 0, zoom: 0 }` "until a position-query
|
|
32862
|
+
* path lands upstream"
|
|
32863
|
+
* hikvision stub, "firmware-dependent and frequently absent"
|
|
32864
|
+
* amcrest stub, "no generic absolute-position read for this model family"
|
|
32865
|
+
* onvif throws
|
|
32866
|
+
*
|
|
32867
|
+
* So every consumer asking where a camera points was told "perfectly centred"
|
|
32868
|
+
* by four cameras that had never looked. That is D393 -- a measurement that
|
|
32869
|
+
* FAILED is `null`, never `0`, and the type says so all the way to the
|
|
32870
|
+
* decision -- the same shape as the unreadable `statfs` folded into "0 bytes of
|
|
32871
|
+
* headroom", which evacuated a healthy disk.
|
|
32872
|
+
*
|
|
32873
|
+
* D393 also says to check for a narrower structural TWIN of the result type.
|
|
32874
|
+
* There is one: `PtzStatusSchema` extends this, so the lie had already
|
|
32875
|
+
* propagated into `getStatus`, which is the surface `getPosition`'s own comment
|
|
32876
|
+
* tells callers to migrate to.
|
|
32877
|
+
*/
|
|
32811
32878
|
var PtzPositionSchema = z.object({
|
|
32812
|
-
pan: z.number(),
|
|
32813
|
-
tilt: z.number(),
|
|
32814
|
-
zoom: z.number()
|
|
32879
|
+
pan: z.number().nullable(),
|
|
32880
|
+
tilt: z.number().nullable(),
|
|
32881
|
+
zoom: z.number().nullable()
|
|
32815
32882
|
});
|
|
32816
32883
|
var PtzMoveCommandSchema = z.object({
|
|
32817
32884
|
pan: z.number().optional(),
|
|
@@ -32833,7 +32900,72 @@ var PtzOptionsSchema = z.object({
|
|
|
32833
32900
|
maxPresets: z.number().optional(),
|
|
32834
32901
|
/** Whether the camera exposes a controllable autofocus toggle
|
|
32835
32902
|
* (boolean `hasX` per the getOptions availability convention). */
|
|
32836
|
-
hasAutofocus: z.boolean()
|
|
32903
|
+
hasAutofocus: z.boolean(),
|
|
32904
|
+
/**
|
|
32905
|
+
* How many distinct speeds this camera's NATIVE scale offers.
|
|
32906
|
+
*
|
|
32907
|
+
* The cap's `speed` is normalized 0..1 and each provider maps it down --
|
|
32908
|
+
* Baichuan 1..63, Dahua 1..8, ISAPI's percentage -100..100. The normalized
|
|
32909
|
+
* value hides how coarse that really is: asking an amcrest for `0.37` is
|
|
32910
|
+
* meaningless, because it has eight steps and three of them round to the
|
|
32911
|
+
* same one. A loop that tunes its own gain has to know the granularity of
|
|
32912
|
+
* the knob it is turning.
|
|
32913
|
+
*
|
|
32914
|
+
* `null` = the driver does not know, or the scale is continuous (ONVIF takes
|
|
32915
|
+
* a float). Never a made-up number.
|
|
32916
|
+
*/
|
|
32917
|
+
speedSteps: z.number().int().positive().nullable(),
|
|
32918
|
+
/**
|
|
32919
|
+
* How long ONE `move` pulse runs on this driver, ms.
|
|
32920
|
+
*
|
|
32921
|
+
* `move` is a self-terminating burst everywhere, but every provider hardcoded
|
|
32922
|
+
* its own duration in private -- 200 reolink, 350 amcrest, 500 hikvision,
|
|
32923
|
+
* 1000 onvif -- so no caller could read it. It is the DENOMINATOR of "how far
|
|
32924
|
+
* did the head travel per pulse": without it a measured displacement has no
|
|
32925
|
+
* gain to be divided into.
|
|
32926
|
+
*
|
|
32927
|
+
* `null` = the driver cannot say.
|
|
32928
|
+
*/
|
|
32929
|
+
moveImpulseMs: z.number().int().positive().nullable()
|
|
32930
|
+
});
|
|
32931
|
+
/**
|
|
32932
|
+
* Which preset `goHome` goes to, and WHO decided.
|
|
32933
|
+
*
|
|
32934
|
+
* `goHome` used to be three vendor "conventions" written in three comments --
|
|
32935
|
+
* Reolink preset 0, Hikvision preset '1', Dahua preset 1 -- and on this fleet
|
|
32936
|
+
* not one of the three cameras honours its own:
|
|
32937
|
+
*
|
|
32938
|
+
* 592 Videocamera camera Daniel (reolink) preset 0 holds "stanza"
|
|
32939
|
+
* 1438 Videocamera dispensa (hikvision) preset 1 holds "Credenza"
|
|
32940
|
+
* 3836 Videocamera studio (amcrest) preset 1 holds "Preset1"
|
|
32941
|
+
*
|
|
32942
|
+
* So `goHome` meant "go wherever the operator happened to save in slot 0 or 1",
|
|
32943
|
+
* and two of the three swallowed the failure in a bare `catch`. For autotrack
|
|
32944
|
+
* this is the HOTTEST path -- it runs every time a subject is released -- so it
|
|
32945
|
+
* needs an answer that is true per camera and audible when it is missing.
|
|
32946
|
+
*
|
|
32947
|
+
* `source` is what makes it honest:
|
|
32948
|
+
* - `operator` -- picked in the UI, stored by the provider.
|
|
32949
|
+
* - `firmware` -- the camera itself named a preset `fn: 'home'` (Hikvision's
|
|
32950
|
+
* "Back to origin"), adopted as the default with nothing to configure.
|
|
32951
|
+
* - `native` -- the driver homes WITHOUT a preset at all. ONVIF does:
|
|
32952
|
+
* `goHome` is `ptzAbsoluteMove({x:0, y:0, zoom:0})`. `presetId` is null and
|
|
32953
|
+
* that is not a failure -- there is nothing to pick, and the UI must offer
|
|
32954
|
+
* no picker.
|
|
32955
|
+
* - `none` -- nothing is configured and the camera names nothing.
|
|
32956
|
+
* `goHome` REFUSES rather than moving the head somewhere arbitrary.
|
|
32957
|
+
*
|
|
32958
|
+
* `source === 'none'` is the refusal condition, NOT `presetId === null`: the
|
|
32959
|
+
* native case has no preset and homes perfectly well.
|
|
32960
|
+
*/
|
|
32961
|
+
var PtzHomePresetSchema = z.object({
|
|
32962
|
+
presetId: z.string().nullable(),
|
|
32963
|
+
source: z.enum([
|
|
32964
|
+
"operator",
|
|
32965
|
+
"firmware",
|
|
32966
|
+
"native",
|
|
32967
|
+
"none"
|
|
32968
|
+
])
|
|
32837
32969
|
});
|
|
32838
32970
|
var ptzCapability = {
|
|
32839
32971
|
name: "ptz",
|
|
@@ -32874,7 +33006,25 @@ var ptzCapability = {
|
|
|
32874
33006
|
auth: "admin"
|
|
32875
33007
|
}),
|
|
32876
33008
|
getOptions: method(z.object({ deviceId: z.number() }), PtzOptionsSchema),
|
|
33009
|
+
/**
|
|
33010
|
+
* Move to the camera's configured home preset. THROWS when
|
|
33011
|
+
* `getHomePreset()` resolves to `none` -- a head that did not move must
|
|
33012
|
+
* never look like a head that went home.
|
|
33013
|
+
*/
|
|
32877
33014
|
goHome: method(z.object({ deviceId: z.number() }), z.void(), { kind: "mutation" }),
|
|
33015
|
+
/** Which preset `goHome` targets, and who decided it. */
|
|
33016
|
+
getHomePreset: method(z.object({ deviceId: z.number() }), PtzHomePresetSchema),
|
|
33017
|
+
/**
|
|
33018
|
+
* Pin the home preset for this camera. `null` clears the operator's choice
|
|
33019
|
+
* and falls back to whatever the firmware names, or to `none`.
|
|
33020
|
+
*/
|
|
33021
|
+
setHomePreset: method(z.object({
|
|
33022
|
+
deviceId: z.number(),
|
|
33023
|
+
presetId: z.string().nullable()
|
|
33024
|
+
}), z.void(), {
|
|
33025
|
+
kind: "mutation",
|
|
33026
|
+
auth: "admin"
|
|
33027
|
+
}),
|
|
32878
33028
|
/**
|
|
32879
33029
|
* Pull the current PTZ position. Redundant with the auto-injected
|
|
32880
33030
|
* `getStatus` method (see `status` below); kept for callers that
|
|
@@ -42271,6 +42421,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
42271
42421
|
addonId: null,
|
|
42272
42422
|
access: "delete"
|
|
42273
42423
|
},
|
|
42424
|
+
"ptz.getHomePreset": {
|
|
42425
|
+
capName: "ptz",
|
|
42426
|
+
capScope: "device",
|
|
42427
|
+
addonId: null,
|
|
42428
|
+
access: "view"
|
|
42429
|
+
},
|
|
42274
42430
|
"ptz.getOptions": {
|
|
42275
42431
|
capName: "ptz",
|
|
42276
42432
|
capScope: "device",
|
|
@@ -42319,6 +42475,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
42319
42475
|
addonId: null,
|
|
42320
42476
|
access: "create"
|
|
42321
42477
|
},
|
|
42478
|
+
"ptz.setHomePreset": {
|
|
42479
|
+
capName: "ptz",
|
|
42480
|
+
capScope: "device",
|
|
42481
|
+
addonId: null,
|
|
42482
|
+
access: "create"
|
|
42483
|
+
},
|
|
42322
42484
|
"ptz.stop": {
|
|
42323
42485
|
capName: "ptz",
|
|
42324
42486
|
capScope: "device",
|
|
@@ -45492,6 +45654,11 @@ Object.freeze({
|
|
|
45492
45654
|
form: "single",
|
|
45493
45655
|
optional: false
|
|
45494
45656
|
}],
|
|
45657
|
+
"ptz.getHomePreset": [{
|
|
45658
|
+
name: "deviceId",
|
|
45659
|
+
form: "single",
|
|
45660
|
+
optional: false
|
|
45661
|
+
}],
|
|
45495
45662
|
"ptz.getOptions": [{
|
|
45496
45663
|
name: "deviceId",
|
|
45497
45664
|
form: "single",
|
|
@@ -45532,6 +45699,11 @@ Object.freeze({
|
|
|
45532
45699
|
form: "single",
|
|
45533
45700
|
optional: false
|
|
45534
45701
|
}],
|
|
45702
|
+
"ptz.setHomePreset": [{
|
|
45703
|
+
name: "deviceId",
|
|
45704
|
+
form: "single",
|
|
45705
|
+
optional: false
|
|
45706
|
+
}],
|
|
45535
45707
|
"ptz.stop": [{
|
|
45536
45708
|
name: "deviceId",
|
|
45537
45709
|
form: "single",
|