@ceralive/cerastream 2026.9.10 → 2026.9.11
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/README.md +8 -0
- package/dist/capture-status.d.ts +52 -0
- package/dist/capture-status.js +62 -0
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +5 -1
- package/dist/events.d.ts +180 -0
- package/dist/events.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/messages.d.ts +28 -0
- package/dist/messages.js +3 -0
- package/dist/session-switch.d.ts +6 -0
- package/dist/session-switch.js +3 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @ceralive/cerastream
|
|
2
2
|
|
|
3
|
+
Prepared `2026.9.11` / schema `0.21.0` adds an optional capture-status report
|
|
4
|
+
and source-mode fields on switch targets plus a closed `retime`/`adapt` input
|
|
5
|
+
policy. Capture status accepts future token strings without dropping a status
|
|
6
|
+
event; malformed capture blocks become absent without hiding encode data.
|
|
7
|
+
`INTERNAL_TRANSITION_WORST_CASE_BOUND_MS` is `65_000` in both IPC and bindings.
|
|
8
|
+
This is not a published release or engine recovery implementation. Publish before
|
|
9
|
+
consumer use; capability tokens are not advertised by the engine yet.
|
|
10
|
+
|
|
3
11
|
Prepared `2026.9.10` / schema `0.20.0` carries optional
|
|
4
12
|
`active_encode.skip_to_live` alongside encoder health counters. It counts
|
|
5
13
|
age-based RAM backlog discards in the current session, not outages or lost frames.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CAPTURE_STATES: readonly ['normal', 'degraded', 'standby'];
|
|
3
|
+
export declare const SUSPENSION_KINDS: readonly ['composition_primary_absent', 'passthrough_source_absent', 'rate_adapted'];
|
|
4
|
+
export declare const TRANSITION_KINDS: readonly ['suspend', 'resume', 'adapt', 'restore', 'safe_harbor'];
|
|
5
|
+
export declare const FAILOVER_RATE_POLICIES: readonly ['retime', 'adapt'];
|
|
6
|
+
export declare const CAPTURE_CAUSES: ("composition-unsupported" | "decoder-unavailable" | "device_busy" | "interlaced-unsupported" | "negotiation_failed" | "no_signal" | "no_silicon_converter" | "secondary-unavailable" | "software-pixel-path-rejected" | "source-changed" | "unsupported-format")[];
|
|
7
|
+
export declare function isKnownCaptureState(value: string): value is (typeof CAPTURE_STATES)[number];
|
|
8
|
+
export declare function isKnownSuspensionKind(value: string): value is (typeof SUSPENSION_KINDS)[number];
|
|
9
|
+
export declare function isKnownTransitionKind(value: string): value is (typeof TRANSITION_KINDS)[number];
|
|
10
|
+
export declare function isKnownFailoverRatePolicy(value: string): value is (typeof FAILOVER_RATE_POLICIES)[number];
|
|
11
|
+
export declare function isKnownCaptureCause(value: string): value is (typeof CAPTURE_CAUSES)[number];
|
|
12
|
+
/** Inputs are owned by the sender and remain closed; status values remain open. */
|
|
13
|
+
export declare const failoverRatePolicyInputSchema: z.ZodEnum<{
|
|
14
|
+
adapt: "adapt";
|
|
15
|
+
retime: "retime";
|
|
16
|
+
}>;
|
|
17
|
+
export type FailoverRatePolicyInput = z.infer<typeof failoverRatePolicyInputSchema>;
|
|
18
|
+
/** Unknown future enum tokens must not make the parent `status` event fail validation. */
|
|
19
|
+
export declare const captureStatusSchema: z.ZodObject<{
|
|
20
|
+
state: z.ZodString;
|
|
21
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
22
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
23
|
+
input_id: z.ZodString;
|
|
24
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
kind: z.ZodString;
|
|
29
|
+
since_ms: z.ZodNumber;
|
|
30
|
+
resume_attempts: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
kind: z.ZodString;
|
|
34
|
+
since_ms: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
input_id: z.ZodString;
|
|
38
|
+
width: z.ZodNumber;
|
|
39
|
+
height: z.ZodNumber;
|
|
40
|
+
framerate: z.ZodNumber;
|
|
41
|
+
retimed: z.ZodBoolean;
|
|
42
|
+
rescaled: z.ZodBoolean;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
in: z.ZodNumber;
|
|
46
|
+
out: z.ZodNumber;
|
|
47
|
+
drop: z.ZodNumber;
|
|
48
|
+
duplicate: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
failover_rate_policy: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type CaptureStatus = z.infer<typeof captureStatusSchema>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { captureCauseSchema } from './errors.js';
|
|
3
|
+
export const CAPTURE_STATES = ['normal', 'degraded', 'standby'];
|
|
4
|
+
export const SUSPENSION_KINDS = [
|
|
5
|
+
'composition_primary_absent',
|
|
6
|
+
'passthrough_source_absent',
|
|
7
|
+
'rate_adapted',
|
|
8
|
+
];
|
|
9
|
+
export const TRANSITION_KINDS = ['suspend', 'resume', 'adapt', 'restore', 'safe_harbor'];
|
|
10
|
+
export const FAILOVER_RATE_POLICIES = ['retime', 'adapt'];
|
|
11
|
+
export const CAPTURE_CAUSES = captureCauseSchema.options;
|
|
12
|
+
export function isKnownCaptureState(value) {
|
|
13
|
+
return CAPTURE_STATES.some((state) => state === value);
|
|
14
|
+
}
|
|
15
|
+
export function isKnownSuspensionKind(value) {
|
|
16
|
+
return SUSPENSION_KINDS.some((kind) => kind === value);
|
|
17
|
+
}
|
|
18
|
+
export function isKnownTransitionKind(value) {
|
|
19
|
+
return TRANSITION_KINDS.some((kind) => kind === value);
|
|
20
|
+
}
|
|
21
|
+
export function isKnownFailoverRatePolicy(value) {
|
|
22
|
+
return FAILOVER_RATE_POLICIES.some((policy) => policy === value);
|
|
23
|
+
}
|
|
24
|
+
export function isKnownCaptureCause(value) {
|
|
25
|
+
return CAPTURE_CAUSES.some((cause) => cause === value);
|
|
26
|
+
}
|
|
27
|
+
/** Inputs are owned by the sender and remain closed; status values remain open. */
|
|
28
|
+
export const failoverRatePolicyInputSchema = z.enum(FAILOVER_RATE_POLICIES);
|
|
29
|
+
/** Unknown future enum tokens must not make the parent `status` event fail validation. */
|
|
30
|
+
export const captureStatusSchema = z.object({
|
|
31
|
+
state: z.string(),
|
|
32
|
+
live_inputs: z.array(z.string()),
|
|
33
|
+
degraded_inputs: z.array(z.object({ input_id: z.string(), cause: z.string().optional() })),
|
|
34
|
+
standby_since_ms: z.number().int().nonnegative().optional(),
|
|
35
|
+
suspension: z
|
|
36
|
+
.object({
|
|
37
|
+
kind: z.string(),
|
|
38
|
+
since_ms: z.number().int().nonnegative(),
|
|
39
|
+
resume_attempts: z.number().int().nonnegative(),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
transition: z.object({ kind: z.string(), since_ms: z.number().int().nonnegative() }).optional(),
|
|
43
|
+
active_source: z
|
|
44
|
+
.object({
|
|
45
|
+
input_id: z.string(),
|
|
46
|
+
width: z.number().int().nonnegative(),
|
|
47
|
+
height: z.number().int().nonnegative(),
|
|
48
|
+
framerate: z.number(),
|
|
49
|
+
retimed: z.boolean(),
|
|
50
|
+
rescaled: z.boolean(),
|
|
51
|
+
})
|
|
52
|
+
.optional(),
|
|
53
|
+
retime: z
|
|
54
|
+
.object({
|
|
55
|
+
in: z.number().int().nonnegative(),
|
|
56
|
+
out: z.number().int().nonnegative(),
|
|
57
|
+
drop: z.number().int().nonnegative(),
|
|
58
|
+
duplicate: z.number().int().nonnegative(),
|
|
59
|
+
})
|
|
60
|
+
.optional(),
|
|
61
|
+
failover_rate_policy: z.string(),
|
|
62
|
+
});
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ 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.
|
|
11
|
+
export declare const SCHEMA_VERSION: '0.21.0';
|
|
12
|
+
/** Mirrors the Rust bound derived from 3 × teardown + 2 × (build + connect + play + gate). */
|
|
13
|
+
export declare const INTERNAL_TRANSITION_WORST_CASE_BOUND_MS = 65000;
|
|
12
14
|
/** Runtime dir holding both control + preview sockets. systemd `RuntimeDirectory=cerastream`. */
|
|
13
15
|
export declare const DEFAULT_IPC_DIR: '/run/cerastream';
|
|
14
16
|
/** Env override for the IPC dir (tests/dev). Defaults to {@link DEFAULT_IPC_DIR}. */
|
|
@@ -78,7 +80,7 @@ export declare const COMPOSITION_FEATURE: 'composition';
|
|
|
78
80
|
* array, never on membership here — a configuration-dependent token is filtered
|
|
79
81
|
* out of the response the engine actually sends.
|
|
80
82
|
*/
|
|
81
|
-
export declare const ENGINE_FEATURES: readonly ['video-passthrough', 'input-mode', 'audio-pcm-spec', "pipewire-capture", "composition"];
|
|
83
|
+
export declare const ENGINE_FEATURES: readonly ['video-passthrough', 'input-mode', 'audio-pcm-spec', "pipewire-capture", "composition", 'capture-standby', 'failover-rate-policy'];
|
|
82
84
|
/** Engine binary name (systemd-owned; CeraUI never spawns it — ADR-0005). */
|
|
83
85
|
export declare const CERASTREAM_BIN: 'cerastream';
|
|
84
86
|
export declare const DEFAULT_MIN_BITRATE = 300;
|
package/dist/constants.js
CHANGED
|
@@ -11,7 +11,9 @@ 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.
|
|
14
|
+
export const SCHEMA_VERSION = '0.21.0';
|
|
15
|
+
/** Mirrors the Rust bound derived from 3 × teardown + 2 × (build + connect + play + gate). */
|
|
16
|
+
export const INTERNAL_TRANSITION_WORST_CASE_BOUND_MS = 65_000;
|
|
15
17
|
/** Runtime dir holding both control + preview sockets. systemd `RuntimeDirectory=cerastream`. */
|
|
16
18
|
export const DEFAULT_IPC_DIR = '/run/cerastream';
|
|
17
19
|
/** Env override for the IPC dir (tests/dev). Defaults to {@link DEFAULT_IPC_DIR}. */
|
|
@@ -93,6 +95,8 @@ export const ENGINE_FEATURES = [
|
|
|
93
95
|
'audio-pcm-spec',
|
|
94
96
|
PIPEWIRE_CAPTURE_FEATURE,
|
|
95
97
|
COMPOSITION_FEATURE,
|
|
98
|
+
'capture-standby',
|
|
99
|
+
'failover-rate-policy',
|
|
96
100
|
];
|
|
97
101
|
/** Engine binary name (systemd-owned; CeraUI never spawns it — ADR-0005). */
|
|
98
102
|
export const CERASTREAM_BIN = 'cerastream';
|
package/dist/events.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export declare const activeEncodeSchema: z.ZodObject<{
|
|
|
18
18
|
network: "network";
|
|
19
19
|
synthetic: "synthetic";
|
|
20
20
|
}>;
|
|
21
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
21
24
|
}, z.core.$strip>>>;
|
|
22
25
|
decoder: z.ZodOptional<z.ZodString>;
|
|
23
26
|
input_codec: z.ZodOptional<z.ZodString>;
|
|
@@ -29,6 +32,39 @@ export declare const activeEncodeSchema: z.ZodObject<{
|
|
|
29
32
|
encoder_restarts: z.ZodOptional<z.ZodNumber>;
|
|
30
33
|
kernel_faults: z.ZodOptional<z.ZodNumber>;
|
|
31
34
|
skip_to_live: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
capture: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
36
|
+
state: z.ZodString;
|
|
37
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
38
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
39
|
+
input_id: z.ZodString;
|
|
40
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
kind: z.ZodString;
|
|
45
|
+
since_ms: z.ZodNumber;
|
|
46
|
+
resume_attempts: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
kind: z.ZodString;
|
|
50
|
+
since_ms: z.ZodNumber;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
input_id: z.ZodString;
|
|
54
|
+
width: z.ZodNumber;
|
|
55
|
+
height: z.ZodNumber;
|
|
56
|
+
framerate: z.ZodNumber;
|
|
57
|
+
retimed: z.ZodBoolean;
|
|
58
|
+
rescaled: z.ZodBoolean;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
in: z.ZodNumber;
|
|
62
|
+
out: z.ZodNumber;
|
|
63
|
+
drop: z.ZodNumber;
|
|
64
|
+
duplicate: z.ZodNumber;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
failover_rate_policy: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>>;
|
|
32
68
|
}, z.core.$strip>;
|
|
33
69
|
export type ActiveEncode = z.infer<typeof activeEncodeSchema>;
|
|
34
70
|
/**
|
|
@@ -102,6 +138,9 @@ export declare const statusEventSchema: z.ZodObject<{
|
|
|
102
138
|
network: "network";
|
|
103
139
|
synthetic: "synthetic";
|
|
104
140
|
}>;
|
|
141
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
105
144
|
}, z.core.$strip>>>;
|
|
106
145
|
decoder: z.ZodOptional<z.ZodString>;
|
|
107
146
|
input_codec: z.ZodOptional<z.ZodString>;
|
|
@@ -113,6 +152,39 @@ export declare const statusEventSchema: z.ZodObject<{
|
|
|
113
152
|
encoder_restarts: z.ZodOptional<z.ZodNumber>;
|
|
114
153
|
kernel_faults: z.ZodOptional<z.ZodNumber>;
|
|
115
154
|
skip_to_live: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
capture: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
156
|
+
state: z.ZodString;
|
|
157
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
158
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
159
|
+
input_id: z.ZodString;
|
|
160
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
kind: z.ZodString;
|
|
165
|
+
since_ms: z.ZodNumber;
|
|
166
|
+
resume_attempts: z.ZodNumber;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
169
|
+
kind: z.ZodString;
|
|
170
|
+
since_ms: z.ZodNumber;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
input_id: z.ZodString;
|
|
174
|
+
width: z.ZodNumber;
|
|
175
|
+
height: z.ZodNumber;
|
|
176
|
+
framerate: z.ZodNumber;
|
|
177
|
+
retimed: z.ZodBoolean;
|
|
178
|
+
rescaled: z.ZodBoolean;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
in: z.ZodNumber;
|
|
182
|
+
out: z.ZodNumber;
|
|
183
|
+
drop: z.ZodNumber;
|
|
184
|
+
duplicate: z.ZodNumber;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
failover_rate_policy: z.ZodString;
|
|
187
|
+
}, z.core.$strip>>>;
|
|
116
188
|
}, z.core.$strip>>;
|
|
117
189
|
preview_encoder_realized: z.ZodOptional<z.ZodObject<{
|
|
118
190
|
selected_element: z.ZodOptional<z.ZodString>;
|
|
@@ -375,6 +447,9 @@ export declare const eventParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
375
447
|
network: "network";
|
|
376
448
|
synthetic: "synthetic";
|
|
377
449
|
}>;
|
|
450
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
451
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
452
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
378
453
|
}, z.core.$strip>>>;
|
|
379
454
|
decoder: z.ZodOptional<z.ZodString>;
|
|
380
455
|
input_codec: z.ZodOptional<z.ZodString>;
|
|
@@ -386,6 +461,39 @@ export declare const eventParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
386
461
|
encoder_restarts: z.ZodOptional<z.ZodNumber>;
|
|
387
462
|
kernel_faults: z.ZodOptional<z.ZodNumber>;
|
|
388
463
|
skip_to_live: z.ZodOptional<z.ZodNumber>;
|
|
464
|
+
capture: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
465
|
+
state: z.ZodString;
|
|
466
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
467
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
468
|
+
input_id: z.ZodString;
|
|
469
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
470
|
+
}, z.core.$strip>>;
|
|
471
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
472
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
473
|
+
kind: z.ZodString;
|
|
474
|
+
since_ms: z.ZodNumber;
|
|
475
|
+
resume_attempts: z.ZodNumber;
|
|
476
|
+
}, z.core.$strip>>;
|
|
477
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
478
|
+
kind: z.ZodString;
|
|
479
|
+
since_ms: z.ZodNumber;
|
|
480
|
+
}, z.core.$strip>>;
|
|
481
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
482
|
+
input_id: z.ZodString;
|
|
483
|
+
width: z.ZodNumber;
|
|
484
|
+
height: z.ZodNumber;
|
|
485
|
+
framerate: z.ZodNumber;
|
|
486
|
+
retimed: z.ZodBoolean;
|
|
487
|
+
rescaled: z.ZodBoolean;
|
|
488
|
+
}, z.core.$strip>>;
|
|
489
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
490
|
+
in: z.ZodNumber;
|
|
491
|
+
out: z.ZodNumber;
|
|
492
|
+
drop: z.ZodNumber;
|
|
493
|
+
duplicate: z.ZodNumber;
|
|
494
|
+
}, z.core.$strip>>;
|
|
495
|
+
failover_rate_policy: z.ZodString;
|
|
496
|
+
}, z.core.$strip>>>;
|
|
389
497
|
}, z.core.$strip>>;
|
|
390
498
|
preview_encoder_realized: z.ZodOptional<z.ZodObject<{
|
|
391
499
|
selected_element: z.ZodOptional<z.ZodString>;
|
|
@@ -595,6 +703,9 @@ export declare const cerastreamEventSchema: z.ZodObject<{
|
|
|
595
703
|
network: "network";
|
|
596
704
|
synthetic: "synthetic";
|
|
597
705
|
}>;
|
|
706
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
707
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
708
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
598
709
|
}, z.core.$strip>>>;
|
|
599
710
|
decoder: z.ZodOptional<z.ZodString>;
|
|
600
711
|
input_codec: z.ZodOptional<z.ZodString>;
|
|
@@ -606,6 +717,39 @@ export declare const cerastreamEventSchema: z.ZodObject<{
|
|
|
606
717
|
encoder_restarts: z.ZodOptional<z.ZodNumber>;
|
|
607
718
|
kernel_faults: z.ZodOptional<z.ZodNumber>;
|
|
608
719
|
skip_to_live: z.ZodOptional<z.ZodNumber>;
|
|
720
|
+
capture: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
721
|
+
state: z.ZodString;
|
|
722
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
723
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
724
|
+
input_id: z.ZodString;
|
|
725
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
726
|
+
}, z.core.$strip>>;
|
|
727
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
728
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
729
|
+
kind: z.ZodString;
|
|
730
|
+
since_ms: z.ZodNumber;
|
|
731
|
+
resume_attempts: z.ZodNumber;
|
|
732
|
+
}, z.core.$strip>>;
|
|
733
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
734
|
+
kind: z.ZodString;
|
|
735
|
+
since_ms: z.ZodNumber;
|
|
736
|
+
}, z.core.$strip>>;
|
|
737
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
738
|
+
input_id: z.ZodString;
|
|
739
|
+
width: z.ZodNumber;
|
|
740
|
+
height: z.ZodNumber;
|
|
741
|
+
framerate: z.ZodNumber;
|
|
742
|
+
retimed: z.ZodBoolean;
|
|
743
|
+
rescaled: z.ZodBoolean;
|
|
744
|
+
}, z.core.$strip>>;
|
|
745
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
746
|
+
in: z.ZodNumber;
|
|
747
|
+
out: z.ZodNumber;
|
|
748
|
+
drop: z.ZodNumber;
|
|
749
|
+
duplicate: z.ZodNumber;
|
|
750
|
+
}, z.core.$strip>>;
|
|
751
|
+
failover_rate_policy: z.ZodString;
|
|
752
|
+
}, z.core.$strip>>>;
|
|
609
753
|
}, z.core.$strip>>;
|
|
610
754
|
preview_encoder_realized: z.ZodOptional<z.ZodObject<{
|
|
611
755
|
selected_element: z.ZodOptional<z.ZodString>;
|
|
@@ -819,6 +963,9 @@ export declare const eventSchemas: {
|
|
|
819
963
|
network: "network";
|
|
820
964
|
synthetic: "synthetic";
|
|
821
965
|
}>;
|
|
966
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
967
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
968
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
822
969
|
}, z.core.$strip>>>;
|
|
823
970
|
decoder: z.ZodOptional<z.ZodString>;
|
|
824
971
|
input_codec: z.ZodOptional<z.ZodString>;
|
|
@@ -830,6 +977,39 @@ export declare const eventSchemas: {
|
|
|
830
977
|
encoder_restarts: z.ZodOptional<z.ZodNumber>;
|
|
831
978
|
kernel_faults: z.ZodOptional<z.ZodNumber>;
|
|
832
979
|
skip_to_live: z.ZodOptional<z.ZodNumber>;
|
|
980
|
+
capture: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
981
|
+
state: z.ZodString;
|
|
982
|
+
live_inputs: z.ZodArray<z.ZodString>;
|
|
983
|
+
degraded_inputs: z.ZodArray<z.ZodObject<{
|
|
984
|
+
input_id: z.ZodString;
|
|
985
|
+
cause: z.ZodOptional<z.ZodString>;
|
|
986
|
+
}, z.core.$strip>>;
|
|
987
|
+
standby_since_ms: z.ZodOptional<z.ZodNumber>;
|
|
988
|
+
suspension: z.ZodOptional<z.ZodObject<{
|
|
989
|
+
kind: z.ZodString;
|
|
990
|
+
since_ms: z.ZodNumber;
|
|
991
|
+
resume_attempts: z.ZodNumber;
|
|
992
|
+
}, z.core.$strip>>;
|
|
993
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
994
|
+
kind: z.ZodString;
|
|
995
|
+
since_ms: z.ZodNumber;
|
|
996
|
+
}, z.core.$strip>>;
|
|
997
|
+
active_source: z.ZodOptional<z.ZodObject<{
|
|
998
|
+
input_id: z.ZodString;
|
|
999
|
+
width: z.ZodNumber;
|
|
1000
|
+
height: z.ZodNumber;
|
|
1001
|
+
framerate: z.ZodNumber;
|
|
1002
|
+
retimed: z.ZodBoolean;
|
|
1003
|
+
rescaled: z.ZodBoolean;
|
|
1004
|
+
}, z.core.$strip>>;
|
|
1005
|
+
retime: z.ZodOptional<z.ZodObject<{
|
|
1006
|
+
in: z.ZodNumber;
|
|
1007
|
+
out: z.ZodNumber;
|
|
1008
|
+
drop: z.ZodNumber;
|
|
1009
|
+
duplicate: z.ZodNumber;
|
|
1010
|
+
}, z.core.$strip>>;
|
|
1011
|
+
failover_rate_policy: z.ZodString;
|
|
1012
|
+
}, z.core.$strip>>>;
|
|
833
1013
|
}, z.core.$strip>>;
|
|
834
1014
|
preview_encoder_realized: z.ZodOptional<z.ZodObject<{
|
|
835
1015
|
selected_element: z.ZodOptional<z.ZodString>;
|
package/dist/events.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { captureStatusSchema } from './capture-status.js';
|
|
2
3
|
import { captureCauseSchema, processErrorCodeSchema, processErrorSourceSchema } from './errors.js';
|
|
3
4
|
import { sessionSwitchTargetSchema } from './session-switch.js';
|
|
4
5
|
import { captureDeviceSchema, configChangePhaseSchema, inputModeSchema, mediaClassSchema, previewEncodeFallbackSchema, previewEncodeModeSchema, streamStateSchema, } from './types.js';
|
|
@@ -29,6 +30,7 @@ export const activeEncodeSchema = z.object({
|
|
|
29
30
|
encoder_restarts: z.number().int().nonnegative().optional(), // 0.20.0: bounded MPP context restarts this session (any cause); ABSENT = not asked, Some(0) = asked and clean
|
|
30
31
|
kernel_faults: z.number().int().nonnegative().optional(), // 0.20.0: the kernel-attributed subset; 0 is weak evidence — the plugin fault bridge is opt-in and ships off
|
|
31
32
|
skip_to_live: z.number().int().nonnegative().optional(),
|
|
33
|
+
capture: captureStatusSchema.optional().catch(undefined),
|
|
32
34
|
});
|
|
33
35
|
/**
|
|
34
36
|
* What this session's PREVIEW branch is actually encoding with (additive),
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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 './capture-status.js';
|
|
5
6
|
export * from './client.js';
|
|
6
7
|
export * from './config.js';
|
|
7
8
|
export * from './constants.js';
|
package/dist/messages.d.ts
CHANGED
|
@@ -71,6 +71,10 @@ export declare const startParamsSchema: z.ZodObject<{
|
|
|
71
71
|
}>;
|
|
72
72
|
alpha: z.ZodOptional<z.ZodNumber>;
|
|
73
73
|
}, z.core.$strip>>;
|
|
74
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
adapt: "adapt";
|
|
76
|
+
retime: "retime";
|
|
77
|
+
}>>;
|
|
74
78
|
}, z.core.$strip>;
|
|
75
79
|
export type StartParams = z.infer<typeof startParamsSchema>;
|
|
76
80
|
export declare const startResultSchema: z.ZodObject<{
|
|
@@ -122,6 +126,10 @@ export declare const reloadConfigParamsSchema: z.ZodObject<{
|
|
|
122
126
|
hardware: "hardware";
|
|
123
127
|
software: "software";
|
|
124
128
|
}>>;
|
|
129
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
adapt: "adapt";
|
|
131
|
+
retime: "retime";
|
|
132
|
+
}>>;
|
|
125
133
|
}, z.core.$strip>;
|
|
126
134
|
export type ReloadConfigParams = z.infer<typeof reloadConfigParamsSchema>;
|
|
127
135
|
export declare const reloadConfigResultSchema: z.ZodObject<{
|
|
@@ -151,6 +159,10 @@ export declare const reloadConfigResultSchema: z.ZodObject<{
|
|
|
151
159
|
hardware: "hardware";
|
|
152
160
|
software: "software";
|
|
153
161
|
}>>;
|
|
162
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
163
|
+
adapt: "adapt";
|
|
164
|
+
retime: "retime";
|
|
165
|
+
}>>;
|
|
154
166
|
}, z.core.$strip>;
|
|
155
167
|
bitrate_control: z.ZodOptional<z.ZodEnum<{
|
|
156
168
|
encoder: "encoder";
|
|
@@ -649,6 +661,10 @@ export declare const changeConfigParamsSchema: z.ZodObject<{
|
|
|
649
661
|
}>;
|
|
650
662
|
alpha: z.ZodOptional<z.ZodNumber>;
|
|
651
663
|
}, z.core.$strip>>>;
|
|
664
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
665
|
+
adapt: "adapt";
|
|
666
|
+
retime: "retime";
|
|
667
|
+
}>>;
|
|
652
668
|
}, z.core.$strip>;
|
|
653
669
|
export type ChangeConfigParams = z.infer<typeof changeConfigParamsSchema>;
|
|
654
670
|
export declare const changeConfigResultSchema: z.ZodObject<{
|
|
@@ -769,6 +785,10 @@ export declare const requestSchemas: {
|
|
|
769
785
|
}>;
|
|
770
786
|
alpha: z.ZodOptional<z.ZodNumber>;
|
|
771
787
|
}, z.core.$strip>>;
|
|
788
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
789
|
+
adapt: "adapt";
|
|
790
|
+
retime: "retime";
|
|
791
|
+
}>>;
|
|
772
792
|
}, z.core.$strip>;
|
|
773
793
|
readonly result: z.ZodObject<{
|
|
774
794
|
session_id: z.ZodString;
|
|
@@ -820,6 +840,10 @@ export declare const requestSchemas: {
|
|
|
820
840
|
hardware: "hardware";
|
|
821
841
|
software: "software";
|
|
822
842
|
}>>;
|
|
843
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
844
|
+
adapt: "adapt";
|
|
845
|
+
retime: "retime";
|
|
846
|
+
}>>;
|
|
823
847
|
}, z.core.$strip>;
|
|
824
848
|
readonly result: z.ZodObject<{
|
|
825
849
|
applied: z.ZodObject<{
|
|
@@ -848,6 +872,10 @@ export declare const requestSchemas: {
|
|
|
848
872
|
hardware: "hardware";
|
|
849
873
|
software: "software";
|
|
850
874
|
}>>;
|
|
875
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
876
|
+
adapt: "adapt";
|
|
877
|
+
retime: "retime";
|
|
878
|
+
}>>;
|
|
851
879
|
}, z.core.$strip>;
|
|
852
880
|
bitrate_control: z.ZodOptional<z.ZodEnum<{
|
|
853
881
|
encoder: "encoder";
|
package/dist/messages.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { failoverRatePolicyInputSchema } from './capture-status.js';
|
|
2
3
|
import { AUDIO_DELAY_MAX_MS } from './constants.js';
|
|
3
4
|
import { helloParamsSchema, helloResultSchema } from './envelope.js';
|
|
4
5
|
import { audioBackendSchema, balancerAlgorithmSchema, bitrateControlSchema, captureDeviceKindSchema, captureDeviceSchema, cerastreamConfigSchema, compositionConfigSchema, configChangePhaseSchema, inputModeSchema, mediaClassSchema, previewEncodeModeSchema, previewTierSchema, streamStateSchema, videoCodecSchema, } from './types.js';
|
|
@@ -52,6 +53,7 @@ export const reloadConfigParamsSchema = z.object({
|
|
|
52
53
|
// session, and routing it through the transactional method would restart a live
|
|
53
54
|
// stream to change a preview setting.
|
|
54
55
|
preview_encode: previewEncodeModeSchema.optional(),
|
|
56
|
+
failover_rate_policy: failoverRatePolicyInputSchema.optional(),
|
|
55
57
|
});
|
|
56
58
|
export const reloadConfigResultSchema = z.object({
|
|
57
59
|
applied: reloadConfigParamsSchema, // post-clamp values actually applied
|
|
@@ -272,6 +274,7 @@ export const changeConfigParamsSchema = z
|
|
|
272
274
|
// rolls back honestly (reason: mode_barrier_timeout) if the barrier expires.
|
|
273
275
|
input_mode: captureDeviceKindSchema.optional(),
|
|
274
276
|
composition: compositionConfigSchema.nullable().optional(),
|
|
277
|
+
failover_rate_policy: failoverRatePolicyInputSchema.optional(),
|
|
275
278
|
})
|
|
276
279
|
.refine((delta) => Object.keys(delta).length > 0, {
|
|
277
280
|
message: 'change-config delta must carry at least one field',
|
package/dist/session-switch.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare const sessionSwitchTargetSchema: z.ZodObject<{
|
|
|
13
13
|
network: "network";
|
|
14
14
|
synthetic: "synthetic";
|
|
15
15
|
}>;
|
|
16
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
16
19
|
}, z.core.$strip>;
|
|
17
20
|
export type SessionSwitchTarget = z.infer<typeof sessionSwitchTargetSchema>;
|
|
18
21
|
export declare const listSwitchTargetsParamsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
@@ -28,6 +31,9 @@ export declare const listSwitchTargetsResultSchema: z.ZodObject<{
|
|
|
28
31
|
network: "network";
|
|
29
32
|
synthetic: "synthetic";
|
|
30
33
|
}>;
|
|
34
|
+
source_width: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
source_height: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
source_framerate: z.ZodOptional<z.ZodNumber>;
|
|
31
37
|
}, z.core.$strip>>;
|
|
32
38
|
}, z.core.$strip>;
|
|
33
39
|
export type ListSwitchTargetsResult = z.infer<typeof listSwitchTargetsResultSchema>;
|
package/dist/session-switch.js
CHANGED
|
@@ -4,6 +4,9 @@ export const sessionSwitchTargetKindSchema = z.enum(['capture', 'synthetic', 'ne
|
|
|
4
4
|
export const sessionSwitchTargetSchema = z.object({
|
|
5
5
|
input_id: z.string(),
|
|
6
6
|
kind: sessionSwitchTargetKindSchema,
|
|
7
|
+
source_width: z.number().int().nonnegative().optional(),
|
|
8
|
+
source_height: z.number().int().nonnegative().optional(),
|
|
9
|
+
source_framerate: z.number().optional(),
|
|
7
10
|
});
|
|
8
11
|
export const listSwitchTargetsParamsSchema = z.object({});
|
|
9
12
|
/** A snapshot, not a reservation; re-query before dispatch and handle switch refusal. */
|
package/dist/types.d.ts
CHANGED
|
@@ -241,6 +241,10 @@ export declare const cerastreamConfigSchema: z.ZodObject<{
|
|
|
241
241
|
}>;
|
|
242
242
|
alpha: z.ZodOptional<z.ZodNumber>;
|
|
243
243
|
}, z.core.$strip>>;
|
|
244
|
+
failover_rate_policy: z.ZodOptional<z.ZodEnum<{
|
|
245
|
+
adapt: "adapt";
|
|
246
|
+
retime: "retime";
|
|
247
|
+
}>>;
|
|
244
248
|
}, z.core.$strip>;
|
|
245
249
|
export type CerastreamConfig = z.infer<typeof cerastreamConfigSchema>;
|
|
246
250
|
export type PartialCerastreamConfig = z.input<typeof cerastreamConfigSchema>;
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { failoverRatePolicyInputSchema } from './capture-status.js';
|
|
2
3
|
import { DEFAULT_BALANCER, DEFAULT_MAX_BITRATE, DEFAULT_MIN_BITRATE, DEFAULT_SRT_LATENCY, } from './constants.js';
|
|
3
4
|
// Shared domain enums + the unified engine config. Field names are domain-level
|
|
4
5
|
// (snake_case, matching the ceracoder config convention) — never engine
|
|
@@ -156,6 +157,7 @@ export const cerastreamConfigSchema = z.object({
|
|
|
156
157
|
video_passthrough: videoPassthroughSchema.optional(), // additive (0.5.0): auto|force|off; absent ⇒ auto
|
|
157
158
|
input_mode: captureDeviceKindSchema.optional(), // additive (0.11.0): which MODE family of the selected device to capture in, naming a list-devices modes[].pipeline_kind. Absent ⇒ the engine's precedence pick (h265 → h264 → mjpeg → raw). The ONLY way to reach the non-precedence family of a dual-format camera; a family the device does not expose is a typed cerastream.params.invalid, never a silent fallback
|
|
158
159
|
composition: compositionConfigSchema.optional(),
|
|
160
|
+
failover_rate_policy: failoverRatePolicyInputSchema.optional(),
|
|
159
161
|
});
|
|
160
162
|
// convenience defaults for building a config client-side
|
|
161
163
|
export const DEFAULT_BITRATE_CONFIG = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ceralive/cerastream",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.11",
|
|
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",
|