@camstack/addon-provider-dreo 0.2.95 → 0.2.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -5381,6 +5381,86 @@ var ZodIssueCode = {
5381
5381
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5382
5382
  var ZodFirstPartyTypeKind;
5383
5383
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5384
+ //#endregion
5385
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5386
+ /**
5387
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5388
+ * window to float samples (D455).
5389
+ *
5390
+ * ## Why a format at all
5391
+ *
5392
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5393
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5394
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5395
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5396
+ * the plane carried four times the source. The plane crosses hub-main twice on
5397
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5398
+ *
5399
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5400
+ * them where it needs them. That is the same argument D450 made for the rate,
5401
+ * one step further along the same wire.
5402
+ *
5403
+ * ## Why the expansion lives here
5404
+ *
5405
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5406
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5407
+ * `AudioChunkPlane` expands per subscription) and
5408
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5409
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5410
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5411
+ * into their own dist (`self-contained` externals), so this travels with a
5412
+ * `camstack deploy` and needs no published server.
5413
+ *
5414
+ * A second μ-law table anywhere else is the defect this module exists to
5415
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5416
+ * direction for the WebRTC egress — a different transform, not a copy.)
5417
+ *
5418
+ * ## Absent means f32le
5419
+ *
5420
+ * `format` is optional on the wire and its absence means `f32le` — today's
5421
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5422
+ * has always been served, because the broker only emits a coded window to a
5423
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5424
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5425
+ * deployable one addon at a time across three nodes.
5426
+ */
5427
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5428
+ var AUDIO_CHUNK_FORMATS = [
5429
+ "f32le",
5430
+ "pcmu",
5431
+ "pcma"
5432
+ ];
5433
+ /**
5434
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5435
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5436
+ *
5437
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5438
+ * it buffers the coded bytes and the plane's consumers expand.
5439
+ */
5440
+ function buildUlawTable() {
5441
+ const table = new Float32Array(256);
5442
+ for (let i = 0; i < 256; i++) {
5443
+ const complemented = ~i & 255;
5444
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5445
+ const exponent = complemented >> 4 & 7;
5446
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5447
+ }
5448
+ return table;
5449
+ }
5450
+ /** Build the A-law decode table (ITU-T G.711). */
5451
+ function buildAlawTable() {
5452
+ const table = new Float32Array(256);
5453
+ for (let i = 0; i < 256; i++) {
5454
+ const xored = i ^ 85;
5455
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5456
+ const exponent = xored >> 4 & 7;
5457
+ const mantissa = xored & 15;
5458
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5459
+ }
5460
+ return table;
5461
+ }
5462
+ buildUlawTable();
5463
+ buildAlawTable();
5384
5464
  Object.fromEntries([
5385
5465
  {
5386
5466
  id: "overview",
@@ -6673,11 +6753,20 @@ var SubscribeFramesResultSchema = object({
6673
6753
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6674
6754
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6675
6755
  */
6756
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6676
6757
  var DecodedAudioChunkSchema = object({
6677
6758
  data: _instanceof(Uint8Array),
6678
6759
  sampleRate: number().int().positive(),
6679
6760
  channels: number().int().positive(),
6680
- timestamp: number()
6761
+ timestamp: number(),
6762
+ /**
6763
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6764
+ * byte, for any peer that never heard of this field. A coded window
6765
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6766
+ * subscription that DECLARED it accepts one, so absence can never mean
6767
+ * "coded bytes a consumer will read as floats" (D455).
6768
+ */
6769
+ format: AudioChunkFormatSchema.optional()
6681
6770
  });
6682
6771
  /**
6683
6772
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6689,7 +6778,18 @@ var DecodedAudioChunkSchema = object({
6689
6778
  var SubscribeAudioChunksInputSchema = object({
6690
6779
  brokerId: string(),
6691
6780
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6692
- tag: string().optional()
6781
+ tag: string().optional(),
6782
+ /**
6783
+ * Byte formats this subscriber can READ, best first. The broker serves the
6784
+ * chunk's own format when it is in this list and expands to `f32le`
6785
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6786
+ *
6787
+ * Absent (or without the source format) means `f32le` — the behaviour every
6788
+ * subscriber had before D455, unchanged. This is the negotiation half of
6789
+ * the source-bytes lever: it is what lets the broker and its consumers
6790
+ * deploy one at a time across three nodes.
6791
+ */
6792
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6693
6793
  });
6694
6794
  /** Result of `stream-broker.subscribeAudioChunks`. */
6695
6795
  var SubscribeAudioChunksResultSchema = object({
@@ -10677,6 +10777,51 @@ var AudioAnalysisSettingsSchema = object({
10677
10777
  minConfidence: number().min(0).max(1).default(.3),
10678
10778
  allowedClasses: array(string()).default([])
10679
10779
  });
10780
+ /**
10781
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10782
+ *
10783
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10784
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10785
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10786
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10787
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10788
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10789
+ * way to the one expansion that feeds the model.
10790
+ *
10791
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10792
+ * window, the per-device node assignment, the settings read) and therefore
10793
+ * still owns the attach/detach pair. It no longer owns the bytes.
10794
+ */
10795
+ var AudioAttachDeviceInputSchema = object({
10796
+ deviceId: number(),
10797
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10798
+ brokerId: string(),
10799
+ /**
10800
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10801
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10802
+ * the orchestrator's poller pinned them before the move.
10803
+ */
10804
+ ingestNodeId: string(),
10805
+ /**
10806
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10807
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10808
+ * window: a settings change re-attaches, which is what always happened.
10809
+ */
10810
+ settings: AudioAnalysisSettingsSchema
10811
+ });
10812
+ var AudioAttachDeviceResultSchema = object({
10813
+ /** False only when the analyzer is shutting down and refused to attach. */
10814
+ attached: boolean(),
10815
+ /**
10816
+ * True when the attachment replaced a live one for the same device. An
10817
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10818
+ * double the broker's fanout and neither would know about the other.
10819
+ */
10820
+ replaced: boolean()
10821
+ });
10822
+ var AudioDetachDeviceResultSchema = object({
10823
+ /** False when no attachment existed — detach is idempotent. */
10824
+ detached: boolean() });
10680
10825
  var AudioClassificationResultSchema = object({
10681
10826
  labels: array(AudioClassificationLabelSchema).readonly(),
10682
10827
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10685,7 +10830,7 @@ var AudioClassificationResultSchema = object({
10685
10830
  method(object({
10686
10831
  chunk: AudioChunkInputSchema,
10687
10832
  settings: AudioAnalysisSettingsSchema
10688
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10833
+ }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), AudioDetachDeviceResultSchema, { kind: "mutation" }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10689
10834
  kind: "mutation",
10690
10835
  auth: "admin"
10691
10836
  });
@@ -34969,12 +35114,24 @@ Object.freeze({
34969
35114
  addonId: null,
34970
35115
  access: "create"
34971
35116
  },
35117
+ "audioAnalyzer.attachDevice": {
35118
+ capName: "audio-analyzer",
35119
+ capScope: "system",
35120
+ addonId: null,
35121
+ access: "create"
35122
+ },
34972
35123
  "audioAnalyzer.classify": {
34973
35124
  capName: "audio-analyzer",
34974
35125
  capScope: "system",
34975
35126
  addonId: null,
34976
35127
  access: "view"
34977
35128
  },
35129
+ "audioAnalyzer.detachDevice": {
35130
+ capName: "audio-analyzer",
35131
+ capScope: "system",
35132
+ addonId: null,
35133
+ access: "create"
35134
+ },
34978
35135
  "audioAnalyzer.dispose": {
34979
35136
  capName: "audio-analyzer",
34980
35137
  capScope: "system",
@@ -40818,11 +40975,21 @@ Object.freeze({
40818
40975
  form: "single",
40819
40976
  optional: false
40820
40977
  }],
40978
+ "audioAnalyzer.attachDevice": [{
40979
+ name: "deviceId",
40980
+ form: "single",
40981
+ optional: false
40982
+ }],
40821
40983
  "audioAnalyzer.classify": [{
40822
40984
  name: "deviceId",
40823
40985
  form: "single",
40824
40986
  optional: true
40825
40987
  }],
40988
+ "audioAnalyzer.detachDevice": [{
40989
+ name: "deviceId",
40990
+ form: "single",
40991
+ optional: false
40992
+ }],
40826
40993
  "audioMetrics.getCurrentSnapshot": [{
40827
40994
  name: "deviceId",
40828
40995
  form: "single",
@@ -42674,6 +42841,52 @@ Object.freeze({
42674
42841
  "network-access": "ingress",
42675
42842
  "smtp-provider": "email"
42676
42843
  });
42844
+ var G711_SCALE_CORRECTION_DB = {
42845
+ PCMU: 20 * Math.log10(4),
42846
+ PCMA: 20 * Math.log10(8)
42847
+ };
42848
+ /**
42849
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
42850
+ * same intent on the ITU-T scale (D460).
42851
+ *
42852
+ * ## When this applies, and when it is the wrong thing to reach for
42853
+ *
42854
+ * An absolute-dBFS number in this repo is one of two things, and only one of
42855
+ * them converts:
42856
+ *
42857
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
42858
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
42859
+ * after. The defect was never in the number; it was that 19 of this hub's
42860
+ * 25 cameras did not obey it. Converting such a number takes something
42861
+ * correct and makes it wrong, in order to preserve a bug.
42862
+ * - **A measurement taken through the old decoder** — a value someone read
42863
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
42864
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
42865
+ * louder. That is what this function is for.
42866
+ *
42867
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
42868
+ * and it cannot be answered from the number. It is answered by the comment the
42869
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
42870
+ * mandatory.
42871
+ *
42872
+ * ## Why a function and not a typed-in number
42873
+ *
42874
+ * `-55 + 12.04` written into a source file is, six months later, completely
42875
+ * indistinguishable from a threshold somebody simply preferred. Calling this
42876
+ * keeps the derivation, the law, and the original measurement all visible at
42877
+ * the call site, so a future reader can disagree with the *premise* instead of
42878
+ * having to reverse-engineer the sum.
42879
+ *
42880
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
42881
+ * it is declared. It must never be applied to a live sample or a stored
42882
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
42883
+ * adjusting numbers the decoder already got right is the original defect with
42884
+ * an extra place to argue with (D459).
42885
+ */
42886
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
42887
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
42888
+ }
42889
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
42677
42890
  /** Schema defaults — an untouched sub-field must author exactly these. */
42678
42891
  var NC_AUDIO_DEFAULTS = {
42679
42892
  hitPercent: 60,
package/dist/addon.mjs CHANGED
@@ -5382,6 +5382,86 @@ var ZodIssueCode = {
5382
5382
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5383
5383
  var ZodFirstPartyTypeKind;
5384
5384
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5385
+ //#endregion
5386
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5387
+ /**
5388
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5389
+ * window to float samples (D455).
5390
+ *
5391
+ * ## Why a format at all
5392
+ *
5393
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5394
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5395
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5396
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5397
+ * the plane carried four times the source. The plane crosses hub-main twice on
5398
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5399
+ *
5400
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5401
+ * them where it needs them. That is the same argument D450 made for the rate,
5402
+ * one step further along the same wire.
5403
+ *
5404
+ * ## Why the expansion lives here
5405
+ *
5406
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5407
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5408
+ * `AudioChunkPlane` expands per subscription) and
5409
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5410
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5411
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5412
+ * into their own dist (`self-contained` externals), so this travels with a
5413
+ * `camstack deploy` and needs no published server.
5414
+ *
5415
+ * A second μ-law table anywhere else is the defect this module exists to
5416
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5417
+ * direction for the WebRTC egress — a different transform, not a copy.)
5418
+ *
5419
+ * ## Absent means f32le
5420
+ *
5421
+ * `format` is optional on the wire and its absence means `f32le` — today's
5422
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5423
+ * has always been served, because the broker only emits a coded window to a
5424
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5425
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5426
+ * deployable one addon at a time across three nodes.
5427
+ */
5428
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5429
+ var AUDIO_CHUNK_FORMATS = [
5430
+ "f32le",
5431
+ "pcmu",
5432
+ "pcma"
5433
+ ];
5434
+ /**
5435
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5436
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5437
+ *
5438
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5439
+ * it buffers the coded bytes and the plane's consumers expand.
5440
+ */
5441
+ function buildUlawTable() {
5442
+ const table = new Float32Array(256);
5443
+ for (let i = 0; i < 256; i++) {
5444
+ const complemented = ~i & 255;
5445
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5446
+ const exponent = complemented >> 4 & 7;
5447
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5448
+ }
5449
+ return table;
5450
+ }
5451
+ /** Build the A-law decode table (ITU-T G.711). */
5452
+ function buildAlawTable() {
5453
+ const table = new Float32Array(256);
5454
+ for (let i = 0; i < 256; i++) {
5455
+ const xored = i ^ 85;
5456
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5457
+ const exponent = xored >> 4 & 7;
5458
+ const mantissa = xored & 15;
5459
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5460
+ }
5461
+ return table;
5462
+ }
5463
+ buildUlawTable();
5464
+ buildAlawTable();
5385
5465
  Object.fromEntries([
5386
5466
  {
5387
5467
  id: "overview",
@@ -6674,11 +6754,20 @@ var SubscribeFramesResultSchema = object({
6674
6754
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6675
6755
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6676
6756
  */
6757
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6677
6758
  var DecodedAudioChunkSchema = object({
6678
6759
  data: _instanceof(Uint8Array),
6679
6760
  sampleRate: number().int().positive(),
6680
6761
  channels: number().int().positive(),
6681
- timestamp: number()
6762
+ timestamp: number(),
6763
+ /**
6764
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6765
+ * byte, for any peer that never heard of this field. A coded window
6766
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6767
+ * subscription that DECLARED it accepts one, so absence can never mean
6768
+ * "coded bytes a consumer will read as floats" (D455).
6769
+ */
6770
+ format: AudioChunkFormatSchema.optional()
6682
6771
  });
6683
6772
  /**
6684
6773
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6690,7 +6779,18 @@ var DecodedAudioChunkSchema = object({
6690
6779
  var SubscribeAudioChunksInputSchema = object({
6691
6780
  brokerId: string(),
6692
6781
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6693
- tag: string().optional()
6782
+ tag: string().optional(),
6783
+ /**
6784
+ * Byte formats this subscriber can READ, best first. The broker serves the
6785
+ * chunk's own format when it is in this list and expands to `f32le`
6786
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6787
+ *
6788
+ * Absent (or without the source format) means `f32le` — the behaviour every
6789
+ * subscriber had before D455, unchanged. This is the negotiation half of
6790
+ * the source-bytes lever: it is what lets the broker and its consumers
6791
+ * deploy one at a time across three nodes.
6792
+ */
6793
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6694
6794
  });
6695
6795
  /** Result of `stream-broker.subscribeAudioChunks`. */
6696
6796
  var SubscribeAudioChunksResultSchema = object({
@@ -10678,6 +10778,51 @@ var AudioAnalysisSettingsSchema = object({
10678
10778
  minConfidence: number().min(0).max(1).default(.3),
10679
10779
  allowedClasses: array(string()).default([])
10680
10780
  });
10781
+ /**
10782
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10783
+ *
10784
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10785
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10786
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10787
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10788
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10789
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10790
+ * way to the one expansion that feeds the model.
10791
+ *
10792
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10793
+ * window, the per-device node assignment, the settings read) and therefore
10794
+ * still owns the attach/detach pair. It no longer owns the bytes.
10795
+ */
10796
+ var AudioAttachDeviceInputSchema = object({
10797
+ deviceId: number(),
10798
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10799
+ brokerId: string(),
10800
+ /**
10801
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10802
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10803
+ * the orchestrator's poller pinned them before the move.
10804
+ */
10805
+ ingestNodeId: string(),
10806
+ /**
10807
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10808
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10809
+ * window: a settings change re-attaches, which is what always happened.
10810
+ */
10811
+ settings: AudioAnalysisSettingsSchema
10812
+ });
10813
+ var AudioAttachDeviceResultSchema = object({
10814
+ /** False only when the analyzer is shutting down and refused to attach. */
10815
+ attached: boolean(),
10816
+ /**
10817
+ * True when the attachment replaced a live one for the same device. An
10818
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10819
+ * double the broker's fanout and neither would know about the other.
10820
+ */
10821
+ replaced: boolean()
10822
+ });
10823
+ var AudioDetachDeviceResultSchema = object({
10824
+ /** False when no attachment existed — detach is idempotent. */
10825
+ detached: boolean() });
10681
10826
  var AudioClassificationResultSchema = object({
10682
10827
  labels: array(AudioClassificationLabelSchema).readonly(),
10683
10828
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10686,7 +10831,7 @@ var AudioClassificationResultSchema = object({
10686
10831
  method(object({
10687
10832
  chunk: AudioChunkInputSchema,
10688
10833
  settings: AudioAnalysisSettingsSchema
10689
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10834
+ }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), AudioDetachDeviceResultSchema, { kind: "mutation" }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10690
10835
  kind: "mutation",
10691
10836
  auth: "admin"
10692
10837
  });
@@ -34970,12 +35115,24 @@ Object.freeze({
34970
35115
  addonId: null,
34971
35116
  access: "create"
34972
35117
  },
35118
+ "audioAnalyzer.attachDevice": {
35119
+ capName: "audio-analyzer",
35120
+ capScope: "system",
35121
+ addonId: null,
35122
+ access: "create"
35123
+ },
34973
35124
  "audioAnalyzer.classify": {
34974
35125
  capName: "audio-analyzer",
34975
35126
  capScope: "system",
34976
35127
  addonId: null,
34977
35128
  access: "view"
34978
35129
  },
35130
+ "audioAnalyzer.detachDevice": {
35131
+ capName: "audio-analyzer",
35132
+ capScope: "system",
35133
+ addonId: null,
35134
+ access: "create"
35135
+ },
34979
35136
  "audioAnalyzer.dispose": {
34980
35137
  capName: "audio-analyzer",
34981
35138
  capScope: "system",
@@ -40819,11 +40976,21 @@ Object.freeze({
40819
40976
  form: "single",
40820
40977
  optional: false
40821
40978
  }],
40979
+ "audioAnalyzer.attachDevice": [{
40980
+ name: "deviceId",
40981
+ form: "single",
40982
+ optional: false
40983
+ }],
40822
40984
  "audioAnalyzer.classify": [{
40823
40985
  name: "deviceId",
40824
40986
  form: "single",
40825
40987
  optional: true
40826
40988
  }],
40989
+ "audioAnalyzer.detachDevice": [{
40990
+ name: "deviceId",
40991
+ form: "single",
40992
+ optional: false
40993
+ }],
40827
40994
  "audioMetrics.getCurrentSnapshot": [{
40828
40995
  name: "deviceId",
40829
40996
  form: "single",
@@ -42675,6 +42842,52 @@ Object.freeze({
42675
42842
  "network-access": "ingress",
42676
42843
  "smtp-provider": "email"
42677
42844
  });
42845
+ var G711_SCALE_CORRECTION_DB = {
42846
+ PCMU: 20 * Math.log10(4),
42847
+ PCMA: 20 * Math.log10(8)
42848
+ };
42849
+ /**
42850
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
42851
+ * same intent on the ITU-T scale (D460).
42852
+ *
42853
+ * ## When this applies, and when it is the wrong thing to reach for
42854
+ *
42855
+ * An absolute-dBFS number in this repo is one of two things, and only one of
42856
+ * them converts:
42857
+ *
42858
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
42859
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
42860
+ * after. The defect was never in the number; it was that 19 of this hub's
42861
+ * 25 cameras did not obey it. Converting such a number takes something
42862
+ * correct and makes it wrong, in order to preserve a bug.
42863
+ * - **A measurement taken through the old decoder** — a value someone read
42864
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
42865
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
42866
+ * louder. That is what this function is for.
42867
+ *
42868
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
42869
+ * and it cannot be answered from the number. It is answered by the comment the
42870
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
42871
+ * mandatory.
42872
+ *
42873
+ * ## Why a function and not a typed-in number
42874
+ *
42875
+ * `-55 + 12.04` written into a source file is, six months later, completely
42876
+ * indistinguishable from a threshold somebody simply preferred. Calling this
42877
+ * keeps the derivation, the law, and the original measurement all visible at
42878
+ * the call site, so a future reader can disagree with the *premise* instead of
42879
+ * having to reverse-engineer the sum.
42880
+ *
42881
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
42882
+ * it is declared. It must never be applied to a live sample or a stored
42883
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
42884
+ * adjusting numbers the decoder already got right is the original defect with
42885
+ * an extra place to argue with (D459).
42886
+ */
42887
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
42888
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
42889
+ }
42890
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
42678
42891
  /** Schema defaults — an untouched sub-field must author exactly these. */
42679
42892
  var NC_AUDIO_DEFAULTS = {
42680
42893
  hitPercent: 60,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.95",
3
+ "version": "0.2.96",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",