@camstack/addon-remote-storage 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.
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-B99wFlH6.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-BOK9gl06.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-B99wFlH6.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-BOK9gl06.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
  });
@@ -20193,6 +20338,14 @@ var NativeCropResultSchema = object({
20193
20338
  * set `encodeJpeg: true`; `bytes` is then absent.
20194
20339
  */
20195
20340
  jpeg: string().optional(),
20341
+ /**
20342
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
20343
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
20344
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
20345
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
20346
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
20347
+ */
20348
+ jpegBytes: _instanceof(Uint8Array).optional(),
20196
20349
  width: number().int().positive(),
20197
20350
  height: number().int().positive(),
20198
20351
  /**
@@ -20259,7 +20412,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
20259
20412
  })]);
20260
20413
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
20261
20414
  var ParkedTrackFrameSchema = object({
20262
- jpeg: string(),
20415
+ /**
20416
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
20417
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
20418
+ * Exactly one of the two is present.
20419
+ */
20420
+ jpeg: string().optional(),
20421
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
20422
+ jpegBytes: _instanceof(Uint8Array).optional(),
20263
20423
  width: number().int().positive(),
20264
20424
  height: number().int().positive(),
20265
20425
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -20846,6 +21006,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20846
21006
  bbox: NativeCropBboxSchema,
20847
21007
  maxWidth: number().int().positive().optional(),
20848
21008
  /**
21009
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21010
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21011
+ * wire — never assume consent: a pre-D462 caller parses the field as
21012
+ * base64 and bytes would decode to garbage rather than fail.
21013
+ */
21014
+ acceptJpegBytes: boolean().optional(),
21015
+ /**
20849
21016
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
20850
21017
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
20851
21018
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -20913,7 +21080,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20913
21080
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
20914
21081
  deviceId: number(),
20915
21082
  trackId: string(),
20916
- kind: ParkedFrameKindSchema
21083
+ kind: ParkedFrameKindSchema,
21084
+ /**
21085
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21086
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21087
+ * wire — never assume consent: a pre-D462 caller parses the field as
21088
+ * base64 and bytes would decode to garbage rather than fail.
21089
+ */
21090
+ acceptJpegBytes: boolean().optional()
20917
21091
  }), ParkedTrackFrameSchema.nullable()), method(object({
20918
21092
  deviceId: number(),
20919
21093
  trackId: string()
@@ -30612,12 +30786,24 @@ Object.freeze({
30612
30786
  addonId: null,
30613
30787
  access: "create"
30614
30788
  },
30789
+ "audioAnalyzer.attachDevice": {
30790
+ capName: "audio-analyzer",
30791
+ capScope: "system",
30792
+ addonId: null,
30793
+ access: "create"
30794
+ },
30615
30795
  "audioAnalyzer.classify": {
30616
30796
  capName: "audio-analyzer",
30617
30797
  capScope: "system",
30618
30798
  addonId: null,
30619
30799
  access: "view"
30620
30800
  },
30801
+ "audioAnalyzer.detachDevice": {
30802
+ capName: "audio-analyzer",
30803
+ capScope: "system",
30804
+ addonId: null,
30805
+ access: "create"
30806
+ },
30621
30807
  "audioAnalyzer.dispose": {
30622
30808
  capName: "audio-analyzer",
30623
30809
  capScope: "system",
@@ -36461,11 +36647,21 @@ Object.freeze({
36461
36647
  form: "single",
36462
36648
  optional: false
36463
36649
  }],
36650
+ "audioAnalyzer.attachDevice": [{
36651
+ name: "deviceId",
36652
+ form: "single",
36653
+ optional: false
36654
+ }],
36464
36655
  "audioAnalyzer.classify": [{
36465
36656
  name: "deviceId",
36466
36657
  form: "single",
36467
36658
  optional: true
36468
36659
  }],
36660
+ "audioAnalyzer.detachDevice": [{
36661
+ name: "deviceId",
36662
+ form: "single",
36663
+ optional: false
36664
+ }],
36469
36665
  "audioMetrics.getCurrentSnapshot": [{
36470
36666
  name: "deviceId",
36471
36667
  form: "single",
@@ -38317,6 +38513,52 @@ Object.freeze({
38317
38513
  "network-access": "ingress",
38318
38514
  "smtp-provider": "email"
38319
38515
  });
38516
+ var G711_SCALE_CORRECTION_DB = {
38517
+ PCMU: 20 * Math.log10(4),
38518
+ PCMA: 20 * Math.log10(8)
38519
+ };
38520
+ /**
38521
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38522
+ * same intent on the ITU-T scale (D460).
38523
+ *
38524
+ * ## When this applies, and when it is the wrong thing to reach for
38525
+ *
38526
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38527
+ * them converts:
38528
+ *
38529
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38530
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38531
+ * after. The defect was never in the number; it was that 19 of this hub's
38532
+ * 25 cameras did not obey it. Converting such a number takes something
38533
+ * correct and makes it wrong, in order to preserve a bug.
38534
+ * - **A measurement taken through the old decoder** — a value someone read
38535
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38536
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38537
+ * louder. That is what this function is for.
38538
+ *
38539
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38540
+ * and it cannot be answered from the number. It is answered by the comment the
38541
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38542
+ * mandatory.
38543
+ *
38544
+ * ## Why a function and not a typed-in number
38545
+ *
38546
+ * `-55 + 12.04` written into a source file is, six months later, completely
38547
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38548
+ * keeps the derivation, the law, and the original measurement all visible at
38549
+ * the call site, so a future reader can disagree with the *premise* instead of
38550
+ * having to reverse-engineer the sum.
38551
+ *
38552
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38553
+ * it is declared. It must never be applied to a live sample or a stored
38554
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38555
+ * adjusting numbers the decoder already got right is the original defect with
38556
+ * an extra place to argue with (D459).
38557
+ */
38558
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38559
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38560
+ }
38561
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38320
38562
  /** Schema defaults — an untouched sub-field must author exactly these. */
38321
38563
  var NC_AUDIO_DEFAULTS = {
38322
38564
  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
  });
@@ -20170,6 +20315,14 @@ var NativeCropResultSchema = object({
20170
20315
  * set `encodeJpeg: true`; `bytes` is then absent.
20171
20316
  */
20172
20317
  jpeg: string().optional(),
20318
+ /**
20319
+ * The SAME compressed JPEG as `jpeg`, as bytes (D462). Present instead of
20320
+ * `jpeg` when the request set `acceptJpegBytes`; a request that did not gets
20321
+ * `jpeg` exactly as before. MsgPack and the mesh leg both carry binary —
20322
+ * `bytes` above has crossed this boundary as a `Uint8Array` all along — so
20323
+ * base64 was buying nothing but a multi-megabyte string in the relay's heap.
20324
+ */
20325
+ jpegBytes: _instanceof(Uint8Array).optional(),
20173
20326
  width: number().int().positive(),
20174
20327
  height: number().int().positive(),
20175
20328
  /**
@@ -20236,7 +20389,14 @@ var ParkTrackFrameResultSchema = discriminatedUnion("parked", [object({
20236
20389
  })]);
20237
20390
  /** A retrieved parcel — the runner's own JPEG, base64 for the wire. */
20238
20391
  var ParkedTrackFrameSchema = object({
20239
- jpeg: string(),
20392
+ /**
20393
+ * Base64 JPEG — the pre-D462 wire. OPTIONAL since D462: a request that set
20394
+ * `acceptJpegBytes` is answered in `jpegBytes` and this is then absent.
20395
+ * Exactly one of the two is present.
20396
+ */
20397
+ jpeg: string().optional(),
20398
+ /** The same JPEG as bytes, for a caller that declared it reads them (D462). */
20399
+ jpegBytes: _instanceof(Uint8Array).optional(),
20240
20400
  width: number().int().positive(),
20241
20401
  height: number().int().positive(),
20242
20402
  /** The frame instant the parcel shows (the caller's clock, echoed back). */
@@ -20823,6 +20983,13 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20823
20983
  bbox: NativeCropBboxSchema,
20824
20984
  maxWidth: number().int().positive().optional(),
20825
20985
  /**
20986
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
20987
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
20988
+ * wire — never assume consent: a pre-D462 caller parses the field as
20989
+ * base64 and bytes would decode to garbage rather than fail.
20990
+ */
20991
+ acceptJpegBytes: boolean().optional(),
20992
+ /**
20826
20993
  * When `true`, the runner encodes the resolved crop to JPEG ON THE
20827
20994
  * OWNING NODE and returns it in `jpeg` (base64) INSTEAD of raw `bytes`.
20828
20995
  * Callers set this for CROSS-NODE fetches (`handle.nodeId` is a remote
@@ -20890,7 +21057,14 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
20890
21057
  }), ParkTrackFrameResultSchema, { kind: "mutation" }), method(object({
20891
21058
  deviceId: number(),
20892
21059
  trackId: string(),
20893
- kind: ParkedFrameKindSchema
21060
+ kind: ParkedFrameKindSchema,
21061
+ /**
21062
+ * The caller reads a `Uint8Array` (D462). When set, a JPEG answer comes
21063
+ * back in `jpegBytes` instead of base64 `jpeg`. Absent means the old
21064
+ * wire — never assume consent: a pre-D462 caller parses the field as
21065
+ * base64 and bytes would decode to garbage rather than fail.
21066
+ */
21067
+ acceptJpegBytes: boolean().optional()
20894
21068
  }), ParkedTrackFrameSchema.nullable()), method(object({
20895
21069
  deviceId: number(),
20896
21070
  trackId: string()
@@ -30589,12 +30763,24 @@ Object.freeze({
30589
30763
  addonId: null,
30590
30764
  access: "create"
30591
30765
  },
30766
+ "audioAnalyzer.attachDevice": {
30767
+ capName: "audio-analyzer",
30768
+ capScope: "system",
30769
+ addonId: null,
30770
+ access: "create"
30771
+ },
30592
30772
  "audioAnalyzer.classify": {
30593
30773
  capName: "audio-analyzer",
30594
30774
  capScope: "system",
30595
30775
  addonId: null,
30596
30776
  access: "view"
30597
30777
  },
30778
+ "audioAnalyzer.detachDevice": {
30779
+ capName: "audio-analyzer",
30780
+ capScope: "system",
30781
+ addonId: null,
30782
+ access: "create"
30783
+ },
30598
30784
  "audioAnalyzer.dispose": {
30599
30785
  capName: "audio-analyzer",
30600
30786
  capScope: "system",
@@ -36438,11 +36624,21 @@ Object.freeze({
36438
36624
  form: "single",
36439
36625
  optional: false
36440
36626
  }],
36627
+ "audioAnalyzer.attachDevice": [{
36628
+ name: "deviceId",
36629
+ form: "single",
36630
+ optional: false
36631
+ }],
36441
36632
  "audioAnalyzer.classify": [{
36442
36633
  name: "deviceId",
36443
36634
  form: "single",
36444
36635
  optional: true
36445
36636
  }],
36637
+ "audioAnalyzer.detachDevice": [{
36638
+ name: "deviceId",
36639
+ form: "single",
36640
+ optional: false
36641
+ }],
36446
36642
  "audioMetrics.getCurrentSnapshot": [{
36447
36643
  name: "deviceId",
36448
36644
  form: "single",
@@ -38294,6 +38490,52 @@ Object.freeze({
38294
38490
  "network-access": "ingress",
38295
38491
  "smtp-provider": "email"
38296
38492
  });
38493
+ var G711_SCALE_CORRECTION_DB = {
38494
+ PCMU: 20 * Math.log10(4),
38495
+ PCMA: 20 * Math.log10(8)
38496
+ };
38497
+ /**
38498
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38499
+ * same intent on the ITU-T scale (D460).
38500
+ *
38501
+ * ## When this applies, and when it is the wrong thing to reach for
38502
+ *
38503
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38504
+ * them converts:
38505
+ *
38506
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38507
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38508
+ * after. The defect was never in the number; it was that 19 of this hub's
38509
+ * 25 cameras did not obey it. Converting such a number takes something
38510
+ * correct and makes it wrong, in order to preserve a bug.
38511
+ * - **A measurement taken through the old decoder** — a value someone read
38512
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38513
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38514
+ * louder. That is what this function is for.
38515
+ *
38516
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38517
+ * and it cannot be answered from the number. It is answered by the comment the
38518
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38519
+ * mandatory.
38520
+ *
38521
+ * ## Why a function and not a typed-in number
38522
+ *
38523
+ * `-55 + 12.04` written into a source file is, six months later, completely
38524
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38525
+ * keeps the derivation, the law, and the original measurement all visible at
38526
+ * the call site, so a future reader can disagree with the *premise* instead of
38527
+ * having to reverse-engineer the sum.
38528
+ *
38529
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38530
+ * it is declared. It must never be applied to a live sample or a stored
38531
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38532
+ * adjusting numbers the decoder already got right is the original defect with
38533
+ * an extra place to argue with (D459).
38534
+ */
38535
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38536
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38537
+ }
38538
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38297
38539
  /** Schema defaults — an untouched sub-field must author exactly these. */
38298
38540
  var NC_AUDIO_DEFAULTS = {
38299
38541
  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-B99wFlH6.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-BOK9gl06.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-B99wFlH6.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-BOK9gl06.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.96",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV, SMB) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",