@camstack/types 1.2.177 → 1.2.179

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/addon.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_sleep = require("./sleep-B1ZwxAhh.js");
2
3
  const require_event_category = require("./event-category-BNJ9EE5B.js");
3
- const require_sleep = require("./sleep-CTHjJilA.js");
4
4
  const require_err_msg = require("./err-msg-COpsHMw2.js");
5
5
  //#region src/generated/cap-input-defaults.ts
6
6
  /**
@@ -16,14 +16,20 @@ const require_err_msg = require("./err-msg-COpsHMw2.js");
16
16
  * Plain data, zero Zod: a forked runner must not import the schema barrel
17
17
  * (~144MB RSS per runner — D28).
18
18
  *
19
- * Coverage: 24 caps, 56 methods with defaults.
19
+ * Coverage: 24 caps, 57 methods with defaults.
20
20
  */
21
21
  var CAP_INPUT_DEFAULTS = Object.freeze({
22
22
  "addons": { "getLogs": { "limit": 100 } },
23
- "audio-analyzer": { "analyseChunk": { "settings": { "__nested__": {
24
- "minConfidence": .3,
25
- "allowedClasses": []
26
- } } } },
23
+ "audio-analyzer": {
24
+ "analyseChunk": { "settings": { "__nested__": {
25
+ "minConfidence": .3,
26
+ "allowedClasses": []
27
+ } } },
28
+ "attachDevice": { "settings": { "__nested__": {
29
+ "minConfidence": .3,
30
+ "allowedClasses": []
31
+ } } }
32
+ },
27
33
  "audio-codec": {
28
34
  "pullEncoded": { "maxCount": 8 },
29
35
  "pullPcm": { "maxCount": 8 }
package/dist/addon.mjs CHANGED
@@ -1,5 +1,5 @@
1
+ import { D as adminUiCapability, E as DeviceType, G as scopeKey, H as ReadinessTimeoutError, M as expandCapMethods, R as nodePin, S as DEVICE_CHILDREN_BATCH_MAX, St as normalizeAddonInitResult, Tt as emitReadiness, V as ReadinessRegistry, a as asJsonObject, b as deviceOpsCapability, bt as DisposerChain, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, h as createEventBusSliceSource, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, vt as DATAPLANE_SECRET_HEADER, x as viewerUiCapability, xt as BaseAddon, z as readNodePin } from "./sleep-BnujYGPe.mjs";
1
2
  import { t as EventCategory } from "./event-category-DAXzJeTX.mjs";
2
- import { D as adminUiCapability, E as DeviceType, G as scopeKey, H as ReadinessTimeoutError, M as expandCapMethods, R as nodePin, S as DEVICE_CHILDREN_BATCH_MAX, V as ReadinessRegistry, _t as DATAPLANE_SECRET_HEADER, a as asJsonObject, b as deviceOpsCapability, bt as BaseAddon, d as BOOT_RECOVERY_BACKOFF_MS, f as DEVICE_SCOPED_CAPS, h as createEventBusSliceSource, m as createDeviceProxy, p as isDeviceScopedCap, s as asString, t as sleep, u as parseJsonUnknown, wt as emitReadiness, x as viewerUiCapability, xt as normalizeAddonInitResult, yt as DisposerChain, z as readNodePin } from "./sleep-ox21Ig4I.mjs";
3
3
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
4
4
  //#region src/generated/cap-input-defaults.ts
5
5
  /**
@@ -15,14 +15,20 @@ import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
15
15
  * Plain data, zero Zod: a forked runner must not import the schema barrel
16
16
  * (~144MB RSS per runner — D28).
17
17
  *
18
- * Coverage: 24 caps, 56 methods with defaults.
18
+ * Coverage: 24 caps, 57 methods with defaults.
19
19
  */
20
20
  var CAP_INPUT_DEFAULTS = Object.freeze({
21
21
  "addons": { "getLogs": { "limit": 100 } },
22
- "audio-analyzer": { "analyseChunk": { "settings": { "__nested__": {
23
- "minConfidence": .3,
24
- "allowedClasses": []
25
- } } } },
22
+ "audio-analyzer": {
23
+ "analyseChunk": { "settings": { "__nested__": {
24
+ "minConfidence": .3,
25
+ "allowedClasses": []
26
+ } } },
27
+ "attachDevice": { "settings": { "__nested__": {
28
+ "minConfidence": .3,
29
+ "allowedClasses": []
30
+ } } }
31
+ },
26
32
  "audio-codec": {
27
33
  "pullEncoded": { "maxCount": 8 },
28
34
  "pullPcm": { "maxCount": 8 }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The audio chunk plane's byte format, and the ONE expansion from a coded
3
+ * window to float samples (D455).
4
+ *
5
+ * ## Why a format at all
6
+ *
7
+ * D450 took the plane off its 8 → 16 kHz upsample: it carries the SOURCE
8
+ * RATE, and the one consumer that needs 16 kHz resamples next to the model.
9
+ * It left the FORMAT alone — the broker still turned each G.711 byte into a
10
+ * 4-byte f32le sample before the bytes entered the transport, so every leg of
11
+ * the plane carried four times the source. The plane crosses hub-main twice on
12
+ * the way to the analyzer, and the fleet's G.711 cameras are ~79 % of it.
13
+ *
14
+ * So the plane carries the source BYTES too, and whoever needs floats expands
15
+ * them where it needs them. That is the same argument D450 made for the rate,
16
+ * one step further along the same wire.
17
+ *
18
+ * ## Why the expansion lives here
19
+ *
20
+ * Two packages need it and they must never disagree: `addon-pipeline`'s broker
21
+ * (which still has to serve a subscriber that did NOT ask for coded bytes —
22
+ * `AudioChunkPlane` expands per subscription) and
23
+ * `addon-pipeline-orchestrator`'s `AudioWindowAccumulator` (which flushes an
24
+ * f32le window to the analyzer cap, whose `AudioChunkInput` contract is
25
+ * unchanged and stays f32le). Both bundle the bare `@camstack/types` entry
26
+ * into their own dist (`self-contained` externals), so this travels with a
27
+ * `camstack deploy` and needs no published server.
28
+ *
29
+ * A second μ-law table anywhere else is the defect this module exists to
30
+ * prevent. (`stream-broker.ts`'s `mulawToPcm` / `alawToPcm` are the ENCODE
31
+ * direction for the WebRTC egress — a different transform, not a copy.)
32
+ *
33
+ * ## Absent means f32le
34
+ *
35
+ * `format` is optional on the wire and its absence means `f32le` — today's
36
+ * bytes, byte for byte. A peer that never heard of the field is served what it
37
+ * has always been served, because the broker only emits a coded window to a
38
+ * subscription that DECLARED it accepts one (`AudioSubscribeOptions.accept`).
39
+ * That is the D448 `rawForward` negotiation, and it is what makes this
40
+ * deployable one addon at a time across three nodes.
41
+ */
42
+ /** Every byte format the audio chunk plane can carry. `f32le` is the default. */
43
+ export declare const AUDIO_CHUNK_FORMATS: readonly ["f32le", "pcmu", "pcma"];
44
+ /**
45
+ * The byte format of a decoded audio chunk's `data`.
46
+ *
47
+ * - `f32le` — 4 bytes per sample, normalised IEEE 754 float in [-1, 1].
48
+ * - `pcmu` — ITU-T G.711 μ-law, 1 byte per sample.
49
+ * - `pcma` — ITU-T G.711 A-law, 1 byte per sample.
50
+ */
51
+ export type AudioChunkFormat = (typeof AUDIO_CHUNK_FORMATS)[number];
52
+ /** Type guard for a value that arrived over the wire as a format name. */
53
+ export declare function isAudioChunkFormat(value: unknown): value is AudioChunkFormat;
54
+ /**
55
+ * Bytes one sample of `format` occupies. This is the number every duration
56
+ * calculation over a chunk's `data` must use — a window accumulator that
57
+ * hard-codes 4 reports a quarter of the audio it actually holds and flushes
58
+ * four-second windows to a classifier expecting one.
59
+ */
60
+ export declare function audioChunkBytesPerSample(format: AudioChunkFormat): number;
61
+ /**
62
+ * Expand a CODED audio window to freshly-owned f32le bytes, 4-byte aligned at
63
+ * offset 0, so a caller can build a `Float32Array` view over them directly.
64
+ * The input may be a msgpack subview at any offset; nothing here reads it as
65
+ * anything but bytes.
66
+ *
67
+ * `f32le` is accepted and returns a copy, but a caller that already knows the
68
+ * format is `f32le` should not call this at all — it has the bytes. Both
69
+ * callers branch on the format first for exactly that reason, and the copy
70
+ * here exists so the return type is always owned rather than sometimes
71
+ * aliasing the argument.
72
+ */
73
+ export declare function expandAudioChunkToF32le(data: Uint8Array, format: AudioChunkFormat): Uint8Array<ArrayBuffer>;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The instant the audio amplitude scale changed, and by how much (D459).
3
+ *
4
+ * ## What happened
5
+ *
6
+ * Until this epoch the native RTP G.711 decoder that feeds the audio chunk
7
+ * plane — `stream-broker/rtsp/audio-rtp-decoder.ts`, the PCM the audio
8
+ * CLASSIFIER and the dBFS level meter read — decoded μ-law at exactly 1/4 of
9
+ * its ITU-T G.711 value and A-law at exactly −1/8 (magnitude *and* sign). The
10
+ * WebRTC/Opus egress decoded the same bytes correctly in `g711-mulaw.ts`, so
11
+ * **the audio an operator HEARD was right and the audio the detector MEASURED
12
+ * was 4–8× quieter**, which is why it survived so long.
13
+ *
14
+ * Non-G.711 sources — AAC and Opus, decoded through the `audio-codec` cap —
15
+ * were always on the ITU-T scale and are NOT affected. Nothing here should
16
+ * ever be applied to them.
17
+ *
18
+ * ## What this module is for, and what it is NOT for
19
+ *
20
+ * It is the ONE place the two numbers live, so no caller re-derives them and
21
+ * no second constant can disagree. It exists for two readers:
22
+ *
23
+ * - **A person re-calibrating a threshold.** Every absolute-dBFS gate
24
+ * authored before the epoch against a native G.711 camera is now that many
25
+ * dB too permissive: `NcAudioCondition.dbThreshold`,
26
+ * `RecordingTriggers.audioThresholdDbfs`, `audioMarkerMinDbfs`, and the
27
+ * viewer's per-grid `audioDb`.
28
+ * - **Anything drawing a level across the epoch.** A graph that spans it
29
+ * shows a step of 12.04 dB (PCMU) or 18.06 dB (PCMA) on the affected
30
+ * cameras. `audioScaleEraOf` is how a reader says which side a sample is
31
+ * on instead of leaving the step unexplained.
32
+ *
33
+ * **It is NOT a gain to apply to a sample.** Stored history is NOT rewritten
34
+ * and live audio is NOT re-scaled: the decoder is correct now, and a second
35
+ * authority that "fixes up" a number the decoder already got right is the
36
+ * defect again with an extra place to argue with. Nor can history be
37
+ * retro-corrected honestly — `DecodedAudioChunk` never carried the codec, so
38
+ * a stored `AudioEvent.dbfs` does not say which of the two factors (or
39
+ * neither) applied to it. Guessing per row is exactly the move that wrote the
40
+ * original defect.
41
+ */
42
+ /** Spelling of the epoch, so the millisecond constant is readable. */
43
+ export declare const AUDIO_SCALE_EPOCH_ISO = "2026-09-11T00:00:00.000Z";
44
+ /**
45
+ * The instant, in epoch milliseconds. A reading at or after it is on the
46
+ * ITU-T scale; a reading before it, from a native G.711 camera, is 12–18 dB
47
+ * low.
48
+ *
49
+ * It is the DAY, not the deploy minute, and deliberately so: the correction
50
+ * reaches each node when that node's `addon-pipeline` is redeployed, which is
51
+ * neither simultaneous across the fleet nor knowable from here. A reader that
52
+ * treats the boundary as fuzzy by a few hours is reading it correctly; one
53
+ * that treats a sample 200 ms after it as authoritative is not.
54
+ */
55
+ export declare const AUDIO_SCALE_EPOCH_MS: number;
56
+ /**
57
+ * How many dB a pre-epoch reading from a native G.711 camera was LOW, by law.
58
+ *
59
+ * Derived, not measured: the old tables were under-scaled by exactly 4 (μ-law)
60
+ * and exactly 8 (A-law) on all 256 codes, and `20·log10` turns an amplitude
61
+ * factor into dB. A-law's extra octave is its own separate defect — its
62
+ * magnitudes were built on a 13-bit scale and never shifted to 16.
63
+ *
64
+ * To convert a threshold authored on the old scale to the same intent on the
65
+ * ITU-T scale, ADD this (a −55 dBFS gate on a PCMU camera meant −42.96).
66
+ */
67
+ export type G711Law = 'PCMU' | 'PCMA';
68
+ export declare const G711_SCALE_CORRECTION_DB: Readonly<Record<G711Law, number>>;
69
+ /**
70
+ * Restate a dBFS number that was MEASURED through the pre-epoch decoder as the
71
+ * same intent on the ITU-T scale (D460).
72
+ *
73
+ * ## When this applies, and when it is the wrong thing to reach for
74
+ *
75
+ * An absolute-dBFS number in this repo is one of two things, and only one of
76
+ * them converts:
77
+ *
78
+ * - **A statement about the scale** — "-55 dBFS is near silence", "-25 dBFS
79
+ * is loud". It was true on the ITU-T scale before the epoch and it is true
80
+ * after. The defect was never in the number; it was that 19 of this hub's
81
+ * 25 cameras did not obey it. Converting such a number takes something
82
+ * correct and makes it wrong, in order to preserve a bug.
83
+ * - **A measurement taken through the old decoder** — a value someone read
84
+ * off a meter that under-reported by exactly 4× (PCMU) or 8× (PCMA). It
85
+ * describes a sound that was really {@link G711_SCALE_CORRECTION_DB} dB
86
+ * louder. That is what this function is for.
87
+ *
88
+ * Telling the two apart is a question about PROVENANCE, not about arithmetic,
89
+ * and it cannot be answered from the number. It is answered by the comment the
90
+ * author left — which is why `scripts/check-dbfs-era.mts` makes leaving one
91
+ * mandatory.
92
+ *
93
+ * ## Why a function and not a typed-in number
94
+ *
95
+ * `-55 + 12.04` written into a source file is, six months later, completely
96
+ * indistinguishable from a threshold somebody simply preferred. Calling this
97
+ * keeps the derivation, the law, and the original measurement all visible at
98
+ * the call site, so a future reader can disagree with the *premise* instead of
99
+ * having to reverse-engineer the sum.
100
+ *
101
+ * **This is not a runtime gain.** It converts an authored CONSTANT once, where
102
+ * it is declared. It must never be applied to a live sample or a stored
103
+ * `AudioEvent.dbfs`: the decoder is correct now, and a second authority
104
+ * adjusting numbers the decoder already got right is the original defect with
105
+ * an extra place to argue with (D459).
106
+ */
107
+ export declare function ituDbfsFromPreEpoch(law: G711Law, authoredDbfs: number): number;
108
+ /**
109
+ * Which amplitude scale a dBFS reading taken at `timestampMs` is on.
110
+ *
111
+ * `unknown` is a real answer and never collapses into `itu`: a row with no
112
+ * usable timestamp carries no claim about its scale, and calling it current
113
+ * would make the oldest readings look freshly calibrated — the direction that
114
+ * destroys the ability to explain the step at all (D393).
115
+ */
116
+ export type AudioScaleEra = 'pre-itu' | 'itu' | 'unknown';
117
+ export declare function audioScaleEraOf(timestampMs: number): AudioScaleEra;
@@ -19,6 +19,37 @@ declare const AudioAnalysisSettingsSchema: z.ZodObject<{
19
19
  minConfidence: z.ZodDefault<z.ZodNumber>;
20
20
  allowedClasses: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
21
  }, z.core.$strip>;
22
+ /**
23
+ * `attachDevice` — the analyzer PULLS a camera's audio from the broker (D461).
24
+ *
25
+ * Until D461 the orchestrator drained the broker's chunk plane, accumulated
26
+ * ~1 s windows and pushed them back out as `analyseChunk`. It neither produced
27
+ * nor consumed the audio: the PCM crossed hub-main twice for a process that
28
+ * only buffered it. `attachDevice` inverts the direction — the analyzer opens
29
+ * its own `subscribeAudioChunks` against the broker and the subscriber IS the
30
+ * decoder, so the coded G.711 bytes D455 put on the plane stay coded all the
31
+ * way to the one expansion that feeds the model.
32
+ *
33
+ * The orchestrator still owns the POLICY (the `audioMode` gate, the on-motion
34
+ * window, the per-device node assignment, the settings read) and therefore
35
+ * still owns the attach/detach pair. It no longer owns the bytes.
36
+ */
37
+ declare const AudioAttachDeviceInputSchema: z.ZodObject<{
38
+ deviceId: z.ZodNumber;
39
+ brokerId: z.ZodString;
40
+ ingestNodeId: z.ZodString;
41
+ settings: z.ZodObject<{
42
+ minConfidence: z.ZodDefault<z.ZodNumber>;
43
+ allowedClasses: z.ZodDefault<z.ZodArray<z.ZodString>>;
44
+ }, z.core.$strip>;
45
+ }, z.core.$strip>;
46
+ declare const AudioAttachDeviceResultSchema: z.ZodObject<{
47
+ attached: z.ZodBoolean;
48
+ replaced: z.ZodBoolean;
49
+ }, z.core.$strip>;
50
+ declare const AudioDetachDeviceResultSchema: z.ZodObject<{
51
+ detached: z.ZodBoolean;
52
+ }, z.core.$strip>;
22
53
  declare const AudioClassificationResultSchema: z.ZodObject<{
23
54
  labels: z.ZodReadonly<z.ZodArray<z.ZodObject<{
24
55
  className: z.ZodString;
@@ -132,6 +163,36 @@ export declare const audioAnalyzerCapability: {
132
163
  }, z.core.$strip>>>>;
133
164
  inferenceMs: z.ZodNumber;
134
165
  }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
166
+ /**
167
+ * Start pulling this camera's audio from the broker, in THIS process.
168
+ * Returns as soon as the attachment exists — the first
169
+ * `subscribeAudioChunks` retries with backoff behind it, because the
170
+ * broker for a camStream may not be registered yet (that tolerance moved
171
+ * with the poller, D461). Replaces any live attachment for the device.
172
+ */
173
+ readonly attachDevice: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
174
+ deviceId: z.ZodNumber;
175
+ brokerId: z.ZodString;
176
+ ingestNodeId: z.ZodString;
177
+ settings: z.ZodObject<{
178
+ minConfidence: z.ZodDefault<z.ZodNumber>;
179
+ allowedClasses: z.ZodDefault<z.ZodArray<z.ZodString>>;
180
+ }, z.core.$strip>;
181
+ }, z.core.$strip>, z.ZodObject<{
182
+ attached: z.ZodBoolean;
183
+ replaced: z.ZodBoolean;
184
+ }, z.core.$strip>, "mutation">;
185
+ /**
186
+ * Stop pulling this camera's audio and release the broker subscription.
187
+ * Idempotent. A detach that never arrives is the one failure mode this
188
+ * split adds, which is why `AudioChunkPlane` reaps a subscription nobody
189
+ * drains rather than trusting it (D461).
190
+ */
191
+ readonly detachDevice: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
192
+ deviceId: z.ZodNumber;
193
+ }, z.core.$strip>, z.ZodObject<{
194
+ detached: z.ZodBoolean;
195
+ }, z.core.$strip>, "mutation">;
135
196
  readonly isReady: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodBoolean, import("./capability-definition.js").CapabilityMethodKind>;
136
197
  readonly dispose: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodVoid, "mutation">;
137
198
  /**
@@ -147,4 +208,4 @@ export declare const audioAnalyzerCapability: {
147
208
  };
148
209
  };
149
210
  export type IAudioAnalyzerProvider = InferProvider<typeof audioAnalyzerCapability>;
150
- export { AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioClassificationResultSchema };
211
+ export { AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioClassificationResultSchema, AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, AudioDetachDeviceResultSchema, };
@@ -28,7 +28,7 @@ export type { Alert, AlertSeverity, AlertStatus } from './alerts.cap.js';
28
28
  export { AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, alertsCapability, } from './alerts.cap.js';
29
29
  export { audioAnalysisCapability, type IAudioAnalysisProvider } from './audio-analysis.cap.js';
30
30
  export type { AudioAnalyzerGlobalConfig, AudioBackendChoice, IAudioAnalyzerProvider, } from './audio-analyzer.cap.js';
31
- export { AUDIO_BACKEND_CHOICES, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioClassificationResultSchema, audioAnalyzerCapability, DEFAULT_AUDIO_ANALYZER_CONFIG, } from './audio-analyzer.cap.js';
31
+ export { AUDIO_BACKEND_CHOICES, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, AudioClassificationResultSchema, AudioDetachDeviceResultSchema, audioAnalyzerCapability, DEFAULT_AUDIO_ANALYZER_CONFIG, } from './audio-analyzer.cap.js';
32
32
  export { AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEncodeSessionConfigSchema, AudioPcmChunkSchema, audioCodecCapability, type IAudioCodecCapProvider, PcmSampleFormatSchema, } from './audio-codec.cap.js';
33
33
  export { AuthResultSchema, authProviderCapability } from './auth-provider.cap.js';
34
34
  export { ArchiveEntrySchema, ArchiveManifestSchema, BackupDestinationInfoSchema, BackupEntrySchema, type BackupRun, type BackupRunPhase, BackupRunPhaseSchema, BackupRunSchema, type BackupRunState, BackupRunStateSchema, type BackupTriggerResult, BackupTriggerResultSchema, backupCapability, type IBackupProvider, LocationStatSchema, } from './backup.cap.js';
@@ -92,7 +92,7 @@ export { FrameLazyCountersSchema, FrameLazyMetricsSchema, MotionSourceEnum, Moti
92
92
  export { AudioChunkInputSchema, AudioClassificationLabelSchema, AudioLevelSchema, BoundingBoxSchema, FrameInputSchema, SpatialDetectionSchema, } from './schemas/detection-shared.js';
93
93
  export { CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, OrchestratorMetricsSchema, } from './schemas/orchestrator-metrics.js';
94
94
  export type { CameraStream, CamProfile, CamStreamKind, DecodedAudioChunkWire, FrameHandleFormat, ProfileRtspEntry, ProfileSlot, ProfileSlotStatus, SubscribeAudioChunksInput, SubscribeAudioChunksResult, SubscribeFramesInput, SubscribeFramesResult, } from './schemas/streaming-shared.js';
95
- export { BrokerStatsSchema, BrokerStatusSchema, CAM_PROFILE_ORDER, CameraStreamSchema, CamProfileSchema, CamStreamKindSchema, CamStreamResolutionSchema, DecodedAudioChunkSchema, DecodedFrameSchema, EncodedPacketSchema, FrameHandleFormatSchema, FrameHandleSchema, makeProfileBrokerId, makeSourceBrokerId, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, parseProfileBrokerId, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, selectAssignedProfileSlots, } from './schemas/streaming-shared.js';
95
+ export { BrokerStatsSchema, BrokerStatusSchema, CAM_PROFILE_ORDER, CameraStreamSchema, CamProfileSchema, CamStreamKindSchema, CamStreamResolutionSchema, AudioChunkFormatSchema, DecodedAudioChunkSchema, DecodedFrameSchema, EncodedPacketSchema, FrameHandleFormatSchema, FrameHandleSchema, makeProfileBrokerId, makeSourceBrokerId, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, parseProfileBrokerId, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, selectAssignedProfileSlots, } from './schemas/streaming-shared.js';
96
96
  export { buildEventKindDescriptor, EVENT_KIND_BY_CAP, EVENTFUL_CAP_NAMES, type SensorEventKindDescriptor, } from './sensor-event-kinds.js';
97
97
  export { type ImageContract, ImageContractSchema, type ImageContractState, ImageContractStateSchema, type IServerManagementProvider, type ServerBootMode, ServerBootModeSchema, type ServerPackageStatus, ServerPackageStatusSchema, type ServerRollbackInfo, ServerRollbackInfoSchema, type ServerUpdateActionResult, ServerUpdateActionResultSchema, type ServerUpdateCheckResult, ServerUpdateCheckResultSchema, type ServerUpdateState, ServerUpdateStateSchema, serverManagementCapability, type WrapperEvidence, WrapperEvidenceSchema, type WrapperIdentity, WrapperIdentitySchema, type WrapperKind, WrapperKindSchema, } from './server-management.cap.js';
98
98
  export { type BulkRecord, BulkRecordSchema, type CollectionColumn, CollectionColumnSchema, type CollectionIndex, CollectionIndexSchema, type ISettingsStoreProvider, type MutationFilter, MutationFilterSchema, QueryFilterSchema, SettingsRecordSchema, type SettingsStoreClient, settingsStoreCapability, } from './settings-store.cap.js';
@@ -239,6 +239,12 @@ export type NcOccupancyCondition = z.infer<typeof NcOccupancyConditionSchema>;
239
239
  * number. An operator (or a UI) that writes `60` meaning "60 decibels, quite
240
240
  * loud" would author a threshold NO sample can ever reach, and the rule would
241
241
  * look broken rather than mis-configured. The schema range rejects it instead.
242
+ *
243
+ * Untouched by the D459 scale correction, and structurally so: -96 dBFS is
244
+ * where 16-bit digital silence sits on ANY decoder, right or wrong. It
245
+ * describes the container, not a calibration made through one.
246
+ *
247
+ * @dbfs-era scale-bound
242
248
  */
243
249
  export declare const NC_AUDIO_DBFS_FLOOR = -96;
244
250
  /**
@@ -261,11 +261,21 @@ export type SubscribeFramesResult = z.infer<typeof SubscribeFramesResultSchema>;
261
261
  * (the wire-serialisable supertype of `Buffer`) to match `DecodedFrameSchema`
262
262
  * / `EncodedPacketSchema`'s precedent; a `Buffer` is assignable to it.
263
263
  */
264
+ export declare const AudioChunkFormatSchema: z.ZodEnum<{
265
+ f32le: "f32le";
266
+ pcmu: "pcmu";
267
+ pcma: "pcma";
268
+ }>;
264
269
  export declare const DecodedAudioChunkSchema: z.ZodObject<{
265
270
  data: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
266
271
  sampleRate: z.ZodNumber;
267
272
  channels: z.ZodNumber;
268
273
  timestamp: z.ZodNumber;
274
+ format: z.ZodOptional<z.ZodEnum<{
275
+ f32le: "f32le";
276
+ pcmu: "pcmu";
277
+ pcma: "pcma";
278
+ }>>;
269
279
  }, z.core.$strip>;
270
280
  export type DecodedAudioChunkWire = z.infer<typeof DecodedAudioChunkSchema>;
271
281
  /**
@@ -278,6 +288,11 @@ export type DecodedAudioChunkWire = z.infer<typeof DecodedAudioChunkSchema>;
278
288
  export declare const SubscribeAudioChunksInputSchema: z.ZodObject<{
279
289
  brokerId: z.ZodString;
280
290
  tag: z.ZodOptional<z.ZodString>;
291
+ accept: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
292
+ f32le: "f32le";
293
+ pcmu: "pcmu";
294
+ pcma: "pcma";
295
+ }>>>>;
281
296
  }, z.core.$strip>;
282
297
  export type SubscribeAudioChunksInput = z.infer<typeof SubscribeAudioChunksInputSchema>;
283
298
  /** Result of `stream-broker.subscribeAudioChunks`. */
@@ -308,11 +308,11 @@ declare const VideoCodecTargetSchema: z.ZodEnum<{
308
308
  }>;
309
309
  export type VideoCodecTarget = z.infer<typeof VideoCodecTargetSchema>;
310
310
  declare const AudioCodecTargetSchema: z.ZodEnum<{
311
+ pcmu: "pcmu";
311
312
  none: "none";
312
313
  copy: "copy";
313
314
  opus: "opus";
314
315
  aac: "aac";
315
- pcmu: "pcmu";
316
316
  }>;
317
317
  export type AudioCodecTarget = z.infer<typeof AudioCodecTargetSchema>;
318
318
  export declare const GetStreamWithCodecInputSchema: z.ZodObject<{
@@ -323,11 +323,11 @@ export declare const GetStreamWithCodecInputSchema: z.ZodObject<{
323
323
  copy: "copy";
324
324
  }>;
325
325
  audio: z.ZodOptional<z.ZodEnum<{
326
+ pcmu: "pcmu";
326
327
  none: "none";
327
328
  copy: "copy";
328
329
  opus: "opus";
329
330
  aac: "aac";
330
- pcmu: "pcmu";
331
331
  }>>;
332
332
  profile: z.ZodOptional<z.ZodEnum<{
333
333
  high: "high";
@@ -410,11 +410,11 @@ export declare const EgressEncodeSchema: z.ZodObject<{
410
410
  }, z.core.$strip>;
411
411
  audio: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
412
412
  codec: z.ZodEnum<{
413
+ pcmu: "pcmu";
414
+ pcma: "pcma";
413
415
  copy: "copy";
414
416
  opus: "opus";
415
417
  aac: "aac";
416
- pcmu: "pcmu";
417
- pcma: "pcma";
418
418
  }>;
419
419
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
420
420
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -481,11 +481,11 @@ export declare const EgressTranscodeRequestSchema: z.ZodObject<{
481
481
  }, z.core.$strip>;
482
482
  audio: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
483
483
  codec: z.ZodEnum<{
484
+ pcmu: "pcmu";
485
+ pcma: "pcma";
484
486
  copy: "copy";
485
487
  opus: "opus";
486
488
  aac: "aac";
487
- pcmu: "pcmu";
488
- pcma: "pcma";
489
489
  }>;
490
490
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
491
491
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -605,11 +605,11 @@ export declare const streamBrokerCapability: {
605
605
  }, z.core.$strip>;
606
606
  audio: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
607
607
  codec: z.ZodEnum<{
608
+ pcmu: "pcmu";
609
+ pcma: "pcma";
608
610
  copy: "copy";
609
611
  opus: "opus";
610
612
  aac: "aac";
611
- pcmu: "pcmu";
612
- pcma: "pcma";
613
613
  }>;
614
614
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
615
615
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -1034,11 +1034,11 @@ export declare const streamBrokerCapability: {
1034
1034
  copy: "copy";
1035
1035
  }>;
1036
1036
  audio: z.ZodOptional<z.ZodEnum<{
1037
+ pcmu: "pcmu";
1037
1038
  none: "none";
1038
1039
  copy: "copy";
1039
1040
  opus: "opus";
1040
1041
  aac: "aac";
1041
- pcmu: "pcmu";
1042
1042
  }>>;
1043
1043
  profile: z.ZodOptional<z.ZodEnum<{
1044
1044
  high: "high";
@@ -1144,11 +1144,11 @@ export declare const streamBrokerCapability: {
1144
1144
  }, z.core.$strip>;
1145
1145
  audio: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
1146
1146
  codec: z.ZodEnum<{
1147
+ pcmu: "pcmu";
1148
+ pcma: "pcma";
1147
1149
  copy: "copy";
1148
1150
  opus: "opus";
1149
1151
  aac: "aac";
1150
- pcmu: "pcmu";
1151
- pcma: "pcma";
1152
1152
  }>;
1153
1153
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
1154
1154
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -1223,6 +1223,11 @@ export declare const streamBrokerCapability: {
1223
1223
  readonly subscribeAudioChunks: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
1224
1224
  brokerId: z.ZodString;
1225
1225
  tag: z.ZodOptional<z.ZodString>;
1226
+ accept: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
1227
+ f32le: "f32le";
1228
+ pcmu: "pcmu";
1229
+ pcma: "pcma";
1230
+ }>>>>;
1226
1231
  }, z.core.$strip>, z.ZodObject<{
1227
1232
  subscriptionId: z.ZodString;
1228
1233
  }, z.core.$strip>, "mutation">;
@@ -1234,6 +1239,11 @@ export declare const streamBrokerCapability: {
1234
1239
  sampleRate: z.ZodNumber;
1235
1240
  channels: z.ZodNumber;
1236
1241
  timestamp: z.ZodNumber;
1242
+ format: z.ZodOptional<z.ZodEnum<{
1243
+ f32le: "f32le";
1244
+ pcmu: "pcmu";
1245
+ pcma: "pcma";
1246
+ }>>;
1237
1247
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
1238
1248
  readonly unsubscribeAudioChunks: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
1239
1249
  subscriptionId: z.ZodString;
@@ -46,11 +46,11 @@ export declare const VideoEncodeSchema: z.ZodObject<{
46
46
  export type VideoEncode = z.infer<typeof VideoEncodeSchema>;
47
47
  export declare const AudioEncodeSchema: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
48
48
  codec: z.ZodEnum<{
49
+ pcmu: "pcmu";
50
+ pcma: "pcma";
49
51
  copy: "copy";
50
52
  opus: "opus";
51
53
  aac: "aac";
52
- pcmu: "pcmu";
53
- pcma: "pcma";
54
54
  }>;
55
55
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
56
56
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -92,11 +92,11 @@ export declare const EncodeProfileSchema: z.ZodObject<{
92
92
  }, z.core.$strip>;
93
93
  audio: z.ZodUnion<readonly [z.ZodLiteral<"passthrough">, z.ZodObject<{
94
94
  codec: z.ZodEnum<{
95
+ pcmu: "pcmu";
96
+ pcma: "pcma";
95
97
  copy: "copy";
96
98
  opus: "opus";
97
99
  aac: "aac";
98
- pcmu: "pcmu";
99
- pcma: "pcma";
100
100
  }>;
101
101
  bitrateKbps: z.ZodOptional<z.ZodNumber>;
102
102
  sampleRateHz: z.ZodOptional<z.ZodNumber>;
@@ -693,6 +693,20 @@ export type AppRouter = TrpcCoreRouter<{
693
693
  output: z.infer<typeof audioAnalyzerCapability.methods.classify.output>;
694
694
  meta: object;
695
695
  }>;
696
+ attachDevice: TRPCMutationProcedure<{
697
+ input: {
698
+ [x: string]: unknown;
699
+ } & z.input<typeof audioAnalyzerCapability.methods.attachDevice.input>;
700
+ output: z.infer<typeof audioAnalyzerCapability.methods.attachDevice.output>;
701
+ meta: object;
702
+ }>;
703
+ detachDevice: TRPCMutationProcedure<{
704
+ input: {
705
+ [x: string]: unknown;
706
+ } & z.input<typeof audioAnalyzerCapability.methods.detachDevice.input>;
707
+ output: z.infer<typeof audioAnalyzerCapability.methods.detachDevice.output>;
708
+ meta: object;
709
+ }>;
696
710
  isReady: TRPCQueryProcedure<{
697
711
  input: {
698
712
  nodeId?: string | undefined;
@@ -11,7 +11,7 @@
11
11
  * Plain data, zero Zod: a forked runner must not import the schema barrel
12
12
  * (~144MB RSS per runner — D28).
13
13
  *
14
- * Coverage: 24 caps, 56 methods with defaults.
14
+ * Coverage: 24 caps, 57 methods with defaults.
15
15
  */
16
16
  export declare const CAP_INPUT_DEFAULTS: Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, unknown>>>>>>;
17
17
  /**
@@ -86,6 +86,7 @@ import type { zoneAnalyticsCapability } from '../capabilities/zone-analytics.cap
86
86
  import type { zoneRulesCapability } from '../capabilities/zone-rules.cap.js';
87
87
  import type { zonesCapability } from '../capabilities/zones.cap.js';
88
88
  import type { addonSettingsCapability } from '../capabilities/addon-settings.cap.js';
89
+ import type { audioAnalyzerCapability } from '../capabilities/audio-analyzer.cap.js';
89
90
  import type { cameraPipelineConfigCapability } from '../capabilities/camera-pipeline-config.cap.js';
90
91
  import type { deviceAdoptionCapability } from '../capabilities/device-adoption.cap.js';
91
92
  import type { deviceExportCapability } from '../capabilities/device-export.cap.js';
@@ -278,6 +279,7 @@ export interface DeviceProxy {
278
279
  readonly zoneRules?: InferDeviceProxyCap<typeof zoneRulesCapability>;
279
280
  readonly zones?: InferDeviceProxyCap<typeof zonesCapability>;
280
281
  readonly addonSettings: Pick<InferDeviceProxyCap<typeof addonSettingsCapability>, 'getDeviceSettings' | 'updateDeviceSettings'>;
282
+ readonly audioAnalyzer: Pick<InferDeviceProxyCap<typeof audioAnalyzerCapability>, 'detachDevice'>;
281
283
  readonly cameraPipelineConfig: Pick<InferDeviceProxyCap<typeof cameraPipelineConfigCapability>, 'getDeviceSettingsContribution' | 'getDeviceLiveContribution' | 'applyDeviceSettingsPatch'>;
282
284
  readonly deviceAdoption: Pick<InferDeviceProxyCap<typeof deviceAdoptionCapability>, 'getStatus'>;
283
285
  readonly deviceExport: Pick<InferDeviceProxyCap<typeof deviceExportCapability>, 'getDeviceSettingsContribution' | 'getDeviceLiveContribution' | 'applyDeviceSettingsPatch'>;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1027 method paths across 129 capabilities.
9
+ * Coverage: 1029 method paths across 129 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -6,8 +6,8 @@
6
6
  * system-scope cap that takes a deviceId was previously never device-filtered
7
7
  * — see the generator header).
8
8
  *
9
- * Coverage: 372 methods carry a device reference, of which
10
- * 137 are on SYSTEM-scope caps.
9
+ * Coverage: 374 methods carry a device reference, of which
10
+ * 139 are on SYSTEM-scope caps.
11
11
  *
12
12
  * Top-level fields, number arrays, and one-level arrays of objects carrying
13
13
  * a numeric device field (targets[].deviceId) are all mapped; the matcher
@@ -59,7 +59,7 @@ export interface SystemProxy {
59
59
  readonly addonSettings: Pick<InferProvider<typeof addonSettingsCapability>, 'getGlobalSettings' | 'updateGlobalSettings' | 'getIntegrationSettings'>;
60
60
  readonly addonWidgets: Pick<InferProvider<typeof addonWidgetsCapability>, 'listWidgets'>;
61
61
  readonly alerts: Pick<InferProvider<typeof alertsCapability>, 'emit' | 'update' | 'list' | 'getUnreadCount' | 'markRead' | 'markAllRead' | 'dismiss'>;
62
- readonly audioAnalyzer: Pick<InferProvider<typeof audioAnalyzerCapability>, 'analyseChunk' | 'classify' | 'isReady' | 'dispose' | 'reprobeAudioEngine'>;
62
+ readonly audioAnalyzer: Pick<InferProvider<typeof audioAnalyzerCapability>, 'analyseChunk' | 'classify' | 'attachDevice' | 'isReady' | 'dispose' | 'reprobeAudioEngine'>;
63
63
  readonly audioCodec: Pick<InferProvider<typeof audioCodecCapability>, 'listSupportedCodecs' | 'canHandle' | 'createDecodeSession' | 'createEncodeSession' | 'closeSession' | 'pushEncodedFrame' | 'pullPcm' | 'pushPcm' | 'pullEncoded' | 'flushEncode' | 'listActiveSessions'>;
64
64
  readonly backup: Pick<InferProvider<typeof backupCapability>, 'listDestinations' | 'trigger' | 'listRuns' | 'cancel' | 'list' | 'listLocations' | 'getEntries' | 'restore' | 'delete' | 'listArchives' | 'upsertDestinationPolicy' | 'previewSchedule' | 'listSchedules' | 'upsertSchedule' | 'deleteSchedule'>;
65
65
  readonly broker: Pick<InferProvider<typeof brokerCapability>, 'list' | 'get' | 'listProviders' | 'add' | 'remove' | 'testConnection' | 'getSettings' | 'setSettings' | 'getBrokerConfig' | 'getSettingsSchema' | 'testSettings' | 'publish' | 'subscribe' | 'unsubscribe' | 'getState' | 'getStatus'>;