@camstack/addon-remote-storage 1.2.94 → 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/s3.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Bw28dZgY.js");
5
+ const require_shared = require("./shared-CAn4TcNa.js");
6
6
  let node_stream = require("node:stream");
7
7
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
8
8
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
package/dist/s3.addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-BYRTGLQ5.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-DfgX737p.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { Upload } from "@aws-sdk/lib-storage";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Bw28dZgY.js");
5
+ const require_shared = require("./shared-CAn4TcNa.js");
6
6
  let ssh2 = require("ssh2");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-BYRTGLQ5.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DfgX737p.mjs";
2
2
  import { Client } from "ssh2";
3
3
  import * as path from "node:path";
4
4
  //#region src/providers/sftp/sftp-config-schema.ts
@@ -5369,6 +5369,86 @@ var ZodIssueCode = {
5369
5369
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5370
5370
  var ZodFirstPartyTypeKind;
5371
5371
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5372
+ //#endregion
5373
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5374
+ /**
5375
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5376
+ * window to float samples (D455).
5377
+ *
5378
+ * ## Why a format at all
5379
+ *
5380
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5381
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5382
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5383
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5384
+ * the plane carried four times the source. The plane crosses hub-main twice on
5385
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5386
+ *
5387
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5388
+ * them where it needs them. That is the same argument D450 made for the rate,
5389
+ * one step further along the same wire.
5390
+ *
5391
+ * ## Why the expansion lives here
5392
+ *
5393
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5394
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5395
+ * `AudioChunkPlane` expands per subscription) and
5396
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5397
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5398
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5399
+ * into their own dist (`self-contained` externals), so this travels with a
5400
+ * `camstack deploy` and needs no published server.
5401
+ *
5402
+ * A second μ-law table anywhere else is the defect this module exists to
5403
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5404
+ * direction for the WebRTC egress — a different transform, not a copy.)
5405
+ *
5406
+ * ## Absent means f32le
5407
+ *
5408
+ * `format` is optional on the wire and its absence means `f32le` — today's
5409
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5410
+ * has always been served, because the broker only emits a coded window to a
5411
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5412
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5413
+ * deployable one addon at a time across three nodes.
5414
+ */
5415
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5416
+ var AUDIO_CHUNK_FORMATS = [
5417
+ "f32le",
5418
+ "pcmu",
5419
+ "pcma"
5420
+ ];
5421
+ /**
5422
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5423
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5424
+ *
5425
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5426
+ * it buffers the coded bytes and the plane's consumers expand.
5427
+ */
5428
+ function buildUlawTable() {
5429
+ const table = new Float32Array(256);
5430
+ for (let i = 0; i < 256; i++) {
5431
+ const complemented = ~i & 255;
5432
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5433
+ const exponent = complemented >> 4 & 7;
5434
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5435
+ }
5436
+ return table;
5437
+ }
5438
+ /** Build the A-law decode table (ITU-T G.711). */
5439
+ function buildAlawTable() {
5440
+ const table = new Float32Array(256);
5441
+ for (let i = 0; i < 256; i++) {
5442
+ const xored = i ^ 85;
5443
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5444
+ const exponent = xored >> 4 & 7;
5445
+ const mantissa = xored & 15;
5446
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5447
+ }
5448
+ return table;
5449
+ }
5450
+ buildUlawTable();
5451
+ buildAlawTable();
5372
5452
  Object.fromEntries([
5373
5453
  {
5374
5454
  id: "overview",
@@ -6661,11 +6741,20 @@ var SubscribeFramesResultSchema = object({
6661
6741
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6662
6742
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6663
6743
  */
6744
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6664
6745
  var DecodedAudioChunkSchema = object({
6665
6746
  data: _instanceof(Uint8Array),
6666
6747
  sampleRate: number().int().positive(),
6667
6748
  channels: number().int().positive(),
6668
- timestamp: number()
6749
+ timestamp: number(),
6750
+ /**
6751
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6752
+ * byte, for any peer that never heard of this field. A coded window
6753
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6754
+ * subscription that DECLARED it accepts one, so absence can never mean
6755
+ * "coded bytes a consumer will read as floats" (D455).
6756
+ */
6757
+ format: AudioChunkFormatSchema.optional()
6669
6758
  });
6670
6759
  /**
6671
6760
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6677,7 +6766,18 @@ var DecodedAudioChunkSchema = object({
6677
6766
  var SubscribeAudioChunksInputSchema = object({
6678
6767
  brokerId: string(),
6679
6768
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6680
- tag: string().optional()
6769
+ tag: string().optional(),
6770
+ /**
6771
+ * Byte formats this subscriber can READ, best first. The broker serves the
6772
+ * chunk's own format when it is in this list and expands to `f32le`
6773
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6774
+ *
6775
+ * Absent (or without the source format) means `f32le` — the behaviour every
6776
+ * subscriber had before D455, unchanged. This is the negotiation half of
6777
+ * the source-bytes lever: it is what lets the broker and its consumers
6778
+ * deploy one at a time across three nodes.
6779
+ */
6780
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6681
6781
  });
6682
6782
  /** Result of `stream-broker.subscribeAudioChunks`. */
6683
6783
  var SubscribeAudioChunksResultSchema = object({
@@ -10649,6 +10749,51 @@ var AudioAnalysisSettingsSchema = object({
10649
10749
  minConfidence: number().min(0).max(1).default(.3),
10650
10750
  allowedClasses: array(string()).default([])
10651
10751
  });
10752
+ /**
10753
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10754
+ *
10755
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10756
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10757
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10758
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10759
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10760
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10761
+ * way to the one expansion that feeds the model.
10762
+ *
10763
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10764
+ * window, the per-device node assignment, the settings read) and therefore
10765
+ * still owns the attach/detach pair. It no longer owns the bytes.
10766
+ */
10767
+ var AudioAttachDeviceInputSchema = object({
10768
+ deviceId: number(),
10769
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10770
+ brokerId: string(),
10771
+ /**
10772
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10773
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10774
+ * the orchestrator's poller pinned them before the move.
10775
+ */
10776
+ ingestNodeId: string(),
10777
+ /**
10778
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10779
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10780
+ * window: a settings change re-attaches, which is what always happened.
10781
+ */
10782
+ settings: AudioAnalysisSettingsSchema
10783
+ });
10784
+ var AudioAttachDeviceResultSchema = object({
10785
+ /** False only when the analyzer is shutting down and refused to attach. */
10786
+ attached: boolean(),
10787
+ /**
10788
+ * True when the attachment replaced a live one for the same device. An
10789
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10790
+ * double the broker's fanout and neither would know about the other.
10791
+ */
10792
+ replaced: boolean()
10793
+ });
10794
+ var AudioDetachDeviceResultSchema = object({
10795
+ /** False when no attachment existed — detach is idempotent. */
10796
+ detached: boolean() });
10652
10797
  var AudioClassificationResultSchema = object({
10653
10798
  labels: array(AudioClassificationLabelSchema).readonly(),
10654
10799
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10657,7 +10802,7 @@ var AudioClassificationResultSchema = object({
10657
10802
  method(object({
10658
10803
  chunk: AudioChunkInputSchema,
10659
10804
  settings: AudioAnalysisSettingsSchema
10660
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10805
+ }), 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() }), {
10661
10806
  kind: "mutation",
10662
10807
  auth: "admin"
10663
10808
  });
@@ -30612,12 +30757,24 @@ Object.freeze({
30612
30757
  addonId: null,
30613
30758
  access: "create"
30614
30759
  },
30760
+ "audioAnalyzer.attachDevice": {
30761
+ capName: "audio-analyzer",
30762
+ capScope: "system",
30763
+ addonId: null,
30764
+ access: "create"
30765
+ },
30615
30766
  "audioAnalyzer.classify": {
30616
30767
  capName: "audio-analyzer",
30617
30768
  capScope: "system",
30618
30769
  addonId: null,
30619
30770
  access: "view"
30620
30771
  },
30772
+ "audioAnalyzer.detachDevice": {
30773
+ capName: "audio-analyzer",
30774
+ capScope: "system",
30775
+ addonId: null,
30776
+ access: "create"
30777
+ },
30621
30778
  "audioAnalyzer.dispose": {
30622
30779
  capName: "audio-analyzer",
30623
30780
  capScope: "system",
@@ -36461,11 +36618,21 @@ Object.freeze({
36461
36618
  form: "single",
36462
36619
  optional: false
36463
36620
  }],
36621
+ "audioAnalyzer.attachDevice": [{
36622
+ name: "deviceId",
36623
+ form: "single",
36624
+ optional: false
36625
+ }],
36464
36626
  "audioAnalyzer.classify": [{
36465
36627
  name: "deviceId",
36466
36628
  form: "single",
36467
36629
  optional: true
36468
36630
  }],
36631
+ "audioAnalyzer.detachDevice": [{
36632
+ name: "deviceId",
36633
+ form: "single",
36634
+ optional: false
36635
+ }],
36469
36636
  "audioMetrics.getCurrentSnapshot": [{
36470
36637
  name: "deviceId",
36471
36638
  form: "single",
@@ -38317,6 +38484,52 @@ Object.freeze({
38317
38484
  "network-access": "ingress",
38318
38485
  "smtp-provider": "email"
38319
38486
  });
38487
+ var G711_SCALE_CORRECTION_DB = {
38488
+ PCMU: 20 * Math.log10(4),
38489
+ PCMA: 20 * Math.log10(8)
38490
+ };
38491
+ /**
38492
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38493
+ * same intent on the ITU-T scale (D460).
38494
+ *
38495
+ * ## When this applies, and when it is the wrong thing to reach for
38496
+ *
38497
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38498
+ * them converts:
38499
+ *
38500
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38501
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38502
+ * after. The defect was never in the number; it was that 19 of this hub's
38503
+ * 25 cameras did not obey it. Converting such a number takes something
38504
+ * correct and makes it wrong, in order to preserve a bug.
38505
+ * - **A measurement taken through the old decoder** — a value someone read
38506
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38507
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38508
+ * louder. That is what this function is for.
38509
+ *
38510
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38511
+ * and it cannot be answered from the number. It is answered by the comment the
38512
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38513
+ * mandatory.
38514
+ *
38515
+ * ## Why a function and not a typed-in number
38516
+ *
38517
+ * `-55 + 12.04` written into a source file is, six months later, completely
38518
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38519
+ * keeps the derivation, the law, and the original measurement all visible at
38520
+ * the call site, so a future reader can disagree with the *premise* instead of
38521
+ * having to reverse-engineer the sum.
38522
+ *
38523
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38524
+ * it is declared. It must never be applied to a live sample or a stored
38525
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38526
+ * adjusting numbers the decoder already got right is the original defect with
38527
+ * an extra place to argue with (D459).
38528
+ */
38529
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38530
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38531
+ }
38532
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38320
38533
  /** Schema defaults — an untouched sub-field must author exactly these. */
38321
38534
  var NC_AUDIO_DEFAULTS = {
38322
38535
  hitPercent: 60,
@@ -5346,6 +5346,86 @@ var ZodIssueCode = {
5346
5346
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5347
5347
  var ZodFirstPartyTypeKind;
5348
5348
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5349
+ //#endregion
5350
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5351
+ /**
5352
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5353
+ * window to float samples (D455).
5354
+ *
5355
+ * ## Why a format at all
5356
+ *
5357
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5358
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5359
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5360
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5361
+ * the plane carried four times the source. The plane crosses hub-main twice on
5362
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5363
+ *
5364
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5365
+ * them where it needs them. That is the same argument D450 made for the rate,
5366
+ * one step further along the same wire.
5367
+ *
5368
+ * ## Why the expansion lives here
5369
+ *
5370
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5371
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5372
+ * `AudioChunkPlane` expands per subscription) and
5373
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5374
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5375
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5376
+ * into their own dist (`self-contained` externals), so this travels with a
5377
+ * `camstack deploy` and needs no published server.
5378
+ *
5379
+ * A second μ-law table anywhere else is the defect this module exists to
5380
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5381
+ * direction for the WebRTC egress — a different transform, not a copy.)
5382
+ *
5383
+ * ## Absent means f32le
5384
+ *
5385
+ * `format` is optional on the wire and its absence means `f32le` — today's
5386
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5387
+ * has always been served, because the broker only emits a coded window to a
5388
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5389
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5390
+ * deployable one addon at a time across three nodes.
5391
+ */
5392
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5393
+ var AUDIO_CHUNK_FORMATS = [
5394
+ "f32le",
5395
+ "pcmu",
5396
+ "pcma"
5397
+ ];
5398
+ /**
5399
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5400
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5401
+ *
5402
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5403
+ * it buffers the coded bytes and the plane's consumers expand.
5404
+ */
5405
+ function buildUlawTable() {
5406
+ const table = new Float32Array(256);
5407
+ for (let i = 0; i < 256; i++) {
5408
+ const complemented = ~i & 255;
5409
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5410
+ const exponent = complemented >> 4 & 7;
5411
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5412
+ }
5413
+ return table;
5414
+ }
5415
+ /** Build the A-law decode table (ITU-T G.711). */
5416
+ function buildAlawTable() {
5417
+ const table = new Float32Array(256);
5418
+ for (let i = 0; i < 256; i++) {
5419
+ const xored = i ^ 85;
5420
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5421
+ const exponent = xored >> 4 & 7;
5422
+ const mantissa = xored & 15;
5423
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5424
+ }
5425
+ return table;
5426
+ }
5427
+ buildUlawTable();
5428
+ buildAlawTable();
5349
5429
  Object.fromEntries([
5350
5430
  {
5351
5431
  id: "overview",
@@ -6638,11 +6718,20 @@ var SubscribeFramesResultSchema = object({
6638
6718
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6639
6719
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6640
6720
  */
6721
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6641
6722
  var DecodedAudioChunkSchema = object({
6642
6723
  data: _instanceof(Uint8Array),
6643
6724
  sampleRate: number().int().positive(),
6644
6725
  channels: number().int().positive(),
6645
- timestamp: number()
6726
+ timestamp: number(),
6727
+ /**
6728
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6729
+ * byte, for any peer that never heard of this field. A coded window
6730
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6731
+ * subscription that DECLARED it accepts one, so absence can never mean
6732
+ * "coded bytes a consumer will read as floats" (D455).
6733
+ */
6734
+ format: AudioChunkFormatSchema.optional()
6646
6735
  });
6647
6736
  /**
6648
6737
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6654,7 +6743,18 @@ var DecodedAudioChunkSchema = object({
6654
6743
  var SubscribeAudioChunksInputSchema = object({
6655
6744
  brokerId: string(),
6656
6745
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6657
- tag: string().optional()
6746
+ tag: string().optional(),
6747
+ /**
6748
+ * Byte formats this subscriber can READ, best first. The broker serves the
6749
+ * chunk's own format when it is in this list and expands to `f32le`
6750
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6751
+ *
6752
+ * Absent (or without the source format) means `f32le` — the behaviour every
6753
+ * subscriber had before D455, unchanged. This is the negotiation half of
6754
+ * the source-bytes lever: it is what lets the broker and its consumers
6755
+ * deploy one at a time across three nodes.
6756
+ */
6757
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6658
6758
  });
6659
6759
  /** Result of `stream-broker.subscribeAudioChunks`. */
6660
6760
  var SubscribeAudioChunksResultSchema = object({
@@ -10626,6 +10726,51 @@ var AudioAnalysisSettingsSchema = object({
10626
10726
  minConfidence: number().min(0).max(1).default(.3),
10627
10727
  allowedClasses: array(string()).default([])
10628
10728
  });
10729
+ /**
10730
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10731
+ *
10732
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10733
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10734
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10735
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10736
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10737
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10738
+ * way to the one expansion that feeds the model.
10739
+ *
10740
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10741
+ * window, the per-device node assignment, the settings read) and therefore
10742
+ * still owns the attach/detach pair. It no longer owns the bytes.
10743
+ */
10744
+ var AudioAttachDeviceInputSchema = object({
10745
+ deviceId: number(),
10746
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10747
+ brokerId: string(),
10748
+ /**
10749
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10750
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10751
+ * the orchestrator's poller pinned them before the move.
10752
+ */
10753
+ ingestNodeId: string(),
10754
+ /**
10755
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10756
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10757
+ * window: a settings change re-attaches, which is what always happened.
10758
+ */
10759
+ settings: AudioAnalysisSettingsSchema
10760
+ });
10761
+ var AudioAttachDeviceResultSchema = object({
10762
+ /** False only when the analyzer is shutting down and refused to attach. */
10763
+ attached: boolean(),
10764
+ /**
10765
+ * True when the attachment replaced a live one for the same device. An
10766
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10767
+ * double the broker's fanout and neither would know about the other.
10768
+ */
10769
+ replaced: boolean()
10770
+ });
10771
+ var AudioDetachDeviceResultSchema = object({
10772
+ /** False when no attachment existed — detach is idempotent. */
10773
+ detached: boolean() });
10629
10774
  var AudioClassificationResultSchema = object({
10630
10775
  labels: array(AudioClassificationLabelSchema).readonly(),
10631
10776
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10634,7 +10779,7 @@ var AudioClassificationResultSchema = object({
10634
10779
  method(object({
10635
10780
  chunk: AudioChunkInputSchema,
10636
10781
  settings: AudioAnalysisSettingsSchema
10637
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10782
+ }), 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() }), {
10638
10783
  kind: "mutation",
10639
10784
  auth: "admin"
10640
10785
  });
@@ -30589,12 +30734,24 @@ Object.freeze({
30589
30734
  addonId: null,
30590
30735
  access: "create"
30591
30736
  },
30737
+ "audioAnalyzer.attachDevice": {
30738
+ capName: "audio-analyzer",
30739
+ capScope: "system",
30740
+ addonId: null,
30741
+ access: "create"
30742
+ },
30592
30743
  "audioAnalyzer.classify": {
30593
30744
  capName: "audio-analyzer",
30594
30745
  capScope: "system",
30595
30746
  addonId: null,
30596
30747
  access: "view"
30597
30748
  },
30749
+ "audioAnalyzer.detachDevice": {
30750
+ capName: "audio-analyzer",
30751
+ capScope: "system",
30752
+ addonId: null,
30753
+ access: "create"
30754
+ },
30598
30755
  "audioAnalyzer.dispose": {
30599
30756
  capName: "audio-analyzer",
30600
30757
  capScope: "system",
@@ -36438,11 +36595,21 @@ Object.freeze({
36438
36595
  form: "single",
36439
36596
  optional: false
36440
36597
  }],
36598
+ "audioAnalyzer.attachDevice": [{
36599
+ name: "deviceId",
36600
+ form: "single",
36601
+ optional: false
36602
+ }],
36441
36603
  "audioAnalyzer.classify": [{
36442
36604
  name: "deviceId",
36443
36605
  form: "single",
36444
36606
  optional: true
36445
36607
  }],
36608
+ "audioAnalyzer.detachDevice": [{
36609
+ name: "deviceId",
36610
+ form: "single",
36611
+ optional: false
36612
+ }],
36446
36613
  "audioMetrics.getCurrentSnapshot": [{
36447
36614
  name: "deviceId",
36448
36615
  form: "single",
@@ -38294,6 +38461,52 @@ Object.freeze({
38294
38461
  "network-access": "ingress",
38295
38462
  "smtp-provider": "email"
38296
38463
  });
38464
+ var G711_SCALE_CORRECTION_DB = {
38465
+ PCMU: 20 * Math.log10(4),
38466
+ PCMA: 20 * Math.log10(8)
38467
+ };
38468
+ /**
38469
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38470
+ * same intent on the ITU-T scale (D460).
38471
+ *
38472
+ * ## When this applies, and when it is the wrong thing to reach for
38473
+ *
38474
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38475
+ * them converts:
38476
+ *
38477
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38478
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38479
+ * after. The defect was never in the number; it was that 19 of this hub's
38480
+ * 25 cameras did not obey it. Converting such a number takes something
38481
+ * correct and makes it wrong, in order to preserve a bug.
38482
+ * - **A measurement taken through the old decoder** — a value someone read
38483
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38484
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38485
+ * louder. That is what this function is for.
38486
+ *
38487
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38488
+ * and it cannot be answered from the number. It is answered by the comment the
38489
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38490
+ * mandatory.
38491
+ *
38492
+ * ## Why a function and not a typed-in number
38493
+ *
38494
+ * `-55 + 12.04` written into a source file is, six months later, completely
38495
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38496
+ * keeps the derivation, the law, and the original measurement all visible at
38497
+ * the call site, so a future reader can disagree with the *premise* instead of
38498
+ * having to reverse-engineer the sum.
38499
+ *
38500
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38501
+ * it is declared. It must never be applied to a live sample or a stored
38502
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38503
+ * adjusting numbers the decoder already got right is the original defect with
38504
+ * an extra place to argue with (D459).
38505
+ */
38506
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38507
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38508
+ }
38509
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38297
38510
  /** Schema defaults — an untouched sub-field must author exactly these. */
38298
38511
  var NC_AUDIO_DEFAULTS = {
38299
38512
  hitPercent: 60,
package/dist/smb.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Bw28dZgY.js");
5
+ const require_shared = require("./shared-CAn4TcNa.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, s as storageProviderCapability } from "./shared-BYRTGLQ5.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, s as storageProviderCapability } from "./shared-DfgX737p.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as path from "node:path";
4
4
  import * as fsp from "node:fs/promises";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-Bw28dZgY.js");
5
+ const require_shared = require("./shared-CAn4TcNa.js");
6
6
  let node_stream = require("node:stream");
7
7
  let webdav = require("webdav");
8
8
  //#region src/providers/webdav/webdav-config-schema.ts
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-BYRTGLQ5.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DfgX737p.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { AuthType, createClient } from "webdav";
4
4
  //#region src/providers/webdav/webdav-config-schema.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-remote-storage",
3
- "version": "1.2.94",
3
+ "version": "1.2.95",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV, SMB) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",