@camstack/addon-provider-homeassistant 1.2.111 → 1.2.113
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 +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-BDR9sTVd.mjs → dist-65xKnX_d.mjs} +247 -5
- package/dist/{dist-DW95a2hI.js → dist-DU9rYiaM.js} +247 -5
- package/dist/ha-export/ha-export.addon.js +1 -1
- package/dist/ha-export/ha-export.addon.mjs +1 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-DU9rYiaM.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_zlib = require("node:zlib");
|
|
5
5
|
//#region src/ha-device-source.ts
|
package/dist/addon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-
|
|
1
|
+
import { $ as presenceCapability, A as controlCapability, At as EventCategory, B as humiditySensorCapability, C as buildAddonRouteProvider, Ct as number, D as colorCapability, Dt as union, E as climateControlCapability, Et as string, F as eventEmitterCapability, G as motionCapability, H as lawnMowerControlCapability, I as fanControlCapability, J as notifierCapability, K as normalizeUnit, L as floodCapability, M as deviceAdoptionCapability, O as connectivityCapability, Ot as unknown, P as enumSensorCapability, Q as prepareNotification, R as gasCapability, S as brokerCapability, St as literal, T as carbonMonoxideCapability, Tt as record, U as lockControlCapability, V as imageCapability, W as mediaPlayerCapability, Y as numericSensorCapability, Z as powerMeterCapability, _ as automationControlCapability, _t as createEvent, at as temperatureSensorCapability, b as binaryCapability, bt as array, ct as valveCapability, d as TargetSchema, dt as weatherCapability, et as pressureSensorCapability, f as accessoriesCapability, ft as errMsg, g as ambientLightSensorCapability, gt as DeviceType, h as alarmPanelCapability, ht as DeviceRole, it as tamperCapability, j as coverCapability, k as contactCapability, kt as url, lt as vibrationCapability, m as airQualitySensorCapability, mt as DeviceFeature, n as BaseDevice, nt as smokeCapability, ot as updateCapability, p as addonRoutesCapability, q as notificationOutputCapability, r as BaseDeviceProvider, rt as switchCapability, s as EnumSensorDateTimeFormatSchema, st as vacuumControlCapability, tt as scriptRunnerCapability, ut as waterHeaterCapability, v as batteryCapability, w as buttonCapability, wt as object, x as brightnessCapability, xt as discriminatedUnion, y as bestLocationMatch, yt as _enum, z as humidifierCapability } from "./dist-65xKnX_d.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
|
|
4
4
|
//#region src/ha-device-source.ts
|
|
@@ -5344,6 +5344,86 @@ var ZodIssueCode = {
|
|
|
5344
5344
|
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
5345
5345
|
var ZodFirstPartyTypeKind;
|
|
5346
5346
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5347
|
+
//#endregion
|
|
5348
|
+
//#region ../types/dist/sleep-BnujYGPe.mjs
|
|
5349
|
+
/**
|
|
5350
|
+
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5351
|
+
* window to float samples (D455).
|
|
5352
|
+
*
|
|
5353
|
+
* ## Why a format at all
|
|
5354
|
+
*
|
|
5355
|
+
* D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
|
|
5356
|
+
* RATE, and the one consumer that needs 16 kHz resamples next to the model.
|
|
5357
|
+
* It left the FORMAT alone — the broker still turned each G.711 byte into a
|
|
5358
|
+
* 4-byte f32le sample before the bytes entered the transport, so every leg of
|
|
5359
|
+
* the plane carried four times the source. The plane crosses hub-main twice on
|
|
5360
|
+
* the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
|
|
5361
|
+
*
|
|
5362
|
+
* So the plane carries the source BYTES too, and whoever needs floats expands
|
|
5363
|
+
* them where it needs them. That is the same argument D450 made for the rate,
|
|
5364
|
+
* one step further along the same wire.
|
|
5365
|
+
*
|
|
5366
|
+
* ## Why the expansion lives here
|
|
5367
|
+
*
|
|
5368
|
+
* Two packages need it and they must never disagree: `addon-pipeline`'s broker
|
|
5369
|
+
* (which still has to serve a subscriber that did NOT ask for coded bytes —
|
|
5370
|
+
* `AudioChunkPlane` expands per subscription) and
|
|
5371
|
+
* `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
|
|
5372
|
+
* f32le window to the analyzer cap, whose `AudioChunkInput` contract is
|
|
5373
|
+
* unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
|
|
5374
|
+
* into their own dist (`self-contained` externals), so this travels with a
|
|
5375
|
+
* `camstack deploy` and needs no published server.
|
|
5376
|
+
*
|
|
5377
|
+
* A second μ-law table anywhere else is the defect this module exists to
|
|
5378
|
+
* prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
|
|
5379
|
+
* direction for the WebRTC egress — a different transform, not a copy.)
|
|
5380
|
+
*
|
|
5381
|
+
* ## Absent means f32le
|
|
5382
|
+
*
|
|
5383
|
+
* `format` is optional on the wire and its absence means `f32le` — today's
|
|
5384
|
+
* bytes, byte for byte. A peer that never heard of the field is served what it
|
|
5385
|
+
* has always been served, because the broker only emits a coded window to a
|
|
5386
|
+
* subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
|
|
5387
|
+
* That is the D448 `rawForward` negotiation, and it is what makes this
|
|
5388
|
+
* deployable one addon at a time across three nodes.
|
|
5389
|
+
*/
|
|
5390
|
+
/** Every byte format the audio chunk plane can carry. `f32le` is the default. */
|
|
5391
|
+
var AUDIO_CHUNK_FORMATS = [
|
|
5392
|
+
"f32le",
|
|
5393
|
+
"pcmu",
|
|
5394
|
+
"pcma"
|
|
5395
|
+
];
|
|
5396
|
+
/**
|
|
5397
|
+
* Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
|
|
5398
|
+
* to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
|
|
5399
|
+
*
|
|
5400
|
+
* Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
|
|
5401
|
+
* it buffers the coded bytes and the plane's consumers expand.
|
|
5402
|
+
*/
|
|
5403
|
+
function buildUlawTable() {
|
|
5404
|
+
const table = new Float32Array(256);
|
|
5405
|
+
for (let i = 0; i < 256; i++) {
|
|
5406
|
+
const complemented = ~i & 255;
|
|
5407
|
+
const sign = (complemented & 128) !== 0 ? -1 : 1;
|
|
5408
|
+
const exponent = complemented >> 4 & 7;
|
|
5409
|
+
table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
|
|
5410
|
+
}
|
|
5411
|
+
return table;
|
|
5412
|
+
}
|
|
5413
|
+
/** Build the A-law decode table (ITU-T G.711). */
|
|
5414
|
+
function buildAlawTable() {
|
|
5415
|
+
const table = new Float32Array(256);
|
|
5416
|
+
for (let i = 0; i < 256; i++) {
|
|
5417
|
+
const xored = i ^ 85;
|
|
5418
|
+
const sign = (xored & 128) !== 0 ? 1 : -1;
|
|
5419
|
+
const exponent = xored >> 4 & 7;
|
|
5420
|
+
const mantissa = xored & 15;
|
|
5421
|
+
table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
|
|
5422
|
+
}
|
|
5423
|
+
return table;
|
|
5424
|
+
}
|
|
5425
|
+
buildUlawTable();
|
|
5426
|
+
buildAlawTable();
|
|
5347
5427
|
Object.fromEntries([
|
|
5348
5428
|
{
|
|
5349
5429
|
id: "overview",
|
|
@@ -6636,11 +6716,20 @@ var SubscribeFramesResultSchema = object({
|
|
|
6636
6716
|
* (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
|
|
6637
6717
|
* / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
|
|
6638
6718
|
*/
|
|
6719
|
+
var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
|
|
6639
6720
|
var DecodedAudioChunkSchema = object({
|
|
6640
6721
|
data: _instanceof(Uint8Array),
|
|
6641
6722
|
sampleRate: number().int().positive(),
|
|
6642
6723
|
channels: number().int().positive(),
|
|
6643
|
-
timestamp: number()
|
|
6724
|
+
timestamp: number(),
|
|
6725
|
+
/**
|
|
6726
|
+
* Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
|
|
6727
|
+
* byte, for any peer that never heard of this field. A coded window
|
|
6728
|
+
* (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
|
|
6729
|
+
* subscription that DECLARED it accepts one, so absence can never mean
|
|
6730
|
+
* "coded bytes a consumer will read as floats" (D455).
|
|
6731
|
+
*/
|
|
6732
|
+
format: AudioChunkFormatSchema.optional()
|
|
6644
6733
|
});
|
|
6645
6734
|
/**
|
|
6646
6735
|
* Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
|
|
@@ -6652,7 +6741,18 @@ var DecodedAudioChunkSchema = object({
|
|
|
6652
6741
|
var SubscribeAudioChunksInputSchema = object({
|
|
6653
6742
|
brokerId: string(),
|
|
6654
6743
|
/** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
|
|
6655
|
-
tag: string().optional()
|
|
6744
|
+
tag: string().optional(),
|
|
6745
|
+
/**
|
|
6746
|
+
* Byte formats this subscriber can READ, best first. The broker serves the
|
|
6747
|
+
* chunk's own format when it is in this list and expands to `f32le`
|
|
6748
|
+
* otherwise, so a subscriber is never handed bytes it cannot interpret.
|
|
6749
|
+
*
|
|
6750
|
+
* Absent (or without the source format) means `f32le` — the behaviour every
|
|
6751
|
+
* subscriber had before D455, unchanged. This is the negotiation half of
|
|
6752
|
+
* the source-bytes lever: it is what lets the broker and its consumers
|
|
6753
|
+
* deploy one at a time across three nodes.
|
|
6754
|
+
*/
|
|
6755
|
+
accept: array(AudioChunkFormatSchema).readonly().optional()
|
|
6656
6756
|
});
|
|
6657
6757
|
/** Result of `stream-broker.subscribeAudioChunks`. */
|
|
6658
6758
|
var SubscribeAudioChunksResultSchema = object({
|
|
@@ -10863,6 +10963,51 @@ var AudioAnalysisSettingsSchema = object({
|
|
|
10863
10963
|
minConfidence: number().min(0).max(1).default(.3),
|
|
10864
10964
|
allowedClasses: array(string()).default([])
|
|
10865
10965
|
});
|
|
10966
|
+
/**
|
|
10967
|
+
* `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
|
|
10968
|
+
*
|
|
10969
|
+
* Until D461 the orchestrator drained the broker's chunk plane, accumulated
|
|
10970
|
+
* ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
|
|
10971
|
+
* nor consumed the audio: the PCM crossed hub-main twice for a process that
|
|
10972
|
+
* only buffered it. `attachDevice` inverts the direction — the analyzer opens
|
|
10973
|
+
* its own `subscribeAudioChunks` against the broker and the subscriber IS the
|
|
10974
|
+
* decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
|
|
10975
|
+
* way to the one expansion that feeds the model.
|
|
10976
|
+
*
|
|
10977
|
+
* The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
|
|
10978
|
+
* window, the per-device node assignment, the settings read) and therefore
|
|
10979
|
+
* still owns the attach/detach pair. It no longer owns the bytes.
|
|
10980
|
+
*/
|
|
10981
|
+
var AudioAttachDeviceInputSchema = object({
|
|
10982
|
+
deviceId: number(),
|
|
10983
|
+
/** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
|
|
10984
|
+
brokerId: string(),
|
|
10985
|
+
/**
|
|
10986
|
+
* `clusterRoles.ingestNode` — the node whose broker owns the source dial.
|
|
10987
|
+
* Every `streamBroker` call the attachment makes is pinned to it, exactly as
|
|
10988
|
+
* the orchestrator's poller pinned them before the move.
|
|
10989
|
+
*/
|
|
10990
|
+
ingestNodeId: string(),
|
|
10991
|
+
/**
|
|
10992
|
+
* Resolved once by the orchestrator at attach time, exactly as it was read
|
|
10993
|
+
* once per subscription before D461. The analyzer does NOT re-resolve per
|
|
10994
|
+
* window: a settings change re-attaches, which is what always happened.
|
|
10995
|
+
*/
|
|
10996
|
+
settings: AudioAnalysisSettingsSchema
|
|
10997
|
+
});
|
|
10998
|
+
var AudioAttachDeviceResultSchema = object({
|
|
10999
|
+
/** False only when the analyzer is shutting down and refused to attach. */
|
|
11000
|
+
attached: boolean(),
|
|
11001
|
+
/**
|
|
11002
|
+
* True when the attachment replaced a live one for the same device. An
|
|
11003
|
+
* attach is idempotent by REPLACEMENT — two pollers on one camera would
|
|
11004
|
+
* double the broker's fanout and neither would know about the other.
|
|
11005
|
+
*/
|
|
11006
|
+
replaced: boolean()
|
|
11007
|
+
});
|
|
11008
|
+
var AudioDetachDeviceResultSchema = object({
|
|
11009
|
+
/** False when no attachment existed — detach is idempotent. */
|
|
11010
|
+
detached: boolean() });
|
|
10866
11011
|
var AudioClassificationResultSchema = object({
|
|
10867
11012
|
labels: array(AudioClassificationLabelSchema).readonly(),
|
|
10868
11013
|
rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
|
|
@@ -10871,7 +11016,7 @@ var AudioClassificationResultSchema = object({
|
|
|
10871
11016
|
method(object({
|
|
10872
11017
|
chunk: AudioChunkInputSchema,
|
|
10873
11018
|
settings: AudioAnalysisSettingsSchema
|
|
10874
|
-
}), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
|
|
11019
|
+
}), 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() }), {
|
|
10875
11020
|
kind: "mutation",
|
|
10876
11021
|
auth: "admin"
|
|
10877
11022
|
});
|
|
@@ -20941,6 +21086,14 @@ var NativeCropResultSchema = object({
|
|
|
20941
21086
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
20942
21087
|
*/
|
|
20943
21088
|
jpeg: string().optional(),
|
|
21089
|
+
/**
|
|
21090
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
21091
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
21092
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
21093
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
21094
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
21095
|
+
*/
|
|
21096
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20944
21097
|
width: number().int().positive(),
|
|
20945
21098
|
height: number().int().positive(),
|
|
20946
21099
|
/**
|
|
@@ -21007,7 +21160,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
21007
21160
|
})]);
|
|
21008
21161
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
21009
21162
|
var ParkedTrackFrameSchema = object({
|
|
21010
|
-
|
|
21163
|
+
/**
|
|
21164
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
21165
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
21166
|
+
* Exactly one of the two is present.
|
|
21167
|
+
*/
|
|
21168
|
+
jpeg: string().optional(),
|
|
21169
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
21170
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21011
21171
|
width: number().int().positive(),
|
|
21012
21172
|
height: number().int().positive(),
|
|
21013
21173
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -21594,6 +21754,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21594
21754
|
bbox: NativeCropBboxSchema,
|
|
21595
21755
|
maxWidth: number().int().positive().optional(),
|
|
21596
21756
|
/**
|
|
21757
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21758
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21759
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21760
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21761
|
+
*/
|
|
21762
|
+
acceptJpegBytes: boolean().optional(),
|
|
21763
|
+
/**
|
|
21597
21764
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
21598
21765
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
21599
21766
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -21661,7 +21828,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21661
21828
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
21662
21829
|
deviceId: number(),
|
|
21663
21830
|
trackId: string(),
|
|
21664
|
-
kind: ParkedFrameKindSchema
|
|
21831
|
+
kind: ParkedFrameKindSchema,
|
|
21832
|
+
/**
|
|
21833
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21834
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21835
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21836
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21837
|
+
*/
|
|
21838
|
+
acceptJpegBytes: boolean().optional()
|
|
21665
21839
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
21666
21840
|
deviceId: number(),
|
|
21667
21841
|
trackId: string()
|
|
@@ -35385,12 +35559,24 @@ Object.freeze({
|
|
|
35385
35559
|
addonId: null,
|
|
35386
35560
|
access: "create"
|
|
35387
35561
|
},
|
|
35562
|
+
"audioAnalyzer.attachDevice": {
|
|
35563
|
+
capName: "audio-analyzer",
|
|
35564
|
+
capScope: "system",
|
|
35565
|
+
addonId: null,
|
|
35566
|
+
access: "create"
|
|
35567
|
+
},
|
|
35388
35568
|
"audioAnalyzer.classify": {
|
|
35389
35569
|
capName: "audio-analyzer",
|
|
35390
35570
|
capScope: "system",
|
|
35391
35571
|
addonId: null,
|
|
35392
35572
|
access: "view"
|
|
35393
35573
|
},
|
|
35574
|
+
"audioAnalyzer.detachDevice": {
|
|
35575
|
+
capName: "audio-analyzer",
|
|
35576
|
+
capScope: "system",
|
|
35577
|
+
addonId: null,
|
|
35578
|
+
access: "create"
|
|
35579
|
+
},
|
|
35394
35580
|
"audioAnalyzer.dispose": {
|
|
35395
35581
|
capName: "audio-analyzer",
|
|
35396
35582
|
capScope: "system",
|
|
@@ -41234,11 +41420,21 @@ Object.freeze({
|
|
|
41234
41420
|
form: "single",
|
|
41235
41421
|
optional: false
|
|
41236
41422
|
}],
|
|
41423
|
+
"audioAnalyzer.attachDevice": [{
|
|
41424
|
+
name: "deviceId",
|
|
41425
|
+
form: "single",
|
|
41426
|
+
optional: false
|
|
41427
|
+
}],
|
|
41237
41428
|
"audioAnalyzer.classify": [{
|
|
41238
41429
|
name: "deviceId",
|
|
41239
41430
|
form: "single",
|
|
41240
41431
|
optional: true
|
|
41241
41432
|
}],
|
|
41433
|
+
"audioAnalyzer.detachDevice": [{
|
|
41434
|
+
name: "deviceId",
|
|
41435
|
+
form: "single",
|
|
41436
|
+
optional: false
|
|
41437
|
+
}],
|
|
41242
41438
|
"audioMetrics.getCurrentSnapshot": [{
|
|
41243
41439
|
name: "deviceId",
|
|
41244
41440
|
form: "single",
|
|
@@ -43090,6 +43286,52 @@ Object.freeze({
|
|
|
43090
43286
|
"network-access": "ingress",
|
|
43091
43287
|
"smtp-provider": "email"
|
|
43092
43288
|
});
|
|
43289
|
+
var G711_SCALE_CORRECTION_DB = {
|
|
43290
|
+
PCMU: 20 * Math.log10(4),
|
|
43291
|
+
PCMA: 20 * Math.log10(8)
|
|
43292
|
+
};
|
|
43293
|
+
/**
|
|
43294
|
+
* Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
|
|
43295
|
+
* same intent on the ITU-T scale (D460).
|
|
43296
|
+
*
|
|
43297
|
+
* ## When this applies, and when it is the wrong thing to reach for
|
|
43298
|
+
*
|
|
43299
|
+
* An absolute-dBFS number in this repo is one of two things, and only one of
|
|
43300
|
+
* them converts:
|
|
43301
|
+
*
|
|
43302
|
+
* - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
|
|
43303
|
+
* is loud". It was true on the ITU-T scale before the epoch and it is true
|
|
43304
|
+
* after. The defect was never in the number; it was that 19 of this hub's
|
|
43305
|
+
* 25 cameras did not obey it. Converting such a number takes something
|
|
43306
|
+
* correct and makes it wrong, in order to preserve a bug.
|
|
43307
|
+
* - **A measurement taken through the old decoder** — a value someone read
|
|
43308
|
+
* off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
|
|
43309
|
+
* describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
|
|
43310
|
+
* louder. That is what this function is for.
|
|
43311
|
+
*
|
|
43312
|
+
* Telling the two apart is a question about PROVENANCE, not about arithmetic,
|
|
43313
|
+
* and it cannot be answered from the number. It is answered by the comment the
|
|
43314
|
+
* author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
|
|
43315
|
+
* mandatory.
|
|
43316
|
+
*
|
|
43317
|
+
* ## Why a function and not a typed-in number
|
|
43318
|
+
*
|
|
43319
|
+
* `-55 + 12.04` written into a source file is, six months later, completely
|
|
43320
|
+
* indistinguishable from a threshold somebody simply preferred. Calling this
|
|
43321
|
+
* keeps the derivation, the law, and the original measurement all visible at
|
|
43322
|
+
* the call site, so a future reader can disagree with the *premise* instead of
|
|
43323
|
+
* having to reverse-engineer the sum.
|
|
43324
|
+
*
|
|
43325
|
+
* **This is not a runtime gain.** It converts an authored CONSTANT once, where
|
|
43326
|
+
* it is declared. It must never be applied to a live sample or a stored
|
|
43327
|
+
* `AudioEvent.dbfs`: the decoder is correct now, and a second authority
|
|
43328
|
+
* adjusting numbers the decoder already got right is the original defect with
|
|
43329
|
+
* an extra place to argue with (D459).
|
|
43330
|
+
*/
|
|
43331
|
+
function ituDbfsFromPreEpoch(law, authoredDbfs) {
|
|
43332
|
+
return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
|
|
43333
|
+
}
|
|
43334
|
+
Math.round(ituDbfsFromPreEpoch("PCMU", -55));
|
|
43093
43335
|
/** Schema defaults — an untouched sub-field must author exactly these. */
|
|
43094
43336
|
var NC_AUDIO_DEFAULTS = {
|
|
43095
43337
|
hitPercent: 60,
|
|
@@ -5344,6 +5344,86 @@ var ZodIssueCode = {
|
|
|
5344
5344
|
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
5345
5345
|
var ZodFirstPartyTypeKind;
|
|
5346
5346
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5347
|
+
//#endregion
|
|
5348
|
+
//#region ../types/dist/sleep-BnujYGPe.mjs
|
|
5349
|
+
/**
|
|
5350
|
+
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5351
|
+
* window to float samples (D455).
|
|
5352
|
+
*
|
|
5353
|
+
* ## Why a format at all
|
|
5354
|
+
*
|
|
5355
|
+
* D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
|
|
5356
|
+
* RATE, and the one consumer that needs 16 kHz resamples next to the model.
|
|
5357
|
+
* It left the FORMAT alone — the broker still turned each G.711 byte into a
|
|
5358
|
+
* 4-byte f32le sample before the bytes entered the transport, so every leg of
|
|
5359
|
+
* the plane carried four times the source. The plane crosses hub-main twice on
|
|
5360
|
+
* the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
|
|
5361
|
+
*
|
|
5362
|
+
* So the plane carries the source BYTES too, and whoever needs floats expands
|
|
5363
|
+
* them where it needs them. That is the same argument D450 made for the rate,
|
|
5364
|
+
* one step further along the same wire.
|
|
5365
|
+
*
|
|
5366
|
+
* ## Why the expansion lives here
|
|
5367
|
+
*
|
|
5368
|
+
* Two packages need it and they must never disagree: `addon-pipeline`'s broker
|
|
5369
|
+
* (which still has to serve a subscriber that did NOT ask for coded bytes —
|
|
5370
|
+
* `AudioChunkPlane` expands per subscription) and
|
|
5371
|
+
* `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
|
|
5372
|
+
* f32le window to the analyzer cap, whose `AudioChunkInput` contract is
|
|
5373
|
+
* unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
|
|
5374
|
+
* into their own dist (`self-contained` externals), so this travels with a
|
|
5375
|
+
* `camstack deploy` and needs no published server.
|
|
5376
|
+
*
|
|
5377
|
+
* A second μ-law table anywhere else is the defect this module exists to
|
|
5378
|
+
* prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
|
|
5379
|
+
* direction for the WebRTC egress — a different transform, not a copy.)
|
|
5380
|
+
*
|
|
5381
|
+
* ## Absent means f32le
|
|
5382
|
+
*
|
|
5383
|
+
* `format` is optional on the wire and its absence means `f32le` — today's
|
|
5384
|
+
* bytes, byte for byte. A peer that never heard of the field is served what it
|
|
5385
|
+
* has always been served, because the broker only emits a coded window to a
|
|
5386
|
+
* subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
|
|
5387
|
+
* That is the D448 `rawForward` negotiation, and it is what makes this
|
|
5388
|
+
* deployable one addon at a time across three nodes.
|
|
5389
|
+
*/
|
|
5390
|
+
/** Every byte format the audio chunk plane can carry. `f32le` is the default. */
|
|
5391
|
+
var AUDIO_CHUNK_FORMATS = [
|
|
5392
|
+
"f32le",
|
|
5393
|
+
"pcmu",
|
|
5394
|
+
"pcma"
|
|
5395
|
+
];
|
|
5396
|
+
/**
|
|
5397
|
+
* Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
|
|
5398
|
+
* to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
|
|
5399
|
+
*
|
|
5400
|
+
* Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
|
|
5401
|
+
* it buffers the coded bytes and the plane's consumers expand.
|
|
5402
|
+
*/
|
|
5403
|
+
function buildUlawTable() {
|
|
5404
|
+
const table = new Float32Array(256);
|
|
5405
|
+
for (let i = 0; i < 256; i++) {
|
|
5406
|
+
const complemented = ~i & 255;
|
|
5407
|
+
const sign = (complemented & 128) !== 0 ? -1 : 1;
|
|
5408
|
+
const exponent = complemented >> 4 & 7;
|
|
5409
|
+
table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
|
|
5410
|
+
}
|
|
5411
|
+
return table;
|
|
5412
|
+
}
|
|
5413
|
+
/** Build the A-law decode table (ITU-T G.711). */
|
|
5414
|
+
function buildAlawTable() {
|
|
5415
|
+
const table = new Float32Array(256);
|
|
5416
|
+
for (let i = 0; i < 256; i++) {
|
|
5417
|
+
const xored = i ^ 85;
|
|
5418
|
+
const sign = (xored & 128) !== 0 ? 1 : -1;
|
|
5419
|
+
const exponent = xored >> 4 & 7;
|
|
5420
|
+
const mantissa = xored & 15;
|
|
5421
|
+
table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
|
|
5422
|
+
}
|
|
5423
|
+
return table;
|
|
5424
|
+
}
|
|
5425
|
+
buildUlawTable();
|
|
5426
|
+
buildAlawTable();
|
|
5347
5427
|
Object.fromEntries([
|
|
5348
5428
|
{
|
|
5349
5429
|
id: "overview",
|
|
@@ -6636,11 +6716,20 @@ var SubscribeFramesResultSchema = object({
|
|
|
6636
6716
|
* (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
|
|
6637
6717
|
* / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
|
|
6638
6718
|
*/
|
|
6719
|
+
var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
|
|
6639
6720
|
var DecodedAudioChunkSchema = object({
|
|
6640
6721
|
data: _instanceof(Uint8Array),
|
|
6641
6722
|
sampleRate: number().int().positive(),
|
|
6642
6723
|
channels: number().int().positive(),
|
|
6643
|
-
timestamp: number()
|
|
6724
|
+
timestamp: number(),
|
|
6725
|
+
/**
|
|
6726
|
+
* Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
|
|
6727
|
+
* byte, for any peer that never heard of this field. A coded window
|
|
6728
|
+
* (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
|
|
6729
|
+
* subscription that DECLARED it accepts one, so absence can never mean
|
|
6730
|
+
* "coded bytes a consumer will read as floats" (D455).
|
|
6731
|
+
*/
|
|
6732
|
+
format: AudioChunkFormatSchema.optional()
|
|
6644
6733
|
});
|
|
6645
6734
|
/**
|
|
6646
6735
|
* Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
|
|
@@ -6652,7 +6741,18 @@ var DecodedAudioChunkSchema = object({
|
|
|
6652
6741
|
var SubscribeAudioChunksInputSchema = object({
|
|
6653
6742
|
brokerId: string(),
|
|
6654
6743
|
/** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
|
|
6655
|
-
tag: string().optional()
|
|
6744
|
+
tag: string().optional(),
|
|
6745
|
+
/**
|
|
6746
|
+
* Byte formats this subscriber can READ, best first. The broker serves the
|
|
6747
|
+
* chunk's own format when it is in this list and expands to `f32le`
|
|
6748
|
+
* otherwise, so a subscriber is never handed bytes it cannot interpret.
|
|
6749
|
+
*
|
|
6750
|
+
* Absent (or without the source format) means `f32le` — the behaviour every
|
|
6751
|
+
* subscriber had before D455, unchanged. This is the negotiation half of
|
|
6752
|
+
* the source-bytes lever: it is what lets the broker and its consumers
|
|
6753
|
+
* deploy one at a time across three nodes.
|
|
6754
|
+
*/
|
|
6755
|
+
accept: array(AudioChunkFormatSchema).readonly().optional()
|
|
6656
6756
|
});
|
|
6657
6757
|
/** Result of `stream-broker.subscribeAudioChunks`. */
|
|
6658
6758
|
var SubscribeAudioChunksResultSchema = object({
|
|
@@ -10863,6 +10963,51 @@ var AudioAnalysisSettingsSchema = object({
|
|
|
10863
10963
|
minConfidence: number().min(0).max(1).default(.3),
|
|
10864
10964
|
allowedClasses: array(string()).default([])
|
|
10865
10965
|
});
|
|
10966
|
+
/**
|
|
10967
|
+
* `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
|
|
10968
|
+
*
|
|
10969
|
+
* Until D461 the orchestrator drained the broker's chunk plane, accumulated
|
|
10970
|
+
* ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
|
|
10971
|
+
* nor consumed the audio: the PCM crossed hub-main twice for a process that
|
|
10972
|
+
* only buffered it. `attachDevice` inverts the direction — the analyzer opens
|
|
10973
|
+
* its own `subscribeAudioChunks` against the broker and the subscriber IS the
|
|
10974
|
+
* decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
|
|
10975
|
+
* way to the one expansion that feeds the model.
|
|
10976
|
+
*
|
|
10977
|
+
* The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
|
|
10978
|
+
* window, the per-device node assignment, the settings read) and therefore
|
|
10979
|
+
* still owns the attach/detach pair. It no longer owns the bytes.
|
|
10980
|
+
*/
|
|
10981
|
+
var AudioAttachDeviceInputSchema = object({
|
|
10982
|
+
deviceId: number(),
|
|
10983
|
+
/** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
|
|
10984
|
+
brokerId: string(),
|
|
10985
|
+
/**
|
|
10986
|
+
* `clusterRoles.ingestNode` — the node whose broker owns the source dial.
|
|
10987
|
+
* Every `streamBroker` call the attachment makes is pinned to it, exactly as
|
|
10988
|
+
* the orchestrator's poller pinned them before the move.
|
|
10989
|
+
*/
|
|
10990
|
+
ingestNodeId: string(),
|
|
10991
|
+
/**
|
|
10992
|
+
* Resolved once by the orchestrator at attach time, exactly as it was read
|
|
10993
|
+
* once per subscription before D461. The analyzer does NOT re-resolve per
|
|
10994
|
+
* window: a settings change re-attaches, which is what always happened.
|
|
10995
|
+
*/
|
|
10996
|
+
settings: AudioAnalysisSettingsSchema
|
|
10997
|
+
});
|
|
10998
|
+
var AudioAttachDeviceResultSchema = object({
|
|
10999
|
+
/** False only when the analyzer is shutting down and refused to attach. */
|
|
11000
|
+
attached: boolean(),
|
|
11001
|
+
/**
|
|
11002
|
+
* True when the attachment replaced a live one for the same device. An
|
|
11003
|
+
* attach is idempotent by REPLACEMENT — two pollers on one camera would
|
|
11004
|
+
* double the broker's fanout and neither would know about the other.
|
|
11005
|
+
*/
|
|
11006
|
+
replaced: boolean()
|
|
11007
|
+
});
|
|
11008
|
+
var AudioDetachDeviceResultSchema = object({
|
|
11009
|
+
/** False when no attachment existed — detach is idempotent. */
|
|
11010
|
+
detached: boolean() });
|
|
10866
11011
|
var AudioClassificationResultSchema = object({
|
|
10867
11012
|
labels: array(AudioClassificationLabelSchema).readonly(),
|
|
10868
11013
|
rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
|
|
@@ -10871,7 +11016,7 @@ var AudioClassificationResultSchema = object({
|
|
|
10871
11016
|
method(object({
|
|
10872
11017
|
chunk: AudioChunkInputSchema,
|
|
10873
11018
|
settings: AudioAnalysisSettingsSchema
|
|
10874
|
-
}), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
|
|
11019
|
+
}), 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() }), {
|
|
10875
11020
|
kind: "mutation",
|
|
10876
11021
|
auth: "admin"
|
|
10877
11022
|
});
|
|
@@ -20941,6 +21086,14 @@ var NativeCropResultSchema = object({
|
|
|
20941
21086
|
* set `encodeJpeg: true`; `bytes` is then absent.
|
|
20942
21087
|
*/
|
|
20943
21088
|
jpeg: string().optional(),
|
|
21089
|
+
/**
|
|
21090
|
+
* The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
|
|
21091
|
+
* `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
|
|
21092
|
+
* `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
|
|
21093
|
+
* `bytes` above has crossed this boundary as a `Uint8Array` all along — so
|
|
21094
|
+
* base64 was buying nothing but a multi-megabyte string in the relay's heap.
|
|
21095
|
+
*/
|
|
21096
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
20944
21097
|
width: number().int().positive(),
|
|
20945
21098
|
height: number().int().positive(),
|
|
20946
21099
|
/**
|
|
@@ -21007,7 +21160,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
|
|
|
21007
21160
|
})]);
|
|
21008
21161
|
/** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
|
|
21009
21162
|
var ParkedTrackFrameSchema = object({
|
|
21010
|
-
|
|
21163
|
+
/**
|
|
21164
|
+
* Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
|
|
21165
|
+
* `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
|
|
21166
|
+
* Exactly one of the two is present.
|
|
21167
|
+
*/
|
|
21168
|
+
jpeg: string().optional(),
|
|
21169
|
+
/** The same JPEG as bytes, for a caller that declared it reads them (D462). */
|
|
21170
|
+
jpegBytes: _instanceof(Uint8Array).optional(),
|
|
21011
21171
|
width: number().int().positive(),
|
|
21012
21172
|
height: number().int().positive(),
|
|
21013
21173
|
/** The frame instant the parcel shows (the caller's clock, echoed back). */
|
|
@@ -21594,6 +21754,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21594
21754
|
bbox: NativeCropBboxSchema,
|
|
21595
21755
|
maxWidth: number().int().positive().optional(),
|
|
21596
21756
|
/**
|
|
21757
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21758
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21759
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21760
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21761
|
+
*/
|
|
21762
|
+
acceptJpegBytes: boolean().optional(),
|
|
21763
|
+
/**
|
|
21597
21764
|
* When `true`, the runner encodes the resolved crop to JPEG ON THE
|
|
21598
21765
|
* OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
|
|
21599
21766
|
* Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
|
|
@@ -21661,7 +21828,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
|
|
|
21661
21828
|
}), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
|
|
21662
21829
|
deviceId: number(),
|
|
21663
21830
|
trackId: string(),
|
|
21664
|
-
kind: ParkedFrameKindSchema
|
|
21831
|
+
kind: ParkedFrameKindSchema,
|
|
21832
|
+
/**
|
|
21833
|
+
* The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
|
|
21834
|
+
* back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
|
|
21835
|
+
* wire — never assume consent: a pre-D462 caller parses the field as
|
|
21836
|
+
* base64 and bytes would decode to garbage rather than fail.
|
|
21837
|
+
*/
|
|
21838
|
+
acceptJpegBytes: boolean().optional()
|
|
21665
21839
|
}), ParkedTrackFrameSchema.nullable()), method(object({
|
|
21666
21840
|
deviceId: number(),
|
|
21667
21841
|
trackId: string()
|
|
@@ -35385,12 +35559,24 @@ Object.freeze({
|
|
|
35385
35559
|
addonId: null,
|
|
35386
35560
|
access: "create"
|
|
35387
35561
|
},
|
|
35562
|
+
"audioAnalyzer.attachDevice": {
|
|
35563
|
+
capName: "audio-analyzer",
|
|
35564
|
+
capScope: "system",
|
|
35565
|
+
addonId: null,
|
|
35566
|
+
access: "create"
|
|
35567
|
+
},
|
|
35388
35568
|
"audioAnalyzer.classify": {
|
|
35389
35569
|
capName: "audio-analyzer",
|
|
35390
35570
|
capScope: "system",
|
|
35391
35571
|
addonId: null,
|
|
35392
35572
|
access: "view"
|
|
35393
35573
|
},
|
|
35574
|
+
"audioAnalyzer.detachDevice": {
|
|
35575
|
+
capName: "audio-analyzer",
|
|
35576
|
+
capScope: "system",
|
|
35577
|
+
addonId: null,
|
|
35578
|
+
access: "create"
|
|
35579
|
+
},
|
|
35394
35580
|
"audioAnalyzer.dispose": {
|
|
35395
35581
|
capName: "audio-analyzer",
|
|
35396
35582
|
capScope: "system",
|
|
@@ -41234,11 +41420,21 @@ Object.freeze({
|
|
|
41234
41420
|
form: "single",
|
|
41235
41421
|
optional: false
|
|
41236
41422
|
}],
|
|
41423
|
+
"audioAnalyzer.attachDevice": [{
|
|
41424
|
+
name: "deviceId",
|
|
41425
|
+
form: "single",
|
|
41426
|
+
optional: false
|
|
41427
|
+
}],
|
|
41237
41428
|
"audioAnalyzer.classify": [{
|
|
41238
41429
|
name: "deviceId",
|
|
41239
41430
|
form: "single",
|
|
41240
41431
|
optional: true
|
|
41241
41432
|
}],
|
|
41433
|
+
"audioAnalyzer.detachDevice": [{
|
|
41434
|
+
name: "deviceId",
|
|
41435
|
+
form: "single",
|
|
41436
|
+
optional: false
|
|
41437
|
+
}],
|
|
41242
41438
|
"audioMetrics.getCurrentSnapshot": [{
|
|
41243
41439
|
name: "deviceId",
|
|
41244
41440
|
form: "single",
|
|
@@ -43090,6 +43286,52 @@ Object.freeze({
|
|
|
43090
43286
|
"network-access": "ingress",
|
|
43091
43287
|
"smtp-provider": "email"
|
|
43092
43288
|
});
|
|
43289
|
+
var G711_SCALE_CORRECTION_DB = {
|
|
43290
|
+
PCMU: 20 * Math.log10(4),
|
|
43291
|
+
PCMA: 20 * Math.log10(8)
|
|
43292
|
+
};
|
|
43293
|
+
/**
|
|
43294
|
+
* Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
|
|
43295
|
+
* same intent on the ITU-T scale (D460).
|
|
43296
|
+
*
|
|
43297
|
+
* ## When this applies, and when it is the wrong thing to reach for
|
|
43298
|
+
*
|
|
43299
|
+
* An absolute-dBFS number in this repo is one of two things, and only one of
|
|
43300
|
+
* them converts:
|
|
43301
|
+
*
|
|
43302
|
+
* - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
|
|
43303
|
+
* is loud". It was true on the ITU-T scale before the epoch and it is true
|
|
43304
|
+
* after. The defect was never in the number; it was that 19 of this hub's
|
|
43305
|
+
* 25 cameras did not obey it. Converting such a number takes something
|
|
43306
|
+
* correct and makes it wrong, in order to preserve a bug.
|
|
43307
|
+
* - **A measurement taken through the old decoder** — a value someone read
|
|
43308
|
+
* off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
|
|
43309
|
+
* describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
|
|
43310
|
+
* louder. That is what this function is for.
|
|
43311
|
+
*
|
|
43312
|
+
* Telling the two apart is a question about PROVENANCE, not about arithmetic,
|
|
43313
|
+
* and it cannot be answered from the number. It is answered by the comment the
|
|
43314
|
+
* author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
|
|
43315
|
+
* mandatory.
|
|
43316
|
+
*
|
|
43317
|
+
* ## Why a function and not a typed-in number
|
|
43318
|
+
*
|
|
43319
|
+
* `-55 + 12.04` written into a source file is, six months later, completely
|
|
43320
|
+
* indistinguishable from a threshold somebody simply preferred. Calling this
|
|
43321
|
+
* keeps the derivation, the law, and the original measurement all visible at
|
|
43322
|
+
* the call site, so a future reader can disagree with the *premise* instead of
|
|
43323
|
+
* having to reverse-engineer the sum.
|
|
43324
|
+
*
|
|
43325
|
+
* **This is not a runtime gain.** It converts an authored CONSTANT once, where
|
|
43326
|
+
* it is declared. It must never be applied to a live sample or a stored
|
|
43327
|
+
* `AudioEvent.dbfs`: the decoder is correct now, and a second authority
|
|
43328
|
+
* adjusting numbers the decoder already got right is the original defect with
|
|
43329
|
+
* an extra place to argue with (D459).
|
|
43330
|
+
*/
|
|
43331
|
+
function ituDbfsFromPreEpoch(law, authoredDbfs) {
|
|
43332
|
+
return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
|
|
43333
|
+
}
|
|
43334
|
+
Math.round(ituDbfsFromPreEpoch("PCMU", -55));
|
|
43093
43335
|
/** Schema defaults — an untouched sub-field must author exactly these. */
|
|
43094
43336
|
var NC_AUDIO_DEFAULTS = {
|
|
43095
43337
|
hitPercent: 60,
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
//#endregion
|
|
6
|
-
const require_dist = require("../dist-
|
|
6
|
+
const require_dist = require("../dist-DU9rYiaM.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
//#region src/ha-export/topics.ts
|
|
9
9
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-
|
|
1
|
+
import { At as EventCategory, C as buildAddonRouteProvider, Et as string, N as deviceExportCapability, X as oauthIntegrationCapability, a as COCO_TO_MACRO, c as FanDirectionSchema, i as CAMERA_SWITCH_ORDER, l as HvacModeSchema, o as CameraSwitchIdSchema, p as addonRoutesCapability, pt as BaseAddon, t as AlarmArmModeSchema, u as MediaPlayerRepeatSchema, vt as nodePin } from "../dist-65xKnX_d.mjs";
|
|
2
2
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
3
3
|
//#region src/ha-export/topics.ts
|
|
4
4
|
/**
|