@camstack/addon-pipeline 1.1.65 → 1.1.66
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/audio-analyzer/index.js +1 -1
- package/dist/audio-analyzer/index.mjs +1 -1
- package/dist/detection-pipeline/index.js +33 -11
- package/dist/detection-pipeline/index.mjs +33 -11
- package/dist/{dist-D6tHM9GA.mjs → dist-BpWot5-w.mjs} +13 -0
- package/dist/{dist-WW3gH8hF.js → dist-D5o9fGxq.js} +13 -0
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +88 -22
- package/dist/pipeline-runner/index.mjs +88 -22
- package/dist/recorder/index.js +141 -1
- package/dist/recorder/index.mjs +141 -1
- package/dist/session-decode/decode-worker-child.js +9 -3
- package/dist/session-decode/decode-worker-child.mjs +9 -3
- package/dist/{step-definitions-CXZpwwT0.js → step-definitions-81eYyJbW.js} +127 -8
- package/dist/{step-definitions-Dbsm64_I.mjs → step-definitions-D6R9X0V7.mjs} +127 -8
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CbU_HuOC.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CIIIVPzB.mjs} +2 -2
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CPbLcza9.mjs +26 -0
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DlALQ_wp.mjs +26 -0
- package/dist/stream-broker/{hostInit-QaDEOY0Z.mjs → hostInit-CeBNudbY.mjs} +2 -2
- package/dist/stream-broker/index.js +1 -1
- package/dist/stream-broker/index.mjs +1 -1
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-C7H0kVAH.js → MaskShapeCanvas-DI4BY7W2-CbBbcdZb.js} +1 -1
- package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-CHfEFlEF.js → MotionZonesSettings-NcxxQN8r-aA6zvms_.js} +1 -1
- package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-Bc-trVxX.js → PrivacyMaskSettings-APgPLF7p-CcGB7iAE.js} +1 -1
- package/embed-dist/assets/index-BRG_Fqb5.js +114 -0
- package/embed-dist/assets/index-D2pF9Z3W.css +2 -0
- package/embed-dist/index.html +2 -2
- package/package.json +1 -1
- package/python/inference_pool.py +30 -0
- package/python/postprocessors/softmax.py +17 -5
- package/python/postprocessors/test_softmax.py +52 -0
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CxZvj8X1.mjs +0 -26
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BzNJyeNE.mjs +0 -26
- package/embed-dist/assets/index-Bm9LaQPH.css +0 -2
- package/embed-dist/assets/index-eZGm_itM.js +0 -81
package/dist/recorder/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("../chunk-D6vf50IK.js");
|
|
2
|
-
const require_dist = require("../dist-
|
|
2
|
+
const require_dist = require("../dist-D5o9fGxq.js");
|
|
3
3
|
const require_sheet_geometry = require("../sheet-geometry-BR-ip0CP.js");
|
|
4
4
|
const require_model_download_service_Cp9f4dk6 = require("../model-download-service-Cp9f4dk6-Dv-oFwjN.js");
|
|
5
5
|
let node_child_process = require("node:child_process");
|
|
@@ -2593,6 +2593,122 @@ function makeBrokerCall(handle) {
|
|
|
2593
2593
|
return (fn) => handle.call(fn, BROKER_READY_TIMEOUT_MS);
|
|
2594
2594
|
}
|
|
2595
2595
|
//#endregion
|
|
2596
|
+
//#region src/recorder/addon/retention-sweep.ts
|
|
2597
|
+
/**
|
|
2598
|
+
* Periodic footage-retention sweep (recording-spec §6).
|
|
2599
|
+
*
|
|
2600
|
+
* The disk-pressure eviction path only fires when a volume is TOO FULL
|
|
2601
|
+
* (`shouldSaveDiskSpace` + `minFreePercent`); it never enforces a camera's
|
|
2602
|
+
* age/size policy. This sweeper closes that gap: on an hourly cadence it prunes
|
|
2603
|
+
* footage for every device whose operator set an actionable `retention` policy,
|
|
2604
|
+
* delegating the actual selection + delete to the `recording` cap's
|
|
2605
|
+
* `pruneFootage` (which owns the retention FLOOR via `selectEvictions` — this
|
|
2606
|
+
* sweeper only decides WHICH devices to prune and WHEN).
|
|
2607
|
+
*
|
|
2608
|
+
* Owns its own timer + single-flight guard so a slow sweep is never overlapped
|
|
2609
|
+
* by the next tick — the same subsystem-owns-its-timer shape as
|
|
2610
|
+
* `ThumbnailService`. Pure over injected deps (config read + prune + logger +
|
|
2611
|
+
* clock via `setInterval`), so it is unit-testable with fake timers and a mock
|
|
2612
|
+
* `prune`. Every pass is best-effort: a per-device prune failure is logged and
|
|
2613
|
+
* never aborts the rest, and the sweep never throws.
|
|
2614
|
+
*/
|
|
2615
|
+
/**
|
|
2616
|
+
* True when the operator set an ACTIONABLE retention policy on a device — at
|
|
2617
|
+
* least one of `maxAgeDays` / `maxSizeGb` is present and positive. Mirrors the
|
|
2618
|
+
* `> 0` guards `selectEvictions` itself applies, so a `0`/absent limit (which
|
|
2619
|
+
* inherits the node default = "keep forever") is treated as NO policy and the
|
|
2620
|
+
* device is skipped. NEVER prune a device without an explicit policy — that
|
|
2621
|
+
* would delete footage the operator never asked to age out.
|
|
2622
|
+
*/
|
|
2623
|
+
function hasRetentionPolicy(config) {
|
|
2624
|
+
const retention = config.retention;
|
|
2625
|
+
if (!retention) return false;
|
|
2626
|
+
const byAge = retention.maxAgeDays != null && retention.maxAgeDays > 0;
|
|
2627
|
+
const bySize = retention.maxSizeGb != null && retention.maxSizeGb > 0;
|
|
2628
|
+
return byAge || bySize;
|
|
2629
|
+
}
|
|
2630
|
+
var RetentionSweeper = class {
|
|
2631
|
+
deps;
|
|
2632
|
+
timer = null;
|
|
2633
|
+
/** Single-flight guard: true while a sweep is in flight. */
|
|
2634
|
+
sweeping = false;
|
|
2635
|
+
constructor(deps) {
|
|
2636
|
+
this.deps = deps;
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Arm the sweep: run immediately, then on the interval. Idempotent — a second
|
|
2640
|
+
* `start()` while already armed is a no-op. The timer is `unref`'d so it never
|
|
2641
|
+
* keeps the process alive.
|
|
2642
|
+
*/
|
|
2643
|
+
start() {
|
|
2644
|
+
if (this.timer !== null) return;
|
|
2645
|
+
const tick = () => {
|
|
2646
|
+
this.sweep();
|
|
2647
|
+
};
|
|
2648
|
+
tick();
|
|
2649
|
+
this.timer = setInterval(tick, this.deps.intervalMs);
|
|
2650
|
+
this.timer.unref?.();
|
|
2651
|
+
}
|
|
2652
|
+
/** Stop the sweep timer. Idempotent. An in-flight sweep still completes. */
|
|
2653
|
+
stop() {
|
|
2654
|
+
if (this.timer !== null) {
|
|
2655
|
+
clearInterval(this.timer);
|
|
2656
|
+
this.timer = null;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* One retention pass. Single-flighted: a call that fires while a previous
|
|
2661
|
+
* sweep is still running is a no-op. Never throws — a config-read failure
|
|
2662
|
+
* aborts THIS pass (logged); a per-device prune failure is logged and the
|
|
2663
|
+
* sweep continues with the remaining devices.
|
|
2664
|
+
*/
|
|
2665
|
+
async sweep() {
|
|
2666
|
+
if (this.sweeping) {
|
|
2667
|
+
this.deps.logger.debug("recorder: retention sweep already running — skipping this tick");
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
this.sweeping = true;
|
|
2671
|
+
try {
|
|
2672
|
+
let configs;
|
|
2673
|
+
try {
|
|
2674
|
+
configs = await this.deps.readConfigs();
|
|
2675
|
+
} catch (err) {
|
|
2676
|
+
this.deps.logger.warn("recorder: retention sweep could not read device configs", { meta: { error: require_dist.errMsg(err) } });
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
let devicesSwept = 0;
|
|
2680
|
+
let devicesSkipped = 0;
|
|
2681
|
+
let bucketsPruned = 0;
|
|
2682
|
+
let bytesReclaimed = 0;
|
|
2683
|
+
for (const [deviceId, config] of configs) {
|
|
2684
|
+
if (!hasRetentionPolicy(config)) {
|
|
2685
|
+
devicesSkipped += 1;
|
|
2686
|
+
continue;
|
|
2687
|
+
}
|
|
2688
|
+
try {
|
|
2689
|
+
const result = await this.deps.prune(deviceId);
|
|
2690
|
+
devicesSwept += 1;
|
|
2691
|
+
bucketsPruned += result.deletedBuckets;
|
|
2692
|
+
bytesReclaimed += result.reclaimedBytes;
|
|
2693
|
+
} catch (err) {
|
|
2694
|
+
this.deps.logger.warn("recorder: retention prune failed for device", {
|
|
2695
|
+
tags: { deviceId },
|
|
2696
|
+
meta: { error: require_dist.errMsg(err) }
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
this.deps.logger.info("recorder: retention sweep complete", { meta: {
|
|
2701
|
+
devicesSwept,
|
|
2702
|
+
devicesSkipped,
|
|
2703
|
+
bucketsPruned,
|
|
2704
|
+
bytesReclaimed
|
|
2705
|
+
} });
|
|
2706
|
+
} finally {
|
|
2707
|
+
this.sweeping = false;
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
};
|
|
2711
|
+
//#endregion
|
|
2596
2712
|
//#region src/recorder/addon/recording-hub-host.ts
|
|
2597
2713
|
/**
|
|
2598
2714
|
* Resolve the host a REMOTE recording node should use to dial the hub-only
|
|
@@ -3599,6 +3715,12 @@ var PLAYBACK_PREFIX = "playback";
|
|
|
3599
3715
|
var EXPORTS_PREFIX = "exports";
|
|
3600
3716
|
/** How often the export janitor sweeps expired exports. */
|
|
3601
3717
|
var EXPORT_SWEEP_INTERVAL_MS = 5 * 6e4;
|
|
3718
|
+
/** How often the retention sweep prunes footage past each camera's per-device
|
|
3719
|
+
* age/size policy. Retention is NOT time-critical (footage ages out over days,
|
|
3720
|
+
* and the disk-pressure eviction path already bounds the worst case), so an
|
|
3721
|
+
* hourly cadence keeps the storage.list/evict cost negligible while honouring
|
|
3722
|
+
* the recording-spec §6 periodic retention. */
|
|
3723
|
+
var RETENTION_SWEEP_INTERVAL_MS = 60 * 6e4;
|
|
3602
3724
|
/** Grace after a completed download before a `deleteAfterDownload` file is removed. */
|
|
3603
3725
|
var EXPORT_DELETE_GRACE_MS = 6e4;
|
|
3604
3726
|
/** Only `.mp4` export ids matching this shape are servable (traversal guard). */
|
|
@@ -3634,6 +3756,12 @@ var RecorderV2Addon = class extends require_dist.BaseAddon {
|
|
|
3634
3756
|
exportEngine = null;
|
|
3635
3757
|
/** Periodic export-expiry sweep timer. Cleared on shutdown. */
|
|
3636
3758
|
exportSweepTimer = null;
|
|
3759
|
+
/** The `recording` cap provider — retained so the periodic retention sweep can
|
|
3760
|
+
* call its `pruneFootage`. Null until built in `onInitialize`. */
|
|
3761
|
+
recordingProvider = null;
|
|
3762
|
+
/** Periodic footage-retention sweep (owns its timer + single-flight guard).
|
|
3763
|
+
* Constructed + started in `onHubReachable`, stopped on shutdown. */
|
|
3764
|
+
retentionSweeper = null;
|
|
3637
3765
|
constructor() {
|
|
3638
3766
|
super({ ...DEFAULT_CONFIG });
|
|
3639
3767
|
}
|
|
@@ -3742,6 +3870,7 @@ var RecorderV2Addon = class extends require_dist.BaseAddon {
|
|
|
3742
3870
|
}
|
|
3743
3871
|
};
|
|
3744
3872
|
const recordingProvider = buildRecordingProvider(recordingDeps);
|
|
3873
|
+
this.recordingProvider = recordingProvider;
|
|
3745
3874
|
const evictableProvider = new StorageEvictableProvider({
|
|
3746
3875
|
index: this.index,
|
|
3747
3876
|
store: this.segmentStore
|
|
@@ -3839,7 +3968,10 @@ var RecorderV2Addon = class extends require_dist.BaseAddon {
|
|
|
3839
3968
|
clearInterval(this.exportSweepTimer);
|
|
3840
3969
|
this.exportSweepTimer = null;
|
|
3841
3970
|
}
|
|
3971
|
+
this.retentionSweeper?.stop();
|
|
3972
|
+
this.retentionSweeper = null;
|
|
3842
3973
|
this.exportEngine = null;
|
|
3974
|
+
this.recordingProvider = null;
|
|
3843
3975
|
}
|
|
3844
3976
|
/**
|
|
3845
3977
|
* Boot hydrate: once the hub is reachable (`ctx.api.*` safe), resolve the
|
|
@@ -3898,6 +4030,14 @@ var RecorderV2Addon = class extends require_dist.BaseAddon {
|
|
|
3898
4030
|
this.ctx.logger.warn("recorder: thumbnail service start failed", { meta: { error: require_dist.errMsg(err) } });
|
|
3899
4031
|
}
|
|
3900
4032
|
await this.bootstrapExports();
|
|
4033
|
+
const provider = this.recordingProvider;
|
|
4034
|
+
if (provider && this.retentionSweeper === null) this.retentionSweeper = new RetentionSweeper({
|
|
4035
|
+
prune: (deviceId) => provider.pruneFootage({ deviceId }),
|
|
4036
|
+
readConfigs: () => readDeviceConfigs(this.configStore()),
|
|
4037
|
+
logger: this.ctx.logger,
|
|
4038
|
+
intervalMs: RETENTION_SWEEP_INTERVAL_MS
|
|
4039
|
+
});
|
|
4040
|
+
this.retentionSweeper?.start();
|
|
3901
4041
|
}
|
|
3902
4042
|
/**
|
|
3903
4043
|
* Resume interrupted exports and arm the expiry sweep. A row left `rendering`
|
package/dist/recorder/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as errMsg, D as migrateConfigToBands, I as storageEvictableCapability, K as hydrateSchema, M as recordingCapability, N as recordingExportCapability, P as resolveScrubThumbnailGeometry, Q as selectAssignedProfileSlots, V as BaseAddon, W as DeviceType, ct as record, d as OpsLogEntrySchema, dt as EventCategory, f as RecordingConfigSchema, k as nodePin, l as ExportRecordSchema, lt as string, q as isEvent, s as EVENT_PAD_MS, tt as array } from "../dist-
|
|
1
|
+
import { B as errMsg, D as migrateConfigToBands, I as storageEvictableCapability, K as hydrateSchema, M as recordingCapability, N as recordingExportCapability, P as resolveScrubThumbnailGeometry, Q as selectAssignedProfileSlots, V as BaseAddon, W as DeviceType, ct as record, d as OpsLogEntrySchema, dt as EventCategory, f as RecordingConfigSchema, k as nodePin, l as ExportRecordSchema, lt as string, q as isEvent, s as EVENT_PAD_MS, tt as array } from "../dist-BpWot5-w.mjs";
|
|
2
2
|
import { n as computeSheetGeometry, r as resolveHubHostname, t as allTilePlacements } from "../sheet-geometry-DcpuGTCm.mjs";
|
|
3
3
|
import { n as createFileDataPlaneHandler, s as parseRangeHeader, t as contentTypeFor } from "../model-download-service-Cp9f4dk6-CwUb5v3Y.mjs";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
@@ -2590,6 +2590,122 @@ function makeBrokerCall(handle) {
|
|
|
2590
2590
|
return (fn) => handle.call(fn, BROKER_READY_TIMEOUT_MS);
|
|
2591
2591
|
}
|
|
2592
2592
|
//#endregion
|
|
2593
|
+
//#region src/recorder/addon/retention-sweep.ts
|
|
2594
|
+
/**
|
|
2595
|
+
* Periodic footage-retention sweep (recording-spec §6).
|
|
2596
|
+
*
|
|
2597
|
+
* The disk-pressure eviction path only fires when a volume is TOO FULL
|
|
2598
|
+
* (`shouldSaveDiskSpace` + `minFreePercent`); it never enforces a camera's
|
|
2599
|
+
* age/size policy. This sweeper closes that gap: on an hourly cadence it prunes
|
|
2600
|
+
* footage for every device whose operator set an actionable `retention` policy,
|
|
2601
|
+
* delegating the actual selection + delete to the `recording` cap's
|
|
2602
|
+
* `pruneFootage` (which owns the retention FLOOR via `selectEvictions` — this
|
|
2603
|
+
* sweeper only decides WHICH devices to prune and WHEN).
|
|
2604
|
+
*
|
|
2605
|
+
* Owns its own timer + single-flight guard so a slow sweep is never overlapped
|
|
2606
|
+
* by the next tick — the same subsystem-owns-its-timer shape as
|
|
2607
|
+
* `ThumbnailService`. Pure over injected deps (config read + prune + logger +
|
|
2608
|
+
* clock via `setInterval`), so it is unit-testable with fake timers and a mock
|
|
2609
|
+
* `prune`. Every pass is best-effort: a per-device prune failure is logged and
|
|
2610
|
+
* never aborts the rest, and the sweep never throws.
|
|
2611
|
+
*/
|
|
2612
|
+
/**
|
|
2613
|
+
* True when the operator set an ACTIONABLE retention policy on a device — at
|
|
2614
|
+
* least one of `maxAgeDays` / `maxSizeGb` is present and positive. Mirrors the
|
|
2615
|
+
* `> 0` guards `selectEvictions` itself applies, so a `0`/absent limit (which
|
|
2616
|
+
* inherits the node default = "keep forever") is treated as NO policy and the
|
|
2617
|
+
* device is skipped. NEVER prune a device without an explicit policy — that
|
|
2618
|
+
* would delete footage the operator never asked to age out.
|
|
2619
|
+
*/
|
|
2620
|
+
function hasRetentionPolicy(config) {
|
|
2621
|
+
const retention = config.retention;
|
|
2622
|
+
if (!retention) return false;
|
|
2623
|
+
const byAge = retention.maxAgeDays != null && retention.maxAgeDays > 0;
|
|
2624
|
+
const bySize = retention.maxSizeGb != null && retention.maxSizeGb > 0;
|
|
2625
|
+
return byAge || bySize;
|
|
2626
|
+
}
|
|
2627
|
+
var RetentionSweeper = class {
|
|
2628
|
+
deps;
|
|
2629
|
+
timer = null;
|
|
2630
|
+
/** Single-flight guard: true while a sweep is in flight. */
|
|
2631
|
+
sweeping = false;
|
|
2632
|
+
constructor(deps) {
|
|
2633
|
+
this.deps = deps;
|
|
2634
|
+
}
|
|
2635
|
+
/**
|
|
2636
|
+
* Arm the sweep: run immediately, then on the interval. Idempotent — a second
|
|
2637
|
+
* `start()` while already armed is a no-op. The timer is `unref`'d so it never
|
|
2638
|
+
* keeps the process alive.
|
|
2639
|
+
*/
|
|
2640
|
+
start() {
|
|
2641
|
+
if (this.timer !== null) return;
|
|
2642
|
+
const tick = () => {
|
|
2643
|
+
this.sweep();
|
|
2644
|
+
};
|
|
2645
|
+
tick();
|
|
2646
|
+
this.timer = setInterval(tick, this.deps.intervalMs);
|
|
2647
|
+
this.timer.unref?.();
|
|
2648
|
+
}
|
|
2649
|
+
/** Stop the sweep timer. Idempotent. An in-flight sweep still completes. */
|
|
2650
|
+
stop() {
|
|
2651
|
+
if (this.timer !== null) {
|
|
2652
|
+
clearInterval(this.timer);
|
|
2653
|
+
this.timer = null;
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* One retention pass. Single-flighted: a call that fires while a previous
|
|
2658
|
+
* sweep is still running is a no-op. Never throws — a config-read failure
|
|
2659
|
+
* aborts THIS pass (logged); a per-device prune failure is logged and the
|
|
2660
|
+
* sweep continues with the remaining devices.
|
|
2661
|
+
*/
|
|
2662
|
+
async sweep() {
|
|
2663
|
+
if (this.sweeping) {
|
|
2664
|
+
this.deps.logger.debug("recorder: retention sweep already running — skipping this tick");
|
|
2665
|
+
return;
|
|
2666
|
+
}
|
|
2667
|
+
this.sweeping = true;
|
|
2668
|
+
try {
|
|
2669
|
+
let configs;
|
|
2670
|
+
try {
|
|
2671
|
+
configs = await this.deps.readConfigs();
|
|
2672
|
+
} catch (err) {
|
|
2673
|
+
this.deps.logger.warn("recorder: retention sweep could not read device configs", { meta: { error: errMsg(err) } });
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
let devicesSwept = 0;
|
|
2677
|
+
let devicesSkipped = 0;
|
|
2678
|
+
let bucketsPruned = 0;
|
|
2679
|
+
let bytesReclaimed = 0;
|
|
2680
|
+
for (const [deviceId, config] of configs) {
|
|
2681
|
+
if (!hasRetentionPolicy(config)) {
|
|
2682
|
+
devicesSkipped += 1;
|
|
2683
|
+
continue;
|
|
2684
|
+
}
|
|
2685
|
+
try {
|
|
2686
|
+
const result = await this.deps.prune(deviceId);
|
|
2687
|
+
devicesSwept += 1;
|
|
2688
|
+
bucketsPruned += result.deletedBuckets;
|
|
2689
|
+
bytesReclaimed += result.reclaimedBytes;
|
|
2690
|
+
} catch (err) {
|
|
2691
|
+
this.deps.logger.warn("recorder: retention prune failed for device", {
|
|
2692
|
+
tags: { deviceId },
|
|
2693
|
+
meta: { error: errMsg(err) }
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
this.deps.logger.info("recorder: retention sweep complete", { meta: {
|
|
2698
|
+
devicesSwept,
|
|
2699
|
+
devicesSkipped,
|
|
2700
|
+
bucketsPruned,
|
|
2701
|
+
bytesReclaimed
|
|
2702
|
+
} });
|
|
2703
|
+
} finally {
|
|
2704
|
+
this.sweeping = false;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
};
|
|
2708
|
+
//#endregion
|
|
2593
2709
|
//#region src/recorder/addon/recording-hub-host.ts
|
|
2594
2710
|
/**
|
|
2595
2711
|
* Resolve the host a REMOTE recording node should use to dial the hub-only
|
|
@@ -3596,6 +3712,12 @@ var PLAYBACK_PREFIX = "playback";
|
|
|
3596
3712
|
var EXPORTS_PREFIX = "exports";
|
|
3597
3713
|
/** How often the export janitor sweeps expired exports. */
|
|
3598
3714
|
var EXPORT_SWEEP_INTERVAL_MS = 5 * 6e4;
|
|
3715
|
+
/** How often the retention sweep prunes footage past each camera's per-device
|
|
3716
|
+
* age/size policy. Retention is NOT time-critical (footage ages out over days,
|
|
3717
|
+
* and the disk-pressure eviction path already bounds the worst case), so an
|
|
3718
|
+
* hourly cadence keeps the storage.list/evict cost negligible while honouring
|
|
3719
|
+
* the recording-spec §6 periodic retention. */
|
|
3720
|
+
var RETENTION_SWEEP_INTERVAL_MS = 60 * 6e4;
|
|
3599
3721
|
/** Grace after a completed download before a `deleteAfterDownload` file is removed. */
|
|
3600
3722
|
var EXPORT_DELETE_GRACE_MS = 6e4;
|
|
3601
3723
|
/** Only `.mp4` export ids matching this shape are servable (traversal guard). */
|
|
@@ -3631,6 +3753,12 @@ var RecorderV2Addon = class extends BaseAddon {
|
|
|
3631
3753
|
exportEngine = null;
|
|
3632
3754
|
/** Periodic export-expiry sweep timer. Cleared on shutdown. */
|
|
3633
3755
|
exportSweepTimer = null;
|
|
3756
|
+
/** The `recording` cap provider — retained so the periodic retention sweep can
|
|
3757
|
+
* call its `pruneFootage`. Null until built in `onInitialize`. */
|
|
3758
|
+
recordingProvider = null;
|
|
3759
|
+
/** Periodic footage-retention sweep (owns its timer + single-flight guard).
|
|
3760
|
+
* Constructed + started in `onHubReachable`, stopped on shutdown. */
|
|
3761
|
+
retentionSweeper = null;
|
|
3634
3762
|
constructor() {
|
|
3635
3763
|
super({ ...DEFAULT_CONFIG });
|
|
3636
3764
|
}
|
|
@@ -3739,6 +3867,7 @@ var RecorderV2Addon = class extends BaseAddon {
|
|
|
3739
3867
|
}
|
|
3740
3868
|
};
|
|
3741
3869
|
const recordingProvider = buildRecordingProvider(recordingDeps);
|
|
3870
|
+
this.recordingProvider = recordingProvider;
|
|
3742
3871
|
const evictableProvider = new StorageEvictableProvider({
|
|
3743
3872
|
index: this.index,
|
|
3744
3873
|
store: this.segmentStore
|
|
@@ -3836,7 +3965,10 @@ var RecorderV2Addon = class extends BaseAddon {
|
|
|
3836
3965
|
clearInterval(this.exportSweepTimer);
|
|
3837
3966
|
this.exportSweepTimer = null;
|
|
3838
3967
|
}
|
|
3968
|
+
this.retentionSweeper?.stop();
|
|
3969
|
+
this.retentionSweeper = null;
|
|
3839
3970
|
this.exportEngine = null;
|
|
3971
|
+
this.recordingProvider = null;
|
|
3840
3972
|
}
|
|
3841
3973
|
/**
|
|
3842
3974
|
* Boot hydrate: once the hub is reachable (`ctx.api.*` safe), resolve the
|
|
@@ -3895,6 +4027,14 @@ var RecorderV2Addon = class extends BaseAddon {
|
|
|
3895
4027
|
this.ctx.logger.warn("recorder: thumbnail service start failed", { meta: { error: errMsg(err) } });
|
|
3896
4028
|
}
|
|
3897
4029
|
await this.bootstrapExports();
|
|
4030
|
+
const provider = this.recordingProvider;
|
|
4031
|
+
if (provider && this.retentionSweeper === null) this.retentionSweeper = new RetentionSweeper({
|
|
4032
|
+
prune: (deviceId) => provider.pruneFootage({ deviceId }),
|
|
4033
|
+
readConfigs: () => readDeviceConfigs(this.configStore()),
|
|
4034
|
+
logger: this.ctx.logger,
|
|
4035
|
+
intervalMs: RETENTION_SWEEP_INTERVAL_MS
|
|
4036
|
+
});
|
|
4037
|
+
this.retentionSweeper?.start();
|
|
3898
4038
|
}
|
|
3899
4039
|
/**
|
|
3900
4040
|
* Resume interrupted exports and arm the expiry sweep. A row left `rendering`
|
|
@@ -460,12 +460,18 @@ var NATIVE_LEASE_BUDGET_BYTES = (() => {
|
|
|
460
460
|
/**
|
|
461
461
|
* TTL (ms) after which a native-frame lease is treated as a miss and reclaimed.
|
|
462
462
|
* The backstop that bounds in-flight RAM even if the explicit `releaseNativeLease`
|
|
463
|
-
* is dropped
|
|
464
|
-
*
|
|
463
|
+
* is dropped. Must comfortably exceed the FULL late-crop horizon: detection
|
|
464
|
+
* inference + the cross-process inference-result hop to hub post-analysis +
|
|
465
|
+
* tracking + the tRPC crop round-trip back — on a busy camera with many
|
|
466
|
+
* concurrent tracks that is well past the old 500 ms (which the busiest cameras'
|
|
467
|
+
* subject crops outran, missing to the ≤640 fallback). Raised to 1200 ms; still
|
|
468
|
+
* bounded by the per-session {@link NATIVE_LEASE_BUDGET_BYTES} ceiling and the
|
|
469
|
+
* {@link NATIVE_LEASE_ACTIVITY_WINDOW_MS} demand gate, so idle cameras retain
|
|
470
|
+
* nothing. `CAMSTACK_SESSION_NATIVE_LEASE_TTL_MS` (default 1200).
|
|
465
471
|
*/
|
|
466
472
|
var NATIVE_LEASE_TTL_MS = (() => {
|
|
467
473
|
const raw = Number(process.env["CAMSTACK_SESSION_NATIVE_LEASE_TTL_MS"]);
|
|
468
|
-
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) :
|
|
474
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 1200;
|
|
469
475
|
})();
|
|
470
476
|
/**
|
|
471
477
|
* Demand window (ms) for the lease-capture {@link LeaseActivityGate}: eager
|
|
@@ -456,12 +456,18 @@ var NATIVE_LEASE_BUDGET_BYTES = (() => {
|
|
|
456
456
|
/**
|
|
457
457
|
* TTL (ms) after which a native-frame lease is treated as a miss and reclaimed.
|
|
458
458
|
* The backstop that bounds in-flight RAM even if the explicit `releaseNativeLease`
|
|
459
|
-
* is dropped
|
|
460
|
-
*
|
|
459
|
+
* is dropped. Must comfortably exceed the FULL late-crop horizon: detection
|
|
460
|
+
* inference + the cross-process inference-result hop to hub post-analysis +
|
|
461
|
+
* tracking + the tRPC crop round-trip back — on a busy camera with many
|
|
462
|
+
* concurrent tracks that is well past the old 500 ms (which the busiest cameras'
|
|
463
|
+
* subject crops outran, missing to the ≤640 fallback). Raised to 1200 ms; still
|
|
464
|
+
* bounded by the per-session {@link NATIVE_LEASE_BUDGET_BYTES} ceiling and the
|
|
465
|
+
* {@link NATIVE_LEASE_ACTIVITY_WINDOW_MS} demand gate, so idle cameras retain
|
|
466
|
+
* nothing. `CAMSTACK_SESSION_NATIVE_LEASE_TTL_MS` (default 1200).
|
|
461
467
|
*/
|
|
462
468
|
var NATIVE_LEASE_TTL_MS = (() => {
|
|
463
469
|
const raw = Number(process.env["CAMSTACK_SESSION_NATIVE_LEASE_TTL_MS"]);
|
|
464
|
-
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) :
|
|
470
|
+
return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 1200;
|
|
465
471
|
})();
|
|
466
472
|
/**
|
|
467
473
|
* Demand window (ms) for the lease-capture {@link LeaseActivityGate}: eager
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
1
|
+
const require_dist = require("./dist-D5o9fGxq.js");
|
|
2
2
|
//#region src/detection-pipeline/registry/model-catalogs.ts
|
|
3
3
|
var HF_REPO = "camstack/camstack-models";
|
|
4
4
|
var HF_SCRYPTED = "scrypted/plugin-models";
|
|
@@ -764,9 +764,45 @@ var PLATE_OCR_MODELS = [{
|
|
|
764
764
|
}
|
|
765
765
|
}];
|
|
766
766
|
var ANIMAL_CLASSIFIER_MODELS = [{
|
|
767
|
+
id: "animal-classifier",
|
|
768
|
+
name: "Animal Classifier (8)",
|
|
769
|
+
description: "EfficientNet-Lite0 animal classifier — bird, cat, cow, deer, dog, horse, sheep, squirrel (Open Images V7, publicly distributable)",
|
|
770
|
+
inputSize: {
|
|
771
|
+
width: 224,
|
|
772
|
+
height: 224
|
|
773
|
+
},
|
|
774
|
+
inputLayout: "nchw",
|
|
775
|
+
inputNormalization: "imagenet",
|
|
776
|
+
license: "Apache-2.0",
|
|
777
|
+
labels: [{
|
|
778
|
+
id: "animal-type",
|
|
779
|
+
name: "Animal Type"
|
|
780
|
+
}],
|
|
781
|
+
preprocessMode: "resize",
|
|
782
|
+
formats: {
|
|
783
|
+
onnx: {
|
|
784
|
+
url: hf("animalClassification/animal-classifier/onnx/animal-classifier.onnx"),
|
|
785
|
+
sizeMB: 13
|
|
786
|
+
},
|
|
787
|
+
coreml: {
|
|
788
|
+
url: hf("animalClassification/animal-classifier/coreml/animal-classifier.mlpackage"),
|
|
789
|
+
sizeMB: 6.5,
|
|
790
|
+
isDirectory: true,
|
|
791
|
+
files: [...MLPACKAGE_FILES],
|
|
792
|
+
runtimes: ["python"]
|
|
793
|
+
},
|
|
794
|
+
openvino: ovFormat(hf("animalClassification/animal-classifier/openvino/animal-classifier.xml"), 6.9)
|
|
795
|
+
},
|
|
796
|
+
extraFiles: [{
|
|
797
|
+
url: hf("animalClassification/animal-classifier/onnx/animal-classifier-labels.json"),
|
|
798
|
+
filename: "animal-classifier-labels.json",
|
|
799
|
+
sizeMB: .01
|
|
800
|
+
}]
|
|
801
|
+
}, {
|
|
767
802
|
id: "animals-10",
|
|
768
803
|
name: "Animal Classifier (10)",
|
|
769
804
|
description: "ViT-based animal type classifier — cat, cow, dog, dolphin, eagle, panda, horse, monkey, sheep, spider",
|
|
805
|
+
legacy: true,
|
|
770
806
|
inputSize: {
|
|
771
807
|
width: 224,
|
|
772
808
|
height: 224
|
|
@@ -793,9 +829,46 @@ var ANIMAL_CLASSIFIER_MODELS = [{
|
|
|
793
829
|
}
|
|
794
830
|
}];
|
|
795
831
|
var BIRD_CLASSIFIER_MODELS = [{
|
|
832
|
+
id: "bird-classifier",
|
|
833
|
+
name: "Bird Classifier (AIY 965)",
|
|
834
|
+
description: "Google AIY Birds V1 (MobileNetV2) — 964 species + background; publicly distributable (Apache-2.0)",
|
|
835
|
+
inputSize: {
|
|
836
|
+
width: 224,
|
|
837
|
+
height: 224
|
|
838
|
+
},
|
|
839
|
+
inputLayout: "nhwc",
|
|
840
|
+
inputNormalization: "none",
|
|
841
|
+
outputProbabilities: true,
|
|
842
|
+
license: "Apache-2.0",
|
|
843
|
+
labels: [{
|
|
844
|
+
id: "species",
|
|
845
|
+
name: "Bird Species"
|
|
846
|
+
}],
|
|
847
|
+
preprocessMode: "resize",
|
|
848
|
+
formats: {
|
|
849
|
+
onnx: {
|
|
850
|
+
url: hf("animalClassification/bird-classifier/onnx/bird-classifier.onnx"),
|
|
851
|
+
sizeMB: 14
|
|
852
|
+
},
|
|
853
|
+
coreml: {
|
|
854
|
+
url: hf("animalClassification/bird-classifier/coreml/bird-classifier.mlpackage"),
|
|
855
|
+
sizeMB: 6.8,
|
|
856
|
+
isDirectory: true,
|
|
857
|
+
files: [...MLPACKAGE_FILES],
|
|
858
|
+
runtimes: ["python"]
|
|
859
|
+
},
|
|
860
|
+
openvino: ovFormat(hf("animalClassification/bird-classifier/openvino/bird-classifier.xml"), 14)
|
|
861
|
+
},
|
|
862
|
+
extraFiles: [{
|
|
863
|
+
url: hf("animalClassification/bird-classifier/onnx/bird-classifier-labels.json"),
|
|
864
|
+
filename: "bird-classifier-labels.json",
|
|
865
|
+
sizeMB: .03
|
|
866
|
+
}]
|
|
867
|
+
}, {
|
|
796
868
|
id: "bird-nabirds-404",
|
|
797
869
|
name: "NABirds (404 species)",
|
|
798
870
|
description: "ResNet50 trained on NABirds — 404 North American species",
|
|
871
|
+
legacy: true,
|
|
799
872
|
inputSize: {
|
|
800
873
|
width: 224,
|
|
801
874
|
height: 224
|
|
@@ -827,9 +900,44 @@ var BIRD_CLASSIFIER_MODELS = [{
|
|
|
827
900
|
}]
|
|
828
901
|
}];
|
|
829
902
|
var VEHICLE_CLASSIFIER_MODELS = [{
|
|
903
|
+
id: "vehicle-type-v1",
|
|
904
|
+
name: "Vehicle Type (8)",
|
|
905
|
+
description: "MobileNetV3-Large vehicle type classifier — Ambulance, Bicycle, Bus, Car, Motorcycle, Taxi, Truck, Van (val 89.4%)",
|
|
906
|
+
inputSize: {
|
|
907
|
+
width: 224,
|
|
908
|
+
height: 224
|
|
909
|
+
},
|
|
910
|
+
inputLayout: "nchw",
|
|
911
|
+
inputNormalization: "imagenet",
|
|
912
|
+
labels: [{
|
|
913
|
+
id: "vehicle-type",
|
|
914
|
+
name: "Vehicle Type"
|
|
915
|
+
}],
|
|
916
|
+
preprocessMode: "resize",
|
|
917
|
+
formats: {
|
|
918
|
+
onnx: {
|
|
919
|
+
url: hf("vehicleClassification/vehicle-type-v1/onnx/vehicle-type-v1.onnx"),
|
|
920
|
+
sizeMB: 17
|
|
921
|
+
},
|
|
922
|
+
coreml: {
|
|
923
|
+
url: hf("vehicleClassification/vehicle-type-v1/coreml/vehicle-type-v1.mlpackage"),
|
|
924
|
+
sizeMB: 8.1,
|
|
925
|
+
isDirectory: true,
|
|
926
|
+
files: [...MLPACKAGE_FILES],
|
|
927
|
+
runtimes: ["python"]
|
|
928
|
+
},
|
|
929
|
+
openvino: ovFormat(hf("vehicleClassification/vehicle-type-v1/openvino/vehicle-type-v1.xml"), 8.7)
|
|
930
|
+
},
|
|
931
|
+
extraFiles: [{
|
|
932
|
+
url: hf("vehicleClassification/vehicle-type-v1/onnx/vehicle-type-v1-labels.json"),
|
|
933
|
+
filename: "vehicle-type-v1-labels.json",
|
|
934
|
+
sizeMB: .01
|
|
935
|
+
}]
|
|
936
|
+
}, {
|
|
830
937
|
id: "vehicle-type-efficientnet",
|
|
831
938
|
name: "Vehicle Type (EfficientNet)",
|
|
832
939
|
description: "EfficientNet-B4 vehicle make/model/year classifier — 8,949 classes from VMMRdb",
|
|
940
|
+
legacy: true,
|
|
833
941
|
inputSize: {
|
|
834
942
|
width: 380,
|
|
835
943
|
height: 380
|
|
@@ -1105,6 +1213,16 @@ var ANIMAL_10_LABELS = [
|
|
|
1105
1213
|
"sheep",
|
|
1106
1214
|
"spider"
|
|
1107
1215
|
];
|
|
1216
|
+
var ANIMAL_CLASSIFIER_LABELS = [
|
|
1217
|
+
"bird",
|
|
1218
|
+
"cat",
|
|
1219
|
+
"cow",
|
|
1220
|
+
"deer",
|
|
1221
|
+
"dog",
|
|
1222
|
+
"horse",
|
|
1223
|
+
"sheep",
|
|
1224
|
+
"squirrel"
|
|
1225
|
+
];
|
|
1108
1226
|
var VGG_G2_CHARSET = [
|
|
1109
1227
|
"",
|
|
1110
1228
|
..."0123456789".split(""),
|
|
@@ -1303,9 +1421,9 @@ var AnimalClassifierStep = class {
|
|
|
1303
1421
|
inputClasses: ["animal"],
|
|
1304
1422
|
outputClasses: ["animal-type"],
|
|
1305
1423
|
models: [...ANIMAL_CLASSIFIER_MODELS],
|
|
1306
|
-
defaultModelId: "
|
|
1424
|
+
defaultModelId: "animal-classifier",
|
|
1307
1425
|
enabledByDefault: false,
|
|
1308
|
-
defaultConfidence: .
|
|
1426
|
+
defaultConfidence: .5,
|
|
1309
1427
|
labels: [...ANIMAL_10_LABELS],
|
|
1310
1428
|
cadence: {
|
|
1311
1429
|
trigger: "once",
|
|
@@ -1319,7 +1437,7 @@ var AnimalClassifierStep = class {
|
|
|
1319
1437
|
key: "enabledClasses",
|
|
1320
1438
|
label: "Species",
|
|
1321
1439
|
description: "Which animal species to keep (empty = all). The classifier still scores every label but only the selected classes are returned on the detection.",
|
|
1322
|
-
options:
|
|
1440
|
+
options: ANIMAL_CLASSIFIER_LABELS.map((l) => ({
|
|
1323
1441
|
value: l,
|
|
1324
1442
|
label: l
|
|
1325
1443
|
})),
|
|
@@ -1465,9 +1583,10 @@ var STEP_BIRD_CLASSIFIER = new ClassifierWithMinConfidence({
|
|
|
1465
1583
|
inputClasses: ["animal"],
|
|
1466
1584
|
outputClasses: ["species"],
|
|
1467
1585
|
models: [...BIRD_CLASSIFIER_MODELS],
|
|
1468
|
-
defaultModelId: "bird-
|
|
1586
|
+
defaultModelId: "bird-classifier",
|
|
1469
1587
|
enabledByDefault: false,
|
|
1470
|
-
defaultConfidence: .
|
|
1588
|
+
defaultConfidence: .6,
|
|
1589
|
+
rejectClasses: ["background"],
|
|
1471
1590
|
cadence: {
|
|
1472
1591
|
trigger: "once",
|
|
1473
1592
|
maxPerTrack: 3,
|
|
@@ -1483,9 +1602,9 @@ var STEP_VEHICLE_CLASSIFIER = new ClassifierWithMinConfidence({
|
|
|
1483
1602
|
inputClasses: ["vehicle"],
|
|
1484
1603
|
outputClasses: ["vehicle-type"],
|
|
1485
1604
|
models: [...VEHICLE_CLASSIFIER_MODELS],
|
|
1486
|
-
defaultModelId: "vehicle-type-
|
|
1605
|
+
defaultModelId: "vehicle-type-v1",
|
|
1487
1606
|
enabledByDefault: false,
|
|
1488
|
-
defaultConfidence: .
|
|
1607
|
+
defaultConfidence: .5,
|
|
1489
1608
|
cadence: {
|
|
1490
1609
|
trigger: "once",
|
|
1491
1610
|
maxPerTrack: 3,
|