@camstack/addon-pipeline 1.2.340 → 1.2.342
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 +3 -3
- package/dist/audio-analyzer/index.mjs +3 -3
- package/dist/{custom-model-catalog-BOnN63HU.mjs → custom-model-catalog-BjPZrWX3.mjs} +2 -2
- package/dist/{custom-model-catalog-Cjbll1Sf.js → custom-model-catalog-DPBG06HE.js} +2 -2
- package/dist/detection-pipeline/index.js +9 -123
- package/dist/detection-pipeline/index.mjs +9 -123
- package/dist/{dist-CsA6fY6I.mjs → dist-BWzBHFEB.mjs} +276 -188
- package/dist/{dist-BWigCRRN.js → dist-w_gA9z8W.js} +275 -193
- package/dist/{model-catalogs-D7JXV0_i.mjs → model-catalogs-Dseq1bmN.mjs} +1 -1
- package/dist/{model-catalogs-BFBf8sHb.js → model-catalogs-ll-ggTUb.js} +1 -1
- package/dist/motion-wasm/index.js +1 -1
- package/dist/motion-wasm/index.mjs +1 -1
- package/dist/{node-BZ29vHq2.mjs → node-B7gAWBnv.mjs} +1 -1
- package/dist/{node-D52HHrVZ.js → node-BTsWSPyQ.js} +1 -1
- package/dist/pipeline-runner/index.js +3 -3
- package/dist/pipeline-runner/index.mjs +3 -3
- package/dist/{process-memory-DOEeg2pL.mjs → process-memory-BYs3sxnT.mjs} +1 -1
- package/dist/{process-memory-C9U6dKxS.js → process-memory-Nq3qwp-q.js} +1 -1
- package/dist/recorder/index.js +19 -4
- package/dist/recorder/index.mjs +19 -4
- package/dist/{segment-demux-js-DDgwrz-e.mjs → segment-demux-js-C7Bk1l_R.mjs} +1 -1
- package/dist/{segment-demux-js-CMZSmwMp.js → segment-demux-js-D4kTUDck.js} +1 -1
- package/dist/stream-broker/_stub.js +2 -2
- package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-6JIjr_ur.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-By8a97Br.mjs} +3 -3
- package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B204qFeL.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-Czhfk3hD.mjs +26 -0
- package/dist/stream-broker/demux-worker-child.js +1 -1
- package/dist/stream-broker/demux-worker-child.mjs +1 -1
- package/dist/stream-broker/{hostInit-Ck1wQfKk.mjs → hostInit-BU65uPCY.mjs} +3 -3
- package/dist/stream-broker/index.js +3 -3
- package/dist/stream-broker/index.mjs +3 -3
- package/dist/stream-broker/remoteEntry.js +1 -1
- 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--yC-aoPc.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-B-hhg2sP.mjs +0 -26
|
@@ -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-
|
|
7
|
-
const require_model_catalogs = require("../model-catalogs-
|
|
8
|
-
const require_process_memory = require("../process-memory-
|
|
6
|
+
const require_dist = require("../dist-w_gA9z8W.js");
|
|
7
|
+
const require_model_catalogs = require("../model-catalogs-ll-ggTUb.js");
|
|
8
|
+
const require_process_memory = require("../process-memory-Nq3qwp-q.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 { Dn as errMsg, In as expandAudioChunkToF32le, Ln as hydrateSchema, Mn as audioChunkBytesPerSample, N as PoolMemoryWatchdog, Nt as mapAudioLabelToMacro, Vn as nodePin, X as audioAnalyzerCapability, Y as audioAnalysisCapability, an as resolvePoolMemoryPolicy, h as DEFAULT_AUDIO_ANALYZER_CONFIG,
|
|
3
|
-
import { n as AUDIO_CLASSIFIER_MODELS } from "../model-catalogs-
|
|
4
|
-
import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-
|
|
2
|
+
import { Dn as errMsg, In as expandAudioChunkToF32le, Ln as hydrateSchema, Mn as audioChunkBytesPerSample, N as PoolMemoryWatchdog, Nt as mapAudioLabelToMacro, Vn as nodePin, X as audioAnalyzerCapability, Y as audioAnalysisCapability, an as resolvePoolMemoryPolicy, h as DEFAULT_AUDIO_ANALYZER_CONFIG, kn as BaseAddon, r as AUDIO_BACKEND_CHOICES, rr as EventCategory } from "../dist-BWzBHFEB.mjs";
|
|
3
|
+
import { n as AUDIO_CLASSIFIER_MODELS } from "../model-catalogs-Dseq1bmN.mjs";
|
|
4
|
+
import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-BYs3sxnT.mjs";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
7
7
|
import { ensureModel } from "@camstack/system/addon-utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dt as inferModelProvider, Z as audioKindId, b as DEVICE_BACKEND_TO_FORMAT, f as COCO_80_LABELS, i as AUDIO_MACRO_LABELS, k as LABEL_SUPPLY_VOCABULARIES, p as COCO_TO_MACRO, un as stepModelRunsOnFormat } from "./dist-
|
|
2
|
-
import { a as FACE_DETECTION_MODELS, c as OBJECT_DETECTION_MODELS, d as PLATE_OCR_MODELS, f as SEGMENTATION_REFINER_MODELS, i as CLIP_EMBEDDING_MODELS, l as PACKAGE_DETECTION_MODELS, n as AUDIO_CLASSIFIER_MODELS, o as FACE_EMBEDDING_MODELS, p as VEHICLE_CLASSIFIER_MODELS, r as BIRD_CLASSIFIER_MODELS, s as INSTANCE_SEGMENTATION_MODELS, t as ANIMAL_CLASSIFIER_MODELS, u as PLATE_DETECTION_MODELS } from "./model-catalogs-
|
|
1
|
+
import { Dt as inferModelProvider, Z as audioKindId, b as DEVICE_BACKEND_TO_FORMAT, f as COCO_80_LABELS, i as AUDIO_MACRO_LABELS, k as LABEL_SUPPLY_VOCABULARIES, p as COCO_TO_MACRO, un as stepModelRunsOnFormat } from "./dist-BWzBHFEB.mjs";
|
|
2
|
+
import { a as FACE_DETECTION_MODELS, c as OBJECT_DETECTION_MODELS, d as PLATE_OCR_MODELS, f as SEGMENTATION_REFINER_MODELS, i as CLIP_EMBEDDING_MODELS, l as PACKAGE_DETECTION_MODELS, n as AUDIO_CLASSIFIER_MODELS, o as FACE_EMBEDDING_MODELS, p as VEHICLE_CLASSIFIER_MODELS, r as BIRD_CLASSIFIER_MODELS, s as INSTANCE_SEGMENTATION_MODELS, t as ANIMAL_CLASSIFIER_MODELS, u as PLATE_DETECTION_MODELS } from "./model-catalogs-Dseq1bmN.mjs";
|
|
3
3
|
import { t as isWorkerReply } from "./worker-protocol-D_NzPcnh.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/detection-pipeline/registry/effective-confidence.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
2
|
-
const require_model_catalogs = require("./model-catalogs-
|
|
1
|
+
const require_dist = require("./dist-w_gA9z8W.js");
|
|
2
|
+
const require_model_catalogs = require("./model-catalogs-ll-ggTUb.js");
|
|
3
3
|
const require_worker_protocol = require("./worker-protocol-C-G8qmye.js");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
//#region src/detection-pipeline/registry/effective-confidence.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_node = require("../node-
|
|
8
|
-
const require_custom_model_catalog = require("../custom-model-catalog-
|
|
6
|
+
const require_dist = require("../dist-w_gA9z8W.js");
|
|
7
|
+
const require_node = require("../node-BTsWSPyQ.js");
|
|
8
|
+
const require_custom_model_catalog = require("../custom-model-catalog-DPBG06HE.js");
|
|
9
9
|
const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
|
|
10
|
-
const require_process_memory = require("../process-memory-
|
|
10
|
+
const require_process_memory = require("../process-memory-Nq3qwp-q.js");
|
|
11
11
|
let node_os = require("node:os");
|
|
12
12
|
node_os = require_chunk.__toESM(node_os);
|
|
13
13
|
let node_fs = require("node:fs");
|
|
@@ -348,7 +348,7 @@ function normalizeEngineNodeId(rawNodeId) {
|
|
|
348
348
|
//#endregion
|
|
349
349
|
//#region src/detection-pipeline/model-bound-device-overrides.ts
|
|
350
350
|
/**
|
|
351
|
-
*
|
|
351
|
+
* Auto tune (D745), the executor leg: list — and optionally remove — the
|
|
352
352
|
* MODEL-BOUND thresholds stored in this addon's per-camera settings (the
|
|
353
353
|
* object-detection root's `bindsToModel` keys and their binding keys, D738).
|
|
354
354
|
* Every other key of a camera's store is kept.
|
|
@@ -8024,7 +8024,6 @@ var TIMEOUT_GUARD_SOURCE = {
|
|
|
8024
8024
|
type: "addon",
|
|
8025
8025
|
id: "detection-pipeline"
|
|
8026
8026
|
};
|
|
8027
|
-
var KEY_TEMPLATES = "pipelineTemplates";
|
|
8028
8027
|
function pythonModuleForBackend(backend) {
|
|
8029
8028
|
switch (backend) {
|
|
8030
8029
|
case "coreml": return "coremltools";
|
|
@@ -8088,75 +8087,6 @@ function assembleBatchedFrameResult(raw, frame, modelId, deviceId, inferenceMs,
|
|
|
8088
8087
|
}
|
|
8089
8088
|
};
|
|
8090
8089
|
}
|
|
8091
|
-
/**
|
|
8092
|
-
* Typed stored-config reader — reads a JSON string this provider
|
|
8093
|
-
* itself wrote, performs a runtime shape check against the caller
|
|
8094
|
-
* predicate, and returns the narrowed value or null.
|
|
8095
|
-
*
|
|
8096
|
-
* All persisted shapes in this file are written by the provider, so
|
|
8097
|
-
* the predicates can be minimal (they're primarily a runtime assertion
|
|
8098
|
-
* that the on-disk state hasn't been corrupted).
|
|
8099
|
-
*/
|
|
8100
|
-
function readStored(raw, guard) {
|
|
8101
|
-
if (!raw) return null;
|
|
8102
|
-
try {
|
|
8103
|
-
const parsed = require_dist.parseJsonUnknown(raw);
|
|
8104
|
-
return guard(parsed) ? parsed : null;
|
|
8105
|
-
} catch {
|
|
8106
|
-
return null;
|
|
8107
|
-
}
|
|
8108
|
-
}
|
|
8109
|
-
/**
|
|
8110
|
-
* Phase 7 (settings redesign) template migration.
|
|
8111
|
-
*
|
|
8112
|
-
* Walks every template → step tree and removes the obsolete generic
|
|
8113
|
-
* `confidence` key that existed on `PipelineTemplateStep` pre-Phase-7.
|
|
8114
|
-
* The step's threshold (if any) now lives in its own `configSchema`-
|
|
8115
|
-
* declared `minConfidence` field inside `step.settings`.
|
|
8116
|
-
*
|
|
8117
|
-
* Idempotent: running twice returns `changed: false` on the second
|
|
8118
|
-
* call, because after the first pass no `confidence` property remains.
|
|
8119
|
-
* Returns the cleaned template array + a flag indicating whether at
|
|
8120
|
-
* least one step actually carried the obsolete key, so `listTemplates`
|
|
8121
|
-
* can skip the rewrite when nothing changed.
|
|
8122
|
-
*/
|
|
8123
|
-
function migrateTemplates(templates) {
|
|
8124
|
-
let stripped = 0;
|
|
8125
|
-
function stripStep(step) {
|
|
8126
|
-
const hasLegacyConfidence = "confidence" in step;
|
|
8127
|
-
const cleanedChildren = step.children.map(stripStep);
|
|
8128
|
-
const childrenChanged = cleanedChildren.some((c, i) => c !== step.children[i]);
|
|
8129
|
-
if (!hasLegacyConfidence && !childrenChanged) return step;
|
|
8130
|
-
if (hasLegacyConfidence) stripped++;
|
|
8131
|
-
return {
|
|
8132
|
-
addonId: step.addonId,
|
|
8133
|
-
enabled: step.enabled,
|
|
8134
|
-
modelId: step.modelId,
|
|
8135
|
-
children: cleanedChildren,
|
|
8136
|
-
...step.settings !== void 0 ? { settings: step.settings } : {}
|
|
8137
|
-
};
|
|
8138
|
-
}
|
|
8139
|
-
const nextTemplates = [];
|
|
8140
|
-
let anyChanged = false;
|
|
8141
|
-
for (const t of templates) {
|
|
8142
|
-
const cleanedSteps = t.steps.map(stripStep);
|
|
8143
|
-
if (cleanedSteps.some((s, i) => s !== t.steps[i])) {
|
|
8144
|
-
anyChanged = true;
|
|
8145
|
-
nextTemplates.push({
|
|
8146
|
-
...t,
|
|
8147
|
-
steps: cleanedSteps
|
|
8148
|
-
});
|
|
8149
|
-
} else nextTemplates.push(t);
|
|
8150
|
-
}
|
|
8151
|
-
return {
|
|
8152
|
-
templates: nextTemplates,
|
|
8153
|
-
changed: anyChanged,
|
|
8154
|
-
stripped
|
|
8155
|
-
};
|
|
8156
|
-
}
|
|
8157
|
-
function isTemplateArray(v) {
|
|
8158
|
-
return Array.isArray(v);
|
|
8159
|
-
}
|
|
8160
8090
|
function resolveReferenceAudioDir() {
|
|
8161
8091
|
return [
|
|
8162
8092
|
node_path.resolve(__dirname, "assets/reference-audio"),
|
|
@@ -8554,7 +8484,7 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
8554
8484
|
readDeviceStore;
|
|
8555
8485
|
/** Delete all per-device settings for a device (used by `clearDeviceOverrides`). */
|
|
8556
8486
|
clearDeviceStore;
|
|
8557
|
-
/** Merge a patch into one device's settings (
|
|
8487
|
+
/** Merge a patch into one device's settings (Auto tune' keep-the-rest rewrite, D745). */
|
|
8558
8488
|
writeDeviceStore;
|
|
8559
8489
|
/**
|
|
8560
8490
|
* The per-device overrides the FRAME path reads, kept fresh off that path.
|
|
@@ -10613,50 +10543,6 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
10613
10543
|
node_path.resolve(process.cwd(), "../../../assets/reference-images")
|
|
10614
10544
|
].find((p) => node_fs.existsSync(p)) ?? null;
|
|
10615
10545
|
}
|
|
10616
|
-
async listTemplates() {
|
|
10617
|
-
const raw = (await this.readStore())[KEY_TEMPLATES];
|
|
10618
|
-
const migrated = migrateTemplates(readStored(raw, isTemplateArray) ?? []);
|
|
10619
|
-
if (migrated.changed) {
|
|
10620
|
-
this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(migrated.templates) });
|
|
10621
|
-
this.log.info("Migrated stored template steps — removed obsolete \"confidence\" field", { meta: { stripped: migrated.stripped } });
|
|
10622
|
-
}
|
|
10623
|
-
return migrated.templates;
|
|
10624
|
-
}
|
|
10625
|
-
async saveTemplate(input) {
|
|
10626
|
-
const { name, steps, engine } = input;
|
|
10627
|
-
const templates = await this.listTemplates();
|
|
10628
|
-
const template = {
|
|
10629
|
-
id: `tpl-${Date.now()}`,
|
|
10630
|
-
name,
|
|
10631
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10632
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10633
|
-
engine,
|
|
10634
|
-
steps: [...steps]
|
|
10635
|
-
};
|
|
10636
|
-
templates.push(template);
|
|
10637
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10638
|
-
return template;
|
|
10639
|
-
}
|
|
10640
|
-
async updateTemplate(input) {
|
|
10641
|
-
const { id, ...update } = input;
|
|
10642
|
-
const templates = await this.listTemplates();
|
|
10643
|
-
const idx = templates.findIndex((t) => t.id === id);
|
|
10644
|
-
if (idx === -1) throw new Error(`Template not found: ${id}`);
|
|
10645
|
-
const updated = {
|
|
10646
|
-
...templates[idx],
|
|
10647
|
-
...update.name !== void 0 ? { name: update.name } : {},
|
|
10648
|
-
...update.steps !== void 0 ? { steps: [...update.steps] } : {},
|
|
10649
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10650
|
-
};
|
|
10651
|
-
templates[idx] = updated;
|
|
10652
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10653
|
-
return updated;
|
|
10654
|
-
}
|
|
10655
|
-
async deleteTemplate(input) {
|
|
10656
|
-
const { id } = input;
|
|
10657
|
-
const templates = (await this.listTemplates()).filter((t) => t.id !== id);
|
|
10658
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10659
|
-
}
|
|
10660
10546
|
async getDeviceSettingsContribution(_input) {
|
|
10661
10547
|
return null;
|
|
10662
10548
|
}
|
|
@@ -11155,7 +11041,7 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
11155
11041
|
};
|
|
11156
11042
|
}
|
|
11157
11043
|
/**
|
|
11158
|
-
*
|
|
11044
|
+
* Auto tune (D745): list — or, unless `dryRun`, remove — the model-bound
|
|
11159
11045
|
* thresholds of the per-camera detector store. See
|
|
11160
11046
|
* `model-bound-device-overrides.ts`.
|
|
11161
11047
|
*/
|
|
@@ -11172,14 +11058,14 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
11172
11058
|
invalidate: (deviceId) => this.deviceOverrides.invalidate(deviceId),
|
|
11173
11059
|
boundKeys: require_dist.collectModelBoundKeys(require_custom_model_catalog.getStep("object-detection").getConfigSchema())
|
|
11174
11060
|
}, input);
|
|
11175
|
-
if (!input.dryRun) for (const entry of result.entries) this.log.info("
|
|
11061
|
+
if (!input.dryRun) for (const entry of result.entries) this.log.info("auto tune: per-camera detector thresholds cleared", {
|
|
11176
11062
|
tags: { deviceId: entry.deviceId },
|
|
11177
11063
|
meta: {
|
|
11178
11064
|
deviceId: entry.deviceId,
|
|
11179
11065
|
keys: entry.keys
|
|
11180
11066
|
}
|
|
11181
11067
|
});
|
|
11182
|
-
for (const r of result.refused) this.log.warn("
|
|
11068
|
+
for (const r of result.refused) this.log.warn("auto tune: per-camera detector thresholds not cleared", {
|
|
11183
11069
|
tags: { deviceId: r.deviceId },
|
|
11184
11070
|
meta: {
|
|
11185
11071
|
deviceId: r.deviceId,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __require } from "../chunk-DnnnRqeS.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { s as readProcessCost } from "../node-
|
|
4
|
-
import { C as resolveModelDefaultConfidence, S as landmarkPrecisionVerdict, _ as ALL_STEPS, b as getStepDefinition, f as localFrameRegistry, g as ALL_PIPELINE_STEPS, l as resolveDefaultDetectionModel, n as mergeCustomModels, o as deviceKeyOf, r as buildSubtreeCanRun, s as resolveDeviceEngine, t as CustomModelCatalog, u as macroGateVerdict, v as getDefaultModelForFormat, x as resolveModelForFormat, y as getStep } from "../custom-model-catalog-
|
|
2
|
+
import { Bt as modelBindingKey, Dn as errMsg$1, Et as hfModelUrl, G as YAMNET_TO_MACRO, Ht as overlayClusterStepSettings, J as applyModelBoundSettings, Kn as array, Ln as hydrateSchema, N as PoolMemoryWatchdog, Nn as createEvent, O as LABEL_SUPPLY_MACRO, Qn as object, Vn as nodePin, Wn as sleep, Wt as pickClusterStepSettings, _t as evaluateZoneRules, an as resolvePoolMemoryPolicy, cn as rootSuppliesOf, ct as defaultDeviceFor$1, d as CLUSTER_MODEL_SCOPED_STEPS, en as resolveClusterStepModelId, g as DEFAULT_CLUSTER_STEP_SETTINGS, gt as enumerateInferenceDevices, hn as supportedRuntimes$1, it as containingParentIndex, jt as loadContributionCapability, kn as BaseAddon, kt as linkedLabelStepId, ln as runtimeDevices$1, n as APPLE_SA_TO_MACRO, nr as union, pt as detectionPipelineCapability, qt as pipelineExecutorCapability, rr as EventCategory, rt as collectModelBoundKeys, tr as string, un as stepModelRunsOnFormat } from "../dist-BWzBHFEB.mjs";
|
|
3
|
+
import { s as readProcessCost } from "../node-B7gAWBnv.mjs";
|
|
4
|
+
import { C as resolveModelDefaultConfidence, S as landmarkPrecisionVerdict, _ as ALL_STEPS, b as getStepDefinition, f as localFrameRegistry, g as ALL_PIPELINE_STEPS, l as resolveDefaultDetectionModel, n as mergeCustomModels, o as deviceKeyOf, r as buildSubtreeCanRun, s as resolveDeviceEngine, t as CustomModelCatalog, u as macroGateVerdict, v as getDefaultModelForFormat, x as resolveModelForFormat, y as getStep } from "../custom-model-catalog-BjPZrWX3.mjs";
|
|
5
5
|
import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
|
|
6
|
-
import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-
|
|
6
|
+
import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-BYs3sxnT.mjs";
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import * as path$1 from "node:path";
|
|
@@ -341,7 +341,7 @@ function normalizeEngineNodeId(rawNodeId) {
|
|
|
341
341
|
//#endregion
|
|
342
342
|
//#region src/detection-pipeline/model-bound-device-overrides.ts
|
|
343
343
|
/**
|
|
344
|
-
*
|
|
344
|
+
* Auto tune (D745), the executor leg: list — and optionally remove — the
|
|
345
345
|
* MODEL-BOUND thresholds stored in this addon's per-camera settings (the
|
|
346
346
|
* object-detection root's `bindsToModel` keys and their binding keys, D738).
|
|
347
347
|
* Every other key of a camera's store is kept.
|
|
@@ -8017,7 +8017,6 @@ var TIMEOUT_GUARD_SOURCE = {
|
|
|
8017
8017
|
type: "addon",
|
|
8018
8018
|
id: "detection-pipeline"
|
|
8019
8019
|
};
|
|
8020
|
-
var KEY_TEMPLATES = "pipelineTemplates";
|
|
8021
8020
|
function pythonModuleForBackend(backend) {
|
|
8022
8021
|
switch (backend) {
|
|
8023
8022
|
case "coreml": return "coremltools";
|
|
@@ -8081,75 +8080,6 @@ function assembleBatchedFrameResult(raw, frame, modelId, deviceId, inferenceMs,
|
|
|
8081
8080
|
}
|
|
8082
8081
|
};
|
|
8083
8082
|
}
|
|
8084
|
-
/**
|
|
8085
|
-
* Typed stored-config reader — reads a JSON string this provider
|
|
8086
|
-
* itself wrote, performs a runtime shape check against the caller
|
|
8087
|
-
* predicate, and returns the narrowed value or null.
|
|
8088
|
-
*
|
|
8089
|
-
* All persisted shapes in this file are written by the provider, so
|
|
8090
|
-
* the predicates can be minimal (they're primarily a runtime assertion
|
|
8091
|
-
* that the on-disk state hasn't been corrupted).
|
|
8092
|
-
*/
|
|
8093
|
-
function readStored(raw, guard) {
|
|
8094
|
-
if (!raw) return null;
|
|
8095
|
-
try {
|
|
8096
|
-
const parsed = parseJsonUnknown(raw);
|
|
8097
|
-
return guard(parsed) ? parsed : null;
|
|
8098
|
-
} catch {
|
|
8099
|
-
return null;
|
|
8100
|
-
}
|
|
8101
|
-
}
|
|
8102
|
-
/**
|
|
8103
|
-
* Phase 7 (settings redesign) template migration.
|
|
8104
|
-
*
|
|
8105
|
-
* Walks every template → step tree and removes the obsolete generic
|
|
8106
|
-
* `confidence` key that existed on `PipelineTemplateStep` pre-Phase-7.
|
|
8107
|
-
* The step's threshold (if any) now lives in its own `configSchema`-
|
|
8108
|
-
* declared `minConfidence` field inside `step.settings`.
|
|
8109
|
-
*
|
|
8110
|
-
* Idempotent: running twice returns `changed: false` on the second
|
|
8111
|
-
* call, because after the first pass no `confidence` property remains.
|
|
8112
|
-
* Returns the cleaned template array + a flag indicating whether at
|
|
8113
|
-
* least one step actually carried the obsolete key, so `listTemplates`
|
|
8114
|
-
* can skip the rewrite when nothing changed.
|
|
8115
|
-
*/
|
|
8116
|
-
function migrateTemplates(templates) {
|
|
8117
|
-
let stripped = 0;
|
|
8118
|
-
function stripStep(step) {
|
|
8119
|
-
const hasLegacyConfidence = "confidence" in step;
|
|
8120
|
-
const cleanedChildren = step.children.map(stripStep);
|
|
8121
|
-
const childrenChanged = cleanedChildren.some((c, i) => c !== step.children[i]);
|
|
8122
|
-
if (!hasLegacyConfidence && !childrenChanged) return step;
|
|
8123
|
-
if (hasLegacyConfidence) stripped++;
|
|
8124
|
-
return {
|
|
8125
|
-
addonId: step.addonId,
|
|
8126
|
-
enabled: step.enabled,
|
|
8127
|
-
modelId: step.modelId,
|
|
8128
|
-
children: cleanedChildren,
|
|
8129
|
-
...step.settings !== void 0 ? { settings: step.settings } : {}
|
|
8130
|
-
};
|
|
8131
|
-
}
|
|
8132
|
-
const nextTemplates = [];
|
|
8133
|
-
let anyChanged = false;
|
|
8134
|
-
for (const t of templates) {
|
|
8135
|
-
const cleanedSteps = t.steps.map(stripStep);
|
|
8136
|
-
if (cleanedSteps.some((s, i) => s !== t.steps[i])) {
|
|
8137
|
-
anyChanged = true;
|
|
8138
|
-
nextTemplates.push({
|
|
8139
|
-
...t,
|
|
8140
|
-
steps: cleanedSteps
|
|
8141
|
-
});
|
|
8142
|
-
} else nextTemplates.push(t);
|
|
8143
|
-
}
|
|
8144
|
-
return {
|
|
8145
|
-
templates: nextTemplates,
|
|
8146
|
-
changed: anyChanged,
|
|
8147
|
-
stripped
|
|
8148
|
-
};
|
|
8149
|
-
}
|
|
8150
|
-
function isTemplateArray(v) {
|
|
8151
|
-
return Array.isArray(v);
|
|
8152
|
-
}
|
|
8153
8083
|
function resolveReferenceAudioDir() {
|
|
8154
8084
|
return [
|
|
8155
8085
|
path$1.resolve(__dirname, "assets/reference-audio"),
|
|
@@ -8547,7 +8477,7 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
8547
8477
|
readDeviceStore;
|
|
8548
8478
|
/** Delete all per-device settings for a device (used by `clearDeviceOverrides`). */
|
|
8549
8479
|
clearDeviceStore;
|
|
8550
|
-
/** Merge a patch into one device's settings (
|
|
8480
|
+
/** Merge a patch into one device's settings (Auto tune' keep-the-rest rewrite, D745). */
|
|
8551
8481
|
writeDeviceStore;
|
|
8552
8482
|
/**
|
|
8553
8483
|
* The per-device overrides the FRAME path reads, kept fresh off that path.
|
|
@@ -10606,50 +10536,6 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
10606
10536
|
path$1.resolve(process.cwd(), "../../../assets/reference-images")
|
|
10607
10537
|
].find((p) => fs.existsSync(p)) ?? null;
|
|
10608
10538
|
}
|
|
10609
|
-
async listTemplates() {
|
|
10610
|
-
const raw = (await this.readStore())[KEY_TEMPLATES];
|
|
10611
|
-
const migrated = migrateTemplates(readStored(raw, isTemplateArray) ?? []);
|
|
10612
|
-
if (migrated.changed) {
|
|
10613
|
-
this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(migrated.templates) });
|
|
10614
|
-
this.log.info("Migrated stored template steps — removed obsolete \"confidence\" field", { meta: { stripped: migrated.stripped } });
|
|
10615
|
-
}
|
|
10616
|
-
return migrated.templates;
|
|
10617
|
-
}
|
|
10618
|
-
async saveTemplate(input) {
|
|
10619
|
-
const { name, steps, engine } = input;
|
|
10620
|
-
const templates = await this.listTemplates();
|
|
10621
|
-
const template = {
|
|
10622
|
-
id: `tpl-${Date.now()}`,
|
|
10623
|
-
name,
|
|
10624
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10625
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10626
|
-
engine,
|
|
10627
|
-
steps: [...steps]
|
|
10628
|
-
};
|
|
10629
|
-
templates.push(template);
|
|
10630
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10631
|
-
return template;
|
|
10632
|
-
}
|
|
10633
|
-
async updateTemplate(input) {
|
|
10634
|
-
const { id, ...update } = input;
|
|
10635
|
-
const templates = await this.listTemplates();
|
|
10636
|
-
const idx = templates.findIndex((t) => t.id === id);
|
|
10637
|
-
if (idx === -1) throw new Error(`Template not found: ${id}`);
|
|
10638
|
-
const updated = {
|
|
10639
|
-
...templates[idx],
|
|
10640
|
-
...update.name !== void 0 ? { name: update.name } : {},
|
|
10641
|
-
...update.steps !== void 0 ? { steps: [...update.steps] } : {},
|
|
10642
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10643
|
-
};
|
|
10644
|
-
templates[idx] = updated;
|
|
10645
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10646
|
-
return updated;
|
|
10647
|
-
}
|
|
10648
|
-
async deleteTemplate(input) {
|
|
10649
|
-
const { id } = input;
|
|
10650
|
-
const templates = (await this.listTemplates()).filter((t) => t.id !== id);
|
|
10651
|
-
await this.writeStore({ [KEY_TEMPLATES]: JSON.stringify(templates) });
|
|
10652
|
-
}
|
|
10653
10539
|
async getDeviceSettingsContribution(_input) {
|
|
10654
10540
|
return null;
|
|
10655
10541
|
}
|
|
@@ -11148,7 +11034,7 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
11148
11034
|
};
|
|
11149
11035
|
}
|
|
11150
11036
|
/**
|
|
11151
|
-
*
|
|
11037
|
+
* Auto tune (D745): list — or, unless `dryRun`, remove — the model-bound
|
|
11152
11038
|
* thresholds of the per-camera detector store. See
|
|
11153
11039
|
* `model-bound-device-overrides.ts`.
|
|
11154
11040
|
*/
|
|
@@ -11165,14 +11051,14 @@ var DetectionPipelineProvider = class DetectionPipelineProvider {
|
|
|
11165
11051
|
invalidate: (deviceId) => this.deviceOverrides.invalidate(deviceId),
|
|
11166
11052
|
boundKeys: collectModelBoundKeys(getStep("object-detection").getConfigSchema())
|
|
11167
11053
|
}, input);
|
|
11168
|
-
if (!input.dryRun) for (const entry of result.entries) this.log.info("
|
|
11054
|
+
if (!input.dryRun) for (const entry of result.entries) this.log.info("auto tune: per-camera detector thresholds cleared", {
|
|
11169
11055
|
tags: { deviceId: entry.deviceId },
|
|
11170
11056
|
meta: {
|
|
11171
11057
|
deviceId: entry.deviceId,
|
|
11172
11058
|
keys: entry.keys
|
|
11173
11059
|
}
|
|
11174
11060
|
});
|
|
11175
|
-
for (const r of result.refused) this.log.warn("
|
|
11061
|
+
for (const r of result.refused) this.log.warn("auto tune: per-camera detector thresholds not cleared", {
|
|
11176
11062
|
tags: { deviceId: r.deviceId },
|
|
11177
11063
|
meta: {
|
|
11178
11064
|
deviceId: r.deviceId,
|