@camstack/addon-smtp-nodemailer 1.2.93 → 1.2.95
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/smtp.addon.js +218 -5
- package/dist/smtp.addon.mjs +218 -5
- package/package.json +1 -1
package/dist/smtp.addon.js
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({
|
|
@@ -10662,6 +10762,51 @@ var AudioAnalysisSettingsSchema = object({
|
|
|
10662
10762
|
minConfidence: number().min(0).max(1).default(.3),
|
|
10663
10763
|
allowedClasses: array(string()).default([])
|
|
10664
10764
|
});
|
|
10765
|
+
/**
|
|
10766
|
+
* `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
|
|
10767
|
+
*
|
|
10768
|
+
* Until D461 the orchestrator drained the broker's chunk plane, accumulated
|
|
10769
|
+
* ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
|
|
10770
|
+
* nor consumed the audio: the PCM crossed hub-main twice for a process that
|
|
10771
|
+
* only buffered it. `attachDevice` inverts the direction — the analyzer opens
|
|
10772
|
+
* its own `subscribeAudioChunks` against the broker and the subscriber IS the
|
|
10773
|
+
* decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
|
|
10774
|
+
* way to the one expansion that feeds the model.
|
|
10775
|
+
*
|
|
10776
|
+
* The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
|
|
10777
|
+
* window, the per-device node assignment, the settings read) and therefore
|
|
10778
|
+
* still owns the attach/detach pair. It no longer owns the bytes.
|
|
10779
|
+
*/
|
|
10780
|
+
var AudioAttachDeviceInputSchema = object({
|
|
10781
|
+
deviceId: number(),
|
|
10782
|
+
/** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
|
|
10783
|
+
brokerId: string(),
|
|
10784
|
+
/**
|
|
10785
|
+
* `clusterRoles.ingestNode` — the node whose broker owns the source dial.
|
|
10786
|
+
* Every `streamBroker` call the attachment makes is pinned to it, exactly as
|
|
10787
|
+
* the orchestrator's poller pinned them before the move.
|
|
10788
|
+
*/
|
|
10789
|
+
ingestNodeId: string(),
|
|
10790
|
+
/**
|
|
10791
|
+
* Resolved once by the orchestrator at attach time, exactly as it was read
|
|
10792
|
+
* once per subscription before D461. The analyzer does NOT re-resolve per
|
|
10793
|
+
* window: a settings change re-attaches, which is what always happened.
|
|
10794
|
+
*/
|
|
10795
|
+
settings: AudioAnalysisSettingsSchema
|
|
10796
|
+
});
|
|
10797
|
+
var AudioAttachDeviceResultSchema = object({
|
|
10798
|
+
/** False only when the analyzer is shutting down and refused to attach. */
|
|
10799
|
+
attached: boolean(),
|
|
10800
|
+
/**
|
|
10801
|
+
* True when the attachment replaced a live one for the same device. An
|
|
10802
|
+
* attach is idempotent by REPLACEMENT — two pollers on one camera would
|
|
10803
|
+
* double the broker's fanout and neither would know about the other.
|
|
10804
|
+
*/
|
|
10805
|
+
replaced: boolean()
|
|
10806
|
+
});
|
|
10807
|
+
var AudioDetachDeviceResultSchema = object({
|
|
10808
|
+
/** False when no attachment existed — detach is idempotent. */
|
|
10809
|
+
detached: boolean() });
|
|
10665
10810
|
var AudioClassificationResultSchema = object({
|
|
10666
10811
|
labels: array(AudioClassificationLabelSchema).readonly(),
|
|
10667
10812
|
rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
|
|
@@ -10670,7 +10815,7 @@ var AudioClassificationResultSchema = object({
|
|
|
10670
10815
|
method(object({
|
|
10671
10816
|
chunk: AudioChunkInputSchema,
|
|
10672
10817
|
settings: AudioAnalysisSettingsSchema
|
|
10673
|
-
}), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
|
|
10818
|
+
}), 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() }), {
|
|
10674
10819
|
kind: "mutation",
|
|
10675
10820
|
auth: "admin"
|
|
10676
10821
|
});
|
|
@@ -24809,8 +24954,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
|
|
|
24809
24954
|
*
|
|
24810
24955
|
* An **empty array reads NOTHING** — `[]` is an empty page, never
|
|
24811
24956
|
* "every camera". A request for no devices is a request, not an
|
|
24812
|
-
* omission; same contract as `deviceManager.
|
|
24813
|
-
* `pipelineAnalytics.listRecentTracks`.
|
|
24957
|
+
* omission; same contract as `deviceManager.listAll`'s `deviceIds`
|
|
24958
|
+
* and `pipelineAnalytics.listRecentTracks`.
|
|
24814
24959
|
*
|
|
24815
24960
|
* Absent (`undefined`) is the omission, and keeps the cluster-wide view.
|
|
24816
24961
|
*/
|
|
@@ -30578,12 +30723,24 @@ Object.freeze({
|
|
|
30578
30723
|
addonId: null,
|
|
30579
30724
|
access: "create"
|
|
30580
30725
|
},
|
|
30726
|
+
"audioAnalyzer.attachDevice": {
|
|
30727
|
+
capName: "audio-analyzer",
|
|
30728
|
+
capScope: "system",
|
|
30729
|
+
addonId: null,
|
|
30730
|
+
access: "create"
|
|
30731
|
+
},
|
|
30581
30732
|
"audioAnalyzer.classify": {
|
|
30582
30733
|
capName: "audio-analyzer",
|
|
30583
30734
|
capScope: "system",
|
|
30584
30735
|
addonId: null,
|
|
30585
30736
|
access: "view"
|
|
30586
30737
|
},
|
|
30738
|
+
"audioAnalyzer.detachDevice": {
|
|
30739
|
+
capName: "audio-analyzer",
|
|
30740
|
+
capScope: "system",
|
|
30741
|
+
addonId: null,
|
|
30742
|
+
access: "create"
|
|
30743
|
+
},
|
|
30587
30744
|
"audioAnalyzer.dispose": {
|
|
30588
30745
|
capName: "audio-analyzer",
|
|
30589
30746
|
capScope: "system",
|
|
@@ -36427,11 +36584,21 @@ Object.freeze({
|
|
|
36427
36584
|
form: "single",
|
|
36428
36585
|
optional: false
|
|
36429
36586
|
}],
|
|
36587
|
+
"audioAnalyzer.attachDevice": [{
|
|
36588
|
+
name: "deviceId",
|
|
36589
|
+
form: "single",
|
|
36590
|
+
optional: false
|
|
36591
|
+
}],
|
|
36430
36592
|
"audioAnalyzer.classify": [{
|
|
36431
36593
|
name: "deviceId",
|
|
36432
36594
|
form: "single",
|
|
36433
36595
|
optional: true
|
|
36434
36596
|
}],
|
|
36597
|
+
"audioAnalyzer.detachDevice": [{
|
|
36598
|
+
name: "deviceId",
|
|
36599
|
+
form: "single",
|
|
36600
|
+
optional: false
|
|
36601
|
+
}],
|
|
36435
36602
|
"audioMetrics.getCurrentSnapshot": [{
|
|
36436
36603
|
name: "deviceId",
|
|
36437
36604
|
form: "single",
|
|
@@ -38283,6 +38450,52 @@ Object.freeze({
|
|
|
38283
38450
|
"network-access": "ingress",
|
|
38284
38451
|
"smtp-provider": "email"
|
|
38285
38452
|
});
|
|
38453
|
+
var G711_SCALE_CORRECTION_DB = {
|
|
38454
|
+
PCMU: 20 * Math.log10(4),
|
|
38455
|
+
PCMA: 20 * Math.log10(8)
|
|
38456
|
+
};
|
|
38457
|
+
/**
|
|
38458
|
+
* Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
|
|
38459
|
+
* same intent on the ITU-T scale (D460).
|
|
38460
|
+
*
|
|
38461
|
+
* ## When this applies, and when it is the wrong thing to reach for
|
|
38462
|
+
*
|
|
38463
|
+
* An absolute-dBFS number in this repo is one of two things, and only one of
|
|
38464
|
+
* them converts:
|
|
38465
|
+
*
|
|
38466
|
+
* - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
|
|
38467
|
+
* is loud". It was true on the ITU-T scale before the epoch and it is true
|
|
38468
|
+
* after. The defect was never in the number; it was that 19 of this hub's
|
|
38469
|
+
* 25 cameras did not obey it. Converting such a number takes something
|
|
38470
|
+
* correct and makes it wrong, in order to preserve a bug.
|
|
38471
|
+
* - **A measurement taken through the old decoder** — a value someone read
|
|
38472
|
+
* off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
|
|
38473
|
+
* describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
|
|
38474
|
+
* louder. That is what this function is for.
|
|
38475
|
+
*
|
|
38476
|
+
* Telling the two apart is a question about PROVENANCE, not about arithmetic,
|
|
38477
|
+
* and it cannot be answered from the number. It is answered by the comment the
|
|
38478
|
+
* author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
|
|
38479
|
+
* mandatory.
|
|
38480
|
+
*
|
|
38481
|
+
* ## Why a function and not a typed-in number
|
|
38482
|
+
*
|
|
38483
|
+
* `-55 + 12.04` written into a source file is, six months later, completely
|
|
38484
|
+
* indistinguishable from a threshold somebody simply preferred. Calling this
|
|
38485
|
+
* keeps the derivation, the law, and the original measurement all visible at
|
|
38486
|
+
* the call site, so a future reader can disagree with the *premise* instead of
|
|
38487
|
+
* having to reverse-engineer the sum.
|
|
38488
|
+
*
|
|
38489
|
+
* **This is not a runtime gain.** It converts an authored CONSTANT once, where
|
|
38490
|
+
* it is declared. It must never be applied to a live sample or a stored
|
|
38491
|
+
* `AudioEvent.dbfs`: the decoder is correct now, and a second authority
|
|
38492
|
+
* adjusting numbers the decoder already got right is the original defect with
|
|
38493
|
+
* an extra place to argue with (D459).
|
|
38494
|
+
*/
|
|
38495
|
+
function ituDbfsFromPreEpoch(law, authoredDbfs) {
|
|
38496
|
+
return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
|
|
38497
|
+
}
|
|
38498
|
+
Math.round(ituDbfsFromPreEpoch("PCMU", -55));
|
|
38286
38499
|
/** Schema defaults — an untouched sub-field must author exactly these. */
|
|
38287
38500
|
var NC_AUDIO_DEFAULTS = {
|
|
38288
38501
|
hitPercent: 60,
|
package/dist/smtp.addon.mjs
CHANGED
|
@@ -5380,6 +5380,86 @@ var ZodIssueCode = {
|
|
|
5380
5380
|
/** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
|
|
5381
5381
|
var ZodFirstPartyTypeKind;
|
|
5382
5382
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5383
|
+
//#endregion
|
|
5384
|
+
//#region ../types/dist/sleep-BnujYGPe.mjs
|
|
5385
|
+
/**
|
|
5386
|
+
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5387
|
+
* window to float samples (D455).
|
|
5388
|
+
*
|
|
5389
|
+
* ## Why a format at all
|
|
5390
|
+
*
|
|
5391
|
+
* D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
|
|
5392
|
+
* RATE, and the one consumer that needs 16 kHz resamples next to the model.
|
|
5393
|
+
* It left the FORMAT alone — the broker still turned each G.711 byte into a
|
|
5394
|
+
* 4-byte f32le sample before the bytes entered the transport, so every leg of
|
|
5395
|
+
* the plane carried four times the source. The plane crosses hub-main twice on
|
|
5396
|
+
* the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
|
|
5397
|
+
*
|
|
5398
|
+
* So the plane carries the source BYTES too, and whoever needs floats expands
|
|
5399
|
+
* them where it needs them. That is the same argument D450 made for the rate,
|
|
5400
|
+
* one step further along the same wire.
|
|
5401
|
+
*
|
|
5402
|
+
* ## Why the expansion lives here
|
|
5403
|
+
*
|
|
5404
|
+
* Two packages need it and they must never disagree: `addon-pipeline`'s broker
|
|
5405
|
+
* (which still has to serve a subscriber that did NOT ask for coded bytes —
|
|
5406
|
+
* `AudioChunkPlane` expands per subscription) and
|
|
5407
|
+
* `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
|
|
5408
|
+
* f32le window to the analyzer cap, whose `AudioChunkInput` contract is
|
|
5409
|
+
* unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
|
|
5410
|
+
* into their own dist (`self-contained` externals), so this travels with a
|
|
5411
|
+
* `camstack deploy` and needs no published server.
|
|
5412
|
+
*
|
|
5413
|
+
* A second μ-law table anywhere else is the defect this module exists to
|
|
5414
|
+
* prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
|
|
5415
|
+
* direction for the WebRTC egress — a different transform, not a copy.)
|
|
5416
|
+
*
|
|
5417
|
+
* ## Absent means f32le
|
|
5418
|
+
*
|
|
5419
|
+
* `format` is optional on the wire and its absence means `f32le` — today's
|
|
5420
|
+
* bytes, byte for byte. A peer that never heard of the field is served what it
|
|
5421
|
+
* has always been served, because the broker only emits a coded window to a
|
|
5422
|
+
* subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
|
|
5423
|
+
* That is the D448 `rawForward` negotiation, and it is what makes this
|
|
5424
|
+
* deployable one addon at a time across three nodes.
|
|
5425
|
+
*/
|
|
5426
|
+
/** Every byte format the audio chunk plane can carry. `f32le` is the default. */
|
|
5427
|
+
var AUDIO_CHUNK_FORMATS = [
|
|
5428
|
+
"f32le",
|
|
5429
|
+
"pcmu",
|
|
5430
|
+
"pcma"
|
|
5431
|
+
];
|
|
5432
|
+
/**
|
|
5433
|
+
* Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
|
|
5434
|
+
* to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
|
|
5435
|
+
*
|
|
5436
|
+
* Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
|
|
5437
|
+
* it buffers the coded bytes and the plane's consumers expand.
|
|
5438
|
+
*/
|
|
5439
|
+
function buildUlawTable() {
|
|
5440
|
+
const table = new Float32Array(256);
|
|
5441
|
+
for (let i = 0; i < 256; i++) {
|
|
5442
|
+
const complemented = ~i & 255;
|
|
5443
|
+
const sign = (complemented & 128) !== 0 ? -1 : 1;
|
|
5444
|
+
const exponent = complemented >> 4 & 7;
|
|
5445
|
+
table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
|
|
5446
|
+
}
|
|
5447
|
+
return table;
|
|
5448
|
+
}
|
|
5449
|
+
/** Build the A-law decode table (ITU-T G.711). */
|
|
5450
|
+
function buildAlawTable() {
|
|
5451
|
+
const table = new Float32Array(256);
|
|
5452
|
+
for (let i = 0; i < 256; i++) {
|
|
5453
|
+
const xored = i ^ 85;
|
|
5454
|
+
const sign = (xored & 128) !== 0 ? 1 : -1;
|
|
5455
|
+
const exponent = xored >> 4 & 7;
|
|
5456
|
+
const mantissa = xored & 15;
|
|
5457
|
+
table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
|
|
5458
|
+
}
|
|
5459
|
+
return table;
|
|
5460
|
+
}
|
|
5461
|
+
buildUlawTable();
|
|
5462
|
+
buildAlawTable();
|
|
5383
5463
|
Object.fromEntries([
|
|
5384
5464
|
{
|
|
5385
5465
|
id: "overview",
|
|
@@ -6672,11 +6752,20 @@ var SubscribeFramesResultSchema = object({
|
|
|
6672
6752
|
* (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
|
|
6673
6753
|
* / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
|
|
6674
6754
|
*/
|
|
6755
|
+
var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
|
|
6675
6756
|
var DecodedAudioChunkSchema = object({
|
|
6676
6757
|
data: _instanceof(Uint8Array),
|
|
6677
6758
|
sampleRate: number().int().positive(),
|
|
6678
6759
|
channels: number().int().positive(),
|
|
6679
|
-
timestamp: number()
|
|
6760
|
+
timestamp: number(),
|
|
6761
|
+
/**
|
|
6762
|
+
* Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
|
|
6763
|
+
* byte, for any peer that never heard of this field. A coded window
|
|
6764
|
+
* (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
|
|
6765
|
+
* subscription that DECLARED it accepts one, so absence can never mean
|
|
6766
|
+
* "coded bytes a consumer will read as floats" (D455).
|
|
6767
|
+
*/
|
|
6768
|
+
format: AudioChunkFormatSchema.optional()
|
|
6680
6769
|
});
|
|
6681
6770
|
/**
|
|
6682
6771
|
* Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
|
|
@@ -6688,7 +6777,18 @@ var DecodedAudioChunkSchema = object({
|
|
|
6688
6777
|
var SubscribeAudioChunksInputSchema = object({
|
|
6689
6778
|
brokerId: string(),
|
|
6690
6779
|
/** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
|
|
6691
|
-
tag: string().optional()
|
|
6780
|
+
tag: string().optional(),
|
|
6781
|
+
/**
|
|
6782
|
+
* Byte formats this subscriber can READ, best first. The broker serves the
|
|
6783
|
+
* chunk's own format when it is in this list and expands to `f32le`
|
|
6784
|
+
* otherwise, so a subscriber is never handed bytes it cannot interpret.
|
|
6785
|
+
*
|
|
6786
|
+
* Absent (or without the source format) means `f32le` — the behaviour every
|
|
6787
|
+
* subscriber had before D455, unchanged. This is the negotiation half of
|
|
6788
|
+
* the source-bytes lever: it is what lets the broker and its consumers
|
|
6789
|
+
* deploy one at a time across three nodes.
|
|
6790
|
+
*/
|
|
6791
|
+
accept: array(AudioChunkFormatSchema).readonly().optional()
|
|
6692
6792
|
});
|
|
6693
6793
|
/** Result of `stream-broker.subscribeAudioChunks`. */
|
|
6694
6794
|
var SubscribeAudioChunksResultSchema = object({
|
|
@@ -10660,6 +10760,51 @@ var AudioAnalysisSettingsSchema = object({
|
|
|
10660
10760
|
minConfidence: number().min(0).max(1).default(.3),
|
|
10661
10761
|
allowedClasses: array(string()).default([])
|
|
10662
10762
|
});
|
|
10763
|
+
/**
|
|
10764
|
+
* `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
|
|
10765
|
+
*
|
|
10766
|
+
* Until D461 the orchestrator drained the broker's chunk plane, accumulated
|
|
10767
|
+
* ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
|
|
10768
|
+
* nor consumed the audio: the PCM crossed hub-main twice for a process that
|
|
10769
|
+
* only buffered it. `attachDevice` inverts the direction — the analyzer opens
|
|
10770
|
+
* its own `subscribeAudioChunks` against the broker and the subscriber IS the
|
|
10771
|
+
* decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
|
|
10772
|
+
* way to the one expansion that feeds the model.
|
|
10773
|
+
*
|
|
10774
|
+
* The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
|
|
10775
|
+
* window, the per-device node assignment, the settings read) and therefore
|
|
10776
|
+
* still owns the attach/detach pair. It no longer owns the bytes.
|
|
10777
|
+
*/
|
|
10778
|
+
var AudioAttachDeviceInputSchema = object({
|
|
10779
|
+
deviceId: number(),
|
|
10780
|
+
/** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
|
|
10781
|
+
brokerId: string(),
|
|
10782
|
+
/**
|
|
10783
|
+
* `clusterRoles.ingestNode` — the node whose broker owns the source dial.
|
|
10784
|
+
* Every `streamBroker` call the attachment makes is pinned to it, exactly as
|
|
10785
|
+
* the orchestrator's poller pinned them before the move.
|
|
10786
|
+
*/
|
|
10787
|
+
ingestNodeId: string(),
|
|
10788
|
+
/**
|
|
10789
|
+
* Resolved once by the orchestrator at attach time, exactly as it was read
|
|
10790
|
+
* once per subscription before D461. The analyzer does NOT re-resolve per
|
|
10791
|
+
* window: a settings change re-attaches, which is what always happened.
|
|
10792
|
+
*/
|
|
10793
|
+
settings: AudioAnalysisSettingsSchema
|
|
10794
|
+
});
|
|
10795
|
+
var AudioAttachDeviceResultSchema = object({
|
|
10796
|
+
/** False only when the analyzer is shutting down and refused to attach. */
|
|
10797
|
+
attached: boolean(),
|
|
10798
|
+
/**
|
|
10799
|
+
* True when the attachment replaced a live one for the same device. An
|
|
10800
|
+
* attach is idempotent by REPLACEMENT — two pollers on one camera would
|
|
10801
|
+
* double the broker's fanout and neither would know about the other.
|
|
10802
|
+
*/
|
|
10803
|
+
replaced: boolean()
|
|
10804
|
+
});
|
|
10805
|
+
var AudioDetachDeviceResultSchema = object({
|
|
10806
|
+
/** False when no attachment existed — detach is idempotent. */
|
|
10807
|
+
detached: boolean() });
|
|
10663
10808
|
var AudioClassificationResultSchema = object({
|
|
10664
10809
|
labels: array(AudioClassificationLabelSchema).readonly(),
|
|
10665
10810
|
rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
|
|
@@ -10668,7 +10813,7 @@ var AudioClassificationResultSchema = object({
|
|
|
10668
10813
|
method(object({
|
|
10669
10814
|
chunk: AudioChunkInputSchema,
|
|
10670
10815
|
settings: AudioAnalysisSettingsSchema
|
|
10671
|
-
}), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
|
|
10816
|
+
}), 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() }), {
|
|
10672
10817
|
kind: "mutation",
|
|
10673
10818
|
auth: "admin"
|
|
10674
10819
|
});
|
|
@@ -24807,8 +24952,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
|
|
|
24807
24952
|
*
|
|
24808
24953
|
* An **empty array reads NOTHING** — `[]` is an empty page, never
|
|
24809
24954
|
* "every camera". A request for no devices is a request, not an
|
|
24810
|
-
* omission; same contract as `deviceManager.
|
|
24811
|
-
* `pipelineAnalytics.listRecentTracks`.
|
|
24955
|
+
* omission; same contract as `deviceManager.listAll`'s `deviceIds`
|
|
24956
|
+
* and `pipelineAnalytics.listRecentTracks`.
|
|
24812
24957
|
*
|
|
24813
24958
|
* Absent (`undefined`) is the omission, and keeps the cluster-wide view.
|
|
24814
24959
|
*/
|
|
@@ -30576,12 +30721,24 @@ Object.freeze({
|
|
|
30576
30721
|
addonId: null,
|
|
30577
30722
|
access: "create"
|
|
30578
30723
|
},
|
|
30724
|
+
"audioAnalyzer.attachDevice": {
|
|
30725
|
+
capName: "audio-analyzer",
|
|
30726
|
+
capScope: "system",
|
|
30727
|
+
addonId: null,
|
|
30728
|
+
access: "create"
|
|
30729
|
+
},
|
|
30579
30730
|
"audioAnalyzer.classify": {
|
|
30580
30731
|
capName: "audio-analyzer",
|
|
30581
30732
|
capScope: "system",
|
|
30582
30733
|
addonId: null,
|
|
30583
30734
|
access: "view"
|
|
30584
30735
|
},
|
|
30736
|
+
"audioAnalyzer.detachDevice": {
|
|
30737
|
+
capName: "audio-analyzer",
|
|
30738
|
+
capScope: "system",
|
|
30739
|
+
addonId: null,
|
|
30740
|
+
access: "create"
|
|
30741
|
+
},
|
|
30585
30742
|
"audioAnalyzer.dispose": {
|
|
30586
30743
|
capName: "audio-analyzer",
|
|
30587
30744
|
capScope: "system",
|
|
@@ -36425,11 +36582,21 @@ Object.freeze({
|
|
|
36425
36582
|
form: "single",
|
|
36426
36583
|
optional: false
|
|
36427
36584
|
}],
|
|
36585
|
+
"audioAnalyzer.attachDevice": [{
|
|
36586
|
+
name: "deviceId",
|
|
36587
|
+
form: "single",
|
|
36588
|
+
optional: false
|
|
36589
|
+
}],
|
|
36428
36590
|
"audioAnalyzer.classify": [{
|
|
36429
36591
|
name: "deviceId",
|
|
36430
36592
|
form: "single",
|
|
36431
36593
|
optional: true
|
|
36432
36594
|
}],
|
|
36595
|
+
"audioAnalyzer.detachDevice": [{
|
|
36596
|
+
name: "deviceId",
|
|
36597
|
+
form: "single",
|
|
36598
|
+
optional: false
|
|
36599
|
+
}],
|
|
36433
36600
|
"audioMetrics.getCurrentSnapshot": [{
|
|
36434
36601
|
name: "deviceId",
|
|
36435
36602
|
form: "single",
|
|
@@ -38281,6 +38448,52 @@ Object.freeze({
|
|
|
38281
38448
|
"network-access": "ingress",
|
|
38282
38449
|
"smtp-provider": "email"
|
|
38283
38450
|
});
|
|
38451
|
+
var G711_SCALE_CORRECTION_DB = {
|
|
38452
|
+
PCMU: 20 * Math.log10(4),
|
|
38453
|
+
PCMA: 20 * Math.log10(8)
|
|
38454
|
+
};
|
|
38455
|
+
/**
|
|
38456
|
+
* Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
|
|
38457
|
+
* same intent on the ITU-T scale (D460).
|
|
38458
|
+
*
|
|
38459
|
+
* ## When this applies, and when it is the wrong thing to reach for
|
|
38460
|
+
*
|
|
38461
|
+
* An absolute-dBFS number in this repo is one of two things, and only one of
|
|
38462
|
+
* them converts:
|
|
38463
|
+
*
|
|
38464
|
+
* - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
|
|
38465
|
+
* is loud". It was true on the ITU-T scale before the epoch and it is true
|
|
38466
|
+
* after. The defect was never in the number; it was that 19 of this hub's
|
|
38467
|
+
* 25 cameras did not obey it. Converting such a number takes something
|
|
38468
|
+
* correct and makes it wrong, in order to preserve a bug.
|
|
38469
|
+
* - **A measurement taken through the old decoder** — a value someone read
|
|
38470
|
+
* off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
|
|
38471
|
+
* describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
|
|
38472
|
+
* louder. That is what this function is for.
|
|
38473
|
+
*
|
|
38474
|
+
* Telling the two apart is a question about PROVENANCE, not about arithmetic,
|
|
38475
|
+
* and it cannot be answered from the number. It is answered by the comment the
|
|
38476
|
+
* author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
|
|
38477
|
+
* mandatory.
|
|
38478
|
+
*
|
|
38479
|
+
* ## Why a function and not a typed-in number
|
|
38480
|
+
*
|
|
38481
|
+
* `-55 + 12.04` written into a source file is, six months later, completely
|
|
38482
|
+
* indistinguishable from a threshold somebody simply preferred. Calling this
|
|
38483
|
+
* keeps the derivation, the law, and the original measurement all visible at
|
|
38484
|
+
* the call site, so a future reader can disagree with the *premise* instead of
|
|
38485
|
+
* having to reverse-engineer the sum.
|
|
38486
|
+
*
|
|
38487
|
+
* **This is not a runtime gain.** It converts an authored CONSTANT once, where
|
|
38488
|
+
* it is declared. It must never be applied to a live sample or a stored
|
|
38489
|
+
* `AudioEvent.dbfs`: the decoder is correct now, and a second authority
|
|
38490
|
+
* adjusting numbers the decoder already got right is the original defect with
|
|
38491
|
+
* an extra place to argue with (D459).
|
|
38492
|
+
*/
|
|
38493
|
+
function ituDbfsFromPreEpoch(law, authoredDbfs) {
|
|
38494
|
+
return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
|
|
38495
|
+
}
|
|
38496
|
+
Math.round(ituDbfsFromPreEpoch("PCMU", -55));
|
|
38284
38497
|
/** Schema defaults — an untouched sub-field must author exactly these. */
|
|
38285
38498
|
var NC_AUDIO_DEFAULTS = {
|
|
38286
38499
|
hitPercent: 60,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-smtp-nodemailer",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.95",
|
|
4
4
|
"description": "SMTP email provider addon for CamStack — wraps `nodemailer` and registers a `smtp-provider` cap collection entry. Used by magic-link login + notifier addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|