@camstack/addon-smtp-nodemailer 1.2.94 → 1.2.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  });
@@ -20206,6 +20351,14 @@ var NativeCropResultSchema = object({
20206
20351
  * set `encodeJpeg: true`; `bytes` is then absent.
20207
20352
  */
20208
20353
  jpeg: string().optional(),
20354
+ /**
20355
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
20356
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
20357
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
20358
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
20359
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
20360
+ */
20361
+ jpegBytes: _instanceof(Uint8Array).optional(),
20209
20362
  width: number().int().positive(),
20210
20363
  height: number().int().positive(),
20211
20364
  /**
@@ -20272,7 +20425,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
20272
20425
  })]);
20273
20426
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
20274
20427
  var ParkedTrackFrameSchema = object({
20275
- jpeg: string(),
20428
+ /**
20429
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
20430
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
20431
+ * Exactly one of the two is present.
20432
+ */
20433
+ jpeg: string().optional(),
20434
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
20435
+ jpegBytes: _instanceof(Uint8Array).optional(),
20276
20436
  width: number().int().positive(),
20277
20437
  height: number().int().positive(),
20278
20438
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -20859,6 +21019,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20859
21019
  bbox: NativeCropBboxSchema,
20860
21020
  maxWidth: number().int().positive().optional(),
20861
21021
  /**
21022
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21023
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21024
+ * wire — never assume consent: a pre-D462 caller parses the field as
21025
+ * base64 and bytes would decode to garbage rather than fail.
21026
+ */
21027
+ acceptJpegBytes: boolean().optional(),
21028
+ /**
20862
21029
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
20863
21030
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
20864
21031
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -20926,7 +21093,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20926
21093
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
20927
21094
  deviceId: number(),
20928
21095
  trackId: string(),
20929
- kind: ParkedFrameKindSchema
21096
+ kind: ParkedFrameKindSchema,
21097
+ /**
21098
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21099
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21100
+ * wire — never assume consent: a pre-D462 caller parses the field as
21101
+ * base64 and bytes would decode to garbage rather than fail.
21102
+ */
21103
+ acceptJpegBytes: boolean().optional()
20930
21104
  }), ParkedTrackFrameSchema.nullable()), method(object({
20931
21105
  deviceId: number(),
20932
21106
  trackId: string()
@@ -30578,12 +30752,24 @@ Object.freeze({
30578
30752
  addonId: null,
30579
30753
  access: "create"
30580
30754
  },
30755
+ "audioAnalyzer.attachDevice": {
30756
+ capName: "audio-analyzer",
30757
+ capScope: "system",
30758
+ addonId: null,
30759
+ access: "create"
30760
+ },
30581
30761
  "audioAnalyzer.classify": {
30582
30762
  capName: "audio-analyzer",
30583
30763
  capScope: "system",
30584
30764
  addonId: null,
30585
30765
  access: "view"
30586
30766
  },
30767
+ "audioAnalyzer.detachDevice": {
30768
+ capName: "audio-analyzer",
30769
+ capScope: "system",
30770
+ addonId: null,
30771
+ access: "create"
30772
+ },
30587
30773
  "audioAnalyzer.dispose": {
30588
30774
  capName: "audio-analyzer",
30589
30775
  capScope: "system",
@@ -36427,11 +36613,21 @@ Object.freeze({
36427
36613
  form: "single",
36428
36614
  optional: false
36429
36615
  }],
36616
+ "audioAnalyzer.attachDevice": [{
36617
+ name: "deviceId",
36618
+ form: "single",
36619
+ optional: false
36620
+ }],
36430
36621
  "audioAnalyzer.classify": [{
36431
36622
  name: "deviceId",
36432
36623
  form: "single",
36433
36624
  optional: true
36434
36625
  }],
36626
+ "audioAnalyzer.detachDevice": [{
36627
+ name: "deviceId",
36628
+ form: "single",
36629
+ optional: false
36630
+ }],
36435
36631
  "audioMetrics.getCurrentSnapshot": [{
36436
36632
  name: "deviceId",
36437
36633
  form: "single",
@@ -38283,6 +38479,52 @@ Object.freeze({
38283
38479
  "network-access": "ingress",
38284
38480
  "smtp-provider": "email"
38285
38481
  });
38482
+ var G711_SCALE_CORRECTION_DB = {
38483
+ PCMU: 20 * Math.log10(4),
38484
+ PCMA: 20 * Math.log10(8)
38485
+ };
38486
+ /**
38487
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38488
+ * same intent on the ITU-T scale (D460).
38489
+ *
38490
+ * ## When this applies, and when it is the wrong thing to reach for
38491
+ *
38492
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38493
+ * them converts:
38494
+ *
38495
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38496
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38497
+ * after. The defect was never in the number; it was that 19 of this hub's
38498
+ * 25 cameras did not obey it. Converting such a number takes something
38499
+ * correct and makes it wrong, in order to preserve a bug.
38500
+ * - **A measurement taken through the old decoder** — a value someone read
38501
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38502
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38503
+ * louder. That is what this function is for.
38504
+ *
38505
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38506
+ * and it cannot be answered from the number. It is answered by the comment the
38507
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38508
+ * mandatory.
38509
+ *
38510
+ * ## Why a function and not a typed-in number
38511
+ *
38512
+ * `-55 + 12.04` written into a source file is, six months later, completely
38513
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38514
+ * keeps the derivation, the law, and the original measurement all visible at
38515
+ * the call site, so a future reader can disagree with the *premise* instead of
38516
+ * having to reverse-engineer the sum.
38517
+ *
38518
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38519
+ * it is declared. It must never be applied to a live sample or a stored
38520
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38521
+ * adjusting numbers the decoder already got right is the original defect with
38522
+ * an extra place to argue with (D459).
38523
+ */
38524
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38525
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38526
+ }
38527
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38286
38528
  /** Schema defaults — an untouched sub-field must author exactly these. */
38287
38529
  var NC_AUDIO_DEFAULTS = {
38288
38530
  hitPercent: 60,
@@ -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
  });
@@ -20204,6 +20349,14 @@ var NativeCropResultSchema = object({
20204
20349
  * set `encodeJpeg: true`; `bytes` is then absent.
20205
20350
  */
20206
20351
  jpeg: string().optional(),
20352
+ /**
20353
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
20354
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
20355
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
20356
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
20357
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
20358
+ */
20359
+ jpegBytes: _instanceof(Uint8Array).optional(),
20207
20360
  width: number().int().positive(),
20208
20361
  height: number().int().positive(),
20209
20362
  /**
@@ -20270,7 +20423,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
20270
20423
  })]);
20271
20424
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
20272
20425
  var ParkedTrackFrameSchema = object({
20273
- jpeg: string(),
20426
+ /**
20427
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
20428
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
20429
+ * Exactly one of the two is present.
20430
+ */
20431
+ jpeg: string().optional(),
20432
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
20433
+ jpegBytes: _instanceof(Uint8Array).optional(),
20274
20434
  width: number().int().positive(),
20275
20435
  height: number().int().positive(),
20276
20436
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -20857,6 +21017,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20857
21017
  bbox: NativeCropBboxSchema,
20858
21018
  maxWidth: number().int().positive().optional(),
20859
21019
  /**
21020
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21021
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21022
+ * wire — never assume consent: a pre-D462 caller parses the field as
21023
+ * base64 and bytes would decode to garbage rather than fail.
21024
+ */
21025
+ acceptJpegBytes: boolean().optional(),
21026
+ /**
20860
21027
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
20861
21028
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
20862
21029
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -20924,7 +21091,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20924
21091
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
20925
21092
  deviceId: number(),
20926
21093
  trackId: string(),
20927
- kind: ParkedFrameKindSchema
21094
+ kind: ParkedFrameKindSchema,
21095
+ /**
21096
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21097
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21098
+ * wire — never assume consent: a pre-D462 caller parses the field as
21099
+ * base64 and bytes would decode to garbage rather than fail.
21100
+ */
21101
+ acceptJpegBytes: boolean().optional()
20928
21102
  }), ParkedTrackFrameSchema.nullable()), method(object({
20929
21103
  deviceId: number(),
20930
21104
  trackId: string()
@@ -30576,12 +30750,24 @@ Object.freeze({
30576
30750
  addonId: null,
30577
30751
  access: "create"
30578
30752
  },
30753
+ "audioAnalyzer.attachDevice": {
30754
+ capName: "audio-analyzer",
30755
+ capScope: "system",
30756
+ addonId: null,
30757
+ access: "create"
30758
+ },
30579
30759
  "audioAnalyzer.classify": {
30580
30760
  capName: "audio-analyzer",
30581
30761
  capScope: "system",
30582
30762
  addonId: null,
30583
30763
  access: "view"
30584
30764
  },
30765
+ "audioAnalyzer.detachDevice": {
30766
+ capName: "audio-analyzer",
30767
+ capScope: "system",
30768
+ addonId: null,
30769
+ access: "create"
30770
+ },
30585
30771
  "audioAnalyzer.dispose": {
30586
30772
  capName: "audio-analyzer",
30587
30773
  capScope: "system",
@@ -36425,11 +36611,21 @@ Object.freeze({
36425
36611
  form: "single",
36426
36612
  optional: false
36427
36613
  }],
36614
+ "audioAnalyzer.attachDevice": [{
36615
+ name: "deviceId",
36616
+ form: "single",
36617
+ optional: false
36618
+ }],
36428
36619
  "audioAnalyzer.classify": [{
36429
36620
  name: "deviceId",
36430
36621
  form: "single",
36431
36622
  optional: true
36432
36623
  }],
36624
+ "audioAnalyzer.detachDevice": [{
36625
+ name: "deviceId",
36626
+ form: "single",
36627
+ optional: false
36628
+ }],
36433
36629
  "audioMetrics.getCurrentSnapshot": [{
36434
36630
  name: "deviceId",
36435
36631
  form: "single",
@@ -38281,6 +38477,52 @@ Object.freeze({
38281
38477
  "network-access": "ingress",
38282
38478
  "smtp-provider": "email"
38283
38479
  });
38480
+ var G711_SCALE_CORRECTION_DB = {
38481
+ PCMU: 20 * Math.log10(4),
38482
+ PCMA: 20 * Math.log10(8)
38483
+ };
38484
+ /**
38485
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38486
+ * same intent on the ITU-T scale (D460).
38487
+ *
38488
+ * ## When this applies, and when it is the wrong thing to reach for
38489
+ *
38490
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38491
+ * them converts:
38492
+ *
38493
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38494
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38495
+ * after. The defect was never in the number; it was that 19 of this hub's
38496
+ * 25 cameras did not obey it. Converting such a number takes something
38497
+ * correct and makes it wrong, in order to preserve a bug.
38498
+ * - **A measurement taken through the old decoder** — a value someone read
38499
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38500
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38501
+ * louder. That is what this function is for.
38502
+ *
38503
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38504
+ * and it cannot be answered from the number. It is answered by the comment the
38505
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38506
+ * mandatory.
38507
+ *
38508
+ * ## Why a function and not a typed-in number
38509
+ *
38510
+ * `-55 + 12.04` written into a source file is, six months later, completely
38511
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38512
+ * keeps the derivation, the law, and the original measurement all visible at
38513
+ * the call site, so a future reader can disagree with the *premise* instead of
38514
+ * having to reverse-engineer the sum.
38515
+ *
38516
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38517
+ * it is declared. It must never be applied to a live sample or a stored
38518
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38519
+ * adjusting numbers the decoder already got right is the original defect with
38520
+ * an extra place to argue with (D459).
38521
+ */
38522
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38523
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38524
+ }
38525
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38284
38526
  /** Schema defaults — an untouched sub-field must author exactly these. */
38285
38527
  var NC_AUDIO_DEFAULTS = {
38286
38528
  hitPercent: 60,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-smtp-nodemailer",
3
- "version": "1.2.94",
3
+ "version": "1.2.96",
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",