@camstack/addon-pipeline 1.2.52 → 1.2.54
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-DveoBR6G.js → addon-utils-CQs-AjTJ.js} +177 -177
- package/dist/{addon-utils-QuxtOdK1.mjs → addon-utils-CZ2xo67g.mjs} +177 -177
- package/dist/audio-analyzer/index.js +2 -2
- package/dist/audio-analyzer/index.mjs +2 -2
- package/dist/detection-pipeline/index.js +3 -3
- package/dist/detection-pipeline/index.mjs +3 -3
- package/dist/{dist-gB3o0cyM.mjs → dist-B55xTTsS.mjs} +368 -5
- package/dist/{dist-CzFJeiG1.js → dist-D8TX_P_A.js} +368 -5
- package/dist/{event-loop-stall-monitor-DSPDQYjc.js → event-loop-stall-monitor-Bs6d-u_F.js} +1 -1
- package/dist/{event-loop-stall-monitor-PxIaVeyh.mjs → event-loop-stall-monitor-Cq_KOlfb.mjs} +1 -1
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/pipeline-runner/index.js +75 -25
- package/dist/pipeline-runner/index.mjs +75 -25
- package/dist/recorder/index.js +2 -2
- package/dist/recorder/index.mjs +2 -2
- package/dist/session-decode/decode-worker-child.js +6 -2
- package/dist/session-decode/decode-worker-child.mjs +6 -2
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DAeBhR8B.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C-9q6y1s.mjs} +3 -3
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CAmiVOsA.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-CaGsMvou.mjs +26 -0
- package/dist/stream-broker/{hostInit-DniAXKLy.mjs → hostInit-DiXYwnXH.mjs} +3 -3
- package/dist/stream-broker/index.js +2 -2
- package/dist/stream-broker/index.mjs +2 -2
- package/dist/stream-broker/remoteEntry.js +1 -1
- package/dist/{worker-protocol-BhhX7J4-.mjs → worker-protocol-Bol291_n.mjs} +1 -1
- package/dist/{worker-protocol-BQlELGzv.js → worker-protocol-C2uctCrd.js} +1 -1
- package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-B1gpA9sI.js → MaskShapeCanvas-DI4BY7W2-DY1AX2y_.js} +1 -1
- package/embed-dist/assets/{MotionZonesSettings-NcxxQN8r-DV6vvNDq.js → MotionZonesSettings-NcxxQN8r-D46Ft0YB.js} +1 -1
- package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-BmUdRoZ9.js → PrivacyMaskSettings-APgPLF7p-BLD9p-W3.js} +1 -1
- package/embed-dist/assets/{index-ICnBEqOy.css → index-C68W664Z.css} +1 -1
- package/embed-dist/assets/{index-DsGzhGCW.js → index-CWxqVyhE.js} +12 -12
- package/embed-dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Bl9zivOk.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-Czrsozsg.mjs +0 -26
|
@@ -5,7 +5,183 @@ import * as path$1 from "node:path";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { brotliCompress, constants, gzip } from "node:zlib";
|
|
8
|
-
//#region ../system/dist/
|
|
8
|
+
//#region ../system/dist/file-data-plane-CuE_hBli.mjs
|
|
9
|
+
function isNonEmptyFile(filePath) {
|
|
10
|
+
return fs.existsSync(filePath) && fs.statSync(filePath).size > 0;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Sibling files of a single-file (non-directory) format — extra files the
|
|
14
|
+
* format needs, fetched from the same remote directory as `url` and stored
|
|
15
|
+
* flat alongside the main file in `modelsDir`. Catalog-declared via
|
|
16
|
+
* `formatEntry.files`, e.g. OpenVINO IR lists its `.bin` weights next to the
|
|
17
|
+
* `.xml`. The downloader stays format-agnostic; the convention lives in the
|
|
18
|
+
* catalog data (like `MLPACKAGE_FILES` for the directory case).
|
|
19
|
+
*/
|
|
20
|
+
function siblingFilesFor(formatEntry) {
|
|
21
|
+
return formatEntry.isDirectory ? [] : formatEntry.files ?? [];
|
|
22
|
+
}
|
|
23
|
+
/** Resolve a sibling's remote URL relative to the main file's directory. */
|
|
24
|
+
function siblingUrl(mainUrl, sibling) {
|
|
25
|
+
return mainUrl.replace(/[^/]+$/, sibling);
|
|
26
|
+
}
|
|
27
|
+
/** Build fetch headers, including HF auth token for huggingface.co URLs */
|
|
28
|
+
function buildHeaders(url) {
|
|
29
|
+
const headers = { "User-Agent": "CamStack/1.0" };
|
|
30
|
+
const hfToken = process.env["HF_TOKEN"] ?? process.env["HUGGING_FACE_HUB_TOKEN"];
|
|
31
|
+
if (hfToken && url.includes("huggingface.co")) headers["Authorization"] = `Bearer ${hfToken}`;
|
|
32
|
+
return headers;
|
|
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) {
|
|
41
|
+
if (fs.existsSync(destPath)) return destPath;
|
|
42
|
+
fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
|
|
43
|
+
const tmpPath = destPath + ".downloading";
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(url, {
|
|
46
|
+
redirect: "follow",
|
|
47
|
+
headers: buildHeaders(url)
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) throw new Error(`HTTP ${response.status} downloading ${url}`);
|
|
50
|
+
if (!response.body) throw new Error(`No response body from ${url}`);
|
|
51
|
+
const total = parseInt(response.headers.get("content-length") ?? "0", 10);
|
|
52
|
+
let downloaded = 0;
|
|
53
|
+
const fileStream = fs.createWriteStream(tmpPath);
|
|
54
|
+
const reader = response.body.getReader();
|
|
55
|
+
try {
|
|
56
|
+
for (;;) {
|
|
57
|
+
const { done, value } = await reader.read();
|
|
58
|
+
if (done || !value) break;
|
|
59
|
+
fileStream.write(value);
|
|
60
|
+
downloaded += value.length;
|
|
61
|
+
onProgress?.(downloaded, total);
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
fileStream.end();
|
|
65
|
+
await new Promise((resolve, reject) => {
|
|
66
|
+
fileStream.on("finish", resolve);
|
|
67
|
+
fileStream.on("error", reject);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
fs.renameSync(tmpPath, destPath);
|
|
71
|
+
return destPath;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
try {
|
|
74
|
+
fs.unlinkSync(tmpPath);
|
|
75
|
+
} catch {}
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Download every file in a HuggingFace directory bundle (e.g.,
|
|
81
|
+
* `.mlpackage` / OpenVINO IR pair) atomically. `knownFiles` lists the
|
|
82
|
+
* relative paths inside the directory; the function fetches each from
|
|
83
|
+
* `${url}/${file}` and renames the staging directory only on full
|
|
84
|
+
* success. Mirrors `ModelDownloadService.downloadDirectory` but
|
|
85
|
+
* exposed as a standalone for catalog-less callers.
|
|
86
|
+
*/
|
|
87
|
+
async function downloadDirectory(url, destDir, knownFiles, onProgress) {
|
|
88
|
+
const match = url.match(/huggingface\.co\/([^/]+\/[^/]+)\/resolve\/main\/(.+)/);
|
|
89
|
+
if (!match) throw new Error(`Cannot parse HuggingFace URL: ${url}`);
|
|
90
|
+
const [, repo, dirPath] = match;
|
|
91
|
+
const files = (knownFiles ?? []).map((f) => ({
|
|
92
|
+
relativePath: f,
|
|
93
|
+
fileUrl: `https://huggingface.co/${repo}/resolve/main/${dirPath}/${f}`
|
|
94
|
+
}));
|
|
95
|
+
if (files.length === 0) throw new Error(`Directory bundle requires explicit \`files\` list (got none for ${url})`);
|
|
96
|
+
const tmpDir = destDir + ".downloading";
|
|
97
|
+
fs.rmSync(tmpDir, {
|
|
98
|
+
recursive: true,
|
|
99
|
+
force: true
|
|
100
|
+
});
|
|
101
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
102
|
+
let totalDownloaded = 0;
|
|
103
|
+
try {
|
|
104
|
+
for (const file of files) {
|
|
105
|
+
const destPath = path$1.join(tmpDir, file.relativePath);
|
|
106
|
+
fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
|
|
107
|
+
await downloadFile(file.fileUrl, destPath, (downloaded, _total) => {
|
|
108
|
+
onProgress?.(totalDownloaded + downloaded, void 0);
|
|
109
|
+
});
|
|
110
|
+
totalDownloaded += fs.statSync(destPath).size;
|
|
111
|
+
}
|
|
112
|
+
fs.rmSync(destDir, {
|
|
113
|
+
recursive: true,
|
|
114
|
+
force: true
|
|
115
|
+
});
|
|
116
|
+
fs.renameSync(tmpDir, destDir);
|
|
117
|
+
} catch (err) {
|
|
118
|
+
fs.rmSync(tmpDir, {
|
|
119
|
+
recursive: true,
|
|
120
|
+
force: true
|
|
121
|
+
});
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Resolve a `ModelCatalogEntry` against `modelsDir`: download model file
|
|
127
|
+
* (or directory bundle) + extra files (labels JSON, charset dict, …),
|
|
128
|
+
* skip if already on disk. Returns the local model path.
|
|
129
|
+
*/
|
|
130
|
+
async function ensureModel(modelsDir, entry, format, onProgress) {
|
|
131
|
+
const formatEntry = entry.formats[format];
|
|
132
|
+
if (!formatEntry) throw new Error(`Model "${entry.id}" has no ${format} format. Available: ${Object.keys(entry.formats).join(", ")}`);
|
|
133
|
+
if (entry.extraFiles) for (const extra of entry.extraFiles) await downloadFile(extra.url, path$1.join(modelsDir, extra.filename));
|
|
134
|
+
const filename = formatEntry.url.split("/").pop() ?? `${entry.id}.${format}`;
|
|
135
|
+
const modelPath = path$1.join(modelsDir, filename);
|
|
136
|
+
const siblings = siblingFilesFor(formatEntry);
|
|
137
|
+
if (fs.existsSync(modelPath)) if (formatEntry.isDirectory && !fs.existsSync(path$1.join(modelPath, "Manifest.json"))) fs.rmSync(modelPath, {
|
|
138
|
+
recursive: true,
|
|
139
|
+
force: true
|
|
140
|
+
});
|
|
141
|
+
else if (siblings.some((f) => !isNonEmptyFile(path$1.join(modelsDir, f)))) {} else return modelPath;
|
|
142
|
+
fs.mkdirSync(modelsDir, { recursive: true });
|
|
143
|
+
if (formatEntry.isDirectory) await downloadDirectory(formatEntry.url, modelPath, formatEntry.files, onProgress);
|
|
144
|
+
else {
|
|
145
|
+
await downloadFile(formatEntry.url, modelPath, (downloaded, total) => onProgress?.(downloaded, total === 0 ? void 0 : total));
|
|
146
|
+
for (const sibling of siblings) await downloadFile(siblingUrl(formatEntry.url, sibling), path$1.join(modelsDir, sibling));
|
|
147
|
+
}
|
|
148
|
+
return modelPath;
|
|
149
|
+
}
|
|
150
|
+
/** Compute the on-disk path for a given model + format, even when not yet downloaded. */
|
|
151
|
+
function getModelFilePath(modelsDir, entry, format) {
|
|
152
|
+
const formatEntry = entry.formats[format];
|
|
153
|
+
if (!formatEntry) return null;
|
|
154
|
+
const filename = formatEntry.url.split("/").pop() ?? `${entry.id}.${format}`;
|
|
155
|
+
return path$1.join(modelsDir, filename);
|
|
156
|
+
}
|
|
157
|
+
/** True iff the model file (or `Manifest.json` for directory bundles) exists and is non-empty. */
|
|
158
|
+
function isModelDownloaded(modelsDir, entry, format) {
|
|
159
|
+
const formatEntry = entry.formats[format];
|
|
160
|
+
if (!formatEntry) return false;
|
|
161
|
+
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
162
|
+
if (!modelPath || !fs.existsSync(modelPath)) return false;
|
|
163
|
+
if (formatEntry.isDirectory) return fs.existsSync(path$1.join(modelPath, "Manifest.json"));
|
|
164
|
+
if (fs.statSync(modelPath).size <= 0) return false;
|
|
165
|
+
return siblingFilesFor(formatEntry).every((f) => isNonEmptyFile(path$1.join(modelsDir, f)));
|
|
166
|
+
}
|
|
167
|
+
/** Remove the on-disk model file/directory. Returns true if something was deleted. */
|
|
168
|
+
function deleteModelFromDisk(modelsDir, entry, format) {
|
|
169
|
+
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
170
|
+
if (!modelPath || !fs.existsSync(modelPath)) return false;
|
|
171
|
+
const formatEntry = entry.formats[format];
|
|
172
|
+
if (formatEntry?.isDirectory) fs.rmSync(modelPath, {
|
|
173
|
+
recursive: true,
|
|
174
|
+
force: true
|
|
175
|
+
});
|
|
176
|
+
else {
|
|
177
|
+
fs.unlinkSync(modelPath);
|
|
178
|
+
if (formatEntry) for (const sibling of siblingFilesFor(formatEntry)) {
|
|
179
|
+
const sibPath = path$1.join(modelsDir, sibling);
|
|
180
|
+
if (fs.existsSync(sibPath)) fs.unlinkSync(sibPath);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
9
185
|
/**
|
|
10
186
|
* Map a rel path to one candidate absolute path PER root, keeping only roots the
|
|
11
187
|
* path stays within (traversal guard). The handler serves the first candidate
|
|
@@ -367,181 +543,5 @@ function createFileDataPlaneHandler(opts) {
|
|
|
367
543
|
createReadStream(absPath).pipe(res);
|
|
368
544
|
};
|
|
369
545
|
}
|
|
370
|
-
function isNonEmptyFile(filePath) {
|
|
371
|
-
return fs.existsSync(filePath) && fs.statSync(filePath).size > 0;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Sibling files of a single-file (non-directory) format — extra files the
|
|
375
|
-
* format needs, fetched from the same remote directory as `url` and stored
|
|
376
|
-
* flat alongside the main file in `modelsDir`. Catalog-declared via
|
|
377
|
-
* `formatEntry.files`, e.g. OpenVINO IR lists its `.bin` weights next to the
|
|
378
|
-
* `.xml`. The downloader stays format-agnostic; the convention lives in the
|
|
379
|
-
* catalog data (like `MLPACKAGE_FILES` for the directory case).
|
|
380
|
-
*/
|
|
381
|
-
function siblingFilesFor(formatEntry) {
|
|
382
|
-
return formatEntry.isDirectory ? [] : formatEntry.files ?? [];
|
|
383
|
-
}
|
|
384
|
-
/** Resolve a sibling's remote URL relative to the main file's directory. */
|
|
385
|
-
function siblingUrl(mainUrl, sibling) {
|
|
386
|
-
return mainUrl.replace(/[^/]+$/, sibling);
|
|
387
|
-
}
|
|
388
|
-
/** Build fetch headers, including HF auth token for huggingface.co URLs */
|
|
389
|
-
function buildHeaders(url) {
|
|
390
|
-
const headers = { "User-Agent": "CamStack/1.0" };
|
|
391
|
-
const hfToken = process.env["HF_TOKEN"] ?? process.env["HUGGING_FACE_HUB_TOKEN"];
|
|
392
|
-
if (hfToken && url.includes("huggingface.co")) headers["Authorization"] = `Bearer ${hfToken}`;
|
|
393
|
-
return headers;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Download a single file from a URL to a destination path.
|
|
397
|
-
* Uses native fetch() (Node 22+) which handles redirects natively.
|
|
398
|
-
* Streams to disk with optional progress callback.
|
|
399
|
-
* Returns the destination path. Skips download if file already exists.
|
|
400
|
-
*/
|
|
401
|
-
async function downloadFile(url, destPath, onProgress) {
|
|
402
|
-
if (fs.existsSync(destPath)) return destPath;
|
|
403
|
-
fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
|
|
404
|
-
const tmpPath = destPath + ".downloading";
|
|
405
|
-
try {
|
|
406
|
-
const response = await fetch(url, {
|
|
407
|
-
redirect: "follow",
|
|
408
|
-
headers: buildHeaders(url)
|
|
409
|
-
});
|
|
410
|
-
if (!response.ok) throw new Error(`HTTP ${response.status} downloading ${url}`);
|
|
411
|
-
if (!response.body) throw new Error(`No response body from ${url}`);
|
|
412
|
-
const total = parseInt(response.headers.get("content-length") ?? "0", 10);
|
|
413
|
-
let downloaded = 0;
|
|
414
|
-
const fileStream = fs.createWriteStream(tmpPath);
|
|
415
|
-
const reader = response.body.getReader();
|
|
416
|
-
try {
|
|
417
|
-
for (;;) {
|
|
418
|
-
const { done, value } = await reader.read();
|
|
419
|
-
if (done || !value) break;
|
|
420
|
-
fileStream.write(value);
|
|
421
|
-
downloaded += value.length;
|
|
422
|
-
onProgress?.(downloaded, total);
|
|
423
|
-
}
|
|
424
|
-
} finally {
|
|
425
|
-
fileStream.end();
|
|
426
|
-
await new Promise((resolve, reject) => {
|
|
427
|
-
fileStream.on("finish", resolve);
|
|
428
|
-
fileStream.on("error", reject);
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
fs.renameSync(tmpPath, destPath);
|
|
432
|
-
return destPath;
|
|
433
|
-
} catch (err) {
|
|
434
|
-
try {
|
|
435
|
-
fs.unlinkSync(tmpPath);
|
|
436
|
-
} catch {}
|
|
437
|
-
throw err;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Download every file in a HuggingFace directory bundle (e.g.,
|
|
442
|
-
* `.mlpackage` / OpenVINO IR pair) atomically. `knownFiles` lists the
|
|
443
|
-
* relative paths inside the directory; the function fetches each from
|
|
444
|
-
* `${url}/${file}` and renames the staging directory only on full
|
|
445
|
-
* success. Mirrors `ModelDownloadService.downloadDirectory` but
|
|
446
|
-
* exposed as a standalone for catalog-less callers.
|
|
447
|
-
*/
|
|
448
|
-
async function downloadDirectory(url, destDir, knownFiles, onProgress) {
|
|
449
|
-
const match = url.match(/huggingface\.co\/([^/]+\/[^/]+)\/resolve\/main\/(.+)/);
|
|
450
|
-
if (!match) throw new Error(`Cannot parse HuggingFace URL: ${url}`);
|
|
451
|
-
const [, repo, dirPath] = match;
|
|
452
|
-
const files = (knownFiles ?? []).map((f) => ({
|
|
453
|
-
relativePath: f,
|
|
454
|
-
fileUrl: `https://huggingface.co/${repo}/resolve/main/${dirPath}/${f}`
|
|
455
|
-
}));
|
|
456
|
-
if (files.length === 0) throw new Error(`Directory bundle requires explicit \`files\` list (got none for ${url})`);
|
|
457
|
-
const tmpDir = destDir + ".downloading";
|
|
458
|
-
fs.rmSync(tmpDir, {
|
|
459
|
-
recursive: true,
|
|
460
|
-
force: true
|
|
461
|
-
});
|
|
462
|
-
fs.mkdirSync(tmpDir, { recursive: true });
|
|
463
|
-
let totalDownloaded = 0;
|
|
464
|
-
try {
|
|
465
|
-
for (const file of files) {
|
|
466
|
-
const destPath = path$1.join(tmpDir, file.relativePath);
|
|
467
|
-
fs.mkdirSync(path$1.dirname(destPath), { recursive: true });
|
|
468
|
-
await downloadFile(file.fileUrl, destPath, (downloaded, _total) => {
|
|
469
|
-
onProgress?.(totalDownloaded + downloaded, void 0);
|
|
470
|
-
});
|
|
471
|
-
totalDownloaded += fs.statSync(destPath).size;
|
|
472
|
-
}
|
|
473
|
-
fs.rmSync(destDir, {
|
|
474
|
-
recursive: true,
|
|
475
|
-
force: true
|
|
476
|
-
});
|
|
477
|
-
fs.renameSync(tmpDir, destDir);
|
|
478
|
-
} catch (err) {
|
|
479
|
-
fs.rmSync(tmpDir, {
|
|
480
|
-
recursive: true,
|
|
481
|
-
force: true
|
|
482
|
-
});
|
|
483
|
-
throw err;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* Resolve a `ModelCatalogEntry` against `modelsDir`: download model file
|
|
488
|
-
* (or directory bundle) + extra files (labels JSON, charset dict, …),
|
|
489
|
-
* skip if already on disk. Returns the local model path.
|
|
490
|
-
*/
|
|
491
|
-
async function ensureModel(modelsDir, entry, format, onProgress) {
|
|
492
|
-
const formatEntry = entry.formats[format];
|
|
493
|
-
if (!formatEntry) throw new Error(`Model "${entry.id}" has no ${format} format. Available: ${Object.keys(entry.formats).join(", ")}`);
|
|
494
|
-
if (entry.extraFiles) for (const extra of entry.extraFiles) await downloadFile(extra.url, path$1.join(modelsDir, extra.filename));
|
|
495
|
-
const filename = formatEntry.url.split("/").pop() ?? `${entry.id}.${format}`;
|
|
496
|
-
const modelPath = path$1.join(modelsDir, filename);
|
|
497
|
-
const siblings = siblingFilesFor(formatEntry);
|
|
498
|
-
if (fs.existsSync(modelPath)) if (formatEntry.isDirectory && !fs.existsSync(path$1.join(modelPath, "Manifest.json"))) fs.rmSync(modelPath, {
|
|
499
|
-
recursive: true,
|
|
500
|
-
force: true
|
|
501
|
-
});
|
|
502
|
-
else if (siblings.some((f) => !isNonEmptyFile(path$1.join(modelsDir, f)))) {} else return modelPath;
|
|
503
|
-
fs.mkdirSync(modelsDir, { recursive: true });
|
|
504
|
-
if (formatEntry.isDirectory) await downloadDirectory(formatEntry.url, modelPath, formatEntry.files, onProgress);
|
|
505
|
-
else {
|
|
506
|
-
await downloadFile(formatEntry.url, modelPath, (downloaded, total) => onProgress?.(downloaded, total === 0 ? void 0 : total));
|
|
507
|
-
for (const sibling of siblings) await downloadFile(siblingUrl(formatEntry.url, sibling), path$1.join(modelsDir, sibling));
|
|
508
|
-
}
|
|
509
|
-
return modelPath;
|
|
510
|
-
}
|
|
511
|
-
/** Compute the on-disk path for a given model + format, even when not yet downloaded. */
|
|
512
|
-
function getModelFilePath(modelsDir, entry, format) {
|
|
513
|
-
const formatEntry = entry.formats[format];
|
|
514
|
-
if (!formatEntry) return null;
|
|
515
|
-
const filename = formatEntry.url.split("/").pop() ?? `${entry.id}.${format}`;
|
|
516
|
-
return path$1.join(modelsDir, filename);
|
|
517
|
-
}
|
|
518
|
-
/** True iff the model file (or `Manifest.json` for directory bundles) exists and is non-empty. */
|
|
519
|
-
function isModelDownloaded(modelsDir, entry, format) {
|
|
520
|
-
const formatEntry = entry.formats[format];
|
|
521
|
-
if (!formatEntry) return false;
|
|
522
|
-
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
523
|
-
if (!modelPath || !fs.existsSync(modelPath)) return false;
|
|
524
|
-
if (formatEntry.isDirectory) return fs.existsSync(path$1.join(modelPath, "Manifest.json"));
|
|
525
|
-
if (fs.statSync(modelPath).size <= 0) return false;
|
|
526
|
-
return siblingFilesFor(formatEntry).every((f) => isNonEmptyFile(path$1.join(modelsDir, f)));
|
|
527
|
-
}
|
|
528
|
-
/** Remove the on-disk model file/directory. Returns true if something was deleted. */
|
|
529
|
-
function deleteModelFromDisk(modelsDir, entry, format) {
|
|
530
|
-
const modelPath = getModelFilePath(modelsDir, entry, format);
|
|
531
|
-
if (!modelPath || !fs.existsSync(modelPath)) return false;
|
|
532
|
-
const formatEntry = entry.formats[format];
|
|
533
|
-
if (formatEntry?.isDirectory) fs.rmSync(modelPath, {
|
|
534
|
-
recursive: true,
|
|
535
|
-
force: true
|
|
536
|
-
});
|
|
537
|
-
else {
|
|
538
|
-
fs.unlinkSync(modelPath);
|
|
539
|
-
if (formatEntry) for (const sibling of siblingFilesFor(formatEntry)) {
|
|
540
|
-
const sibPath = path$1.join(modelsDir, sibling);
|
|
541
|
-
if (fs.existsSync(sibPath)) fs.unlinkSync(sibPath);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
return true;
|
|
545
|
-
}
|
|
546
546
|
//#endregion
|
|
547
547
|
export { ensureModel as a, downloadFile as i, createFileDataPlaneHandler as n, isModelDownloaded as o, deleteModelFromDisk as r, parseRangeHeader as s, contentTypeFor as t };
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../chunk-emK7D4bc.js");
|
|
6
|
-
const require_dist = require("../dist-
|
|
6
|
+
const require_dist = require("../dist-D8TX_P_A.js");
|
|
7
7
|
const require_node_topology_platform = require("../node-topology-platform-CFZ7F4xW.js");
|
|
8
|
-
const require_addon_utils = require("../addon-utils-
|
|
8
|
+
const require_addon_utils = require("../addon-utils-CQs-AjTJ.js");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
10
|
node_fs = require_chunk.__toESM(node_fs);
|
|
11
11
|
let node_path = require("node:path");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as __require } from "../chunk-DnnnRqeS.mjs";
|
|
2
|
-
import { T as audioAnalyzerCapability, dt as hydrateSchema, et as errMsg, m as HF_BASE_URL, n as AUDIO_BACKEND_CHOICES, o as DEFAULT_AUDIO_ANALYZER_CONFIG, ot as BaseAddon, w as audioAnalysisCapability, z as mapAudioLabelToMacro } from "../dist-
|
|
2
|
+
import { T as audioAnalyzerCapability, dt as hydrateSchema, et as errMsg, m as HF_BASE_URL, n as AUDIO_BACKEND_CHOICES, o as DEFAULT_AUDIO_ANALYZER_CONFIG, ot as BaseAddon, w as audioAnalysisCapability, z as mapAudioLabelToMacro } from "../dist-B55xTTsS.mjs";
|
|
3
3
|
import { t as pickNodePlatformArch } from "../node-topology-platform-BkR_k6WT.mjs";
|
|
4
|
-
import { i as downloadFile } from "../addon-utils-
|
|
4
|
+
import { i as downloadFile } from "../addon-utils-CZ2xo67g.mjs";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
7
7
|
//#region src/audio-analyzer/audio-pipeline.ts
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../chunk-emK7D4bc.js");
|
|
6
|
-
const require_dist = require("../dist-
|
|
7
|
-
const require_event_loop_stall_monitor = require("../event-loop-stall-monitor-
|
|
6
|
+
const require_dist = require("../dist-D8TX_P_A.js");
|
|
7
|
+
const require_event_loop_stall_monitor = require("../event-loop-stall-monitor-Bs6d-u_F.js");
|
|
8
8
|
const require_lazy_sharp = require("../lazy-sharp-CcYuXtsa.js");
|
|
9
9
|
const require_node_topology_platform = require("../node-topology-platform-CFZ7F4xW.js");
|
|
10
|
-
const require_addon_utils = require("../addon-utils-
|
|
10
|
+
const require_addon_utils = require("../addon-utils-CQs-AjTJ.js");
|
|
11
11
|
let sharp = require("sharp");
|
|
12
12
|
sharp = require_chunk.__toESM(sharp);
|
|
13
13
|
let node_child_process = require("node:child_process");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __require } from "../chunk-DnnnRqeS.mjs";
|
|
2
|
-
import { At as union, Dt as object, I as enumerateInferenceDevices, L as evaluateZoneRules, N as detectionPipelineCapability, Q as supportedRuntimes$1, S as YAMNET_TO_MACRO, W as pipelineExecutorCapability, Y as runtimeDevices$1, dt as hydrateSchema, et as errMsg, gt as parseJsonUnknown, ht as nodePin, jt as EventCategory, k as defaultDeviceFor$1, kt as string, ot as BaseAddon, t as APPLE_SA_TO_MACRO, u as DEVICE_BACKEND_TO_FORMAT, ut as createEvent, xt as array, yt as sleep } from "../dist-
|
|
3
|
-
import { a as getDefaultModelForFormat, c as getStepDefinition, i as ALL_STEPS, l as resolveModelForFormat, n as startEventLoopStallMonitor, o as getDefaultModelForFormatFromDef, r as ALL_PIPELINE_STEPS, s as getStep } from "../event-loop-stall-monitor-
|
|
2
|
+
import { At as union, Dt as object, I as enumerateInferenceDevices, L as evaluateZoneRules, N as detectionPipelineCapability, Q as supportedRuntimes$1, S as YAMNET_TO_MACRO, W as pipelineExecutorCapability, Y as runtimeDevices$1, dt as hydrateSchema, et as errMsg, gt as parseJsonUnknown, ht as nodePin, jt as EventCategory, k as defaultDeviceFor$1, kt as string, ot as BaseAddon, t as APPLE_SA_TO_MACRO, u as DEVICE_BACKEND_TO_FORMAT, ut as createEvent, xt as array, yt as sleep } from "../dist-B55xTTsS.mjs";
|
|
3
|
+
import { a as getDefaultModelForFormat, c as getStepDefinition, i as ALL_STEPS, l as resolveModelForFormat, n as startEventLoopStallMonitor, o as getDefaultModelForFormatFromDef, r as ALL_PIPELINE_STEPS, s as getStep } from "../event-loop-stall-monitor-Cq_KOlfb.mjs";
|
|
4
4
|
import { t as getSharp } from "../lazy-sharp-B-mb8uWx.mjs";
|
|
5
5
|
import { t as pickNodePlatformArch } from "../node-topology-platform-BkR_k6WT.mjs";
|
|
6
|
-
import { a as ensureModel, o as isModelDownloaded, r as deleteModelFromDisk } from "../addon-utils-
|
|
6
|
+
import { a as ensureModel, o as isModelDownloaded, r as deleteModelFromDisk } from "../addon-utils-CZ2xo67g.mjs";
|
|
7
7
|
import sharp from "sharp";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
import * as os from "node:os";
|