reactor-effect-client 0.2.0 → 0.3.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/README.md +66 -6
- package/dist/FetchHttp.js +1 -1
- package/dist/FetchHttp.js.map +1 -1
- package/dist/PeerFactory.d.ts +13 -2
- package/dist/PeerFactory.d.ts.map +1 -1
- package/dist/PeerFactory.js.map +1 -1
- package/dist/PeerTypes.d.ts +2 -2
- package/dist/PeerTypes.d.ts.map +1 -1
- package/dist/Sequence.d.ts +18 -14
- package/dist/Sequence.d.ts.map +1 -1
- package/dist/Sequence.js +117 -122
- package/dist/Sequence.js.map +1 -1
- package/dist/SessionTypes.d.ts +172 -15
- package/dist/SessionTypes.d.ts.map +1 -1
- package/dist/SessionTypes.js +18 -1
- package/dist/SessionTypes.js.map +1 -1
- package/dist/bytes.js +3 -3
- package/dist/bytes.js.map +1 -1
- package/dist/contract.d.ts +120 -29
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +105 -73
- package/dist/contract.js.map +1 -1
- package/dist/coordinator/_internal/client.d.ts +111 -17
- package/dist/coordinator/_internal/client.d.ts.map +1 -1
- package/dist/coordinator/_internal/client.js +187 -74
- package/dist/coordinator/_internal/client.js.map +1 -1
- package/dist/coordinator/_internal/recording.d.ts +33 -0
- package/dist/coordinator/_internal/recording.d.ts.map +1 -0
- package/dist/coordinator/_internal/recording.js +123 -0
- package/dist/coordinator/_internal/recording.js.map +1 -0
- package/dist/coordinator/_internal/response.d.ts.map +1 -1
- package/dist/coordinator/_internal/response.js +5 -7
- package/dist/coordinator/_internal/response.js.map +1 -1
- package/dist/coordinator/_internal/schemas.d.ts +40 -6
- package/dist/coordinator/_internal/schemas.d.ts.map +1 -1
- package/dist/coordinator/_internal/schemas.js +94 -64
- package/dist/coordinator/_internal/schemas.js.map +1 -1
- package/dist/coordinator/index.d.ts +14 -2
- package/dist/coordinator/index.d.ts.map +1 -1
- package/dist/coordinator/index.js +14 -18
- package/dist/coordinator/index.js.map +1 -1
- package/dist/correlation.d.ts +15 -0
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +26 -8
- package/dist/correlation.js.map +1 -1
- package/dist/duration.d.ts +25 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +47 -0
- package/dist/duration.js.map +1 -0
- package/dist/errors.d.ts +1264 -49
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +698 -46
- package/dist/errors.js.map +1 -1
- package/dist/h3/_internal/client.d.ts +2 -2
- package/dist/h3/_internal/client.d.ts.map +1 -1
- package/dist/h3/_internal/client.js +280 -146
- package/dist/h3/_internal/client.js.map +1 -1
- package/dist/h3/_internal/contracts.d.ts.map +1 -1
- package/dist/h3/_internal/contracts.js +2 -2
- package/dist/h3/_internal/contracts.js.map +1 -1
- package/dist/h3/_internal/deployment.d.ts.map +1 -1
- package/dist/h3/_internal/deployment.js +5 -4
- package/dist/h3/_internal/deployment.js.map +1 -1
- package/dist/h3/_internal/evidence.js +1 -1
- package/dist/h3/_internal/evidence.js.map +1 -1
- package/dist/h3/_internal/operations.d.ts +58 -0
- package/dist/h3/_internal/operations.d.ts.map +1 -0
- package/dist/h3/_internal/operations.js +268 -0
- package/dist/h3/_internal/operations.js.map +1 -0
- package/dist/h3/_internal/references.d.ts.map +1 -1
- package/dist/h3/_internal/references.js +3 -8
- package/dist/h3/_internal/references.js.map +1 -1
- package/dist/h3/_internal/request.js +1 -1
- package/dist/h3/_internal/request.js.map +1 -1
- package/dist/h3/_internal/retained.d.ts +22 -0
- package/dist/h3/_internal/retained.d.ts.map +1 -0
- package/dist/h3/_internal/retained.js +89 -0
- package/dist/h3/_internal/retained.js.map +1 -0
- package/dist/h3/_internal/state.d.ts +15 -1
- package/dist/h3/_internal/state.d.ts.map +1 -1
- package/dist/h3/_internal/state.js +69 -29
- package/dist/h3/_internal/state.js.map +1 -1
- package/dist/h3/index.d.ts +1 -1
- package/dist/h3/index.d.ts.map +1 -1
- package/dist/h3/messages.d.ts +118 -109
- package/dist/h3/messages.d.ts.map +1 -1
- package/dist/h3/messages.js +73 -51
- package/dist/h3/messages.js.map +1 -1
- package/dist/h3/types.d.ts +109 -13
- package/dist/h3/types.d.ts.map +1 -1
- package/dist/host.d.ts +6 -6
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +4 -5
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +13 -6
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +34 -14
- package/dist/json.js.map +1 -1
- package/dist/media-stream.d.ts.map +1 -1
- package/dist/media-stream.js +9 -11
- package/dist/media-stream.js.map +1 -1
- package/dist/observation.d.ts +9 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +20 -18
- package/dist/observation.js.map +1 -1
- package/dist/orchestration/h3-source.d.ts +32 -4
- package/dist/orchestration/h3-source.d.ts.map +1 -1
- package/dist/orchestration/h3-source.js +47 -14
- package/dist/orchestration/h3-source.js.map +1 -1
- package/dist/orchestration/index.d.ts +9 -6
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +5 -3
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/media-buffer.d.ts +12 -4
- package/dist/orchestration/media-buffer.d.ts.map +1 -1
- package/dist/orchestration/media-buffer.js +31 -11
- package/dist/orchestration/media-buffer.js.map +1 -1
- package/dist/orchestration/open-h3.d.ts +65 -0
- package/dist/orchestration/open-h3.d.ts.map +1 -0
- package/dist/orchestration/open-h3.js +65 -0
- package/dist/orchestration/open-h3.js.map +1 -0
- package/dist/orchestration/references.d.ts +5 -1
- package/dist/orchestration/references.d.ts.map +1 -1
- package/dist/orchestration/references.js +37 -34
- package/dist/orchestration/references.js.map +1 -1
- package/dist/orchestration/renewal-state.js +1 -1
- package/dist/orchestration/renewal-state.js.map +1 -1
- package/dist/orchestration/renewal.d.ts +64 -64
- package/dist/orchestration/renewal.d.ts.map +1 -1
- package/dist/orchestration/renewal.js +149 -88
- package/dist/orchestration/renewal.js.map +1 -1
- package/dist/orchestration/request.d.ts +11 -12
- package/dist/orchestration/request.d.ts.map +1 -1
- package/dist/orchestration/request.js +63 -66
- package/dist/orchestration/request.js.map +1 -1
- package/dist/orchestration/routing.d.ts.map +1 -1
- package/dist/orchestration/routing.js +17 -14
- package/dist/orchestration/routing.js.map +1 -1
- package/dist/orchestration/source-slot.d.ts +15 -5
- package/dist/orchestration/source-slot.d.ts.map +1 -1
- package/dist/orchestration/source-slot.js +40 -21
- package/dist/orchestration/source-slot.js.map +1 -1
- package/dist/orchestration/types.d.ts +594 -39
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/orchestration/types.js +20 -0
- package/dist/orchestration/types.js.map +1 -1
- package/dist/protobuf.js +2 -2
- package/dist/protobuf.js.map +1 -1
- package/dist/session/_internal/acquire.d.ts +4 -6
- package/dist/session/_internal/acquire.d.ts.map +1 -1
- package/dist/session/_internal/acquire.js +40 -50
- package/dist/session/_internal/acquire.js.map +1 -1
- package/dist/session/_internal/cleanup.d.ts +2 -1
- package/dist/session/_internal/cleanup.d.ts.map +1 -1
- package/dist/session/_internal/cleanup.js +23 -15
- package/dist/session/_internal/cleanup.js.map +1 -1
- package/dist/session/_internal/lifecycle.d.ts +5 -0
- package/dist/session/_internal/lifecycle.d.ts.map +1 -1
- package/dist/session/_internal/lifecycle.js +16 -6
- package/dist/session/_internal/lifecycle.js.map +1 -1
- package/dist/session/_internal/remote.d.ts.map +1 -1
- package/dist/session/_internal/remote.js +16 -7
- package/dist/session/_internal/remote.js.map +1 -1
- package/dist/session/_internal/uploads.d.ts +4 -1
- package/dist/session/_internal/uploads.d.ts.map +1 -1
- package/dist/session/_internal/uploads.js +25 -27
- package/dist/session/_internal/uploads.js.map +1 -1
- package/dist/session/commands.d.ts +1 -21
- package/dist/session/commands.d.ts.map +1 -1
- package/dist/session/commands.js +1 -12
- package/dist/session/commands.js.map +1 -1
- package/dist/session/files.d.ts +10 -2
- package/dist/session/files.d.ts.map +1 -1
- package/dist/session/files.js +11 -16
- package/dist/session/files.js.map +1 -1
- package/dist/session/index.d.ts +6 -6
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js.map +1 -1
- package/dist/session/media.d.ts +53 -6
- package/dist/session/media.d.ts.map +1 -1
- package/dist/session/recorder.d.ts +24 -0
- package/dist/session/recorder.d.ts.map +1 -0
- package/dist/session/recorder.js +19 -0
- package/dist/session/recorder.js.map +1 -0
- package/dist/session.d.ts +5 -4
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +213 -110
- package/dist/session.js.map +1 -1
- package/dist/simulation/_internal/source.d.ts.map +1 -1
- package/dist/simulation/_internal/source.js +57 -48
- package/dist/simulation/_internal/source.js.map +1 -1
- package/dist/simulation/index.d.ts +4 -5
- package/dist/simulation/index.d.ts.map +1 -1
- package/dist/simulation/index.js +3 -4
- package/dist/simulation/index.js.map +1 -1
- package/dist/simulation/types.d.ts +16 -2
- package/dist/simulation/types.d.ts.map +1 -1
- package/dist/stats.d.ts +19 -0
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +79 -8
- package/dist/stats.js.map +1 -1
- package/package.json +5 -4
- package/notices/owned-webrtc/Effect-MIT.txt +0 -21
- package/notices/owned-webrtc/IETF.txt +0 -43
- package/notices/owned-webrtc/LICENSE +0 -21
- package/notices/owned-webrtc/UPSTREAM.md +0 -20
- package/notices/owned-webrtc/VP8-ADAPTATION.md +0 -32
- package/notices/owned-webrtc/VP8-AUTHORS.txt +0 -42
- package/notices/owned-webrtc/VP8-LICENSE.txt +0 -25
- package/notices/owned-webrtc/VP8-PATENTS.txt +0 -21
- package/notices/owned-webrtc/Werift-MIT.txt +0 -21
- package/notices/owned-webrtc/libvpx-v1.12.0-LICENSE.txt +0 -28
- package/notices/owned-webrtc/libvpx-v1.12.0-PATENTS.txt +0 -22
- package/notices/owned-webrtc/rfc3711.txt +0 -3139
- package/notices/owned-webrtc/str0m-MIT.txt +0 -7
package/dist/h3/messages.d.ts
CHANGED
|
@@ -5,76 +5,81 @@ export declare const Clip: Schema.Struct<{
|
|
|
5
5
|
readonly clip_id: Schema.String;
|
|
6
6
|
readonly prompt: Schema.String;
|
|
7
7
|
readonly metadata: Schema.String;
|
|
8
|
-
readonly frames: Schema.
|
|
9
|
-
readonly seconds: Schema.
|
|
10
|
-
readonly seed: Schema.
|
|
8
|
+
readonly frames: Schema.Int;
|
|
9
|
+
readonly seconds: Schema.Finite;
|
|
10
|
+
readonly seed: Schema.Natural;
|
|
11
11
|
readonly ready: Schema.Boolean;
|
|
12
12
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
13
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
13
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
14
14
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
15
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
15
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
16
16
|
}>;
|
|
17
17
|
export type Clip = typeof Clip.Type;
|
|
18
|
+
/**
|
|
19
|
+
* A clip is in at most one queue position. A retained history entry may
|
|
20
|
+
* describe a clip that is still in playout, but duplicate positions within the
|
|
21
|
+
* queues, or within the history, are ambiguous.
|
|
22
|
+
*/
|
|
18
23
|
export declare const Queue: Schema.Struct<{
|
|
19
24
|
readonly generation: Schema.$Array<Schema.Struct<{
|
|
20
25
|
readonly clip_id: Schema.String;
|
|
21
26
|
readonly prompt: Schema.String;
|
|
22
27
|
readonly metadata: Schema.String;
|
|
23
|
-
readonly frames: Schema.
|
|
24
|
-
readonly seconds: Schema.
|
|
25
|
-
readonly seed: Schema.
|
|
28
|
+
readonly frames: Schema.Int;
|
|
29
|
+
readonly seconds: Schema.Finite;
|
|
30
|
+
readonly seed: Schema.Natural;
|
|
26
31
|
readonly ready: Schema.Boolean;
|
|
27
32
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
28
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
33
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
29
34
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
30
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
35
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
31
36
|
}>>;
|
|
32
37
|
readonly playout: Schema.$Array<Schema.Struct<{
|
|
33
38
|
readonly clip_id: Schema.String;
|
|
34
39
|
readonly prompt: Schema.String;
|
|
35
40
|
readonly metadata: Schema.String;
|
|
36
|
-
readonly frames: Schema.
|
|
37
|
-
readonly seconds: Schema.
|
|
38
|
-
readonly seed: Schema.
|
|
41
|
+
readonly frames: Schema.Int;
|
|
42
|
+
readonly seconds: Schema.Finite;
|
|
43
|
+
readonly seed: Schema.Natural;
|
|
39
44
|
readonly ready: Schema.Boolean;
|
|
40
45
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
41
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
46
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
42
47
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
43
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
48
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
44
49
|
}>>;
|
|
45
50
|
readonly history: Schema.$Array<Schema.Struct<{
|
|
46
51
|
readonly clip_id: Schema.String;
|
|
47
52
|
readonly prompt: Schema.String;
|
|
48
53
|
readonly metadata: Schema.String;
|
|
49
|
-
readonly frames: Schema.
|
|
50
|
-
readonly seconds: Schema.
|
|
51
|
-
readonly seed: Schema.
|
|
54
|
+
readonly frames: Schema.Int;
|
|
55
|
+
readonly seconds: Schema.Finite;
|
|
56
|
+
readonly seed: Schema.Natural;
|
|
52
57
|
readonly ready: Schema.Boolean;
|
|
53
58
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
54
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
59
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
55
60
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
56
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
61
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
57
62
|
}>>;
|
|
58
63
|
}>;
|
|
59
64
|
export type Queue = typeof Queue.Type;
|
|
60
65
|
export declare const State: Schema.Struct<{
|
|
61
|
-
readonly clip_seconds: Schema.
|
|
62
|
-
readonly clip_seconds_min: Schema.
|
|
63
|
-
readonly clip_seconds_max: Schema.
|
|
64
|
-
readonly seed: Schema.
|
|
66
|
+
readonly clip_seconds: Schema.Finite;
|
|
67
|
+
readonly clip_seconds_min: Schema.Finite;
|
|
68
|
+
readonly clip_seconds_max: Schema.Finite;
|
|
69
|
+
readonly seed: Schema.Natural;
|
|
65
70
|
readonly autoplay: Schema.Boolean;
|
|
66
71
|
readonly flush_on_clip_end: Schema.Boolean;
|
|
67
72
|
readonly aspect: Schema.String;
|
|
68
|
-
readonly width: Schema.
|
|
69
|
-
readonly height: Schema.
|
|
73
|
+
readonly width: Schema.Int;
|
|
74
|
+
readonly height: Schema.Int;
|
|
70
75
|
readonly playing: Schema.Boolean;
|
|
71
76
|
readonly playing_clip_id: Schema.NullOr<Schema.String>;
|
|
72
|
-
readonly generation_queued: Schema.
|
|
73
|
-
readonly generation_capacity: Schema.
|
|
74
|
-
readonly playout_queued: Schema.
|
|
75
|
-
readonly playout_capacity: Schema.
|
|
76
|
-
readonly clips_played: Schema.
|
|
77
|
-
readonly seconds_sent: Schema.
|
|
77
|
+
readonly generation_queued: Schema.Natural;
|
|
78
|
+
readonly generation_capacity: Schema.Int;
|
|
79
|
+
readonly playout_queued: Schema.Natural;
|
|
80
|
+
readonly playout_capacity: Schema.Int;
|
|
81
|
+
readonly clips_played: Schema.Natural;
|
|
82
|
+
readonly seconds_sent: Schema.Finite;
|
|
78
83
|
readonly valid_commands: Schema.$Array<Schema.String>;
|
|
79
84
|
}>;
|
|
80
85
|
export type State = typeof State.Type;
|
|
@@ -84,14 +89,14 @@ export declare const Payloads: {
|
|
|
84
89
|
readonly clip_id: Schema.String;
|
|
85
90
|
readonly prompt: Schema.String;
|
|
86
91
|
readonly metadata: Schema.String;
|
|
87
|
-
readonly frames: Schema.
|
|
88
|
-
readonly seconds: Schema.
|
|
89
|
-
readonly seed: Schema.
|
|
92
|
+
readonly frames: Schema.Int;
|
|
93
|
+
readonly seconds: Schema.Finite;
|
|
94
|
+
readonly seed: Schema.Natural;
|
|
90
95
|
readonly ready: Schema.Boolean;
|
|
91
96
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
92
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
97
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
93
98
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
94
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
99
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
95
100
|
}>;
|
|
96
101
|
}>;
|
|
97
102
|
readonly clip_moved: Schema.Struct<{
|
|
@@ -99,31 +104,31 @@ export declare const Payloads: {
|
|
|
99
104
|
readonly clip_id: Schema.String;
|
|
100
105
|
readonly prompt: Schema.String;
|
|
101
106
|
readonly metadata: Schema.String;
|
|
102
|
-
readonly frames: Schema.
|
|
103
|
-
readonly seconds: Schema.
|
|
104
|
-
readonly seed: Schema.
|
|
107
|
+
readonly frames: Schema.Int;
|
|
108
|
+
readonly seconds: Schema.Finite;
|
|
109
|
+
readonly seed: Schema.Natural;
|
|
105
110
|
readonly ready: Schema.Boolean;
|
|
106
111
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
107
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
112
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
108
113
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
109
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
114
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
110
115
|
}>;
|
|
111
116
|
readonly queue: Schema.Literals<readonly ["generation", "playout"]>;
|
|
112
|
-
readonly position: Schema.
|
|
117
|
+
readonly position: Schema.Natural;
|
|
113
118
|
}>;
|
|
114
119
|
readonly clip_popped: Schema.Struct<{
|
|
115
120
|
readonly clip: Schema.Struct<{
|
|
116
121
|
readonly clip_id: Schema.String;
|
|
117
122
|
readonly prompt: Schema.String;
|
|
118
123
|
readonly metadata: Schema.String;
|
|
119
|
-
readonly frames: Schema.
|
|
120
|
-
readonly seconds: Schema.
|
|
121
|
-
readonly seed: Schema.
|
|
124
|
+
readonly frames: Schema.Int;
|
|
125
|
+
readonly seconds: Schema.Finite;
|
|
126
|
+
readonly seed: Schema.Natural;
|
|
122
127
|
readonly ready: Schema.Boolean;
|
|
123
128
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
124
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
129
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
125
130
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
126
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
131
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
127
132
|
}>;
|
|
128
133
|
}>;
|
|
129
134
|
readonly clip_generated: Schema.Struct<{
|
|
@@ -131,14 +136,14 @@ export declare const Payloads: {
|
|
|
131
136
|
readonly clip_id: Schema.String;
|
|
132
137
|
readonly prompt: Schema.String;
|
|
133
138
|
readonly metadata: Schema.String;
|
|
134
|
-
readonly frames: Schema.
|
|
135
|
-
readonly seconds: Schema.
|
|
136
|
-
readonly seed: Schema.
|
|
139
|
+
readonly frames: Schema.Int;
|
|
140
|
+
readonly seconds: Schema.Finite;
|
|
141
|
+
readonly seed: Schema.Natural;
|
|
137
142
|
readonly ready: Schema.Boolean;
|
|
138
143
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
139
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
144
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
140
145
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
141
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
146
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
142
147
|
}>;
|
|
143
148
|
}>;
|
|
144
149
|
readonly clip_failed: Schema.Struct<{
|
|
@@ -146,14 +151,14 @@ export declare const Payloads: {
|
|
|
146
151
|
readonly clip_id: Schema.String;
|
|
147
152
|
readonly prompt: Schema.String;
|
|
148
153
|
readonly metadata: Schema.String;
|
|
149
|
-
readonly frames: Schema.
|
|
150
|
-
readonly seconds: Schema.
|
|
151
|
-
readonly seed: Schema.
|
|
154
|
+
readonly frames: Schema.Int;
|
|
155
|
+
readonly seconds: Schema.Finite;
|
|
156
|
+
readonly seed: Schema.Natural;
|
|
152
157
|
readonly ready: Schema.Boolean;
|
|
153
158
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
154
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
159
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
155
160
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
156
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
161
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
157
162
|
}>;
|
|
158
163
|
readonly reason: Schema.String;
|
|
159
164
|
}>;
|
|
@@ -162,14 +167,14 @@ export declare const Payloads: {
|
|
|
162
167
|
readonly clip_id: Schema.String;
|
|
163
168
|
readonly prompt: Schema.String;
|
|
164
169
|
readonly metadata: Schema.String;
|
|
165
|
-
readonly frames: Schema.
|
|
166
|
-
readonly seconds: Schema.
|
|
167
|
-
readonly seed: Schema.
|
|
170
|
+
readonly frames: Schema.Int;
|
|
171
|
+
readonly seconds: Schema.Finite;
|
|
172
|
+
readonly seed: Schema.Natural;
|
|
168
173
|
readonly ready: Schema.Boolean;
|
|
169
174
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
170
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
175
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
171
176
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
172
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
177
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
173
178
|
}>;
|
|
174
179
|
}>;
|
|
175
180
|
readonly clip_finished: Schema.Struct<{
|
|
@@ -177,92 +182,92 @@ export declare const Payloads: {
|
|
|
177
182
|
readonly clip_id: Schema.String;
|
|
178
183
|
readonly prompt: Schema.String;
|
|
179
184
|
readonly metadata: Schema.String;
|
|
180
|
-
readonly frames: Schema.
|
|
181
|
-
readonly seconds: Schema.
|
|
182
|
-
readonly seed: Schema.
|
|
185
|
+
readonly frames: Schema.Int;
|
|
186
|
+
readonly seconds: Schema.Finite;
|
|
187
|
+
readonly seed: Schema.Natural;
|
|
183
188
|
readonly ready: Schema.Boolean;
|
|
184
189
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
185
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
190
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
186
191
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
187
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
192
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
188
193
|
}>;
|
|
189
|
-
readonly seconds_sent: Schema.
|
|
194
|
+
readonly seconds_sent: Schema.Finite;
|
|
190
195
|
}>;
|
|
191
196
|
readonly clip_stopped: Schema.Struct<{
|
|
192
197
|
readonly clip: Schema.Struct<{
|
|
193
198
|
readonly clip_id: Schema.String;
|
|
194
199
|
readonly prompt: Schema.String;
|
|
195
200
|
readonly metadata: Schema.String;
|
|
196
|
-
readonly frames: Schema.
|
|
197
|
-
readonly seconds: Schema.
|
|
198
|
-
readonly seed: Schema.
|
|
201
|
+
readonly frames: Schema.Int;
|
|
202
|
+
readonly seconds: Schema.Finite;
|
|
203
|
+
readonly seed: Schema.Natural;
|
|
199
204
|
readonly ready: Schema.Boolean;
|
|
200
205
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
201
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
206
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
202
207
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
203
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
208
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
204
209
|
}>;
|
|
205
|
-
readonly seconds_sent: Schema.
|
|
210
|
+
readonly seconds_sent: Schema.Finite;
|
|
206
211
|
}>;
|
|
207
212
|
readonly queue_update: Schema.Struct<{
|
|
208
213
|
readonly generation: Schema.$Array<Schema.Struct<{
|
|
209
214
|
readonly clip_id: Schema.String;
|
|
210
215
|
readonly prompt: Schema.String;
|
|
211
216
|
readonly metadata: Schema.String;
|
|
212
|
-
readonly frames: Schema.
|
|
213
|
-
readonly seconds: Schema.
|
|
214
|
-
readonly seed: Schema.
|
|
217
|
+
readonly frames: Schema.Int;
|
|
218
|
+
readonly seconds: Schema.Finite;
|
|
219
|
+
readonly seed: Schema.Natural;
|
|
215
220
|
readonly ready: Schema.Boolean;
|
|
216
221
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
217
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
222
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
218
223
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
219
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
224
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
220
225
|
}>>;
|
|
221
226
|
readonly playout: Schema.$Array<Schema.Struct<{
|
|
222
227
|
readonly clip_id: Schema.String;
|
|
223
228
|
readonly prompt: Schema.String;
|
|
224
229
|
readonly metadata: Schema.String;
|
|
225
|
-
readonly frames: Schema.
|
|
226
|
-
readonly seconds: Schema.
|
|
227
|
-
readonly seed: Schema.
|
|
230
|
+
readonly frames: Schema.Int;
|
|
231
|
+
readonly seconds: Schema.Finite;
|
|
232
|
+
readonly seed: Schema.Natural;
|
|
228
233
|
readonly ready: Schema.Boolean;
|
|
229
234
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
230
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
235
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
231
236
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
232
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
237
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
233
238
|
}>>;
|
|
234
239
|
readonly history: Schema.$Array<Schema.Struct<{
|
|
235
240
|
readonly clip_id: Schema.String;
|
|
236
241
|
readonly prompt: Schema.String;
|
|
237
242
|
readonly metadata: Schema.String;
|
|
238
|
-
readonly frames: Schema.
|
|
239
|
-
readonly seconds: Schema.
|
|
240
|
-
readonly seed: Schema.
|
|
243
|
+
readonly frames: Schema.Int;
|
|
244
|
+
readonly seconds: Schema.Finite;
|
|
245
|
+
readonly seed: Schema.Natural;
|
|
241
246
|
readonly ready: Schema.Boolean;
|
|
242
247
|
readonly has_reference_image: Schema.optionalKey<Schema.Boolean>;
|
|
243
|
-
readonly reference_image_count: Schema.optionalKey<Schema.
|
|
248
|
+
readonly reference_image_count: Schema.optionalKey<Schema.Natural>;
|
|
244
249
|
readonly has_reference_audio: Schema.optionalKey<Schema.Boolean>;
|
|
245
|
-
readonly reference_audio_count: Schema.optionalKey<Schema.
|
|
250
|
+
readonly reference_audio_count: Schema.optionalKey<Schema.Natural>;
|
|
246
251
|
}>>;
|
|
247
252
|
}>;
|
|
248
253
|
readonly state_update: Schema.Struct<{
|
|
249
|
-
readonly clip_seconds: Schema.
|
|
250
|
-
readonly clip_seconds_min: Schema.
|
|
251
|
-
readonly clip_seconds_max: Schema.
|
|
252
|
-
readonly seed: Schema.
|
|
254
|
+
readonly clip_seconds: Schema.Finite;
|
|
255
|
+
readonly clip_seconds_min: Schema.Finite;
|
|
256
|
+
readonly clip_seconds_max: Schema.Finite;
|
|
257
|
+
readonly seed: Schema.Natural;
|
|
253
258
|
readonly autoplay: Schema.Boolean;
|
|
254
259
|
readonly flush_on_clip_end: Schema.Boolean;
|
|
255
260
|
readonly aspect: Schema.String;
|
|
256
|
-
readonly width: Schema.
|
|
257
|
-
readonly height: Schema.
|
|
261
|
+
readonly width: Schema.Int;
|
|
262
|
+
readonly height: Schema.Int;
|
|
258
263
|
readonly playing: Schema.Boolean;
|
|
259
264
|
readonly playing_clip_id: Schema.NullOr<Schema.String>;
|
|
260
|
-
readonly generation_queued: Schema.
|
|
261
|
-
readonly generation_capacity: Schema.
|
|
262
|
-
readonly playout_queued: Schema.
|
|
263
|
-
readonly playout_capacity: Schema.
|
|
264
|
-
readonly clips_played: Schema.
|
|
265
|
-
readonly seconds_sent: Schema.
|
|
265
|
+
readonly generation_queued: Schema.Natural;
|
|
266
|
+
readonly generation_capacity: Schema.Int;
|
|
267
|
+
readonly playout_queued: Schema.Natural;
|
|
268
|
+
readonly playout_capacity: Schema.Int;
|
|
269
|
+
readonly clips_played: Schema.Natural;
|
|
270
|
+
readonly seconds_sent: Schema.Finite;
|
|
266
271
|
readonly valid_commands: Schema.$Array<Schema.String>;
|
|
267
272
|
}>;
|
|
268
273
|
readonly command_error: Schema.Struct<{
|
|
@@ -270,16 +275,16 @@ export declare const Payloads: {
|
|
|
270
275
|
readonly reason: Schema.String;
|
|
271
276
|
}>;
|
|
272
277
|
readonly seed_accepted: Schema.Struct<{
|
|
273
|
-
readonly seed: Schema.
|
|
278
|
+
readonly seed: Schema.Natural;
|
|
274
279
|
}>;
|
|
275
280
|
readonly clip_length_accepted: Schema.Struct<{
|
|
276
|
-
readonly clip_seconds: Schema.
|
|
277
|
-
readonly frames: Schema.
|
|
281
|
+
readonly clip_seconds: Schema.Finite;
|
|
282
|
+
readonly frames: Schema.Int;
|
|
278
283
|
}>;
|
|
279
284
|
readonly canvas_accepted: Schema.Struct<{
|
|
280
285
|
readonly aspect: Schema.String;
|
|
281
|
-
readonly width: Schema.
|
|
282
|
-
readonly height: Schema.
|
|
286
|
+
readonly width: Schema.Int;
|
|
287
|
+
readonly height: Schema.Int;
|
|
283
288
|
}>;
|
|
284
289
|
readonly autoplay_accepted: Schema.Struct<{
|
|
285
290
|
readonly enabled: Schema.Boolean;
|
|
@@ -288,7 +293,7 @@ export declare const Payloads: {
|
|
|
288
293
|
readonly enabled: Schema.Boolean;
|
|
289
294
|
}>;
|
|
290
295
|
readonly session_reset: Schema.Struct<{
|
|
291
|
-
readonly cleared_clips: Schema.
|
|
296
|
+
readonly cleared_clips: Schema.Natural;
|
|
292
297
|
readonly was_playing: Schema.Boolean;
|
|
293
298
|
}>;
|
|
294
299
|
};
|
|
@@ -305,6 +310,10 @@ export type DecodedMessage = Message | {
|
|
|
305
310
|
readonly name: string;
|
|
306
311
|
readonly data: JsonObject | undefined;
|
|
307
312
|
};
|
|
308
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* Unknown events remain observable. A known message never accepts a partial
|
|
315
|
+
* payload: its Schema, cross-field rules included, rejects it as Protocol, and
|
|
316
|
+
* a bug in these checks stays a defect.
|
|
317
|
+
*/
|
|
309
318
|
export declare const decodeMessage: (type: string, input: unknown) => DecodedMessage;
|
|
310
319
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/h3/messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/h3/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAK7C,kFAAkF;AAClF,eAAO,MAAM,IAAI;;;;;;;;;;;;EAYf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAWpC;;;;GAIG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;EA+BjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,eAAO,MAAM,QAAQ;aACnB,WAAW;;;;;;;;;;;;;;;aACX,UAAU;;;;;;;;;;;;;;;;;aAKV,WAAW;;;;;;;;;;;;;;;aACX,cAAc;;;;;;;;;;;;;;;aACd,WAAW;;;;;;;;;;;;;;;;aACX,YAAY;;;;;;;;;;;;;;;aACZ,aAAa;;;;;;;;;;;;;;;;aACb,YAAY;;;;;;;;;;;;;;;;aACZ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACZ,YAAY;;;;;;;;;;;;;;;;;;;;aACZ,aAAa;;;;aACb,aAAa;;;aACb,oBAAoB;;;;aACpB,eAAe;;;;;aACf,iBAAiB;;;aACjB,cAAc;;;aACd,aAAa;;;;CACL,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAC;AAChD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1E,MAAM,MAAM,OAAO,GAAG;KACnB,CAAC,IAAI,WAAW,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;KAAE;CACpE,CAAC,WAAW,CAAC,CAAC;AACf,MAAM,MAAM,cAAc,GACtB,OAAO,GACP;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAA;CAAE,CAAC;AAiB/F;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,SAAS,OAAO,KAAG,cAU5D,CAAC"}
|
package/dist/h3/messages.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import * as Result from "effect/Result";
|
|
1
2
|
import * as Schema from "effect/Schema";
|
|
2
3
|
import { ReactorError } from "../errors.js";
|
|
3
4
|
import { jsonObject } from "../json.js";
|
|
4
|
-
const
|
|
5
|
-
const Integer = NumberValue.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));
|
|
6
|
-
const Positive = Integer.check(Schema.isGreaterThan(0));
|
|
5
|
+
const Positive = Schema.Int.check(Schema.isGreaterThan(0));
|
|
7
6
|
const Id = Schema.String.check(Schema.isUUID());
|
|
8
7
|
/** Required fields follow the H3 Reference Turbo Realtime 0.5.5 documentation. */
|
|
9
8
|
export const Clip = Schema.Struct({
|
|
@@ -11,24 +10,50 @@ export const Clip = Schema.Struct({
|
|
|
11
10
|
prompt: Schema.String,
|
|
12
11
|
metadata: Schema.String,
|
|
13
12
|
frames: Positive,
|
|
14
|
-
seconds:
|
|
15
|
-
seed:
|
|
13
|
+
seconds: Schema.Finite.check(Schema.isGreaterThan(0)),
|
|
14
|
+
seed: Schema.Natural,
|
|
16
15
|
ready: Schema.Boolean,
|
|
17
16
|
has_reference_image: Schema.optionalKey(Schema.Boolean),
|
|
18
|
-
reference_image_count: Schema.optionalKey(
|
|
17
|
+
reference_image_count: Schema.optionalKey(Schema.Natural),
|
|
19
18
|
has_reference_audio: Schema.optionalKey(Schema.Boolean),
|
|
20
|
-
reference_audio_count: Schema.optionalKey(
|
|
19
|
+
reference_audio_count: Schema.optionalKey(Schema.Natural),
|
|
21
20
|
});
|
|
21
|
+
/** The first repeated clip id in `clips`, as its index. */
|
|
22
|
+
const repeated = (clips, seen = new Set()) => {
|
|
23
|
+
for (const [index, clip] of clips.entries()) {
|
|
24
|
+
if (seen.has(clip.clip_id))
|
|
25
|
+
return index;
|
|
26
|
+
seen.add(clip.clip_id);
|
|
27
|
+
}
|
|
28
|
+
return -1;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A clip is in at most one queue position. A retained history entry may
|
|
32
|
+
* describe a clip that is still in playout, but duplicate positions within the
|
|
33
|
+
* queues, or within the history, are ambiguous.
|
|
34
|
+
*/
|
|
22
35
|
export const Queue = Schema.Struct({
|
|
23
36
|
generation: Schema.Array(Clip),
|
|
24
37
|
playout: Schema.Array(Clip),
|
|
25
38
|
history: Schema.Array(Clip),
|
|
26
|
-
})
|
|
39
|
+
}).check(Schema.makeFilter((queue) => {
|
|
40
|
+
const queued = new Set();
|
|
41
|
+
const generation = repeated(queue.generation, queued);
|
|
42
|
+
if (generation >= 0)
|
|
43
|
+
return { path: ["generation", generation, "clip_id"], issue: "clip is queued twice" };
|
|
44
|
+
const playout = repeated(queue.playout, queued);
|
|
45
|
+
if (playout >= 0)
|
|
46
|
+
return { path: ["playout", playout, "clip_id"], issue: "clip is queued twice" };
|
|
47
|
+
const history = repeated(queue.history);
|
|
48
|
+
if (history >= 0)
|
|
49
|
+
return { path: ["history", history, "clip_id"], issue: "clip is in history twice" };
|
|
50
|
+
return undefined;
|
|
51
|
+
}));
|
|
27
52
|
export const State = Schema.Struct({
|
|
28
|
-
clip_seconds:
|
|
29
|
-
clip_seconds_min:
|
|
30
|
-
clip_seconds_max:
|
|
31
|
-
seed:
|
|
53
|
+
clip_seconds: Schema.Finite,
|
|
54
|
+
clip_seconds_min: Schema.Finite,
|
|
55
|
+
clip_seconds_max: Schema.Finite,
|
|
56
|
+
seed: Schema.Natural,
|
|
32
57
|
autoplay: Schema.Boolean,
|
|
33
58
|
flush_on_clip_end: Schema.Boolean,
|
|
34
59
|
aspect: Schema.String,
|
|
@@ -36,36 +61,47 @@ export const State = Schema.Struct({
|
|
|
36
61
|
height: Positive,
|
|
37
62
|
playing: Schema.Boolean,
|
|
38
63
|
playing_clip_id: Schema.NullOr(Id),
|
|
39
|
-
generation_queued:
|
|
64
|
+
generation_queued: Schema.Natural,
|
|
40
65
|
generation_capacity: Positive,
|
|
41
|
-
playout_queued:
|
|
66
|
+
playout_queued: Schema.Natural,
|
|
42
67
|
playout_capacity: Positive,
|
|
43
|
-
clips_played:
|
|
44
|
-
seconds_sent:
|
|
68
|
+
clips_played: Schema.Natural,
|
|
69
|
+
seconds_sent: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
45
70
|
valid_commands: Schema.Array(Schema.String),
|
|
46
|
-
})
|
|
71
|
+
}).check(Schema.makeFilter((state) => {
|
|
72
|
+
const issues = [];
|
|
73
|
+
if (state.clip_seconds_min <= 0)
|
|
74
|
+
issues.push({ path: ["clip_seconds_min"], issue: "must be positive" });
|
|
75
|
+
if (state.clip_seconds_max < state.clip_seconds_min)
|
|
76
|
+
issues.push({ path: ["clip_seconds_max"], issue: "must be at least clip_seconds_min" });
|
|
77
|
+
if (state.clip_seconds <= 0)
|
|
78
|
+
issues.push({ path: ["clip_seconds"], issue: "must be positive" });
|
|
79
|
+
if (state.playing !== (state.playing_clip_id !== null))
|
|
80
|
+
issues.push({ path: ["playing_clip_id"], issue: "must be set exactly while playing" });
|
|
81
|
+
return issues;
|
|
82
|
+
}));
|
|
47
83
|
export const Payloads = {
|
|
48
84
|
clip_queued: Schema.Struct({ clip: Clip }),
|
|
49
85
|
clip_moved: Schema.Struct({
|
|
50
86
|
clip: Clip,
|
|
51
87
|
queue: Schema.Literals(["generation", "playout"]),
|
|
52
|
-
position:
|
|
88
|
+
position: Schema.Natural,
|
|
53
89
|
}),
|
|
54
90
|
clip_popped: Schema.Struct({ clip: Clip }),
|
|
55
91
|
clip_generated: Schema.Struct({ clip: Clip }),
|
|
56
92
|
clip_failed: Schema.Struct({ clip: Clip, reason: Schema.String }),
|
|
57
93
|
clip_started: Schema.Struct({ clip: Clip }),
|
|
58
|
-
clip_finished: Schema.Struct({ clip: Clip, seconds_sent:
|
|
59
|
-
clip_stopped: Schema.Struct({ clip: Clip, seconds_sent:
|
|
94
|
+
clip_finished: Schema.Struct({ clip: Clip, seconds_sent: Schema.Finite }),
|
|
95
|
+
clip_stopped: Schema.Struct({ clip: Clip, seconds_sent: Schema.Finite }),
|
|
60
96
|
queue_update: Queue,
|
|
61
97
|
state_update: State,
|
|
62
98
|
command_error: Schema.Struct({ command: Schema.String, reason: Schema.String }),
|
|
63
|
-
seed_accepted: Schema.Struct({ seed:
|
|
64
|
-
clip_length_accepted: Schema.Struct({ clip_seconds:
|
|
99
|
+
seed_accepted: Schema.Struct({ seed: Schema.Natural }),
|
|
100
|
+
clip_length_accepted: Schema.Struct({ clip_seconds: Schema.Finite, frames: Positive }),
|
|
65
101
|
canvas_accepted: Schema.Struct({ aspect: Schema.String, width: Positive, height: Positive }),
|
|
66
102
|
autoplay_accepted: Schema.Struct({ enabled: Schema.Boolean }),
|
|
67
103
|
flush_accepted: Schema.Struct({ enabled: Schema.Boolean }),
|
|
68
|
-
session_reset: Schema.Struct({ cleared_clips:
|
|
104
|
+
session_reset: Schema.Struct({ cleared_clips: Schema.Natural, was_playing: Schema.Boolean }),
|
|
69
105
|
};
|
|
70
106
|
const freeze = (value) => {
|
|
71
107
|
if (value !== null && typeof value === "object") {
|
|
@@ -75,7 +111,16 @@ const freeze = (value) => {
|
|
|
75
111
|
}
|
|
76
112
|
return value;
|
|
77
113
|
};
|
|
78
|
-
/**
|
|
114
|
+
/** The `SchemaError`, which names the path but no input value, stays in `detail`. */
|
|
115
|
+
const malformed = (type, cause) => ReactorError.fromCode("Protocol", `H3 ${type} payload is malformed`, {
|
|
116
|
+
operation: "h3 observation",
|
|
117
|
+
detail: cause,
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Unknown events remain observable. A known message never accepts a partial
|
|
121
|
+
* payload: its Schema, cross-field rules included, rejects it as Protocol, and
|
|
122
|
+
* a bug in these checks stays a defect.
|
|
123
|
+
*/
|
|
79
124
|
export const decodeMessage = (type, input) => {
|
|
80
125
|
if (!Object.hasOwn(Payloads, type))
|
|
81
126
|
return Object.freeze({
|
|
@@ -83,32 +128,9 @@ export const decodeMessage = (type, input) => {
|
|
|
83
128
|
name: type,
|
|
84
129
|
data: input === undefined ? undefined : jsonObject(input),
|
|
85
130
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (message.type === "state_update") {
|
|
91
|
-
const state = message.data;
|
|
92
|
-
if (state.clip_seconds_min <= 0 ||
|
|
93
|
-
state.clip_seconds_max < state.clip_seconds_min ||
|
|
94
|
-
state.clip_seconds <= 0 ||
|
|
95
|
-
state.playing !== (state.playing_clip_id !== null))
|
|
96
|
-
throw new Error("inconsistent state");
|
|
97
|
-
}
|
|
98
|
-
if (message.type === "queue_update") {
|
|
99
|
-
const queued = [...message.data.generation, ...message.data.playout].map((clip) => clip.clip_id);
|
|
100
|
-
const history = message.data.history.map((clip) => clip.clip_id);
|
|
101
|
-
// A retained history entry may describe a clip that is still in playout;
|
|
102
|
-
// duplicate positions within queues/history remain ambiguous.
|
|
103
|
-
if (new Set(queued).size !== queued.length || new Set(history).size !== history.length)
|
|
104
|
-
throw new Error("duplicate queue identity");
|
|
105
|
-
}
|
|
106
|
-
return freeze(message);
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
throw new ReactorError("Protocol", `H3 ${type} payload is malformed`, {
|
|
110
|
-
operation: "h3 observation",
|
|
111
|
-
});
|
|
112
|
-
}
|
|
131
|
+
const decoded = Schema.decodeUnknownResult(Payloads[type])(input);
|
|
132
|
+
if (Result.isFailure(decoded))
|
|
133
|
+
throw malformed(type, decoded.failure);
|
|
134
|
+
return freeze({ type, data: decoded.success });
|
|
113
135
|
};
|
|
114
136
|
//# sourceMappingURL=messages.js.map
|
package/dist/h3/messages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/h3/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/h3/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CA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