@ceralive/cerastream 2026.6.1 → 2026.6.2

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.
@@ -8,7 +8,7 @@ export declare const PROTOCOL_VERSION: "cerastream-ipc/1";
8
8
  * additive-only within protocol major `cerastream-ipc/1` (ADR-0002 §4); this value
9
9
  * only moves when the wire schema itself does, in lockstep across both languages.
10
10
  */
11
- export declare const SCHEMA_VERSION: "0.1.0-stub";
11
+ export declare const SCHEMA_VERSION: "0.3.0";
12
12
  /** Runtime dir holding both control + preview sockets. systemd `RuntimeDirectory=cerastream`. */
13
13
  export declare const DEFAULT_IPC_DIR: "/run/cerastream";
14
14
  /** Env override for the IPC dir (tests/dev). Defaults to {@link DEFAULT_IPC_DIR}. */
@@ -23,6 +23,8 @@ export declare const CONTROL_SOCKET_PATH: "/run/cerastream/control.sock";
23
23
  export declare const PREVIEW_SOCKET_PATH: "/run/cerastream/preview.sock";
24
24
  /** Per-line framing cap (ADR-0002 §1): an oversized line is a fatal protocol error. */
25
25
  export declare const MAX_LINE_BYTES: number;
26
+ /** Upper bound (ms) for `reload-config.audio.delay_ms`. Mirrors the Rust `AUDIO_DELAY_MAX_MS` and CeraUI's `AUDIO_DELAY_MAX`. */
27
+ export declare const AUDIO_DELAY_MAX_MS = 2000;
26
28
  /** Engine binary name (systemd-owned; CeraUI never spawns it — ADR-0005). */
27
29
  export declare const CERASTREAM_BIN: "cerastream";
28
30
  export declare const DEFAULT_MIN_BITRATE = 300;
package/dist/constants.js CHANGED
@@ -11,7 +11,7 @@ export const PROTOCOL_VERSION = "cerastream-ipc/1";
11
11
  * additive-only within protocol major `cerastream-ipc/1` (ADR-0002 §4); this value
12
12
  * only moves when the wire schema itself does, in lockstep across both languages.
13
13
  */
14
- export const SCHEMA_VERSION = "0.1.0-stub";
14
+ export const SCHEMA_VERSION = "0.3.0";
15
15
  /** Runtime dir holding both control + preview sockets. systemd `RuntimeDirectory=cerastream`. */
16
16
  export const DEFAULT_IPC_DIR = "/run/cerastream";
17
17
  /** Env override for the IPC dir (tests/dev). Defaults to {@link DEFAULT_IPC_DIR}. */
@@ -26,6 +26,8 @@ export const CONTROL_SOCKET_PATH = "/run/cerastream/control.sock";
26
26
  export const PREVIEW_SOCKET_PATH = "/run/cerastream/preview.sock";
27
27
  /** Per-line framing cap (ADR-0002 §1): an oversized line is a fatal protocol error. */
28
28
  export const MAX_LINE_BYTES = 1024 * 1024; // 1 MiB
29
+ /** Upper bound (ms) for `reload-config.audio.delay_ms`. Mirrors the Rust `AUDIO_DELAY_MAX_MS` and CeraUI's `AUDIO_DELAY_MAX`. */
30
+ export const AUDIO_DELAY_MAX_MS = 2000;
29
31
  /** Engine binary name (systemd-owned; CeraUI never spawns it — ADR-0005). */
30
32
  export const CERASTREAM_BIN = "cerastream";
31
33
  // ---- config defaults (mirror ceracoder, the engine being replaced) ----
package/dist/errors.d.ts CHANGED
@@ -42,6 +42,7 @@ export declare const rpcErrorCodeSchema: z.ZodEnum<{
42
42
  "cerastream.state.not_streaming": "cerastream.state.not_streaming";
43
43
  "cerastream.state.already_streaming": "cerastream.state.already_streaming";
44
44
  "cerastream.device.not_found": "cerastream.device.not_found";
45
+ "cerastream.audio.device_not_found": "cerastream.audio.device_not_found";
45
46
  "cerastream.bitrate.out_of_range": "cerastream.bitrate.out_of_range";
46
47
  "cerastream.preview.unsupported_tier": "cerastream.preview.unsupported_tier";
47
48
  "cerastream.internal": "cerastream.internal";
package/dist/errors.js CHANGED
@@ -60,6 +60,7 @@ export const rpcErrorCodeSchema = z.enum([
60
60
  "cerastream.state.not_streaming",
61
61
  "cerastream.state.already_streaming",
62
62
  "cerastream.device.not_found",
63
+ "cerastream.audio.device_not_found",
63
64
  "cerastream.bitrate.out_of_range",
64
65
  "cerastream.preview.unsupported_tier",
65
66
  "cerastream.internal",
@@ -75,6 +76,7 @@ export const RPC_ERROR_NUMERIC = {
75
76
  "cerastream.state.not_streaming": -32001,
76
77
  "cerastream.state.already_streaming": -32002,
77
78
  "cerastream.device.not_found": -32003,
79
+ "cerastream.audio.device_not_found": -32006,
78
80
  "cerastream.bitrate.out_of_range": -32004,
79
81
  "cerastream.preview.unsupported_tier": -32005,
80
82
  "cerastream.internal": -32603,
package/dist/events.d.ts CHANGED
@@ -21,6 +21,10 @@ export declare const switchEventSchema: z.ZodObject<{
21
21
  auto: "auto";
22
22
  }>;
23
23
  reason: z.ZodOptional<z.ZodString>;
24
+ media_class: z.ZodOptional<z.ZodEnum<{
25
+ video: "video";
26
+ audio: "audio";
27
+ }>>;
24
28
  }, z.core.$strip>;
25
29
  export type SwitchEvent = z.infer<typeof switchEventSchema>;
26
30
  export declare const deviceEventSchema: z.ZodObject<{
@@ -109,6 +113,10 @@ export declare const eventParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
109
113
  auto: "auto";
110
114
  }>;
111
115
  reason: z.ZodOptional<z.ZodString>;
116
+ media_class: z.ZodOptional<z.ZodEnum<{
117
+ video: "video";
118
+ audio: "audio";
119
+ }>>;
112
120
  }, z.core.$strip>, z.ZodObject<{
113
121
  type: z.ZodLiteral<"device">;
114
122
  seq: z.ZodNumber;
@@ -190,6 +198,10 @@ export declare const cerastreamEventSchema: z.ZodObject<{
190
198
  auto: "auto";
191
199
  }>;
192
200
  reason: z.ZodOptional<z.ZodString>;
201
+ media_class: z.ZodOptional<z.ZodEnum<{
202
+ video: "video";
203
+ audio: "audio";
204
+ }>>;
193
205
  }, z.core.$strip>, z.ZodObject<{
194
206
  type: z.ZodLiteral<"device">;
195
207
  seq: z.ZodNumber;
@@ -274,6 +286,10 @@ export declare const eventSchemas: {
274
286
  auto: "auto";
275
287
  }>;
276
288
  reason: z.ZodOptional<z.ZodString>;
289
+ media_class: z.ZodOptional<z.ZodEnum<{
290
+ video: "video";
291
+ audio: "audio";
292
+ }>>;
277
293
  }, z.core.$strip>;
278
294
  readonly device: z.ZodObject<{
279
295
  type: z.ZodLiteral<"device">;
package/dist/events.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { processErrorCodeSchema, processErrorSourceSchema, } from "./errors.js";
3
- import { captureDeviceSchema, inputModeSchema, streamStateSchema, } from "./types.js";
3
+ import { captureDeviceSchema, inputModeSchema, mediaClassSchema, streamStateSchema, } from "./types.js";
4
4
  // Server → client `event` notifications, delivered after `subscribe-events`
5
5
  // (schema.md "Events"). Each event is the inner `params` of an rpcEventSchema:
6
6
  // { type, seq, … }. `type` discriminates; `seq` is a per-type monotonic counter.
@@ -13,13 +13,15 @@ export const statusEventSchema = z.object({
13
13
  streaming: z.boolean(),
14
14
  active_input: z.string().optional(),
15
15
  });
16
- // switch — active input changed (manual or failover)
16
+ // switch — active input changed (manual or failover). media_class is additive
17
+ // (absent on legacy video-only emitters); switch-audio sets it to "audio".
17
18
  export const switchEventSchema = z.object({
18
19
  type: z.literal("switch"),
19
20
  seq,
20
21
  active_input: z.string(),
21
22
  mode: inputModeSchema,
22
23
  reason: z.string().optional(),
24
+ media_class: mediaClassSchema.optional(),
23
25
  });
24
26
  // device — GstDeviceMonitor hotplug
25
27
  export const deviceEventSchema = z.object({
@@ -56,6 +56,9 @@ export declare const reloadConfigParamsSchema: z.ZodObject<{
56
56
  srt: z.ZodOptional<z.ZodObject<{
57
57
  latency_ms: z.ZodOptional<z.ZodNumber>;
58
58
  }, z.core.$strip>>;
59
+ audio: z.ZodOptional<z.ZodObject<{
60
+ delay_ms: z.ZodOptional<z.ZodNumber>;
61
+ }, z.core.$strip>>;
59
62
  }, z.core.$strip>;
60
63
  export type ReloadConfigParams = z.infer<typeof reloadConfigParamsSchema>;
61
64
  export declare const reloadConfigResultSchema: z.ZodObject<{
@@ -72,6 +75,9 @@ export declare const reloadConfigResultSchema: z.ZodObject<{
72
75
  srt: z.ZodOptional<z.ZodObject<{
73
76
  latency_ms: z.ZodOptional<z.ZodNumber>;
74
77
  }, z.core.$strip>>;
78
+ audio: z.ZodOptional<z.ZodObject<{
79
+ delay_ms: z.ZodOptional<z.ZodNumber>;
80
+ }, z.core.$strip>>;
75
81
  }, z.core.$strip>;
76
82
  }, z.core.$strip>;
77
83
  export type ReloadConfigResult = z.infer<typeof reloadConfigResultSchema>;
@@ -101,6 +107,22 @@ export declare const switchInputResultSchema: z.ZodObject<{
101
107
  }>;
102
108
  }, z.core.$strip>;
103
109
  export type SwitchInputResult = z.infer<typeof switchInputResultSchema>;
110
+ export declare const switchAudioParamsSchema: z.ZodObject<{
111
+ audio_input_id: z.ZodString;
112
+ mode: z.ZodOptional<z.ZodEnum<{
113
+ manual: "manual";
114
+ auto: "auto";
115
+ }>>;
116
+ }, z.core.$strip>;
117
+ export type SwitchAudioParams = z.infer<typeof switchAudioParamsSchema>;
118
+ export declare const switchAudioResultSchema: z.ZodObject<{
119
+ active_audio_input: z.ZodString;
120
+ mode: z.ZodEnum<{
121
+ manual: "manual";
122
+ auto: "auto";
123
+ }>;
124
+ }, z.core.$strip>;
125
+ export type SwitchAudioResult = z.infer<typeof switchAudioResultSchema>;
104
126
  export declare const listDevicesParamsSchema: z.ZodOptional<z.ZodObject<{
105
127
  media_class: z.ZodOptional<z.ZodEnum<{
106
128
  video: "video";
@@ -243,6 +265,7 @@ export declare const getCapabilitiesResultSchema: z.ZodObject<{
243
265
  default_resolution: z.ZodString;
244
266
  default_framerate: z.ZodNumber;
245
267
  }, z.core.$strip>>;
268
+ audio_live_switch: z.ZodOptional<z.ZodBoolean>;
246
269
  }, z.core.$strip>;
247
270
  export type GetCapabilitiesResult = z.infer<typeof getCapabilitiesResultSchema>;
248
271
  /** The eight v1 control methods (the literal JSON-RPC `method` strings). */
@@ -323,6 +346,9 @@ export declare const requestSchemas: {
323
346
  srt: z.ZodOptional<z.ZodObject<{
324
347
  latency_ms: z.ZodOptional<z.ZodNumber>;
325
348
  }, z.core.$strip>>;
349
+ audio: z.ZodOptional<z.ZodObject<{
350
+ delay_ms: z.ZodOptional<z.ZodNumber>;
351
+ }, z.core.$strip>>;
326
352
  }, z.core.$strip>;
327
353
  readonly result: z.ZodObject<{
328
354
  applied: z.ZodObject<{
@@ -338,6 +364,9 @@ export declare const requestSchemas: {
338
364
  srt: z.ZodOptional<z.ZodObject<{
339
365
  latency_ms: z.ZodOptional<z.ZodNumber>;
340
366
  }, z.core.$strip>>;
367
+ audio: z.ZodOptional<z.ZodObject<{
368
+ delay_ms: z.ZodOptional<z.ZodNumber>;
369
+ }, z.core.$strip>>;
341
370
  }, z.core.$strip>;
342
371
  }, z.core.$strip>;
343
372
  };
package/dist/messages.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { AUDIO_DELAY_MAX_MS } from "./constants.js";
2
3
  import { helloParamsSchema, helloResultSchema, } from "./envelope.js";
3
4
  import { balancerAlgorithmSchema, captureDeviceSchema, cerastreamConfigSchema, inputModeSchema, mediaClassSchema, previewTierSchema, streamStateSchema, } from "./types.js";
4
5
  // The eight v1 control methods (schema.md "v1 messages"). Each is matched
@@ -34,6 +35,11 @@ export const reloadConfigParamsSchema = z.object({
34
35
  latency_ms: z.number().int().min(100).max(10_000).optional(),
35
36
  })
36
37
  .optional(),
38
+ audio: z
39
+ .object({
40
+ delay_ms: z.number().int().min(0).max(AUDIO_DELAY_MAX_MS).optional(),
41
+ })
42
+ .optional(),
37
43
  });
38
44
  export const reloadConfigResultSchema = z.object({
39
45
  applied: reloadConfigParamsSchema, // post-clamp values actually applied
@@ -54,6 +60,18 @@ export const switchInputResultSchema = z.object({
54
60
  active_input: z.string(),
55
61
  mode: inputModeSchema,
56
62
  });
63
+ // ---- 5b. switch-audio (additive; the audio mirror of switch-input) ----
64
+ // Drives the live audio fallbackswitch active-pad. Additive standalone schema
65
+ // (like get-capabilities): kept OUT of V1_METHODS / requestSchemas so the frozen
66
+ // eight-method contract count is unchanged. `mode` is optional (absent ⇒ manual).
67
+ export const switchAudioParamsSchema = z.object({
68
+ audio_input_id: z.string(), // audio device/input identifier from list-devices
69
+ mode: inputModeSchema.optional(),
70
+ });
71
+ export const switchAudioResultSchema = z.object({
72
+ active_audio_input: z.string(),
73
+ mode: inputModeSchema,
74
+ });
57
75
  // ---- 6. list-devices ----
58
76
  export const listDevicesParamsSchema = z
59
77
  .object({
@@ -133,6 +151,7 @@ export const getCapabilitiesResultSchema = z.object({
133
151
  platform: platformCapsSchema,
134
152
  encoder: encoderCapsSchema,
135
153
  sources: z.array(videoSourceCapSchema),
154
+ audio_live_switch: z.boolean().optional(),
136
155
  });
137
156
  // ---- method registry (count-assertion source of truth) ----
138
157
  /** The eight v1 control methods (the literal JSON-RPC `method` strings). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceralive/cerastream",
3
- "version": "2026.6.1",
3
+ "version": "2026.6.2",
4
4
  "description": "Type-safe TypeScript schema + IPC client for the cerastream streaming engine (JSON-RPC 2.0 / NDJSON over a Unix domain socket).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",