@camstack/addon-pipeline 1.2.106 → 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.
Files changed (35) hide show
  1. package/dist/{addon-utils-BEzVJ0xg.js → addon-utils-C0ht2KPO.js} +51 -15
  2. package/dist/{addon-utils-A2S9D7pu.mjs → addon-utils-CgBCF-mE.mjs} +50 -14
  3. package/dist/audio-analyzer/index.js +3 -3
  4. package/dist/audio-analyzer/index.mjs +3 -3
  5. package/dist/detection-pipeline/index.js +198 -38
  6. package/dist/detection-pipeline/index.mjs +197 -37
  7. package/dist/{dist-BSeR_hVv.js → dist-BqIbYW1A.js} +290 -17
  8. package/dist/{dist-lITI1Bn5.mjs → dist-DGQkkWc6.mjs} +273 -18
  9. package/dist/{event-loop-stall-monitor-0VvjTRDP.mjs → event-loop-stall-monitor-D5jK5v4Z.mjs} +223 -2
  10. package/dist/{event-loop-stall-monitor-BNsp9k8r.js → event-loop-stall-monitor-ylMGpz48.js} +234 -1
  11. package/dist/{lazy-sharp-CBohM8D8.js → lazy-sharp-cOsy7l_P.js} +1 -1
  12. package/dist/motion-wasm/index.js +2 -2
  13. package/dist/motion-wasm/index.mjs +1 -1
  14. package/dist/pipeline-runner/index.js +915 -107
  15. package/dist/pipeline-runner/index.mjs +914 -106
  16. package/dist/{process-memory-C33u3tQz.js → process-memory-45juuHpN.js} +1 -1
  17. package/dist/{process-memory-CEKVKfwg.mjs → process-memory-BtT7WfbJ.mjs} +1 -1
  18. package/dist/recorder/index.js +187 -47
  19. package/dist/recorder/index.mjs +187 -47
  20. package/dist/session-decode/decode-worker-child.js +30 -10
  21. package/dist/session-decode/decode-worker-child.mjs +29 -9
  22. package/dist/stream-broker/_stub.js +2 -2
  23. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-w2XLD3uI.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C_SFFNGT.mjs} +3 -3
  24. 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
  25. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DsIi4G5Q.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
  26. package/dist/stream-broker/{hostInit-B-h24cDy.mjs → hostInit-CG28NvlV.mjs} +3 -3
  27. package/dist/stream-broker/index.js +279 -198
  28. package/dist/stream-broker/index.mjs +279 -198
  29. package/dist/stream-broker/remoteEntry.js +1 -1
  30. package/dist/{worker-protocol-CiKfal2P.js → worker-protocol-CIrqGbpG.js} +6 -3
  31. package/dist/{worker-protocol-BDiL8TBm.mjs → worker-protocol-DyocTIx_.mjs} +6 -3
  32. package/package.json +1 -1
  33. package/python/inference_pool.py +4 -1
  34. package/python/test_inference_pool_preprocess.py +87 -16
  35. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DvZWLWk1.mjs +0 -26
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-BSeR_hVv.js");
1
+ const require_dist = require("./dist-BqIbYW1A.js");
2
2
  require("node:crypto");
3
3
  let node_path = require("node:path");
4
4
  node_path = require_dist.__toESM(node_path, 1);
@@ -6,7 +6,7 @@ let node_fs = require("node:fs");
6
6
  node_fs = require_dist.__toESM(node_fs, 1);
7
7
  let node_util = require("node:util");
8
8
  let node_zlib = require("node:zlib");
9
- //#region ../system/dist/file-data-plane-CuE_hBli.mjs
9
+ //#region ../system/dist/file-data-plane-BhKdxJgf.mjs
10
10
  function isNonEmptyFile(filePath) {
11
11
  return node_fs.existsSync(filePath) && node_fs.statSync(filePath).size > 0;
12
12
  }
@@ -32,21 +32,56 @@ function buildHeaders(url) {
32
32
  if (hfToken && url.includes("huggingface.co")) headers["Authorization"] = `Bearer ${hfToken}`;
33
33
  return headers;
34
34
  }
35
- /**
36
- * Download a single file from a URL to a destination path.
37
- * Uses native fetch() (Node 22+) which handles redirects natively.
38
- * Streams to disk with optional progress callback.
39
- * Returns the destination path. Skips download if file already exists.
40
- */
41
- async function downloadFile(url, destPath, onProgress) {
35
+ var DEFAULT_MAX_REDIRECTS = 5;
36
+ function normalizeDownloadOptions(third) {
37
+ if (typeof third === "function") return { onProgress: third };
38
+ return third ?? {};
39
+ }
40
+ function isRedirectStatus(status) {
41
+ return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
42
+ }
43
+ function resolveRedirectUrl(current, location) {
44
+ return new URL(location, current);
45
+ }
46
+ async function downloadFile(url, destPath, onProgressOrOptions) {
42
47
  if (node_fs.existsSync(destPath)) return destPath;
48
+ const opts = normalizeDownloadOptions(onProgressOrOptions);
49
+ const fetchImpl = opts.fetchImpl ?? fetch;
50
+ const maxRedirects = opts.maxRedirects ?? DEFAULT_MAX_REDIRECTS;
43
51
  node_fs.mkdirSync(node_path.dirname(destPath), { recursive: true });
44
52
  const tmpPath = destPath + ".downloading";
45
53
  try {
46
- const response = await fetch(url, {
47
- redirect: "follow",
48
- headers: buildHeaders(url)
49
- });
54
+ let current = url;
55
+ const seen = /* @__PURE__ */ new Set();
56
+ let response;
57
+ const manual = opts.redirectPolicy !== void 0;
58
+ for (let hop = 0; hop <= maxRedirects; hop++) {
59
+ const parsed = new URL(current);
60
+ if (opts.redirectPolicy) opts.redirectPolicy(parsed, hop);
61
+ if (seen.has(parsed.href)) throw new Error(`Redirect loop detected at ${parsed.href}`);
62
+ seen.add(parsed.href);
63
+ const controller = opts.timeoutMs !== void 0 ? new AbortController() : void 0;
64
+ const timer = controller && opts.timeoutMs !== void 0 ? setTimeout(() => controller.abort(), opts.timeoutMs) : void 0;
65
+ try {
66
+ response = await fetchImpl(current, {
67
+ redirect: manual ? "manual" : "follow",
68
+ headers: buildHeaders(current),
69
+ ...controller ? { signal: controller.signal } : {}
70
+ });
71
+ } finally {
72
+ if (timer) clearTimeout(timer);
73
+ }
74
+ if (manual && isRedirectStatus(response.status)) {
75
+ const location = response.headers.get("location");
76
+ if (!location) throw new Error(`Redirect ${response.status} missing Location header`);
77
+ if (hop >= maxRedirects) throw new Error(`Too many redirects (max ${maxRedirects}) downloading ${url}`);
78
+ current = resolveRedirectUrl(current, location).href;
79
+ continue;
80
+ }
81
+ break;
82
+ }
83
+ if (!response) throw new Error(`No response downloading ${url}`);
84
+ if (manual && isRedirectStatus(response.status)) throw new Error(`Too many redirects (max ${maxRedirects}) downloading ${url}`);
50
85
  if (!response.ok) throw new Error(`HTTP ${response.status} downloading ${url}`);
51
86
  if (!response.body) throw new Error(`No response body from ${url}`);
52
87
  const total = parseInt(response.headers.get("content-length") ?? "0", 10);
@@ -57,9 +92,10 @@ async function downloadFile(url, destPath, onProgress) {
57
92
  for (;;) {
58
93
  const { done, value } = await reader.read();
59
94
  if (done || !value) break;
60
- fileStream.write(value);
61
95
  downloaded += value.length;
62
- onProgress?.(downloaded, total);
96
+ if (opts.maxBytes !== void 0 && downloaded > opts.maxBytes) throw new Error(`Downloaded ${downloaded} bytes exceeds the ${opts.maxBytes}-byte limit`);
97
+ fileStream.write(value);
98
+ opts.onProgress?.(downloaded, total);
63
99
  }
64
100
  } finally {
65
101
  fileStream.end();
@@ -5,7 +5,7 @@ import * as fs from "node:fs";
5
5
  import { createReadStream, promises } from "node:fs";
6
6
  import { promisify } from "node:util";
7
7
  import { brotliCompress, constants, gzip } from "node:zlib";
8
- //#region ../system/dist/file-data-plane-CuE_hBli.mjs
8
+ //#region ../system/dist/file-data-plane-BhKdxJgf.mjs
9
9
  function isNonEmptyFile(filePath) {
10
10
  return fs.existsSync(filePath) && fs.statSync(filePath).size > 0;
11
11
  }
@@ -31,21 +31,56 @@ function buildHeaders(url) {
31
31
  if (hfToken && url.includes("huggingface.co")) headers["Authorization"] = `Bearer ${hfToken}`;
32
32
  return headers;
33
33
  }
34
- /**
35
- * Download a single file from a URL to a destination path.
36
- * Uses native fetch() (Node 22+) which handles redirects natively.
37
- * Streams to disk with optional progress callback.
38
- * Returns the destination path. Skips download if file already exists.
39
- */
40
- async function downloadFile(url, destPath, onProgress) {
34
+ var DEFAULT_MAX_REDIRECTS = 5;
35
+ function normalizeDownloadOptions(third) {
36
+ if (typeof third === "function") return { onProgress: third };
37
+ return third ?? {};
38
+ }
39
+ function isRedirectStatus(status) {
40
+ return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
41
+ }
42
+ function resolveRedirectUrl(current, location) {
43
+ return new URL(location, current);
44
+ }
45
+ async function downloadFile(url, destPath, onProgressOrOptions) {
41
46
  if (fs.existsSync(destPath)) return destPath;
47
+ const opts = normalizeDownloadOptions(onProgressOrOptions);
48
+ const fetchImpl = opts.fetchImpl ?? fetch;
49
+ const maxRedirects = opts.maxRedirects ?? DEFAULT_MAX_REDIRECTS;
42
50
  fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
43
51
  const tmpPath = destPath + ".downloading";
44
52
  try {
45
- const response = await fetch(url, {
46
- redirect: "follow",
47
- headers: buildHeaders(url)
48
- });
53
+ let current = url;
54
+ const seen = /* @__PURE__ */ new Set();
55
+ let response;
56
+ const manual = opts.redirectPolicy !== void 0;
57
+ for (let hop = 0; hop <= maxRedirects; hop++) {
58
+ const parsed = new URL(current);
59
+ if (opts.redirectPolicy) opts.redirectPolicy(parsed, hop);
60
+ if (seen.has(parsed.href)) throw new Error(`Redirect loop detected at ${parsed.href}`);
61
+ seen.add(parsed.href);
62
+ const controller = opts.timeoutMs !== void 0 ? new AbortController() : void 0;
63
+ const timer = controller && opts.timeoutMs !== void 0 ? setTimeout(() => controller.abort(), opts.timeoutMs) : void 0;
64
+ try {
65
+ response = await fetchImpl(current, {
66
+ redirect: manual ? "manual" : "follow",
67
+ headers: buildHeaders(current),
68
+ ...controller ? { signal: controller.signal } : {}
69
+ });
70
+ } finally {
71
+ if (timer) clearTimeout(timer);
72
+ }
73
+ if (manual && isRedirectStatus(response.status)) {
74
+ const location = response.headers.get("location");
75
+ if (!location) throw new Error(`Redirect ${response.status} missing Location header`);
76
+ if (hop >= maxRedirects) throw new Error(`Too many redirects (max ${maxRedirects}) downloading ${url}`);
77
+ current = resolveRedirectUrl(current, location).href;
78
+ continue;
79
+ }
80
+ break;
81
+ }
82
+ if (!response) throw new Error(`No response downloading ${url}`);
83
+ if (manual && isRedirectStatus(response.status)) throw new Error(`Too many redirects (max ${maxRedirects}) downloading ${url}`);
49
84
  if (!response.ok) throw new Error(`HTTP ${response.status} downloading ${url}`);
50
85
  if (!response.body) throw new Error(`No response body from ${url}`);
51
86
  const total = parseInt(response.headers.get("content-length") ?? "0", 10);
@@ -56,9 +91,10 @@ async function downloadFile(url, destPath, onProgress) {
56
91
  for (;;) {
57
92
  const { done, value } = await reader.read();
58
93
  if (done || !value) break;
59
- fileStream.write(value);
60
94
  downloaded += value.length;
61
- onProgress?.(downloaded, total);
95
+ if (opts.maxBytes !== void 0 && downloaded > opts.maxBytes) throw new Error(`Downloaded ${downloaded} bytes exceeds the ${opts.maxBytes}-byte limit`);
96
+ fileStream.write(value);
97
+ opts.onProgress?.(downloaded, total);
62
98
  }
63
99
  } finally {
64
100
  fileStream.end();
@@ -2,9 +2,9 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-BSeR_hVv.js");
6
- const require_process_memory = require("../process-memory-C33u3tQz.js");
7
- const require_addon_utils = require("../addon-utils-BEzVJ0xg.js");
5
+ const require_dist = require("../dist-BqIbYW1A.js");
6
+ const require_process_memory = require("../process-memory-45juuHpN.js");
7
+ const require_addon_utils = require("../addon-utils-C0ht2KPO.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_dist.__toESM(node_path);
10
10
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
1
  import { n as __require } from "../chunk-DnnnRqeS.mjs";
2
- import { Ct as hydrateSchema, K as mapAudioLabelToMacro, O as audioAnalysisCapability, at as resolvePoolMemoryPolicy, b as PoolMemoryWatchdog, ft as errMsg, g as HF_BASE_URL, k as audioAnalyzerCapability, n as AUDIO_BACKEND_CHOICES, s as DEFAULT_AUDIO_ANALYZER_CONFIG, vt as BaseAddon } from "../dist-lITI1Bn5.mjs";
3
- import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-CEKVKfwg.mjs";
4
- import { i as downloadFile } from "../addon-utils-A2S9D7pu.mjs";
2
+ import { A as audioAnalyzerCapability, Et as hydrateSchema, _ as HF_BASE_URL, ct as resolvePoolMemoryPolicy, ht as errMsg, k as audioAnalysisCapability, n as AUDIO_BACKEND_CHOICES, q as mapAudioLabelToMacro, s as DEFAULT_AUDIO_ANALYZER_CONFIG, x as PoolMemoryWatchdog, xt as BaseAddon } from "../dist-DGQkkWc6.mjs";
3
+ import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-BtT7WfbJ.mjs";
4
+ import { i as downloadFile } from "../addon-utils-CgBCF-mE.mjs";
5
5
  import * as path$1 from "node:path";
6
6
  import * as fs from "node:fs";
7
7
  //#region src/audio-analyzer/audio-pipeline.ts