@camstack/addon-pipeline 1.2.341 → 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-DNSmyZTT.mjs → custom-model-catalog-BjPZrWX3.mjs} +2 -2
- package/dist/{custom-model-catalog-CoJEC8nz.js → custom-model-catalog-DPBG06HE.js} +2 -2
- package/dist/detection-pipeline/index.js +4 -118
- package/dist/detection-pipeline/index.mjs +4 -118
- package/dist/{dist-B8oPeJDI.mjs → dist-BWzBHFEB.mjs} +225 -308
- package/dist/{dist-PiNPe8uQ.js → dist-w_gA9z8W.js} +224 -313
- package/dist/{model-catalogs-RM3pkuZm.mjs → model-catalogs-Dseq1bmN.mjs} +1 -1
- package/dist/{model-catalogs-CEphd9Va.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-DFUmMJ_f.mjs → node-B7gAWBnv.mjs} +1 -1
- package/dist/{node-CMTBIa3-.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-C4v8DBKn.mjs → process-memory-BYs3sxnT.mjs} +1 -1
- package/dist/{process-memory-CzAfDP9P.js → process-memory-Nq3qwp-q.js} +1 -1
- package/dist/recorder/index.js +14 -5
- package/dist/recorder/index.mjs +14 -5
- package/dist/{segment-demux-js-CIpCdbx4.mjs → segment-demux-js-C7Bk1l_R.mjs} +1 -1
- package/dist/{segment-demux-js-C-n_ZsMK.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-CIDS0Tr9.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-CW_cmeNQ.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-BvfT5BVP.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-LU_e-xJm.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");
|
|
@@ -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"),
|
|
@@ -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
|
}
|
|
@@ -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";
|
|
@@ -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"),
|
|
@@ -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
|
}
|