@camstack/addon-export-google 0.1.58 → 0.1.60

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.
@@ -5423,6 +5423,86 @@ var ZodIssueCode = {
5423
5423
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5424
5424
  var ZodFirstPartyTypeKind;
5425
5425
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5426
+ //#endregion
5427
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5428
+ /**
5429
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5430
+ * window to float samples (D455).
5431
+ *
5432
+ * ## Why a format at all
5433
+ *
5434
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5435
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5436
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5437
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5438
+ * the plane carried four times the source. The plane crosses hub-main twice on
5439
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5440
+ *
5441
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5442
+ * them where it needs them. That is the same argument D450 made for the rate,
5443
+ * one step further along the same wire.
5444
+ *
5445
+ * ## Why the expansion lives here
5446
+ *
5447
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5448
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5449
+ * `AudioChunkPlane` expands per subscription) and
5450
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5451
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5452
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5453
+ * into their own dist (`self-contained` externals), so this travels with a
5454
+ * `camstack deploy` and needs no published server.
5455
+ *
5456
+ * A second μ-law table anywhere else is the defect this module exists to
5457
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5458
+ * direction for the WebRTC egress — a different transform, not a copy.)
5459
+ *
5460
+ * ## Absent means f32le
5461
+ *
5462
+ * `format` is optional on the wire and its absence means `f32le` — today's
5463
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5464
+ * has always been served, because the broker only emits a coded window to a
5465
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5466
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5467
+ * deployable one addon at a time across three nodes.
5468
+ */
5469
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5470
+ var AUDIO_CHUNK_FORMATS = [
5471
+ "f32le",
5472
+ "pcmu",
5473
+ "pcma"
5474
+ ];
5475
+ /**
5476
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5477
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5478
+ *
5479
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5480
+ * it buffers the coded bytes and the plane's consumers expand.
5481
+ */
5482
+ function buildUlawTable() {
5483
+ const table = new Float32Array(256);
5484
+ for (let i = 0; i < 256; i++) {
5485
+ const complemented = ~i & 255;
5486
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5487
+ const exponent = complemented >> 4 & 7;
5488
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5489
+ }
5490
+ return table;
5491
+ }
5492
+ /** Build the A-law decode table (ITU-T G.711). */
5493
+ function buildAlawTable() {
5494
+ const table = new Float32Array(256);
5495
+ for (let i = 0; i < 256; i++) {
5496
+ const xored = i ^ 85;
5497
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5498
+ const exponent = xored >> 4 & 7;
5499
+ const mantissa = xored & 15;
5500
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5501
+ }
5502
+ return table;
5503
+ }
5504
+ buildUlawTable();
5505
+ buildAlawTable();
5426
5506
  Object.fromEntries([
5427
5507
  {
5428
5508
  id: "overview",
@@ -6715,11 +6795,20 @@ var SubscribeFramesResultSchema = object({
6715
6795
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6716
6796
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6717
6797
  */
6798
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6718
6799
  var DecodedAudioChunkSchema = object({
6719
6800
  data: _instanceof(Uint8Array),
6720
6801
  sampleRate: number().int().positive(),
6721
6802
  channels: number().int().positive(),
6722
- timestamp: number()
6803
+ timestamp: number(),
6804
+ /**
6805
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6806
+ * byte, for any peer that never heard of this field. A coded window
6807
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6808
+ * subscription that DECLARED it accepts one, so absence can never mean
6809
+ * "coded bytes a consumer will read as floats" (D455).
6810
+ */
6811
+ format: AudioChunkFormatSchema.optional()
6723
6812
  });
6724
6813
  /**
6725
6814
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6731,7 +6820,18 @@ var DecodedAudioChunkSchema = object({
6731
6820
  var SubscribeAudioChunksInputSchema = object({
6732
6821
  brokerId: string(),
6733
6822
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6734
- tag: string().optional()
6823
+ tag: string().optional(),
6824
+ /**
6825
+ * Byte formats this subscriber can READ, best first. The broker serves the
6826
+ * chunk's own format when it is in this list and expands to `f32le`
6827
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6828
+ *
6829
+ * Absent (or without the source format) means `f32le` — the behaviour every
6830
+ * subscriber had before D455, unchanged. This is the negotiation half of
6831
+ * the source-bytes lever: it is what lets the broker and its consumers
6832
+ * deploy one at a time across three nodes.
6833
+ */
6834
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6735
6835
  });
6736
6836
  /** Result of `stream-broker.subscribeAudioChunks`. */
6737
6837
  var SubscribeAudioChunksResultSchema = object({
@@ -10860,6 +10960,51 @@ var AudioAnalysisSettingsSchema = object({
10860
10960
  minConfidence: number().min(0).max(1).default(.3),
10861
10961
  allowedClasses: array(string()).default([])
10862
10962
  });
10963
+ /**
10964
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10965
+ *
10966
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10967
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10968
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10969
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10970
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10971
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10972
+ * way to the one expansion that feeds the model.
10973
+ *
10974
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10975
+ * window, the per-device node assignment, the settings read) and therefore
10976
+ * still owns the attach/detach pair. It no longer owns the bytes.
10977
+ */
10978
+ var AudioAttachDeviceInputSchema = object({
10979
+ deviceId: number(),
10980
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10981
+ brokerId: string(),
10982
+ /**
10983
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10984
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10985
+ * the orchestrator's poller pinned them before the move.
10986
+ */
10987
+ ingestNodeId: string(),
10988
+ /**
10989
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10990
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10991
+ * window: a settings change re-attaches, which is what always happened.
10992
+ */
10993
+ settings: AudioAnalysisSettingsSchema
10994
+ });
10995
+ var AudioAttachDeviceResultSchema = object({
10996
+ /** False only when the analyzer is shutting down and refused to attach. */
10997
+ attached: boolean(),
10998
+ /**
10999
+ * True when the attachment replaced a live one for the same device. An
11000
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
11001
+ * double the broker's fanout and neither would know about the other.
11002
+ */
11003
+ replaced: boolean()
11004
+ });
11005
+ var AudioDetachDeviceResultSchema = object({
11006
+ /** False when no attachment existed — detach is idempotent. */
11007
+ detached: boolean() });
10863
11008
  var AudioClassificationResultSchema = object({
10864
11009
  labels: array(AudioClassificationLabelSchema).readonly(),
10865
11010
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10868,7 +11013,7 @@ var AudioClassificationResultSchema = object({
10868
11013
  method(object({
10869
11014
  chunk: AudioChunkInputSchema,
10870
11015
  settings: AudioAnalysisSettingsSchema
10871
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
11016
+ }), 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() }), {
10872
11017
  kind: "mutation",
10873
11018
  auth: "admin"
10874
11019
  });
@@ -25069,8 +25214,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
25069
25214
  *
25070
25215
  * An **empty array reads NOTHING** — `[]` is an empty page, never
25071
25216
  * "every camera". A request for no devices is a request, not an
25072
- * omission; same contract as `deviceManager.listFleet` and
25073
- * `pipelineAnalytics.listRecentTracks`.
25217
+ * omission; same contract as `deviceManager.listAll`'s `deviceIds`
25218
+ * and `pipelineAnalytics.listRecentTracks`.
25074
25219
  *
25075
25220
  * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
25076
25221
  */
@@ -30845,12 +30990,24 @@ Object.freeze({
30845
30990
  addonId: null,
30846
30991
  access: "create"
30847
30992
  },
30993
+ "audioAnalyzer.attachDevice": {
30994
+ capName: "audio-analyzer",
30995
+ capScope: "system",
30996
+ addonId: null,
30997
+ access: "create"
30998
+ },
30848
30999
  "audioAnalyzer.classify": {
30849
31000
  capName: "audio-analyzer",
30850
31001
  capScope: "system",
30851
31002
  addonId: null,
30852
31003
  access: "view"
30853
31004
  },
31005
+ "audioAnalyzer.detachDevice": {
31006
+ capName: "audio-analyzer",
31007
+ capScope: "system",
31008
+ addonId: null,
31009
+ access: "create"
31010
+ },
30854
31011
  "audioAnalyzer.dispose": {
30855
31012
  capName: "audio-analyzer",
30856
31013
  capScope: "system",
@@ -36694,11 +36851,21 @@ Object.freeze({
36694
36851
  form: "single",
36695
36852
  optional: false
36696
36853
  }],
36854
+ "audioAnalyzer.attachDevice": [{
36855
+ name: "deviceId",
36856
+ form: "single",
36857
+ optional: false
36858
+ }],
36697
36859
  "audioAnalyzer.classify": [{
36698
36860
  name: "deviceId",
36699
36861
  form: "single",
36700
36862
  optional: true
36701
36863
  }],
36864
+ "audioAnalyzer.detachDevice": [{
36865
+ name: "deviceId",
36866
+ form: "single",
36867
+ optional: false
36868
+ }],
36702
36869
  "audioMetrics.getCurrentSnapshot": [{
36703
36870
  name: "deviceId",
36704
36871
  form: "single",
@@ -38550,6 +38717,52 @@ Object.freeze({
38550
38717
  "network-access": "ingress",
38551
38718
  "smtp-provider": "email"
38552
38719
  });
38720
+ var G711_SCALE_CORRECTION_DB = {
38721
+ PCMU: 20 * Math.log10(4),
38722
+ PCMA: 20 * Math.log10(8)
38723
+ };
38724
+ /**
38725
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38726
+ * same intent on the ITU-T scale (D460).
38727
+ *
38728
+ * ## When this applies, and when it is the wrong thing to reach for
38729
+ *
38730
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38731
+ * them converts:
38732
+ *
38733
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38734
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38735
+ * after. The defect was never in the number; it was that 19 of this hub's
38736
+ * 25 cameras did not obey it. Converting such a number takes something
38737
+ * correct and makes it wrong, in order to preserve a bug.
38738
+ * - **A measurement taken through the old decoder** — a value someone read
38739
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38740
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38741
+ * louder. That is what this function is for.
38742
+ *
38743
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38744
+ * and it cannot be answered from the number. It is answered by the comment the
38745
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38746
+ * mandatory.
38747
+ *
38748
+ * ## Why a function and not a typed-in number
38749
+ *
38750
+ * `-55 + 12.04` written into a source file is, six months later, completely
38751
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38752
+ * keeps the derivation, the law, and the original measurement all visible at
38753
+ * the call site, so a future reader can disagree with the *premise* instead of
38754
+ * having to reverse-engineer the sum.
38755
+ *
38756
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38757
+ * it is declared. It must never be applied to a live sample or a stored
38758
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38759
+ * adjusting numbers the decoder already got right is the original defect with
38760
+ * an extra place to argue with (D459).
38761
+ */
38762
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38763
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38764
+ }
38765
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38553
38766
  /** Schema defaults — an untouched sub-field must author exactly these. */
38554
38767
  var NC_AUDIO_DEFAULTS = {
38555
38768
  hitPercent: 60,
@@ -5419,6 +5419,86 @@ var ZodIssueCode = {
5419
5419
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5420
5420
  var ZodFirstPartyTypeKind;
5421
5421
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5422
+ //#endregion
5423
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5424
+ /**
5425
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5426
+ * window to float samples (D455).
5427
+ *
5428
+ * ## Why a format at all
5429
+ *
5430
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5431
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5432
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5433
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5434
+ * the plane carried four times the source. The plane crosses hub-main twice on
5435
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5436
+ *
5437
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5438
+ * them where it needs them. That is the same argument D450 made for the rate,
5439
+ * one step further along the same wire.
5440
+ *
5441
+ * ## Why the expansion lives here
5442
+ *
5443
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5444
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5445
+ * `AudioChunkPlane` expands per subscription) and
5446
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5447
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5448
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5449
+ * into their own dist (`self-contained` externals), so this travels with a
5450
+ * `camstack deploy` and needs no published server.
5451
+ *
5452
+ * A second μ-law table anywhere else is the defect this module exists to
5453
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5454
+ * direction for the WebRTC egress — a different transform, not a copy.)
5455
+ *
5456
+ * ## Absent means f32le
5457
+ *
5458
+ * `format` is optional on the wire and its absence means `f32le` — today's
5459
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5460
+ * has always been served, because the broker only emits a coded window to a
5461
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5462
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5463
+ * deployable one addon at a time across three nodes.
5464
+ */
5465
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5466
+ var AUDIO_CHUNK_FORMATS = [
5467
+ "f32le",
5468
+ "pcmu",
5469
+ "pcma"
5470
+ ];
5471
+ /**
5472
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5473
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5474
+ *
5475
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5476
+ * it buffers the coded bytes and the plane's consumers expand.
5477
+ */
5478
+ function buildUlawTable() {
5479
+ const table = new Float32Array(256);
5480
+ for (let i = 0; i < 256; i++) {
5481
+ const complemented = ~i & 255;
5482
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5483
+ const exponent = complemented >> 4 & 7;
5484
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5485
+ }
5486
+ return table;
5487
+ }
5488
+ /** Build the A-law decode table (ITU-T G.711). */
5489
+ function buildAlawTable() {
5490
+ const table = new Float32Array(256);
5491
+ for (let i = 0; i < 256; i++) {
5492
+ const xored = i ^ 85;
5493
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5494
+ const exponent = xored >> 4 & 7;
5495
+ const mantissa = xored & 15;
5496
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5497
+ }
5498
+ return table;
5499
+ }
5500
+ buildUlawTable();
5501
+ buildAlawTable();
5422
5502
  Object.fromEntries([
5423
5503
  {
5424
5504
  id: "overview",
@@ -6711,11 +6791,20 @@ var SubscribeFramesResultSchema = object({
6711
6791
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6712
6792
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6713
6793
  */
6794
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6714
6795
  var DecodedAudioChunkSchema = object({
6715
6796
  data: _instanceof(Uint8Array),
6716
6797
  sampleRate: number().int().positive(),
6717
6798
  channels: number().int().positive(),
6718
- timestamp: number()
6799
+ timestamp: number(),
6800
+ /**
6801
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6802
+ * byte, for any peer that never heard of this field. A coded window
6803
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6804
+ * subscription that DECLARED it accepts one, so absence can never mean
6805
+ * "coded bytes a consumer will read as floats" (D455).
6806
+ */
6807
+ format: AudioChunkFormatSchema.optional()
6719
6808
  });
6720
6809
  /**
6721
6810
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6727,7 +6816,18 @@ var DecodedAudioChunkSchema = object({
6727
6816
  var SubscribeAudioChunksInputSchema = object({
6728
6817
  brokerId: string(),
6729
6818
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6730
- tag: string().optional()
6819
+ tag: string().optional(),
6820
+ /**
6821
+ * Byte formats this subscriber can READ, best first. The broker serves the
6822
+ * chunk's own format when it is in this list and expands to `f32le`
6823
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6824
+ *
6825
+ * Absent (or without the source format) means `f32le` — the behaviour every
6826
+ * subscriber had before D455, unchanged. This is the negotiation half of
6827
+ * the source-bytes lever: it is what lets the broker and its consumers
6828
+ * deploy one at a time across three nodes.
6829
+ */
6830
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6731
6831
  });
6732
6832
  /** Result of `stream-broker.subscribeAudioChunks`. */
6733
6833
  var SubscribeAudioChunksResultSchema = object({
@@ -10856,6 +10956,51 @@ var AudioAnalysisSettingsSchema = object({
10856
10956
  minConfidence: number().min(0).max(1).default(.3),
10857
10957
  allowedClasses: array(string()).default([])
10858
10958
  });
10959
+ /**
10960
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10961
+ *
10962
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10963
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10964
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10965
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10966
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10967
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10968
+ * way to the one expansion that feeds the model.
10969
+ *
10970
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10971
+ * window, the per-device node assignment, the settings read) and therefore
10972
+ * still owns the attach/detach pair. It no longer owns the bytes.
10973
+ */
10974
+ var AudioAttachDeviceInputSchema = object({
10975
+ deviceId: number(),
10976
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10977
+ brokerId: string(),
10978
+ /**
10979
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10980
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10981
+ * the orchestrator's poller pinned them before the move.
10982
+ */
10983
+ ingestNodeId: string(),
10984
+ /**
10985
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10986
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10987
+ * window: a settings change re-attaches, which is what always happened.
10988
+ */
10989
+ settings: AudioAnalysisSettingsSchema
10990
+ });
10991
+ var AudioAttachDeviceResultSchema = object({
10992
+ /** False only when the analyzer is shutting down and refused to attach. */
10993
+ attached: boolean(),
10994
+ /**
10995
+ * True when the attachment replaced a live one for the same device. An
10996
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10997
+ * double the broker's fanout and neither would know about the other.
10998
+ */
10999
+ replaced: boolean()
11000
+ });
11001
+ var AudioDetachDeviceResultSchema = object({
11002
+ /** False when no attachment existed — detach is idempotent. */
11003
+ detached: boolean() });
10859
11004
  var AudioClassificationResultSchema = object({
10860
11005
  labels: array(AudioClassificationLabelSchema).readonly(),
10861
11006
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10864,7 +11009,7 @@ var AudioClassificationResultSchema = object({
10864
11009
  method(object({
10865
11010
  chunk: AudioChunkInputSchema,
10866
11011
  settings: AudioAnalysisSettingsSchema
10867
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
11012
+ }), 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() }), {
10868
11013
  kind: "mutation",
10869
11014
  auth: "admin"
10870
11015
  });
@@ -25065,8 +25210,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
25065
25210
  *
25066
25211
  * An **empty array reads NOTHING** — `[]` is an empty page, never
25067
25212
  * "every camera". A request for no devices is a request, not an
25068
- * omission; same contract as `deviceManager.listFleet` and
25069
- * `pipelineAnalytics.listRecentTracks`.
25213
+ * omission; same contract as `deviceManager.listAll`'s `deviceIds`
25214
+ * and `pipelineAnalytics.listRecentTracks`.
25070
25215
  *
25071
25216
  * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
25072
25217
  */
@@ -30841,12 +30986,24 @@ Object.freeze({
30841
30986
  addonId: null,
30842
30987
  access: "create"
30843
30988
  },
30989
+ "audioAnalyzer.attachDevice": {
30990
+ capName: "audio-analyzer",
30991
+ capScope: "system",
30992
+ addonId: null,
30993
+ access: "create"
30994
+ },
30844
30995
  "audioAnalyzer.classify": {
30845
30996
  capName: "audio-analyzer",
30846
30997
  capScope: "system",
30847
30998
  addonId: null,
30848
30999
  access: "view"
30849
31000
  },
31001
+ "audioAnalyzer.detachDevice": {
31002
+ capName: "audio-analyzer",
31003
+ capScope: "system",
31004
+ addonId: null,
31005
+ access: "create"
31006
+ },
30850
31007
  "audioAnalyzer.dispose": {
30851
31008
  capName: "audio-analyzer",
30852
31009
  capScope: "system",
@@ -36690,11 +36847,21 @@ Object.freeze({
36690
36847
  form: "single",
36691
36848
  optional: false
36692
36849
  }],
36850
+ "audioAnalyzer.attachDevice": [{
36851
+ name: "deviceId",
36852
+ form: "single",
36853
+ optional: false
36854
+ }],
36693
36855
  "audioAnalyzer.classify": [{
36694
36856
  name: "deviceId",
36695
36857
  form: "single",
36696
36858
  optional: true
36697
36859
  }],
36860
+ "audioAnalyzer.detachDevice": [{
36861
+ name: "deviceId",
36862
+ form: "single",
36863
+ optional: false
36864
+ }],
36698
36865
  "audioMetrics.getCurrentSnapshot": [{
36699
36866
  name: "deviceId",
36700
36867
  form: "single",
@@ -38546,6 +38713,52 @@ Object.freeze({
38546
38713
  "network-access": "ingress",
38547
38714
  "smtp-provider": "email"
38548
38715
  });
38716
+ var G711_SCALE_CORRECTION_DB = {
38717
+ PCMU: 20 * Math.log10(4),
38718
+ PCMA: 20 * Math.log10(8)
38719
+ };
38720
+ /**
38721
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38722
+ * same intent on the ITU-T scale (D460).
38723
+ *
38724
+ * ## When this applies, and when it is the wrong thing to reach for
38725
+ *
38726
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38727
+ * them converts:
38728
+ *
38729
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38730
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38731
+ * after. The defect was never in the number; it was that 19 of this hub's
38732
+ * 25 cameras did not obey it. Converting such a number takes something
38733
+ * correct and makes it wrong, in order to preserve a bug.
38734
+ * - **A measurement taken through the old decoder** — a value someone read
38735
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38736
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38737
+ * louder. That is what this function is for.
38738
+ *
38739
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38740
+ * and it cannot be answered from the number. It is answered by the comment the
38741
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38742
+ * mandatory.
38743
+ *
38744
+ * ## Why a function and not a typed-in number
38745
+ *
38746
+ * `-55 + 12.04` written into a source file is, six months later, completely
38747
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38748
+ * keeps the derivation, the law, and the original measurement all visible at
38749
+ * the call site, so a future reader can disagree with the *premise* instead of
38750
+ * having to reverse-engineer the sum.
38751
+ *
38752
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38753
+ * it is declared. It must never be applied to a live sample or a stored
38754
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38755
+ * adjusting numbers the decoder already got right is the original defect with
38756
+ * an extra place to argue with (D459).
38757
+ */
38758
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38759
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38760
+ }
38761
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38549
38762
  /** Schema defaults — an untouched sub-field must author exactly these. */
38550
38763
  var NC_AUDIO_DEFAULTS = {
38551
38764
  hitPercent: 60,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "description": "Google Home export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",