@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
@@ -0,0 +1,35 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ Object.defineProperty(exports, "__commonJSMin", {
25
+ enumerable: true,
26
+ get: function() {
27
+ return __commonJSMin;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "__toESM", {
31
+ enumerable: true,
32
+ get: function() {
33
+ return __toESM;
34
+ }
35
+ });
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-wtNhtVVo.js");
1
+ const require_dist = require("./dist-ATDfcxgL.js");
2
2
  let node_crypto = require("node:crypto");
3
3
  //#region src/detection-pipeline/pipeline/landmark-precision-gate.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { N as audioKindId, a as COCO_80_LABELS, o as COCO_TO_MACRO, r as AUDIO_MACRO_LABELS, tt as hfModelUrl } from "./dist-CKK0CBUW.mjs";
1
+ import { P as audioKindId, a as COCO_80_LABELS, nt as hfModelUrl, o as COCO_TO_MACRO, r as AUDIO_MACRO_LABELS } from "./dist-CEFC3PkP.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  //#region src/detection-pipeline/pipeline/landmark-precision-gate.ts
4
4
  /**
@@ -2,20 +2,21 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-wtNhtVVo.js");
6
- const require_node = require("../node-BduNi21Z.js");
7
- const require_default_detection_model = require("../default-detection-model-d7-Q_LMo.js");
8
- const require_lazy_sharp = require("../lazy-sharp-zoQ07I43.js");
9
- const require_process_memory = require("../process-memory-Dwl0MFPH.js");
5
+ const require_chunk = require("../chunk-emK7D4bc.js");
6
+ const require_dist = require("../dist-ATDfcxgL.js");
7
+ const require_node = require("../node-C5jnTgpv.js");
8
+ const require_default_detection_model = require("../default-detection-model-B1NT1A38.js");
9
+ const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
10
+ const require_process_memory = require("../process-memory-DQbCPnMA.js");
10
11
  let node_os = require("node:os");
11
- node_os = require_dist.__toESM(node_os);
12
+ node_os = require_chunk.__toESM(node_os);
12
13
  let node_fs = require("node:fs");
13
- node_fs = require_dist.__toESM(node_fs);
14
+ node_fs = require_chunk.__toESM(node_fs);
14
15
  let node_path = require("node:path");
15
- node_path = require_dist.__toESM(node_path);
16
+ node_path = require_chunk.__toESM(node_path);
16
17
  let node_child_process = require("node:child_process");
17
18
  let sharp = require("sharp");
18
- sharp = require_dist.__toESM(sharp);
19
+ sharp = require_chunk.__toESM(sharp);
19
20
  let _camstack_system_addon_utils = require("@camstack/system/addon-utils");
20
21
  //#region src/detection-pipeline/runtimes.ts
21
22
  var KNOWN_PLATFORMS = [
@@ -1,9 +1,9 @@
1
1
  import { n as __require } from "../chunk-DnnnRqeS.mjs";
2
- import { $t as parseJsonUnknown, B as defaultDeviceFor$1, Dt as resolvePoolMemoryPolicy, G as detectionPipelineCapability, It as errMsg, J as enumerateInferenceDevices, Jt as hydrateSchema, Pt as supportedRuntimes$1, Qt as nodePin, S as PoolMemoryWatchdog, Ut as BaseAddon, X as evaluateZoneRules, c as DEFAULT_CLUSTER_STEP_MODELS, gt as pickClusterStepSettings, hn as EventCategory, ht as pickClusterStepModels, in as array, it as loadContributionCapability, k as YAMNET_TO_MACRO, kt as runtimeDevices$1, l as DEFAULT_CLUSTER_STEP_SETTINGS, m as DEVICE_BACKEND_TO_FORMAT, mn as union, nn as sleep, nt as inferModelProvider, pn as string, pt as overlayClusterStepSettings, qt as createEvent, t as APPLE_SA_TO_MACRO, un as object, wt as resolveClusterStepModelId, yt as pipelineExecutorCapability } from "../dist-CKK0CBUW.mjs";
3
- import { o as readProcessCost } from "../node-CrNBWFbA.mjs";
4
- import { a as ALL_PIPELINE_STEPS, c as getStep, d as landmarkPrecisionVerdict, l as getStepDefinition, n as resolveDefaultDetectionModel, o as ALL_STEPS, r as localFrameRegistry, s as getDefaultModelForFormat, u as resolveModelForFormat } from "../default-detection-model-Dsk1a5pY.mjs";
2
+ import { A as YAMNET_TO_MACRO, At as runtimeDevices$1, C as PoolMemoryWatchdog, Ft as supportedRuntimes$1, K as detectionPipelineCapability, Lt as errMsg, Ot as resolvePoolMemoryPolicy, Tt as resolveClusterStepModelId, V as defaultDeviceFor$1, Wt as BaseAddon, Y as enumerateInferenceDevices, Yt as createEvent, Z as evaluateZoneRules, Zt as hydrateSchema, _n as union, _t as pickClusterStepSettings, an as sleep, at as loadContributionCapability, bt as pipelineExecutorCapability, c as DEFAULT_CLUSTER_STEP_MODELS, gn as string, gt as pickClusterStepModels, l as DEFAULT_CLUSTER_STEP_SETTINGS, m as DEVICE_BACKEND_TO_FORMAT, mt as overlayClusterStepSettings, nn as parseJsonUnknown, pn as object, rt as inferModelProvider, sn as array, t as APPLE_SA_TO_MACRO, tn as nodePin, vn as EventCategory } from "../dist-CEFC3PkP.mjs";
3
+ import { o as readProcessCost } from "../node-DR3fHqUq.mjs";
4
+ import { a as ALL_PIPELINE_STEPS, c as getStep, d as landmarkPrecisionVerdict, l as getStepDefinition, n as resolveDefaultDetectionModel, o as ALL_STEPS, r as localFrameRegistry, s as getDefaultModelForFormat, u as resolveModelForFormat } from "../default-detection-model-DkVFgubU.mjs";
5
5
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
6
- import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-BRQOtDN1.mjs";
6
+ import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-DqYj5IAb.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";
@@ -1,26 +1,3 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
- get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
- value: mod,
21
- enumerable: true
22
- }) : target, mod));
23
- //#endregion
24
1
  let node_crypto = require("node:crypto");
25
2
  //#region ../types/dist/event-category-DAXzJeTX.mjs
26
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
@@ -5368,6 +5345,118 @@ var ZodIssueCode = {
5368
5345
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5369
5346
  var ZodFirstPartyTypeKind;
5370
5347
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5348
+ //#endregion
5349
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5350
+ /**
5351
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5352
+ * window to float samples (D455).
5353
+ *
5354
+ * ## Why a format at all
5355
+ *
5356
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5357
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5358
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5359
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5360
+ * the plane carried four times the source. The plane crosses hub-main twice on
5361
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5362
+ *
5363
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5364
+ * them where it needs them. That is the same argument D450 made for the rate,
5365
+ * one step further along the same wire.
5366
+ *
5367
+ * ## Why the expansion lives here
5368
+ *
5369
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5370
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5371
+ * `AudioChunkPlane` expands per subscription) and
5372
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5373
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5374
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5375
+ * into their own dist (`self-contained` externals), so this travels with a
5376
+ * `camstack deploy` and needs no published server.
5377
+ *
5378
+ * A second μ-law table anywhere else is the defect this module exists to
5379
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5380
+ * direction for the WebRTC egress — a different transform, not a copy.)
5381
+ *
5382
+ * ## Absent means f32le
5383
+ *
5384
+ * `format` is optional on the wire and its absence means `f32le` — today's
5385
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5386
+ * has always been served, because the broker only emits a coded window to a
5387
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5388
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5389
+ * deployable one addon at a time across three nodes.
5390
+ */
5391
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5392
+ var AUDIO_CHUNK_FORMATS = [
5393
+ "f32le",
5394
+ "pcmu",
5395
+ "pcma"
5396
+ ];
5397
+ /**
5398
+ * Bytes one sample of `format` occupies. This is the number every duration
5399
+ * calculation over a chunk's `data` must use — a window accumulator that
5400
+ * hard-codes 4 reports a quarter of the audio it actually holds and flushes
5401
+ * four-second windows to a classifier expecting one.
5402
+ */
5403
+ function audioChunkBytesPerSample(format) {
5404
+ return format === "f32le" ? 4 : 1;
5405
+ }
5406
+ /**
5407
+ * Expand a CODED audio window to freshly-owned f32le bytes, 4-byte aligned at
5408
+ * offset 0, so a caller can build a `Float32Array` view over them directly.
5409
+ * The input may be a msgpack subview at any offset; nothing here reads it as
5410
+ * anything but bytes.
5411
+ *
5412
+ * `f32le` is accepted and returns a copy, but a caller that already knows the
5413
+ * format is `f32le` should not call this at all — it has the bytes. Both
5414
+ * callers branch on the format first for exactly that reason, and the copy
5415
+ * here exists so the return type is always owned rather than sometimes
5416
+ * aliasing the argument.
5417
+ */
5418
+ function expandAudioChunkToF32le(data, format) {
5419
+ if (format === "f32le") {
5420
+ const copy = new Uint8Array(data.byteLength);
5421
+ copy.set(data);
5422
+ return copy;
5423
+ }
5424
+ const table = format === "pcmu" ? ULAW_TABLE : ALAW_TABLE;
5425
+ const out = new Float32Array(data.length);
5426
+ for (let i = 0; i < data.length; i++) out[i] = table[data[i]];
5427
+ return new Uint8Array(out.buffer);
5428
+ }
5429
+ /**
5430
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5431
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5432
+ *
5433
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5434
+ * it buffers the coded bytes and the plane's consumers expand.
5435
+ */
5436
+ function buildUlawTable() {
5437
+ const table = new Float32Array(256);
5438
+ for (let i = 0; i < 256; i++) {
5439
+ const complemented = ~i & 255;
5440
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5441
+ const exponent = complemented >> 4 & 7;
5442
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5443
+ }
5444
+ return table;
5445
+ }
5446
+ /** Build the A-law decode table (ITU-T G.711). */
5447
+ function buildAlawTable() {
5448
+ const table = new Float32Array(256);
5449
+ for (let i = 0; i < 256; i++) {
5450
+ const xored = i ^ 85;
5451
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5452
+ const exponent = xored >> 4 & 7;
5453
+ const mantissa = xored & 15;
5454
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5455
+ }
5456
+ return table;
5457
+ }
5458
+ var ULAW_TABLE = buildUlawTable();
5459
+ var ALAW_TABLE = buildAlawTable();
5371
5460
  Object.fromEntries([
5372
5461
  {
5373
5462
  id: "overview",
@@ -6740,11 +6829,20 @@ var SubscribeFramesResultSchema = object({
6740
6829
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6741
6830
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6742
6831
  */
6832
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6743
6833
  var DecodedAudioChunkSchema = object({
6744
6834
  data: _instanceof(Uint8Array),
6745
6835
  sampleRate: number().int().positive(),
6746
6836
  channels: number().int().positive(),
6747
- timestamp: number()
6837
+ timestamp: number(),
6838
+ /**
6839
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6840
+ * byte, for any peer that never heard of this field. A coded window
6841
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6842
+ * subscription that DECLARED it accepts one, so absence can never mean
6843
+ * "coded bytes a consumer will read as floats" (D455).
6844
+ */
6845
+ format: AudioChunkFormatSchema.optional()
6748
6846
  });
6749
6847
  /**
6750
6848
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6756,7 +6854,18 @@ var DecodedAudioChunkSchema = object({
6756
6854
  var SubscribeAudioChunksInputSchema = object({
6757
6855
  brokerId: string(),
6758
6856
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6759
- tag: string().optional()
6857
+ tag: string().optional(),
6858
+ /**
6859
+ * Byte formats this subscriber can READ, best first. The broker serves the
6860
+ * chunk's own format when it is in this list and expands to `f32le`
6861
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6862
+ *
6863
+ * Absent (or without the source format) means `f32le` — the behaviour every
6864
+ * subscriber had before D455, unchanged. This is the negotiation half of
6865
+ * the source-bytes lever: it is what lets the broker and its consumers
6866
+ * deploy one at a time across three nodes.
6867
+ */
6868
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6760
6869
  });
6761
6870
  /** Result of `stream-broker.subscribeAudioChunks`. */
6762
6871
  var SubscribeAudioChunksResultSchema = object({
@@ -12363,6 +12472,51 @@ var AudioAnalysisSettingsSchema = object({
12363
12472
  minConfidence: number().min(0).max(1).default(.3),
12364
12473
  allowedClasses: array(string()).default([])
12365
12474
  });
12475
+ /**
12476
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
12477
+ *
12478
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
12479
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
12480
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
12481
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
12482
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
12483
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
12484
+ * way to the one expansion that feeds the model.
12485
+ *
12486
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
12487
+ * window, the per-device node assignment, the settings read) and therefore
12488
+ * still owns the attach/detach pair. It no longer owns the bytes.
12489
+ */
12490
+ var AudioAttachDeviceInputSchema = object({
12491
+ deviceId: number(),
12492
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
12493
+ brokerId: string(),
12494
+ /**
12495
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
12496
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
12497
+ * the orchestrator's poller pinned them before the move.
12498
+ */
12499
+ ingestNodeId: string(),
12500
+ /**
12501
+ * Resolved once by the orchestrator at attach time, exactly as it was read
12502
+ * once per subscription before D461. The analyzer does NOT re-resolve per
12503
+ * window: a settings change re-attaches, which is what always happened.
12504
+ */
12505
+ settings: AudioAnalysisSettingsSchema
12506
+ });
12507
+ var AudioAttachDeviceResultSchema = object({
12508
+ /** False only when the analyzer is shutting down and refused to attach. */
12509
+ attached: boolean(),
12510
+ /**
12511
+ * True when the attachment replaced a live one for the same device. An
12512
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
12513
+ * double the broker's fanout and neither would know about the other.
12514
+ */
12515
+ replaced: boolean()
12516
+ });
12517
+ var AudioDetachDeviceResultSchema = object({
12518
+ /** False when no attachment existed — detach is idempotent. */
12519
+ detached: boolean() });
12366
12520
  var AudioClassificationResultSchema = object({
12367
12521
  labels: array(AudioClassificationLabelSchema).readonly(),
12368
12522
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -12411,6 +12565,21 @@ var audioAnalyzerCapability = {
12411
12565
  settings: AudioAnalysisSettingsSchema
12412
12566
  }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }),
12413
12567
  classify: method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }),
12568
+ /**
12569
+ * Start pulling this camera's audio from the broker, in THIS process.
12570
+ * Returns as soon as the attachment exists — the first
12571
+ * `subscribeAudioChunks` retries with backoff behind it, because the
12572
+ * broker for a camStream may not be registered yet (that tolerance moved
12573
+ * with the poller, D461). Replaces any live attachment for the device.
12574
+ */
12575
+ attachDevice: method(AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, { kind: "mutation" }),
12576
+ /**
12577
+ * Stop pulling this camera's audio and release the broker subscription.
12578
+ * Idempotent. A detach that never arrives is the one failure mode this
12579
+ * split adds, which is why `AudioChunkPlane` reaps a subscription nobody
12580
+ * drains rather than trusting it (D461).
12581
+ */
12582
+ detachDevice: method(object({ deviceId: number() }), AudioDetachDeviceResultSchema, { kind: "mutation" }),
12414
12583
  isReady: method(_void(), boolean()),
12415
12584
  dispose: method(_void(), _void(), { kind: "mutation" }),
12416
12585
  /**
@@ -27877,8 +28046,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
27877
28046
  *
27878
28047
  * An **empty array reads NOTHING** — `[]` is an empty page, never
27879
28048
  * "every camera". A request for no devices is a request, not an
27880
- * omission; same contract as `deviceManager.listFleet` and
27881
- * `pipelineAnalytics.listRecentTracks`.
28049
+ * omission; same contract as `deviceManager.listAll`'s `deviceIds`
28050
+ * and `pipelineAnalytics.listRecentTracks`.
27882
28051
  *
27883
28052
  * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
27884
28053
  */
@@ -34060,12 +34229,24 @@ Object.freeze({
34060
34229
  addonId: null,
34061
34230
  access: "create"
34062
34231
  },
34232
+ "audioAnalyzer.attachDevice": {
34233
+ capName: "audio-analyzer",
34234
+ capScope: "system",
34235
+ addonId: null,
34236
+ access: "create"
34237
+ },
34063
34238
  "audioAnalyzer.classify": {
34064
34239
  capName: "audio-analyzer",
34065
34240
  capScope: "system",
34066
34241
  addonId: null,
34067
34242
  access: "view"
34068
34243
  },
34244
+ "audioAnalyzer.detachDevice": {
34245
+ capName: "audio-analyzer",
34246
+ capScope: "system",
34247
+ addonId: null,
34248
+ access: "create"
34249
+ },
34069
34250
  "audioAnalyzer.dispose": {
34070
34251
  capName: "audio-analyzer",
34071
34252
  capScope: "system",
@@ -39909,11 +40090,21 @@ Object.freeze({
39909
40090
  form: "single",
39910
40091
  optional: false
39911
40092
  }],
40093
+ "audioAnalyzer.attachDevice": [{
40094
+ name: "deviceId",
40095
+ form: "single",
40096
+ optional: false
40097
+ }],
39912
40098
  "audioAnalyzer.classify": [{
39913
40099
  name: "deviceId",
39914
40100
  form: "single",
39915
40101
  optional: true
39916
40102
  }],
40103
+ "audioAnalyzer.detachDevice": [{
40104
+ name: "deviceId",
40105
+ form: "single",
40106
+ optional: false
40107
+ }],
39917
40108
  "audioMetrics.getCurrentSnapshot": [{
39918
40109
  name: "deviceId",
39919
40110
  form: "single",
@@ -41765,6 +41956,51 @@ Object.freeze({
41765
41956
  "network-access": "ingress",
41766
41957
  "smtp-provider": "email"
41767
41958
  });
41959
+ var G711_SCALE_CORRECTION_DB = {
41960
+ PCMU: 20 * Math.log10(4),
41961
+ PCMA: 20 * Math.log10(8)
41962
+ };
41963
+ /**
41964
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
41965
+ * same intent on the ITU-T scale (D460).
41966
+ *
41967
+ * ## When this applies, and when it is the wrong thing to reach for
41968
+ *
41969
+ * An absolute-dBFS number in this repo is one of two things, and only one of
41970
+ * them converts:
41971
+ *
41972
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
41973
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
41974
+ * after. The defect was never in the number; it was that 19 of this hub's
41975
+ * 25 cameras did not obey it. Converting such a number takes something
41976
+ * correct and makes it wrong, in order to preserve a bug.
41977
+ * - **A measurement taken through the old decoder** — a value someone read
41978
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
41979
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
41980
+ * louder. That is what this function is for.
41981
+ *
41982
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
41983
+ * and it cannot be answered from the number. It is answered by the comment the
41984
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
41985
+ * mandatory.
41986
+ *
41987
+ * ## Why a function and not a typed-in number
41988
+ *
41989
+ * `-55 + 12.04` written into a source file is, six months later, completely
41990
+ * indistinguishable from a threshold somebody simply preferred. Calling this
41991
+ * keeps the derivation, the law, and the original measurement all visible at
41992
+ * the call site, so a future reader can disagree with the *premise* instead of
41993
+ * having to reverse-engineer the sum.
41994
+ *
41995
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
41996
+ * it is declared. It must never be applied to a live sample or a stored
41997
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
41998
+ * adjusting numbers the decoder already got right is the original defect with
41999
+ * an extra place to argue with (D459).
42000
+ */
42001
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
42002
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
42003
+ }
41768
42004
  /**
41769
42005
  * audio-condition — the authoring logic behind the sustained-sound condition
41770
42006
  * (`NcConditions.audio`), pure and UI-framework-free.
@@ -41815,6 +42051,7 @@ var AUDIO_KIND_PREFIX = "audio-";
41815
42051
  function audioKindId(macroId) {
41816
42052
  return macroId.startsWith(AUDIO_KIND_PREFIX) ? macroId : `${AUDIO_KIND_PREFIX}${macroId}`;
41817
42053
  }
42054
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
41818
42055
  /** Schema defaults — an untouched sub-field must author exactly these. */
41819
42056
  var NC_AUDIO_DEFAULTS = {
41820
42057
  hitPercent: 60,
@@ -43498,6 +43735,12 @@ Object.defineProperty(exports, "Fmp4BoxSplitter", {
43498
43735
  return Fmp4BoxSplitter;
43499
43736
  }
43500
43737
  });
43738
+ Object.defineProperty(exports, "G711_SCALE_CORRECTION_DB", {
43739
+ enumerable: true,
43740
+ get: function() {
43741
+ return G711_SCALE_CORRECTION_DB;
43742
+ }
43743
+ });
43501
43744
  Object.defineProperty(exports, "HF_BASE_URL", {
43502
43745
  enumerable: true,
43503
43746
  get: function() {
@@ -43570,18 +43813,6 @@ Object.defineProperty(exports, "YAMNET_TO_MACRO", {
43570
43813
  return YAMNET_TO_MACRO;
43571
43814
  }
43572
43815
  });
43573
- Object.defineProperty(exports, "__commonJSMin", {
43574
- enumerable: true,
43575
- get: function() {
43576
- return __commonJSMin;
43577
- }
43578
- });
43579
- Object.defineProperty(exports, "__toESM", {
43580
- enumerable: true,
43581
- get: function() {
43582
- return __toESM;
43583
- }
43584
- });
43585
43816
  Object.defineProperty(exports, "_enum", {
43586
43817
  enumerable: true,
43587
43818
  get: function() {
@@ -43612,6 +43843,12 @@ Object.defineProperty(exports, "audioAnalyzerCapability", {
43612
43843
  return audioAnalyzerCapability;
43613
43844
  }
43614
43845
  });
43846
+ Object.defineProperty(exports, "audioChunkBytesPerSample", {
43847
+ enumerable: true,
43848
+ get: function() {
43849
+ return audioChunkBytesPerSample;
43850
+ }
43851
+ });
43615
43852
  Object.defineProperty(exports, "audioKindId", {
43616
43853
  enumerable: true,
43617
43854
  get: function() {
@@ -43762,6 +43999,12 @@ Object.defineProperty(exports, "evictionPolicyOfLocation", {
43762
43999
  return evictionPolicyOfLocation;
43763
44000
  }
43764
44001
  });
44002
+ Object.defineProperty(exports, "expandAudioChunkToF32le", {
44003
+ enumerable: true,
44004
+ get: function() {
44005
+ return expandAudioChunkToF32le;
44006
+ }
44007
+ });
43765
44008
  Object.defineProperty(exports, "failureContributionCapability", {
43766
44009
  enumerable: true,
43767
44010
  get: function() {