@camstack/addon-pipeline 1.2.107 → 1.2.115
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/{addon-utils-Vv2dCqA2.js → addon-utils-C0ht2KPO.js} +51 -15
- package/dist/{addon-utils-A2S9D7pu.mjs → addon-utils-CgBCF-mE.mjs} +50 -14
- package/dist/audio-analyzer/index.js +3 -3
- package/dist/audio-analyzer/index.mjs +3 -3
- package/dist/detection-pipeline/index.js +170 -31
- package/dist/detection-pipeline/index.mjs +169 -30
- package/dist/{dist-L-1LMGQs.js → dist-BqIbYW1A.js} +130 -17
- package/dist/{dist-CkXAzTZ2.mjs → dist-DGQkkWc6.mjs} +130 -17
- package/dist/{event-loop-stall-monitor-fHkfgmlw.mjs → event-loop-stall-monitor-D5jK5v4Z.mjs} +223 -2
- package/dist/{event-loop-stall-monitor-DwAho7HD.js → event-loop-stall-monitor-ylMGpz48.js} +234 -1
- package/dist/{lazy-sharp-DfbyQxET.js → lazy-sharp-cOsy7l_P.js} +1 -1
- package/dist/motion-wasm/index.js +2 -2
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +915 -107
- package/dist/pipeline-runner/index.mjs +914 -106
- package/dist/{process-memory-CgrbLo3l.js → process-memory-45juuHpN.js} +1 -1
- package/dist/{process-memory-DlSOzuHP.mjs → process-memory-BtT7WfbJ.mjs} +1 -1
- package/dist/recorder/index.js +187 -47
- package/dist/recorder/index.mjs +187 -47
- package/dist/session-decode/decode-worker-child.js +30 -10
- package/dist/session-decode/decode-worker-child.mjs +29 -9
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-BeL4_jgH.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C_SFFNGT.mjs} +3 -3
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B1LDFHY9.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-CmHtm5CX.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BAMyzCWw.mjs} +1 -1
- package/dist/stream-broker/{hostInit-BK9nzKAG.mjs → hostInit-CG28NvlV.mjs} +3 -3
- package/dist/stream-broker/index.js +279 -198
- package/dist/stream-broker/index.mjs +279 -198
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/{worker-protocol-GGnzfWu3.js → worker-protocol-CIrqGbpG.js} +6 -3
- package/dist/{worker-protocol-bEipQT9l.mjs → worker-protocol-DyocTIx_.mjs} +6 -3
- package/package.json +1 -1
- package/python/inference_pool.py +4 -1
- package/python/test_inference_pool_preprocess.py +87 -16
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DjndFc5V.mjs +0 -26
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
1
|
+
const require_dist = require("./dist-BqIbYW1A.js");
|
|
2
|
+
let node_crypto = require("node:crypto");
|
|
2
3
|
let node_perf_hooks = require("node:perf_hooks");
|
|
3
4
|
//#region src/detection-pipeline/registry/model-catalogs.ts
|
|
4
5
|
var HF_REPO = "camstack/camstack-models";
|
|
@@ -1890,6 +1891,226 @@ function resolveModelForFormat(stepId, chosenModelId, format) {
|
|
|
1890
1891
|
return getDefaultModelForFormat(stepId, format);
|
|
1891
1892
|
}
|
|
1892
1893
|
//#endregion
|
|
1894
|
+
//#region src/session-decode/frame-view-geometry.ts
|
|
1895
|
+
function positiveInteger(value, label) {
|
|
1896
|
+
if (!Number.isFinite(value) || value <= 0) throw new Error(`${label} must be positive`);
|
|
1897
|
+
return Math.max(1, Math.round(value));
|
|
1898
|
+
}
|
|
1899
|
+
function clampCrop(sourceWidth, sourceHeight, crop) {
|
|
1900
|
+
if (!crop) return {
|
|
1901
|
+
left: 0,
|
|
1902
|
+
top: 0,
|
|
1903
|
+
width: sourceWidth,
|
|
1904
|
+
height: sourceHeight
|
|
1905
|
+
};
|
|
1906
|
+
const left = Math.max(0, Math.min(sourceWidth - 1, Math.floor(crop.left)));
|
|
1907
|
+
const top = Math.max(0, Math.min(sourceHeight - 1, Math.floor(crop.top)));
|
|
1908
|
+
const right = Math.max(left + 1, Math.min(sourceWidth, Math.ceil(crop.left + crop.width)));
|
|
1909
|
+
const bottom = Math.max(top + 1, Math.min(sourceHeight, Math.ceil(crop.top + crop.height)));
|
|
1910
|
+
return {
|
|
1911
|
+
left,
|
|
1912
|
+
top,
|
|
1913
|
+
width: right - left,
|
|
1914
|
+
height: bottom - top
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
/** Pure geometry for worker-side crop/resize without model padding. */
|
|
1918
|
+
function resolveFrameViewGeometry(sourceWidthInput, sourceHeightInput, spec) {
|
|
1919
|
+
const sourceWidth = positiveInteger(sourceWidthInput, "source width");
|
|
1920
|
+
const sourceHeight = positiveInteger(sourceHeightInput, "source height");
|
|
1921
|
+
const targetWidth = positiveInteger(spec.content.width, "content width");
|
|
1922
|
+
const targetHeight = positiveInteger(spec.content.height, "content height");
|
|
1923
|
+
const sourceCrop = clampCrop(sourceWidth, sourceHeight, spec.crop);
|
|
1924
|
+
const output = spec.fit === "stretch" ? {
|
|
1925
|
+
width: targetWidth,
|
|
1926
|
+
height: targetHeight
|
|
1927
|
+
} : (() => {
|
|
1928
|
+
const scale = Math.min(targetWidth / sourceCrop.width, targetHeight / sourceCrop.height);
|
|
1929
|
+
return {
|
|
1930
|
+
width: Math.max(1, Math.round(sourceCrop.width * scale)),
|
|
1931
|
+
height: Math.max(1, Math.round(sourceCrop.height * scale))
|
|
1932
|
+
};
|
|
1933
|
+
})();
|
|
1934
|
+
return {
|
|
1935
|
+
source: {
|
|
1936
|
+
width: sourceWidth,
|
|
1937
|
+
height: sourceHeight
|
|
1938
|
+
},
|
|
1939
|
+
sourceCrop,
|
|
1940
|
+
output,
|
|
1941
|
+
scale: {
|
|
1942
|
+
x: output.width / sourceCrop.width,
|
|
1943
|
+
y: output.height / sourceCrop.height
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1947
|
+
//#endregion
|
|
1948
|
+
//#region src/session-decode/local-frame-registry.ts
|
|
1949
|
+
var DEFAULT_MAX_FRAMES = 24;
|
|
1950
|
+
var DEFAULT_MAX_BYTES = 512 * 1024 * 1024;
|
|
1951
|
+
function estimateFrameBytes(image) {
|
|
1952
|
+
return image.width * image.height * (image.format === "gray" ? 1 : 3);
|
|
1953
|
+
}
|
|
1954
|
+
function releasesNative(reason) {
|
|
1955
|
+
return reason !== "success";
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Bounded process-local registry. A serialized ref from another process misses
|
|
1959
|
+
* by registry id; an evicted id never aliases a newer frame. View resolution
|
|
1960
|
+
* is lease-only ({@link acquire} → {@link LocalFrameLease.resolve}) so an
|
|
1961
|
+
* in-flight `toBuffer()` is covered by `refs > 1` and cannot be LRU-evicted.
|
|
1962
|
+
*/
|
|
1963
|
+
var LocalFrameRegistry = class {
|
|
1964
|
+
registryId;
|
|
1965
|
+
maxFrames;
|
|
1966
|
+
maxBytes;
|
|
1967
|
+
entries = /* @__PURE__ */ new Map();
|
|
1968
|
+
bytes = 0;
|
|
1969
|
+
releaseCount = 0;
|
|
1970
|
+
evictionCount = 0;
|
|
1971
|
+
staleMissCount = 0;
|
|
1972
|
+
constructor(options = {}) {
|
|
1973
|
+
this.registryId = options.registryId ?? `${process.pid}-${(0, node_crypto.randomUUID)()}`;
|
|
1974
|
+
this.maxFrames = options.maxFrames ?? DEFAULT_MAX_FRAMES;
|
|
1975
|
+
this.maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
1976
|
+
}
|
|
1977
|
+
get size() {
|
|
1978
|
+
return this.entries.size;
|
|
1979
|
+
}
|
|
1980
|
+
get estimatedBytes() {
|
|
1981
|
+
return this.bytes;
|
|
1982
|
+
}
|
|
1983
|
+
getStats() {
|
|
1984
|
+
let residentRefs = 0;
|
|
1985
|
+
for (const entry of this.entries.values()) residentRefs += entry.refs;
|
|
1986
|
+
return {
|
|
1987
|
+
residentFrames: this.entries.size,
|
|
1988
|
+
residentRefs,
|
|
1989
|
+
residentBytes: this.bytes,
|
|
1990
|
+
releases: this.releaseCount,
|
|
1991
|
+
evictions: this.evictionCount,
|
|
1992
|
+
staleMisses: this.staleMissCount
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
register(image, metadata) {
|
|
1996
|
+
const estimatedBytes = estimateFrameBytes(image);
|
|
1997
|
+
if (this.maxFrames < 1 || estimatedBytes > this.maxBytes) {
|
|
1998
|
+
image.close();
|
|
1999
|
+
image.releaseNativeLease?.();
|
|
2000
|
+
return null;
|
|
2001
|
+
}
|
|
2002
|
+
const ref = {
|
|
2003
|
+
registryId: this.registryId,
|
|
2004
|
+
id: (0, node_crypto.randomUUID)(),
|
|
2005
|
+
width: image.width,
|
|
2006
|
+
height: image.height,
|
|
2007
|
+
format: image.format,
|
|
2008
|
+
timestamp: metadata.timestamp,
|
|
2009
|
+
...metadata.capturedAt !== void 0 ? { capturedAt: metadata.capturedAt } : {}
|
|
2010
|
+
};
|
|
2011
|
+
this.entries.set(ref.id, {
|
|
2012
|
+
ref,
|
|
2013
|
+
image,
|
|
2014
|
+
estimatedBytes,
|
|
2015
|
+
refs: 1,
|
|
2016
|
+
releaseNativeOnClose: false
|
|
2017
|
+
});
|
|
2018
|
+
this.bytes += estimatedBytes;
|
|
2019
|
+
this.evictToBounds();
|
|
2020
|
+
return this.entries.has(ref.id) ? ref : null;
|
|
2021
|
+
}
|
|
2022
|
+
acquire(ref) {
|
|
2023
|
+
if (ref.registryId === this.registryId && !this.entries.has(ref.id)) this.staleMissCount += 1;
|
|
2024
|
+
const entry = this.getEntry(ref);
|
|
2025
|
+
if (!entry) return null;
|
|
2026
|
+
entry.refs += 1;
|
|
2027
|
+
this.touch(entry);
|
|
2028
|
+
let released = false;
|
|
2029
|
+
return {
|
|
2030
|
+
resolve: (spec) => this.resolveFromLease(entry, spec),
|
|
2031
|
+
release: (reason) => {
|
|
2032
|
+
if (released) return;
|
|
2033
|
+
released = true;
|
|
2034
|
+
this.release(ref, reason);
|
|
2035
|
+
}
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
release(ref, reason) {
|
|
2039
|
+
const entry = this.getEntry(ref);
|
|
2040
|
+
if (!entry) return;
|
|
2041
|
+
this.releaseCount += 1;
|
|
2042
|
+
if (releasesNative(reason)) entry.releaseNativeOnClose = true;
|
|
2043
|
+
entry.refs = Math.max(0, entry.refs - 1);
|
|
2044
|
+
if (entry.refs === 0) this.drop(entry);
|
|
2045
|
+
}
|
|
2046
|
+
clear(reason = "detach") {
|
|
2047
|
+
for (const entry of [...this.entries.values()]) {
|
|
2048
|
+
if (releasesNative(reason)) entry.releaseNativeOnClose = true;
|
|
2049
|
+
this.drop(entry);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
getEntry(ref) {
|
|
2053
|
+
if (ref.registryId !== this.registryId) return null;
|
|
2054
|
+
return this.entries.get(ref.id) ?? null;
|
|
2055
|
+
}
|
|
2056
|
+
touch(entry) {
|
|
2057
|
+
this.entries.delete(entry.ref.id);
|
|
2058
|
+
this.entries.set(entry.ref.id, entry);
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Materialize a view for a live lease only. Public callers must go through
|
|
2062
|
+
* {@link acquire} so `refs > 1` covers the whole `toBuffer()` window.
|
|
2063
|
+
*/
|
|
2064
|
+
async resolveFromLease(entry, spec) {
|
|
2065
|
+
if (!this.entries.has(entry.ref.id)) return {
|
|
2066
|
+
kind: "miss",
|
|
2067
|
+
reason: "stale-ref"
|
|
2068
|
+
};
|
|
2069
|
+
this.touch(entry);
|
|
2070
|
+
const geometry = resolveFrameViewGeometry(entry.image.width, entry.image.height, spec);
|
|
2071
|
+
return {
|
|
2072
|
+
kind: "view",
|
|
2073
|
+
data: await entry.image.toBuffer({
|
|
2074
|
+
crop: geometry.sourceCrop,
|
|
2075
|
+
resize: geometry.output,
|
|
2076
|
+
format: spec.format
|
|
2077
|
+
}),
|
|
2078
|
+
width: geometry.output.width,
|
|
2079
|
+
height: geometry.output.height,
|
|
2080
|
+
format: spec.format,
|
|
2081
|
+
geometry
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
/** Oldest owner-only / queued entry (`refs === 1`). Consumer leases (`refs > 1`) stay. */
|
|
2085
|
+
findOwnerOnlyVictim() {
|
|
2086
|
+
for (const entry of this.entries.values()) if (entry.refs <= 1) return entry;
|
|
2087
|
+
}
|
|
2088
|
+
evictToBounds() {
|
|
2089
|
+
while (this.entries.size > this.maxFrames || this.bytes > this.maxBytes) {
|
|
2090
|
+
const victim = this.findOwnerOnlyVictim();
|
|
2091
|
+
if (!victim) break;
|
|
2092
|
+
victim.releaseNativeOnClose = true;
|
|
2093
|
+
this.evictionCount += 1;
|
|
2094
|
+
this.drop(victim);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
drop(entry) {
|
|
2098
|
+
if (!this.entries.delete(entry.ref.id)) return;
|
|
2099
|
+
this.bytes = Math.max(0, this.bytes - entry.estimatedBytes);
|
|
2100
|
+
entry.image.close();
|
|
2101
|
+
if (entry.releaseNativeOnClose) entry.image.releaseNativeLease?.();
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2104
|
+
function envPositiveInt(name, fallback) {
|
|
2105
|
+
const parsed = Number(process.env[name]);
|
|
2106
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
|
|
2107
|
+
}
|
|
2108
|
+
/** Shared only by addons in the same grouped runner process. */
|
|
2109
|
+
var localFrameRegistry = new LocalFrameRegistry({
|
|
2110
|
+
maxFrames: envPositiveInt("CAMSTACK_LOCAL_FRAME_MAX_FRAMES", DEFAULT_MAX_FRAMES),
|
|
2111
|
+
maxBytes: envPositiveInt("CAMSTACK_LOCAL_FRAME_BUDGET_MB", DEFAULT_MAX_BYTES / 1048576) * 1048576
|
|
2112
|
+
});
|
|
2113
|
+
//#endregion
|
|
1893
2114
|
//#region src/detection-pipeline/diagnostics/event-loop-stall-monitor.ts
|
|
1894
2115
|
/**
|
|
1895
2116
|
* event-loop-stall-monitor — names the thing that freezes the detection process.
|
|
@@ -2074,6 +2295,18 @@ Object.defineProperty(exports, "landmarkPrecisionVerdict", {
|
|
|
2074
2295
|
return landmarkPrecisionVerdict;
|
|
2075
2296
|
}
|
|
2076
2297
|
});
|
|
2298
|
+
Object.defineProperty(exports, "localFrameRegistry", {
|
|
2299
|
+
enumerable: true,
|
|
2300
|
+
get: function() {
|
|
2301
|
+
return localFrameRegistry;
|
|
2302
|
+
}
|
|
2303
|
+
});
|
|
2304
|
+
Object.defineProperty(exports, "resolveFrameViewGeometry", {
|
|
2305
|
+
enumerable: true,
|
|
2306
|
+
get: function() {
|
|
2307
|
+
return resolveFrameViewGeometry;
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2077
2310
|
Object.defineProperty(exports, "resolveModelForFormat", {
|
|
2078
2311
|
enumerable: true,
|
|
2079
2312
|
get: function() {
|
|
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_dist = require("../dist-
|
|
6
|
-
const require_lazy_sharp = require("../lazy-sharp-
|
|
5
|
+
const require_dist = require("../dist-BqIbYW1A.js");
|
|
6
|
+
const require_lazy_sharp = require("../lazy-sharp-cOsy7l_P.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
//#region src/motion-wasm/wasm-motion-detector.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as hydrateSchema, G as evaluateZoneRules, Y as motionDetectionCapability, wt as DeviceType, xt as BaseAddon } from "../dist-
|
|
1
|
+
import { Et as hydrateSchema, G as evaluateZoneRules, Y as motionDetectionCapability, wt as DeviceType, xt as BaseAddon } from "../dist-DGQkkWc6.mjs";
|
|
2
2
|
import { t as getSharp } from "../lazy-sharp-6oymT_yf.mjs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|