@camstack/addon-tailscale 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.
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_dist = require("../dist-zVDTQPmu.js");
27
+ const require_dist = require("../dist-BtxyUtA4.js");
28
28
  let node_child_process = require("node:child_process");
29
29
  let node_util = require("node:util");
30
30
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-Cp75afkR.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-CHvdQviB.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
4
  import * as fs from "node:fs";
@@ -5344,6 +5344,86 @@ var ZodIssueCode = {
5344
5344
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5345
5345
  var ZodFirstPartyTypeKind;
5346
5346
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5347
+ //#endregion
5348
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5349
+ /**
5350
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5351
+ * window to float samples (D455).
5352
+ *
5353
+ * ## Why a format at all
5354
+ *
5355
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5356
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5357
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5358
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5359
+ * the plane carried four times the source. The plane crosses hub-main twice on
5360
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5361
+ *
5362
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5363
+ * them where it needs them. That is the same argument D450 made for the rate,
5364
+ * one step further along the same wire.
5365
+ *
5366
+ * ## Why the expansion lives here
5367
+ *
5368
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5369
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5370
+ * `AudioChunkPlane` expands per subscription) and
5371
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5372
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5373
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5374
+ * into their own dist (`self-contained` externals), so this travels with a
5375
+ * `camstack deploy` and needs no published server.
5376
+ *
5377
+ * A second μ-law table anywhere else is the defect this module exists to
5378
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5379
+ * direction for the WebRTC egress — a different transform, not a copy.)
5380
+ *
5381
+ * ## Absent means f32le
5382
+ *
5383
+ * `format` is optional on the wire and its absence means `f32le` — today's
5384
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5385
+ * has always been served, because the broker only emits a coded window to a
5386
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5387
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5388
+ * deployable one addon at a time across three nodes.
5389
+ */
5390
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5391
+ var AUDIO_CHUNK_FORMATS = [
5392
+ "f32le",
5393
+ "pcmu",
5394
+ "pcma"
5395
+ ];
5396
+ /**
5397
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5398
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5399
+ *
5400
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5401
+ * it buffers the coded bytes and the plane's consumers expand.
5402
+ */
5403
+ function buildUlawTable() {
5404
+ const table = new Float32Array(256);
5405
+ for (let i = 0; i < 256; i++) {
5406
+ const complemented = ~i & 255;
5407
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5408
+ const exponent = complemented >> 4 & 7;
5409
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5410
+ }
5411
+ return table;
5412
+ }
5413
+ /** Build the A-law decode table (ITU-T G.711). */
5414
+ function buildAlawTable() {
5415
+ const table = new Float32Array(256);
5416
+ for (let i = 0; i < 256; i++) {
5417
+ const xored = i ^ 85;
5418
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5419
+ const exponent = xored >> 4 & 7;
5420
+ const mantissa = xored & 15;
5421
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5422
+ }
5423
+ return table;
5424
+ }
5425
+ buildUlawTable();
5426
+ buildAlawTable();
5347
5427
  Object.fromEntries([
5348
5428
  {
5349
5429
  id: "overview",
@@ -6636,11 +6716,20 @@ var SubscribeFramesResultSchema = object({
6636
6716
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6637
6717
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6638
6718
  */
6719
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6639
6720
  var DecodedAudioChunkSchema = object({
6640
6721
  data: _instanceof(Uint8Array),
6641
6722
  sampleRate: number().int().positive(),
6642
6723
  channels: number().int().positive(),
6643
- timestamp: number()
6724
+ timestamp: number(),
6725
+ /**
6726
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6727
+ * byte, for any peer that never heard of this field. A coded window
6728
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6729
+ * subscription that DECLARED it accepts one, so absence can never mean
6730
+ * "coded bytes a consumer will read as floats" (D455).
6731
+ */
6732
+ format: AudioChunkFormatSchema.optional()
6644
6733
  });
6645
6734
  /**
6646
6735
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6652,7 +6741,18 @@ var DecodedAudioChunkSchema = object({
6652
6741
  var SubscribeAudioChunksInputSchema = object({
6653
6742
  brokerId: string(),
6654
6743
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6655
- tag: string().optional()
6744
+ tag: string().optional(),
6745
+ /**
6746
+ * Byte formats this subscriber can READ, best first. The broker serves the
6747
+ * chunk's own format when it is in this list and expands to `f32le`
6748
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6749
+ *
6750
+ * Absent (or without the source format) means `f32le` — the behaviour every
6751
+ * subscriber had before D455, unchanged. This is the negotiation half of
6752
+ * the source-bytes lever: it is what lets the broker and its consumers
6753
+ * deploy one at a time across three nodes.
6754
+ */
6755
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6656
6756
  });
6657
6757
  /** Result of `stream-broker.subscribeAudioChunks`. */
6658
6758
  var SubscribeAudioChunksResultSchema = object({
@@ -10658,6 +10758,51 @@ var AudioAnalysisSettingsSchema = object({
10658
10758
  minConfidence: number().min(0).max(1).default(.3),
10659
10759
  allowedClasses: array(string()).default([])
10660
10760
  });
10761
+ /**
10762
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10763
+ *
10764
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10765
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10766
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10767
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10768
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10769
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10770
+ * way to the one expansion that feeds the model.
10771
+ *
10772
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10773
+ * window, the per-device node assignment, the settings read) and therefore
10774
+ * still owns the attach/detach pair. It no longer owns the bytes.
10775
+ */
10776
+ var AudioAttachDeviceInputSchema = object({
10777
+ deviceId: number(),
10778
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10779
+ brokerId: string(),
10780
+ /**
10781
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10782
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10783
+ * the orchestrator's poller pinned them before the move.
10784
+ */
10785
+ ingestNodeId: string(),
10786
+ /**
10787
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10788
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10789
+ * window: a settings change re-attaches, which is what always happened.
10790
+ */
10791
+ settings: AudioAnalysisSettingsSchema
10792
+ });
10793
+ var AudioAttachDeviceResultSchema = object({
10794
+ /** False only when the analyzer is shutting down and refused to attach. */
10795
+ attached: boolean(),
10796
+ /**
10797
+ * True when the attachment replaced a live one for the same device. An
10798
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10799
+ * double the broker's fanout and neither would know about the other.
10800
+ */
10801
+ replaced: boolean()
10802
+ });
10803
+ var AudioDetachDeviceResultSchema = object({
10804
+ /** False when no attachment existed — detach is idempotent. */
10805
+ detached: boolean() });
10661
10806
  var AudioClassificationResultSchema = object({
10662
10807
  labels: array(AudioClassificationLabelSchema).readonly(),
10663
10808
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10666,7 +10811,7 @@ var AudioClassificationResultSchema = object({
10666
10811
  method(object({
10667
10812
  chunk: AudioChunkInputSchema,
10668
10813
  settings: AudioAnalysisSettingsSchema
10669
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10814
+ }), 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() }), {
10670
10815
  kind: "mutation",
10671
10816
  auth: "admin"
10672
10817
  });
@@ -24809,8 +24954,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24809
24954
  *
24810
24955
  * An **empty array reads NOTHING** — `[]` is an empty page, never
24811
24956
  * "every camera". A request for no devices is a request, not an
24812
- * omission; same contract as `deviceManager.listFleet` and
24813
- * `pipelineAnalytics.listRecentTracks`.
24957
+ * omission; same contract as `deviceManager.listAll`'s `deviceIds`
24958
+ * and `pipelineAnalytics.listRecentTracks`.
24814
24959
  *
24815
24960
  * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24816
24961
  */
@@ -30639,12 +30784,24 @@ Object.freeze({
30639
30784
  addonId: null,
30640
30785
  access: "create"
30641
30786
  },
30787
+ "audioAnalyzer.attachDevice": {
30788
+ capName: "audio-analyzer",
30789
+ capScope: "system",
30790
+ addonId: null,
30791
+ access: "create"
30792
+ },
30642
30793
  "audioAnalyzer.classify": {
30643
30794
  capName: "audio-analyzer",
30644
30795
  capScope: "system",
30645
30796
  addonId: null,
30646
30797
  access: "view"
30647
30798
  },
30799
+ "audioAnalyzer.detachDevice": {
30800
+ capName: "audio-analyzer",
30801
+ capScope: "system",
30802
+ addonId: null,
30803
+ access: "create"
30804
+ },
30648
30805
  "audioAnalyzer.dispose": {
30649
30806
  capName: "audio-analyzer",
30650
30807
  capScope: "system",
@@ -36488,11 +36645,21 @@ Object.freeze({
36488
36645
  form: "single",
36489
36646
  optional: false
36490
36647
  }],
36648
+ "audioAnalyzer.attachDevice": [{
36649
+ name: "deviceId",
36650
+ form: "single",
36651
+ optional: false
36652
+ }],
36491
36653
  "audioAnalyzer.classify": [{
36492
36654
  name: "deviceId",
36493
36655
  form: "single",
36494
36656
  optional: true
36495
36657
  }],
36658
+ "audioAnalyzer.detachDevice": [{
36659
+ name: "deviceId",
36660
+ form: "single",
36661
+ optional: false
36662
+ }],
36496
36663
  "audioMetrics.getCurrentSnapshot": [{
36497
36664
  name: "deviceId",
36498
36665
  form: "single",
@@ -38344,6 +38511,52 @@ Object.freeze({
38344
38511
  "network-access": "ingress",
38345
38512
  "smtp-provider": "email"
38346
38513
  });
38514
+ var G711_SCALE_CORRECTION_DB = {
38515
+ PCMU: 20 * Math.log10(4),
38516
+ PCMA: 20 * Math.log10(8)
38517
+ };
38518
+ /**
38519
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38520
+ * same intent on the ITU-T scale (D460).
38521
+ *
38522
+ * ## When this applies, and when it is the wrong thing to reach for
38523
+ *
38524
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38525
+ * them converts:
38526
+ *
38527
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38528
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38529
+ * after. The defect was never in the number; it was that 19 of this hub's
38530
+ * 25 cameras did not obey it. Converting such a number takes something
38531
+ * correct and makes it wrong, in order to preserve a bug.
38532
+ * - **A measurement taken through the old decoder** — a value someone read
38533
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38534
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38535
+ * louder. That is what this function is for.
38536
+ *
38537
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38538
+ * and it cannot be answered from the number. It is answered by the comment the
38539
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38540
+ * mandatory.
38541
+ *
38542
+ * ## Why a function and not a typed-in number
38543
+ *
38544
+ * `-55 + 12.04` written into a source file is, six months later, completely
38545
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38546
+ * keeps the derivation, the law, and the original measurement all visible at
38547
+ * the call site, so a future reader can disagree with the *premise* instead of
38548
+ * having to reverse-engineer the sum.
38549
+ *
38550
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38551
+ * it is declared. It must never be applied to a live sample or a stored
38552
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38553
+ * adjusting numbers the decoder already got right is the original defect with
38554
+ * an extra place to argue with (D459).
38555
+ */
38556
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38557
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38558
+ }
38559
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38347
38560
  /** Schema defaults — an untouched sub-field must author exactly these. */
38348
38561
  var NC_AUDIO_DEFAULTS = {
38349
38562
  hitPercent: 60,
@@ -5344,6 +5344,86 @@ var ZodIssueCode = {
5344
5344
  /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
5345
5345
  var ZodFirstPartyTypeKind;
5346
5346
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5347
+ //#endregion
5348
+ //#region ../types/dist/sleep-BnujYGPe.mjs
5349
+ /**
5350
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
5351
+ * window to float samples (D455).
5352
+ *
5353
+ * ## Why a format at all
5354
+ *
5355
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
5356
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
5357
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
5358
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
5359
+ * the plane carried four times the source. The plane crosses hub-main twice on
5360
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
5361
+ *
5362
+ * So the plane carries the source BYTES too, and whoever needs floats expands
5363
+ * them where it needs them. That is the same argument D450 made for the rate,
5364
+ * one step further along the same wire.
5365
+ *
5366
+ * ## Why the expansion lives here
5367
+ *
5368
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
5369
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
5370
+ * `AudioChunkPlane` expands per subscription) and
5371
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
5372
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
5373
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
5374
+ * into their own dist (`self-contained` externals), so this travels with a
5375
+ * `camstack deploy` and needs no published server.
5376
+ *
5377
+ * A second μ-law table anywhere else is the defect this module exists to
5378
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
5379
+ * direction for the WebRTC egress — a different transform, not a copy.)
5380
+ *
5381
+ * ## Absent means f32le
5382
+ *
5383
+ * `format` is optional on the wire and its absence means `f32le` — today's
5384
+ * bytes, byte for byte. A peer that never heard of the field is served what it
5385
+ * has always been served, because the broker only emits a coded window to a
5386
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
5387
+ * That is the D448 `rawForward` negotiation, and it is what makes this
5388
+ * deployable one addon at a time across three nodes.
5389
+ */
5390
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
5391
+ var AUDIO_CHUNK_FORMATS = [
5392
+ "f32le",
5393
+ "pcmu",
5394
+ "pcma"
5395
+ ];
5396
+ /**
5397
+ * Build the μ-law decode table (ITU-T G.711). Each of the 256 byte values maps
5398
+ * to a 16-bit PCM sample, normalised to [-1.0, 1.0] for f32le output.
5399
+ *
5400
+ * Moved here verbatim from `audio-rtp-decoder.ts`, which no longer decodes:
5401
+ * it buffers the coded bytes and the plane's consumers expand.
5402
+ */
5403
+ function buildUlawTable() {
5404
+ const table = new Float32Array(256);
5405
+ for (let i = 0; i < 256; i++) {
5406
+ const complemented = ~i & 255;
5407
+ const sign = (complemented & 128) !== 0 ? -1 : 1;
5408
+ const exponent = complemented >> 4 & 7;
5409
+ table[i] = sign * ((8 * (complemented & 15) + 132 << exponent) - 132) / 32768;
5410
+ }
5411
+ return table;
5412
+ }
5413
+ /** Build the A-law decode table (ITU-T G.711). */
5414
+ function buildAlawTable() {
5415
+ const table = new Float32Array(256);
5416
+ for (let i = 0; i < 256; i++) {
5417
+ const xored = i ^ 85;
5418
+ const sign = (xored & 128) !== 0 ? 1 : -1;
5419
+ const exponent = xored >> 4 & 7;
5420
+ const mantissa = xored & 15;
5421
+ table[i] = sign * (exponent === 0 ? 16 * mantissa + 8 : 16 * mantissa + 264 << exponent - 1) / 32768;
5422
+ }
5423
+ return table;
5424
+ }
5425
+ buildUlawTable();
5426
+ buildAlawTable();
5347
5427
  Object.fromEntries([
5348
5428
  {
5349
5429
  id: "overview",
@@ -6636,11 +6716,20 @@ var SubscribeFramesResultSchema = object({
6636
6716
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
6637
6717
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
6638
6718
  */
6719
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
6639
6720
  var DecodedAudioChunkSchema = object({
6640
6721
  data: _instanceof(Uint8Array),
6641
6722
  sampleRate: number().int().positive(),
6642
6723
  channels: number().int().positive(),
6643
- timestamp: number()
6724
+ timestamp: number(),
6725
+ /**
6726
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
6727
+ * byte, for any peer that never heard of this field. A coded window
6728
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
6729
+ * subscription that DECLARED it accepts one, so absence can never mean
6730
+ * "coded bytes a consumer will read as floats" (D455).
6731
+ */
6732
+ format: AudioChunkFormatSchema.optional()
6644
6733
  });
6645
6734
  /**
6646
6735
  * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). The
@@ -6652,7 +6741,18 @@ var DecodedAudioChunkSchema = object({
6652
6741
  var SubscribeAudioChunksInputSchema = object({
6653
6742
  brokerId: string(),
6654
6743
  /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
6655
- tag: string().optional()
6744
+ tag: string().optional(),
6745
+ /**
6746
+ * Byte formats this subscriber can READ, best first. The broker serves the
6747
+ * chunk's own format when it is in this list and expands to `f32le`
6748
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
6749
+ *
6750
+ * Absent (or without the source format) means `f32le` — the behaviour every
6751
+ * subscriber had before D455, unchanged. This is the negotiation half of
6752
+ * the source-bytes lever: it is what lets the broker and its consumers
6753
+ * deploy one at a time across three nodes.
6754
+ */
6755
+ accept: array(AudioChunkFormatSchema).readonly().optional()
6656
6756
  });
6657
6757
  /** Result of `stream-broker.subscribeAudioChunks`. */
6658
6758
  var SubscribeAudioChunksResultSchema = object({
@@ -10658,6 +10758,51 @@ var AudioAnalysisSettingsSchema = object({
10658
10758
  minConfidence: number().min(0).max(1).default(.3),
10659
10759
  allowedClasses: array(string()).default([])
10660
10760
  });
10761
+ /**
10762
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
10763
+ *
10764
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
10765
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
10766
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
10767
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
10768
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
10769
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
10770
+ * way to the one expansion that feeds the model.
10771
+ *
10772
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
10773
+ * window, the per-device node assignment, the settings read) and therefore
10774
+ * still owns the attach/detach pair. It no longer owns the bytes.
10775
+ */
10776
+ var AudioAttachDeviceInputSchema = object({
10777
+ deviceId: number(),
10778
+ /** Broker id (`<deviceId>/<camStreamId>`) carrying this camera's audio. */
10779
+ brokerId: string(),
10780
+ /**
10781
+ * `clusterRoles.ingestNode` — the node whose broker owns the source dial.
10782
+ * Every `streamBroker` call the attachment makes is pinned to it, exactly as
10783
+ * the orchestrator's poller pinned them before the move.
10784
+ */
10785
+ ingestNodeId: string(),
10786
+ /**
10787
+ * Resolved once by the orchestrator at attach time, exactly as it was read
10788
+ * once per subscription before D461. The analyzer does NOT re-resolve per
10789
+ * window: a settings change re-attaches, which is what always happened.
10790
+ */
10791
+ settings: AudioAnalysisSettingsSchema
10792
+ });
10793
+ var AudioAttachDeviceResultSchema = object({
10794
+ /** False only when the analyzer is shutting down and refused to attach. */
10795
+ attached: boolean(),
10796
+ /**
10797
+ * True when the attachment replaced a live one for the same device. An
10798
+ * attach is idempotent by REPLACEMENT — two pollers on one camera would
10799
+ * double the broker's fanout and neither would know about the other.
10800
+ */
10801
+ replaced: boolean()
10802
+ });
10803
+ var AudioDetachDeviceResultSchema = object({
10804
+ /** False when no attachment existed — detach is idempotent. */
10805
+ detached: boolean() });
10661
10806
  var AudioClassificationResultSchema = object({
10662
10807
  labels: array(AudioClassificationLabelSchema).readonly(),
10663
10808
  rawLabels: array(AudioClassificationLabelSchema).readonly().optional(),
@@ -10666,7 +10811,7 @@ var AudioClassificationResultSchema = object({
10666
10811
  method(object({
10667
10812
  chunk: AudioChunkInputSchema,
10668
10813
  settings: AudioAnalysisSettingsSchema
10669
- }), AudioAnalysisResultSchema.nullable(), { kind: "mutation" }), method(AudioChunkInputSchema, AudioClassificationResultSchema, { timeoutMs: 3e4 }), method(_void(), boolean()), method(_void(), _void(), { kind: "mutation" }), method(_void(), object({ backend: string() }), {
10814
+ }), 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() }), {
10670
10815
  kind: "mutation",
10671
10816
  auth: "admin"
10672
10817
  });
@@ -24809,8 +24954,8 @@ includeCrops: boolean().optional() }).optional(), array(IdentitySchema).readonly
24809
24954
  *
24810
24955
  * An **empty array reads NOTHING** — `[]` is an empty page, never
24811
24956
  * "every camera". A request for no devices is a request, not an
24812
- * omission; same contract as `deviceManager.listFleet` and
24813
- * `pipelineAnalytics.listRecentTracks`.
24957
+ * omission; same contract as `deviceManager.listAll`'s `deviceIds`
24958
+ * and `pipelineAnalytics.listRecentTracks`.
24814
24959
  *
24815
24960
  * Absent (`undefined`) is the omission, and keeps the cluster-wide view.
24816
24961
  */
@@ -30639,12 +30784,24 @@ Object.freeze({
30639
30784
  addonId: null,
30640
30785
  access: "create"
30641
30786
  },
30787
+ "audioAnalyzer.attachDevice": {
30788
+ capName: "audio-analyzer",
30789
+ capScope: "system",
30790
+ addonId: null,
30791
+ access: "create"
30792
+ },
30642
30793
  "audioAnalyzer.classify": {
30643
30794
  capName: "audio-analyzer",
30644
30795
  capScope: "system",
30645
30796
  addonId: null,
30646
30797
  access: "view"
30647
30798
  },
30799
+ "audioAnalyzer.detachDevice": {
30800
+ capName: "audio-analyzer",
30801
+ capScope: "system",
30802
+ addonId: null,
30803
+ access: "create"
30804
+ },
30648
30805
  "audioAnalyzer.dispose": {
30649
30806
  capName: "audio-analyzer",
30650
30807
  capScope: "system",
@@ -36488,11 +36645,21 @@ Object.freeze({
36488
36645
  form: "single",
36489
36646
  optional: false
36490
36647
  }],
36648
+ "audioAnalyzer.attachDevice": [{
36649
+ name: "deviceId",
36650
+ form: "single",
36651
+ optional: false
36652
+ }],
36491
36653
  "audioAnalyzer.classify": [{
36492
36654
  name: "deviceId",
36493
36655
  form: "single",
36494
36656
  optional: true
36495
36657
  }],
36658
+ "audioAnalyzer.detachDevice": [{
36659
+ name: "deviceId",
36660
+ form: "single",
36661
+ optional: false
36662
+ }],
36496
36663
  "audioMetrics.getCurrentSnapshot": [{
36497
36664
  name: "deviceId",
36498
36665
  form: "single",
@@ -38344,6 +38511,52 @@ Object.freeze({
38344
38511
  "network-access": "ingress",
38345
38512
  "smtp-provider": "email"
38346
38513
  });
38514
+ var G711_SCALE_CORRECTION_DB = {
38515
+ PCMU: 20 * Math.log10(4),
38516
+ PCMA: 20 * Math.log10(8)
38517
+ };
38518
+ /**
38519
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
38520
+ * same intent on the ITU-T scale (D460).
38521
+ *
38522
+ * ## When this applies, and when it is the wrong thing to reach for
38523
+ *
38524
+ * An absolute-dBFS number in this repo is one of two things, and only one of
38525
+ * them converts:
38526
+ *
38527
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
38528
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
38529
+ * after. The defect was never in the number; it was that 19 of this hub's
38530
+ * 25 cameras did not obey it. Converting such a number takes something
38531
+ * correct and makes it wrong, in order to preserve a bug.
38532
+ * - **A measurement taken through the old decoder** — a value someone read
38533
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
38534
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
38535
+ * louder. That is what this function is for.
38536
+ *
38537
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
38538
+ * and it cannot be answered from the number. It is answered by the comment the
38539
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
38540
+ * mandatory.
38541
+ *
38542
+ * ## Why a function and not a typed-in number
38543
+ *
38544
+ * `-55 + 12.04` written into a source file is, six months later, completely
38545
+ * indistinguishable from a threshold somebody simply preferred. Calling this
38546
+ * keeps the derivation, the law, and the original measurement all visible at
38547
+ * the call site, so a future reader can disagree with the *premise* instead of
38548
+ * having to reverse-engineer the sum.
38549
+ *
38550
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
38551
+ * it is declared. It must never be applied to a live sample or a stored
38552
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
38553
+ * adjusting numbers the decoder already got right is the original defect with
38554
+ * an extra place to argue with (D459).
38555
+ */
38556
+ function ituDbfsFromPreEpoch(law, authoredDbfs) {
38557
+ return authoredDbfs + G711_SCALE_CORRECTION_DB[law];
38558
+ }
38559
+ Math.round(ituDbfsFromPreEpoch("PCMU", -55));
38347
38560
  /** Schema defaults — an untouched sub-field must author exactly these. */
38348
38561
  var NC_AUDIO_DEFAULTS = {
38349
38562
  hitPercent: 60,
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-zVDTQPmu.js");
5
+ const require_dist = require("../dist-BtxyUtA4.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/ingress/tailscale-cli.ts
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-Cp75afkR.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-CHvdQviB.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-tailscale",
3
- "version": "1.2.94",
3
+ "version": "1.2.96",
4
4
  "description": "Tailscale bundle for CamStack — joins the host to a tailnet (client) and exposes the hub via Serve/Funnel (ingress). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",