@ceralive/cerastream 2026.7.6 → 2026.8.0

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/events.js CHANGED
@@ -1,6 +1,6 @@
1
- import { z } from "zod";
2
- import { processErrorCodeSchema, processErrorSourceSchema, } from "./errors.js";
3
- import { captureDeviceSchema, configChangePhaseSchema, inputModeSchema, mediaClassSchema, previewEncodeFallbackSchema, previewEncodeModeSchema, streamStateSchema, } from "./types.js";
1
+ import { z } from 'zod';
2
+ import { processErrorCodeSchema, processErrorSourceSchema } from './errors.js';
3
+ import { captureDeviceSchema, configChangePhaseSchema, inputModeSchema, mediaClassSchema, previewEncodeFallbackSchema, previewEncodeModeSchema, 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.
@@ -60,7 +60,7 @@ export const previewEncoderRealizedSchema = z.object({
60
60
  * preview branch.
61
61
  */
62
62
  export const statusEventSchema = z.object({
63
- type: z.literal("status"),
63
+ type: z.literal('status'),
64
64
  seq,
65
65
  state: streamStateSchema,
66
66
  streaming: z.boolean(),
@@ -79,7 +79,7 @@ export const statusEventSchema = z.object({
79
79
  * `"audio"`.
80
80
  */
81
81
  export const switchEventSchema = z.object({
82
- type: z.literal("switch"),
82
+ type: z.literal('switch'),
83
83
  seq,
84
84
  active_input: z.string(),
85
85
  mode: inputModeSchema,
@@ -88,21 +88,21 @@ export const switchEventSchema = z.object({
88
88
  });
89
89
  /** `device` event — a GstDeviceMonitor hotplug add/remove. */
90
90
  export const deviceEventSchema = z.object({
91
- type: z.literal("device"),
91
+ type: z.literal('device'),
92
92
  seq,
93
- change: z.enum(["added", "removed"]),
93
+ change: z.enum(['added', 'removed']),
94
94
  device: captureDeviceSchema,
95
95
  });
96
96
  /** `bitrate` event — the adaptive controller adjusted the encode bitrate. */
97
97
  export const bitrateEventSchema = z.object({
98
- type: z.literal("bitrate"),
98
+ type: z.literal('bitrate'),
99
99
  seq,
100
100
  current_bitrate: z.number().int(),
101
101
  max_bitrate: z.number().int(),
102
102
  });
103
103
  /** `srt-stats` event — periodic SRT transport telemetry. */
104
104
  export const srtStatsEventSchema = z.object({
105
- type: z.literal("srt-stats"),
105
+ type: z.literal('srt-stats'),
106
106
  seq,
107
107
  rtt_ms: z.number(),
108
108
  send_buffer: z.number().int(),
@@ -113,7 +113,7 @@ export const srtStatsEventSchema = z.object({
113
113
  * code; the engine reports facts and CeraUI decides what to surface.
114
114
  */
115
115
  export const runtimeErrorEventSchema = z.object({
116
- type: z.literal("error"),
116
+ type: z.literal('error'),
117
117
  seq,
118
118
  code: processErrorCodeSchema, // Tier 2 (errors.ts)
119
119
  source: processErrorSourceSchema,
@@ -122,7 +122,7 @@ export const runtimeErrorEventSchema = z.object({
122
122
  });
123
123
  /** `preview` event — a preview-session lifecycle/phase change. */
124
124
  export const previewEventSchema = z.object({
125
- type: z.literal("preview"),
125
+ type: z.literal('preview'),
126
126
  seq,
127
127
  session_id: z.string(),
128
128
  phase: z.string(),
@@ -138,12 +138,12 @@ export const previewEventSchema = z.object({
138
138
  * Independent of the preview-scoped `audio-level` WebSocket frame.
139
139
  */
140
140
  export const audioLevelEventSchema = z.object({
141
- type: z.literal("audio-level"),
141
+ type: z.literal('audio-level'),
142
142
  seq,
143
143
  source: z
144
144
  .object({
145
145
  identity: z.string().optional(), // reboot-stable device id (Todo 20 stable_id)
146
- owner: z.enum(["sidecar", "streaming"]),
146
+ owner: z.enum(['sidecar', 'streaming']),
147
147
  })
148
148
  .optional(),
149
149
  channels: z.number().int().nonnegative().optional(),
@@ -151,7 +151,7 @@ export const audioLevelEventSchema = z.object({
151
151
  peak_db: z.array(z.number()).optional(),
152
152
  floor_db: z.number().optional(),
153
153
  unavailable: z.literal(true).optional(),
154
- reason: z.enum(["device_busy", "no_device", "mode_none", "handoff"]).optional(),
154
+ reason: z.enum(['device_busy', 'no_device', 'mode_none', 'handoff']).optional(),
155
155
  });
156
156
  /**
157
157
  * `config-change` event — one phase of a `change-config` transaction (0.10.0,
@@ -162,14 +162,14 @@ export const audioLevelEventSchema = z.object({
162
162
  * actually advancing", never merely "PLAYING".
163
163
  */
164
164
  export const configChangeEventSchema = z.object({
165
- type: z.literal("config-change"),
165
+ type: z.literal('config-change'),
166
166
  seq,
167
167
  attempt_id: z.string(),
168
168
  phase: configChangePhaseSchema,
169
169
  reason: z.string().optional(), // absent on applying/applied; "teardown_timeout" marks the supervisor escalation
170
170
  });
171
171
  /** Discriminated union of every v1 event payload (the inner `params`). */
172
- export const eventParamsSchema = z.discriminatedUnion("type", [
172
+ export const eventParamsSchema = z.discriminatedUnion('type', [
173
173
  statusEventSchema,
174
174
  switchEventSchema,
175
175
  deviceEventSchema,
@@ -182,23 +182,23 @@ export const eventParamsSchema = z.discriminatedUnion("type", [
182
182
  ]);
183
183
  /** Full event envelope: { jsonrpc, method:"event", params } with typed params. */
184
184
  export const cerastreamEventSchema = z.object({
185
- jsonrpc: z.literal("2.0"),
186
- method: z.literal("event"),
185
+ jsonrpc: z.literal('2.0'),
186
+ method: z.literal('event'),
187
187
  params: eventParamsSchema,
188
188
  });
189
189
  /** The nine event topics (schema.md "Events" table) — count-assertion source.
190
190
  * `audio-level` (Todo 21) and `config-change` (Todo 9) are additive and appended
191
191
  * last, preserving the order of every prior topic. */
192
192
  export const EVENT_TOPICS = [
193
- "status",
194
- "switch",
195
- "device",
196
- "bitrate",
197
- "srt-stats",
198
- "error",
199
- "preview",
200
- "audio-level",
201
- "config-change",
193
+ 'status',
194
+ 'switch',
195
+ 'device',
196
+ 'bitrate',
197
+ 'srt-stats',
198
+ 'error',
199
+ 'preview',
200
+ 'audio-level',
201
+ 'config-change',
202
202
  ];
203
203
  /** topic → payload Zod schema. Tests assert every topic is represented here. */
204
204
  export const eventSchemas = {
@@ -206,9 +206,9 @@ export const eventSchemas = {
206
206
  switch: switchEventSchema,
207
207
  device: deviceEventSchema,
208
208
  bitrate: bitrateEventSchema,
209
- "srt-stats": srtStatsEventSchema,
209
+ 'srt-stats': srtStatsEventSchema,
210
210
  error: runtimeErrorEventSchema,
211
211
  preview: previewEventSchema,
212
- "audio-level": audioLevelEventSchema,
213
- "config-change": configChangeEventSchema,
212
+ 'audio-level': audioLevelEventSchema,
213
+ 'config-change': configChangeEventSchema,
214
214
  };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from "./constants.js";
2
- export * from "./errors.js";
3
- export * from "./envelope.js";
4
- export * from "./types.js";
5
- export * from "./messages.js";
6
- export * from "./events.js";
7
- export * from "./paths.js";
8
- export * from "./config.js";
9
- export * from "./client.js";
1
+ export * from './client.js';
2
+ export * from './config.js';
3
+ export * from './constants.js';
4
+ export * from './envelope.js';
5
+ export * from './errors.js';
6
+ export * from './events.js';
7
+ export * from './messages.js';
8
+ export * from './paths.js';
9
+ export * from './types.js';
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@
2
2
  // Rust streaming engine. The Zod schemas + types are the frozen public contract
3
3
  // (ADR-0002 / schema.md); the client drives that contract over a Bun-native
4
4
  // NDJSON/UDS transport (Task 31).
5
- export * from "./constants.js";
6
- export * from "./errors.js";
7
- export * from "./envelope.js";
8
- export * from "./types.js";
9
- export * from "./messages.js";
10
- export * from "./events.js";
11
- export * from "./paths.js";
12
- export * from "./config.js";
13
- export * from "./client.js";
5
+ export * from './client.js';
6
+ export * from './config.js';
7
+ export * from './constants.js';
8
+ export * from './envelope.js';
9
+ export * from './errors.js';
10
+ export * from './events.js';
11
+ export * from './messages.js';
12
+ export * from './paths.js';
13
+ export * from './types.js';