@camstack/addon-pipeline 1.2.219 → 1.2.221

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 (40) hide show
  1. package/dist/audio-analyzer/index.js +661 -7
  2. package/dist/audio-analyzer/index.mjs +658 -5
  3. package/dist/chunk-emK7D4bc.js +35 -0
  4. package/dist/{default-detection-model-d7-Q_LMo.js → default-detection-model-B1NT1A38.js} +1 -1
  5. package/dist/{default-detection-model-Dsk1a5pY.mjs → default-detection-model-DkVFgubU.mjs} +1 -1
  6. package/dist/detection-pipeline/index.js +10 -9
  7. package/dist/detection-pipeline/index.mjs +4 -4
  8. package/dist/{dist-wtNhtVVo.js → dist-ATDfcxgL.js} +282 -39
  9. package/dist/{dist-CKK0CBUW.mjs → dist-CEFC3PkP.mjs} +265 -5
  10. package/dist/{lazy-sharp-zoQ07I43.js → lazy-sharp-BuwKlQLR.js} +2 -2
  11. package/dist/motion-wasm/index.js +2 -2
  12. package/dist/motion-wasm/index.mjs +1 -1
  13. package/dist/{node-BduNi21Z.js → node-C5jnTgpv.js} +4 -3
  14. package/dist/{node-CrNBWFbA.mjs → node-DR3fHqUq.mjs} +1 -1
  15. package/dist/pipeline-runner/index.js +222 -157
  16. package/dist/pipeline-runner/index.mjs +218 -154
  17. package/dist/{process-memory-Dwl0MFPH.js → process-memory-DQbCPnMA.js} +3 -2
  18. package/dist/{process-memory-BRQOtDN1.mjs → process-memory-DqYj5IAb.mjs} +1 -1
  19. package/dist/recorder/index.js +344 -127
  20. package/dist/recorder/index.mjs +342 -126
  21. package/dist/{segment-demux-js-D2o9ShNL.mjs → segment-demux-js-CddDwD69.mjs} +1 -1
  22. package/dist/{segment-demux-js-CFOU3biG.js → segment-demux-js-o9KBAz9p.js} +4 -3
  23. package/dist/session-decode/decode-worker-child.js +155 -74
  24. package/dist/session-decode/decode-worker-child.mjs +154 -73
  25. package/dist/stream-broker/_stub.js +2 -2
  26. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-DN_IoShh.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-D5XnLZWR.mjs} +3 -3
  27. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CyMYDKfM.mjs +26 -0
  28. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DICVQkNi.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CKUGpDns.mjs} +1 -1
  29. package/dist/stream-broker/demux-worker-child.js +1 -1
  30. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  31. package/dist/stream-broker/{hostInit-n7c9pNlt.mjs → hostInit-C-VdcJS2.mjs} +3 -3
  32. package/dist/stream-broker/index.js +231 -112
  33. package/dist/stream-broker/index.mjs +224 -106
  34. package/dist/stream-broker/remoteEntry.js +1 -1
  35. package/dist/worker-protocol-B2MfQLlu.js +184 -0
  36. package/dist/worker-protocol-C_W-P_g-.mjs +161 -0
  37. package/package.json +1 -1
  38. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-7hqrrd88.mjs +0 -26
  39. package/dist/worker-protocol-Cx3Nqreq.mjs +0 -264
  40. package/dist/worker-protocol-iWTFnnUM.js +0 -299
@@ -1,299 +0,0 @@
1
- const require_dist = require("./dist-wtNhtVVo.js");
2
- //#region src/session-decode/native-lease-config.ts
3
- /**
4
- * Resolution of the native-frame hold / tile knobs for one decode worker.
5
- *
6
- * ## Where the values come from
7
- *
8
- * The knobs are cluster-wide `pipeline-orchestrator` settings
9
- * (`@camstack/types` → `pipeline/native-lease.ts`). The pipeline-runner reads
10
- * them over the hub-routed `addon-settings` cap
11
- * (`pipeline-runner/native-lease-settings-source.ts`) and injects the ones the
12
- * operator actually SET into the child's environment at `fork` time
13
- * ({@link nativeLeaseSettingEnv}, consumed by `fork-decode-worker.ts`). The
14
- * child resolves them at module load ({@link resolveNativeLeaseKnobs}).
15
- *
16
- * Env-on-fork rather than an init message on purpose: the hold store, the tile
17
- * store and the demand gate are constructed with the worker, before the first
18
- * `start` message arrives, and a knob that can change after construction is a
19
- * knob that has two values during a session.
20
- *
21
- * ## Precedence — setting > env > default
22
- *
23
- * 1. **setting** — the operator set the knob in the orchestrator's global
24
- * settings. Wins, because a value someone deliberately chose in the UI must
25
- * not be silently overruled by a shell variable nobody can see from there.
26
- * 2. **env** — {@link NATIVE_LEASE_ENV_VARS}, the pre-settings mechanism, kept
27
- * as an emergency / dev override. It applies only while the corresponding
28
- * setting is UNSET. "Unset" includes a knob sitting AT its shipped default:
29
- * `addon-settings.getGlobalSettings` hydrates an unstored field with the
30
- * schema default and offers no way to tell the two apart, so treating the
31
- * default as a choice would have retired every env var on the day this
32
- * shipped. Move the slider off the default and the setting takes over; move
33
- * it back and the env var returns. See `readNativeLeaseOverride`.
34
- * 3. **default** — {@link DEFAULT_NATIVE_LEASE_SETTINGS}, byte-for-byte the
35
- * constants the worker shipped with.
36
- *
37
- * A value that fails its bounds at ANY level falls through to the next one
38
- * rather than being clamped: clamping turns a typo into a number nobody chose,
39
- * and this one governs how much RAM a busy camera holds.
40
- *
41
- * The GPU surface ring (`CAMSTACK_SESSION_NATIVE_CROP_RING`) is deliberately
42
- * NOT here — see its docblock in `decode-worker-child.ts` for why it stays
43
- * env-only.
44
- */
45
- /** Every knob, in the order the spawn line names them. */
46
- var NATIVE_LEASE_KNOBS = [
47
- "holdFrames",
48
- "budgetMb",
49
- "activityMs",
50
- "admission",
51
- "tileBudgetMb",
52
- "sceneBudgetMb"
53
- ];
54
- /** Emergency / dev override env vars (pre-settings; lowest precedence but the default). */
55
- var NATIVE_LEASE_ENV_VARS = {
56
- holdFrames: "CAMSTACK_SESSION_NATIVE_LEASE_HOLD_FRAMES",
57
- budgetMb: "CAMSTACK_SESSION_NATIVE_LEASE_BUDGET_MB",
58
- activityMs: "CAMSTACK_SESSION_NATIVE_LEASE_ACTIVITY_MS",
59
- admission: "CAMSTACK_SESSION_NATIVE_LEASE_ADMISSION",
60
- tileBudgetMb: "CAMSTACK_SESSION_NATIVE_TILE_BUDGET_MB",
61
- sceneBudgetMb: "CAMSTACK_SESSION_NATIVE_SCENE_BUDGET_MB"
62
- };
63
- /**
64
- * Env vars the PARENT writes at fork time to carry an operator setting into the
65
- * child. Distinct names from {@link NATIVE_LEASE_ENV_VARS} so the child can tell
66
- * "the operator chose this" from "a shell variable set this" and log the source
67
- * honestly — with one shared name that distinction is unrecoverable.
68
- */
69
- var NATIVE_LEASE_SETTING_ENV_VARS = {
70
- holdFrames: "CAMSTACK_SESSION_NATIVE_LEASE_HOLD_FRAMES_SETTING",
71
- budgetMb: "CAMSTACK_SESSION_NATIVE_LEASE_BUDGET_MB_SETTING",
72
- activityMs: "CAMSTACK_SESSION_NATIVE_LEASE_ACTIVITY_MS_SETTING",
73
- admission: "CAMSTACK_SESSION_NATIVE_LEASE_ADMISSION_SETTING",
74
- tileBudgetMb: "CAMSTACK_SESSION_NATIVE_TILE_BUDGET_MB_SETTING",
75
- sceneBudgetMb: "CAMSTACK_SESSION_NATIVE_SCENE_BUDGET_MB_SETTING"
76
- };
77
- /**
78
- * Parse one env value through the knob's own Zod bound. Returns `null` for
79
- * absent, non-numeric, or out-of-bounds input — the caller then falls through
80
- * to the next precedence level.
81
- */
82
- function parseKnob(knob, raw) {
83
- if (raw === void 0 || raw.trim() === "") return null;
84
- const parsed = require_dist.NativeLeaseSettingsSchema.shape[knob].safeParse(Number(raw));
85
- return parsed.success ? parsed.data : null;
86
- }
87
- /** {@link parseKnob} for the one knob whose value is a word, not a number. */
88
- function parseAdmission(raw) {
89
- if (raw === void 0) return null;
90
- const parsed = require_dist.NativeLeaseAdmissionSchema.safeParse(raw.trim());
91
- return parsed.success ? parsed.data : null;
92
- }
93
- /** Resolve one NUMERIC knob across the three precedence levels. */
94
- function resolveKnob(knob, env) {
95
- const fromSetting = parseKnob(knob, env[NATIVE_LEASE_SETTING_ENV_VARS[knob]]);
96
- if (fromSetting !== null) return {
97
- value: fromSetting,
98
- source: "setting"
99
- };
100
- const fromEnv = parseKnob(knob, env[NATIVE_LEASE_ENV_VARS[knob]]);
101
- if (fromEnv !== null) return {
102
- value: fromEnv,
103
- source: "env"
104
- };
105
- return {
106
- value: require_dist.DEFAULT_NATIVE_LEASE_SETTINGS[knob],
107
- source: "default"
108
- };
109
- }
110
- /** {@link resolveKnob} for `admission`. Same precedence, different parser. */
111
- function resolveAdmission(env) {
112
- const fromSetting = parseAdmission(env[NATIVE_LEASE_SETTING_ENV_VARS.admission]);
113
- if (fromSetting !== null) return {
114
- value: fromSetting,
115
- source: "setting"
116
- };
117
- const fromEnv = parseAdmission(env[NATIVE_LEASE_ENV_VARS.admission]);
118
- if (fromEnv !== null) return {
119
- value: fromEnv,
120
- source: "env"
121
- };
122
- return {
123
- value: require_dist.DEFAULT_NATIVE_LEASE_SETTINGS.admission,
124
- source: "default"
125
- };
126
- }
127
- /** Resolve every lease knob from an environment. Pure. */
128
- function resolveNativeLeaseKnobs(env) {
129
- const holdFrames = resolveKnob("holdFrames", env);
130
- const budgetMb = resolveKnob("budgetMb", env);
131
- const activityMs = resolveKnob("activityMs", env);
132
- const admission = resolveAdmission(env);
133
- const tileBudgetMb = resolveKnob("tileBudgetMb", env);
134
- const sceneBudgetMb = resolveKnob("sceneBudgetMb", env);
135
- return {
136
- values: {
137
- holdFrames: holdFrames.value,
138
- budgetMb: budgetMb.value,
139
- activityMs: activityMs.value,
140
- admission: admission.value,
141
- tileBudgetMb: tileBudgetMb.value,
142
- sceneBudgetMb: sceneBudgetMb.value
143
- },
144
- sources: {
145
- holdFrames: holdFrames.source,
146
- budgetMb: budgetMb.source,
147
- activityMs: activityMs.source,
148
- admission: admission.source,
149
- tileBudgetMb: tileBudgetMb.source,
150
- sceneBudgetMb: sceneBudgetMb.source
151
- }
152
- };
153
- }
154
- /**
155
- * The env fragment the parent merges into a decode worker's `fork` environment.
156
- * Emits ONLY the knobs the operator actually set — an empty result leaves the
157
- * env override fully functional, which is the whole point of the distinction.
158
- */
159
- function nativeLeaseSettingEnv(override) {
160
- const out = {};
161
- for (const knob of NATIVE_LEASE_KNOBS) {
162
- const value = override[knob];
163
- if (value !== void 0) out[NATIVE_LEASE_SETTING_ENV_VARS[knob]] = String(value);
164
- }
165
- return out;
166
- }
167
- /**
168
- * The one-line spawn diagnostic. Names the effective value AND its source for
169
- * every knob: without the source, a log saying `holdFrames=8` cannot distinguish
170
- * "the operator's setting arrived" from "someone left a shell variable set", and
171
- * a setting that silently fails to arrive is exactly the failure the distinct
172
- * env-var names exist to make visible.
173
- */
174
- function formatNativeLeaseKnobs(resolved) {
175
- const part = (knob) => `${knob}=${resolved.values[knob]} source=${resolved.sources[knob]}`;
176
- return `native lease knobs — ${NATIVE_LEASE_KNOBS.map(part).join("; ")}`;
177
- }
178
- //#endregion
179
- //#region src/session-decode/worker-protocol.ts
180
- /**
181
- * Classify a worker diagnostic line into a {@link WorkerLogLevel}. Failure /
182
- * fault lines surface at `warn` (visible at the default log level so a
183
- * native-crop failure is finally seen in `addons.getLogs`); routine
184
- * provenance / transition / lifecycle lines stay `debug`. Pure + exported so
185
- * the mapping is unit-testable without spawning a worker.
186
- */
187
- function logLevelForLine(line) {
188
- return /\b(fail(?:ed|ure)?|error|exception|unhandled rejection|corrupt|EIO|EINVAL)\b/i.test(line) ? "warn" : "debug";
189
- }
190
- function isRecord(value) {
191
- return typeof value === "object" && value !== null;
192
- }
193
- function isFiniteNumber(value) {
194
- return typeof value === "number" && Number.isFinite(value);
195
- }
196
- function isWorkerFrameFormat(value) {
197
- return value === "rgb" || value === "gray";
198
- }
199
- function isWorkerBufferFormat(value) {
200
- return isWorkerFrameFormat(value) || value === "jpeg";
201
- }
202
- function isWorkerLogLevel(value) {
203
- return value === "debug" || value === "info" || value === "warn" || value === "error";
204
- }
205
- function isWorkerCropRegion(value) {
206
- return isRecord(value) && isFiniteNumber(value.left) && isFiniteNumber(value.top) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
207
- }
208
- function isWorkerResizeTarget(value) {
209
- return isRecord(value) && isFiniteNumber(value.width) && isFiniteNumber(value.height);
210
- }
211
- function isFrameImageOptions(value) {
212
- if (!isRecord(value)) return false;
213
- if (value.crop !== void 0 && !isWorkerCropRegion(value.crop)) return false;
214
- if (value.resize !== void 0 && !isWorkerResizeTarget(value.resize)) return false;
215
- if (value.format !== void 0 && !isWorkerBufferFormat(value.format)) return false;
216
- return true;
217
- }
218
- function isNormalizedBbox(value) {
219
- return isRecord(value) && isFiniteNumber(value.x) && isFiniteNumber(value.y) && isFiniteNumber(value.w) && isFiniteNumber(value.h);
220
- }
221
- function isVideoFrameSource(value) {
222
- return isRecord(value) && typeof value.restreamUrl === "string" && isFiniteNumber(value.deviceId) && typeof value.codec === "string";
223
- }
224
- function isVideoFrameGenOptions(value) {
225
- if (!isRecord(value)) return false;
226
- if (value.fps !== void 0 && !isFiniteNumber(value.fps)) return false;
227
- if (value.format !== void 0 && !isWorkerFrameFormat(value.format)) return false;
228
- if (value.preRollMs !== void 0 && !isFiniteNumber(value.preRollMs)) return false;
229
- if (value.preRollMaxFrames !== void 0 && !isFiniteNumber(value.preRollMaxFrames)) return false;
230
- return true;
231
- }
232
- /** Discriminated-union guard for {@link WorkerRequest} — no `as` casts. */
233
- function isWorkerRequest(value) {
234
- if (!isRecord(value)) return false;
235
- switch (value.kind) {
236
- case "start": return isVideoFrameSource(value.source) && isVideoFrameGenOptions(value.opts);
237
- case "pull": return true;
238
- case "toBuffer": return isFiniteNumber(value.frameId) && (value.opts === void 0 || isFrameImageOptions(value.opts));
239
- case "nativeCrop": return isFiniteNumber(value.requestId) && isFiniteNumber(value.frameId) && isNormalizedBbox(value.bbox) && (value.maxWidth === void 0 || isFiniteNumber(value.maxWidth));
240
- case "cutTiles": return isFiniteNumber(value.frameId) && Array.isArray(value.bboxes) && value.bboxes.every(isNormalizedBbox);
241
- case "releaseNativeLease":
242
- case "markInferred": return isFiniteNumber(value.frameId);
243
- case "stop": return true;
244
- default: return false;
245
- }
246
- }
247
- /** Discriminated-union guard for {@link WorkerReply} — no `as` casts. */
248
- function isWorkerReply(value) {
249
- if (!isRecord(value)) return false;
250
- switch (value.kind) {
251
- case "frame": return isFiniteNumber(value.frameId) && isFiniteNumber(value.timestamp) && isFiniteNumber(value.width) && isFiniteNumber(value.height) && isWorkerFrameFormat(value.format) && (value.capturedAt === void 0 || isFiniteNumber(value.capturedAt)) && (value.preRoll === void 0 || typeof value.preRoll === "boolean");
252
- case "buffer": return isFiniteNumber(value.frameId) && value.bytes instanceof Uint8Array;
253
- case "nativeCropResult": return isFiniteNumber(value.requestId) && value.bytes instanceof Uint8Array && isFiniteNumber(value.width) && isFiniteNumber(value.height) && (value.source === void 0 || value.source === "lease" || value.source === "tile");
254
- case "nativeCropMiss": return isFiniteNumber(value.requestId) && (value.reason === void 0 || typeof value.reason === "string");
255
- case "ended": return true;
256
- case "error": return typeof value.message === "string" && (value.frameId === void 0 || isFiniteNumber(value.frameId));
257
- case "log": return isWorkerLogLevel(value.level) && typeof value.message === "string";
258
- case "preRollReport": return isFiniteNumber(value.offered) && isFiniteNumber(value.inferred) && isFiniteNumber(value.dropped) && isRecord(value.droppedByReason) && isFiniteNumber(value.strideMs) && typeof value.subsampled === "boolean" && isFiniteNumber(value.spanMs);
259
- case "dialTiming": return isFiniteNumber(value.hwContextMs) && isFiniteNumber(value.demuxerOpenMs) && isFiniteNumber(value.decoderCreateMs) && isFiniteNumber(value.firstDecodeMs) && typeof value.streamInfoProbed === "boolean";
260
- default: return false;
261
- }
262
- }
263
- //#endregion
264
- Object.defineProperty(exports, "formatNativeLeaseKnobs", {
265
- enumerable: true,
266
- get: function() {
267
- return formatNativeLeaseKnobs;
268
- }
269
- });
270
- Object.defineProperty(exports, "isWorkerReply", {
271
- enumerable: true,
272
- get: function() {
273
- return isWorkerReply;
274
- }
275
- });
276
- Object.defineProperty(exports, "isWorkerRequest", {
277
- enumerable: true,
278
- get: function() {
279
- return isWorkerRequest;
280
- }
281
- });
282
- Object.defineProperty(exports, "logLevelForLine", {
283
- enumerable: true,
284
- get: function() {
285
- return logLevelForLine;
286
- }
287
- });
288
- Object.defineProperty(exports, "nativeLeaseSettingEnv", {
289
- enumerable: true,
290
- get: function() {
291
- return nativeLeaseSettingEnv;
292
- }
293
- });
294
- Object.defineProperty(exports, "resolveNativeLeaseKnobs", {
295
- enumerable: true,
296
- get: function() {
297
- return resolveNativeLeaseKnobs;
298
- }
299
- });